Author: adietish
Date: 2011-09-26 08:27:42 -0400 (Mon, 26 Sep 2011)
New Revision: 35040
Added:
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/ApplicationLogReaderIntegrationTest.java
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/utils/ApplicationUtils.java
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/IUser.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/Application.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/User.java
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/ApplicationIntegrationTest.java
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/ApplicationTest.java
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/CartridgesIntegrationTest.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/ListCartridgesIntegrationTest.java
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/OpenshiftIntegrationTestSuite.java
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/UserInfoIntegrationTest.java
Log:
[JBIDE-9773] correcting ApplicationLogReader implementation and adding new tests
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/IUser.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/IUser.java 2011-09-26
10:05:13 UTC (rev 35039)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/IUser.java 2011-09-26
12:27:42 UTC (rev 35040)
@@ -30,6 +30,8 @@
public abstract Collection<Cartridge> getCartridges() throws OpenshiftException;
+ public Application createApplication(String name, Cartridge cartridge) throws
OpenshiftException;
+
public abstract Collection<Application> getApplications() throws
OpenshiftException;
}
\ No newline at end of file
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/Application.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/Application.java 2011-09-26
10:05:13 UTC (rev 35039)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/Application.java 2011-09-26
12:27:42 UTC (rev 35040)
@@ -135,6 +135,14 @@
this.uuid = applicationInfo.getUuid();
}
+ protected IOpenshiftService getService() {
+ return service;
+ }
+
+ protected User getUser() {
+ return user;
+ }
+
@Override
public int hashCode() {
final int prime = 31;
@@ -159,5 +167,4 @@
return false;
return true;
}
-
}
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-26
10:05:13 UTC (rev 35039)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/OpenshiftService.java 2011-09-26
12:27:42 UTC (rev 35040)
@@ -129,7 +129,6 @@
public Application createApplication(String name, ICartridge cartridge, User user)
throws OpenshiftException {
Application application = requestApplicationAction(new ApplicationRequest(name,
cartridge, ApplicationAction.CONFIGURE,
user.getRhlogin(), true), user);
- user.add(application);
return application;
}
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/User.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/User.java 2011-09-26
10:05:13 UTC (rev 35039)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/User.java 2011-09-26
12:27:42 UTC (rev 35040)
@@ -88,6 +88,13 @@
}
@Override
+ public Application createApplication(String name, Cartridge cartridge) throws
OpenshiftException {
+ Application application = service.createApplication(name, cartridge, this);
+ add(application);
+ return application;
+ }
+
+ @Override
public Collection<Application> getApplications() throws OpenshiftException {
loadLazyValues();
return Collections.unmodifiableList(applications);
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-26
10:05:13 UTC (rev 35039)
+++
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/ApplicationIntegrationTest.java 2011-09-26
12:27:42 UTC (rev 35040)
@@ -10,9 +10,8 @@
******************************************************************************/
package org.jboss.ide.eclipse.as.openshift.test.internal.core;
-import static
org.jboss.ide.eclipse.as.openshift.test.internal.core.utils.ApplicationAsserts.assertGitUri;
import static
org.jboss.ide.eclipse.as.openshift.test.internal.core.utils.ApplicationAsserts.assertAppliactionUrl;
-
+import static
org.jboss.ide.eclipse.as.openshift.test.internal.core.utils.ApplicationAsserts.assertGitUri;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
@@ -24,8 +23,9 @@
import org.jboss.ide.eclipse.as.openshift.core.internal.IOpenshiftService;
import org.jboss.ide.eclipse.as.openshift.core.internal.OpenshiftService;
import org.jboss.ide.eclipse.as.openshift.core.internal.User;
+import org.jboss.ide.eclipse.as.openshift.test.internal.core.fakes.TestUser;
+import org.jboss.ide.eclipse.as.openshift.test.internal.core.utils.ApplicationUtils;
import org.junit.Before;
-import org.junit.Ignore;
import org.junit.Test;
/**
@@ -35,29 +35,24 @@
private IOpenshiftService service;
- private static final String RHLOGIN = "toolsjboss(a)gmail.com";
- private static final String PASSWORD = "1q2w3e";
private User user;
private User invalidUser;
- @Ignore
@Before
public void setUp() {
this.service = new OpenshiftService();
- this.user = new User(RHLOGIN, PASSWORD);
- this.invalidUser = new User(RHLOGIN, "bogusPassword");
+ this.user = new TestUser();
+ this.invalidUser = new TestUser("bogusPassword");
}
- @Ignore
@Test(expected = InvalidCredentialsOpenshiftException.class)
public void createApplicationWithInvalidCredentialsThrowsException() throws Exception {
- service.createApplication(createRandomApplicationName(), ICartridge.JBOSSAS_7,
invalidUser);
+ service.createApplication(ApplicationUtils.createRandomApplicationName(),
ICartridge.JBOSSAS_7, invalidUser);
}
- @Ignore
@Test
public void canCreateApplication() throws Exception {
- String applicationName = createRandomApplicationName();
+ String applicationName = ApplicationUtils.createRandomApplicationName();
try {
ICartridge cartridge = ICartridge.JBOSSAS_7;
Application application = service.createApplication(applicationName, cartridge,
user);
@@ -65,59 +60,54 @@
assertEquals(applicationName, application.getName());
assertEquals(cartridge, application.getCartridge());
} finally {
- silentlyDestroyAS7Application(applicationName, service);
+ ApplicationUtils.silentlyDestroyAS7Application(applicationName, user, service);
}
}
- @Ignore
@Test
public void canDestroyApplication() throws Exception {
- String applicationName = createRandomApplicationName();
+ String applicationName = ApplicationUtils.createRandomApplicationName();
service.createApplication(applicationName, ICartridge.JBOSSAS_7, user);
service.destroyApplication(applicationName, ICartridge.JBOSSAS_7, user);
}
- @Ignore
@Test(expected = OpenshiftException.class)
public void createDuplicateApplicationThrowsException() throws Exception {
- String applicationName = createRandomApplicationName();
+ String applicationName = ApplicationUtils.createRandomApplicationName();
try {
service.createApplication(applicationName, ICartridge.JBOSSAS_7, user);
service.createApplication(applicationName, ICartridge.JBOSSAS_7, user);
} finally {
- silentlyDestroyAS7Application(applicationName, service);
+ ApplicationUtils.silentlyDestroyAS7Application(applicationName, user, service);
}
}
- @Ignore
@Test
public void canStopApplication() throws Exception {
- String applicationName = createRandomApplicationName();
+ String applicationName = ApplicationUtils.createRandomApplicationName();
try {
service.createApplication(applicationName, ICartridge.JBOSSAS_7, user);
service.stopApplication(applicationName, ICartridge.JBOSSAS_7, user);
} finally {
- silentlyDestroyAS7Application(applicationName, service);
+ ApplicationUtils.silentlyDestroyAS7Application(applicationName, user, service);
}
}
- @Ignore
@Test
public void canStartStoppedApplication() throws Exception {
- String applicationName = createRandomApplicationName();
+ String applicationName = ApplicationUtils.createRandomApplicationName();
try {
service.createApplication(applicationName, ICartridge.JBOSSAS_7, user);
service.stopApplication(applicationName, ICartridge.JBOSSAS_7, user);
service.startApplication(applicationName, ICartridge.JBOSSAS_7, user);
} finally {
- silentlyDestroyAS7Application(applicationName, service);
+ ApplicationUtils.silentlyDestroyAS7Application(applicationName, user, service);
}
}
- @Ignore
@Test
public void canStartStartedApplication() throws Exception {
- String applicationName = createRandomApplicationName();
+ String applicationName = ApplicationUtils.createRandomApplicationName();
try {
/**
* freshly created apps are started
@@ -129,14 +119,13 @@
service.createApplication(applicationName, ICartridge.JBOSSAS_7, user);
service.startApplication(applicationName, ICartridge.JBOSSAS_7, user);
} finally {
- silentlyDestroyAS7Application(applicationName, service);
+ ApplicationUtils.silentlyDestroyAS7Application(applicationName, user, service);
}
}
- @Ignore
@Test
public void canStopStoppedApplication() throws Exception {
- String applicationName = createRandomApplicationName();
+ String applicationName = ApplicationUtils.createRandomApplicationName();
try {
/**
* freshly created apps are started
@@ -149,14 +138,13 @@
service.stopApplication(applicationName, ICartridge.JBOSSAS_7, user);
service.stopApplication(applicationName, ICartridge.JBOSSAS_7, user);
} finally {
- silentlyDestroyAS7Application(applicationName, service);
+ ApplicationUtils.silentlyDestroyAS7Application(applicationName, user, service);
}
}
- @Ignore
@Test
public void canRestartApplication() throws Exception {
- String applicationName = createRandomApplicationName();
+ String applicationName = ApplicationUtils.createRandomApplicationName();
try {
/**
* freshly created apps are started
@@ -168,72 +156,45 @@
service.createApplication(applicationName, ICartridge.JBOSSAS_7, user);
service.restartApplication(applicationName, ICartridge.JBOSSAS_7, user);
} finally {
- silentlyDestroyAS7Application(applicationName, service);
+ ApplicationUtils.silentlyDestroyAS7Application(applicationName, user, service);
}
}
- @Ignore
@Test
public void canGetStatus() throws Exception {
- String applicationName = createRandomApplicationName();
+ String applicationName = ApplicationUtils.createRandomApplicationName();
try {
Application application = service.createApplication(applicationName,
ICartridge.JBOSSAS_7, user);
String applicationStatus = service.getStatus(application.getName(),
application.getCartridge(), user);
assertNotNull(applicationStatus);
} finally {
- silentlyDestroyAS7Application(applicationName, service);
+ ApplicationUtils.silentlyDestroyAS7Application(applicationName, user, service);
}
}
- @Ignore
@Test
- public void getStatusReturnsTheWholeLog() throws Exception {
- String applicationName = createRandomApplicationName();
- try {
- Application application = service.createApplication(applicationName,
ICartridge.JBOSSAS_7, user);
- String applicationStatus = service.getStatus(application.getName(),
application.getCartridge(), user);
- String applicationStatus2 = service.getStatus(application.getName(),
application.getCartridge(), user);
- assertEquals(applicationStatus, applicationStatus2);
- } finally {
- silentlyDestroyAS7Application(applicationName, service);
- }
- }
-
- @Test
public void returnsValidGitUri() throws Exception {
- String applicationName = createRandomApplicationName();
+ String applicationName = ApplicationUtils.createRandomApplicationName();
try {
IApplication application = service.createApplication(applicationName,
ICartridge.JBOSSAS_7, user);
String gitUri = application.getGitUri();
assertNotNull(gitUri);
assertGitUri(applicationName, gitUri);
} finally {
- silentlyDestroyAS7Application(applicationName, service);
+ ApplicationUtils.silentlyDestroyAS7Application(applicationName, user, service);
}
}
@Test
public void returnsValidApplicationUrl() throws Exception {
- String applicationName = createRandomApplicationName();
+ String applicationName = ApplicationUtils.createRandomApplicationName();
try {
IApplication application = service.createApplication(applicationName,
ICartridge.JBOSSAS_7, user);
String applicationUrl = application.getApplicationUrl();
assertNotNull(applicationUrl);
assertAppliactionUrl(applicationName, applicationUrl);
} finally {
- silentlyDestroyAS7Application(applicationName, service);
+ ApplicationUtils.silentlyDestroyAS7Application(applicationName, user, service);
}
}
-
- private String createRandomApplicationName() {
- return String.valueOf(System.currentTimeMillis());
- }
-
- private void silentlyDestroyAS7Application(String name, IOpenshiftService service) {
- try {
- service.destroyApplication(name, ICartridge.JBOSSAS_7, user);
- } catch (OpenshiftException e) {
- e.printStackTrace();
- }
- }
}
Added:
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/ApplicationLogReaderIntegrationTest.java
===================================================================
---
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/ApplicationLogReaderIntegrationTest.java
(rev 0)
+++
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/ApplicationLogReaderIntegrationTest.java 2011-09-26
12:27:42 UTC (rev 35040)
@@ -0,0 +1,79 @@
+/*******************************************************************************
+ * 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.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotSame;
+
+import org.jboss.ide.eclipse.as.openshift.core.ICartridge;
+import org.jboss.ide.eclipse.as.openshift.core.internal.Application;
+import org.jboss.ide.eclipse.as.openshift.core.internal.IOpenshiftService;
+import org.jboss.ide.eclipse.as.openshift.core.internal.OpenshiftService;
+import org.jboss.ide.eclipse.as.openshift.core.internal.User;
+import org.jboss.ide.eclipse.as.openshift.test.internal.core.fakes.TestUser;
+import org.jboss.ide.eclipse.as.openshift.test.internal.core.utils.ApplicationUtils;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * @author André Dietisheim
+ */
+public class ApplicationLogReaderIntegrationTest {
+
+ private IOpenshiftService service;
+
+ private User user;
+
+ @Before
+ public void setUp() {
+ this.service = new OpenshiftService();
+ this.user = new TestUser();
+ }
+
+ /**
+ * Asserts the service implementation: getStatus returns the same log if no
+ * new log entry is available
+ *
+ * @throws Exception
+ */
+ @Test
+ public void getStatusReturnsTheWholeLogIfNoNewLogEntryOnServer() throws Exception {
+ String applicationName = ApplicationUtils.createRandomApplicationName();
+ try {
+ Application application = service.createApplication(applicationName,
ICartridge.JBOSSAS_7, user);
+ String applicationStatus = service.getStatus(application.getName(),
application.getCartridge(), user);
+ String applicationStatus2 = service.getStatus(application.getName(),
application.getCartridge(), user);
+ assertEquals(applicationStatus, applicationStatus2);
+ } finally {
+ ApplicationUtils.silentlyDestroyAS7Application(applicationName, user, service);
+ }
+ }
+
+ /**
+ * Asserts the service implementation: getStatus returns the new entries
+ * (and a tailing-header) if new log entries are available
+ */
+ @Test
+ public void getStatusReturnsNewEntriesIfNewLogEntriesOnServer() throws Exception {
+ String applicationName = ApplicationUtils.createRandomApplicationName();
+ try {
+ Application application = service.createApplication(applicationName,
ICartridge.JBOSSAS_7, user);
+ String applicationStatus = service.getStatus(application.getName(),
application.getCartridge(), user);
+ application.restart();
+ String applicationStatus2 = service.getStatus(application.getName(),
application.getCartridge(), user);
+ assertFalse(applicationStatus.equals(applicationStatus2));
+ } finally {
+ ApplicationUtils.silentlyDestroyAS7Application(applicationName, user, service);
+ }
+ }
+
+}
Property changes on:
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/ApplicationLogReaderIntegrationTest.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified:
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/ApplicationTest.java
===================================================================
---
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/ApplicationTest.java 2011-09-26
10:05:13 UTC (rev 35039)
+++
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/ApplicationTest.java 2011-09-26
12:27:42 UTC (rev 35040)
@@ -189,7 +189,11 @@
, ApplicationResponseFake.APPLICATION_CREATIONTIME
, user
, userInfoService);
- // we need to add it manually since we dont use the service
+ /**
+ * we have to add it manually since we dont create the application with the user class
+ *
+ * @see User#createApplication
+ */
user.add(application);
return application;
}
Modified:
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/CartridgesIntegrationTest.java
===================================================================
---
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/CartridgesIntegrationTest.java 2011-09-26
10:05:13 UTC (rev 35039)
+++
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/CartridgesIntegrationTest.java 2011-09-26
12:27:42 UTC (rev 35040)
@@ -18,6 +18,7 @@
import org.jboss.ide.eclipse.as.openshift.core.Cartridge;
import org.jboss.ide.eclipse.as.openshift.core.internal.OpenshiftService;
import org.jboss.ide.eclipse.as.openshift.core.internal.User;
+import org.jboss.ide.eclipse.as.openshift.test.internal.core.fakes.TestUser;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
@@ -29,15 +30,12 @@
private OpenshiftService openshiftService;
- private static final String RHLOGIN = "toolsjboss(a)gmail.com";
- private static final String PASSWORD = "1q2w3e";
-
private User user;
@Before
public void setUp() {
this.openshiftService = new OpenshiftService();
- this.user = new User(RHLOGIN, PASSWORD);
+ this.user = new TestUser();
}
@Ignore
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-26
10:05:13 UTC (rev 35039)
+++
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/DomainIntegrationTest.java 2011-09-26
12:27:42 UTC (rev 35040)
@@ -16,21 +16,20 @@
import org.jboss.ide.eclipse.as.openshift.core.SSHKeyPair;
import org.jboss.ide.eclipse.as.openshift.core.internal.Domain;
import org.jboss.ide.eclipse.as.openshift.core.internal.OpenshiftService;
-import org.jboss.ide.eclipse.as.openshift.core.internal.User;
import org.jboss.ide.eclipse.as.openshift.test.internal.core.fakes.TestSSHKey;
+import org.jboss.ide.eclipse.as.openshift.test.internal.core.fakes.TestUser;
import org.junit.Before;
import org.junit.Test;
public class DomainIntegrationTest {
private OpenshiftService openshiftService;
+ private TestUser user;
- private static final String RHLOGIN = "toolsjboss(a)gmail.com";
- private static final String PASSWORD = "1q2w3e";
-
@Before
public void setUp() {
this.openshiftService = new OpenshiftService();
+ this.user = new TestUser();
}
@Test
@@ -38,7 +37,6 @@
String domainName = createRandomString();
SSHKeyPair sshKey = TestSSHKey.create();
- User user = new User(RHLOGIN, PASSWORD);
Domain domain = openshiftService.createDomain(domainName, sshKey, user);
assertNotNull(domain);
@@ -50,7 +48,6 @@
String domainName = createRandomString();
SSHKeyPair sshKey = TestSSHKey.create();
- User user = new User(RHLOGIN, PASSWORD);
Domain domain = openshiftService.changeDomain(domainName, sshKey, user);
assertNotNull(domain);
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-26
10:05:13 UTC (rev 35039)
+++
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/ListCartridgesIntegrationTest.java 2011-09-26
12:27:42 UTC (rev 35040)
@@ -18,7 +18,7 @@
import org.jboss.ide.eclipse.as.openshift.core.Cartridge;
import org.jboss.ide.eclipse.as.openshift.core.internal.OpenshiftService;
-import org.jboss.ide.eclipse.as.openshift.core.internal.User;
+import org.jboss.ide.eclipse.as.openshift.test.internal.core.fakes.TestUser;
import org.junit.Before;
import org.junit.Test;
@@ -28,18 +28,17 @@
public class ListCartridgesIntegrationTest {
private OpenshiftService openshiftService;
+ private TestUser user;
- private static final String USERNAME = "toolsjboss(a)gmail.com";
- private static final String PASSWORD = "1q2w3e";
-
@Before
public void setUp() {
this.openshiftService = new OpenshiftService();
+ this.user = new TestUser();
}
@Test
public void canListCartridges() throws Exception {
- List<Cartridge> cartridges = openshiftService.getCartridges(new User(USERNAME,
PASSWORD));
+ List<Cartridge> cartridges = openshiftService.getCartridges(user);
assertNotNull(cartridges);
assertTrue(cartridges.size() > 0);
assertThatContainsCartridge("jbossas-7.0", cartridges);
Modified:
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/OpenshiftIntegrationTestSuite.java
===================================================================
---
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/OpenshiftIntegrationTestSuite.java 2011-09-26
10:05:13 UTC (rev 35039)
+++
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/OpenshiftIntegrationTestSuite.java 2011-09-26
12:27:42 UTC (rev 35040)
@@ -20,7 +20,8 @@
CartridgesIntegrationTest.class,
DomainIntegrationTest.class,
ListCartridgesIntegrationTest.class,
- UserInfoIntegrationTest.class
+ UserInfoIntegrationTest.class,
+ ApplicationLogReaderIntegrationTest.class
})
/**
* @author André Dietisheim
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-26
10:05:13 UTC (rev 35039)
+++
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/UserInfoIntegrationTest.java 2011-09-26
12:27:42 UTC (rev 35040)
@@ -21,8 +21,8 @@
import org.jboss.ide.eclipse.as.openshift.core.internal.ApplicationInfo;
import org.jboss.ide.eclipse.as.openshift.core.internal.IOpenshiftService;
import org.jboss.ide.eclipse.as.openshift.core.internal.OpenshiftService;
-import org.jboss.ide.eclipse.as.openshift.core.internal.User;
import org.jboss.ide.eclipse.as.openshift.core.internal.UserInfo;
+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.Test;
@@ -33,26 +33,24 @@
public class UserInfoIntegrationTest {
private OpenshiftService openshiftService;
+ private TestUser user;
- private static final String RHLOGIN = "toolsjboss(a)gmail.com";
- private static final String PASSWORD = "1q2w3e";
-
@Before
public void setUp() {
this.openshiftService = new OpenshiftService();
+ this.user = new TestUser();
}
@Test
public void canGetUserInfo() throws Exception {
- UserInfo userInfo = openshiftService.getUserInfo(new User(RHLOGIN, PASSWORD));
+ UserInfo userInfo = openshiftService.getUserInfo(user);
assertNotNull(userInfo);
- assertEquals(RHLOGIN, userInfo.getRhLogin());
+ assertEquals(user.getRhlogin(), userInfo.getRhLogin());
}
@Test
public void userInfoContainsOneMoreApplicationAfterCreatingNewApplication() throws
Exception {
- User user = new User(RHLOGIN, PASSWORD);
UserInfo userInfo = openshiftService.getUserInfo(user);
assertNotNull(userInfo);
@@ -74,7 +72,6 @@
@Test
public void canUseReturnedSSHKeyToChangeDomain() throws Exception {
- User user = new User(RHLOGIN, PASSWORD);
UserInfo userInfo = openshiftService.getUserInfo(user);
assertNotNull(userInfo);
@@ -88,7 +85,7 @@
private void silentlyDestroyAS7Application(String name, IOpenshiftService service) {
try {
- service.destroyApplication(name, ICartridge.JBOSSAS_7, new User(RHLOGIN, PASSWORD));
+ service.destroyApplication(name, ICartridge.JBOSSAS_7, user);
} catch (OpenshiftException e) {
e.printStackTrace();
}
Added:
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
(rev 0)
+++
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/fakes/TestUser.java 2011-09-26
12:27:42 UTC (rev 35040)
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.ide.eclipse.as.openshift.test.internal.core.fakes;
+
+import org.jboss.ide.eclipse.as.openshift.core.internal.User;
+
+/**
+ * @author André Dietisheim
+ */
+public class TestUser extends User {
+
+ private static final String RHLOGIN = "toolsjboss(a)gmail.com";
+ private static final String PASSWORD = "1q2w3e";
+
+ public TestUser() {
+ super(RHLOGIN, PASSWORD);
+ }
+
+ public TestUser(String password) {
+ super(RHLOGIN, password);
+ }
+}
Property changes on:
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/fakes/TestUser.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added:
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/utils/ApplicationUtils.java
===================================================================
---
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/utils/ApplicationUtils.java
(rev 0)
+++
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/utils/ApplicationUtils.java 2011-09-26
12:27:42 UTC (rev 35040)
@@ -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.test.internal.core.utils;
+
+import org.jboss.ide.eclipse.as.openshift.core.Cartridge;
+import org.jboss.ide.eclipse.as.openshift.core.ICartridge;
+import org.jboss.ide.eclipse.as.openshift.core.OpenshiftException;
+import org.jboss.ide.eclipse.as.openshift.core.internal.Application;
+import org.jboss.ide.eclipse.as.openshift.core.internal.IOpenshiftService;
+import org.jboss.ide.eclipse.as.openshift.core.internal.User;
+
+/**
+ * @author André Dietisheim
+ */
+public class ApplicationUtils {
+
+ public static String createRandomApplicationName() {
+ return String.valueOf(System.currentTimeMillis());
+ }
+
+ public static Application createApplication(User user, IOpenshiftService service) throws
OpenshiftException {
+ return service.createApplication(createRandomApplicationName(), Cartridge.JBOSSAS_7,
user);
+ }
+
+ public static void silentlyDestroyAS7Application(String name, User user,
IOpenshiftService service) {
+ try {
+ service.destroyApplication(name, ICartridge.JBOSSAS_7, user);
+ } catch (OpenshiftException e) {
+ e.printStackTrace();
+ }
+ }
+}
Property changes on:
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/utils/ApplicationUtils.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain