diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 00000000..bb6447a0
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,6 @@
+language: java
+
+jdk:
+ - openjdk7
+
+script: mvn package
diff --git a/README.md b/README.md
index f416162f..706b3a93 100755
--- a/README.md
+++ b/README.md
@@ -1,9 +1,15 @@
-OpenShift Java Client
+OpenShift Java Client [](https://travis-ci.org/openshift/openshift-java-client) [](https://maven-badges.herokuapp.com/maven-central/com.openshift/openshift-java-client)
===========================
Java client for the OpenShift REST API. It pretty much offers all features that are currently available in the rhc-* command line tools
(create/rename a domain, create/destroy applications, list applications, list available cartridges, add cartridges, etc.).
-This client is used by JBoss Tools for OpenShift.
+
+Only for Version 2
+----------------
+
+This client is used by JBoss Tools for OpenShift 2.x.
+
+For later OpenShift versions see https://github.com/openshift/openshift-restclient-java/.
Usage
-----
diff --git a/pom.xml b/pom.xml
index 3eecf5f3..8b23f7be 100755
--- a/pom.xml
+++ b/pom.xml
@@ -17,7 +17,7 @@
com.openshift
openshift-java-client
- 2.7.0.Final
+ 2.8.0-SNAPSHOT
jar
OpenShift Java Client
http://openshift.redhat.com
diff --git a/src/main/java/com/openshift/client/ConnectionBuilder.java b/src/main/java/com/openshift/client/ConnectionBuilder.java
index 521bdc20..da624469 100644
--- a/src/main/java/com/openshift/client/ConnectionBuilder.java
+++ b/src/main/java/com/openshift/client/ConnectionBuilder.java
@@ -97,8 +97,8 @@ public IOpenShiftConnection create() {
clientId,
null,
null,
- authIV,
authKey,
+ authIV,
null,
serverUrl,
timeout,
@@ -234,12 +234,12 @@ protected IRestService createRestService(IHttpClient httpClient) {
public IHttpClient createHttpClient(final String clientId, final String username, final String password,
final String authKey, final String authIV, final String token, final String serverUrl,
- final int timeout, final ISSLCertificateCallback sslCertificateCallback, String exludeSSLCipherRegex) {
+ final int timeout, final ISSLCertificateCallback sslCertificateCallback, String excludeSSLCipherRegex) {
return new UrlConnectionHttpClientBuilder()
.setCredentials(username, password, authKey, authIV, token)
.setConfigTimeout(timeout)
.setSSLCertificateCallback(sslCertificateCallback)
- .excludeSSLCipher(exludeSSLCipherRegex)
+ .excludeSSLCipher(excludeSSLCipherRegex)
.client();
}
diff --git a/src/main/java/com/openshift/client/HttpMethod.java b/src/main/java/com/openshift/client/HttpMethod.java
index 89c65419..c625dfaa 100644
--- a/src/main/java/com/openshift/client/HttpMethod.java
+++ b/src/main/java/com/openshift/client/HttpMethod.java
@@ -23,10 +23,8 @@ public enum HttpMethod {
* @return true if the value can be safely converted to the enum; false otherwise
*/
public static boolean hasValue(String value) {
- HttpMethod[] enumConstants = HttpMethod.class.getEnumConstants();
- for (int i = 0; i < enumConstants.length; i++) {
- HttpMethod httpMethod = enumConstants[i];
- if(httpMethod.name().equalsIgnoreCase(value)){
+ for (HttpMethod m : HttpMethod.values()) {
+ if(m.name().equalsIgnoreCase(value)){
return true;
}
}
diff --git a/src/main/java/com/openshift/client/IApplication.java b/src/main/java/com/openshift/client/IApplication.java
index 433443ba..e1162803 100755
--- a/src/main/java/com/openshift/client/IApplication.java
+++ b/src/main/java/com/openshift/client/IApplication.java
@@ -413,9 +413,9 @@ public IEmbeddedCartridge getEmbeddedCartridge(IEmbeddableCartridge cartridge)
* @return true if the port-forwarding has been started, false otherwise.
* @throws OpenShiftSSHOperationException
*
- * @deprecated use {@link IApplicationSSHSession#isPortFowardingStarted()}
+ * @deprecated use {@link IApplicationSSHSession#isPortForwardingStarted()}
*/
- public boolean isPortFowardingStarted() throws OpenShiftSSHOperationException;
+ public boolean isPortForwardingStarted() throws OpenShiftSSHOperationException;
/**
* Returns the list of forwardable ports on OpenShift for this application.
diff --git a/src/main/java/com/openshift/client/IApplicationSSHSession.java b/src/main/java/com/openshift/client/IApplicationSSHSession.java
index 2b5e6edc..147bfe11 100644
--- a/src/main/java/com/openshift/client/IApplicationSSHSession.java
+++ b/src/main/java/com/openshift/client/IApplicationSSHSession.java
@@ -88,7 +88,7 @@ public interface IApplicationSSHSession {
* @return true if the port-forwarding has been started, false otherwise.
* @throws OpenShiftSSHOperationException
*/
- public boolean isPortFowardingStarted() throws OpenShiftSSHOperationException;
+ public boolean isPortForwardingStarted() throws OpenShiftSSHOperationException;
}
diff --git a/src/main/java/com/openshift/client/IDomain.java b/src/main/java/com/openshift/client/IDomain.java
index d562075e..055d1d3e 100755
--- a/src/main/java/com/openshift/client/IDomain.java
+++ b/src/main/java/com/openshift/client/IDomain.java
@@ -92,6 +92,10 @@ public IApplication createApplication(String name, IStandaloneCartridge cartridg
IGearProfile gearProfile)
throws OpenShiftException;
+ public IApplication createApplication(String name, IStandaloneCartridge cartridge, ApplicationScale scale, String region,
+ IGearProfile gearProfile)
+ throws OpenShiftException;
+
/**
* Creates a new application with the given name and the given
* cartridge/framework. Optionally, adds scalability and a specific gear
diff --git a/src/main/java/com/openshift/client/IOpenShiftResource.java b/src/main/java/com/openshift/client/IOpenShiftResource.java
index cd6d976b..41ffa5fc 100644
--- a/src/main/java/com/openshift/client/IOpenShiftResource.java
+++ b/src/main/java/com/openshift/client/IOpenShiftResource.java
@@ -9,7 +9,7 @@ public interface IOpenShiftResource {
* Creation logs are only available at creation time. So resources that were retrieved
* while they already existed wont have a creation log.
*
- * @return true if there's cretion log for this resource
+ * @return true if there's creation log for this resource
*/
public boolean hasCreationLog();
@@ -23,7 +23,7 @@ public interface IOpenShiftResource {
/**
* Returns all the (creation log) messages. These messages only exist at
* creation time. Existing cartridges, that were added in a prior session
- * dont have any messages any more.
+ * don't have any messages any more.
*
* @return all messages by field
*
diff --git a/src/main/java/com/openshift/client/IUser.java b/src/main/java/com/openshift/client/IUser.java
index dc27eaf2..aa44bfd4 100755
--- a/src/main/java/com/openshift/client/IUser.java
+++ b/src/main/java/com/openshift/client/IUser.java
@@ -134,14 +134,14 @@ public interface IUser extends IOpenShiftResource {
*/
public IOpenShiftSSHKey addSSHKey(String name, ISSHPublicKey key) throws OpenShiftException;
- public IOpenShiftSSHKey getSSHKeyByName(String name) throws OpenShiftUnknonwSSHKeyTypeException, OpenShiftException;
+ public IOpenShiftSSHKey getSSHKeyByName(String name) throws OpenShiftUnknownSSHKeyTypeException, OpenShiftException;
- public IOpenShiftSSHKey getSSHKeyByPublicKey(String publicKey) throws OpenShiftUnknonwSSHKeyTypeException,
+ public IOpenShiftSSHKey getSSHKeyByPublicKey(String publicKey) throws OpenShiftUnknownSSHKeyTypeException,
OpenShiftException;
- public boolean hasSSHKeyName(String name) throws OpenShiftUnknonwSSHKeyTypeException, OpenShiftException;
+ public boolean hasSSHKeyName(String name) throws OpenShiftUnknownSSHKeyTypeException, OpenShiftException;
- public boolean hasSSHPublicKey(String publicKey) throws OpenShiftUnknonwSSHKeyTypeException, OpenShiftException;
+ public boolean hasSSHPublicKey(String publicKey) throws OpenShiftUnknownSSHKeyTypeException, OpenShiftException;
public boolean removeSSHKey(String name);
diff --git a/src/main/java/com/openshift/client/Message.java b/src/main/java/com/openshift/client/Message.java
index b8553526..f5d1a3bd 100644
--- a/src/main/java/com/openshift/client/Message.java
+++ b/src/main/java/com/openshift/client/Message.java
@@ -71,11 +71,11 @@ public String toString() {
}
private String getOperationState() {
- if (ISeverity.INFO.equals(severity.getValue())
- || ISeverity.DEBUG.equals(severity.getValue())
- || ISeverity.RESULT.equals(severity.getValue())) {
+ if (ISeverity.INFO.equals(severity)
+ || ISeverity.DEBUG.equals(severity)
+ || ISeverity.RESULT.equals(severity)) {
return "Operation succeeded";
- } else if (ISeverity.ERROR.equals(severity.getValue())) {
+ } else if (ISeverity.ERROR.equals(severity)) {
return "Operation failed";
} else {
return "Operation state is " + severity.getValue();
diff --git a/src/main/java/com/openshift/client/OpenShiftConnectionFactory.java b/src/main/java/com/openshift/client/OpenShiftConnectionFactory.java
index d6ff4c91..c2de2920 100755
--- a/src/main/java/com/openshift/client/OpenShiftConnectionFactory.java
+++ b/src/main/java/com/openshift/client/OpenShiftConnectionFactory.java
@@ -158,7 +158,7 @@ protected String createCipherExclusionRegex(IOpenShiftConfiguration configuratio
*/
public IOpenShiftConnection getConnection(final String clientId, final String username, final String password,
final String authKey, final String authIV, final String token, final String serverUrl,
- final ISSLCertificateCallback sslCertificateCallback, String exludeSSLCipherRegex)
+ final ISSLCertificateCallback sslCertificateCallback, String excludeSSLCipherRegex)
throws OpenShiftException {
Assert.notNull(clientId);
@@ -170,7 +170,7 @@ public IOpenShiftConnection getConnection(final String clientId, final String us
IHttpClient httpClient = createClient(
clientId, username, password, authKey, authIV, token, serverUrl, sslCertificateCallback,
- exludeSSLCipherRegex);
+ excludeSSLCipherRegex);
try {
return getConnection(clientId, username, password, token, serverUrl, httpClient);
} catch (IOException e) {
diff --git a/src/main/java/com/openshift/client/OpenShiftUnknonwSSHKeyTypeException.java b/src/main/java/com/openshift/client/OpenShiftUnknownSSHKeyTypeException.java
similarity index 83%
rename from src/main/java/com/openshift/client/OpenShiftUnknonwSSHKeyTypeException.java
rename to src/main/java/com/openshift/client/OpenShiftUnknownSSHKeyTypeException.java
index c50d1c26..7355575d 100644
--- a/src/main/java/com/openshift/client/OpenShiftUnknonwSSHKeyTypeException.java
+++ b/src/main/java/com/openshift/client/OpenShiftUnknownSSHKeyTypeException.java
@@ -13,11 +13,11 @@
/**
* @author Andre Dietisheim
*/
-public class OpenShiftUnknonwSSHKeyTypeException extends OpenShiftException {
+public class OpenShiftUnknownSSHKeyTypeException extends OpenShiftException {
private static final long serialVersionUID = 1L;
- public OpenShiftUnknonwSSHKeyTypeException(String message, Object... arguments) {
+ public OpenShiftUnknownSSHKeyTypeException(String message, Object... arguments) {
super(message, arguments);
}
}
diff --git a/src/main/java/com/openshift/client/SSHKeyPair.java b/src/main/java/com/openshift/client/SSHKeyPair.java
index 30f6a4d2..b5956786 100644
--- a/src/main/java/com/openshift/client/SSHKeyPair.java
+++ b/src/main/java/com/openshift/client/SSHKeyPair.java
@@ -23,7 +23,7 @@
public class SSHKeyPair extends AbstractSSHKey {
/**
- * the length of the key that is created when using #create. ssh-keygen uses
+ * The length of the key that is created when using #create. ssh-keygen uses
* a default of 2048
*
* @see #create(String, String, String)
diff --git a/src/main/java/com/openshift/client/SSHKeyType.java b/src/main/java/com/openshift/client/SSHKeyType.java
index e3852d26..ee5130b1 100644
--- a/src/main/java/com/openshift/client/SSHKeyType.java
+++ b/src/main/java/com/openshift/client/SSHKeyType.java
@@ -49,7 +49,7 @@ public int toJSchKeyType() {
}
}
- public static SSHKeyType getByTypeId(String keyTypeId) throws OpenShiftUnknonwSSHKeyTypeException {
+ public static SSHKeyType getByTypeId(String keyTypeId) throws OpenShiftUnknownSSHKeyTypeException {
Assert.notNull(keyTypeId);
for (SSHKeyType sSHKeyType : values()) {
@@ -57,22 +57,22 @@ public static SSHKeyType getByTypeId(String keyTypeId) throws OpenShiftUnknonwSS
return sSHKeyType;
}
}
- throw new OpenShiftUnknonwSSHKeyTypeException("OpenShift does not support keys of type \"{0}\"", keyTypeId);
+ throw new OpenShiftUnknownSSHKeyTypeException("OpenShift does not support keys of type \"{0}\"", keyTypeId);
}
- public static SSHKeyType getByJSchKeyType(KeyPair keyPair) throws OpenShiftUnknonwSSHKeyTypeException {
+ public static SSHKeyType getByJSchKeyType(KeyPair keyPair) throws OpenShiftUnknownSSHKeyTypeException {
Assert.notNull(keyPair);
return getByJSchKeyType(keyPair.getKeyType());
}
- public static SSHKeyType getByJSchKeyType(int jschKeyType) throws OpenShiftUnknonwSSHKeyTypeException {
+ public static SSHKeyType getByJSchKeyType(int jschKeyType) throws OpenShiftUnknownSSHKeyTypeException {
if (jschKeyType == KeyPair.RSA) {
return SSH_RSA;
} else if (jschKeyType == KeyPair.DSA) {
return SSH_DSA;
} else {
- throw new OpenShiftUnknonwSSHKeyTypeException("Unknown jsch key type \"{0}\"", jschKeyType);
+ throw new OpenShiftUnknownSSHKeyTypeException("Unknown jsch key type \"{0}\"", jschKeyType);
}
}
}
diff --git a/src/main/java/com/openshift/client/cartridge/StandaloneCartridge.java b/src/main/java/com/openshift/client/cartridge/StandaloneCartridge.java
index 8d90d92d..33d98612 100755
--- a/src/main/java/com/openshift/client/cartridge/StandaloneCartridge.java
+++ b/src/main/java/com/openshift/client/cartridge/StandaloneCartridge.java
@@ -19,7 +19,7 @@
/**
* A cartridge that is available on the openshift server. This class is no enum
- * since we dont know all available types and they may change at any time.
+ * since we don't know all available types and they may change at any time.
*
* @author André Dietisheim
* @author Jeff Cantrill
diff --git a/src/main/java/com/openshift/client/cartridge/query/CartridgeNameQuery.java b/src/main/java/com/openshift/client/cartridge/query/CartridgeNameQuery.java
index eef793c4..c8f249b1 100644
--- a/src/main/java/com/openshift/client/cartridge/query/CartridgeNameQuery.java
+++ b/src/main/java/com/openshift/client/cartridge/query/CartridgeNameQuery.java
@@ -33,7 +33,7 @@ public boolean matches(C cartridge) {
|| cartridge.getName() == null) {
return false;
}
- return cartridge.getName().indexOf(nameSubstring) >= 0;
+ return cartridge.getName().contains(nameSubstring);
}
@Override
diff --git a/src/main/java/com/openshift/client/cartridge/query/LatestEmbeddableCartridge.java b/src/main/java/com/openshift/client/cartridge/query/LatestEmbeddableCartridge.java
index e5df0f44..9cd1d0c7 100644
--- a/src/main/java/com/openshift/client/cartridge/query/LatestEmbeddableCartridge.java
+++ b/src/main/java/com/openshift/client/cartridge/query/LatestEmbeddableCartridge.java
@@ -20,7 +20,7 @@
import com.openshift.internal.client.utils.Assert;
/**
- * A query that shall select the latest version of an embedded cartidge that's given by name.
+ * A query that shall select the latest version of an embedded cartridge that's given by name.
*
* @author Andre Dietisheim
*
diff --git a/src/main/java/com/openshift/client/cartridge/query/LatestStandaloneCartridge.java b/src/main/java/com/openshift/client/cartridge/query/LatestStandaloneCartridge.java
index 1397f814..01990de2 100644
--- a/src/main/java/com/openshift/client/cartridge/query/LatestStandaloneCartridge.java
+++ b/src/main/java/com/openshift/client/cartridge/query/LatestStandaloneCartridge.java
@@ -18,7 +18,7 @@
import com.openshift.internal.client.utils.Assert;
/**
- * A query that shall select the latest version of a standalone cartidge that's given by name.
+ * A query that shall select the latest version of a standalone cartridge that's given by name.
*
* @author Andre Dietisheim
*
diff --git a/src/main/java/com/openshift/client/utils/Base64Coder.java b/src/main/java/com/openshift/client/utils/Base64Coder.java
index 630e1da6..f60b1833 100644
--- a/src/main/java/com/openshift/client/utils/Base64Coder.java
+++ b/src/main/java/com/openshift/client/utils/Base64Coder.java
@@ -37,7 +37,7 @@ public static String encode(byte[] unencoded) {
if (unencoded == null) {
return null;
} else if (unencoded.length == 0) {
- return new String();
+ return "";
}
return DatatypeConverter.printBase64Binary(unencoded);
}
@@ -59,7 +59,7 @@ public static String encode(String unencoded) {
public static String decode(byte[] encoded) {
if (encoded == null
|| encoded.length == 0) {
- return new String();
+ return "";
}
return decode(new String(encoded));
}
diff --git a/src/main/java/com/openshift/client/utils/RFC822DateUtils.java b/src/main/java/com/openshift/client/utils/RFC822DateUtils.java
index e95e5f22..b114f34e 100644
--- a/src/main/java/com/openshift/client/utils/RFC822DateUtils.java
+++ b/src/main/java/com/openshift/client/utils/RFC822DateUtils.java
@@ -45,7 +45,7 @@ public static Date getDate(String rfc822DateString) throws DatatypeConfiguration
/**
* Returns a date instance for a given timestamp string that complies to the
- * RFC 822 standard. If an error occurrs, null is returned an
+ * RFC 822 standard. If an error occurs, null is returned an
* no exception is thrown.
*
* @param rfc822DateString
diff --git a/src/main/java/com/openshift/internal/client/APIResource.java b/src/main/java/com/openshift/internal/client/APIResource.java
index 4cb086e5..9858c4b0 100755
--- a/src/main/java/com/openshift/internal/client/APIResource.java
+++ b/src/main/java/com/openshift/internal/client/APIResource.java
@@ -225,9 +225,10 @@ public IDomain showDomain(String id) throws OpenShiftException {
Assert.notNull(id);
final DomainResourceDTO domainDTO = new ShowDomainRequest().execute(id);
- final IDomain domain = new DomainResource(domainDTO, this);
// TODO: implement caching
- return domain;
+ return new DomainResource(domainDTO, this);
+
+
}
@Override
diff --git a/src/main/java/com/openshift/internal/client/AbstractOpenShiftResource.java b/src/main/java/com/openshift/internal/client/AbstractOpenShiftResource.java
index 33e0e977..59716a29 100755
--- a/src/main/java/com/openshift/internal/client/AbstractOpenShiftResource.java
+++ b/src/main/java/com/openshift/internal/client/AbstractOpenShiftResource.java
@@ -297,6 +297,14 @@ protected Parameters gearProfile(IGearProfile gearProfile) {
return add(new StringParameter(IOpenShiftJsonConstants.PROPERTY_GEAR_PROFILE, gearProfile.getName()));
}
+ protected Parameters region(String region) {
+ if (region == null || "".equals(region)) {
+ return this;
+ }
+ return add(new StringParameter(IOpenShiftJsonConstants.PROPERTY_REGION, region));
+ }
+
+
protected Parameters include(String includedResource) {
add(IOpenShiftParameterConstants.PARAMETER_INCLUDE, includedResource);
return this;
@@ -331,7 +339,7 @@ protected List toList() {
}
public boolean hasCreationLog() {
- return messages.hasMessages();
+ return (messages != null) ? messages.hasMessages() : null;
}
public String getCreationLog() {
diff --git a/src/main/java/com/openshift/internal/client/ApplicationResource.java b/src/main/java/com/openshift/internal/client/ApplicationResource.java
index 80181388..cc02e7ab 100755
--- a/src/main/java/com/openshift/internal/client/ApplicationResource.java
+++ b/src/main/java/com/openshift/internal/client/ApplicationResource.java
@@ -76,7 +76,7 @@
*/
public class ApplicationResource extends AbstractOpenShiftResource implements IApplication {
- private static final long APPLICATION_WAIT_RETRY_DELAY = 2 * 1024;
+ private static final long APPLICATION_WAIT_RETRY_DELAY = 2 * 1024L;
private static final Logger LOGGER = LoggerFactory.getLogger(ApplicationResource.class);
private static final String LINK_DELETE_APPLICATION = "DELETE";
@@ -182,7 +182,7 @@ protected ApplicationResource(ApplicationResourceDTO dto, DomainResource domain)
* the git url
* @param sshUrl
* the ssh url
- * @param cartridge
+ * @param cartridgesByName
* the cartridge (type/framework)
* @param aliases
* the aliases
@@ -377,7 +377,8 @@ public String setDeploymentType(String deploymentType) {
final ApplicationResourceDTO applicationDTO =
new UpdateRequest().execute(deploymentType);
- return this.deploymentType = applicationDTO.getDeploymentType();
+ this.deploymentType = applicationDTO.getDeploymentType();
+ return this.deploymentType;
}
@Override
@@ -562,7 +563,7 @@ public IGearGroup getGearGroup(ICartridge cartridge, Collection gear
for (IGearGroup gearGroup : gearGroups) {
for (ICartridge groupCartridge : gearGroup.getCartridges()) {
- if (cartridge.equals(cartridge)) {
+ if (groupCartridge.equals(cartridge)) {
return gearGroup;
}
}
@@ -577,7 +578,8 @@ private Collection loadGearGroups() throws OpenShiftException {
gearGroups.add(new GearGroupResource(dto, this, getService()));
}
- return this.gearGroups = gearGroups;
+ this.gearGroups = gearGroups;
+ return this.gearGroups;
}
public boolean waitForAccessible(long timeout) throws OpenShiftException {
@@ -648,7 +650,7 @@ public boolean hasSSHSession() {
return this.session != null && this.session.isConnected();
}
- public boolean isPortFowardingStarted() throws OpenShiftSSHOperationException {
+ public boolean isPortForwardingStarted() throws OpenShiftSSHOperationException {
try {
return this.session != null && this.session.isConnected() && this.session.getPortForwardingL().length > 0;
} catch (JSchException e) {
@@ -753,14 +755,14 @@ public Map addEnvironmentVariables(MapvariablesCandidateMap = new HashMap();
- for(String varCandidateName:environmentVariables.keySet()){
- IEnvironmentVariable tempVar = environmentVariablesMap.get(varCandidateName);
+ for(Map.Entry varCandidate:environmentVariables.entrySet()){
+ IEnvironmentVariable tempVar = environmentVariablesMap.get(varCandidate.getKey());
if(tempVar != null)
- { if(tempVar.getValue() == environmentVariables.get(varCandidateName))
- variablesCandidateMap.put(varCandidateName,environmentVariables.get(varCandidateName));
+ { if(tempVar.getValue().equals(varCandidate.getValue()))
+ variablesCandidateMap.put(varCandidate.getKey(),varCandidate.getValue());
}
else
- variablesCandidateMap.put(varCandidateName, environmentVariables.get(varCandidateName));
+ variablesCandidateMap.put(varCandidate.getKey(), varCandidate.getValue());
}
List environmentVariableResourceDTOs = new AddEnvironmentVariablesRequest()
.execute(variablesCandidateMap);
@@ -797,14 +799,10 @@ public boolean hasEnvironmentVariable(String name) throws OpenShiftException {
}
protected void updateEnvironmentVariables() throws OpenShiftException {
- if (!canGetEnvironmentVariables())
- return;
- else
- {
+ if (canGetEnvironmentVariables()) {
environmentVariablesMap.clear();
environmentVariablesMap = loadEnvironmentVariables();
}
-
}
/*
@@ -850,7 +848,6 @@ public boolean canUpdateEnvironmentVariables() {
/**
* List all forwardable ports for a given application.
*
- * @param application
* @return the forwardable ports in an unmodifiable collection
* @throws JSchException
* @throws OpenShiftSSHOperationException
@@ -880,7 +877,6 @@ protected List sshExecCmd(final String command, final SshStreams sshStre
throw new OpenShiftSSHOperationException("No SSH session available for application ''{0}''", this.getName());
}
Channel channel = null;
- BufferedReader reader = null;
try {
session.openChannel("exec");
channel = session.openChannel("exec");
@@ -895,14 +891,6 @@ protected List sshExecCmd(final String command, final SshStreams sshStre
this.getName());
} finally {
- if (reader != null) {
- try {
- reader.close();
- } catch (IOException e) {
- LOGGER.error("Failed to close SSH error stream reader", e);
- }
- }
-
if (channel != null && channel.isConnected()) {
channel.disconnect();
}
@@ -1016,7 +1004,8 @@ public String toString() {
+ "uuid=" + uuid
+ ", name=" + name
+ ", creationTime=" + creationTime
- + ", cartridge=" + cartridge
+ // avoid recursion, only display cartridge name
+ + ", cartridge=" + (cartridge == null? "null" : cartridge.getName())
+ ", scale=" + scale
+ ", gearProfile=" + gearProfile
+ ", domain=" + domain
@@ -1034,7 +1023,8 @@ protected InputStream getInputStream(Channel channel) throws IOException {
return channel.getExtInputStream();
}
- }, INPUT {
+ },
+ INPUT {
protected InputStream getInputStream(Channel channel) throws IOException {
return channel.getInputStream();
}
diff --git a/src/main/java/com/openshift/internal/client/ApplicationSSHSession.java b/src/main/java/com/openshift/internal/client/ApplicationSSHSession.java
index 6d93f817..45ffb073 100644
--- a/src/main/java/com/openshift/internal/client/ApplicationSSHSession.java
+++ b/src/main/java/com/openshift/internal/client/ApplicationSSHSession.java
@@ -108,7 +108,7 @@ public boolean isConnected() {
* @return true if port forwarding is started, false otherwise
* @throws OpenShiftSSHOperationException
*/
- public boolean isPortFowardingStarted() throws OpenShiftSSHOperationException {
+ public boolean isPortForwardingStarted() throws OpenShiftSSHOperationException {
try {
return isConnected()
&& session.getPortForwardingL().length > 0;
@@ -280,8 +280,8 @@ private List loadPorts() throws OpenShiftSSHOperatio
this.ports = new ArrayList();
InputStream in = execCommand("rhc-list-ports", ChannelInputStreams.EXTENDED_DATA, session);
try {
- return this.ports =
- new RhcListPortsCommandResponse(application, in).getPortForwardings();
+ this.ports = new RhcListPortsCommandResponse(application, in).getPortForwardings();
+ return this.ports;
} catch (IOException e) {
throw new OpenShiftSSHOperationException("Could not execute \"rhc-list-ports\" via ssh in application {0}",
application.getName());
@@ -326,7 +326,7 @@ public boolean equals(Object object) {
return false;
} else if (isConnected() != other.isConnected()) {
return false;
- } else if (isPortFowardingStarted() != other.isPortFowardingStarted()) {
+ } else if (isPortForwardingStarted() != other.isPortForwardingStarted()) {
return false;
} else if (!application.equals(otherapp)) {
return false;
@@ -340,7 +340,7 @@ public String toString() {
+ "applicationuuid=" + application.getUUID()
+ ", applicationname=" + application.getName()
+ ", isconnected=" + isConnected()
- + ", isportforwardingstarted=" + isPortFowardingStarted()
+ + ", isportforwardingstarted=" + isPortForwardingStarted()
+ "]";
}
@@ -385,12 +385,17 @@ protected InputStream execCommand(final String command, InputStream forStdIn,
}
return channelResponse;
} catch (JSchException e) {
- channel.disconnect();
+ if (channel != null && channel.isConnected()) {
+ channel.disconnect();
+ }
+
throw new OpenShiftSSHOperationException(e,
"Could no execute remote ssh command \"{0}\" on application {1}",
command, application.getName());
} catch (IOException e) {
- channel.disconnect();
+ if (channel != null && channel.isConnected()) {
+ channel.disconnect();
+ }
throw new OpenShiftSSHOperationException(e,
"Could not get response channel for remote ssh command \"{0}\" on application {1}",
command, application.getName());
diff --git a/src/main/java/com/openshift/internal/client/DomainResource.java b/src/main/java/com/openshift/internal/client/DomainResource.java
index bd4af86d..59c9f4f4 100755
--- a/src/main/java/com/openshift/internal/client/DomainResource.java
+++ b/src/main/java/com/openshift/internal/client/DomainResource.java
@@ -104,7 +104,7 @@ public IApplication createApplication(final String name, final IStandaloneCartri
@Override
public IApplication createApplication(final String name, final IStandaloneCartridge cartridge,
final ApplicationScale scale) throws OpenShiftException {
- return createApplication(name, cartridge, scale, null, null);
+ return createApplication(name, cartridge, scale, (IGearProfile)null, null);
}
@Override
@@ -135,6 +135,12 @@ public IApplication createApplication(final String name, final IStandaloneCartri
return createApplication(name, cartridge, scale, gearProfile, null);
}
+ @Override
+ public IApplication createApplication(final String name, final IStandaloneCartridge cartridge,
+ final ApplicationScale scale, String region, final IGearProfile gearProfile) throws OpenShiftException {
+ return createApplication(name, scale, gearProfile, null, IHttpClient.NO_TIMEOUT, region, null,CollectionUtils. toList(cartridge));
+ }
+
@Override
public IApplication createApplication(final String name, final IStandaloneCartridge cartridge,
final ApplicationScale scale, final IGearProfile gearProfile, String initialGitUrl)
@@ -154,10 +160,10 @@ public IApplication createApplication(final String name, final IStandaloneCartri
@Override
public IApplication createApplication(final String name, final IStandaloneCartridge standaloneCartridge,
final ApplicationScale scale, final IGearProfile gearProfile, String initialGitUrl, int timeout,
- Map environmentVariables, IEmbeddableCartridge... embedddableCartridges)
+ Map environmentVariables, IEmbeddableCartridge... embeddableCartridges)
throws OpenShiftException {
- return createApplication(name, scale, gearProfile, initialGitUrl, timeout, environmentVariables,
- CollectionUtils. toList(standaloneCartridge, embedddableCartridges));
+ return createApplication(name, scale, gearProfile, initialGitUrl, timeout, null, environmentVariables,
+ CollectionUtils. toList(standaloneCartridge, embeddableCartridges));
}
@Override
@@ -165,11 +171,11 @@ public IApplication createApplication(final String name, final ApplicationScale
final IGearProfile gearProfile, String initialGitUrl, int timeout,
Map environmentVariables, ICartridge... cartridges)
throws OpenShiftException {
- return createApplication(name, scale, gearProfile, initialGitUrl, timeout, environmentVariables, Arrays.asList(cartridges));
+ return createApplication(name, scale, gearProfile, initialGitUrl, timeout, null, environmentVariables, Arrays.asList(cartridges));
}
protected IApplication createApplication(final String name, final ApplicationScale scale,
- final IGearProfile gearProfile, String initialGitUrl, int timeout,
+ final IGearProfile gearProfile, String initialGitUrl, int timeout, String region,
Map environmentVariables, Collection cartridges)
throws OpenShiftException {
if (name == null) {
@@ -184,7 +190,7 @@ protected IApplication createApplication(final String name, final ApplicationSca
ApplicationResourceDTO applicationDTO =
new CreateApplicationRequest().execute(
- name, scale, gearProfile, initialGitUrl, timeout, environmentVariables, cartridges);
+ name, scale, gearProfile, initialGitUrl, timeout, region, environmentVariables, cartridges);
IApplication application = new ApplicationResource(applicationDTO, this);
getOrLoadApplications().add(application);
@@ -456,7 +462,7 @@ private CreateApplicationRequest() throws OpenShiftException {
protected ApplicationResourceDTO execute(final String name, final ApplicationScale scale,
final IGearProfile gearProfile, final String initialGitUrl, final int timeout,
- Map environmentVariables, Collection cartridges)
+ String region, Map environmentVariables, Collection cartridges)
throws OpenShiftException {
if (cartridges == null
|| cartridges.size() == 0) {
@@ -468,6 +474,7 @@ protected ApplicationResourceDTO execute(final String name, final ApplicationSca
.addCartridges(cartridges)
.scale(scale)
.gearProfile(gearProfile)
+ .region(region)
.add(IOpenShiftJsonConstants.PROPERTY_INITIAL_GIT_URL, initialGitUrl)
.addEnvironmentVariables(environmentVariables);
diff --git a/src/main/java/com/openshift/internal/client/EmbeddedCartridgeResource.java b/src/main/java/com/openshift/internal/client/EmbeddedCartridgeResource.java
index 4c36ba82..37678a75 100755
--- a/src/main/java/com/openshift/internal/client/EmbeddedCartridgeResource.java
+++ b/src/main/java/com/openshift/internal/client/EmbeddedCartridgeResource.java
@@ -160,21 +160,21 @@ public boolean equals(Object obj) {
return false;
}
IEmbeddableCartridge other = (IEmbeddableCartridge) obj;
- if (name == null) {
- if (other.getName() != null) {
+ if (name == null && other.getName() != null) {
return false;
- }
}
- if (!name.equals(other.getName())) {
- return false;
+ if (name != null) {
+ if (!name.equals(other.getName())) {
+ return false;
+ }
}
return true;
}
@Override
public String toString() {
- return "EmbeddedCartridgeResource [" +
- "name=" + name
+ return "EmbeddedCartridgeResource ["
+ + "name=" + name
+ "url=" + url
+ ", displayName=" + displayName
+ ", description=" + description
diff --git a/src/main/java/com/openshift/internal/client/EnvironmentVariableResource.java b/src/main/java/com/openshift/internal/client/EnvironmentVariableResource.java
index fd2d2eb1..1261e3d5 100644
--- a/src/main/java/com/openshift/internal/client/EnvironmentVariableResource.java
+++ b/src/main/java/com/openshift/internal/client/EnvironmentVariableResource.java
@@ -130,8 +130,6 @@ public IApplication getApplication() {
}
public String toString(){
- return new String(
- "Name:"+this.name+",Value:"+value
- );
+ return "Name:"+this.name+",Value:"+value;
}
}
diff --git a/src/main/java/com/openshift/internal/client/GearGroupResource.java b/src/main/java/com/openshift/internal/client/GearGroupResource.java
index 3aebf516..36eeb22b 100755
--- a/src/main/java/com/openshift/internal/client/GearGroupResource.java
+++ b/src/main/java/com/openshift/internal/client/GearGroupResource.java
@@ -84,7 +84,7 @@ protected GearGroupResource(final String uuid, final String name, final Collecti
*
* @param dto the associated {@link GearGroupResourceDTO}
* @param application the parent application
- * @param servicethe underlying REST Service
+ * @param service the underlying REST Service
*/
protected GearGroupResource(final GearGroupResourceDTO dto, final ApplicationResource application, final IRestService service) {
this(dto.getUuid(), dto.getName(), dto.getGears(), dto.getCartridges(), dto.getAdditionalStorage(), application, service);
diff --git a/src/main/java/com/openshift/internal/client/IRestService.java b/src/main/java/com/openshift/internal/client/IRestService.java
index 631ff92a..0f5ba453 100755
--- a/src/main/java/com/openshift/internal/client/IRestService.java
+++ b/src/main/java/com/openshift/internal/client/IRestService.java
@@ -59,7 +59,7 @@ public RestResponse request(Link link, int timeout, IRestResponseFactory respons
* @param urlParameters
* the url parameters ("?parameter=value")
* @param parameters
- * the body parameters (ingnored for GET requests)
+ * the body parameters (ignored for GET requests)
* @param parameters
* the parameters to send
* @return the rest response
diff --git a/src/main/java/com/openshift/internal/client/RestService.java b/src/main/java/com/openshift/internal/client/RestService.java
index e95625f1..0fbe14f4 100755
--- a/src/main/java/com/openshift/internal/client/RestService.java
+++ b/src/main/java/com/openshift/internal/client/RestService.java
@@ -118,7 +118,7 @@ public RestResponse request(Link link, int timeout, IMediaType requestMediaType,
RestResponse restResponse = getRestResponse(e);
String message = getMessage(restResponse, e);
throw new OpenShiftEndpointException(
- url.toString(), e, restResponse, "Could not request {0}: {1}", url, message);
+ url, e, restResponse, "Could not request {0}: {1}", url, message);
} catch (SocketTimeoutException e) {
throw new OpenShiftTimeoutException(url, e,
"Could not request url {0}, connection timed out", url);
diff --git a/src/main/java/com/openshift/internal/client/SSHKeyResource.java b/src/main/java/com/openshift/internal/client/SSHKeyResource.java
index def5c579..14cd33e9 100644
--- a/src/main/java/com/openshift/internal/client/SSHKeyResource.java
+++ b/src/main/java/com/openshift/internal/client/SSHKeyResource.java
@@ -12,7 +12,7 @@
import com.openshift.client.IOpenShiftSSHKey;
import com.openshift.client.OpenShiftException;
-import com.openshift.client.OpenShiftUnknonwSSHKeyTypeException;
+import com.openshift.client.OpenShiftUnknownSSHKeyTypeException;
import com.openshift.client.SSHKeyType;
import com.openshift.internal.client.httpclient.request.StringParameter;
import com.openshift.internal.client.response.KeyResourceDTO;
@@ -29,7 +29,7 @@ public class SSHKeyResource extends AbstractOpenShiftResource implements IOpenSh
private String publicKey;
private UserResource user;
- protected SSHKeyResource(KeyResourceDTO dto, UserResource user) throws OpenShiftUnknonwSSHKeyTypeException {
+ protected SSHKeyResource(KeyResourceDTO dto, UserResource user) throws OpenShiftUnknownSSHKeyTypeException {
super(user.getService(), dto.getLinks(), dto.getMessages());
this.name = dto.getName();
this.type = SSHKeyType.getByTypeId(dto.getType());
@@ -77,7 +77,7 @@ public void destroy() throws OpenShiftException {
this.publicKey = null;
}
- protected void update(KeyResourceDTO dto) throws OpenShiftUnknonwSSHKeyTypeException {
+ protected void update(KeyResourceDTO dto) throws OpenShiftUnknownSSHKeyTypeException {
if (dto == null) {
return;
}
diff --git a/src/main/java/com/openshift/internal/client/UserResource.java b/src/main/java/com/openshift/internal/client/UserResource.java
index 8228ba94..1e833f90 100755
--- a/src/main/java/com/openshift/internal/client/UserResource.java
+++ b/src/main/java/com/openshift/internal/client/UserResource.java
@@ -22,7 +22,7 @@
import com.openshift.client.IUser;
import com.openshift.client.OpenShiftException;
import com.openshift.client.OpenShiftSSHKeyException;
-import com.openshift.client.OpenShiftUnknonwSSHKeyTypeException;
+import com.openshift.client.OpenShiftUnknownSSHKeyTypeException;
import com.openshift.client.SSHKeyType;
import com.openshift.client.IAuthorization;
import com.openshift.internal.client.httpclient.request.StringParameter;
@@ -101,8 +101,7 @@ public IDomain createDomain(String id) throws OpenShiftException {
@Override
public List getDomains() throws OpenShiftException {
- List domains = api.getDomains();
- return domains;
+ return api.getDomains();
}
@Override
@@ -180,7 +179,7 @@ public void refresh() throws OpenShiftException {
}
@Override
- public List getSSHKeys() throws OpenShiftUnknonwSSHKeyTypeException,
+ public List getSSHKeys() throws OpenShiftUnknownSSHKeyTypeException,
OpenShiftException {
Map keys = new HashMap();
keys.putAll(getCachedOrLoadSSHKeys());
@@ -188,7 +187,7 @@ public List getSSHKeys() throws OpenShiftUnknonwSSHKeyTypeExce
}
private Map getCachedOrLoadSSHKeys() throws OpenShiftException,
- OpenShiftUnknonwSSHKeyTypeException {
+ OpenShiftUnknownSSHKeyTypeException {
if (sshKeys == null) {
this.sshKeys = loadKeys();
}
@@ -196,7 +195,7 @@ private Map getCachedOrLoadSSHKeys() throws OpenShiftExc
}
private Map loadKeys() throws OpenShiftException,
- OpenShiftUnknonwSSHKeyTypeException {
+ OpenShiftUnknownSSHKeyTypeException {
Map keys = new HashMap();
List keyDTOs = new GetSShKeysRequest().execute();
for (KeyResourceDTO keyDTO : keyDTOs) {
@@ -224,7 +223,7 @@ public void deleteKey(String name) {
@Override
public IOpenShiftSSHKey getSSHKeyByName(String name)
- throws OpenShiftUnknonwSSHKeyTypeException, OpenShiftException {
+ throws OpenShiftUnknownSSHKeyTypeException, OpenShiftException {
Assert.notNull(name);
return getCachedOrLoadSSHKeys().get(name);
@@ -232,7 +231,7 @@ public IOpenShiftSSHKey getSSHKeyByName(String name)
@Override
public IOpenShiftSSHKey getSSHKeyByPublicKey(String publicKey)
- throws OpenShiftUnknonwSSHKeyTypeException, OpenShiftException {
+ throws OpenShiftUnknownSSHKeyTypeException, OpenShiftException {
Assert.notNull(publicKey);
IOpenShiftSSHKey matchingKey = null;
@@ -250,7 +249,7 @@ public IOpenShiftSSHKey getSSHKeyByPublicKey(String publicKey)
}
@Override
- public boolean hasSSHKeyName(String name) throws OpenShiftUnknonwSSHKeyTypeException,
+ public boolean hasSSHKeyName(String name) throws OpenShiftUnknownSSHKeyTypeException,
OpenShiftException {
Assert.notNull(name);
@@ -259,7 +258,7 @@ public boolean hasSSHKeyName(String name) throws OpenShiftUnknonwSSHKeyTypeExcep
@Override
public boolean hasSSHPublicKey(String publicKey)
- throws OpenShiftUnknonwSSHKeyTypeException, OpenShiftException {
+ throws OpenShiftUnknownSSHKeyTypeException, OpenShiftException {
return getSSHKeyByPublicKey(publicKey) != null;
}
@@ -291,7 +290,7 @@ public IOpenShiftSSHKey addSSHKey(String name, ISSHPublicKey key) throws OpenShi
return put(keyDTO);
}
- private SSHKeyResource put(KeyResourceDTO keyDTO) throws OpenShiftUnknonwSSHKeyTypeException {
+ private SSHKeyResource put(KeyResourceDTO keyDTO) throws OpenShiftUnknownSSHKeyTypeException {
SSHKeyResource sshKey = new SSHKeyResource(keyDTO, this);
getCachedOrLoadSSHKeys().put(keyDTO.getName(), sshKey);
return sshKey;
diff --git a/src/main/java/com/openshift/internal/client/httpclient/UrlConnectionHttpClient.java b/src/main/java/com/openshift/internal/client/httpclient/UrlConnectionHttpClient.java
index 30406892..9da4bd38 100755
--- a/src/main/java/com/openshift/internal/client/httpclient/UrlConnectionHttpClient.java
+++ b/src/main/java/com/openshift/internal/client/httpclient/UrlConnectionHttpClient.java
@@ -283,13 +283,13 @@ private void setAuthorization(String username, String password, String authKey,
}
else if(token != null){
connection.setRequestProperty(PROPERTY_AUTHORIZATION,
- new StringBuilder().append(AUTHORIZATION_BEARER).append(SPACE).append(token).toString());
+ AUTHORIZATION_BEARER + SPACE + token);
}
} else {
String credentials = Base64Coder.encode(
- new StringBuilder().append(username).append(COLON).append(password).toString().getBytes());
+ (username + COLON + password).getBytes());
connection.setRequestProperty(PROPERTY_AUTHORIZATION,
- new StringBuilder().append(AUTHORIZATION_BASIC).append(SPACE).append(credentials).toString());
+ AUTHORIZATION_BASIC + SPACE + credentials);
}
}
@@ -305,7 +305,7 @@ private SSLContext setSSLCallback(ISSLCertificateCallback sslAuthorizationCallba
connection.setSSLSocketFactory(sslContext.getSocketFactory());
return sslContext;
} catch (GeneralSecurityException e) {
- LOGGER.warn("Could not install trust manager callback", e);;
+ LOGGER.warn("Could not install trust manager callback", e);
return null;
}
}
@@ -325,7 +325,7 @@ private X509TrustManager createCallbackTrustManager(ISSLCertificateCallback sslA
trustManager = new CallbackTrustManager(trustManager, sslAuthorizationCallback);
}
} catch (GeneralSecurityException e) {
- LOGGER.warn("Could not install trust manager callback.", e);;
+ LOGGER.warn("Could not install trust manager callback.", e);
}
return trustManager;
}
@@ -338,8 +338,6 @@ private X509TrustManager createCallbackTrustManager(ISSLCertificateCallback sslA
*
* @param sslContext
* the ssl context that shall be used
- * @param url
- * the url we are connecting to
* @param connection
* the connection that the cipher filter shall be applied to
*/
@@ -355,7 +353,17 @@ excludedSSLCipherRegex, getSupportedCiphers(sslContext)), sslContext
}
protected String[] getSupportedCiphers(SSLContext sslContext) {
- return sslContext.getSupportedSSLParameters().getCipherSuites();
+ if (sslContext != null) {
+ return sslContext.getSupportedSSLParameters().getCipherSuites();
+ } else {
+ /*
+ * Should we throw an exception here?
+ * Seems like we never hit this point before or we would have gotten an exception...
+ */
+ LOGGER.warn("sslContext is null");
+ return null;
+ }
+
}
private void setConnectTimeout(int timeout, URLConnection connection) {
diff --git a/src/main/java/com/openshift/internal/client/httpclient/request/FormUrlEncodedMediaType.java b/src/main/java/com/openshift/internal/client/httpclient/request/FormUrlEncodedMediaType.java
index 4cfb731c..52dc3a34 100644
--- a/src/main/java/com/openshift/internal/client/httpclient/request/FormUrlEncodedMediaType.java
+++ b/src/main/java/com/openshift/internal/client/httpclient/request/FormUrlEncodedMediaType.java
@@ -70,10 +70,7 @@ public void writeTo(ParameterValueMap parameterMap, OutputStream out) throws Enc
private void writeTo(String name, ParameterValueMap parameterMap, OutputStream out) throws IOException {
for (Parameter parameter : parameterMap.getValue().values()) {
- String childName = new StringBuilder()
- .append(name)
- .append('[').append(parameter.getName()).append(']')
- .toString();
+ String childName = name + '[' + parameter.getName() + ']';
writeTo(childName, parameter.getValue(), out);
}
}
@@ -113,7 +110,7 @@ private void writeTo(String name, StringValue stringValue, OutputStream out) thr
private String encode(String value) throws UnsupportedEncodingException {
if (UrlUtils.isUrl(value)) {
- // dont encode url payload
+ // don't encode url payload
return value;
}
return URLEncoder.encode(value, UTF8);
diff --git a/src/main/java/com/openshift/internal/client/httpclient/request/Parameter.java b/src/main/java/com/openshift/internal/client/httpclient/request/Parameter.java
index bbc2c186..afb3538f 100644
--- a/src/main/java/com/openshift/internal/client/httpclient/request/Parameter.java
+++ b/src/main/java/com/openshift/internal/client/httpclient/request/Parameter.java
@@ -69,7 +69,7 @@ public boolean equals(Object obj) {
public String toString() {
return "Parameter ["
+ "name=" + name
- + ", value=" + String.valueOf(getValue())
+ + ", value=" + getValue()
+ "]";
}
}
diff --git a/src/main/java/com/openshift/internal/client/httpclient/request/ParameterValueMap.java b/src/main/java/com/openshift/internal/client/httpclient/request/ParameterValueMap.java
index 3a143422..5f315050 100644
--- a/src/main/java/com/openshift/internal/client/httpclient/request/ParameterValueMap.java
+++ b/src/main/java/com/openshift/internal/client/httpclient/request/ParameterValueMap.java
@@ -57,7 +57,7 @@ public ParameterValueMap add(Parameter parameter) {
return this;
}
- public Parameter getParamater(String name) {
+ public Parameter getParameter(String name) {
return getValue().get(name);
}
diff --git a/src/main/java/com/openshift/internal/client/response/EnumDataType.java b/src/main/java/com/openshift/internal/client/response/EnumDataType.java
index abe2807f..490a7f63 100755
--- a/src/main/java/com/openshift/internal/client/response/EnumDataType.java
+++ b/src/main/java/com/openshift/internal/client/response/EnumDataType.java
@@ -43,7 +43,7 @@ public enum EnumDataType {
cartridge,
/** The environment-variables type*/
environment_variables,
- /** The environmetn-variable type*/
+ /** The environment-variable type*/
environment_variable
;
diff --git a/src/main/java/com/openshift/internal/client/response/Link.java b/src/main/java/com/openshift/internal/client/response/Link.java
index e2693438..f8a1296b 100755
--- a/src/main/java/com/openshift/internal/client/response/Link.java
+++ b/src/main/java/com/openshift/internal/client/response/Link.java
@@ -181,7 +181,7 @@ private void validateRequiredParameter(LinkParameter linkParameter, Parameter[]
throw new OpenShiftRequestException("Requesting {0}: required request parameter \"{1}\" is empty",
getHref(), linkParameter.getName());
}
- // TODO: check valid options (still reported in a very incosistent way)
+ // TODO: check valid options (still reported in a very inconsistent way)
}
private Parameter getParameter(String name, Parameter[] parameters) {
@@ -257,9 +257,9 @@ private String addParameters(String url, List urlParameters) {
new FormUrlEncodedMediaType().writeTo(new ParameterValueMap(urlParameters), out);
return out.toString();
} catch (IOException e) {
- throw new OpenShiftException(e, "Could not add paramters {0} to url {1}", urlParameters, url);
+ throw new OpenShiftException(e, "Could not add parameters {0} to url {1}", urlParameters, url);
} catch (EncodingException e) {
- throw new OpenShiftException(e, "Could not add paramters {0} to url {1}", urlParameters, url);
+ throw new OpenShiftException(e, "Could not add parameters {0} to url {1}", urlParameters, url);
}
}
diff --git a/src/main/java/com/openshift/internal/client/ssh/AbstractSSHKey.java b/src/main/java/com/openshift/internal/client/ssh/AbstractSSHKey.java
index 0cbdd48d..8ceab5e2 100644
--- a/src/main/java/com/openshift/internal/client/ssh/AbstractSSHKey.java
+++ b/src/main/java/com/openshift/internal/client/ssh/AbstractSSHKey.java
@@ -11,7 +11,7 @@
package com.openshift.internal.client.ssh;
import com.openshift.client.ISSHPublicKey;
-import com.openshift.client.OpenShiftUnknonwSSHKeyTypeException;
+import com.openshift.client.OpenShiftUnknownSSHKeyTypeException;
import com.openshift.client.SSHKeyType;
/**
@@ -29,7 +29,7 @@ public SSHKeyType getKeyType() {
return keyType;
}
- protected void setKeyType(String keyTypeId) throws OpenShiftUnknonwSSHKeyTypeException {
+ protected void setKeyType(String keyTypeId) throws OpenShiftUnknownSSHKeyTypeException {
setKeyType(SSHKeyType.getByTypeId(keyTypeId));
}
@@ -54,9 +54,7 @@ public boolean equals(Object obj) {
if (getClass() != obj.getClass())
return false;
AbstractSSHKey other = (AbstractSSHKey) obj;
- if (keyType != other.keyType)
- return false;
- return true;
+ return keyType == other.keyType;
}
@Override
diff --git a/src/main/java/com/openshift/internal/client/utils/IOpenShiftJsonConstants.java b/src/main/java/com/openshift/internal/client/utils/IOpenShiftJsonConstants.java
index 73a264f2..41b2fc48 100755
--- a/src/main/java/com/openshift/internal/client/utils/IOpenShiftJsonConstants.java
+++ b/src/main/java/com/openshift/internal/client/utils/IOpenShiftJsonConstants.java
@@ -82,6 +82,7 @@ public class IOpenShiftJsonConstants {
public static final String PROPERTY_REL = "rel";
public static final String PROPERTY_REQUIRED_PARAMS = "required_params";
public static final String PROPERTY_RESULT = "result";
+ public static final String PROPERTY_REGION = "region";
public static final String PROPERTY_RHLOGIN = "rhlogin";
public static final String PROPERTY_RHC_DOMAIN = "rhc_domain";
public static final String PROPERTY_SCALABLE = "scalable";
diff --git a/src/main/java/com/openshift/internal/client/utils/StreamUtils.java b/src/main/java/com/openshift/internal/client/utils/StreamUtils.java
index f92891e5..016c46ef 100644
--- a/src/main/java/com/openshift/internal/client/utils/StreamUtils.java
+++ b/src/main/java/com/openshift/internal/client/utils/StreamUtils.java
@@ -69,6 +69,7 @@ public static String readToString(Reader reader) throws IOException {
writer.write(line);
writer.write('\n');
}
+ bufferedReader.close();
return writer.toString();
}
diff --git a/src/main/java/com/openshift/internal/client/utils/StringUtils.java b/src/main/java/com/openshift/internal/client/utils/StringUtils.java
index aec23d2b..a7e94d4e 100644
--- a/src/main/java/com/openshift/internal/client/utils/StringUtils.java
+++ b/src/main/java/com/openshift/internal/client/utils/StringUtils.java
@@ -40,7 +40,7 @@ public static String prependIfNonEmpty(String prefix, String string) {
return string;
}
- return new StringBuilder(prefix).append(string).toString();
+ return prefix + string;
}
public static String nullToEmptyString(String string) {
diff --git a/src/main/java/com/openshift/internal/client/utils/UrlUtils.java b/src/main/java/com/openshift/internal/client/utils/UrlUtils.java
index ff1993f3..22546319 100644
--- a/src/main/java/com/openshift/internal/client/utils/UrlUtils.java
+++ b/src/main/java/com/openshift/internal/client/utils/UrlUtils.java
@@ -41,10 +41,7 @@ public static String ensureStartsWithHttps(String url) {
return url;
}
- return new StringBuilder(HTTPS)
- .append(SCHEMA_SEPARATOR)
- .append(url)
- .toString();
+ return HTTPS + SCHEMA_SEPARATOR + url;
}
public static boolean isUrl(String string) {
@@ -62,7 +59,7 @@ public static String appendPath(String parent, String child) {
if (child.charAt(0) == '/') {
return parent + child;
} else {
- return new StringBuilder(parent).append('/').append(child).toString();
+ return parent + '/' + child;
}
}
}
diff --git a/src/test/java/com/openshift/client/fakes/HttpServerFake.java b/src/test/java/com/openshift/client/fakes/HttpServerFake.java
index 88acc6f7..7726696d 100644
--- a/src/test/java/com/openshift/client/fakes/HttpServerFake.java
+++ b/src/test/java/com/openshift/client/fakes/HttpServerFake.java
@@ -70,9 +70,9 @@ public HttpServerFake(String response, String statusLine) {
* @param port
* the port to listen to (address is always localhost)
* @param response
- * the reponse to return to the requesting socket. If
+ * the response to return to the requesting socket. If
* null the request string is returned.
- * @param statusLine the staus line that shall be returned
+ * @param statusLine the status line that shall be returned
*
* @see ServerFakeSocket#getResponse(Socket)
*/
@@ -162,7 +162,7 @@ protected void writeResponseHeader(OutputStream outputStream) throws IOException
* Returns the response given to this server at creation time or the
* content that may be read from the socket is returned.
*
- * @param inputStream
+ * @param socket
* @return
* @throws IOException
*/
@@ -174,8 +174,7 @@ private String getResponse(Socket socket) throws IOException {
}
private String readRequestToString(InputStream inputStream) throws IOException {
- BufferedReader bufferedReader = null;
- bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
+ BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
StringWriter writer = new StringWriter();
String line = null;
while ((line = bufferedReader.readLine()) != null) {
diff --git a/src/test/java/com/openshift/client/fakes/HttpsServerFake.java b/src/test/java/com/openshift/client/fakes/HttpsServerFake.java
index 6b97efbd..a63ef595 100644
--- a/src/test/java/com/openshift/client/fakes/HttpsServerFake.java
+++ b/src/test/java/com/openshift/client/fakes/HttpsServerFake.java
@@ -47,10 +47,10 @@ public HttpsServerFake(int port) {
* @param port
* the port to listen to (address is always localhost)
* @param response
- * the reponse to return to the requesting socket. If
+ * the response to return to the requesting socket. If
* null the request string is returned.
* @param statusLine
- * the staus line that shall be returned
+ * the status line that shall be returned
*
* @see ServerFakeSocket#getResponse(Socket)
*/
@@ -83,7 +83,7 @@ protected ServerSocket createServerSocket(int port) throws Exception {
KeyManagerFactory keyManagerFactory =
KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());
keyManagerFactory.init(keyStore, KEYSTORE_PASSWORD.toCharArray());
- KeyManager keyManagers[] = keyManagerFactory.getKeyManagers();
+ KeyManager[] keyManagers = keyManagerFactory.getKeyManagers();
SSLContext sslContext = SSLContext.getInstance("TLS");
sslContext.init(keyManagers, null, null);
diff --git a/src/test/java/com/openshift/client/fakes/WaitingHttpServerFake.java b/src/test/java/com/openshift/client/fakes/WaitingHttpServerFake.java
index 7afdfe8b..72e68613 100644
--- a/src/test/java/com/openshift/client/fakes/WaitingHttpServerFake.java
+++ b/src/test/java/com/openshift/client/fakes/WaitingHttpServerFake.java
@@ -27,8 +27,7 @@ protected void write(byte[] text, OutputStream outputStream) throws IOException
try {
Thread.sleep(delay);
} catch (InterruptedException e) {
- //Intentional ignore
- return ;
+ //Intentional ignored
}
}
diff --git a/src/test/java/com/openshift/client/portforwarding/PortForwardingL.java b/src/test/java/com/openshift/client/portforwarding/PortForwardingL.java
index 7c5ee5fe..953d4011 100644
--- a/src/test/java/com/openshift/client/portforwarding/PortForwardingL.java
+++ b/src/test/java/com/openshift/client/portforwarding/PortForwardingL.java
@@ -25,7 +25,7 @@ public static void main(String[] arg){
try{
JSch jsch=new JSch();
- String host=null;
+ String host = null;
if(arg.length>0){
host=arg[0];
}
@@ -55,8 +55,8 @@ public static void main(String[] arg){
//Channel channel=session.openChannel("shell");
//channel.connect();
- int assinged_port=session.setPortForwardingL(lport, rhost, rport);
- System.out.println("localhost:"+assinged_port+" -> "+rhost+":"+rport);
+ int assigned_port=session.setPortForwardingL(lport, rhost, rport);
+ System.out.println("localhost:"+assigned_port+" -> "+rhost+":"+rport);
}
catch(Exception e){
System.out.println(e);
diff --git a/src/test/java/com/openshift/client/utils/ApplicationAssert.java b/src/test/java/com/openshift/client/utils/ApplicationAssert.java
index ecbcf720..d0be614a 100644
--- a/src/test/java/com/openshift/client/utils/ApplicationAssert.java
+++ b/src/test/java/com/openshift/client/utils/ApplicationAssert.java
@@ -48,7 +48,7 @@ public class ApplicationAssert implements AssertExtension {
public static final Pattern APPLICATION_URL_PATTERN = Pattern.compile("https*://(.+)-([^\\.]+)\\.(.+)/(.*)");
public static final Pattern GIT_URL_PATTERN = Pattern.compile("ssh://(.+)@(.+)-([^\\.]+)\\.(.+)/~/git/(.+).git/");
- private static final long APPLICATION_WAIT_TIMEOUT = 2 * 60 * 1000;
+ private static final long APPLICATION_WAIT_TIMEOUT = 2 * 60 * 1000L;
private IApplication application;
diff --git a/src/test/java/com/openshift/client/utils/ApplicationTestUtils.java b/src/test/java/com/openshift/client/utils/ApplicationTestUtils.java
index edf15a19..16b1f422 100755
--- a/src/test/java/com/openshift/client/utils/ApplicationTestUtils.java
+++ b/src/test/java/com/openshift/client/utils/ApplicationTestUtils.java
@@ -32,10 +32,10 @@
public class ApplicationTestUtils {
// 3 minutes
- private static final long WAIT_FOR_APPLICATION = 3 * 60 * 1000;
+ private static final long WAIT_FOR_APPLICATION = 3 * 60 * 1000L;
public static String createRandomApplicationName() {
- return "app" + String.valueOf(System.currentTimeMillis());
+ return "app" + System.currentTimeMillis();
}
public static IApplication createApplication(IStandaloneCartridge cartridge, IDomain domain) {
@@ -242,7 +242,7 @@ public static IOpenShiftConnection getConnection(IDomain domain) {
public static IApplication destroyAllEnvironmentVariables(IApplication application) {
for (String name : application.getEnvironmentVariables().keySet()) {
- application.removeEnvironmentVariable(name);;
+ application.removeEnvironmentVariable(name);
}
return application;
}
diff --git a/src/test/java/com/openshift/client/utils/CartridgeTestUtils.java b/src/test/java/com/openshift/client/utils/CartridgeTestUtils.java
index 9c83d8cf..a598b9da 100644
--- a/src/test/java/com/openshift/client/utils/CartridgeTestUtils.java
+++ b/src/test/java/com/openshift/client/utils/CartridgeTestUtils.java
@@ -126,18 +126,18 @@ public static IEmbeddableCartridge foreman063() throws MalformedURLException {
public static IEmbeddableCartridge createObsoleteEmbeddableCartridge(boolean obsolete) {
return new EmbeddableCartridge(
- obsolete == true ? "obsolete-0.1" : "non-obsolete-0.1"
- , obsolete == true ? "Obsolete 0.1" : "Non-Obsolete 0.1"
- , obsolete == true ? "Obsolete Cartridge 0.1" : "Non-Obsolete Cartridge 0.1"
+ obsolete ? "obsolete-0.1" : "non-obsolete-0.1"
+ , obsolete ? "Obsolete 0.1" : "Non-Obsolete 0.1"
+ , obsolete ? "Obsolete Cartridge 0.1" : "Non-Obsolete Cartridge 0.1"
, obsolete) {
};
}
public static IStandaloneCartridge createObsoleteStandaloneCartridge(boolean obsolete) {
return new StandaloneCartridge(
- obsolete == true ? "obsolete-0.1" : "non-obsolete-0.1"
- , obsolete == true ? "Obsolete 0.1" : "Non-Obsolete 0.1"
- , obsolete == true ? "Obsolete Cartridge 0.1" : "Non-Obsolete Cartridge 0.1"
+ obsolete ? "obsolete-0.1" : "non-obsolete-0.1"
+ , obsolete ? "Obsolete 0.1" : "Non-Obsolete 0.1"
+ , obsolete ? "Obsolete Cartridge 0.1" : "Non-Obsolete Cartridge 0.1"
, obsolete) {
};
diff --git a/src/test/java/com/openshift/client/utils/DeployedStandaloneCartridgeAssert.java b/src/test/java/com/openshift/client/utils/DeployedStandaloneCartridgeAssert.java
index 3dc3d138..ef2f95b6 100644
--- a/src/test/java/com/openshift/client/utils/DeployedStandaloneCartridgeAssert.java
+++ b/src/test/java/com/openshift/client/utils/DeployedStandaloneCartridgeAssert.java
@@ -28,7 +28,7 @@ public CartridgeAssert isEqualTo(IDeployedStandalo
throws OpenShiftException {
super.isEqualTo(otherCartridge);
- assertThat(getCartridge().getAdditionalGearStorage()).equals(otherCartridge.getAdditionalGearStorage());
+ assertThat(getCartridge().getAdditionalGearStorage()).isEqualTo(otherCartridge.getAdditionalGearStorage());
return this;
}
diff --git a/src/test/java/com/openshift/client/utils/EmbeddedCartridgeTestUtils.java b/src/test/java/com/openshift/client/utils/EmbeddedCartridgeTestUtils.java
index 6c301392..175fe754 100644
--- a/src/test/java/com/openshift/client/utils/EmbeddedCartridgeTestUtils.java
+++ b/src/test/java/com/openshift/client/utils/EmbeddedCartridgeTestUtils.java
@@ -73,7 +73,7 @@ public static void silentlyDestroyAllEmbeddedCartridges(IApplication application
* if they aren't they are added.
*
* @param constraint
- * the constraint that selects the available catridges that
+ * the constraint that selects the available cartridges that
* should be present
* @param application
* the application that should have the constrained cartridges
diff --git a/src/test/java/com/openshift/client/utils/GearProfileTestUtils.java b/src/test/java/com/openshift/client/utils/GearProfileTestUtils.java
index e599b036..214b237e 100644
--- a/src/test/java/com/openshift/client/utils/GearProfileTestUtils.java
+++ b/src/test/java/com/openshift/client/utils/GearProfileTestUtils.java
@@ -2,7 +2,6 @@
import com.openshift.client.IDomain;
import com.openshift.client.IGearProfile;
-import com.openshift.internal.client.GearProfile;
import java.util.List;
diff --git a/src/test/java/com/openshift/internal/client/ApplicationResourceIntegrationTest.java b/src/test/java/com/openshift/internal/client/ApplicationResourceIntegrationTest.java
index d9120566..9b5ae5d3 100755
--- a/src/test/java/com/openshift/internal/client/ApplicationResourceIntegrationTest.java
+++ b/src/test/java/com/openshift/internal/client/ApplicationResourceIntegrationTest.java
@@ -47,7 +47,7 @@
*/
public class ApplicationResourceIntegrationTest extends TestTimer {
- private static final long WAIT_TIMEOUT = 3 * 60 * 1000;
+ private static final long WAIT_TIMEOUT = 3 * 60 * 1000L;
private IUser user;
private IDomain domain;
@@ -292,11 +292,8 @@ public void shouldWaitForApplication() throws OpenShiftException, MalformedURLEx
* https://issues.jboss.org/browse/JBIDE-14721
*/
private String createAlias() {
- return new StringBuilder(String.valueOf(System.currentTimeMillis()))
// valid alias is "/\A[a-z0-9]+(-[a-z0-9]+)*(\.[a-z0-9]+(-[a-z0-9]+)*)+\z/"
- .append('.')
- .append('1')
- .toString();
+ return String.valueOf(System.currentTimeMillis()) + '.' + '1';
}
@Test
diff --git a/src/test/java/com/openshift/internal/client/ApplicationResourceTest.java b/src/test/java/com/openshift/internal/client/ApplicationResourceTest.java
index b632f9b0..f5b054e5 100644
--- a/src/test/java/com/openshift/internal/client/ApplicationResourceTest.java
+++ b/src/test/java/com/openshift/internal/client/ApplicationResourceTest.java
@@ -511,7 +511,7 @@ public void shouldWaitUntilTimeout() throws HttpClientException, Throwable {
assertThat(app).isNotNull().isInstanceOf(ApplicationResource.class);
ApplicationResource spy = Mockito.spy(((ApplicationResource) app));
Mockito.doReturn(false).when(spy).canResolv(Mockito.anyString());
- long timeout = 2 * 1000;
+ long timeout = 2 * 1000L;
long startTime = System.currentTimeMillis();
// operation
@@ -526,7 +526,7 @@ public void shouldWaitUntilTimeout() throws HttpClientException, Throwable {
public void shouldEndBeforeTimeout() throws HttpClientException, Throwable {
// pre-conditions
long startTime = System.currentTimeMillis();
- long timeout = 10 * 1000;
+ long timeout = 10 * 1000L;
final IApplication app = domain.getApplicationByName("springeap6");
assertThat(app).isNotNull().isInstanceOf(ApplicationResource.class);
ApplicationResource spy = Mockito.spy(((ApplicationResource) app));
@@ -617,7 +617,7 @@ public void shouldUpdateOneEnvironmentVariableToApplication() throws Throwable {
POST_ADD_ENVIRONMENT_VARIABLE_FOO_TO_FOOBARZ_SPRINGEAP6)
.mockGetEnvironmentVariables("foobarz", "springeap6", GET_0_ENVIRONMENT_VARIABLES_FOOBARZ_SPRINGEAP6,
GET_1_ENVIRONMENT_VARIABLES_FOOBARZ_SPRINGEAP6)
- .mockUpdateEnvironmentVariableValue("foobarz", "springeap6", "FOO", PUT_FOO_ENVIRONMENT_VARIABLE_FOOBARZ_SPRINGEAP6);;
+ .mockUpdateEnvironmentVariableValue("foobarz", "springeap6", "FOO", PUT_FOO_ENVIRONMENT_VARIABLE_FOOBARZ_SPRINGEAP6);
// operation
final IApplication app = domain.getApplicationByName("springeap6");
@@ -700,7 +700,7 @@ public void shouldRemoveEnvironmentVariableByName() throws Throwable {
GET_1_ENVIRONMENT_VARIABLES_FOOBARZ_SPRINGEAP6, GET_0_ENVIRONMENT_VARIABLES_FOOBARZ_SPRINGEAP6);
final IApplication app = domain.getApplicationByName("springeap6");
assertThat(app.getEnvironmentVariables()).hasSize(1);
- assertThat(app.getEnvironmentVariables().get("FOO").getName() == "FOO");
+ assertThat(app.getEnvironmentVariables().get("FOO").getName().equals("FOO"));
// operation
app.removeEnvironmentVariable("FOO");
@@ -782,5 +782,20 @@ public void shouldEqualApplication() throws Throwable {
assertTrue(domain != this.domain);
}
+ @Test
+ public void shouldToString() {
+ // pre-conditions
+ assertThat(domain).isNotNull();
+ final IApplication app = domain.getApplicationByName("springeap6");
+ assertThat(app).isNotNull();
+
+ // operation
+ String appString = app.toString();
+
+ // verifications
+ assertThat(appString).isNotEmpty();
+
+ }
+
}
diff --git a/src/test/java/com/openshift/internal/client/CartridgeQueryTest.java b/src/test/java/com/openshift/internal/client/CartridgeQueryTest.java
index f5bbedbd..7d74c8ab 100644
--- a/src/test/java/com/openshift/internal/client/CartridgeQueryTest.java
+++ b/src/test/java/com/openshift/internal/client/CartridgeQueryTest.java
@@ -338,15 +338,6 @@ public void shouldSelectZend() {
assertCartridge(IStandaloneCartridge.NAME_ZEND, LatestVersionOf.zend().get(connection));
}
- @Test
- public void shouldSelectMmsAgent() {
- // pre-conditions
- // operation
- // verification
- assertCartridge(IEmbeddedCartridge.NAME_10GEN_MMS_AGENT,
- LatestVersionOf.mmsAgent().get(connection));
- }
-
@Test
public void shouldSelectHaProxy() {
// pre-conditions
diff --git a/src/test/java/com/openshift/internal/client/DomainResourceIntegrationTest.java b/src/test/java/com/openshift/internal/client/DomainResourceIntegrationTest.java
index 1767c40c..eb9da858 100755
--- a/src/test/java/com/openshift/internal/client/DomainResourceIntegrationTest.java
+++ b/src/test/java/com/openshift/internal/client/DomainResourceIntegrationTest.java
@@ -108,7 +108,7 @@ public void shouldNotDeleteDomainWithApplications() throws OpenShiftException {
// operation
domain.destroy();
// verification
- fail("OpenShiftEndpointException did not occurr");
+ fail("OpenShiftEndpointException did not occur");
} catch (OpenShiftEndpointException e) {
// verification
}
@@ -125,7 +125,7 @@ public void shouldContainErrorMessageAndContainErrorCode128() throws OpenShiftEx
// operation
domain.destroy();
- fail("OpenShiftEndpointException did not occurr");
+ fail("OpenShiftEndpointException did not occur");
} catch (OpenShiftEndpointException e) {
// verification
assertThat(e.getRestResponseMessages().size()).isEqualTo(1);
diff --git a/src/test/java/com/openshift/internal/client/EmbeddableCartridgeTest.java b/src/test/java/com/openshift/internal/client/EmbeddableCartridgeTest.java
index b8f5796c..3909d977 100644
--- a/src/test/java/com/openshift/internal/client/EmbeddableCartridgeTest.java
+++ b/src/test/java/com/openshift/internal/client/EmbeddableCartridgeTest.java
@@ -48,7 +48,7 @@ public void setup() throws Throwable {
@Test
public void shouldNonDownloadableEqualsNonDownloadable() {
- // pre-coniditions
+ // pre-conditions
// operation
// verification
assertThat(new EmbeddableCartridge("redhat"))
@@ -59,7 +59,7 @@ public void shouldNonDownloadableEqualsNonDownloadable() {
@Test
public void shouldDownloadableEqualsDownloadable() throws MalformedURLException {
- // pre-coniditions
+ // pre-conditions
// operation
// verification
assertThat(new EmbeddableCartridge(new URL(CartridgeTestUtils.FOREMAN_URL)))
@@ -68,12 +68,12 @@ public void shouldDownloadableEqualsDownloadable() throws MalformedURLException
@Test
public void shouldDownloadableWithNonEqualNameEqualsDownloadable() throws MalformedURLException {
- // pre-coniditions
+ // pre-conditions
// operation
// verification
assertThat(new EmbeddableCartridge("redhat", new URL(CartridgeTestUtils.FOREMAN_URL)))
.isEqualTo(new EmbeddableCartridge(null, new URL(CartridgeTestUtils.FOREMAN_URL)));
- // should equal if url is equal, name doesnt matter
+ // should equal if url is equal, name doesn't matter
// (name is updated as soon as cartridge is deployed)
assertThat(new EmbeddableCartridge("jboss", new URL(CartridgeTestUtils.FOREMAN_URL)))
.isEqualTo(new EmbeddableCartridge("redhat", new URL(CartridgeTestUtils.FOREMAN_URL)));
@@ -81,7 +81,7 @@ public void shouldDownloadableWithNonEqualNameEqualsDownloadable() throws Malfor
@Test
public void shouldDownloadableStandaloneNotEqualsDownloadableEmbeddable() throws MalformedURLException {
- // pre-coniditions
+ // pre-conditions
// operation
// verification
assertThat(new EmbeddableCartridge(null, new URL(CartridgeTestUtils.FOREMAN_URL)))
@@ -89,13 +89,13 @@ public void shouldDownloadableStandaloneNotEqualsDownloadableEmbeddable() throws
}
@Test
- public void shouldHaveNameDisplaynameDescription() throws Throwable {
+ public void shouldHaveNameDisplayNameDescription() throws Throwable {
// pre-condition
IEmbeddableCartridge mongoDb = connection.getEmbeddableCartridges().get(0);
CartridgeAssert cartridgeAssert = new CartridgeAssert(mongoDb);
// operation
- // verifcation
+ // verification
cartridgeAssert
.hasName("mongodb-2.2")
.hasDisplayName("MongoDB NoSQL Database 2.2")
@@ -104,7 +104,7 @@ public void shouldHaveNameDisplaynameDescription() throws Throwable {
@Test
public void shouldHaveObsoleteCartridges() throws MalformedURLException {
- // pre-coniditions
+ // pre-conditions
// operation
ICartridge metrics = new CartridgeNameQuery("metrics").get(connection.getCartridges(true));
assertThat(metrics).isNotNull();
diff --git a/src/test/java/com/openshift/internal/client/EmbeddedCartridgeResourceIntegrationTest.java b/src/test/java/com/openshift/internal/client/EmbeddedCartridgeResourceIntegrationTest.java
index 0d920cb2..8f806409 100755
--- a/src/test/java/com/openshift/internal/client/EmbeddedCartridgeResourceIntegrationTest.java
+++ b/src/test/java/com/openshift/internal/client/EmbeddedCartridgeResourceIntegrationTest.java
@@ -87,7 +87,7 @@ public boolean matches(List> values) {
}
if (php.getName().equals(((ICartridge)value).getName())) {
return true;
- };
+ }
}
return false;
}
diff --git a/src/test/java/com/openshift/internal/client/EmbeddedCartridgeResourceTest.java b/src/test/java/com/openshift/internal/client/EmbeddedCartridgeResourceTest.java
index 02264148..ac119112 100644
--- a/src/test/java/com/openshift/internal/client/EmbeddedCartridgeResourceTest.java
+++ b/src/test/java/com/openshift/internal/client/EmbeddedCartridgeResourceTest.java
@@ -73,7 +73,7 @@ public void setUp() throws SocketTimeoutException, HttpClientException, Throwabl
@Test
public void shouldEmbeddedCartridgeEqualsEmbeddableCartridge() {
- // pre-coniditions
+ // pre-conditions
IEmbeddedCartridge embeddedCartridgeFake = createEmbeddedCartridgeFake("redhat");
// operation
@@ -85,7 +85,7 @@ public void shouldEmbeddedCartridgeEqualsEmbeddableCartridge() {
@Test
public void shouldHaveSameHashCode() {
- // pre-coniditions
+ // pre-conditions
IEmbeddedCartridge embeddedCartridgeFake = createEmbeddedCartridgeFake("redhat");
// operation
// verification
@@ -94,7 +94,7 @@ public void shouldHaveSameHashCode() {
@Test
public void shouldEmbeddableCartridgeWithNameEqualsEmbeddedCartridgeWithoutName() throws MalformedURLException {
- // pre-coniditions
+ // pre-conditions
// operation
// verification
assertEquals(new EmbeddableCartridge(null, new URL(CartridgeTestUtils.FOREMAN_URL)),
@@ -103,7 +103,7 @@ public void shouldEmbeddableCartridgeWithNameEqualsEmbeddedCartridgeWithoutName(
@Test
public void shouldRemoveEmbeddedCartridgeInASetByEmbeddableCartridge() {
- // pre-coniditions
+ // pre-conditions
IEmbeddedCartridge embeddedCartridgeMock = createEmbeddedCartridgeFake("redhat");
HashSet cartridges = new HashSet();
cartridges.add(embeddedCartridgeMock);
diff --git a/src/test/java/com/openshift/internal/client/LatestVersionQueryIntegrationTest.java b/src/test/java/com/openshift/internal/client/LatestVersionQueryIntegrationTest.java
index ed343ac2..2a33804a 100644
--- a/src/test/java/com/openshift/internal/client/LatestVersionQueryIntegrationTest.java
+++ b/src/test/java/com/openshift/internal/client/LatestVersionQueryIntegrationTest.java
@@ -39,7 +39,7 @@ public void setUp() throws OpenShiftException, FileNotFoundException, IOExceptio
@Test
public void shouldSelectJBossAs() {
- // pre-coniditions
+ // pre-conditions
// operation
// verification
assertCartridge(IStandaloneCartridge.NAME_JBOSSAS, LatestVersionOf.jbossAs().get(user));
@@ -47,7 +47,7 @@ public void shouldSelectJBossAs() {
@Test
public void shouldSelectJBossEap() {
- // pre-coniditions
+ // pre-conditions
// operation
// verification
assertCartridge(IStandaloneCartridge.NAME_JBOSSEAP, LatestVersionOf.jbossEap().get(user));
@@ -55,7 +55,7 @@ public void shouldSelectJBossEap() {
@Test
public void shouldSelectJBossEws() {
- // pre-coniditions
+ // pre-conditions
// operation
// verification
assertCartridge(IStandaloneCartridge.NAME_JBOSSEWS, LatestVersionOf.jbossEws().get(user));
@@ -63,7 +63,7 @@ public void shouldSelectJBossEws() {
@Test
public void shouldSelectJenkins() {
- // pre-coniditions
+ // pre-conditions
// operation
// verification
assertCartridge(IStandaloneCartridge.NAME_JENKINS, LatestVersionOf.jenkins().get(user));
@@ -71,7 +71,7 @@ public void shouldSelectJenkins() {
@Test
public void shouldSelectPerl() {
- // pre-coniditions
+ // pre-conditions
// operation
// verification
assertCartridge(IStandaloneCartridge.NAME_PERL, LatestVersionOf.perl().get(user));
@@ -79,7 +79,7 @@ public void shouldSelectPerl() {
@Test
public void shouldSelectPhp() {
- // pre-coniditions
+ // pre-conditions
// operation
// verification
assertCartridge(IStandaloneCartridge.NAME_PHP, LatestVersionOf.php().get(user));
@@ -87,7 +87,7 @@ public void shouldSelectPhp() {
@Test
public void shouldSelectPython() {
- // pre-coniditions
+ // pre-conditions
// operation
// verification
assertCartridge(IStandaloneCartridge.NAME_PYTHON, LatestVersionOf.python().get(user));
@@ -95,7 +95,7 @@ public void shouldSelectPython() {
@Test
public void shouldSelectRuby() {
- // pre-coniditions
+ // pre-conditions
// operation
// verification
assertCartridge(IStandaloneCartridge.NAME_RUBY, LatestVersionOf.ruby().get(user));
@@ -103,24 +103,16 @@ public void shouldSelectRuby() {
@Test
public void shouldSelectZend() {
- // pre-coniditions
+ // pre-conditions
// operation
// verification
assertCartridge(IStandaloneCartridge.NAME_ZEND, LatestVersionOf.zend().get(user));
}
- @Test
- public void shouldSelectMmsAgent() {
- // pre-coniditions
- // operation
- // verification
- assertCartridge(IEmbeddedCartridge.NAME_10GEN_MMS_AGENT, LatestVersionOf.mmsAgent().get(user));
- }
-
@Test
public void shouldSelectHaProxy() {
- // pre-coniditions
+ // pre-conditions
// operation
// verification
assertCartridge(IEmbeddedCartridge.NAME_HAPROXY, LatestVersionOf.haProxy().get(user));
@@ -128,7 +120,7 @@ public void shouldSelectHaProxy() {
@Test
public void shouldSelectJenkinsClient() {
- // pre-coniditions
+ // pre-conditions
// operation
// verification
assertCartridge(IEmbeddedCartridge.NAME_JENKINS_CLIENT, LatestVersionOf.jenkinsClient().get(user));
@@ -136,7 +128,7 @@ public void shouldSelectJenkinsClient() {
@Test
public void shouldSelectMongoDb() {
- // pre-coniditions
+ // pre-conditions
// operation
// verification
assertCartridge(IEmbeddedCartridge.NAME_MONGODB, LatestVersionOf.mongoDB().get(user));
@@ -144,7 +136,7 @@ public void shouldSelectMongoDb() {
@Test
public void shouldSelectMySql() {
- // pre-coniditions
+ // pre-conditions
// operation
// verification
assertCartridge(IEmbeddedCartridge.NAME_MYSQL, LatestVersionOf.mySQL().get(user));
@@ -152,7 +144,7 @@ public void shouldSelectMySql() {
@Test
public void shouldSelectPhpMyAdmin() {
- // pre-coniditions
+ // pre-conditions
// operation
// verification
assertCartridge(IEmbeddedCartridge.NAME_PHPMYADMIN, LatestVersionOf.phpMyAdmin().get(user));
@@ -160,7 +152,7 @@ public void shouldSelectPhpMyAdmin() {
@Test
public void shouldSelectpostgreSql() {
- // pre-coniditions
+ // pre-conditions
// operation
// verification
assertCartridge(IEmbeddedCartridge.NAME_POSTGRESQL, LatestVersionOf.postgreSQL().get(user));
@@ -168,7 +160,7 @@ public void shouldSelectpostgreSql() {
@Test
public void shouldSelectRockmongo() {
- // pre-coniditions
+ // pre-conditions
// operation
// verification
assertCartridge(IEmbeddedCartridge.NAME_ROCKMONGO, LatestVersionOf.rockMongo().get(user));
diff --git a/src/test/java/com/openshift/internal/client/SSHKeyIntegrationTest.java b/src/test/java/com/openshift/internal/client/SSHKeyIntegrationTest.java
index 917e118d..e1cde802 100644
--- a/src/test/java/com/openshift/internal/client/SSHKeyIntegrationTest.java
+++ b/src/test/java/com/openshift/internal/client/SSHKeyIntegrationTest.java
@@ -271,14 +271,12 @@ public void shouldRefreshKeys() throws Exception {
IUser user = new TestConnectionBuilder().defaultCredentials().disableSSLCertificateChecks().create().getUser();
// operation
- int newNumOfKeys = user.getSSHKeys().size();
assertThat(user.getSSHKeys().size()).isEqualTo(originalNumOfKeys);
String newKeyName = SSHKeyTestUtils.createRandomKeyName();
user.addSSHKey(newKeyName, new SSHPublicKey(publicKeyPath));
- newNumOfKeys = user.getSSHKeys().size();
// verification
- assertThat(newNumOfKeys).isEqualTo(originalNumOfKeys + 1);
+ assertThat(user.getSSHKeys().size()).isEqualTo(originalNumOfKeys + 1);
} finally {
SSHKeyTestUtils.silentlyDestroyKey(key);
}
diff --git a/src/test/java/com/openshift/internal/client/SSHKeyTest.java b/src/test/java/com/openshift/internal/client/SSHKeyTest.java
index 558c0b6e..93e6524d 100644
--- a/src/test/java/com/openshift/internal/client/SSHKeyTest.java
+++ b/src/test/java/com/openshift/internal/client/SSHKeyTest.java
@@ -29,7 +29,7 @@
import com.openshift.client.ISSHPublicKey;
import com.openshift.client.IUser;
import com.openshift.client.OpenShiftSSHKeyException;
-import com.openshift.client.OpenShiftUnknonwSSHKeyTypeException;
+import com.openshift.client.OpenShiftUnknownSSHKeyTypeException;
import com.openshift.client.SSHKeyPair;
import com.openshift.client.SSHKeyType;
import com.openshift.client.SSHPublicKey;
@@ -164,13 +164,13 @@ public void shouldLoadPublicKeyDsa() throws Exception {
}
@Test
- public void shouldGetKeyTypeByTypeId() throws OpenShiftUnknonwSSHKeyTypeException {
+ public void shouldGetKeyTypeByTypeId() throws OpenShiftUnknownSSHKeyTypeException {
assertTrue(SSHKeyType.SSH_DSA == SSHKeyType.getByTypeId(SSHKeyTestUtils.SSH_DSA));
assertTrue(SSHKeyType.SSH_RSA == SSHKeyType.getByTypeId(SSHKeyTestUtils.SSH_RSA));
}
- @Test(expected = OpenShiftUnknonwSSHKeyTypeException.class)
- public void getKeyTypeByTypeIdReturnsNullIfNoMatchingType() throws OpenShiftUnknonwSSHKeyTypeException {
+ @Test(expected = OpenShiftUnknownSSHKeyTypeException.class)
+ public void getKeyTypeByTypeIdReturnsNullIfNoMatchingType() throws OpenShiftUnknownSSHKeyTypeException {
SSHKeyType.getByTypeId("dummy");
}
diff --git a/src/test/java/com/openshift/internal/client/StandaloneCartridgeResourceIntegrationTest.java b/src/test/java/com/openshift/internal/client/StandaloneCartridgeResourceIntegrationTest.java
index fd7e14c7..e567bea8 100755
--- a/src/test/java/com/openshift/internal/client/StandaloneCartridgeResourceIntegrationTest.java
+++ b/src/test/java/com/openshift/internal/client/StandaloneCartridgeResourceIntegrationTest.java
@@ -88,7 +88,7 @@ public void shouldGetGearStorage() throws OpenShiftException, URISyntaxException
int additionalGearStorage = cartridge.getAdditionalGearStorage();
// verification
- // reload user info to ensure the storage info isnt cached
+ // reload user info to ensure the storage info isn't cached
assertThat(additionalGearStorage).isNotEqualTo(IGearGroup.NO_ADDITIONAL_GEAR_STORAGE);
}
@@ -104,7 +104,7 @@ public void shouldSetGearStorage() throws OpenShiftException, URISyntaxException
cartridge.setAdditionalGearStorage(newAdditionalGearStorage);
// verification
- // reload user info to ensure the storage info isnt cached
+ // reload user info to ensure the storage info isn't cached
assertThat(cartridge.getAdditionalGearStorage()).isEqualTo(newAdditionalGearStorage);
}
@@ -121,7 +121,7 @@ public void shouldSeeNewAdditionalGearStorageInNewConnection() throws OpenShiftE
cartridge.setAdditionalGearStorage(additionalGearStorage);
// verification
- // reload user info to ensure the storage info isnt cached
+ // reload user info to ensure the storage info isn't cached
IUser newUser = new TestConnectionBuilder()
.defaultCredentials()
.disableSSLCertificateChecks()
diff --git a/src/test/java/com/openshift/internal/client/StandaloneCartridgeResourceTest.java b/src/test/java/com/openshift/internal/client/StandaloneCartridgeResourceTest.java
index d88ec32e..783aa9ee 100644
--- a/src/test/java/com/openshift/internal/client/StandaloneCartridgeResourceTest.java
+++ b/src/test/java/com/openshift/internal/client/StandaloneCartridgeResourceTest.java
@@ -27,7 +27,6 @@
import org.junit.Before;
import org.junit.Test;
-import org.mockito.Mockito;
import com.openshift.client.IApplication;
import com.openshift.client.IDomain;
@@ -154,7 +153,7 @@ public void shouldGetGearStorage() throws OpenShiftException, IOException {
int additionalGearStorage = cartridge.getAdditionalGearStorage();
// verification
- // reload user info to ensure the storage info isnt cached
+ // reload user info to ensure the storage info isn't cached
assertThat(additionalGearStorage).isNotEqualTo(IGearGroup.NO_ADDITIONAL_GEAR_STORAGE);
}
@@ -169,7 +168,7 @@ public void shouldSetGearStorage() throws OpenShiftException, IOException {
cartridge.setAdditionalGearStorage(newAdditionalGearStorage);
// verification
- // reload user info to ensure the storage info isnt cached
+ // reload user info to ensure the storage info isn't cached
mockDirector.mockGetGearGroups("foobarz", "springeap6", Samples.GET_DOMAINS_FOOBARZ_APPLICATIONS_SPRINGEAP6_GEARGROUPS_12ADDITIONALGEARSTORAGE);
assertThat(cartridge.getAdditionalGearStorage()).isEqualTo(newAdditionalGearStorage);
}
diff --git a/src/test/java/com/openshift/internal/client/StandaloneCartridgeTest.java b/src/test/java/com/openshift/internal/client/StandaloneCartridgeTest.java
index 90e1e733..667ebc48 100644
--- a/src/test/java/com/openshift/internal/client/StandaloneCartridgeTest.java
+++ b/src/test/java/com/openshift/internal/client/StandaloneCartridgeTest.java
@@ -47,7 +47,7 @@ public void setup() throws Throwable {
@Test
public void shouldDownloadableWithDifferentNameEqualsDownloadable() throws MalformedURLException {
- // pre-coniditions
+ // pre-conditions
// operation
// verification
assertThat(new StandaloneCartridge("redhat", new URL(CartridgeTestUtils.GO_URL)))
@@ -60,7 +60,7 @@ public void shouldDownloadableWithDifferentNameEqualsDownloadable() throws Malfo
@Test
public void shouldDownloadableStandaloneNotEqualsDownloadableEmbeddable() throws MalformedURLException {
- // pre-coniditions
+ // pre-conditions
// operation
// verification
assertThat(new StandaloneCartridge(new URL(CartridgeTestUtils.GO_URL)))
@@ -74,7 +74,7 @@ public void shouldHaveNameDisplaynameDescription() throws Throwable {
CartridgeAssert cartridgeAssert = new CartridgeAssert(nodeJs);
// operation
- // verifcation
+ // verification
cartridgeAssert
.hasName("nodejs-0.6")
.hasDisplayName("Node.js 0.6")
@@ -86,7 +86,7 @@ public void shouldHaveNameDisplaynameDescription() throws Throwable {
@Test
public void standaloneCartridgeResourceShouldEqualStandAloneCartridgeWithoutName() throws MalformedURLException {
- // pre-coniditions
+ // pre-conditions
// operation
// verification
assertEquals(new StandaloneCartridge(new URL(CartridgeTestUtils.FOREMAN_URL)),
diff --git a/src/test/java/com/openshift/internal/client/TestTimer.java b/src/test/java/com/openshift/internal/client/TestTimer.java
index 769c87a5..09881681 100644
--- a/src/test/java/com/openshift/internal/client/TestTimer.java
+++ b/src/test/java/com/openshift/internal/client/TestTimer.java
@@ -1,7 +1,7 @@
package com.openshift.internal.client;
import com.openshift.client.OpenShiftException;
-import com.openshift.client.utils.TestConnectionFactory;
+
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
diff --git a/src/test/java/com/openshift/internal/client/UserResourceIntegrationTest.java b/src/test/java/com/openshift/internal/client/UserResourceIntegrationTest.java
index a91d89e4..084adae2 100755
--- a/src/test/java/com/openshift/internal/client/UserResourceIntegrationTest.java
+++ b/src/test/java/com/openshift/internal/client/UserResourceIntegrationTest.java
@@ -58,7 +58,7 @@ public void shouldReturnId() throws OpenShiftException {
@Test(expected = InvalidCredentialsOpenShiftException.class)
public void shouldThrowIfInvalidCredentials() throws Exception {
- // dont test on dev server
+ // don't test on dev server
OpenShiftTestConfiguration configuration = new OpenShiftTestConfiguration();
if (configuration.isDevelopmentServer()) {
throw new InvalidCredentialsOpenShiftException(null, new HttpClientException(""), null);
diff --git a/src/test/java/com/openshift/internal/client/httpclient/HttpClientTest.java b/src/test/java/com/openshift/internal/client/httpclient/HttpClientTest.java
index aa827b92..f02b9e99 100755
--- a/src/test/java/com/openshift/internal/client/httpclient/HttpClientTest.java
+++ b/src/test/java/com/openshift/internal/client/httpclient/HttpClientTest.java
@@ -609,9 +609,9 @@ public void shouldFallbackToDefaultTimeout() throws Throwable {
public Long call() throws Exception {
try {
httpClient.get(serverFake.getUrl(), IHttpClient.NO_TIMEOUT);
- return -1l;
+ return -1L;
} catch (SocketTimeoutException e) {
- return -1l;
+ return -1L;
}
}
});
@@ -728,7 +728,7 @@ public HttpURLConnection createConnection() throws IOException, KeyStoreExceptio
return super.createConnection(new URL("http://localhost"), username, password, authKey, authIV,
token, userAgent, acceptedVersion, acceptedMediaType, sslAuthorizationCallback, NO_TIMEOUT);
}
- };
+ }
private void restoreSystemProperty(String property, String value) {
if (value == null) {
diff --git a/src/test/java/com/openshift/internal/client/httpclient/request/FormUrlEncodedMediaTypeTest.java b/src/test/java/com/openshift/internal/client/httpclient/request/FormUrlEncodedMediaTypeTest.java
index 8f9a6cf5..d3fe7e90 100644
--- a/src/test/java/com/openshift/internal/client/httpclient/request/FormUrlEncodedMediaTypeTest.java
+++ b/src/test/java/com/openshift/internal/client/httpclient/request/FormUrlEncodedMediaTypeTest.java
@@ -67,7 +67,7 @@ public void shouldNotStart2ndWriteWithAmpersand() throws IOException {
.add(new StringParameter("name", "adietish"))
, out);
// verification
- assertThat(out.toString().startsWith("&")).isFalse();;
+ assertThat(out.toString().startsWith("&")).isFalse();
}
@Test
diff --git a/src/test/java/com/openshift/internal/client/response/QuickstartDTOCartridgeQueryTest.java b/src/test/java/com/openshift/internal/client/response/QuickstartDTOCartridgeQueryTest.java
index 57ac79a1..2f87a4a6 100644
--- a/src/test/java/com/openshift/internal/client/response/QuickstartDTOCartridgeQueryTest.java
+++ b/src/test/java/com/openshift/internal/client/response/QuickstartDTOCartridgeQueryTest.java
@@ -141,7 +141,7 @@ public void shouldReturnNamedCartridge() throws Throwable {
// verification
assertThat(cartridge).isNotNull();
- assertThat(cartridge.isDownloadable()).isFalse();;
+ assertThat(cartridge.isDownloadable()).isFalse();
assertThat(cartridges).hasSize(1);
}
diff --git a/src/test/resources/integrationTest.properties b/src/test/resources/integrationTest.properties
index 47ca6939..5ea5aa2a 100755
--- a/src/test/resources/integrationTest.properties
+++ b/src/test/resources/integrationTest.properties
@@ -1,14 +1,10 @@
client_id=openshift-java-client-rest-test
-#libra_server=ec2-23-22-230-135.compute-1.amazonaws.com
#libra_server=int.openshift.redhat.com
libra_server=openshift.redhat.com
-#default_rhlogin=bdecoste92e@gmail.com
-#default_rhlogin=toolsjboss@gmail.com
default_rhlogin=toolsjboss@gmail.com
-#rhpassword=123456
rhpassword=1q2w3e
proxySet=true