Author: adietish
Date: 2011-09-15 06:49:15 -0400 (Thu, 15 Sep 2011)
New Revision: 34760
Added:
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/UserInfoIntegrationTest.java
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/fakes/NoopOpenshiftServiceFake.java
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/ApplicationTest.java
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/DomainTest.java
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/ListCartridgesTest.java
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/UserInfoTest.java
Log:
[JBIDE-9510] implementing IOpenshiftService#getApplicationStatus and
ApplicationStatusReader
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-15
10:48:51 UTC (rev 34759)
+++
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/ApplicationIntegrationTest.java 2011-09-15
10:49:15 UTC (rev 34760)
@@ -18,7 +18,6 @@
import org.jboss.ide.eclipse.as.openshift.core.IOpenshiftService;
import org.jboss.ide.eclipse.as.openshift.core.InvalidCredentialsOpenshiftException;
import org.jboss.ide.eclipse.as.openshift.core.OpenshiftException;
-import org.jboss.ide.eclipse.as.openshift.core.Status;
import org.jboss.ide.eclipse.as.openshift.core.internal.OpenshiftService;
import org.junit.Before;
import org.junit.Ignore;
@@ -35,6 +34,7 @@
private static final String USERNAME = "toolsjboss(a)gmail.com";
private static final String PASSWORD = "1q2w3e";
+ @Ignore
@Before
public void setUp() {
this.openshiftService = new OpenshiftService(USERNAME, PASSWORD);
@@ -167,8 +167,8 @@
String applicationName = createRandomApplicationName();
try {
Application application = openshiftService.createApplication(applicationName,
Cartridge.JBOSSAS_7);
- Status status = openshiftService.getStatus(application);
- assertNotNull(status);
+ String applicationStatus = openshiftService.getStatus(application.getName(),
application.getCartridge());
+ assertNotNull(applicationStatus);
} finally {
silentlyDestroyApplication(applicationName, openshiftService);
}
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-15
10:48:51 UTC (rev 34759)
+++
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/ApplicationTest.java 2011-09-15
10:49:15 UTC (rev 34760)
@@ -15,10 +15,10 @@
import java.net.URLEncoder;
import org.jboss.ide.eclipse.as.openshift.core.Cartridge;
-import
org.jboss.ide.eclipse.as.openshift.core.internal.marshalling.ApplicationRequestJsonMarshaller;
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.OpenshiftJsonRequestFactory;
+import
org.jboss.ide.eclipse.as.openshift.core.internal.request.marshalling.ApplicationRequestJsonMarshaller;
import org.junit.Test;
/**
@@ -47,7 +47,7 @@
String createApplicationRequest = new ApplicationRequestJsonMarshaller().marshall(
new ApplicationRequest(
"test-application", Cartridge.JBOSSAS_7, ApplicationAction.CONFIGURE,
USERNAME, true));
- String effectiveRequest = new OpenshiftJsonRequestFactory(PASSWORD,
createApplicationRequest).create();
+ String effectiveRequest = new OpenshiftJsonRequestFactory(PASSWORD,
createApplicationRequest).createString();
assertEquals(expectedRequestString, effectiveRequest);
}
@@ -69,8 +69,38 @@
String createApplicationRequest = new ApplicationRequestJsonMarshaller().marshall(
new ApplicationRequest(
"test-application", Cartridge.JBOSSAS_7, ApplicationAction.DECONFIGURE,
USERNAME, true));
- String effectiveRequest = new OpenshiftJsonRequestFactory(PASSWORD,
createApplicationRequest).create();
+ String effectiveRequest = new OpenshiftJsonRequestFactory(PASSWORD,
createApplicationRequest).createString();
assertEquals(expectedRequestString, effectiveRequest);
}
+
+ @Test
+ public void canUnmarshallStatsResponse() {
+ String statusResponse =
+ "{\"messages\":\"\","
+ +"\"debug\":\"\","
+ +"\"data\":null,"
+ +"\"api\":\"1.1.1\","
+ +"\"api_c\":[\"placeholder\"],"
+ +"\"result\":\""
+ +"tailing
/var/lib/libra/664e4d4dbce74c69ac321053149546df/1316010645406//jbossas-7.0/standalone/log/server.log\n"
+ +"------ Tail of 1316010645406 application server.log ------\n"
+ +"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"
+ +"\","
+ +"\"broker\":\"1.1.1\","
+ +"\"broker_c\":[\"namespace\",\"rhlogin\",\"ssh\",\"app_uuid\",\"debug\",\"alter\",\"cartridge\",\"cart_type\",\"action\",\"app_name\",\"api\"],"
+ +"\"exit_code\":0}";
+ }
}
Modified:
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/DomainTest.java
===================================================================
---
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/DomainTest.java 2011-09-15
10:48:51 UTC (rev 34759)
+++
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/DomainTest.java 2011-09-15
10:49:15 UTC (rev 34760)
@@ -21,10 +21,10 @@
import org.jboss.ide.eclipse.as.openshift.core.OpenshiftException;
import org.jboss.ide.eclipse.as.openshift.core.SSHKey;
import org.jboss.ide.eclipse.as.openshift.core.User;
-import
org.jboss.ide.eclipse.as.openshift.core.internal.marshalling.DomainRequestJsonMarshaller;
import org.jboss.ide.eclipse.as.openshift.core.internal.request.ChangeDomainRequest;
import org.jboss.ide.eclipse.as.openshift.core.internal.request.CreateDomainRequest;
import
org.jboss.ide.eclipse.as.openshift.core.internal.request.OpenshiftJsonRequestFactory;
+import
org.jboss.ide.eclipse.as.openshift.core.internal.request.marshalling.DomainRequestJsonMarshaller;
import
org.jboss.ide.eclipse.as.openshift.core.internal.response.DomainResponseUnmarshaller;
import org.jboss.ide.eclipse.as.openshift.core.internal.response.JsonSanitizer;
import org.jboss.ide.eclipse.as.openshift.core.internal.response.OpenshiftResponse;
@@ -51,7 +51,7 @@
new OpenshiftJsonRequestFactory(
PASSWORD,
new DomainRequestJsonMarshaller().marshall(request))
- .create();
+ .createString();
assertEquals(expectedRequestString, requestString);
}
@@ -64,7 +64,7 @@
OpenshiftResponse<Domain> response = new
DomainResponseUnmarshaller(domainName).unmarshall(responseString);
assertNotNull(response);
- Domain domain = response.getData();
+ Domain domain = response.getOpenshiftObject();
assertEquals(domainName, domain.getName());
User user = domain.getUser();
assertNotNull(user);
@@ -83,7 +83,7 @@
new OpenshiftJsonRequestFactory(
PASSWORD,
new DomainRequestJsonMarshaller().marshall(request))
- .create();
+ .createString();
assertEquals(expectedRequestString, requestString);
}
Modified:
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/ListCartridgesTest.java
===================================================================
---
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/ListCartridgesTest.java 2011-09-15
10:48:51 UTC (rev 34759)
+++
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/ListCartridgesTest.java 2011-09-15
10:49:15 UTC (rev 34760)
@@ -18,9 +18,9 @@
import org.jboss.ide.eclipse.as.openshift.core.Cartridge;
import org.jboss.ide.eclipse.as.openshift.core.OpenshiftException;
-import
org.jboss.ide.eclipse.as.openshift.core.internal.marshalling.ListCartridgesRequestJsonMarshaller;
import org.jboss.ide.eclipse.as.openshift.core.internal.request.ListCartridgesRequest;
import
org.jboss.ide.eclipse.as.openshift.core.internal.request.OpenshiftJsonRequestFactory;
+import
org.jboss.ide.eclipse.as.openshift.core.internal.request.marshalling.ListCartridgesRequestJsonMarshaller;
import org.jboss.ide.eclipse.as.openshift.core.internal.response.JsonSanitizer;
import
org.jboss.ide.eclipse.as.openshift.core.internal.response.ListCartridgesResponseUnmarshaller;
import org.jboss.ide.eclipse.as.openshift.core.internal.response.OpenshiftResponse;
@@ -42,7 +42,7 @@
String listCartridgeRequest = new ListCartridgesRequestJsonMarshaller().marshall(
new ListCartridgesRequest(USERNAME, true));
- String effectiveRequest = new OpenshiftJsonRequestFactory(PASSWORD,
listCartridgeRequest).create();
+ String effectiveRequest = new OpenshiftJsonRequestFactory(PASSWORD,
listCartridgeRequest).createString();
assertEquals(expectedRequestString, effectiveRequest);
}
@@ -80,7 +80,7 @@
assertEquals("", response.getMessages());
assertEquals(false, response.isDebug());
- List<Cartridge> cartridges = response.getData();
+ List<Cartridge> cartridges = response.getOpenshiftObject();
assertEquals(5, cartridges.size());
assertThatContainsCartridge("perl-5.10", cartridges);
assertThatContainsCartridge("jbossas-7.0", cartridges);
Added:
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/UserInfoIntegrationTest.java
===================================================================
---
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/UserInfoIntegrationTest.java
(rev 0)
+++
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/UserInfoIntegrationTest.java 2011-09-15
10:49:15 UTC (rev 34760)
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * 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;
+
+import static org.junit.Assert.assertNotNull;
+
+import org.jboss.ide.eclipse.as.openshift.core.IOpenshiftService;
+import org.jboss.ide.eclipse.as.openshift.core.UserInfo;
+import org.jboss.ide.eclipse.as.openshift.core.internal.OpenshiftService;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * @author André Dietisheim
+ */
+public class UserInfoIntegrationTest {
+
+ private IOpenshiftService openshiftService;
+
+ private static final String USERNAME = "toolsjboss(a)gmail.com";
+ private static final String PASSWORD = "1q2w3e";
+
+ @Before
+ public void setUp() {
+ this.openshiftService = new OpenshiftService(USERNAME, PASSWORD);
+ }
+
+ @Test
+ public void canGetUserInfo() throws Exception {
+ UserInfo userInfo = openshiftService.getUserInfo();
+ assertNotNull(userInfo);
+ }
+}
Property changes on:
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/UserInfoIntegrationTest.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/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-15
10:48:51 UTC (rev 34759)
+++
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/UserInfoTest.java 2011-09-15
10:49:15 UTC (rev 34760)
@@ -14,9 +14,9 @@
import java.net.URLEncoder;
-import
org.jboss.ide.eclipse.as.openshift.core.internal.marshalling.UserInfoRequestJsonMarshaller;
import
org.jboss.ide.eclipse.as.openshift.core.internal.request.OpenshiftJsonRequestFactory;
import org.jboss.ide.eclipse.as.openshift.core.internal.request.UserInfoRequest;
+import
org.jboss.ide.eclipse.as.openshift.core.internal.request.marshalling.UserInfoRequestJsonMarshaller;
import org.junit.Test;
/**
@@ -37,7 +37,7 @@
+ "%7D";
String userInfoRequest = new UserInfoRequestJsonMarshaller().marshall(new
UserInfoRequest(USERNAME, true));
- String effectiveRequest = new OpenshiftJsonRequestFactory(PASSWORD,
userInfoRequest).create();
+ String effectiveRequest = new OpenshiftJsonRequestFactory(PASSWORD,
userInfoRequest).createString();
assertEquals(expectedRequestString, effectiveRequest);
}
Added:
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/fakes/NoopOpenshiftServiceFake.java
===================================================================
---
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/fakes/NoopOpenshiftServiceFake.java
(rev 0)
+++
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/fakes/NoopOpenshiftServiceFake.java 2011-09-15
10:49:15 UTC (rev 34760)
@@ -0,0 +1,88 @@
+/*******************************************************************************
+ * 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.List;
+
+import org.jboss.ide.eclipse.as.openshift.core.Application;
+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.SSHKey;
+import org.jboss.ide.eclipse.as.openshift.core.UserInfo;
+
+/**
+ * @author André Dietisheim
+ */
+public class NoopOpenshiftServiceFake implements IOpenshiftService {
+
+ @Override
+ public UserInfo getUserInfo() throws OpenshiftException {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public List<Cartridge> getCartridges() throws OpenshiftException {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public Application createApplication(String name, Cartridge cartridge) throws
OpenshiftException {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public Application destroyApplication(String name, Cartridge cartridge) throws
OpenshiftException {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public Application startApplication(String name, Cartridge cartridge) throws
OpenshiftException {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public Application restartApplication(String name, Cartridge cartridge) throws
OpenshiftException {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public Application stopApplication(String name, Cartridge cartridge) throws
OpenshiftException {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public String getStatus(String applicationName, Cartridge cartridge) throws
OpenshiftException {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public Domain changeDomain(String domainName, SSHKey sshKey) throws OpenshiftException
{
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public Domain createDomain(String name, SSHKey keyPair) throws OpenshiftException {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public SSHKey createKey(String passPhrase, String privateKeyPath, String publicKeyPath)
throws OpenshiftException {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public SSHKey loadKey(String privateKeyPath, String publicKeyPath) throws
OpenshiftException {
+ throw new UnsupportedOperationException();
+ }
+
+}
Property changes on:
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/fakes/NoopOpenshiftServiceFake.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain