JBoss Tools SVN: r34818 - in trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core: utils and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-09-16 11:04:16 -0400 (Fri, 16 Sep 2011)
New Revision: 34818
Modified:
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/utils/ApplicationAsserts.java
Log:
[JBIDE-9510] implementing IOpenshiftService#getUserInfo (integration test is now also successful)
Modified: 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 2011-09-16 14:55:31 UTC (rev 34817)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/UserInfoIntegrationTest.java 2011-09-16 15:04:16 UTC (rev 34818)
@@ -22,6 +22,7 @@
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.OpenshiftService;
+import org.jboss.ide.eclipse.as.openshift.test.internal.core.utils.ApplicationAsserts;
import org.junit.Before;
import org.junit.Test;
@@ -68,6 +69,7 @@
UserInfo userInfo2 = openshiftService.getUserInfo();
assertEquals(numberOfApplications + 1, userInfo2.getApplications().size());
+ ApplicationAsserts.assertThatContainsApplication(applicationName, userInfo2.getApplications());
} finally {
silentlyDestroyAS7Application(applicationName, openshiftService);
}
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-16 14:55:31 UTC (rev 34817)
+++ 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-16 15:04:16 UTC (rev 34818)
@@ -29,19 +29,28 @@
public static void assertThatContainsApplication(String applicationName, String embedded, String applicationUUID,
String cartridgeName, String creationTime, List<Application> applications) {
- boolean found = false;
+ Application application = getApplication(applicationName, applications);
+ if (application == null) {
+ fail(MessageFormat.format("Could not find application with name \"{0}\"", applicationName));
+ }
+ assertApplication(embedded, applicationUUID, cartridgeName, creationTime, application);
+ }
+
+ public static void assertThatContainsApplication(String applicationName, List<Application> applications) {
+ assertNotNull(getApplication(applicationName, applications));
+ }
+
+ private static Application getApplication(String name, List<Application> applications) {
+ Application matchingApplication = null;
for (Application application : applications) {
- if (applicationName.equals(application.getName())) {
- found = true;
- assertApplication(embedded, applicationUUID, cartridgeName, creationTime, application);
+ if (name.equals(application.getName())) {
+ matchingApplication = application;
break;
}
}
- if (!found) {
- fail(MessageFormat.format("Could not find application with name \"{0}\"", applicationName));
- }
+ return matchingApplication;
}
-
+
private static void assertApplication(String embedded, String uuid, String cartridgeName,
String creationTime, Application application) {
assertEquals(embedded, application.getEmbedded());
14 years, 7 months
JBoss Tools SVN: r34817 - in trunk/as: plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal and 3 other directories.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-09-16 10:55:31 -0400 (Fri, 16 Sep 2011)
New Revision: 34817
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/IOpenshiftService.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/OpenshiftService.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/request/AbstractDomainRequest.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/request/ChangeDomainRequest.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/request/CreateDomainRequest.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/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
Log:
[JBIDE-9510] implementing IOpenshiftService#getUserInfo (integration test is now also successful)
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/IOpenshiftService.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/IOpenshiftService.java 2011-09-16 14:39:20 UTC (rev 34816)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/IOpenshiftService.java 2011-09-16 14:55:31 UTC (rev 34817)
@@ -33,9 +33,9 @@
public String getStatus(String name, Cartridge cartridge) throws OpenshiftException;
- public Domain changeDomain(String domainName, SSHKeyPair sshKey) throws OpenshiftException;
+ public Domain changeDomain(String domainName, ISSHPublicKey sshKey) throws OpenshiftException;
- public Domain createDomain(String name, SSHKeyPair sshKey) throws OpenshiftException;
+ public Domain createDomain(String name, ISSHPublicKey sshKey) throws OpenshiftException;
public SSHKeyPair createKey(String passPhrase, String privateKeyPath, String publicKeyPath) throws OpenshiftException;
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/OpenshiftService.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/OpenshiftService.java 2011-09-16 14:39:20 UTC (rev 34816)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/OpenshiftService.java 2011-09-16 14:55:31 UTC (rev 34817)
@@ -19,6 +19,7 @@
import org.jboss.ide.eclipse.as.openshift.core.Domain;
import org.jboss.ide.eclipse.as.openshift.core.IHttpClient;
import org.jboss.ide.eclipse.as.openshift.core.IOpenshiftService;
+import org.jboss.ide.eclipse.as.openshift.core.ISSHPublicKey;
import org.jboss.ide.eclipse.as.openshift.core.InvalidCredentialsOpenshiftException;
import org.jboss.ide.eclipse.as.openshift.core.OpenshiftEndpointException;
import org.jboss.ide.eclipse.as.openshift.core.OpenshiftException;
@@ -119,12 +120,12 @@
}
@Override
- public Domain createDomain(String name, SSHKeyPair sshKey) throws OpenshiftException {
+ public Domain createDomain(String name, ISSHPublicKey sshKey) throws OpenshiftException {
return requestDomainAction(new CreateDomainRequest(name, sshKey, username, true));
}
@Override
- public Domain changeDomain(String newName, SSHKeyPair sshKey) throws OpenshiftException {
+ public Domain changeDomain(String newName, ISSHPublicKey sshKey) throws OpenshiftException {
return requestDomainAction(new ChangeDomainRequest(newName, sshKey, username, true));
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/request/AbstractDomainRequest.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/request/AbstractDomainRequest.java 2011-09-16 14:39:20 UTC (rev 34816)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/request/AbstractDomainRequest.java 2011-09-16 14:55:31 UTC (rev 34817)
@@ -10,7 +10,7 @@
******************************************************************************/
package org.jboss.ide.eclipse.as.openshift.core.internal.request;
-import org.jboss.ide.eclipse.as.openshift.core.SSHKeyPair;
+import org.jboss.ide.eclipse.as.openshift.core.ISSHPublicKey;
/**
@@ -19,13 +19,13 @@
public abstract class AbstractDomainRequest extends AbstractOpenshiftRequest {
private String name;
- private SSHKeyPair sshKey;
+ private ISSHPublicKey sshKey;
- public AbstractDomainRequest(String name, SSHKeyPair sshKey, String username) {
+ public AbstractDomainRequest(String name, ISSHPublicKey sshKey, String username) {
this(name, sshKey, username, false);
}
- public AbstractDomainRequest(String name, SSHKeyPair sshKey, String username, boolean debug) {
+ public AbstractDomainRequest(String name, ISSHPublicKey sshKey, String username, boolean debug) {
super(username, debug);
this.name = name;
this.sshKey = sshKey;
@@ -35,7 +35,7 @@
return name;
}
- public SSHKeyPair getSshKey() {
+ public ISSHPublicKey getSshKey() {
return sshKey;
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/request/ChangeDomainRequest.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/request/ChangeDomainRequest.java 2011-09-16 14:39:20 UTC (rev 34816)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/request/ChangeDomainRequest.java 2011-09-16 14:55:31 UTC (rev 34817)
@@ -10,7 +10,7 @@
******************************************************************************/
package org.jboss.ide.eclipse.as.openshift.core.internal.request;
-import org.jboss.ide.eclipse.as.openshift.core.SSHKeyPair;
+import org.jboss.ide.eclipse.as.openshift.core.ISSHPublicKey;
/**
@@ -18,11 +18,11 @@
*/
public class ChangeDomainRequest extends AbstractDomainRequest {
- public ChangeDomainRequest(String name, SSHKeyPair sshKey, String username) {
+ public ChangeDomainRequest(String name, ISSHPublicKey sshKey, String username) {
this(name, sshKey, username, false);
}
- public ChangeDomainRequest(String name, SSHKeyPair sshKey, String username, boolean debug) {
+ public ChangeDomainRequest(String name, ISSHPublicKey sshKey, String username, boolean debug) {
super(name, sshKey, username, debug);
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/request/CreateDomainRequest.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/request/CreateDomainRequest.java 2011-09-16 14:39:20 UTC (rev 34816)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/request/CreateDomainRequest.java 2011-09-16 14:55:31 UTC (rev 34817)
@@ -10,7 +10,7 @@
******************************************************************************/
package org.jboss.ide.eclipse.as.openshift.core.internal.request;
-import org.jboss.ide.eclipse.as.openshift.core.SSHKeyPair;
+import org.jboss.ide.eclipse.as.openshift.core.ISSHPublicKey;
/**
@@ -18,11 +18,11 @@
*/
public class CreateDomainRequest extends AbstractDomainRequest {
- public CreateDomainRequest(String name, SSHKeyPair sshKey, ApplicationAction action, String username) {
+ public CreateDomainRequest(String name, ISSHPublicKey sshKey, ApplicationAction action, String username) {
this(name, sshKey, username, false);
}
- public CreateDomainRequest(String name, SSHKeyPair sshKey, String username, boolean debug) {
+ public CreateDomainRequest(String name, ISSHPublicKey sshKey, String username, boolean debug) {
super(name, sshKey, username, debug);
}
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-16 14:39:20 UTC (rev 34816)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/ApplicationIntegrationTest.java 2011-09-16 14:55:31 UTC (rev 34817)
@@ -58,7 +58,7 @@
assertEquals(applicationName, application.getName());
assertEquals(cartridge, application.getCartridge());
} finally {
- silentlyDestroyApplication(applicationName, openshiftService);
+ silentlyDestroyAS7Application(applicationName, openshiftService);
}
}
@@ -78,7 +78,7 @@
openshiftService.createApplication(applicationName, Cartridge.JBOSSAS_7);
openshiftService.createApplication(applicationName, Cartridge.JBOSSAS_7);
} finally {
- silentlyDestroyApplication(applicationName, openshiftService);
+ silentlyDestroyAS7Application(applicationName, openshiftService);
}
}
@@ -90,7 +90,7 @@
openshiftService.createApplication(applicationName, Cartridge.JBOSSAS_7);
openshiftService.stopApplication(applicationName, Cartridge.JBOSSAS_7);
} finally {
- silentlyDestroyApplication(applicationName, openshiftService);
+ silentlyDestroyAS7Application(applicationName, openshiftService);
}
}
@@ -103,7 +103,7 @@
openshiftService.stopApplication(applicationName, Cartridge.JBOSSAS_7);
openshiftService.startApplication(applicationName, Cartridge.JBOSSAS_7);
} finally {
- silentlyDestroyApplication(applicationName, openshiftService);
+ silentlyDestroyAS7Application(applicationName, openshiftService);
}
}
@@ -121,7 +121,7 @@
openshiftService.createApplication(applicationName, Cartridge.JBOSSAS_7);
openshiftService.startApplication(applicationName, Cartridge.JBOSSAS_7);
} finally {
- silentlyDestroyApplication(applicationName, openshiftService);
+ silentlyDestroyAS7Application(applicationName, openshiftService);
}
}
@@ -140,7 +140,7 @@
openshiftService.stopApplication(applicationName, Cartridge.JBOSSAS_7);
openshiftService.stopApplication(applicationName, Cartridge.JBOSSAS_7);
} finally {
- silentlyDestroyApplication(applicationName, openshiftService);
+ silentlyDestroyAS7Application(applicationName, openshiftService);
}
}
@@ -158,7 +158,7 @@
openshiftService.createApplication(applicationName, Cartridge.JBOSSAS_7);
openshiftService.restartApplication(applicationName, Cartridge.JBOSSAS_7);
} finally {
- silentlyDestroyApplication(applicationName, openshiftService);
+ silentlyDestroyAS7Application(applicationName, openshiftService);
}
}
@@ -170,7 +170,7 @@
String applicationStatus = openshiftService.getStatus(application.getName(), application.getCartridge());
assertNotNull(applicationStatus);
} finally {
- silentlyDestroyApplication(applicationName, openshiftService);
+ silentlyDestroyAS7Application(applicationName, openshiftService);
}
}
@@ -183,7 +183,7 @@
String applicationStatus2 = openshiftService.getStatus(application.getName(), application.getCartridge());
assertEquals(applicationStatus, applicationStatus2);
} finally {
- silentlyDestroyApplication(applicationName, openshiftService);
+ silentlyDestroyAS7Application(applicationName, openshiftService);
}
}
@@ -191,7 +191,7 @@
return String.valueOf(System.currentTimeMillis());
}
- private void silentlyDestroyApplication(String name, IOpenshiftService service) {
+ private void silentlyDestroyAS7Application(String name, IOpenshiftService service) {
try {
service.destroyApplication(name, Cartridge.JBOSSAS_7);
} catch (OpenshiftException e) {
Modified: 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 2011-09-16 14:39:20 UTC (rev 34816)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/UserInfoIntegrationTest.java 2011-09-16 14:55:31 UTC (rev 34817)
@@ -10,9 +10,16 @@
******************************************************************************/
package org.jboss.ide.eclipse.as.openshift.test.internal.core;
+import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
+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.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.OpenshiftService;
import org.junit.Before;
@@ -37,5 +44,45 @@
public void canGetUserInfo() throws Exception {
UserInfo userInfo = openshiftService.getUserInfo();
assertNotNull(userInfo);
+
+ User user = userInfo.getUser();
+ assertEquals(USERNAME, user.getRhlogin());
}
+
+ @Test
+ public void userInfoContainsOneMoreApplicationAfterCreatingNewApplication() throws Exception {
+ UserInfo userInfo = openshiftService.getUserInfo();
+ assertNotNull(userInfo);
+
+ User user = userInfo.getUser();
+ assertEquals(USERNAME, user.getRhlogin());
+ assertNotNull(user.getSshKey());
+
+ List<Application> applications = userInfo.getApplications();
+ assertNotNull(applications);
+ int numberOfApplications = applications.size();
+
+ String applicationName = createRandomName();
+ try {
+ openshiftService.createApplication(applicationName, Cartridge.JBOSSAS_7);
+
+ UserInfo userInfo2 = openshiftService.getUserInfo();
+ assertEquals(numberOfApplications + 1, userInfo2.getApplications().size());
+ } finally {
+ silentlyDestroyAS7Application(applicationName, openshiftService);
+ }
+ }
+
+ private String createRandomName() {
+ return String.valueOf(System.currentTimeMillis());
+ }
+
+ private void silentlyDestroyAS7Application(String name, IOpenshiftService service) {
+ try {
+ service.destroyApplication(name, Cartridge.JBOSSAS_7);
+ } catch (OpenshiftException e) {
+ e.printStackTrace();
+ }
+ }
+
}
Modified: 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 2011-09-16 14:39:20 UTC (rev 34816)
+++ 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-16 14:55:31 UTC (rev 34817)
@@ -16,6 +16,7 @@
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.ISSHPublicKey;
import org.jboss.ide.eclipse.as.openshift.core.OpenshiftException;
import org.jboss.ide.eclipse.as.openshift.core.SSHKeyPair;
import org.jboss.ide.eclipse.as.openshift.core.UserInfo;
@@ -66,12 +67,12 @@
}
@Override
- public Domain changeDomain(String domainName, SSHKeyPair sshKey) throws OpenshiftException {
+ public Domain changeDomain(String domainName, ISSHPublicKey sshKey) throws OpenshiftException {
throw new UnsupportedOperationException();
}
@Override
- public Domain createDomain(String name, SSHKeyPair keyPair) throws OpenshiftException {
+ public Domain createDomain(String name, ISSHPublicKey keyPair) throws OpenshiftException {
throw new UnsupportedOperationException();
}
14 years, 7 months
JBoss Tools SVN: r34816 - in trunk/as: plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core and 4 other directories.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-09-16 10:39:20 -0400 (Fri, 16 Sep 2011)
New Revision: 34816
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/utils/RFC822DateUtils.java
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/CartridgeAsserts.java
Removed:
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/CartridgeAsserts.java
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/META-INF/MANIFEST.MF
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/internal/response/AbstractOpenshiftJsonResponseUnmarshaller.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/ListCartridgesIntegrationTest.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#getUserInfo (unmarshalling is now tested and functional)
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/META-INF/MANIFEST.MF
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/META-INF/MANIFEST.MF 2011-09-16 13:08:14 UTC (rev 34815)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/META-INF/MANIFEST.MF 2011-09-16 14:39:20 UTC (rev 34816)
@@ -16,4 +16,5 @@
org.jboss.ide.eclipse.as.openshift.core.internal;x-friends:="org.jboss.ide.eclipse.as.openshift.test",
org.jboss.ide.eclipse.as.openshift.core.internal.request;x-friends:="org.jboss.ide.eclipse.as.openshift.test",
org.jboss.ide.eclipse.as.openshift.core.internal.request.marshalling;x-friends:="org.jboss.ide.eclipse.as.openshift.test",
- org.jboss.ide.eclipse.as.openshift.core.internal.response;x-friends:="org.jboss.ide.eclipse.as.openshift.test"
+ org.jboss.ide.eclipse.as.openshift.core.internal.response;x-friends:="org.jboss.ide.eclipse.as.openshift.test",
+ org.jboss.ide.eclipse.as.openshift.core.internal.utils;x-friends:="org.jboss.ide.eclipse.as.openshift.test"
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-16 13:08:14 UTC (rev 34815)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/Application.java 2011-09-16 14:39:20 UTC (rev 34816)
@@ -10,22 +10,24 @@
******************************************************************************/
package org.jboss.ide.eclipse.as.openshift.core;
+import java.util.Date;
+
public class Application {
private String name;
private Cartridge cartridge;
private String uuid;
- private long creationTime;
+ private Date creationTime;
+ private String embedded;
private IOpenshiftService service;
private ApplicationLogReader logReader;
- private String embedded;
public Application(String name, Cartridge cartridge, IOpenshiftService service) {
- this(name, null, cartridge, null, -1, service);
+ this(name, null, cartridge, null, null, service);
}
- public Application(String name, String uuid, Cartridge cartridge, String embedded, long creationTime, IOpenshiftService service) {
+ public Application(String name, String uuid, Cartridge cartridge, String embedded, Date creationTime, IOpenshiftService service) {
this.name = name;
this.cartridge = cartridge;
this.uuid = uuid;
@@ -38,10 +40,22 @@
return name;
}
+ public String getUUID() {
+ return uuid;
+ }
+
public Cartridge getCartridge() {
return cartridge;
}
+ public String getEmbedded() {
+ return embedded;
+ }
+
+ public Date getCreationTime() {
+ return creationTime;
+ }
+
public void destroy() throws OpenshiftException {
service.destroyApplication(name, cartridge);
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/AbstractOpenshiftJsonResponseUnmarshaller.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/AbstractOpenshiftJsonResponseUnmarshaller.java 2011-09-16 13:08:14 UTC (rev 34815)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/AbstractOpenshiftJsonResponseUnmarshaller.java 2011-09-16 14:39:20 UTC (rev 34816)
@@ -10,19 +10,15 @@
******************************************************************************/
package org.jboss.ide.eclipse.as.openshift.core.internal.response;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
import java.util.Date;
-import java.util.GregorianCalendar;
-import java.util.TimeZone;
import javax.xml.datatype.DatatypeConfigurationException;
-import javax.xml.datatype.DatatypeFactory;
import org.jboss.dmr.ModelNode;
import org.jboss.dmr.ModelType;
import org.jboss.ide.eclipse.as.openshift.core.IOpenshiftJsonConstants;
import org.jboss.ide.eclipse.as.openshift.core.OpenshiftException;
+import org.jboss.ide.eclipse.as.openshift.core.internal.utils.RFC822DateUtils;
/**
* @author André Dietisheim
@@ -55,7 +51,7 @@
protected String getString(String property, ModelNode node) {
ModelNode propertyNode = node.get(property);
- if (!isSet(node)) {
+ if (!isSet(propertyNode)) {
// replace "undefined" by null
return null;
}
@@ -69,14 +65,7 @@
protected Date getDate(String property, ModelNode node) throws DatatypeConfigurationException {
ModelNode propertyNode = node.get(property);
- // SimpleDateFormat can't handle RFC822 (-04:00 instead of GMT-04:00)
- // date formats
- // SimpleDateFormat dateFormat = new
- // SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ");
- // return dateFormat.parse(propertyNode.asString());
- GregorianCalendar calendar =
- DatatypeFactory.newInstance().newXMLGregorianCalendar(propertyNode.asString()).toGregorianCalendar();
- return calendar.getTime();
+ return RFC822DateUtils.getDate(propertyNode.asString());
}
protected long getLong(String property, ModelNode node) {
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-16 13:08:14 UTC (rev 34815)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/UserInfoResponseUnmarshaller.java 2011-09-16 14:39:20 UTC (rev 34816)
@@ -79,7 +79,7 @@
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.getTime(), service);
+ return new Application(name, uuid, cartrdige, embedded, creationTime, 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/RFC822DateUtils.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/utils/RFC822DateUtils.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/utils/RFC822DateUtils.java 2011-09-16 14:39:20 UTC (rev 34816)
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * 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;
+
+import java.util.Date;
+import java.util.GregorianCalendar;
+
+import javax.xml.datatype.DatatypeConfigurationException;
+import javax.xml.datatype.DatatypeFactory;
+
+/**
+ * @author André Dietisheim
+ */
+public class RFC822DateUtils {
+
+ public static Date getDate(String rfc822DateString) throws DatatypeConfigurationException {
+ // SimpleDateFormat can't handle RFC822 (-04:00 instead of GMT-04:00)
+ // date formats
+ //
+ // SimpleDateFormat dateFormat = new
+ // SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ");
+ // return dateFormat.parse(propertyNode.asString());
+ GregorianCalendar calendar =
+ DatatypeFactory.newInstance().newXMLGregorianCalendar(rfc822DateString).toGregorianCalendar();
+ return calendar.getTime();
+ }
+
+ public static String getString(Date date) throws DatatypeConfigurationException {
+ GregorianCalendar calendar = (GregorianCalendar) GregorianCalendar.getInstance();
+ return DatatypeFactory.newInstance().newXMLGregorianCalendar(calendar).toXMLFormat();
+ }
+}
Property changes on: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/utils/RFC822DateUtils.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Deleted: trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/CartridgeAsserts.java
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/CartridgeAsserts.java 2011-09-16 13:08:14 UTC (rev 34815)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/CartridgeAsserts.java 2011-09-16 14:39:20 UTC (rev 34816)
@@ -1,36 +0,0 @@
-/*******************************************************************************
- * 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.fail;
-
-import java.text.MessageFormat;
-import java.util.List;
-
-import org.jboss.ide.eclipse.as.openshift.core.Cartridge;
-
-public class CartridgeAsserts {
-
- public static void assertThatContainsCartridge(String cartridgeName, List<Cartridge> cartridges) {
- boolean found = false;
- for (Cartridge cartridge : cartridges) {
- if (cartridgeName.equals(cartridge.getName())) {
- found = true;
- break;
- }
- }
- if (!found) {
- fail(MessageFormat.format("Could not find cartridge with name \"{0}\"", cartridgeName));
- }
- }
-
-
-}
Modified: trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/ListCartridgesIntegrationTest.java
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/ListCartridgesIntegrationTest.java 2011-09-16 13:08:14 UTC (rev 34815)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/ListCartridgesIntegrationTest.java 2011-09-16 14:39:20 UTC (rev 34816)
@@ -10,9 +10,9 @@
******************************************************************************/
package org.jboss.ide.eclipse.as.openshift.test.internal.core;
-import static org.jboss.ide.eclipse.as.openshift.test.internal.core.CartridgeAsserts.assertThatContainsCartridge;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
+import static org.jboss.ide.eclipse.as.openshift.test.internal.core.utils.CartridgeAsserts.assertThatContainsCartridge;
import java.util.List;
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-16 13:08:14 UTC (rev 34815)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/ListCartridgesTest.java 2011-09-16 14:39:20 UTC (rev 34816)
@@ -10,7 +10,7 @@
******************************************************************************/
package org.jboss.ide.eclipse.as.openshift.test.internal.core;
-import static org.jboss.ide.eclipse.as.openshift.test.internal.core.CartridgeAsserts.assertThatContainsCartridge;
+import static org.jboss.ide.eclipse.as.openshift.test.internal.core.utils.CartridgeAsserts.assertThatContainsCartridge;
import static org.junit.Assert.assertEquals;
import java.net.URLEncoder;
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-16 13:08:14 UTC (rev 34815)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/UserInfoTest.java 2011-09-16 14:39:20 UTC (rev 34816)
@@ -10,11 +10,14 @@
******************************************************************************/
package org.jboss.ide.eclipse.as.openshift.test.internal.core;
+import static org.jboss.ide.eclipse.as.openshift.test.internal.core.utils.ApplicationAsserts.assertThatContainsApplication;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import java.net.URLEncoder;
+import java.util.List;
+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.User;
@@ -45,6 +48,18 @@
+ "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\":\"\","
@@ -62,19 +77,19 @@
+ " },"
+ " \\\"app_info\\\":"
+ " {"
- + " \\\"1315836963263\\\":"
+ + " \\\"" + APP1_NAME + "\\\":"
+ " {"
- + " \\\"embedded\\\":null,"
- + " \\\"uuid\\\":\\\"810540bafc1c4b5e8cac830fb8ca786f\\\","
- + " \\\"framework\\\":\\\"jbossas-7.0\\\","
- + " \\\"creation_time\\\":\\\"2011-09-12T10:15:48-04:00\\\""
+ + " \\\"embedded\\\":" + APP1_EMBEDDED + ","
+ + " \\\"uuid\\\":\\\"" + APP1_UUID + "\\\","
+ + " \\\"framework\\\":\\\"" + APP1_CARTRIDGE + "\\\","
+ + " \\\"creation_time\\\":\\\"" + APP1_CREATION_TIME + "\\\""
+ " },"
- + " \\\"1315903559289\\\":"
+ + " \\\"" + APP2_NAME + "\\\":"
+ " {"
- + " \\\"embedded\\\":null,"
- + " \\\"uuid\\\":\\\"f5496311f43b42cd8fa5db5ecf83a352\\\","
- + " \\\"framework\\\":\\\"jbossas-7.0\\\","
- + " \\\"creation_time\\\":\\\"2011-09-13T04:45:44-04:00\\\""
+ + " \\\"embedded\\\":" + APP2_EMBEDDED + ","
+ + " \\\"uuid\\\":\\\"" + APP2_UUID + "\\\","
+ + " \\\"framework\\\":\\\"" + APP2_CARTRIDGE + "\\\","
+ + " \\\"creation_time\\\":\\\"" + APP2_CREATION_TIME + "\\\""
+ " }"
+ " }"
+ " }\","
@@ -134,5 +149,10 @@
assertEquals(NAMESPACE, domain.getNamespace());
assertEquals(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);
}
}
Copied: trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/utils/ApplicationAsserts.java (from rev 34809, trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/CartridgeAsserts.java)
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/utils/ApplicationAsserts.java (rev 0)
+++ 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-16 14:39:20 UTC (rev 34816)
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * 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.utils;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.fail;
+
+import java.text.MessageFormat;
+import java.util.List;
+
+import javax.xml.datatype.DatatypeConfigurationException;
+
+import org.jboss.ide.eclipse.as.openshift.core.Application;
+import org.jboss.ide.eclipse.as.openshift.core.internal.utils.RFC822DateUtils;
+
+/**
+ * @author André Dietisheim
+ */
+public class ApplicationAsserts {
+
+ public static void assertThatContainsApplication(String applicationName, String embedded, String applicationUUID,
+ String cartridgeName, String creationTime, List<Application> applications) {
+ boolean found = false;
+ for (Application application : applications) {
+ if (applicationName.equals(application.getName())) {
+ found = true;
+ assertApplication(embedded, applicationUUID, cartridgeName, creationTime, application);
+ break;
+ }
+ }
+ if (!found) {
+ fail(MessageFormat.format("Could not find application with name \"{0}\"", applicationName));
+ }
+ }
+
+ private static void assertApplication(String embedded, String uuid, String cartridgeName,
+ String creationTime, Application application) {
+ assertEquals(embedded, application.getEmbedded());
+ assertEquals(uuid, application.getUUID());
+ assertNotNull(application.getCartridge());
+ assertEquals(cartridgeName, application.getCartridge().getName());
+ try {
+ assertEquals(RFC822DateUtils.getDate(creationTime), application.getCreationTime());
+ } catch (DatatypeConfigurationException e) {
+ fail(e.getMessage());
+ }
+ }
+
+}
Added: trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/utils/CartridgeAsserts.java
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/utils/CartridgeAsserts.java (rev 0)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/utils/CartridgeAsserts.java 2011-09-16 14:39:20 UTC (rev 34816)
@@ -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.test.internal.core.utils;
+
+import static org.junit.Assert.fail;
+
+import java.text.MessageFormat;
+import java.util.List;
+
+import org.jboss.ide.eclipse.as.openshift.core.Cartridge;
+
+public class CartridgeAsserts {
+
+ public static void assertThatContainsCartridge(String cartridgeName, List<Cartridge> cartridges) {
+ boolean found = false;
+ for (Cartridge cartridge : cartridges) {
+ if (cartridgeName.equals(cartridge.getName())) {
+ found = true;
+ break;
+ }
+ }
+ if (!found) {
+ fail(MessageFormat.format("Could not find cartridge with name \"{0}\"", cartridgeName));
+ }
+ }
+
+
+}
Property changes on: trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/utils/CartridgeAsserts.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
14 years, 7 months
JBoss Tools SVN: r34815 - in trunk/as: plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal and 5 other directories.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-09-16 09:08:14 -0400 (Fri, 16 Sep 2011)
New Revision: 34815
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/ISSHPublicKey.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/SSHKeyPair.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/SSHPublicKey.java
Removed:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/SSHKey.java
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/IOpenshiftJsonConstants.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/IOpenshiftService.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/internal/OpenshiftService.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/request/AbstractDomainRequest.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/request/ChangeDomainRequest.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/request/CreateDomainRequest.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/request/marshalling/DomainRequestJsonMarshaller.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/DomainIntegrationTest.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/SSHKeyTest.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/fakes/NoopOpenshiftServiceFake.java
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/fakes/TestSSHKey.java
Log:
[JBIDE-9510] implementing IOpenshiftService#getUserInfo
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/IOpenshiftJsonConstants.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/IOpenshiftJsonConstants.java 2011-09-16 13:07:25 UTC (rev 34814)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/IOpenshiftJsonConstants.java 2011-09-16 13:08:14 UTC (rev 34815)
@@ -38,5 +38,6 @@
public static final String PROPERTY_EMBEDDED = "embedded";
public static final String PROPERTY_FRAMEWORK = "framework";
public static final String PROPERTY_CREATION_TIME = "creation_time";
+ public static final String PROPERTY_SSH_KEY = "ssh_key";
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/IOpenshiftService.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/IOpenshiftService.java 2011-09-16 13:07:25 UTC (rev 34814)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/IOpenshiftService.java 2011-09-16 13:08:14 UTC (rev 34815)
@@ -33,11 +33,11 @@
public String getStatus(String name, Cartridge cartridge) throws OpenshiftException;
- public Domain changeDomain(String domainName, SSHKey sshKey) throws OpenshiftException;
+ public Domain changeDomain(String domainName, SSHKeyPair sshKey) throws OpenshiftException;
- public Domain createDomain(String name, SSHKey keyPair) throws OpenshiftException;
+ public Domain createDomain(String name, SSHKeyPair sshKey) throws OpenshiftException;
- public SSHKey createKey(String passPhrase, String privateKeyPath, String publicKeyPath) throws OpenshiftException;
+ public SSHKeyPair createKey(String passPhrase, String privateKeyPath, String publicKeyPath) throws OpenshiftException;
- public SSHKey loadKey(String privateKeyPath, String publicKeyPath) throws OpenshiftException;
+ public SSHKeyPair loadKey(String privateKeyPath, String publicKeyPath) throws OpenshiftException;
}
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/ISSHPublicKey.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/ISSHPublicKey.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/ISSHPublicKey.java 2011-09-16 13:08:14 UTC (rev 34815)
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * 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;
+
+/**
+ * @author André Dietisheim
+ */
+public interface ISSHPublicKey {
+
+ /**
+ * Returns the content of the public key (key content without ssh-rsa
+ * identifier nor comment) of the ssh key
+ *
+ * @return the content of the public key (without signature, without
+ * comment)
+ * @throws OpenshiftException
+ */
+ public String getPublicKey() throws OpenshiftException;
+
+}
Property changes on: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/ISSHPublicKey.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Deleted: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/SSHKey.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/SSHKey.java 2011-09-16 13:07:25 UTC (rev 34814)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/SSHKey.java 2011-09-16 13:08:14 UTC (rev 34815)
@@ -1,111 +0,0 @@
-/*******************************************************************************
- * 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;
-
-import org.jboss.ide.eclipse.as.openshift.core.internal.OpenshiftCoreActivator;
-import org.jboss.ide.eclipse.as.openshift.core.internal.utils.Base64Encoder;
-
-import com.jcraft.jsch.JSch;
-import com.jcraft.jsch.JSchException;
-import com.jcraft.jsch.KeyPair;
-
-/**
- * @author André Dietisheim
- */
-public class SSHKey {
-
- /**
- * the length of the key that is created when using #create. ssh-keygen uses
- * a default of 2048
- *
- * @see #create(String, String, String)
- * @see http://en.wikipedia.org/wiki/Ssh-keygen
- */
- private static final int KEYLENGTH = 2048;
-
- private KeyPair keyPair;
- private String privateKeyPath;
- private String publicKeyPath;
-
- private SSHKey(KeyPair keyPair, String privateKeyPath, String publicKeyPath) throws OpenshiftException {
- this.keyPair = keyPair;
- this.privateKeyPath = privateKeyPath;
- this.publicKeyPath = publicKeyPath;
- }
-
- /**
- * Creates private and public ssh-rsa keys and stores them to the given
- * paths. The key is created while using the given pass phrase.
- *
- * @param passPhrase
- * the pass phrase to set to the new key
- * @param privateKeyPath
- * the path where the new private key gets stored
- * @param publicKeyPath
- * the path where the new public key gets stored
- * @return
- * @throws OpenshiftException
- * if the key could not be created
- */
- public static SSHKey create(String passPhrase, String privateKeyPath, String publicKeyPath)
- throws OpenshiftException {
- try {
- KeyPair keyPair = KeyPair.genKeyPair(new JSch(), KeyPair.RSA, KEYLENGTH);
- keyPair.setPassphrase(passPhrase);
- keyPair.writePublicKey(publicKeyPath, "created by " + OpenshiftCoreActivator.PLUGIN_ID);
- keyPair.writePrivateKey(privateKeyPath);
- return new SSHKey(keyPair, privateKeyPath, publicKeyPath);
- } catch (Exception e) {
- throw new OpenshiftException(e, "Could not create new rsa key", e);
- }
- }
-
- /**
- * Loads existing private and public ssh key from the given paths.
- *
- * @param privateKeyPath
- * the path to the private key
- * @param publicKeyPath
- * the path to the public key
- * @return
- * @throws OpenshiftException
- */
- public static SSHKey load(String privateKeyPath, String publicKeyPath)
- throws OpenshiftException {
- try {
- KeyPair keyPair = KeyPair.load(new JSch(), privateKeyPath, publicKeyPath);
- return new SSHKey(keyPair, privateKeyPath, publicKeyPath);
- } catch (JSchException e) {
- throw new OpenshiftException(e, "Could not create new rsa key");
- }
- }
-
- /**
- * Returns the content of the public key (key content without ssh-rsa
- * identifier nor comment) of the ssh key
- *
- * @return the content of the public key (without signature, without
- * comment)
- * @throws OpenshiftException
- */
- public String getPublicKeyContent() throws OpenshiftException {
- return new String(Base64Encoder.encode(keyPair.getPublicKeyBlob()));
- }
-
- protected String getPublicKeyPath() {
- return publicKeyPath;
- }
-
- protected String getPrivateKeyPath() {
- return privateKeyPath;
- }
-
-}
Copied: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/SSHKeyPair.java (from rev 34809, trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/SSHKey.java)
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/SSHKeyPair.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/SSHKeyPair.java 2011-09-16 13:08:14 UTC (rev 34815)
@@ -0,0 +1,104 @@
+/*******************************************************************************
+ * 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;
+
+import org.jboss.ide.eclipse.as.openshift.core.internal.OpenshiftCoreActivator;
+import org.jboss.ide.eclipse.as.openshift.core.internal.utils.Base64Encoder;
+
+import com.jcraft.jsch.JSch;
+import com.jcraft.jsch.JSchException;
+import com.jcraft.jsch.KeyPair;
+
+/**
+ * @author André Dietisheim
+ */
+public class SSHKeyPair implements ISSHPublicKey {
+
+ /**
+ * the length of the key that is created when using #create. ssh-keygen uses
+ * a default of 2048
+ *
+ * @see #create(String, String, String)
+ * @see http://en.wikipedia.org/wiki/Ssh-keygen
+ */
+ private static final int KEYLENGTH = 2048;
+
+ private KeyPair keyPair;
+ private String privateKeyPath;
+
+ private String publicKeyPath;
+
+ private SSHKeyPair(KeyPair keyPair, String privateKeyPath, String publicKeyPath) throws OpenshiftException {
+ this.keyPair = keyPair;
+ this.privateKeyPath = privateKeyPath;
+ this.publicKeyPath = publicKeyPath;
+ }
+
+ /**
+ * Creates private and public ssh-rsa keys and stores them to the given
+ * paths. The key is created while using the given pass phrase.
+ *
+ * @param passPhrase
+ * the pass phrase to set to the new key
+ * @param privateKeyPath
+ * the path where the new private key gets stored
+ * @param publicKeyPath
+ * the path where the new public key gets stored
+ * @return
+ * @throws OpenshiftException
+ * if the key could not be created
+ */
+ public static SSHKeyPair create(String passPhrase, String privateKeyPath, String publicKeyPath)
+ throws OpenshiftException {
+ try {
+ KeyPair keyPair = KeyPair.genKeyPair(new JSch(), KeyPair.RSA, KEYLENGTH);
+ keyPair.setPassphrase(passPhrase);
+ keyPair.writePublicKey(publicKeyPath, "created by " + OpenshiftCoreActivator.PLUGIN_ID);
+ keyPair.writePrivateKey(privateKeyPath);
+ return new SSHKeyPair(keyPair, privateKeyPath, publicKeyPath);
+ } catch (Exception e) {
+ throw new OpenshiftException(e, "Could not create new rsa key", e);
+ }
+ }
+
+ /**
+ * Loads existing private and public ssh key from the given paths.
+ *
+ * @param privateKeyPath
+ * the path to the private key
+ * @param publicKeyPath
+ * the path to the public key
+ * @return
+ * @throws OpenshiftException
+ */
+ public static SSHKeyPair load(String privateKeyPath, String publicKeyPath)
+ throws OpenshiftException {
+ try {
+ KeyPair keyPair = KeyPair.load(new JSch(), privateKeyPath, publicKeyPath);
+ return new SSHKeyPair(keyPair, privateKeyPath, publicKeyPath);
+ } catch (JSchException e) {
+ throw new OpenshiftException(e, "Could not create new rsa key");
+ }
+ }
+
+ public String getPublicKey() throws OpenshiftException {
+ return new String(Base64Encoder.encode(keyPair.getPublicKeyBlob()));
+ }
+
+ protected String getPrivateKeyPath() {
+ return privateKeyPath;
+ }
+
+ protected String getPublicKeyPath() {
+ return publicKeyPath;
+ }
+
+}
Property changes on: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/SSHKeyPair.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/SSHPublicKey.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/SSHPublicKey.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/SSHPublicKey.java 2011-09-16 13:08:14 UTC (rev 34815)
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * 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;
+
+/**
+ * @author André Dietisheim
+ */
+public class SSHPublicKey implements ISSHPublicKey {
+
+ private String publicKey;
+
+ public SSHPublicKey(String publicKey) {
+ this.publicKey = publicKey;
+ }
+
+ public String getPublicKey() throws OpenshiftException {
+ return publicKey;
+ }
+}
Property changes on: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/SSHPublicKey.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
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-16 13:07:25 UTC (rev 34814)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/User.java 2011-09-16 13:08:14 UTC (rev 34815)
@@ -17,14 +17,14 @@
private String rhlogin;
private String uuid;
- private SSHKey sshKey;
+ 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, SSHKey sshKey, Domain domain) {
+ public User(String rhlogin, String uuid, ISSHPublicKey sshKey, Domain domain) {
this.rhlogin = rhlogin;
this.uuid = uuid;
this.sshKey = sshKey;
@@ -35,7 +35,7 @@
return domain;
}
- public SSHKey getSshKey() {
+ public ISSHPublicKey getSshKey() {
return sshKey;
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/OpenshiftService.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/OpenshiftService.java 2011-09-16 13:07:25 UTC (rev 34814)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/OpenshiftService.java 2011-09-16 13:08:14 UTC (rev 34815)
@@ -22,7 +22,7 @@
import org.jboss.ide.eclipse.as.openshift.core.InvalidCredentialsOpenshiftException;
import org.jboss.ide.eclipse.as.openshift.core.OpenshiftEndpointException;
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.SSHKeyPair;
import org.jboss.ide.eclipse.as.openshift.core.UserInfo;
import org.jboss.ide.eclipse.as.openshift.core.internal.httpclient.HttpClientException;
import org.jboss.ide.eclipse.as.openshift.core.internal.httpclient.UnauthorizedException;
@@ -109,22 +109,22 @@
}
@Override
- public SSHKey createKey(String passPhrase, String privateKeyPath, String publicKeyPath) throws OpenshiftException {
- return SSHKey.create(passPhrase, privateKeyPath, publicKeyPath);
+ public SSHKeyPair createKey(String passPhrase, String privateKeyPath, String publicKeyPath) throws OpenshiftException {
+ return SSHKeyPair.create(passPhrase, privateKeyPath, publicKeyPath);
}
@Override
- public SSHKey loadKey(String privateKeyPath, String publicKeyPath) throws OpenshiftException {
- return SSHKey.load(privateKeyPath, publicKeyPath);
+ public SSHKeyPair loadKey(String privateKeyPath, String publicKeyPath) throws OpenshiftException {
+ return SSHKeyPair.load(privateKeyPath, publicKeyPath);
}
@Override
- public Domain createDomain(String name, SSHKey sshKey) throws OpenshiftException {
+ public Domain createDomain(String name, SSHKeyPair sshKey) throws OpenshiftException {
return requestDomainAction(new CreateDomainRequest(name, sshKey, username, true));
}
@Override
- public Domain changeDomain(String newName, SSHKey sshKey) throws OpenshiftException {
+ public Domain changeDomain(String newName, SSHKeyPair sshKey) throws OpenshiftException {
return requestDomainAction(new ChangeDomainRequest(newName, sshKey, username, true));
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/request/AbstractDomainRequest.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/request/AbstractDomainRequest.java 2011-09-16 13:07:25 UTC (rev 34814)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/request/AbstractDomainRequest.java 2011-09-16 13:08:14 UTC (rev 34815)
@@ -10,7 +10,7 @@
******************************************************************************/
package org.jboss.ide.eclipse.as.openshift.core.internal.request;
-import org.jboss.ide.eclipse.as.openshift.core.SSHKey;
+import org.jboss.ide.eclipse.as.openshift.core.SSHKeyPair;
/**
@@ -19,13 +19,13 @@
public abstract class AbstractDomainRequest extends AbstractOpenshiftRequest {
private String name;
- private SSHKey sshKey;
+ private SSHKeyPair sshKey;
- public AbstractDomainRequest(String name, SSHKey sshKey, String username) {
+ public AbstractDomainRequest(String name, SSHKeyPair sshKey, String username) {
this(name, sshKey, username, false);
}
- public AbstractDomainRequest(String name, SSHKey sshKey, String username, boolean debug) {
+ public AbstractDomainRequest(String name, SSHKeyPair sshKey, String username, boolean debug) {
super(username, debug);
this.name = name;
this.sshKey = sshKey;
@@ -35,7 +35,7 @@
return name;
}
- public SSHKey getSshKey() {
+ public SSHKeyPair getSshKey() {
return sshKey;
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/request/ChangeDomainRequest.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/request/ChangeDomainRequest.java 2011-09-16 13:07:25 UTC (rev 34814)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/request/ChangeDomainRequest.java 2011-09-16 13:08:14 UTC (rev 34815)
@@ -10,7 +10,7 @@
******************************************************************************/
package org.jboss.ide.eclipse.as.openshift.core.internal.request;
-import org.jboss.ide.eclipse.as.openshift.core.SSHKey;
+import org.jboss.ide.eclipse.as.openshift.core.SSHKeyPair;
/**
@@ -18,11 +18,11 @@
*/
public class ChangeDomainRequest extends AbstractDomainRequest {
- public ChangeDomainRequest(String name, SSHKey sshKey, String username) {
+ public ChangeDomainRequest(String name, SSHKeyPair sshKey, String username) {
this(name, sshKey, username, false);
}
- public ChangeDomainRequest(String name, SSHKey sshKey, String username, boolean debug) {
+ public ChangeDomainRequest(String name, SSHKeyPair sshKey, String username, boolean debug) {
super(name, sshKey, username, debug);
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/request/CreateDomainRequest.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/request/CreateDomainRequest.java 2011-09-16 13:07:25 UTC (rev 34814)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/request/CreateDomainRequest.java 2011-09-16 13:08:14 UTC (rev 34815)
@@ -10,7 +10,7 @@
******************************************************************************/
package org.jboss.ide.eclipse.as.openshift.core.internal.request;
-import org.jboss.ide.eclipse.as.openshift.core.SSHKey;
+import org.jboss.ide.eclipse.as.openshift.core.SSHKeyPair;
/**
@@ -18,11 +18,11 @@
*/
public class CreateDomainRequest extends AbstractDomainRequest {
- public CreateDomainRequest(String name, SSHKey sshKey, ApplicationAction action, String username) {
+ public CreateDomainRequest(String name, SSHKeyPair sshKey, ApplicationAction action, String username) {
this(name, sshKey, username, false);
}
- public CreateDomainRequest(String name, SSHKey sshKey, String username, boolean debug) {
+ public CreateDomainRequest(String name, SSHKeyPair sshKey, String username, boolean debug) {
super(name, sshKey, username, debug);
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/request/marshalling/DomainRequestJsonMarshaller.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/request/marshalling/DomainRequestJsonMarshaller.java 2011-09-16 13:07:25 UTC (rev 34814)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/request/marshalling/DomainRequestJsonMarshaller.java 2011-09-16 13:08:14 UTC (rev 34815)
@@ -24,6 +24,6 @@
protected void setJsonDataProperties(ModelNode node, AbstractDomainRequest request) throws OpenshiftException {
node.get(IOpenshiftJsonConstants.PROPERTY_NAMESPACE).set(request.getName());
node.get(IOpenshiftJsonConstants.PROPERTY_ALTER).set(String.valueOf(request.isAlter()));
- node.get(IOpenshiftJsonConstants.PROPERTY_SSH).set(request.getSshKey().getPublicKeyContent());
+ node.get(IOpenshiftJsonConstants.PROPERTY_SSH).set(request.getSshKey().getPublicKey());
}
}
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-16 13:07:25 UTC (rev 34814)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/UserInfoResponseUnmarshaller.java 2011-09-16 13:08:14 UTC (rev 34815)
@@ -22,6 +22,8 @@
import org.jboss.ide.eclipse.as.openshift.core.Domain;
import org.jboss.ide.eclipse.as.openshift.core.IOpenshiftJsonConstants;
import org.jboss.ide.eclipse.as.openshift.core.IOpenshiftService;
+import org.jboss.ide.eclipse.as.openshift.core.ISSHPublicKey;
+import org.jboss.ide.eclipse.as.openshift.core.SSHPublicKey;
import org.jboss.ide.eclipse.as.openshift.core.User;
import org.jboss.ide.eclipse.as.openshift.core.UserInfo;
@@ -42,29 +44,36 @@
if (!isSet(dataNode)) {
return null;
}
+
ModelNode userInfoNode = dataNode.get(IOpenshiftJsonConstants.PROPERTY_USER_INFO);
if (!isSet(userInfoNode)) {
return null;
}
- User user = createUser(userInfoNode, createDomain(userInfoNode));
- return new UserInfo(
- user,
- createApplications(dataNode.get(IOpenshiftJsonConstants.PROPERTY_APP_INFO)));
+
+ ISSHPublicKey sshKey = createSSHKey(userInfoNode);
+ User user = createUser(userInfoNode, sshKey, createDomain(userInfoNode));
+ List<Application> applications = createApplications(dataNode.get(IOpenshiftJsonConstants.PROPERTY_APP_INFO));
+
+ return new UserInfo(user, applications);
}
- private List<Application> createApplications(ModelNode appInfoNode) throws DatatypeConfigurationException {
+ private ISSHPublicKey createSSHKey(ModelNode userInfoNode) {
+ String sshPublicKey = getString(IOpenshiftJsonConstants.PROPERTY_SSH_KEY, userInfoNode);
+ return new SSHPublicKey(sshPublicKey);
+ }
+
+ private List<Application> createApplications(ModelNode appInfoNode) throws DatatypeConfigurationException {
List<Application> applications = new ArrayList<Application>();
if (!isSet(appInfoNode)) {
return applications;
}
- for(String name : appInfoNode.keys()) {
+ for (String name : appInfoNode.keys()) {
applications.add(createApplication(name, appInfoNode.get(name)));
}
return applications;
}
-
private Application createApplication(String name, ModelNode appNode) throws DatatypeConfigurationException {
String embedded = getString(IOpenshiftJsonConstants.PROPERTY_EMBEDDED, appNode);
String uuid = getString(IOpenshiftJsonConstants.PROPERTY_UUID, appNode);
@@ -73,16 +82,15 @@
return new Application(name, uuid, cartrdige, embedded, creationTime.getTime(), service);
}
- protected User createUser(ModelNode userInfoNode, Domain domain) {
+ private User createUser(ModelNode userInfoNode, ISSHPublicKey sshKey, Domain domain) {
String rhlogin = getString(IOpenshiftJsonConstants.PROPERTY_RHLOGIN, userInfoNode);
- String uuid = getString(IOpenshiftJsonConstants.PROPERTY_RHLOGIN, userInfoNode);
- return new User(rhlogin, uuid, domain);
+ String uuid = getString(IOpenshiftJsonConstants.PROPERTY_UUID, userInfoNode);
+ return new User(rhlogin, uuid, sshKey, domain);
}
- protected Domain createDomain(ModelNode userInfoNode) {
+ private Domain createDomain(ModelNode userInfoNode) {
String namespace = getString(IOpenshiftJsonConstants.PROPERTY_NAMESPACE, userInfoNode);
String rhcDomain = getString(IOpenshiftJsonConstants.PROPERTY_RHC_DOMAIN, userInfoNode);
return new Domain(namespace, rhcDomain);
}
-
}
Modified: trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/DomainIntegrationTest.java
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/DomainIntegrationTest.java 2011-09-16 13:07:25 UTC (rev 34814)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/DomainIntegrationTest.java 2011-09-16 13:08:14 UTC (rev 34815)
@@ -14,7 +14,7 @@
import static org.junit.Assert.assertNotNull;
import org.jboss.ide.eclipse.as.openshift.core.Domain;
-import org.jboss.ide.eclipse.as.openshift.core.SSHKey;
+import org.jboss.ide.eclipse.as.openshift.core.SSHKeyPair;
import org.jboss.ide.eclipse.as.openshift.core.internal.OpenshiftService;
import org.jboss.ide.eclipse.as.openshift.test.internal.core.fakes.TestSSHKey;
import org.junit.Before;
@@ -36,7 +36,7 @@
public void canCreateDomain() throws Exception {
String domainName = createRandomString();
- SSHKey sshKey = TestSSHKey.create();
+ SSHKeyPair sshKey = TestSSHKey.create();
Domain domain = openshiftService.createDomain(domainName, sshKey);
assertNotNull(domain);
@@ -47,7 +47,7 @@
public void canChangeDomain() throws Exception {
String domainName = createRandomString();
- SSHKey sshKey = TestSSHKey.create();
+ SSHKeyPair sshKey = TestSSHKey.create();
Domain domain = openshiftService.changeDomain(domainName, sshKey);
assertNotNull(domain);
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-16 13:07:25 UTC (rev 34814)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/DomainTest.java 2011-09-16 13:08:14 UTC (rev 34815)
@@ -19,7 +19,7 @@
import org.jboss.ide.eclipse.as.openshift.core.Domain;
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.SSHKeyPair;
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.OpenshiftEnvelopeFactory;
@@ -41,9 +41,9 @@
@Test
public void canMarshallDomainCreateRequest() throws IOException, OpenshiftException {
- SSHKey sshKey = TestSSHKey.create();
+ SSHKeyPair sshKey = TestSSHKey.create();
String expectedRequestString = createDomainRequestString(PASSWORD, USERNAME, true, "myDomain", false,
- sshKey.getPublicKeyContent());
+ sshKey.getPublicKey());
CreateDomainRequest request = new CreateDomainRequest("myDomain", sshKey, USERNAME, true);
String requestString =
@@ -69,9 +69,9 @@
@Test
public void canMarshallDomainAlterRequest() throws IOException, OpenshiftException {
- SSHKey sshKey = TestSSHKey.create();
+ SSHKeyPair sshKey = TestSSHKey.create();
String expectedRequestString = createDomainRequestString(PASSWORD, USERNAME, true, "myDomain", true,
- sshKey.getPublicKeyContent());
+ sshKey.getPublicKey());
ChangeDomainRequest request = new ChangeDomainRequest("myDomain", sshKey, USERNAME, true);
String requestString =
Modified: trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/SSHKeyTest.java
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/SSHKeyTest.java 2011-09-16 13:07:25 UTC (rev 34814)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/SSHKeyTest.java 2011-09-16 13:08:14 UTC (rev 34815)
@@ -16,7 +16,7 @@
import java.io.File;
import java.io.IOException;
-import org.jboss.ide.eclipse.as.openshift.core.SSHKey;
+import org.jboss.ide.eclipse.as.openshift.core.SSHKeyPair;
import org.junit.Test;
public class SSHKeyTest {
@@ -27,8 +27,8 @@
public void canCreatePublicKey() throws Exception {
String publicKeyPath = createTempFile().getAbsolutePath();
String privateKeyPath = createTempFile().getAbsolutePath();
- SSHKey sshKey = SSHKey.create(PASSPHRASE, privateKeyPath, publicKeyPath);
- String publicKey = sshKey.getPublicKeyContent();
+ SSHKeyPair sshKey = SSHKeyPair.create(PASSPHRASE, privateKeyPath, publicKeyPath);
+ String publicKey = sshKey.getPublicKey();
assertNotNull(publicKey);
assertTrue(!publicKey.contains("ssh-rsa")); // no identifier
@@ -39,10 +39,10 @@
public void canLoadPublicKey() throws Exception {
String publicKeyPath = createTempFile().getAbsolutePath();
String privateKeyPath = createTempFile().getAbsolutePath();
- SSHKey.create(PASSPHRASE, privateKeyPath, publicKeyPath);
+ SSHKeyPair.create(PASSPHRASE, privateKeyPath, publicKeyPath);
- SSHKey sshKey = SSHKey.load(privateKeyPath, publicKeyPath);
- String publicKey = sshKey.getPublicKeyContent();
+ SSHKeyPair sshKey = SSHKeyPair.load(privateKeyPath, publicKeyPath);
+ String publicKey = sshKey.getPublicKey();
assertNotNull(publicKey);
assertTrue(!publicKey.contains("ssh-rsa")); // no identifier
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-16 13:07:25 UTC (rev 34814)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/UserInfoTest.java 2011-09-16 13:08:14 UTC (rev 34815)
@@ -10,11 +10,13 @@
******************************************************************************/
package org.jboss.ide.eclipse.as.openshift.test.internal.core;
-import static org.junit.Assert.*;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
import java.net.URLEncoder;
+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.User;
import org.jboss.ide.eclipse.as.openshift.core.UserInfo;
import org.jboss.ide.eclipse.as.openshift.core.internal.request.OpenshiftEnvelopeFactory;
@@ -37,7 +39,12 @@
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 userInfoRespose =
"{"
+ " \"messages\":\"\","
@@ -50,8 +57,8 @@
+ " \\\"rhc_domain\\\":\\\"" + RHC_DOMAIN + "\\\"," //
+ " \\\"rhlogin\\\":\\\"" + USERNAME + "\\\","
+ " \\\"namespace\\\":\\\"" + NAMESPACE + "\\\","
- + " \\\"uuid\\\":\\\"" + UUID +"\\\","
- + " \\\"ssh_key\\\":\\\"AAAAB3NzaC1yc2EAAAADAQABAAAAgQC6BGRDydfGsQHhnZgo43dEfLzSJBke/hE8MLBBG1+5ZwktsrE+f2VdVt0McRLVAO6rdJRyMUX0rTbm7SABRVSX+zeQjlfqbbUtYFc7TIfd4RQc3GaISG1rS3C4svRSjdWaG36vDY2KxowdFvpKj8i8IYNPlLoRA/7EzzyneS6iyw==\\\""
+ + " \\\"uuid\\\":\\\"" + UUID + "\\\","
+ + " \\\"ssh_key\\\":\\\"" + SSH_KEY + "\\\""
+ " },"
+ " \\\"app_info\\\":"
+ " {"
@@ -114,10 +121,18 @@
UserInfo userInfo = response.getOpenshiftObject();
assertNotNull(userInfo);
+
User user = userInfo.getUser();
assertNotNull(user);
assertEquals(USERNAME, user.getRhlogin());
assertEquals(UUID, user.getUuid());
+ ISSHPublicKey sshKey = user.getSshKey();
+ assertNotNull(sshKey);
+ assertEquals(SSH_KEY,sshKey.getPublicKey());
+
+ Domain domain = user.getDomain();
+ assertEquals(NAMESPACE, domain.getNamespace());
+ assertEquals(RHC_DOMAIN, domain.getRhcDomain());
+
}
-
}
Modified: 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 2011-09-16 13:07:25 UTC (rev 34814)
+++ 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-16 13:08:14 UTC (rev 34815)
@@ -17,7 +17,7 @@
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.SSHKeyPair;
import org.jboss.ide.eclipse.as.openshift.core.UserInfo;
/**
@@ -66,22 +66,22 @@
}
@Override
- public Domain changeDomain(String domainName, SSHKey sshKey) throws OpenshiftException {
+ public Domain changeDomain(String domainName, SSHKeyPair sshKey) throws OpenshiftException {
throw new UnsupportedOperationException();
}
@Override
- public Domain createDomain(String name, SSHKey keyPair) throws OpenshiftException {
+ public Domain createDomain(String name, SSHKeyPair keyPair) throws OpenshiftException {
throw new UnsupportedOperationException();
}
@Override
- public SSHKey createKey(String passPhrase, String privateKeyPath, String publicKeyPath) throws OpenshiftException {
+ public SSHKeyPair createKey(String passPhrase, String privateKeyPath, String publicKeyPath) throws OpenshiftException {
throw new UnsupportedOperationException();
}
@Override
- public SSHKey loadKey(String privateKeyPath, String publicKeyPath) throws OpenshiftException {
+ public SSHKeyPair loadKey(String privateKeyPath, String publicKeyPath) throws OpenshiftException {
throw new UnsupportedOperationException();
}
Modified: trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/fakes/TestSSHKey.java
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/fakes/TestSSHKey.java 2011-09-16 13:07:25 UTC (rev 34814)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/fakes/TestSSHKey.java 2011-09-16 13:08:14 UTC (rev 34815)
@@ -14,7 +14,7 @@
import java.io.IOException;
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.SSHKeyPair;
import org.jboss.ide.eclipse.as.openshift.test.internal.core.utils.StreamUtils;
/**
@@ -50,14 +50,14 @@
"1rS3C4svRSjdWaG36vDY2KxowdFvpKj8i8IYNPlLoRA/7EzzyneS6iyw" +
"== created by org.jboss.ide.eclipse.as.openshift.core";
- public static SSHKey create() throws IOException, OpenshiftException {
+ public static SSHKeyPair create() throws IOException, OpenshiftException {
File privateKeyFile = File.createTempFile(createRandomString(), null);
StreamUtils.writeTo(privateKey, privateKeyFile);
File publicKeyFile = File.createTempFile(createRandomString(), null);
StreamUtils.writeTo(publicKey, publicKeyFile);
- return SSHKey.load(privateKeyFile.getAbsolutePath(), publicKeyFile.getAbsolutePath());
+ return SSHKeyPair.load(privateKeyFile.getAbsolutePath(), publicKeyFile.getAbsolutePath());
}
private static String createRandomString() {
14 years, 7 months
JBoss Tools SVN: r34814 - trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-09-16 09:07:25 -0400 (Fri, 16 Sep 2011)
New Revision: 34814
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/
Log:
added target to .svnignore
Property changes on: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui
___________________________________________________________________
Added: svn:ignore
+ target
14 years, 7 months
JBoss Tools SVN: r34813 - in trunk/as: tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-09-16 08:07:16 -0400 (Fri, 16 Sep 2011)
New Revision: 34813
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/UserInfo.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#getUserInfo
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-16 11:36:03 UTC (rev 34812)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/UserInfo.java 2011-09-16 12:07:16 UTC (rev 34813)
@@ -25,11 +25,11 @@
this.applications = applications;
}
- protected User getUser() {
+ public User getUser() {
return user;
}
- protected List<Application> getApplications() {
+ public List<Application> getApplications() {
return applications;
}
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-16 11:36:03 UTC (rev 34812)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/UserInfoTest.java 2011-09-16 12:07:16 UTC (rev 34813)
@@ -10,14 +10,18 @@
******************************************************************************/
package org.jboss.ide.eclipse.as.openshift.test.internal.core;
+import static org.junit.Assert.*;
import static org.junit.Assert.assertEquals;
import java.net.URLEncoder;
+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;
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.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.core.internal.response.UserInfoResponseUnmarshaller;
import org.jboss.ide.eclipse.as.openshift.test.internal.core.fakes.NoopOpenshiftServiceFake;
import org.junit.Test;
@@ -30,6 +34,10 @@
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 userInfoRespose =
"{"
+ " \"messages\":\"\","
@@ -39,10 +47,10 @@
+ "\"{"
+ " \\\"user_info\\\":"
+ " {"
- + " \\\"rhc_domain\\\":\\\"rhcloud.com\\\","
- + " \\\"rhlogin\\\":\\\"toolsjboss(a)gmail.com\\\","
- + " \\\"namespace\\\":\\\"1315839296868\\\","
- + " \\\"uuid\\\":\\\"5f34b742db754cc9ab70fd1db2c9a2bd\\\","
+ + " \\\"rhc_domain\\\":\\\"" + RHC_DOMAIN + "\\\"," //
+ + " \\\"rhlogin\\\":\\\"" + USERNAME + "\\\","
+ + " \\\"namespace\\\":\\\"" + NAMESPACE + "\\\","
+ + " \\\"uuid\\\":\\\"" + UUID +"\\\","
+ " \\\"ssh_key\\\":\\\"AAAAB3NzaC1yc2EAAAADAQABAAAAgQC6BGRDydfGsQHhnZgo43dEfLzSJBke/hE8MLBBG1+5ZwktsrE+f2VdVt0McRLVAO6rdJRyMUX0rTbm7SABRVSX+zeQjlfqbbUtYFc7TIfd4RQc3GaISG1rS3C4svRSjdWaG36vDY2KxowdFvpKj8i8IYNPlLoRA/7EzzyneS6iyw==\\\""
+ " },"
+ " \\\"app_info\\\":"
@@ -82,6 +90,7 @@
+ " ],"
+ " \"exit_code\":0"
+ "}";
+
@Test
public void canMarshallUserInfoRequest() throws Exception {
String expectedRequestString =
@@ -99,7 +108,16 @@
@Test
public void canUnmarshallUserInfoResponse() throws Exception {
- new UserInfoResponseUnmarshaller(new NoopOpenshiftServiceFake()).unmarshall(JsonSanitizer.sanitize(userInfoRespose));
+ UserInfoResponseUnmarshaller unmarshaller = new UserInfoResponseUnmarshaller(new NoopOpenshiftServiceFake());
+ OpenshiftResponse<UserInfo> response = unmarshaller.unmarshall(
+ JsonSanitizer.sanitize(userInfoRespose));
+
+ UserInfo userInfo = response.getOpenshiftObject();
+ assertNotNull(userInfo);
+ User user = userInfo.getUser();
+ assertNotNull(user);
+ assertEquals(USERNAME, user.getRhlogin());
+ assertEquals(UUID, user.getUuid());
}
}
14 years, 7 months
JBoss Tools SVN: r34812 - in trunk/as: plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-09-16 07:36:03 -0400 (Fri, 16 Sep 2011)
New Revision: 34812
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/IOpenshiftJsonConstants.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/AbstractOpenshiftJsonResponseUnmarshaller.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/UserInfoTest.java
Log:
[JBIDE-9510] implementing IOpenshiftService#getUserInfo
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/IOpenshiftJsonConstants.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/IOpenshiftJsonConstants.java 2011-09-16 11:01:12 UTC (rev 34811)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/IOpenshiftJsonConstants.java 2011-09-16 11:36:03 UTC (rev 34812)
@@ -33,9 +33,10 @@
public static final String PROPERTY_SSH = "ssh";
public static final String PROPERTY_UUID = "uuid";
public static final String PROPERTY_USER_INFO = "user_info";
- public static final String PROPERTY_APP_INFO = "app.info";
+ public static final String PROPERTY_APP_INFO = "app_info";
public static final String PROPERTY_RHC_DOMAIN = "rhc_domain";
public static final String PROPERTY_EMBEDDED = "embedded";
public static final String PROPERTY_FRAMEWORK = "framework";
+ public static final String PROPERTY_CREATION_TIME = "creation_time";
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/AbstractOpenshiftJsonResponseUnmarshaller.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/AbstractOpenshiftJsonResponseUnmarshaller.java 2011-09-16 11:01:12 UTC (rev 34811)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/AbstractOpenshiftJsonResponseUnmarshaller.java 2011-09-16 11:36:03 UTC (rev 34812)
@@ -10,6 +10,15 @@
******************************************************************************/
package org.jboss.ide.eclipse.as.openshift.core.internal.response;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.GregorianCalendar;
+import java.util.TimeZone;
+
+import javax.xml.datatype.DatatypeConfigurationException;
+import javax.xml.datatype.DatatypeFactory;
+
import org.jboss.dmr.ModelNode;
import org.jboss.dmr.ModelType;
import org.jboss.ide.eclipse.as.openshift.core.IOpenshiftJsonConstants;
@@ -38,7 +47,7 @@
}
}
- protected abstract OPENSHIFTOBJECT createOpenshiftObject(ModelNode responseNode);
+ protected abstract OPENSHIFTOBJECT createOpenshiftObject(ModelNode responseNode) throws Exception;
protected String getResponse() {
return response;
@@ -46,13 +55,30 @@
protected String getString(String property, ModelNode node) {
ModelNode propertyNode = node.get(property);
- if (propertyNode.getType() == ModelType.UNDEFINED) {
+ if (!isSet(node)) {
// replace "undefined" by null
return null;
}
return propertyNode.asString();
}
+ protected boolean isSet(ModelNode node) {
+ return node != null
+ && node.getType() != ModelType.UNDEFINED;
+ }
+
+ protected Date getDate(String property, ModelNode node) throws DatatypeConfigurationException {
+ ModelNode propertyNode = node.get(property);
+ // SimpleDateFormat can't handle RFC822 (-04:00 instead of GMT-04:00)
+ // date formats
+ // SimpleDateFormat dateFormat = new
+ // SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ");
+ // return dateFormat.parse(propertyNode.asString());
+ GregorianCalendar calendar =
+ DatatypeFactory.newInstance().newXMLGregorianCalendar(propertyNode.asString()).toGregorianCalendar();
+ return calendar.getTime();
+ }
+
protected long getLong(String property, ModelNode node) {
ModelNode propertyNode = node.get(property);
return propertyNode.asLong(-1);
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-16 11:01:12 UTC (rev 34811)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/UserInfoResponseUnmarshaller.java 2011-09-16 11:36:03 UTC (rev 34812)
@@ -11,8 +11,11 @@
package org.jboss.ide.eclipse.as.openshift.core.internal.response;
import java.util.ArrayList;
+import java.util.Date;
import java.util.List;
+import javax.xml.datatype.DatatypeConfigurationException;
+
import org.jboss.dmr.ModelNode;
import org.jboss.ide.eclipse.as.openshift.core.Application;
import org.jboss.ide.eclipse.as.openshift.core.Cartridge;
@@ -34,25 +37,24 @@
}
@Override
- protected UserInfo createOpenshiftObject(ModelNode node) {
+ protected UserInfo createOpenshiftObject(ModelNode node) throws DatatypeConfigurationException {
ModelNode dataNode = node.get(IOpenshiftJsonConstants.PROPERTY_DATA);
- if (dataNode == null) {
+ if (!isSet(dataNode)) {
return null;
}
- ModelNode userInfoNode = node.get(IOpenshiftJsonConstants.PROPERTY_USER_INFO);
- if (userInfoNode == null) {
+ ModelNode userInfoNode = dataNode.get(IOpenshiftJsonConstants.PROPERTY_USER_INFO);
+ if (!isSet(userInfoNode)) {
return null;
}
- Domain domain = createDomain(userInfoNode);
- User user = createUser(userInfoNode, domain);
+ User user = createUser(userInfoNode, createDomain(userInfoNode));
return new UserInfo(
user,
- createApplications(node.get(IOpenshiftJsonConstants.PROPERTY_APP_INFO)));
+ createApplications(dataNode.get(IOpenshiftJsonConstants.PROPERTY_APP_INFO)));
}
- private List<Application> createApplications(ModelNode appInfoNode) {
+ private List<Application> createApplications(ModelNode appInfoNode) throws DatatypeConfigurationException {
List<Application> applications = new ArrayList<Application>();
- if (appInfoNode == null) {
+ if (!isSet(appInfoNode)) {
return applications;
}
@@ -63,12 +65,12 @@
}
- private Application createApplication(String name, ModelNode appNode) {
+ private Application createApplication(String name, ModelNode appNode) 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));
- long creationTime = getLong(IOpenshiftJsonConstants.PROPERTY_FRAMEWORK, appNode);
- return new Application(name, uuid, cartrdige, embedded, creationTime, service);
+ Date creationTime = getDate(IOpenshiftJsonConstants.PROPERTY_CREATION_TIME, appNode);
+ return new Application(name, uuid, cartrdige, embedded, creationTime.getTime(), service);
}
protected User createUser(ModelNode userInfoNode, Domain domain) {
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-16 11:01:12 UTC (rev 34811)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/UserInfoTest.java 2011-09-16 11:36:03 UTC (rev 34812)
@@ -17,6 +17,9 @@
import org.jboss.ide.eclipse.as.openshift.core.internal.request.OpenshiftEnvelopeFactory;
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.jboss.ide.eclipse.as.openshift.core.internal.response.JsonSanitizer;
+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.junit.Test;
/**
@@ -31,9 +34,9 @@
"{"
+ " \"messages\":\"\","
+ " \"debug\":\"\","
- + " \"data\":\""
+ + " \"data\":"
+ ""
- + " {"
+ + "\"{"
+ " \\\"user_info\\\":"
+ " {"
+ " \\\"rhc_domain\\\":\\\"rhcloud.com\\\","
@@ -96,7 +99,7 @@
@Test
public void canUnmarshallUserInfoResponse() throws Exception {
-
+ new UserInfoResponseUnmarshaller(new NoopOpenshiftServiceFake()).unmarshall(JsonSanitizer.sanitize(userInfoRespose));
}
}
14 years, 7 months
JBoss Tools SVN: r34811 - in trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test: tools and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: vpakan(a)redhat.com
Date: 2011-09-16 07:01:12 -0400 (Fri, 16 Sep 2011)
New Revision: 34811
Modified:
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/VPEAllBotTests.java
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/tools/SWTBotWebBrowser.java
Log:
Fixes for JBDS 5.0.0.M3
Modified: trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/VPEAllBotTests.java
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/VPEAllBotTests.java 2011-09-16 10:07:16 UTC (rev 34810)
+++ trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/VPEAllBotTests.java 2011-09-16 11:01:12 UTC (rev 34811)
@@ -1,8 +1,5 @@
package org.jboss.tools.vpe.ui.bot.test;
-import junit.extensions.TestSetup;
-import junit.framework.Test;
-import junit.framework.TestSuite;
import org.eclipse.swtbot.swt.finder.SWTBotTestCase;
import org.jboss.tools.ui.bot.ext.RequirementAwareSuite;
import org.jboss.tools.vpe.ui.bot.test.editor.BlockCommentTest;
Modified: trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/tools/SWTBotWebBrowser.java
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/tools/SWTBotWebBrowser.java 2011-09-16 10:07:16 UTC (rev 34810)
+++ trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/tools/SWTBotWebBrowser.java 2011-09-16 11:01:12 UTC (rev 34811)
@@ -93,7 +93,7 @@
public static final String SETUP_VISUAL_TEMPLATE_FOR_MENU_LABEL = "Setup Visual Template for ";
public static final String SELECT_THIS_TAG_MENU_LABEL = "Select This Tag";
public static final String PREFERENCES_MENU_LABEL = "Preferences..";
- public static final String EXTERNALIZE_STRING_MENU_LABEL = "Externalize strings...";
+ public static final String EXTERNALIZE_STRING_MENU_LABEL = "Externalize selected string...";
public static final String JSF_MENU_LABEL = "JSF";
public static final String JBOSS_MENU_LABEL = "JBoss";
14 years, 7 months
JBoss Tools SVN: r34810 - trunk/maven/tests/org.jboss.tools.maven.ui.bot.test/src/org/jboss/tools/maven/ui/bot/test.
by jbosstools-commits@lists.jboss.org
Author: fbricon
Date: 2011-09-16 06:07:16 -0400 (Fri, 16 Sep 2011)
New Revision: 34810
Modified:
trunk/maven/tests/org.jboss.tools.maven.ui.bot.test/src/org/jboss/tools/maven/ui/bot/test/CreateMavenizedSeamProjectTest.java
Log:
fix failing Bot tests due to off-by-one error in comboBox selection (Seam Wizard added a new comboBox)
Modified: trunk/maven/tests/org.jboss.tools.maven.ui.bot.test/src/org/jboss/tools/maven/ui/bot/test/CreateMavenizedSeamProjectTest.java
===================================================================
--- trunk/maven/tests/org.jboss.tools.maven.ui.bot.test/src/org/jboss/tools/maven/ui/bot/test/CreateMavenizedSeamProjectTest.java 2011-09-16 09:19:23 UTC (rev 34809)
+++ trunk/maven/tests/org.jboss.tools.maven.ui.bot.test/src/org/jboss/tools/maven/ui/bot/test/CreateMavenizedSeamProjectTest.java 2011-09-16 10:07:16 UTC (rev 34810)
@@ -457,9 +457,9 @@
radio.widget.notifyListeners(SWT.Selection, event);
}
});
-
- bot.comboBox(1).setSelection("HSQL");
- bot.comboBox(2).setSelection(CONNECTION_PROFILE_NAME);
+ //comboBox(1) = Libraries
+ bot.comboBox(2).setSelection("HSQL");
+ bot.comboBox(3).setSelection(CONNECTION_PROFILE_NAME);
bot.button("Finish").click();
waitForIdle();
14 years, 7 months
JBoss Tools SVN: r34809 - in trunk/as: plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-09-16 05:19:23 -0400 (Fri, 16 Sep 2011)
New Revision: 34809
Removed:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/StringResponseUnmarshaller.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/Domain.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/IOpenshiftJsonConstants.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/OpenshiftService.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/AbstractOpenshiftJsonResponseUnmarshaller.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/ApplicationResponseUnmarshaller.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/ApplicationStatusResponseUnmarshaller.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/DomainResponseUnmarshaller.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/ListCartridgesResponseUnmarshaller.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/DomainIntegrationTest.java
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/DomainTest.java
Log:
[JBIDE-9510] implementing IOpenshiftService#getUserInfo
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-16 09:17:29 UTC (rev 34808)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/Application.java 2011-09-16 09:19:23 UTC (rev 34809)
@@ -15,12 +15,22 @@
private String name;
private Cartridge cartridge;
+ private String uuid;
+ private long creationTime;
private IOpenshiftService service;
private ApplicationLogReader logReader;
+ private String embedded;
public Application(String name, Cartridge cartridge, IOpenshiftService service) {
+ this(name, null, cartridge, null, -1, service);
+ }
+
+ public Application(String name, String uuid, Cartridge cartridge, String embedded, long creationTime, IOpenshiftService service) {
this.name = name;
this.cartridge = cartridge;
+ this.uuid = uuid;
+ this.embedded = embedded;
+ this.creationTime = creationTime;
this.service = service;
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/Domain.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/Domain.java 2011-09-16 09:17:29 UTC (rev 34808)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/Domain.java 2011-09-16 09:19:23 UTC (rev 34809)
@@ -16,19 +16,23 @@
*/
public class Domain {
- private User user;
- private String name;
+ private String namespace;
+ private String rhcDomain;
- public Domain(String name, User user) {
- this.name = name;
- this.user = user;
+ public Domain(String namespace) {
+ this(namespace, null);
}
- public String getName() {
- return name;
+ public Domain(String namespace, String rhcDomain) {
+ this.namespace = namespace;
+ this.rhcDomain = rhcDomain;
}
- public User getUser() {
- return user;
+ public String getRhcDomain() {
+ return rhcDomain;
}
+
+ public String getNamespace() {
+ return namespace;
+ }
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/IOpenshiftJsonConstants.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/IOpenshiftJsonConstants.java 2011-09-16 09:17:29 UTC (rev 34808)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/IOpenshiftJsonConstants.java 2011-09-16 09:19:23 UTC (rev 34809)
@@ -32,5 +32,10 @@
public static final String PROPERTY_ALTER = "alter";
public static final String PROPERTY_SSH = "ssh";
public static final String PROPERTY_UUID = "uuid";
+ public static final String PROPERTY_USER_INFO = "user_info";
+ public static final String PROPERTY_APP_INFO = "app.info";
+ public static final String PROPERTY_RHC_DOMAIN = "rhc_domain";
+ public static final String PROPERTY_EMBEDDED = "embedded";
+ public static final String PROPERTY_FRAMEWORK = "framework";
}
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-16 09:17:29 UTC (rev 34808)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/User.java 2011-09-16 09:19:23 UTC (rev 34809)
@@ -17,12 +17,28 @@
private String rhlogin;
private String uuid;
+ private SSHKey sshKey;
+ private Domain domain;
- public User(String rhlogin, String uuid) {
+ public User(String rhlogin, String uuid, Domain domain) {
+ this(rhlogin, uuid, null, domain);
+ }
+
+ public User(String rhlogin, String uuid, SSHKey sshKey, Domain domain) {
this.rhlogin = rhlogin;
this.uuid = uuid;
+ this.sshKey = sshKey;
+ this.domain = domain;
}
+
+ public Domain getDomain() {
+ return domain;
+ }
+ public SSHKey getSshKey() {
+ return sshKey;
+ }
+
public String getRhlogin() {
return rhlogin;
}
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-16 09:17:29 UTC (rev 34808)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/UserInfo.java 2011-09-16 09:19:23 UTC (rev 34809)
@@ -10,42 +10,27 @@
******************************************************************************/
package org.jboss.ide.eclipse.as.openshift.core;
+import java.util.List;
+
/**
* @author André Dietisheim
*/
public class UserInfo {
- private String rhlogin;
- private String uuId;
- private String sshKey;
- private String rhcDomain;
- private String namespace;
+ private User user;
+ private List<Application> applications;
- public UserInfo(String rhlogin, String uuid, String sshKey, String rhcDomain, String namespace) {
- this.rhlogin = rhlogin;
- this.uuId = uuid;
- this.sshKey = sshKey;
- this.rhcDomain = rhcDomain;
- this.namespace = namespace;
+ public UserInfo(User user, List<Application> applications) {
+ this.user = user;
+ this.applications = applications;
}
- public String getRhlogin() {
- return rhlogin;
+ protected User getUser() {
+ return user;
}
- public String getUuId() {
- return uuId;
+ protected List<Application> getApplications() {
+ return applications;
}
- public String getRhcDomain() {
- return rhcDomain;
- }
-
- public String getSSHKey() {
- return sshKey;
- }
-
- public String getNamespace() {
- return namespace;
- }
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/OpenshiftService.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/OpenshiftService.java 2011-09-16 09:17:29 UTC (rev 34808)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/OpenshiftService.java 2011-09-16 09:19:23 UTC (rev 34809)
@@ -71,7 +71,7 @@
String responseString = createHttpClient(url).post(openShiftRequestString);
responseString = JsonSanitizer.sanitize(responseString);
OpenshiftResponse<UserInfo> response =
- new UserInfoResponseUnmarshaller().unmarshall(responseString);
+ new UserInfoResponseUnmarshaller(this).unmarshall(responseString);
return response.getOpenshiftObject();
} catch (MalformedURLException e) {
throw new OpenshiftEndpointException(
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/AbstractOpenshiftJsonResponseUnmarshaller.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/AbstractOpenshiftJsonResponseUnmarshaller.java 2011-09-16 09:17:29 UTC (rev 34808)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/AbstractOpenshiftJsonResponseUnmarshaller.java 2011-09-16 09:19:23 UTC (rev 34809)
@@ -29,7 +29,7 @@
String messages = getString(IOpenshiftJsonConstants.PROPERTY_MESSAGES, node);
String result = getString(IOpenshiftJsonConstants.PROPERTY_RESULT, node);
int exitCode = node.get(IOpenshiftJsonConstants.PROPERTY_EXIT_CODE).asInt();
- OPENSHIFTOBJECT openshiftObject = createFromResultNode(node.get(IOpenshiftJsonConstants.PROPERTY_RESULT));
+ OPENSHIFTOBJECT openshiftObject = createOpenshiftObject(node);
return new OpenshiftResponse<OPENSHIFTOBJECT>(debug, messages, result, openshiftObject, exitCode);
} catch (IllegalArgumentException e) {
throw new OpenshiftException(e, "Could not parse response \"{0}\"", response);
@@ -38,10 +38,8 @@
}
}
+ protected abstract OPENSHIFTOBJECT createOpenshiftObject(ModelNode responseNode);
-
- protected abstract OPENSHIFTOBJECT createFromResultNode(ModelNode dataNode);
-
protected String getResponse() {
return response;
}
@@ -55,4 +53,8 @@
return propertyNode.asString();
}
+ protected long getLong(String property, ModelNode node) {
+ ModelNode propertyNode = node.get(property);
+ return propertyNode.asLong(-1);
+ }
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/ApplicationResponseUnmarshaller.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/ApplicationResponseUnmarshaller.java 2011-09-16 09:17:29 UTC (rev 34808)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/ApplicationResponseUnmarshaller.java 2011-09-16 09:19:23 UTC (rev 34809)
@@ -31,7 +31,7 @@
}
@Override
- protected Application createFromResultNode(ModelNode node) {
+ protected Application createOpenshiftObject(ModelNode node) {
return new Application(applicationName, cartridge, service);
}
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/ApplicationStatusResponseUnmarshaller.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/ApplicationStatusResponseUnmarshaller.java 2011-09-16 09:17:29 UTC (rev 34808)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/ApplicationStatusResponseUnmarshaller.java 2011-09-16 09:19:23 UTC (rev 34809)
@@ -10,10 +10,19 @@
******************************************************************************/
package org.jboss.ide.eclipse.as.openshift.core.internal.response;
+import org.jboss.dmr.ModelNode;
+import org.jboss.ide.eclipse.as.openshift.core.IOpenshiftJsonConstants;
+
/**
* @author André Dietisheim
*/
-public class ApplicationStatusResponseUnmarshaller extends StringResponseUnmarshaller {
+public class ApplicationStatusResponseUnmarshaller extends AbstractOpenshiftJsonResponseUnmarshaller<String> {
+ @Override
+ protected String createOpenshiftObject(ModelNode responseNode) {
+ ModelNode resultNode = responseNode.get(IOpenshiftJsonConstants.PROPERTY_RESULT);
+ return resultNode.asString();
+ }
+
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/DomainResponseUnmarshaller.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/DomainResponseUnmarshaller.java 2011-09-16 09:17:29 UTC (rev 34808)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/DomainResponseUnmarshaller.java 2011-09-16 09:19:23 UTC (rev 34809)
@@ -12,8 +12,6 @@
import org.jboss.dmr.ModelNode;
import org.jboss.ide.eclipse.as.openshift.core.Domain;
-import org.jboss.ide.eclipse.as.openshift.core.IOpenshiftJsonConstants;
-import org.jboss.ide.eclipse.as.openshift.core.User;
/**
* @author André Dietisheim
@@ -27,15 +25,7 @@
}
@Override
- protected Domain createFromResultNode(ModelNode node) {
- User user = createUser(node);
- return new Domain(domainName, user);
+ protected Domain createOpenshiftObject(ModelNode node) {
+ return new Domain(domainName);
}
-
- protected User createUser(ModelNode node) {
- String username = getString(IOpenshiftJsonConstants.PROPERTY_RHLOGIN, node);
- String uuid = getString(IOpenshiftJsonConstants.PROPERTY_UUID, node);
-
- return new User(username, uuid);
- }
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/ListCartridgesResponseUnmarshaller.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/ListCartridgesResponseUnmarshaller.java 2011-09-16 09:17:29 UTC (rev 34808)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/ListCartridgesResponseUnmarshaller.java 2011-09-16 09:19:23 UTC (rev 34809)
@@ -27,9 +27,16 @@
public class ListCartridgesResponseUnmarshaller extends AbstractOpenshiftJsonResponseUnmarshaller<List<Cartridge>> {
@Override
- protected List<Cartridge> createFromResultNode(ModelNode dataNode) {
+ protected List<Cartridge> createOpenshiftObject(ModelNode responseNode) {
List<Cartridge> cartridges = new ArrayList<Cartridge>();
+ ModelNode dataNode = responseNode.get(IOpenshiftJsonConstants.PROPERTY_DATA);
+ if (dataNode == null) {
+ return cartridges;
+ }
ModelNode cartridgesNode = dataNode.get(IOpenshiftJsonConstants.PROPERTY_CARTS);
+ if (cartridgesNode == null) {
+ return cartridges;
+ }
for (ModelNode cartridgeNode : cartridgesNode.asList()) {
cartridges.add(createCartridge(cartridgeNode));
}
Deleted: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/StringResponseUnmarshaller.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/StringResponseUnmarshaller.java 2011-09-16 09:17:29 UTC (rev 34808)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/StringResponseUnmarshaller.java 2011-09-16 09:19:23 UTC (rev 34809)
@@ -1,25 +0,0 @@
-/*******************************************************************************
- * 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.response;
-
-import org.jboss.dmr.ModelNode;
-
-/**
- * @author André Dietisheim
- */
-public class StringResponseUnmarshaller extends AbstractOpenshiftJsonResponseUnmarshaller<String> {
-
- @Override
- protected String createFromResultNode(ModelNode node) {
- return node.asString();
- }
-
-}
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-16 09:17:29 UTC (rev 34808)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/UserInfoResponseUnmarshaller.java 2011-09-16 09:19:23 UTC (rev 34809)
@@ -10,7 +10,16 @@
******************************************************************************/
package org.jboss.ide.eclipse.as.openshift.core.internal.response;
+import java.util.ArrayList;
+import java.util.List;
+
import org.jboss.dmr.ModelNode;
+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.IOpenshiftJsonConstants;
+import org.jboss.ide.eclipse.as.openshift.core.IOpenshiftService;
+import org.jboss.ide.eclipse.as.openshift.core.User;
import org.jboss.ide.eclipse.as.openshift.core.UserInfo;
/**
@@ -18,8 +27,60 @@
*/
public class UserInfoResponseUnmarshaller extends AbstractOpenshiftJsonResponseUnmarshaller<UserInfo> {
+ private IOpenshiftService service;
+
+ public UserInfoResponseUnmarshaller(IOpenshiftService service) {
+ this.service = service;
+ }
+
@Override
- protected UserInfo createFromResultNode(ModelNode node) {
- return new UserInfo("", "", "", "", "");
+ protected UserInfo createOpenshiftObject(ModelNode node) {
+ ModelNode dataNode = node.get(IOpenshiftJsonConstants.PROPERTY_DATA);
+ if (dataNode == null) {
+ return null;
+ }
+ ModelNode userInfoNode = node.get(IOpenshiftJsonConstants.PROPERTY_USER_INFO);
+ if (userInfoNode == null) {
+ return null;
+ }
+ Domain domain = createDomain(userInfoNode);
+ User user = createUser(userInfoNode, domain);
+ return new UserInfo(
+ user,
+ createApplications(node.get(IOpenshiftJsonConstants.PROPERTY_APP_INFO)));
}
+
+ private List<Application> createApplications(ModelNode appInfoNode) {
+ List<Application> applications = new ArrayList<Application>();
+ if (appInfoNode == null) {
+ return applications;
+ }
+
+ for(String name : appInfoNode.keys()) {
+ applications.add(createApplication(name, appInfoNode.get(name)));
+ }
+ return applications;
+ }
+
+
+ private Application createApplication(String name, ModelNode appNode) {
+ String embedded = getString(IOpenshiftJsonConstants.PROPERTY_EMBEDDED, appNode);
+ String uuid = getString(IOpenshiftJsonConstants.PROPERTY_UUID, appNode);
+ Cartridge cartrdige = new Cartridge(getString(IOpenshiftJsonConstants.PROPERTY_FRAMEWORK, appNode));
+ long creationTime = getLong(IOpenshiftJsonConstants.PROPERTY_FRAMEWORK, appNode);
+ return new Application(name, uuid, cartrdige, embedded, creationTime, service);
+ }
+
+ protected User createUser(ModelNode userInfoNode, Domain domain) {
+ String rhlogin = getString(IOpenshiftJsonConstants.PROPERTY_RHLOGIN, userInfoNode);
+ String uuid = getString(IOpenshiftJsonConstants.PROPERTY_RHLOGIN, userInfoNode);
+ return new User(rhlogin, uuid, domain);
+ }
+
+ protected Domain createDomain(ModelNode userInfoNode) {
+ String namespace = getString(IOpenshiftJsonConstants.PROPERTY_NAMESPACE, userInfoNode);
+ String rhcDomain = getString(IOpenshiftJsonConstants.PROPERTY_RHC_DOMAIN, userInfoNode);
+ return new Domain(namespace, rhcDomain);
+ }
+
}
Modified: trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/DomainIntegrationTest.java
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/DomainIntegrationTest.java 2011-09-16 09:17:29 UTC (rev 34808)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/DomainIntegrationTest.java 2011-09-16 09:19:23 UTC (rev 34809)
@@ -15,7 +15,6 @@
import org.jboss.ide.eclipse.as.openshift.core.Domain;
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.OpenshiftService;
import org.jboss.ide.eclipse.as.openshift.test.internal.core.fakes.TestSSHKey;
import org.junit.Before;
@@ -41,11 +40,7 @@
Domain domain = openshiftService.createDomain(domainName, sshKey);
assertNotNull(domain);
- assertEquals(domainName, domain.getName());
- assertNotNull(domain.getUser());
- User user = domain.getUser();
- assertEquals(USERNAME, user.getRhlogin());
- assertNotNull(user.getUuid());
+ assertEquals(domainName, domain.getNamespace());
}
@Test
@@ -56,11 +51,7 @@
Domain domain = openshiftService.changeDomain(domainName, sshKey);
assertNotNull(domain);
- assertEquals(domainName, domain.getName());
- assertNotNull(domain.getUser());
- User user = domain.getUser();
- assertEquals(USERNAME, user.getRhlogin());
- assertNotNull(user.getUuid());
+ assertEquals(domainName, domain.getNamespace());
}
private String createRandomString() {
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-16 09:17:29 UTC (rev 34808)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/DomainTest.java 2011-09-16 09:19:23 UTC (rev 34809)
@@ -20,7 +20,6 @@
import org.jboss.ide.eclipse.as.openshift.core.Domain;
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.request.ChangeDomainRequest;
import org.jboss.ide.eclipse.as.openshift.core.internal.request.CreateDomainRequest;
import org.jboss.ide.eclipse.as.openshift.core.internal.request.OpenshiftEnvelopeFactory;
@@ -65,11 +64,7 @@
assertNotNull(response);
Domain domain = response.getOpenshiftObject();
- assertEquals(domainName, domain.getName());
- User user = domain.getUser();
- assertNotNull(user);
- assertEquals(USERNAME, user.getRhlogin());
- assertEquals(UUID, user.getUuid());
+ assertEquals(domainName, domain.getNamespace());
}
@Test
14 years, 7 months