This repository has been archived by the owner on Apr 15, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #340 from servicecatalog/fb_k5_openstack_enhance
Pull request Update keystone API v2 to v3
- Loading branch information
Showing
21 changed files
with
1,097 additions
and
424 deletions.
There are no files selected for viewing
258 changes: 211 additions & 47 deletions
258
oscm-app-openstack-unittests/javasrc/org/oscm/app/openstack/HeatProcessorTest.java
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
109 changes: 109 additions & 0 deletions
109
oscm-app-openstack-unittests/javasrc/org/oscm/app/openstack/MockHttpsURLConnection.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
/******************************************************************************* | ||
* | ||
* Copyright FUJITSU LIMITED 2016 | ||
* | ||
* Creation Date: 26.07.2016 | ||
* | ||
*******************************************************************************/ | ||
package org.oscm.app.openstack; | ||
|
||
import java.io.ByteArrayInputStream; | ||
import java.io.IOException; | ||
import java.io.InputStream; | ||
import java.io.OutputStream; | ||
import java.io.StringWriter; | ||
import java.security.cert.Certificate; | ||
|
||
import javax.net.ssl.HttpsURLConnection; | ||
import javax.net.ssl.SSLPeerUnverifiedException; | ||
|
||
public class MockHttpsURLConnection extends HttpsURLConnection { | ||
private String error; | ||
private String input; | ||
private String output; | ||
protected int responseCode; | ||
private StringWriter inputWriter = new StringWriter(); | ||
|
||
public MockHttpsURLConnection(int responseCode, String output) { | ||
super(null); | ||
this.output = output; | ||
this.responseCode = responseCode; | ||
|
||
} | ||
|
||
@Override | ||
public String getCipherSuite() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public Certificate[] getLocalCertificates() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public Certificate[] getServerCertificates() | ||
throws SSLPeerUnverifiedException { | ||
return null; | ||
} | ||
|
||
@Override | ||
public void disconnect() { | ||
|
||
} | ||
|
||
@Override | ||
public boolean usingProxy() { | ||
return false; | ||
} | ||
|
||
@Override | ||
public void connect() throws IOException { | ||
|
||
} | ||
@Override | ||
public InputStream getInputStream() throws IOException { | ||
connect(); | ||
if (output == null) { | ||
output = ""; | ||
} | ||
return new ByteArrayInputStream(output.getBytes()); | ||
} | ||
|
||
@Override | ||
public InputStream getErrorStream() { | ||
if (error == null) { | ||
error = ""; | ||
} | ||
return new ByteArrayInputStream(error.getBytes()); | ||
} | ||
|
||
@Override | ||
public OutputStream getOutputStream() throws IOException { | ||
return new OutputStream() { | ||
@Override | ||
public void write(int b) throws IOException { | ||
inputWriter.write(b); | ||
} | ||
}; | ||
} | ||
public String getInput() { | ||
if (!connected) { | ||
throw new IllegalStateException("Not connected"); | ||
} | ||
return input; | ||
} | ||
|
||
@Override | ||
public int getResponseCode() throws IOException { | ||
return responseCode; | ||
} | ||
|
||
@Override | ||
public String getHeaderField(String name){ | ||
if((name).equals("X-Subject-Token")){ | ||
return "authToken"; | ||
} | ||
return super.getHeaderField(name); | ||
} | ||
} |
Oops, something went wrong.