Author: adietish
Date: 2011-09-22 11:11:59 -0400 (Thu, 22 Sep 2011)
New Revision: 34958
Modified:
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/ApplicationTest.java
Log:
[JBIDE-9591] added application unmarshalling test
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
14:38:14 UTC (rev 34957)
+++
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
15:11:59 UTC (rev 34958)
@@ -26,6 +26,7 @@
import org.jboss.ide.eclipse.as.openshift.core.internal.request.ApplicationRequest;
import
org.jboss.ide.eclipse.as.openshift.core.internal.request.OpenshiftEnvelopeFactory;
import
org.jboss.ide.eclipse.as.openshift.core.internal.request.marshalling.ApplicationRequestJsonMarshaller;
+import
org.jboss.ide.eclipse.as.openshift.core.internal.response.ApplicationResponseUnmarshaller;
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;
@@ -43,6 +44,35 @@
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:"
@@ -133,6 +163,18 @@
}
@Test
+ public void canUnmarshallApplicationResponse() throws OpenshiftException {
+ String response = JsonSanitizer.sanitize(statusResponse);
+ OpenshiftResponse<Application> openshiftResponse =
+ new ApplicationResponseUnmarshaller(APPLICATION_NAME, APPLICATION_CARTRIDGE, new
NoopOpenshiftServiceFake())
+ .unmarshall(response);
+ Application application = openshiftResponse.getOpenshiftObject();
+ assertNotNull(application);
+ assertEquals(APPLICATION_NAME, application.getName());
+ assertEquals(APPLICATION_CARTRIDGE, application.getCartridge());
+ }
+
+ @Test
public void canUnmarshallApplicationStatus() throws OpenshiftException {
String response = JsonSanitizer.sanitize(statusResponse);
OpenshiftResponse<String> openshiftResponse =
Show replies by date