Author: adietish
Date: 2011-10-03 11:00:13 -0400 (Mon, 03 Oct 2011)
New Revision: 35283
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/fakes/TestUser.java
Log:
[JBIDE-9820] added tests. implementation is already throwing distinct exceptions
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-10-03
14:07:20 UTC (rev 35282)
+++
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/UserInfoIntegrationTest.java 2011-10-03
15:00:13 UTC (rev 35283)
@@ -18,6 +18,8 @@
import org.jboss.ide.eclipse.as.openshift.core.ICartridge;
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.NotFoundOpenshiftException;
import org.jboss.ide.eclipse.as.openshift.core.OpenshiftException;
import org.jboss.ide.eclipse.as.openshift.core.OpenshiftService;
import org.jboss.ide.eclipse.as.openshift.core.internal.ApplicationInfo;
@@ -25,6 +27,7 @@
import org.jboss.ide.eclipse.as.openshift.test.internal.core.fakes.TestUser;
import
org.jboss.ide.eclipse.as.openshift.test.internal.core.utils.ApplicationInfoAsserts;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Test;
/**
@@ -32,15 +35,20 @@
*/
public class UserInfoIntegrationTest {
+ private static final String PASSWORD_USER_WITHOUT_DOMAIN = "1q2w3e";
+ private static final String RHLOGIN_USER_WITHOUT_DOMAIN =
"toolsjboss.no.domain(a)gmail.com";
+
private OpenshiftService openshiftService;
private TestUser user;
+ @Ignore
@Before
public void setUp() {
this.openshiftService = new OpenshiftService();
this.user = new TestUser();
}
+ @Ignore
@Test
public void canGetUserInfo() throws Exception {
UserInfo userInfo = openshiftService.getUserInfo(user);
@@ -49,6 +57,22 @@
assertEquals(user.getRhlogin(), userInfo.getRhLogin());
}
+ @Test(expected = InvalidCredentialsOpenshiftException.class)
+ public void getUserInfoForInexistantUserThrowsException() throws Exception {
+ TestUser inexistantUser = new TestUser("inexistantUsername",
"bogusPassword");
+ openshiftService.getUserInfo(inexistantUser);
+ }
+
+ /**
+ * {@link OpenshiftService#getUserInfo(InternalUser)} for a user without
+ * domain throws {@link NotFoundOpenshiftException}
+ */
+ @Test(expected = NotFoundOpenshiftException.class)
+ public void canGetUserInfoForUserWithoutDomain() throws Exception {
+ TestUser inexistantUser = new TestUser(RHLOGIN_USER_WITHOUT_DOMAIN,
PASSWORD_USER_WITHOUT_DOMAIN);
+ openshiftService.getUserInfo(inexistantUser);
+ }
+
@Test
public void userInfoContainsOneMoreApplicationAfterCreatingNewApplication() throws
Exception {
UserInfo userInfo = openshiftService.getUserInfo(user);
@@ -70,6 +94,7 @@
}
}
+ @Ignore
@Test
public void canUseReturnedSSHKeyToChangeDomain() throws Exception {
UserInfo userInfo = openshiftService.getUserInfo(user);
@@ -78,7 +103,7 @@
ISSHPublicKey sshKey = userInfo.getSshPublicKey();
openshiftService.changeDomain(createRandomName(), sshKey, user);
}
-
+
private String createRandomName() {
return String.valueOf(System.currentTimeMillis());
}
Modified:
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/fakes/TestUser.java
===================================================================
---
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/fakes/TestUser.java 2011-10-03
14:07:20 UTC (rev 35282)
+++
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/fakes/TestUser.java 2011-10-03
15:00:13 UTC (rev 35283)
@@ -32,6 +32,10 @@
super(RHLOGIN, password);
}
+ public TestUser(String rhlogin, String password) {
+ super(rhlogin, password);
+ }
+
public TestUser(String rhlogin, String password, String url) {
super(rhlogin, password, url);
}
Show replies by date