Author: adietish
Date: 2011-09-22 13:03:11 -0400 (Thu, 22 Sep 2011)
New Revision: 34963
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/utils/Assert.java
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/fakes/ApplicationResponseFake.java
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/fakes/OpenshiftCredentials.java
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/fakes/UserInfoResponseFake.java
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/Application.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/User.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/UserInfo.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/UserInfoResponseUnmarshaller.java
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/ApplicationIntegrationTest.java
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/ApplicationTest.java
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/UserInfoTest.java
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/utils/ApplicationAsserts.java
Log:
[JBIDE-9591] implementing Application#getGitUri
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/Application.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/Application.java 2011-09-22
16:42:43 UTC (rev 34962)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/Application.java 2011-09-22
17:03:11 UTC (rev 34963)
@@ -7,14 +7,21 @@
*
* Contributors:
* Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
+ ******************************************************************************/
package org.jboss.ide.eclipse.as.openshift.core;
+import java.text.MessageFormat;
import java.util.Date;
+import org.jboss.ide.eclipse.as.openshift.core.internal.utils.Assert;
+/**
+ * @author André Dietisheim
+ */
public class Application {
+ private static final String GIT_URI_PATTERN =
"ssh://{0}@{1}-{2}.{3}/~/git/{1}.git/";
+
private String name;
private Cartridge cartridge;
private String uuid;
@@ -22,25 +29,36 @@
private String embedded;
private IOpenshiftService service;
private ApplicationLogReader logReader;
+
+ private User user;
+ private boolean userInfoQueried;
+
public Application(String name, Cartridge cartridge, IOpenshiftService service) {
- this(name, null, cartridge, null, null, service);
+ this(name, null, cartridge, null, null, null, service);
+
+ this.userInfoQueried = false;
}
-
- public Application(String name, String uuid, Cartridge cartridge, String embedded, Date
creationTime, IOpenshiftService service) {
+
+ public Application(String name, String uuid, Cartridge cartridge, String embedded, Date
creationTime, User user,
+ IOpenshiftService service) {
this.name = name;
this.cartridge = cartridge;
this.uuid = uuid;
this.embedded = embedded;
this.creationTime = creationTime;
+ this.user = user;
this.service = service;
+
+ this.userInfoQueried = true;
}
public String getName() {
return name;
}
- public String getUUID() {
+ public String getUUID() throws OpenshiftException {
+ updateFromUserInfoIfNeeded();
return uuid;
}
@@ -48,18 +66,25 @@
return cartridge;
}
- public String getEmbedded() {
+ public String getEmbedded() throws OpenshiftException {
+ updateFromUserInfoIfNeeded();
return embedded;
}
- public Date getCreationTime() {
+ public Date getCreationTime() throws OpenshiftException {
+ updateFromUserInfoIfNeeded();
return creationTime;
}
+ protected User getUser() throws OpenshiftException {
+ updateFromUserInfoIfNeeded();
+ return user;
+ }
+
public void destroy() throws OpenshiftException {
service.destroyApplication(name, cartridge);
}
-
+
public void start() throws OpenshiftException {
service.startApplication(name, cartridge);
}
@@ -71,11 +96,48 @@
public void stop() throws OpenshiftException {
service.stopApplication(name, cartridge);
}
-
+
public ApplicationLogReader getLog() throws OpenshiftException {
if (logReader == null) {
this.logReader = new ApplicationLogReader(this, service);
}
return logReader;
}
+
+ public String getGitUri() throws OpenshiftException {
+ String namespace = null;
+ String rhcDomain = null;
+ Domain domain = getDomain();
+ if (domain != null) {
+ namespace = domain.getNamespace();
+ rhcDomain = domain.getRhcDomain();
+ }
+
+ return MessageFormat.format(GIT_URI_PATTERN, getUUID(), getName(), namespace,
rhcDomain);
+ }
+
+ private Domain getDomain() throws OpenshiftException {
+ return Assert.assertNotNull(getUser()).getDomain();
+ }
+
+ private void updateFromUserInfoIfNeeded() throws OpenshiftException {
+ if (!userInfoQueried) {
+ updateFrom(service.getUserInfo());
+ this.userInfoQueried = true;
+ }
+ }
+
+ private void updateFrom(UserInfo userInfo) {
+ updateFrom(userInfo.getApplicationByName(getName()));
+ this.user = userInfo.getUser();
+ }
+
+ private void updateFrom(Application application) {
+ this.cartridge = application.cartridge;
+ this.creationTime = application.creationTime;
+ this.name = application.name;
+ this.uuid = application.uuid;
+
+ this.userInfoQueried = false;
+ }
}
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/User.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/User.java 2011-09-22
16:42:43 UTC (rev 34962)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/User.java 2011-09-22
17:03:11 UTC (rev 34963)
@@ -20,10 +20,6 @@
private ISSHPublicKey sshKey;
private Domain domain;
- public User(String rhlogin, String uuid, Domain domain) {
- this(rhlogin, uuid, null, domain);
- }
-
public User(String rhlogin, String uuid, ISSHPublicKey sshKey, Domain domain) {
this.rhlogin = rhlogin;
this.uuid = uuid;
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/UserInfo.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/UserInfo.java 2011-09-22
16:42:43 UTC (rev 34962)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/UserInfo.java 2011-09-22
17:03:11 UTC (rev 34963)
@@ -33,4 +33,15 @@
return applications;
}
+ public Application getApplicationByName(String applicationName) {
+ Application matchingApplication = null;
+ for (Application application : applications) {
+ if (applicationName.equals(application.getName())) {
+ matchingApplication = application;
+ break;
+ }
+ }
+ return matchingApplication;
+ }
+
}
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/UserInfoResponseUnmarshaller.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/UserInfoResponseUnmarshaller.java 2011-09-22
16:42:43 UTC (rev 34962)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/UserInfoResponseUnmarshaller.java 2011-09-22
17:03:11 UTC (rev 34963)
@@ -52,7 +52,7 @@
ISSHPublicKey sshKey = createSSHKey(userInfoNode);
User user = createUser(userInfoNode, sshKey, createDomain(userInfoNode));
- List<Application> applications =
createApplications(dataNode.get(IOpenshiftJsonConstants.PROPERTY_APP_INFO));
+ List<Application> applications =
createApplications(dataNode.get(IOpenshiftJsonConstants.PROPERTY_APP_INFO), user);
return new UserInfo(user, applications);
}
@@ -62,24 +62,24 @@
return new SSHPublicKey(sshPublicKey);
}
- private List<Application> createApplications(ModelNode appInfoNode) throws
DatatypeConfigurationException {
+ private List<Application> createApplications(ModelNode appInfoNode, User user)
throws DatatypeConfigurationException {
List<Application> applications = new ArrayList<Application>();
if (!isSet(appInfoNode)) {
return applications;
}
for (String name : appInfoNode.keys()) {
- applications.add(createApplication(name, appInfoNode.get(name)));
+ applications.add(createApplication(name, appInfoNode.get(name), user));
}
return applications;
}
- private Application createApplication(String name, ModelNode appNode) throws
DatatypeConfigurationException {
+ private Application createApplication(String name, ModelNode appNode, User user) throws
DatatypeConfigurationException {
String embedded = getString(IOpenshiftJsonConstants.PROPERTY_EMBEDDED, appNode);
String uuid = getString(IOpenshiftJsonConstants.PROPERTY_UUID, appNode);
Cartridge cartrdige = new
Cartridge(getString(IOpenshiftJsonConstants.PROPERTY_FRAMEWORK, appNode));
Date creationTime = getDate(IOpenshiftJsonConstants.PROPERTY_CREATION_TIME, appNode);
- return new Application(name, uuid, cartrdige, embedded, creationTime, service);
+ return new Application(name, uuid, cartrdige, embedded, creationTime, user, service);
}
private User createUser(ModelNode userInfoNode, ISSHPublicKey sshKey, Domain domain) {
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/utils/Assert.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/utils/Assert.java
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/utils/Assert.java 2011-09-22
17:03:11 UTC (rev 34963)
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.ide.eclipse.as.openshift.core.internal.utils;
+
+
+/**
+ * @author André Dietisheim
+ */
+public class Assert {
+
+ public static final class AssertionFailedException extends RuntimeException {
+
+ private static final long serialVersionUID = 1L;
+
+ public AssertionFailedException() {
+ super();
+ }
+
+ }
+
+ public static <V> V assertNotNull(V value) {
+ if (value == null) {
+ throw new AssertionFailedException();
+ }
+ return value;
+ }
+
+}
Property changes on:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/utils/Assert.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified:
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/ApplicationIntegrationTest.java
===================================================================
---
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/ApplicationIntegrationTest.java 2011-09-22
16:42:43 UTC (rev 34962)
+++
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/ApplicationIntegrationTest.java 2011-09-22
17:03:11 UTC (rev 34963)
@@ -47,7 +47,6 @@
invalidCredentialsOpenshiftService.createApplication(createRandomApplicationName(),
Cartridge.JBOSSAS_7);
}
- @Ignore
@Test
public void canCreateApplication() throws Exception {
String applicationName = createRandomApplicationName();
@@ -174,6 +173,7 @@
}
}
+ @Ignore
@Test
public void getStatusReturnsTheWholeLog() throws Exception {
String applicationName = createRandomApplicationName();
Modified:
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/ApplicationTest.java
===================================================================
---
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/ApplicationTest.java 2011-09-22
16:42:43 UTC (rev 34962)
+++
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/ApplicationTest.java 2011-09-22
17:03:11 UTC (rev 34963)
@@ -16,12 +16,16 @@
import java.io.IOException;
import java.net.URLEncoder;
+import java.util.Arrays;
import org.jboss.ide.eclipse.as.openshift.core.Application;
import org.jboss.ide.eclipse.as.openshift.core.ApplicationLogReader;
import org.jboss.ide.eclipse.as.openshift.core.Cartridge;
+import org.jboss.ide.eclipse.as.openshift.core.Domain;
import org.jboss.ide.eclipse.as.openshift.core.IOpenshiftService;
import org.jboss.ide.eclipse.as.openshift.core.OpenshiftException;
+import org.jboss.ide.eclipse.as.openshift.core.User;
+import org.jboss.ide.eclipse.as.openshift.core.UserInfo;
import org.jboss.ide.eclipse.as.openshift.core.internal.request.ApplicationAction;
import org.jboss.ide.eclipse.as.openshift.core.internal.request.ApplicationRequest;
import
org.jboss.ide.eclipse.as.openshift.core.internal.request.OpenshiftEnvelopeFactory;
@@ -30,6 +34,7 @@
import
org.jboss.ide.eclipse.as.openshift.core.internal.response.ApplicationStatusResponseUnmarshaller;
import org.jboss.ide.eclipse.as.openshift.core.internal.response.JsonSanitizer;
import org.jboss.ide.eclipse.as.openshift.core.internal.response.OpenshiftResponse;
+import
org.jboss.ide.eclipse.as.openshift.test.internal.core.fakes.ApplicationResponseFake;
import
org.jboss.ide.eclipse.as.openshift.test.internal.core.fakes.NoopOpenshiftServiceFake;
import org.junit.Test;
@@ -41,82 +46,6 @@
private static final String USERNAME = "toolsjboss(a)gmail.com";
private static final String PASSWORD = "1q2w3e";
- private static final String APPLICATION_NAME = "1316010645406";
- private static final Cartridge APPLICATION_CARTRIDGE = Cartridge.JBOSSAS_7;
-
- private static final String appResponse =
- "{"
- + " \"messages\":\"\","
- + " \"debug\":\"Validating application limit
toolsjboss(a)gmail.com: num of apps(0) must be < app limit(5)\n\","
- + " \"data\":{"
- + " \"health_check_path\":\"health\""
- + " },"
- + " \"api\":\"1.1.1\","
- + " \"api_c\":[\"placeholder\"],"
- + " \"result\":\"Successfully created application: "
-
- + APPLICATION_NAME
-
- + "\","
- + " \"broker\":\"1.1.1\","
- + " \"broker_c\":[\"namespace\","
- + " \"rhlogin\","
- + " \"ssh\","
- + " \"app_uuid\","
- + " \"debug\","
- + " \"alter\","
- + " \"cartridge\","
- + " \"cart_type\","
- + " \"action\","
- + " \"app_name\","
- + " \"api\"],"
- + " \"exit_code\":0"
- + "}";
-
- private static final String log =
- "10:30:38,700 INFO [org.apache.catalina.core.AprLifecycleListener] (MSC service
thread 1-1) "
- + "The Apache Tomcat Native library which allows optimal performance in
production environments was not found on the java.library.path:"
- +
"/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/lib/amd64/server:/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/lib/amd64:"
- +
"/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/../lib/amd64:/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib\n"
- + "10:30:38,792 INFO [org.apache.coyote.http11.Http11Protocol] (MSC service
thread 1-3) Starting Coyote HTTP/1.1 on http--127.1.7.1-8080\n"
- + "10:30:38,836 INFO [org.jboss.as.connector] (MSC service thread 1-4)
Starting JCA Subsystem (JBoss IronJacamar 1.0.3.Final)\n"
- + "10:30:38,892 INFO [org.jboss.as.connector.subsystems.datasources] (MSC
service thread 1-1) Bound data source [java:jboss/datasources/ExampleDS]\n"
- + "10:30:39,293 INFO [org.jboss.as.deployment] (MSC service thread 1-2)
Started FileSystemDeploymentService for directory
/var/lib/libra/664e4d4dbce74c69ac321053149546df/1316010645406/jbossas-7.0/standalone/deployments\n"
- + "10:30:39,314 INFO [org.jboss.as] (Controller Boot Thread) JBoss AS
7.0.1.Final \\\"Zap\\\" started in 2732ms - Started 82 of 107 services (22
services are passive or on-demand)\n"
- + "10:30:39,339 INFO [org.jboss.as.server.deployment] (MSC service thread 1-3)
Starting deployment of \\\"ROOT.war\\\"\n"
- + "10:30:39,424 INFO [org.jboss.as.jpa] (MSC service thread 1-1) added
javax.persistence.api dependency to ROOT.war\n"
- + "10:30:39,700 INFO [org.jboss.web] (MSC service thread 1-2) registering web
context: \n"
- + "10:30:39,742 INFO [org.jboss.as.server.controller]
(DeploymentScanner-threads - 2) Deployed \\\"ROOT.war\\\"\n";
-
- private static final String tail =
- "tailing /var/lib/libra/664e4d4dbce74c69ac321053149546df/"
-
- + APPLICATION_NAME
-
- + "//"
-
- + APPLICATION_CARTRIDGE
-
- + "/standalone/log/server.log\n"
- + "------ Tail of 1316010645406 application server.log ------\n"
-
- + log;
-
- private static final String statusResponse =
- "{\"messages\":\"\","
- + "\"debug\":\"\","
- + "\"data\":null,"
- + "\"api\":\"1.1.1\","
- + "\"api_c\":[\"placeholder\"],"
- + "\"result\":\""
-
- + tail
-
- + "\","
- + "\"broker\":\"1.1.1\","
- +
"\"broker_c\":[\"namespace\",\"rhlogin\",\"ssh\",\"app_uuid\",\"debug\",\"alter\",\"cartridge\",\"cart_type\",\"action\",\"app_name\",\"api\"],"
- + "\"exit_code\":0}";
-
@Test
public void canMarshallApplicationCreateRequest() throws Exception {
String expectedRequestString =
@@ -164,19 +93,56 @@
@Test
public void canUnmarshallApplicationResponse() throws OpenshiftException {
- String response = JsonSanitizer.sanitize(statusResponse);
+ String response = JsonSanitizer.sanitize(ApplicationResponseFake.appResponse);
OpenshiftResponse<Application> openshiftResponse =
- new ApplicationResponseUnmarshaller(APPLICATION_NAME, APPLICATION_CARTRIDGE, new
NoopOpenshiftServiceFake())
- .unmarshall(response);
+ new ApplicationResponseUnmarshaller(
+ ApplicationResponseFake.APPLICATION_NAME,
ApplicationResponseFake.APPLICATION_CARTRIDGE,
+ new NoopOpenshiftServiceFake())
+ .unmarshall(response);
Application application = openshiftResponse.getOpenshiftObject();
assertNotNull(application);
- assertEquals(APPLICATION_NAME, application.getName());
- assertEquals(APPLICATION_CARTRIDGE, application.getCartridge());
+ assertEquals(ApplicationResponseFake.APPLICATION_NAME, application.getName());
+ assertEquals(ApplicationResponseFake.APPLICATION_CARTRIDGE,
application.getCartridge());
}
-
+
@Test
+ public void canGetGitUri() throws OpenshiftException {
+ String response = JsonSanitizer.sanitize(ApplicationResponseFake.appResponse);
+ IOpenshiftService service = new NoopOpenshiftServiceFake() {
+ @Override
+ public UserInfo getUserInfo() throws OpenshiftException {
+ Domain domain =
+ new Domain("adietish", "openshift.redhat.com");
+ User user = new User(
+ ApplicationResponseFake.USERNAME,
+ "1234567890abcdef",
+ null,
+ domain);
+ Application application = new Application(
+ ApplicationResponseFake.APPLICATION_NAME,
+ ApplicationResponseFake.APPLICATION_UUID,
+ ApplicationResponseFake.APPLICATION_CARTRIDGE,
+ ApplicationResponseFake.APPLICATION_EMBEDDED,
+ ApplicationResponseFake.APPLICATION_CREATIONTIME,
+ user,
+ this);
+ return new UserInfo(user, Arrays.asList(new Application[] { application }));
+ }
+ };
+ OpenshiftResponse<Application> openshiftResponse =
+ new ApplicationResponseUnmarshaller(
+ ApplicationResponseFake.APPLICATION_NAME,
ApplicationResponseFake.APPLICATION_CARTRIDGE,
+ service)
+ .unmarshall(response);
+ Application application = openshiftResponse.getOpenshiftObject();
+ assertNotNull(application);
+ String gitUri = application.getGitUri();
+ assertNotNull(gitUri);
+ }
+
+ @Test
public void canUnmarshallApplicationStatus() throws OpenshiftException {
- String response = JsonSanitizer.sanitize(statusResponse);
+ String response = JsonSanitizer.sanitize(ApplicationResponseFake.statusResponse);
OpenshiftResponse<String> openshiftResponse =
new ApplicationStatusResponseUnmarshaller().unmarshall(response);
String status = openshiftResponse.getOpenshiftObject();
@@ -190,11 +156,13 @@
IOpenshiftService service = new NoopOpenshiftServiceFake() {
@Override
public String getStatus(String applicationName, Cartridge cartridge) throws
OpenshiftException {
- return tail;
+ return ApplicationResponseFake.tail;
}
};
- Application application = new Application(APPLICATION_NAME, APPLICATION_CARTRIDGE,
service);
+ Application application =
+ new Application(ApplicationResponseFake.APPLICATION_NAME,
+ ApplicationResponseFake.APPLICATION_CARTRIDGE, service);
ApplicationLogReader reader = new ApplicationLogReader(application, service);
int toMatchIndex = 0;
@@ -202,8 +170,8 @@
assertEquals(
"character at position " + toMatchIndex
+ " was '" + ((char) character) + "'"
- + " but we expected '" + log.charAt(toMatchIndex) +
"'.",
- log.charAt(toMatchIndex++), character);
+ + " but we expected '" +
ApplicationResponseFake.log.charAt(toMatchIndex) + "'.",
+ ApplicationResponseFake.log.charAt(toMatchIndex++), character);
}
}
}
Modified:
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/UserInfoTest.java
===================================================================
---
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/UserInfoTest.java 2011-09-22
16:42:43 UTC (rev 34962)
+++
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/UserInfoTest.java 2011-09-22
17:03:11 UTC (rev 34963)
@@ -20,6 +20,7 @@
import org.jboss.ide.eclipse.as.openshift.core.Application;
import org.jboss.ide.eclipse.as.openshift.core.Domain;
import org.jboss.ide.eclipse.as.openshift.core.ISSHPublicKey;
+import org.jboss.ide.eclipse.as.openshift.core.OpenshiftException;
import org.jboss.ide.eclipse.as.openshift.core.User;
import org.jboss.ide.eclipse.as.openshift.core.UserInfo;
import
org.jboss.ide.eclipse.as.openshift.core.internal.request.OpenshiftEnvelopeFactory;
@@ -29,6 +30,7 @@
import org.jboss.ide.eclipse.as.openshift.core.internal.response.OpenshiftResponse;
import
org.jboss.ide.eclipse.as.openshift.core.internal.response.UserInfoResponseUnmarshaller;
import
org.jboss.ide.eclipse.as.openshift.test.internal.core.fakes.NoopOpenshiftServiceFake;
+import org.jboss.ide.eclipse.as.openshift.test.internal.core.fakes.UserInfoResponseFake;
import org.junit.Test;
/**
@@ -36,123 +38,72 @@
*/
public class UserInfoTest {
- private static final String USERNAME = "toolsjboss(a)gmail.com";
- private static final String PASSWORD = "1q2w3e";
-
- private static final String RHC_DOMAIN = "rhcloud.com";
- private static final String NAMESPACE = "1315839296868";
- private static final String UUID = "5f34b742db754cc9ab70fd1db2c9a2bd";
- private static final String SSH_KEY =
- "AAAAB3NzaC1yc2EAAAADAQABAAAAgQC6BGRDydfGsQHhnZgo43dEfLz"
- + "SJBke/hE8MLBBG1+5ZwktsrE+f2VdVt0McRLVAO6rdJRyMUX0rTbm7"
- + "SABRVSX+zeQjlfqbbUtYFc7TIfd4RQc3GaISG1rS3C4svRSjdWaG36"
- + "vDY2KxowdFvpKj8i8IYNPlLoRA/7EzzyneS6iyw==";
-
- private static final String APP1_NAME = "1315836963263";
- private static final String APP1_EMBEDDED = null;
- private static final String APP1_UUID = "810540bafc1c4b5e8cac830fb8ca786f";
- private static final String APP1_CARTRIDGE = "jbossas-7.0";
- private static final String APP1_CREATION_TIME = "2011-09-12T10:15:48-04:00";
-
- private static final String APP2_NAME = "1315903559289";
- private static final String APP2_EMBEDDED = null;
- private static final String APP2_UUID = "f5496311f43b42cd8fa5db5ecf83a352";
- private static final String APP2_CARTRIDGE = "jbossas-7.0";
- private static final String APP2_CREATION_TIME = "2011-09-13T04:45:44-04:00";
-
- private static final String userInfoRespose =
- "{"
- + " \"messages\":\"\","
- + " \"debug\":\"\","
- + " \"data\":"
- + ""
- + "\"{"
- + " \\\"user_info\\\":"
- + " {"
- + " \\\"rhc_domain\\\":\\\"" + RHC_DOMAIN +
"\\\"," //
- + " \\\"rhlogin\\\":\\\"" + USERNAME +
"\\\","
- + " \\\"namespace\\\":\\\"" + NAMESPACE +
"\\\","
- + " \\\"uuid\\\":\\\"" + UUID + "\\\","
- + " \\\"ssh_key\\\":\\\"" + SSH_KEY +
"\\\""
- + " },"
- + " \\\"app_info\\\":"
- + " {"
- + " \\\"" + APP1_NAME + "\\\":"
- + " {"
- + " \\\"embedded\\\":" + APP1_EMBEDDED + ","
- + " \\\"uuid\\\":\\\"" + APP1_UUID +
"\\\","
- + " \\\"framework\\\":\\\"" + APP1_CARTRIDGE +
"\\\","
- + " \\\"creation_time\\\":\\\"" + APP1_CREATION_TIME +
"\\\""
- + " },"
- + " \\\"" + APP2_NAME + "\\\":"
- + " {"
- + " \\\"embedded\\\":" + APP2_EMBEDDED + ","
- + " \\\"uuid\\\":\\\"" + APP2_UUID +
"\\\","
- + " \\\"framework\\\":\\\"" + APP2_CARTRIDGE +
"\\\","
- + " \\\"creation_time\\\":\\\"" + APP2_CREATION_TIME +
"\\\""
- + " }"
- + " }"
- + " }\","
- + " \"api\":\"1.1.1\","
- + " \"api_c\":[\"placeholder\"],"
- + " \"result\":null,"
- + " \"broker\":\"1.1.1\","
- + " \"broker_c\":["
- + " \"namespace\","
- + " \"rhlogin\","
- + " \"ssh\","
- + " \"app_uuid\","
- + " \"debug\","
- + " \"alter\","
- + " \"cartridge\","
- + " \"cart_type\","
- + " \"action\","
- + " \"app_name\","
- + " \"api\""
- + " ],"
- + " \"exit_code\":0"
- + "}";
-
@Test
public void canMarshallUserInfoRequest() throws Exception {
String expectedRequestString =
- "password=" + PASSWORD
+ "password=" + URLEncoder.encode(UserInfoResponseFake.PASSWORD,
"UTF-8")
+ "&json_data=%7B"
- + "%22rhlogin%22+%3A+%22" + URLEncoder.encode(USERNAME,
"UTF-8") + "%22%2C+"
+ + "%22rhlogin%22+%3A+%22" +
URLEncoder.encode(UserInfoResponseFake.USERNAME, "UTF-8") + "%22%2C+"
+ "%22debug%22+%3A+%22true%22"
+ "%7D";
- String userInfoRequest = new UserInfoRequestJsonMarshaller().marshall(new
UserInfoRequest(USERNAME, true));
- String effectiveRequest = new OpenshiftEnvelopeFactory(PASSWORD,
userInfoRequest).createString();
+ String userInfoRequest = new UserInfoRequestJsonMarshaller().marshall(
+ new UserInfoRequest(UserInfoResponseFake.USERNAME, true));
+ String effectiveRequest =
+ new OpenshiftEnvelopeFactory(UserInfoResponseFake.PASSWORD,
userInfoRequest).createString();
assertEquals(expectedRequestString, effectiveRequest);
}
@Test
public void canUnmarshallUserInfoResponse() throws Exception {
- UserInfoResponseUnmarshaller unmarshaller = new UserInfoResponseUnmarshaller(new
NoopOpenshiftServiceFake());
- OpenshiftResponse<UserInfo> response = unmarshaller.unmarshall(
- JsonSanitizer.sanitize(userInfoRespose));
-
- UserInfo userInfo = response.getOpenshiftObject();
+ UserInfo userInfo =
getUserInfo(JsonSanitizer.sanitize(UserInfoResponseFake.RESPONSE));
assertNotNull(userInfo);
-
+
User user = userInfo.getUser();
assertNotNull(user);
- assertEquals(USERNAME, user.getRhlogin());
- assertEquals(UUID, user.getUuid());
+ assertEquals(UserInfoResponseFake.USERNAME, user.getRhlogin());
+ assertEquals(UserInfoResponseFake.UUID, user.getUuid());
ISSHPublicKey sshKey = user.getSshKey();
assertNotNull(sshKey);
- assertEquals(SSH_KEY,sshKey.getPublicKey());
-
+ assertEquals(UserInfoResponseFake.SSH_KEY, sshKey.getPublicKey());
+
Domain domain = user.getDomain();
- assertEquals(NAMESPACE, domain.getNamespace());
- assertEquals(RHC_DOMAIN, domain.getRhcDomain());
-
+ assertEquals(UserInfoResponseFake.NAMESPACE, domain.getNamespace());
+ assertEquals(UserInfoResponseFake.RHC_DOMAIN, domain.getRhcDomain());
+
List<Application> applications = userInfo.getApplications();
assertNotNull(applications);
assertEquals(2, applications.size());
- assertThatContainsApplication(APP1_NAME, APP1_EMBEDDED, APP1_UUID, APP1_CARTRIDGE,
APP1_CREATION_TIME, applications);
- assertThatContainsApplication(APP2_NAME, APP2_EMBEDDED, APP2_UUID, APP2_CARTRIDGE,
APP2_CREATION_TIME, applications);
+ assertThatContainsApplication(
+ UserInfoResponseFake.APP1_NAME,
+ UserInfoResponseFake.APP1_EMBEDDED,
+ UserInfoResponseFake.APP1_UUID,
+ UserInfoResponseFake.APP1_CARTRIDGE,
+ UserInfoResponseFake.APP1_CREATION_TIME,
+ applications);
+ assertThatContainsApplication(
+ UserInfoResponseFake.APP2_NAME,
+ UserInfoResponseFake.APP2_EMBEDDED,
+ UserInfoResponseFake.APP2_UUID,
+ UserInfoResponseFake.APP2_CARTRIDGE,
+ UserInfoResponseFake.APP2_CREATION_TIME,
+ applications);
}
+
+ @Test
+ public void canGetApplicationByName() throws OpenshiftException {
+ UserInfo userInfo =
getUserInfo(JsonSanitizer.sanitize(UserInfoResponseFake.RESPONSE));
+ Application application =
userInfo.getApplicationByName(UserInfoResponseFake.APP1_NAME);
+ assertNotNull(application);
+ assertEquals(UserInfoResponseFake.APP1_NAME, application.getName());
+ }
+
+ protected UserInfo getUserInfo(String response) throws OpenshiftException {
+ UserInfoResponseUnmarshaller unmarshaller = new UserInfoResponseUnmarshaller(new
NoopOpenshiftServiceFake());
+ OpenshiftResponse<UserInfo> openshiftResponse =
+ unmarshaller.unmarshall(response);
+
+ return openshiftResponse.getOpenshiftObject();
+ }
}
Added:
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/fakes/ApplicationResponseFake.java
===================================================================
---
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/fakes/ApplicationResponseFake.java
(rev 0)
+++
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/fakes/ApplicationResponseFake.java 2011-09-22
17:03:11 UTC (rev 34963)
@@ -0,0 +1,111 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.ide.eclipse.as.openshift.test.internal.core.fakes;
+
+import java.util.Date;
+
+import org.jboss.ide.eclipse.as.openshift.core.Cartridge;
+
+/**
+ * @author André Dietisheim
+ */
+public class ApplicationResponseFake {
+
+ public static final String USERNAME = "jbosstools(a)redhat.com";
+ public static final String PASSWORD = "$!445password%&";
+
+ public static final String RHC_DOMAIN = "rhcloud.com";
+ public static final String NAMESPACE = "1315839296868";
+
+ public static final String APPLICATION_NAME = "1316010645406";
+ public static final Cartridge APPLICATION_CARTRIDGE = Cartridge.JBOSSAS_7;
+
+ public static final String APPLICATION_UUID = "0123456789abcdefg";
+ public static final String APPLICATION_EMBEDDED = null;
+ public static final Date APPLICATION_CREATIONTIME = new Date();
+
+ public static final String appResponse =
+ "{"
+ + " \"messages\":\"\","
+ + " \"debug\":\"Validating application limit
toolsjboss(a)gmail.com: num of apps(0) must be < app limit(5)\n\","
+ + " \"data\":{"
+ + " \"health_check_path\":\"health\""
+ + " },"
+ + " \"api\":\"1.1.1\","
+ + " \"api_c\":[\"placeholder\"],"
+ + " \"result\":\"Successfully created application: "
+
+ + APPLICATION_NAME
+
+ + "\","
+ + " \"broker\":\"1.1.1\","
+ + " \"broker_c\":[\"namespace\","
+ + " \"rhlogin\","
+ + " \"ssh\","
+ + " \"app_uuid\","
+ + " \"debug\","
+ + " \"alter\","
+ + " \"cartridge\","
+ + " \"cart_type\","
+ + " \"action\","
+ + " \"app_name\","
+ + " \"api\"],"
+ + " \"exit_code\":0"
+ + "}";
+
+
+
+
+ public static final String log =
+ "10:30:38,700 INFO [org.apache.catalina.core.AprLifecycleListener] (MSC service
thread 1-1) "
+ + "The Apache Tomcat Native library which allows optimal performance in
production environments was not found on the java.library.path:"
+ +
"/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/lib/amd64/server:/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/lib/amd64:"
+ +
"/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/../lib/amd64:/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib\n"
+ + "10:30:38,792 INFO [org.apache.coyote.http11.Http11Protocol] (MSC service
thread 1-3) Starting Coyote HTTP/1.1 on http--127.1.7.1-8080\n"
+ + "10:30:38,836 INFO [org.jboss.as.connector] (MSC service thread 1-4)
Starting JCA Subsystem (JBoss IronJacamar 1.0.3.Final)\n"
+ + "10:30:38,892 INFO [org.jboss.as.connector.subsystems.datasources] (MSC
service thread 1-1) Bound data source [java:jboss/datasources/ExampleDS]\n"
+ + "10:30:39,293 INFO [org.jboss.as.deployment] (MSC service thread 1-2)
Started FileSystemDeploymentService for directory
/var/lib/libra/664e4d4dbce74c69ac321053149546df/1316010645406/jbossas-7.0/standalone/deployments\n"
+ + "10:30:39,314 INFO [org.jboss.as] (Controller Boot Thread) JBoss AS
7.0.1.Final \\\"Zap\\\" started in 2732ms - Started 82 of 107 services (22
services are passive or on-demand)\n"
+ + "10:30:39,339 INFO [org.jboss.as.server.deployment] (MSC service thread 1-3)
Starting deployment of \\\"ROOT.war\\\"\n"
+ + "10:30:39,424 INFO [org.jboss.as.jpa] (MSC service thread 1-1) added
javax.persistence.api dependency to ROOT.war\n"
+ + "10:30:39,700 INFO [org.jboss.web] (MSC service thread 1-2) registering web
context: \n"
+ + "10:30:39,742 INFO [org.jboss.as.server.controller]
(DeploymentScanner-threads - 2) Deployed \\\"ROOT.war\\\"\n";
+
+ public static final String tail =
+ "tailing /var/lib/libra/664e4d4dbce74c69ac321053149546df/"
+
+ + APPLICATION_NAME
+
+ + "//"
+
+ + APPLICATION_CARTRIDGE
+
+ + "/standalone/log/server.log\n"
+ + "------ Tail of 1316010645406 application server.log ------\n"
+
+ + log;
+
+ public static final String statusResponse =
+ "{\"messages\":\"\","
+ + "\"debug\":\"\","
+ + "\"data\":null,"
+ + "\"api\":\"1.1.1\","
+ + "\"api_c\":[\"placeholder\"],"
+ + "\"result\":\""
+
+ + tail
+
+ + "\","
+ + "\"broker\":\"1.1.1\","
+ +
"\"broker_c\":[\"namespace\",\"rhlogin\",\"ssh\",\"app_uuid\",\"debug\",\"alter\",\"cartridge\",\"cart_type\",\"action\",\"app_name\",\"api\"],"
+ + "\"exit_code\":0}";
+
+}
Property changes on:
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/fakes/ApplicationResponseFake.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added:
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/fakes/OpenshiftCredentials.java
===================================================================
---
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/fakes/OpenshiftCredentials.java
(rev 0)
+++
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/fakes/OpenshiftCredentials.java 2011-09-22
17:03:11 UTC (rev 34963)
@@ -0,0 +1,18 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.ide.eclipse.as.openshift.test.internal.core.fakes;
+
+public class OpenshiftCredentials {
+
+ public static final String USERNAME = "toolsjboss(a)gmail.com";
+ public static final String PASSWORD = "1q2w3e";
+
+}
Property changes on:
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/fakes/OpenshiftCredentials.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added:
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/fakes/UserInfoResponseFake.java
===================================================================
---
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/fakes/UserInfoResponseFake.java
(rev 0)
+++
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/fakes/UserInfoResponseFake.java 2011-09-22
17:03:11 UTC (rev 34963)
@@ -0,0 +1,81 @@
+package org.jboss.ide.eclipse.as.openshift.test.internal.core.fakes;
+
+public class UserInfoResponseFake {
+
+ public static final String USERNAME = "jbosstools(a)redhat.com";
+ public static final String PASSWORD = "$!445password%&";
+
+ public static final String RHC_DOMAIN = "rhcloud.com";
+ public static final String NAMESPACE = "1315839296868";
+ public static final String UUID = "5f34b742db754cc9ab70fd1db2c9a2bd";
+ public static final String SSH_KEY =
+ "AAAAB3NzaC1yc2EAAAADAQABAAAAgQC6BGRDydfGsQHhnZgo43dEfLz"
+ + "SJBke/hE8MLBBG1+5ZwktsrE+f2VdVt0McRLVAO6rdJRyMUX0rTbm7"
+ + "SABRVSX+zeQjlfqbbUtYFc7TIfd4RQc3GaISG1rS3C4svRSjdWaG36"
+ + "vDY2KxowdFvpKj8i8IYNPlLoRA/7EzzyneS6iyw==";
+
+ public static final String APP1_NAME = "1315836963263";
+ public static final String APP1_EMBEDDED = null;
+ public static final String APP1_UUID = "810540bafc1c4b5e8cac830fb8ca786f";
+ public static final String APP1_CARTRIDGE = "jbossas-7.0";
+ public static final String APP1_CREATION_TIME = "2011-09-12T10:15:48-04:00";
+
+ public static final String APP2_NAME = "1315903559289";
+ public static final String APP2_EMBEDDED = null;
+ public static final String APP2_UUID = "f5496311f43b42cd8fa5db5ecf83a352";
+ public static final String APP2_CARTRIDGE = "jbossas-7.0";
+ public static final String APP2_CREATION_TIME = "2011-09-13T04:45:44-04:00";
+
+ public static final String RESPONSE =
+ "{"
+ + " \"messages\":\"\","
+ + " \"debug\":\"\","
+ + " \"data\":"
+ + ""
+ + "\"{"
+ + " \\\"user_info\\\":"
+ + " {"
+ + " \\\"rhc_domain\\\":\\\"" + RHC_DOMAIN +
"\\\"," //
+ + " \\\"rhlogin\\\":\\\"" + USERNAME +
"\\\","
+ + " \\\"namespace\\\":\\\"" + NAMESPACE +
"\\\","
+ + " \\\"uuid\\\":\\\"" + UUID + "\\\","
+ + " \\\"ssh_key\\\":\\\"" + SSH_KEY +
"\\\""
+ + " },"
+ + " \\\"app_info\\\":"
+ + " {"
+ + " \\\"" + APP1_NAME + "\\\":"
+ + " {"
+ + " \\\"embedded\\\":" + APP1_EMBEDDED + ","
+ + " \\\"uuid\\\":\\\"" + APP1_UUID +
"\\\","
+ + " \\\"framework\\\":\\\"" + APP1_CARTRIDGE +
"\\\","
+ + " \\\"creation_time\\\":\\\"" + APP1_CREATION_TIME +
"\\\""
+ + " },"
+ + " \\\"" + APP2_NAME + "\\\":"
+ + " {"
+ + " \\\"embedded\\\":" + APP2_EMBEDDED + ","
+ + " \\\"uuid\\\":\\\"" + APP2_UUID +
"\\\","
+ + " \\\"framework\\\":\\\"" + APP2_CARTRIDGE +
"\\\","
+ + " \\\"creation_time\\\":\\\"" + APP2_CREATION_TIME +
"\\\""
+ + " }"
+ + " }"
+ + " }\","
+ + " \"api\":\"1.1.1\","
+ + " \"api_c\":[\"placeholder\"],"
+ + " \"result\":null,"
+ + " \"broker\":\"1.1.1\","
+ + " \"broker_c\":["
+ + " \"namespace\","
+ + " \"rhlogin\","
+ + " \"ssh\","
+ + " \"app_uuid\","
+ + " \"debug\","
+ + " \"alter\","
+ + " \"cartridge\","
+ + " \"cart_type\","
+ + " \"action\","
+ + " \"app_name\","
+ + " \"api\""
+ + " ],"
+ + " \"exit_code\":0"
+ + "}";
+}
Property changes on:
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/fakes/UserInfoResponseFake.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified:
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/utils/ApplicationAsserts.java
===================================================================
---
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/utils/ApplicationAsserts.java 2011-09-22
16:42:43 UTC (rev 34962)
+++
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/utils/ApplicationAsserts.java 2011-09-22
17:03:11 UTC (rev 34963)
@@ -20,6 +20,7 @@
import javax.xml.datatype.DatatypeConfigurationException;
import org.jboss.ide.eclipse.as.openshift.core.Application;
+import org.jboss.ide.eclipse.as.openshift.core.OpenshiftException;
import org.jboss.ide.eclipse.as.openshift.core.internal.utils.RFC822DateUtils;
/**
@@ -28,7 +29,7 @@
public class ApplicationAsserts {
public static void assertThatContainsApplication(String applicationName, String
embedded, String applicationUUID,
- String cartridgeName, String creationTime, List<Application> applications) {
+ String cartridgeName, String creationTime, List<Application> applications)
throws OpenshiftException {
Application application = getApplication(applicationName, applications);
if (application == null) {
fail(MessageFormat.format("Could not find application with name
\"{0}\"", applicationName));
@@ -52,7 +53,7 @@
}
private static void assertApplication(String embedded, String uuid, String
cartridgeName,
- String creationTime, Application application) {
+ String creationTime, Application application) throws OpenshiftException {
assertEquals(embedded, application.getEmbedded());
assertEquals(uuid, application.getUUID());
assertNotNull(application.getCartridge());