JBoss Tools SVN: r35068 - 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-27 11:52:59 -0400 (Tue, 27 Sep 2011)
New Revision: 35068
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/ApplicationLogReader.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/Domain.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/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/UserInfoAware.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/unmarshalling/ApplicationResponseUnmarshaller.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/unmarshalling/DomainResponseUnmarshaller.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/utils/UrlBuilder.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/DomainTest.java
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/UserTest.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/TestUser.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/ApplicationUtils.java
Log:
[JBIDE-9773] hiding User implementation from user programmer
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/ApplicationLogReader.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/ApplicationLogReader.java 2011-09-27 15:42:35 UTC (rev 35067)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/ApplicationLogReader.java 2011-09-27 15:52:59 UTC (rev 35068)
@@ -32,12 +32,12 @@
private IOpenshiftService service;
private StringReader logReader;
private Application application;
- private InternalUser internalUser;
+ private InternalUser user;
private String currentStatus;
- public ApplicationLogReader(Application application, InternalUser internalUser, IOpenshiftService service) {
+ public ApplicationLogReader(Application application, InternalUser user, IOpenshiftService service) {
this.application = application;
- this.internalUser = internalUser;
+ this.user = user;
this.service = service;
}
@@ -91,7 +91,7 @@
protected String requestStatus() throws IOException {
try {
- String status = service.getStatus(application.getName(), application.getCartridge(), internalUser);
+ String status = service.getStatus(application.getName(), application.getCartridge(), user);
if (isSameStatus(status, currentStatus)) {
status = null;
}
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-27 15:42:35 UTC (rev 35067)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/Application.java 2011-09-27 15:52:59 UTC (rev 35068)
@@ -32,13 +32,13 @@
private ApplicationLogReader logReader;
private ApplicationInfo applicationInfo;
- public Application(String name, ICartridge cartridge, InternalUser internalUser, IOpenshiftService service) {
- this(name, cartridge, null, internalUser, service);
+ public Application(String name, ICartridge cartridge, InternalUser user, IOpenshiftService service) {
+ this(name, cartridge, null, user, service);
}
- public Application(String name, ICartridge cartridge, ApplicationInfo applicationInfo, InternalUser internalUser,
+ public Application(String name, ICartridge cartridge, ApplicationInfo applicationInfo, InternalUser user,
IOpenshiftService service) {
- super(internalUser);
+ super(user);
this.name = name;
this.cartridge = cartridge;
this.service = service;
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/Domain.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/Domain.java 2011-09-27 15:42:35 UTC (rev 35067)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/Domain.java 2011-09-27 15:52:59 UTC (rev 35068)
@@ -20,12 +20,12 @@
private String namespace;
- public Domain(String namespace, InternalUser internalUser) {
- this(namespace, null, internalUser);
+ public Domain(String namespace, InternalUser user) {
+ this(namespace, null, user);
}
- public Domain(String namespace, String rhcDomain, InternalUser internalUser) {
- super(internalUser);
+ public Domain(String namespace, String rhcDomain, InternalUser user) {
+ super(user);
this.namespace = namespace;
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/IOpenshiftService.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/IOpenshiftService.java 2011-09-27 15:42:35 UTC (rev 35067)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/IOpenshiftService.java 2011-09-27 15:52:59 UTC (rev 35068)
@@ -22,23 +22,23 @@
*/
public interface IOpenshiftService {
- public List<ICartridge> getCartridges(InternalUser internalUser) throws OpenshiftException;
+ public List<ICartridge> getCartridges(InternalUser user) throws OpenshiftException;
- public Application createApplication(String name, ICartridge cartridge, InternalUser internalUser) throws OpenshiftException;
+ public Application createApplication(String name, ICartridge cartridge, InternalUser user) throws OpenshiftException;
- public void destroyApplication(String name, ICartridge cartridge, InternalUser internalUser) throws OpenshiftException;
+ public void destroyApplication(String name, ICartridge cartridge, InternalUser user) throws OpenshiftException;
- public IApplication startApplication(String name, ICartridge cartridge, InternalUser internalUser) throws OpenshiftException;
+ public IApplication startApplication(String name, ICartridge cartridge, InternalUser user) throws OpenshiftException;
- public IApplication restartApplication(String name, ICartridge cartridge, InternalUser internalUser) throws OpenshiftException;
+ public IApplication restartApplication(String name, ICartridge cartridge, InternalUser user) throws OpenshiftException;
- public IApplication stopApplication(String name, ICartridge cartridge, InternalUser internalUser) throws OpenshiftException;
+ public IApplication stopApplication(String name, ICartridge cartridge, InternalUser user) throws OpenshiftException;
- public String getStatus(String name, ICartridge cartridge, InternalUser internalUser) throws OpenshiftException;
+ public String getStatus(String name, ICartridge cartridge, InternalUser user) throws OpenshiftException;
- public IDomain changeDomain(String name, ISSHPublicKey sshKey, InternalUser internalUser) throws OpenshiftException;
+ public IDomain changeDomain(String name, ISSHPublicKey sshKey, InternalUser user) throws OpenshiftException;
- public IDomain createDomain(String name, ISSHPublicKey sshKey, InternalUser internalUser) throws OpenshiftException;
+ public IDomain createDomain(String name, ISSHPublicKey sshKey, InternalUser user) throws OpenshiftException;
- public UserInfo getUserInfo(InternalUser internalUser) throws OpenshiftException;
+ public UserInfo getUserInfo(InternalUser user) 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-27 15:42:35 UTC (rev 35067)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/OpenshiftService.java 2011-09-27 15:52:59 UTC (rev 35068)
@@ -52,12 +52,12 @@
private static final String BASE_URL = "https://openshift.redhat.com/broker";
@Override
- public UserInfo getUserInfo(InternalUser internalUser) throws OpenshiftException {
- UserInfoRequest request = new UserInfoRequest(internalUser.getRhlogin(), true);
+ public UserInfo getUserInfo(InternalUser user) throws OpenshiftException {
+ UserInfoRequest request = new UserInfoRequest(user.getRhlogin(), true);
String url = request.getUrlString(BASE_URL);
try {
String requestString = new UserInfoRequestJsonMarshaller().marshall(request);
- String openShiftRequestString = new OpenshiftEnvelopeFactory(internalUser.getPassword(), requestString)
+ String openShiftRequestString = new OpenshiftEnvelopeFactory(user.getPassword(), requestString)
.createString();
String responseString = createHttpClient(url).post(openShiftRequestString);
responseString = JsonSanitizer.sanitize(responseString);
@@ -66,21 +66,21 @@
return response.getOpenshiftObject();
} catch (MalformedURLException e) {
throw new OpenshiftEndpointException(
- url, e, "Could not get user info for user \"{0}\" at \"{1}\"", internalUser.getRhlogin(), url, e);
+ url, e, "Could not get InternalUser info for InternalUser \"{0}\" at \"{1}\"", user.getRhlogin(), url, e);
} catch (HttpClientException e) {
throw new OpenshiftEndpointException(
- url, e, "Could not get user info for user \"{0}\" at \"{1}\"", internalUser.getRhlogin(), url, e);
+ url, e, "Could not get InternalUser info for InternalUser \"{0}\" at \"{1}\"", user.getRhlogin(), url, e);
}
}
@Override
- public List<ICartridge> getCartridges(InternalUser internalUser) throws OpenshiftException {
- ListCartridgesRequest listCartridgesRequest = new ListCartridgesRequest(internalUser.getRhlogin(), true);
+ public List<ICartridge> getCartridges(InternalUser user) throws OpenshiftException {
+ ListCartridgesRequest listCartridgesRequest = new ListCartridgesRequest(user.getRhlogin(), true);
String url = listCartridgesRequest.getUrlString(BASE_URL);
try {
String listCartridgesRequestString =
new ListCartridgesRequestJsonMarshaller().marshall(listCartridgesRequest);
- String request = new OpenshiftEnvelopeFactory(internalUser.getPassword(), listCartridgesRequestString)
+ String request = new OpenshiftEnvelopeFactory(user.getPassword(), listCartridgesRequestString)
.createString();
String listCatridgesReponse = createHttpClient(url).post(request);
listCatridgesReponse = JsonSanitizer.sanitize(listCatridgesReponse);
@@ -95,27 +95,27 @@
}
@Override
- public IDomain createDomain(String name, ISSHPublicKey sshKey, InternalUser internalUser) throws OpenshiftException {
- return requestDomainAction(new CreateDomainRequest(name, sshKey, internalUser.getRhlogin(), true), internalUser);
+ public IDomain createDomain(String name, ISSHPublicKey sshKey, InternalUser user) throws OpenshiftException {
+ return requestDomainAction(new CreateDomainRequest(name, sshKey, user.getRhlogin(), true), user);
}
@Override
- public IDomain changeDomain(String newName, ISSHPublicKey sshKey, InternalUser internalUser) throws OpenshiftException {
- return requestDomainAction(new ChangeDomainRequest(newName, sshKey, internalUser.getRhlogin(), true), internalUser);
+ public IDomain changeDomain(String newName, ISSHPublicKey sshKey, InternalUser user) throws OpenshiftException {
+ return requestDomainAction(new ChangeDomainRequest(newName, sshKey, user.getRhlogin(), true), user);
}
- protected IDomain requestDomainAction(AbstractDomainRequest request, InternalUser internalUser) throws OpenshiftException {
+ protected IDomain requestDomainAction(AbstractDomainRequest request, InternalUser user) throws OpenshiftException {
String url = request.getUrlString(BASE_URL);
try {
String requestString =
new OpenshiftEnvelopeFactory(
- internalUser.getPassword(),
+ user.getPassword(),
new DomainRequestJsonMarshaller().marshall(request))
.createString();
String responseString = createHttpClient(url).post(requestString);
responseString = JsonSanitizer.sanitize(responseString);
OpenshiftResponse<IDomain> response =
- new DomainResponseUnmarshaller(request.getName(), internalUser).unmarshall(responseString);
+ new DomainResponseUnmarshaller(request.getName(), user).unmarshall(responseString);
return response.getOpenshiftObject();
} catch (MalformedURLException e) {
throw new OpenshiftEndpointException(url, e, "Could not list available cartridges at \"{0}\"", url);
@@ -125,57 +125,46 @@
}
@Override
- public Application createApplication(String name, ICartridge cartridge, InternalUser internalUser) throws OpenshiftException {
+ public Application createApplication(String name, ICartridge cartridge, InternalUser user) throws OpenshiftException {
Application application = requestApplicationAction(new ApplicationRequest(name, cartridge, ApplicationAction.CONFIGURE,
- internalUser.getRhlogin(), true), internalUser);
+ user.getRhlogin(), true), user);
return application;
}
@Override
- public void destroyApplication(String name, ICartridge cartridge, InternalUser internalUser) throws OpenshiftException {
+ public void destroyApplication(String name, ICartridge cartridge, InternalUser user) throws OpenshiftException {
IApplication application = requestApplicationAction(new ApplicationRequest(name, cartridge, ApplicationAction.DECONFIGURE,
- internalUser.getRhlogin(), true), internalUser);
- internalUser.remove(application);
+ user.getRhlogin(), true), user);
+ user.remove(application);
}
@Override
- public IApplication startApplication(String name, ICartridge cartridge, InternalUser internalUser) throws OpenshiftException {
+ public IApplication startApplication(String name, ICartridge cartridge, InternalUser user) throws OpenshiftException {
return requestApplicationAction(new ApplicationRequest(name, cartridge, ApplicationAction.START,
- internalUser.getRhlogin(), true), internalUser);
+ user.getRhlogin(), true), user);
}
@Override
- public IApplication restartApplication(String name, ICartridge cartridge, InternalUser internalUser) throws OpenshiftException {
+ public IApplication restartApplication(String name, ICartridge cartridge, InternalUser user) throws OpenshiftException {
return requestApplicationAction(new ApplicationRequest(name, cartridge, ApplicationAction.RESTART,
- internalUser.getRhlogin(), true), internalUser);
+ user.getRhlogin(), true), user);
}
@Override
- public IApplication stopApplication(String name, ICartridge cartridge, InternalUser internalUser) throws OpenshiftException {
+ public IApplication stopApplication(String name, ICartridge cartridge, InternalUser user) throws OpenshiftException {
return requestApplicationAction(new ApplicationRequest(name, cartridge, ApplicationAction.STOP,
- internalUser.getRhlogin(), true), internalUser);
+ user.getRhlogin(), true), user);
}
- /**
- * This seems not implemented yet on the server. The service simply returns
- * a <code>null</code> data object. example response:
- * <p>
- * {"messages":"","debug":"","data":null,"api":"1.1.1","api_c":[
- * "placeholder"
- * ],"result":"Success","broker":"1.1.1","broker_c":["namespace"
- * ,"rhlogin","ssh"
- * ,"app_uuid","debug","alter","cartridge","cart_type","action"
- * ,"app_name","api"],"exit_code":0}
- */
@Override
- public String getStatus(String applicationName, ICartridge cartridge, InternalUser internalUser) throws OpenshiftException {
+ public String getStatus(String applicationName, ICartridge cartridge, InternalUser user) throws OpenshiftException {
ApplicationRequest applicationRequest =
- new ApplicationRequest(applicationName, cartridge, ApplicationAction.STATUS, internalUser.getRhlogin(), true);
+ new ApplicationRequest(applicationName, cartridge, ApplicationAction.STATUS, user.getRhlogin(), true);
String url = applicationRequest.getUrlString(BASE_URL);
try {
String applicationRequestString =
new ApplicationRequestJsonMarshaller().marshall(applicationRequest);
- String request = new OpenshiftEnvelopeFactory(internalUser.getPassword(), applicationRequestString).createString();
+ String request = new OpenshiftEnvelopeFactory(user.getPassword(), applicationRequestString).createString();
String response = createHttpClient(url).post(request);
response = JsonSanitizer.sanitize(response);
@@ -189,9 +178,9 @@
} catch (UnauthorizedException e) {
throw new InvalidCredentialsOpenshiftException(
url, e,
- "Could not {0} application \"{1}\" at \"{2}\": Invalid credentials user \"{3}\", password \"{4}\"",
+ "Could not {0} application \"{1}\" at \"{2}\": Invalid credentials InternalUser \"{3}\", password \"{4}\"",
applicationRequest.getAction().toHumanReadable(), applicationRequest.getName(), url,
- internalUser.getRhlogin(), internalUser.getPassword());
+ user.getRhlogin(), user.getPassword());
} catch (HttpClientException e) {
throw new OpenshiftEndpointException(
url, e, "Could not {0} application \"{1}\" at \"{2}\"",
@@ -199,19 +188,19 @@
}
}
- protected Application requestApplicationAction(ApplicationRequest applicationRequest, InternalUser internalUser)
+ protected Application requestApplicationAction(ApplicationRequest applicationRequest, InternalUser user)
throws OpenshiftException {
String url = applicationRequest.getUrlString(BASE_URL);
try {
String applicationRequestString =
new ApplicationRequestJsonMarshaller().marshall(applicationRequest);
- String request = new OpenshiftEnvelopeFactory(internalUser.getPassword(), applicationRequestString).createString();
+ String request = new OpenshiftEnvelopeFactory(user.getPassword(), applicationRequestString).createString();
String response = createHttpClient(url).post(request);
response = JsonSanitizer.sanitize(response);
OpenshiftResponse<Application> openshiftResponse =
new ApplicationResponseUnmarshaller(applicationRequest.getName(),
- applicationRequest.getCartridge(), internalUser, this).unmarshall(response);
+ applicationRequest.getCartridge(), user, this).unmarshall(response);
return openshiftResponse.getOpenshiftObject();
} catch (MalformedURLException e) {
throw new OpenshiftException(
@@ -220,10 +209,10 @@
} catch (UnauthorizedException e) {
throw new InvalidCredentialsOpenshiftException(
url, e,
- "Could not {0} application \"{1}\" at \"{2}\": Invalid credentials user \"{3}\", password \"{4}\"",
+ "Could not {0} application \"{1}\" at \"{2}\": Invalid credentials InternalUser \"{3}\", password \"{4}\"",
applicationRequest.getAction().toHumanReadable(), applicationRequest.getName(), url,
- internalUser.getRhlogin(),
- internalUser.getPassword());
+ user.getRhlogin(),
+ user.getPassword());
} catch (HttpClientException e) {
throw new OpenshiftEndpointException(
url, e, "Could not {0} application \"{1}\" at \"{2}\"",
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/UserInfoAware.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/UserInfoAware.java 2011-09-27 15:42:35 UTC (rev 35067)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/UserInfoAware.java 2011-09-27 15:52:59 UTC (rev 35068)
@@ -15,21 +15,21 @@
public class UserInfoAware {
private UserInfo userInfo;
- private InternalUser internalUser;
+ private InternalUser user;
- protected UserInfoAware(InternalUser internalUser) {
- this.internalUser = internalUser;
+ protected UserInfoAware(InternalUser user) {
+ this.user = user;
}
protected UserInfo getUserInfo() throws OpenshiftException {
if (userInfo == null) {
- this.userInfo = internalUser.getUserInfo();
+ this.userInfo = user.getUserInfo();
}
return userInfo;
}
protected InternalUser getUser() {
- return internalUser;
+ return user;
}
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/unmarshalling/ApplicationResponseUnmarshaller.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/unmarshalling/ApplicationResponseUnmarshaller.java 2011-09-27 15:42:35 UTC (rev 35067)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/unmarshalling/ApplicationResponseUnmarshaller.java 2011-09-27 15:52:59 UTC (rev 35068)
@@ -21,20 +21,20 @@
*/
public class ApplicationResponseUnmarshaller extends AbstractOpenshiftJsonResponseUnmarshaller<Application> {
- private InternalUser internalUser;
+ private InternalUser user;
private String applicationName;
private ICartridge cartridge;
private OpenshiftService service;
- public ApplicationResponseUnmarshaller(String applicationName, ICartridge cartridge, InternalUser internalUser, OpenshiftService service) {
+ public ApplicationResponseUnmarshaller(String applicationName, ICartridge cartridge, InternalUser user, OpenshiftService service) {
this.applicationName = applicationName;
this.cartridge = cartridge;
- this.internalUser = internalUser;
+ this.user = user;
this.service = service;
}
@Override
protected Application createOpenshiftObject(ModelNode node) {
- return new Application(applicationName, cartridge, internalUser, service);
+ return new Application(applicationName, cartridge, user, service);
}
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/unmarshalling/DomainResponseUnmarshaller.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/unmarshalling/DomainResponseUnmarshaller.java 2011-09-27 15:42:35 UTC (rev 35067)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/unmarshalling/DomainResponseUnmarshaller.java 2011-09-27 15:52:59 UTC (rev 35068)
@@ -21,15 +21,15 @@
public class DomainResponseUnmarshaller extends AbstractOpenshiftJsonResponseUnmarshaller<IDomain> {
private String domainName;
- private InternalUser internalUser;
+ private InternalUser user;
- public DomainResponseUnmarshaller(String domainName, InternalUser internalUser) {
+ public DomainResponseUnmarshaller(String domainName, InternalUser user) {
this.domainName = domainName;
- this.internalUser = internalUser;
+ this.user = user;
}
@Override
protected IDomain createOpenshiftObject(ModelNode node) {
- return new Domain(domainName, internalUser);
+ return new Domain(domainName, user);
}
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/utils/UrlBuilder.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/utils/UrlBuilder.java 2011-09-27 15:42:35 UTC (rev 35067)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/utils/UrlBuilder.java 2011-09-27 15:52:59 UTC (rev 35068)
@@ -7,7 +7,7 @@
import java.util.Collection;
/**
- * A builder for an url. Currently no state checking is done, the user is
+ * A builder for an url. Currently no state checking is done, the InternalUser is
* responsible to build something that makes sense.
*
* @author André Dietisheim
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-27 15:42:35 UTC (rev 35067)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/ApplicationIntegrationTest.java 2011-09-27 15:52:59 UTC (rev 35068)
@@ -19,10 +19,10 @@
import org.jboss.ide.eclipse.as.openshift.core.ICartridge;
import org.jboss.ide.eclipse.as.openshift.core.InvalidCredentialsOpenshiftException;
import org.jboss.ide.eclipse.as.openshift.core.OpenshiftException;
+import org.jboss.ide.eclipse.as.openshift.core.User;
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.InternalUser;
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;
@@ -35,13 +35,13 @@
private IOpenshiftService service;
- private InternalUser internalUser;
- private InternalUser invalidUser;
+ private User user;
+ private User invalidUser;
@Before
public void setUp() {
this.service = new OpenshiftService();
- this.internalUser = new TestUser();
+ this.user = new TestUser();
this.invalidUser = new TestUser("bogusPassword");
}
@@ -55,30 +55,30 @@
String applicationName = ApplicationUtils.createRandomApplicationName();
try {
ICartridge cartridge = ICartridge.JBOSSAS_7;
- Application application = service.createApplication(applicationName, cartridge, internalUser);
+ Application application = service.createApplication(applicationName, cartridge, user);
assertNotNull(application);
assertEquals(applicationName, application.getName());
assertEquals(cartridge, application.getCartridge());
} finally {
- ApplicationUtils.silentlyDestroyAS7Application(applicationName, internalUser, service);
+ ApplicationUtils.silentlyDestroyAS7Application(applicationName, user, service);
}
}
@Test
public void canDestroyApplication() throws Exception {
String applicationName = ApplicationUtils.createRandomApplicationName();
- service.createApplication(applicationName, ICartridge.JBOSSAS_7, internalUser);
- service.destroyApplication(applicationName, ICartridge.JBOSSAS_7, internalUser);
+ service.createApplication(applicationName, ICartridge.JBOSSAS_7, user);
+ service.destroyApplication(applicationName, ICartridge.JBOSSAS_7, user);
}
@Test(expected = OpenshiftException.class)
public void createDuplicateApplicationThrowsException() throws Exception {
String applicationName = ApplicationUtils.createRandomApplicationName();
try {
- service.createApplication(applicationName, ICartridge.JBOSSAS_7, internalUser);
- service.createApplication(applicationName, ICartridge.JBOSSAS_7, internalUser);
+ service.createApplication(applicationName, ICartridge.JBOSSAS_7, user);
+ service.createApplication(applicationName, ICartridge.JBOSSAS_7, user);
} finally {
- ApplicationUtils.silentlyDestroyAS7Application(applicationName, internalUser, service);
+ ApplicationUtils.silentlyDestroyAS7Application(applicationName, user, service);
}
}
@@ -86,10 +86,10 @@
public void canStopApplication() throws Exception {
String applicationName = ApplicationUtils.createRandomApplicationName();
try {
- service.createApplication(applicationName, ICartridge.JBOSSAS_7, internalUser);
- service.stopApplication(applicationName, ICartridge.JBOSSAS_7, internalUser);
+ service.createApplication(applicationName, ICartridge.JBOSSAS_7, user);
+ service.stopApplication(applicationName, ICartridge.JBOSSAS_7, user);
} finally {
- ApplicationUtils.silentlyDestroyAS7Application(applicationName, internalUser, service);
+ ApplicationUtils.silentlyDestroyAS7Application(applicationName, user, service);
}
}
@@ -97,11 +97,11 @@
public void canStartStoppedApplication() throws Exception {
String applicationName = ApplicationUtils.createRandomApplicationName();
try {
- service.createApplication(applicationName, ICartridge.JBOSSAS_7, internalUser);
- service.stopApplication(applicationName, ICartridge.JBOSSAS_7, internalUser);
- service.startApplication(applicationName, ICartridge.JBOSSAS_7, internalUser);
+ service.createApplication(applicationName, ICartridge.JBOSSAS_7, user);
+ service.stopApplication(applicationName, ICartridge.JBOSSAS_7, user);
+ service.startApplication(applicationName, ICartridge.JBOSSAS_7, user);
} finally {
- ApplicationUtils.silentlyDestroyAS7Application(applicationName, internalUser, service);
+ ApplicationUtils.silentlyDestroyAS7Application(applicationName, user, service);
}
}
@@ -116,10 +116,10 @@
* https://github.com/openshift/os-client-tools/blob/master/express
* /doc/API
*/
- service.createApplication(applicationName, ICartridge.JBOSSAS_7, internalUser);
- service.startApplication(applicationName, ICartridge.JBOSSAS_7, internalUser);
+ service.createApplication(applicationName, ICartridge.JBOSSAS_7, user);
+ service.startApplication(applicationName, ICartridge.JBOSSAS_7, user);
} finally {
- ApplicationUtils.silentlyDestroyAS7Application(applicationName, internalUser, service);
+ ApplicationUtils.silentlyDestroyAS7Application(applicationName, user, service);
}
}
@@ -134,11 +134,11 @@
* https://github.com/openshift/os-client-tools/blob/master/express
* /doc/API
*/
- service.createApplication(applicationName, ICartridge.JBOSSAS_7, internalUser);
- service.stopApplication(applicationName, ICartridge.JBOSSAS_7, internalUser);
- service.stopApplication(applicationName, ICartridge.JBOSSAS_7, internalUser);
+ service.createApplication(applicationName, ICartridge.JBOSSAS_7, user);
+ service.stopApplication(applicationName, ICartridge.JBOSSAS_7, user);
+ service.stopApplication(applicationName, ICartridge.JBOSSAS_7, user);
} finally {
- ApplicationUtils.silentlyDestroyAS7Application(applicationName, internalUser, service);
+ ApplicationUtils.silentlyDestroyAS7Application(applicationName, user, service);
}
}
@@ -153,10 +153,10 @@
* https://github.com/openshift/os-client-tools/blob/master/express
* /doc/API
*/
- service.createApplication(applicationName, ICartridge.JBOSSAS_7, internalUser);
- service.restartApplication(applicationName, ICartridge.JBOSSAS_7, internalUser);
+ service.createApplication(applicationName, ICartridge.JBOSSAS_7, user);
+ service.restartApplication(applicationName, ICartridge.JBOSSAS_7, user);
} finally {
- ApplicationUtils.silentlyDestroyAS7Application(applicationName, internalUser, service);
+ ApplicationUtils.silentlyDestroyAS7Application(applicationName, user, service);
}
}
@@ -164,11 +164,11 @@
public void canGetStatus() throws Exception {
String applicationName = ApplicationUtils.createRandomApplicationName();
try {
- Application application = service.createApplication(applicationName, ICartridge.JBOSSAS_7, internalUser);
- String applicationStatus = service.getStatus(application.getName(), application.getCartridge(), internalUser);
+ Application application = service.createApplication(applicationName, ICartridge.JBOSSAS_7, user);
+ String applicationStatus = service.getStatus(application.getName(), application.getCartridge(), user);
assertNotNull(applicationStatus);
} finally {
- ApplicationUtils.silentlyDestroyAS7Application(applicationName, internalUser, service);
+ ApplicationUtils.silentlyDestroyAS7Application(applicationName, user, service);
}
}
@@ -176,12 +176,12 @@
public void returnsValidGitUri() throws Exception {
String applicationName = ApplicationUtils.createRandomApplicationName();
try {
- IApplication application = service.createApplication(applicationName, ICartridge.JBOSSAS_7, internalUser);
+ IApplication application = service.createApplication(applicationName, ICartridge.JBOSSAS_7, user);
String gitUri = application.getGitUri();
assertNotNull(gitUri);
assertGitUri(applicationName, gitUri);
} finally {
- ApplicationUtils.silentlyDestroyAS7Application(applicationName, internalUser, service);
+ ApplicationUtils.silentlyDestroyAS7Application(applicationName, user, service);
}
}
@@ -189,12 +189,12 @@
public void returnsValidApplicationUrl() throws Exception {
String applicationName = ApplicationUtils.createRandomApplicationName();
try {
- IApplication application = service.createApplication(applicationName, ICartridge.JBOSSAS_7, internalUser);
+ IApplication application = service.createApplication(applicationName, ICartridge.JBOSSAS_7, user);
String applicationUrl = application.getApplicationUrl();
assertNotNull(applicationUrl);
assertAppliactionUrl(applicationName, applicationUrl);
} finally {
- ApplicationUtils.silentlyDestroyAS7Application(applicationName, internalUser, service);
+ ApplicationUtils.silentlyDestroyAS7Application(applicationName, user, service);
}
}
}
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-27 15:42:35 UTC (rev 35067)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/ApplicationTest.java 2011-09-27 15:52:59 UTC (rev 35068)
@@ -46,7 +46,7 @@
*/
public class ApplicationTest {
- private InternalUser internalUser = new InternalUser(ApplicationResponseFake.RHLOGIN, ApplicationResponseFake.PASSWORD,
+ private InternalUser user = new InternalUser(ApplicationResponseFake.RHLOGIN, ApplicationResponseFake.PASSWORD,
new NoopOpenshiftServiceFake());
@Test
@@ -106,7 +106,7 @@
OpenshiftResponse<Application> openshiftResponse =
new ApplicationResponseUnmarshaller(
ApplicationResponseFake.APPLICATION_NAME, ApplicationResponseFake.APPLICATION_CARTRIDGE,
- internalUser, new NoopOpenshiftServiceFake())
+ user, new NoopOpenshiftServiceFake())
.unmarshall(response);
Application application = openshiftResponse.getOpenshiftObject();
assertNotNull(application);
@@ -117,8 +117,8 @@
@Test
public void returnsValidGitUri() throws OpenshiftException {
OpenshiftService userInfoService = createUserInfoService();
- InternalUser internalUser = createUser(userInfoService);
- IApplication application = createApplication(userInfoService, internalUser);
+ InternalUser user = createUser(userInfoService);
+ IApplication application = createApplication(userInfoService, user);
String gitUri = application.getGitUri();
assertNotNull(gitUri);
@@ -133,8 +133,8 @@
@Test
public void returnsValidApplicationUrl() throws OpenshiftException {
OpenshiftService userInfoService = createUserInfoService();
- InternalUser internalUser = createUser(userInfoService);
- IApplication application = createApplication(userInfoService, internalUser);
+ InternalUser user = createUser(userInfoService);
+ IApplication application = createApplication(userInfoService, user);
String applicationUrl = application.getApplicationUrl();
assertNotNull(applicationUrl);
@@ -160,15 +160,15 @@
OpenshiftService service = new NoopOpenshiftServiceFake() {
@Override
- public String getStatus(String applicationName, ICartridge cartridge, InternalUser internalUser) throws OpenshiftException {
+ public String getStatus(String applicationName, ICartridge cartridge, InternalUser user) throws OpenshiftException {
return ApplicationResponseFake.tail;
}
};
Application application =
new Application(ApplicationResponseFake.APPLICATION_NAME,
- ApplicationResponseFake.APPLICATION_CARTRIDGE, internalUser, service);
- ApplicationLogReader reader = new ApplicationLogReader(application, internalUser, service);
+ ApplicationResponseFake.APPLICATION_CARTRIDGE, user, service);
+ ApplicationLogReader reader = new ApplicationLogReader(application, user, service);
int charactersRead = 0;
int character = -1;
@@ -183,7 +183,7 @@
}
}
- private IApplication createApplication(OpenshiftService userInfoService, InternalUser internalUser) {
+ private IApplication createApplication(OpenshiftService userInfoService, InternalUser user) {
Application application = new Application(
ApplicationResponseFake.APPLICATION_NAME
, ApplicationResponseFake.APPLICATION_CARTRIDGE
@@ -193,27 +193,26 @@
, ApplicationResponseFake.APPLICATION_EMBEDDED
, ApplicationResponseFake.APPLICATION_CARTRIDGE
, ApplicationResponseFake.APPLICATION_CREATIONTIME)
- , internalUser
+ , user
, userInfoService);
/**
* we have to add it manually since we dont create the application with
- * the internalUser class
+ * the user class
*
- * @see InternalUser#createApplication
+ * @see user#createApplication
*/
- internalUser.add(application);
+ user.add(application);
return application;
}
private InternalUser createUser(OpenshiftService userInfoService) {
- InternalUser internalUser = new InternalUser(ApplicationResponseFake.RHLOGIN, ApplicationResponseFake.PASSWORD, userInfoService);
- return internalUser;
+ return new InternalUser(ApplicationResponseFake.RHLOGIN, ApplicationResponseFake.PASSWORD, userInfoService);
}
private OpenshiftService createUserInfoService() {
OpenshiftService userInfoService = new NoopOpenshiftServiceFake() {
@Override
- public UserInfo getUserInfo(InternalUser internalUser) throws OpenshiftException {
+ public UserInfo getUserInfo(InternalUser user) throws OpenshiftException {
ApplicationInfo applicationInfo = new ApplicationInfo(
ApplicationResponseFake.APPLICATION_NAME,
ApplicationResponseFake.APPLICATION_UUID,
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-27 15:42:35 UTC (rev 35067)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/CartridgesIntegrationTest.java 2011-09-27 15:52:59 UTC (rev 35068)
@@ -30,18 +30,18 @@
private OpenshiftService openshiftService;
- private InternalUser internalUser;
+ private InternalUser user;
@Before
public void setUp() {
this.openshiftService = new OpenshiftService();
- this.internalUser = new TestUser();
+ this.user = new TestUser();
}
@Ignore
@Test
public void canRequestListCartridges() throws Exception {
- List<ICartridge> cartridges = openshiftService.getCartridges(internalUser);
+ List<ICartridge> cartridges = openshiftService.getCartridges(user);
assertNotNull(cartridges);
assertTrue(cartridges.size() > 0);
}
Modified: trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/DomainTest.java
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/DomainTest.java 2011-09-27 15:42:35 UTC (rev 35067)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/DomainTest.java 2011-09-27 15:52:59 UTC (rev 35068)
@@ -62,8 +62,8 @@
String responseString = createDomainResponseString(RHLOGIN, UUID);
responseString = JsonSanitizer.sanitize(responseString);
- InternalUser internalUser = new InternalUser(RHLOGIN, PASSWORD, new NoopOpenshiftServiceFake());
- OpenshiftResponse<IDomain> response = new DomainResponseUnmarshaller(domainName, internalUser).unmarshall(responseString);
+ InternalUser user = new InternalUser(RHLOGIN, PASSWORD, new NoopOpenshiftServiceFake());
+ OpenshiftResponse<IDomain> response = new DomainResponseUnmarshaller(domainName, user).unmarshall(responseString);
assertNotNull(response);
IDomain domain = response.getOpenshiftObject();
Modified: trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/UserTest.java
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/UserTest.java 2011-09-27 15:42:35 UTC (rev 35067)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/UserTest.java 2011-09-27 15:52:59 UTC (rev 35068)
@@ -45,30 +45,30 @@
public class UserTest {
private OpenshiftService userInfoservice;
- private InternalUser internalUser;
+ private InternalUser user;
@Before
public void setUp() throws OpenshiftException, DatatypeConfigurationException {
UserInfo userInfo = createUserInfo();
this.userInfoservice = createUserInfoService(userInfo);
- this.internalUser = new InternalUser(UserInfoResponseFake.RHLOGIN, UserInfoResponseFake.PASSWORD, userInfoservice);
+ this.user = new InternalUser(UserInfoResponseFake.RHLOGIN, UserInfoResponseFake.PASSWORD, userInfoservice);
}
@Test
public void canGetUserUUID() throws OpenshiftException {
- assertEquals(UserInfoResponseFake.UUID, internalUser.getUUID());
+ assertEquals(UserInfoResponseFake.UUID, user.getUUID());
}
@Test
public void canGetPublicKey() throws OpenshiftException {
- ISSHPublicKey key = internalUser.getSshKey();
+ ISSHPublicKey key = user.getSshKey();
assertNotNull(key);
assertEquals(UserInfoResponseFake.SSH_KEY, key.getPublicKey());
}
@Test
public void canGetDomain() throws OpenshiftException {
- IDomain domain = internalUser.getDomain();
+ IDomain domain = user.getDomain();
assertNotNull(domain);
assertEquals(UserInfoResponseFake.RHC_DOMAIN, domain.getRhcDomain());
assertEquals(UserInfoResponseFake.NAMESPACE, domain.getNamespace());
@@ -79,7 +79,7 @@
OpenshiftService cartridgeListService = new NoopOpenshiftServiceFake() {
@Override
- public List<ICartridge> getCartridges(InternalUser internalUser) throws OpenshiftException {
+ public List<ICartridge> getCartridges(InternalUser user) throws OpenshiftException {
ArrayList<ICartridge> cartridges = new ArrayList<ICartridge>();
cartridges.add(new Cartridge(CartridgeResponseFake.CARTRIDGE_JBOSSAS70));
cartridges.add(new Cartridge(CartridgeResponseFake.CARTRIDGE_PERL5));
@@ -89,8 +89,8 @@
return cartridges;
}
};
- InternalUser internalUser = new InternalUser(UserInfoResponseFake.RHLOGIN, UserInfoResponseFake.PASSWORD, cartridgeListService);
- Collection<ICartridge> cartridges = internalUser.getCartridges();
+ InternalUser user = new InternalUser(UserInfoResponseFake.RHLOGIN, UserInfoResponseFake.PASSWORD, cartridgeListService);
+ Collection<ICartridge> cartridges = user.getCartridges();
assertNotNull(cartridges);
assertEquals(5, cartridges.size());
assertThatContainsCartridge(CartridgeResponseFake.CARTRIDGE_JBOSSAS70, cartridges);
@@ -103,14 +103,14 @@
@Test
public void canGetApplications() throws OpenshiftException {
/** response is UserInfoResponseFake */
- Collection<IApplication> applications = internalUser.getApplications();
+ Collection<IApplication> applications = user.getApplications();
assertNotNull(applications);
assertEquals(2, applications.size());
}
@Test
public void canGetApplicationByName() throws OpenshiftException, DatatypeConfigurationException {
- IApplication application = internalUser.getApplicationByName(UserInfoResponseFake.APP2_NAME);
+ IApplication application = user.getApplicationByName(UserInfoResponseFake.APP2_NAME);
assertApplication(
UserInfoResponseFake.APP2_NAME
, UserInfoResponseFake.APP2_UUID
@@ -146,7 +146,7 @@
return new NoopOpenshiftServiceFake() {
@Override
- public UserInfo getUserInfo(InternalUser internalUser) throws OpenshiftException {
+ public UserInfo getUserInfo(InternalUser user) throws OpenshiftException {
return userInfo;
}
};
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-27 15:42:35 UTC (rev 35067)
+++ 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-27 15:52:59 UTC (rev 35068)
@@ -28,52 +28,52 @@
public class NoopOpenshiftServiceFake extends OpenshiftService {
@Override
- public UserInfo getUserInfo(InternalUser internalUser) throws OpenshiftException {
+ public UserInfo getUserInfo(InternalUser user) throws OpenshiftException {
throw new UnsupportedOperationException();
}
@Override
- public List<ICartridge> getCartridges(InternalUser internalUser) throws OpenshiftException {
+ public List<ICartridge> getCartridges(InternalUser user) throws OpenshiftException {
throw new UnsupportedOperationException();
}
@Override
- public Application createApplication(String name, ICartridge cartridge, InternalUser internalUser) throws OpenshiftException {
+ public Application createApplication(String name, ICartridge cartridge, InternalUser user) throws OpenshiftException {
throw new UnsupportedOperationException();
}
@Override
- public void destroyApplication(String name, ICartridge cartridge, InternalUser internalUser) throws OpenshiftException {
+ public void destroyApplication(String name, ICartridge cartridge, InternalUser user) throws OpenshiftException {
throw new UnsupportedOperationException();
}
@Override
- public IApplication startApplication(String name, ICartridge cartridge, InternalUser internalUser) throws OpenshiftException {
+ public IApplication startApplication(String name, ICartridge cartridge, InternalUser user) throws OpenshiftException {
throw new UnsupportedOperationException();
}
@Override
- public IApplication restartApplication(String name, ICartridge cartridge, InternalUser internalUser) throws OpenshiftException {
+ public IApplication restartApplication(String name, ICartridge cartridge, InternalUser user) throws OpenshiftException {
throw new UnsupportedOperationException();
}
@Override
- public IApplication stopApplication(String name, ICartridge cartridge, InternalUser internalUser) throws OpenshiftException {
+ public IApplication stopApplication(String name, ICartridge cartridge, InternalUser user) throws OpenshiftException {
throw new UnsupportedOperationException();
}
@Override
- public String getStatus(String applicationName, ICartridge cartridge, InternalUser internalUser) throws OpenshiftException {
+ public String getStatus(String applicationName, ICartridge cartridge, InternalUser user) throws OpenshiftException {
throw new UnsupportedOperationException();
}
@Override
- public IDomain changeDomain(String domainName, ISSHPublicKey sshKey, InternalUser internalUser) throws OpenshiftException {
+ public IDomain changeDomain(String domainName, ISSHPublicKey sshKey, InternalUser user) throws OpenshiftException {
throw new UnsupportedOperationException();
}
@Override
- public IDomain createDomain(String name, ISSHPublicKey keyPair, InternalUser internalUser) throws OpenshiftException {
+ public IDomain createDomain(String name, ISSHPublicKey keyPair, InternalUser user) 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/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-09-27 15:42:35 UTC (rev 35067)
+++ 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-27 15:52:59 UTC (rev 35068)
@@ -13,13 +13,13 @@
import org.jboss.ide.eclipse.as.openshift.core.Cartridge;
import org.jboss.ide.eclipse.as.openshift.core.IApplication;
import org.jboss.ide.eclipse.as.openshift.core.OpenshiftException;
-import org.jboss.ide.eclipse.as.openshift.core.internal.InternalUser;
+import org.jboss.ide.eclipse.as.openshift.core.User;
import org.jboss.ide.eclipse.as.openshift.test.internal.core.utils.ApplicationUtils;
/**
* @author André Dietisheim
*/
-public class TestUser extends InternalUser {
+public class TestUser extends User {
private static final String RHLOGIN = "toolsjboss(a)gmail.com";
private static final String PASSWORD = "1q2w3e";
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-27 15:42:35 UTC (rev 35067)
+++ 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-27 15:52:59 UTC (rev 35068)
@@ -35,7 +35,7 @@
/**
* $1 = application uuid
* $2 = application name
- * $3 = user uuid
+ * $3 = InternalUser uuid
* $4 = rhc cloud domain (rhcloud.com)
* $5 = application name
*/
Modified: 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 2011-09-27 15:42:35 UTC (rev 35067)
+++ 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-27 15:52:59 UTC (rev 35068)
@@ -26,13 +26,13 @@
return String.valueOf(System.currentTimeMillis());
}
- public static Application createApplication(InternalUser internalUser, IOpenshiftService service) throws OpenshiftException {
- return service.createApplication(createRandomApplicationName(), Cartridge.JBOSSAS_7, internalUser);
+ public static Application createApplication(InternalUser user, IOpenshiftService service) throws OpenshiftException {
+ return service.createApplication(createRandomApplicationName(), Cartridge.JBOSSAS_7, user);
}
- public static void silentlyDestroyAS7Application(String name, InternalUser internalUser, IOpenshiftService service) {
+ public static void silentlyDestroyAS7Application(String name, InternalUser user, IOpenshiftService service) {
try {
- service.destroyApplication(name, ICartridge.JBOSSAS_7, internalUser);
+ service.destroyApplication(name, ICartridge.JBOSSAS_7, user);
} catch (OpenshiftException e) {
e.printStackTrace();
}
14 years, 2 months
JBoss Tools SVN: r35067 - trunk/central/tests.
by jbosstools-commits@lists.jboss.org
Author: nickboldt
Date: 2011-09-27 11:42:35 -0400 (Tue, 27 Sep 2011)
New Revision: 35067
Added:
trunk/central/tests/pom.xml
Log:
add empty pom.xml to tests folder to allow building in Hudson
Added: trunk/central/tests/pom.xml
===================================================================
--- trunk/central/tests/pom.xml (rev 0)
+++ trunk/central/tests/pom.xml 2011-09-27 15:42:35 UTC (rev 35067)
@@ -0,0 +1,18 @@
+<project
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
+ xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.jboss.tools</groupId>
+ <artifactId>central</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ </parent>
+ <groupId>org.jboss.tools.central</groupId>
+ <artifactId>tests</artifactId>
+ <name>central.tests</name>
+ <packaging>pom</packaging>
+ <modules>
+ <!-- TODO: add test modules here -->
+ </modules>
+</project>
+
14 years, 2 months
JBoss Tools SVN: r35066 - in trunk/as: plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal and 4 other directories.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-09-27 11:40:34 -0400 (Tue, 27 Sep 2011)
New Revision: 35066
Added:
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/InternalUser.java
Removed:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/UserFactory.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/User.java
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/ApplicationLogReader.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/Domain.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/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/UserInfoAware.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/unmarshalling/ApplicationResponseUnmarshaller.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/unmarshalling/DomainResponseUnmarshaller.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/DomainTest.java
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/UserTest.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/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
Log:
[JBIDE-9773] hiding User implementation from user programmer
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/ApplicationLogReader.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/ApplicationLogReader.java 2011-09-27 15:39:43 UTC (rev 35065)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/ApplicationLogReader.java 2011-09-27 15:40:34 UTC (rev 35066)
@@ -18,7 +18,7 @@
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;
+import org.jboss.ide.eclipse.as.openshift.core.internal.InternalUser;
/**
* @author André Dietisheim
@@ -32,12 +32,12 @@
private IOpenshiftService service;
private StringReader logReader;
private Application application;
- private User user;
+ private InternalUser internalUser;
private String currentStatus;
- public ApplicationLogReader(Application application, User user, IOpenshiftService service) {
+ public ApplicationLogReader(Application application, InternalUser internalUser, IOpenshiftService service) {
this.application = application;
- this.user = user;
+ this.internalUser = internalUser;
this.service = service;
}
@@ -91,7 +91,7 @@
protected String requestStatus() throws IOException {
try {
- String status = service.getStatus(application.getName(), application.getCartridge(), user);
+ String status = service.getStatus(application.getName(), application.getCartridge(), internalUser);
if (isSameStatus(status, currentStatus)) {
status = null;
}
Added: 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 (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/User.java 2011-09-27 15:40:34 UTC (rev 35066)
@@ -0,0 +1,10 @@
+package org.jboss.ide.eclipse.as.openshift.core;
+
+import org.jboss.ide.eclipse.as.openshift.core.internal.InternalUser;
+
+public class User extends InternalUser {
+
+ public User(String rhlogin, String password) {
+ super(rhlogin, password);
+ }
+}
Property changes on: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/User.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/UserFactory.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/UserFactory.java 2011-09-27 15:39:43 UTC (rev 35065)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/UserFactory.java 2011-09-27 15:40:34 UTC (rev 35066)
@@ -1,11 +0,0 @@
-package org.jboss.ide.eclipse.as.openshift.core;
-
-import org.jboss.ide.eclipse.as.openshift.core.internal.User;
-
-public class UserFactory {
-
- public static IUser create(String rhlogin, String password) {
- return new User(rhlogin, password);
- }
-
-}
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-27 15:39:43 UTC (rev 35065)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/Application.java 2011-09-27 15:40:34 UTC (rev 35066)
@@ -32,13 +32,13 @@
private ApplicationLogReader logReader;
private ApplicationInfo applicationInfo;
- public Application(String name, ICartridge cartridge, User user, IOpenshiftService service) {
- this(name, cartridge, null, user, service);
+ public Application(String name, ICartridge cartridge, InternalUser internalUser, IOpenshiftService service) {
+ this(name, cartridge, null, internalUser, service);
}
- public Application(String name, ICartridge cartridge, ApplicationInfo applicationInfo, User user,
+ public Application(String name, ICartridge cartridge, ApplicationInfo applicationInfo, InternalUser internalUser,
IOpenshiftService service) {
- super(user);
+ super(internalUser);
this.name = name;
this.cartridge = cartridge;
this.service = service;
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/Domain.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/Domain.java 2011-09-27 15:39:43 UTC (rev 35065)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/Domain.java 2011-09-27 15:40:34 UTC (rev 35066)
@@ -20,12 +20,12 @@
private String namespace;
- public Domain(String namespace, User user) {
- this(namespace, null, user);
+ public Domain(String namespace, InternalUser internalUser) {
+ this(namespace, null, internalUser);
}
- public Domain(String namespace, String rhcDomain, User user) {
- super(user);
+ public Domain(String namespace, String rhcDomain, InternalUser internalUser) {
+ super(internalUser);
this.namespace = namespace;
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/IOpenshiftService.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/IOpenshiftService.java 2011-09-27 15:39:43 UTC (rev 35065)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/IOpenshiftService.java 2011-09-27 15:40:34 UTC (rev 35066)
@@ -22,23 +22,23 @@
*/
public interface IOpenshiftService {
- public List<ICartridge> getCartridges(User user) throws OpenshiftException;
+ public List<ICartridge> getCartridges(InternalUser internalUser) throws OpenshiftException;
- public Application createApplication(String name, ICartridge cartridge, User user) throws OpenshiftException;
+ public Application createApplication(String name, ICartridge cartridge, InternalUser internalUser) throws OpenshiftException;
- public void destroyApplication(String name, ICartridge cartridge, User user) throws OpenshiftException;
+ public void destroyApplication(String name, ICartridge cartridge, InternalUser internalUser) throws OpenshiftException;
- public IApplication startApplication(String name, ICartridge cartridge, User user) throws OpenshiftException;
+ public IApplication startApplication(String name, ICartridge cartridge, InternalUser internalUser) throws OpenshiftException;
- public IApplication restartApplication(String name, ICartridge cartridge, User user) throws OpenshiftException;
+ public IApplication restartApplication(String name, ICartridge cartridge, InternalUser internalUser) throws OpenshiftException;
- public IApplication stopApplication(String name, ICartridge cartridge, User user) throws OpenshiftException;
+ public IApplication stopApplication(String name, ICartridge cartridge, InternalUser internalUser) throws OpenshiftException;
- public String getStatus(String name, ICartridge cartridge, User user) throws OpenshiftException;
+ public String getStatus(String name, ICartridge cartridge, InternalUser internalUser) throws OpenshiftException;
- public IDomain changeDomain(String name, ISSHPublicKey sshKey, User user) throws OpenshiftException;
+ public IDomain changeDomain(String name, ISSHPublicKey sshKey, InternalUser internalUser) throws OpenshiftException;
- public IDomain createDomain(String name, ISSHPublicKey sshKey, User user) throws OpenshiftException;
+ public IDomain createDomain(String name, ISSHPublicKey sshKey, InternalUser internalUser) throws OpenshiftException;
- public UserInfo getUserInfo(User user) throws OpenshiftException;
+ public UserInfo getUserInfo(InternalUser internalUser) throws OpenshiftException;
}
Copied: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/InternalUser.java (from rev 35062, 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/InternalUser.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/InternalUser.java 2011-09-27 15:40:34 UTC (rev 35066)
@@ -0,0 +1,161 @@
+/*******************************************************************************
+ * 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;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+
+import org.jboss.ide.eclipse.as.openshift.core.IApplication;
+import org.jboss.ide.eclipse.as.openshift.core.ICartridge;
+import org.jboss.ide.eclipse.as.openshift.core.ISSHPublicKey;
+import org.jboss.ide.eclipse.as.openshift.core.IUser;
+import org.jboss.ide.eclipse.as.openshift.core.OpenshiftException;
+
+/**
+ * @author André Dietisheim
+ */
+public class InternalUser implements IUser {
+
+ private String rhlogin;
+ private String password;
+ private ISSHPublicKey sshKey;
+ private Domain domain;
+ private UserInfo userInfo;
+ private List<ICartridge> cartridges;
+ private List<IApplication> applications = new ArrayList<IApplication>();
+
+ private IOpenshiftService service;
+
+ public InternalUser(String rhlogin, String password) {
+ this(rhlogin, password, (ISSHPublicKey) null, new OpenshiftService());
+ }
+
+ public InternalUser(String rhlogin, String password, IOpenshiftService service) {
+ this(rhlogin, password, (ISSHPublicKey) null, service);
+ }
+
+ public InternalUser(String rhlogin, String password, ISSHPublicKey sshKey, IOpenshiftService service) {
+ this.rhlogin = rhlogin;
+ this.password = password;
+ this.sshKey = sshKey;
+ this.service = service;
+ }
+
+ public IDomain getDomain() throws OpenshiftException {
+ if (domain == null) {
+ this.domain = new Domain(
+ getUserInfo().getNamespace()
+ , getUserInfo().getRhcDomain(), this);
+ }
+ return domain;
+ }
+
+ public ISSHPublicKey getSshKey() throws OpenshiftException {
+ if (sshKey == null) {
+ sshKey = getUserInfo().getSshPublicKey();
+ }
+ return sshKey;
+ }
+
+ public String getRhlogin() {
+ return rhlogin;
+ }
+
+ public String getPassword() {
+ return password;
+ }
+
+ public String getUUID() throws OpenshiftException {
+ return getUserInfo().getUuid();
+ }
+
+ public List<ICartridge> getCartridges() throws OpenshiftException {
+ if (cartridges == null) {
+ this.cartridges = service.getCartridges(this);
+ }
+ return Collections.unmodifiableList(cartridges);
+ }
+
+ public IApplication createApplication(String name, ICartridge cartridge) throws OpenshiftException {
+ Application application = service.createApplication(name, cartridge, this);
+ add(application);
+ return application;
+ }
+
+ public Collection<IApplication> getApplications() throws OpenshiftException {
+ if (getUserInfo().getApplicationInfos().size() > applications.size()) {
+ update(getUserInfo().getApplicationInfos());
+ }
+ return Collections.unmodifiableList(applications);
+ }
+
+ public IApplication getApplicationByName(String name) throws OpenshiftException {
+ return getApplicationByName(name, getApplications());
+ }
+
+ private IApplication getApplicationByName(String name, Collection<IApplication> applications) {
+ IApplication matchingApplication = null;
+ for (IApplication application : applications) {
+ if (name.equals(application.getName())) {
+ matchingApplication = application;
+ }
+ }
+ return matchingApplication;
+ }
+
+ public void add(Application application) {
+ applications.add(application);
+ }
+
+ public void remove(IApplication application) {
+ applications.remove(application);
+ }
+
+ public void setSshPublicKey(ISSHPublicKey key) {
+ this.sshKey = key;
+ }
+
+ protected UserInfo getUserInfo() throws OpenshiftException {
+ if (userInfo == null) {
+ this.userInfo = service.getUserInfo(this);
+ }
+ return userInfo;
+ }
+
+ public void refresh() throws OpenshiftException {
+ this.domain = null;
+ this.sshKey = null;
+ getUserInfo();
+ }
+
+ private void update(List<ApplicationInfo> applicationInfos) {
+ for (ApplicationInfo applicationInfo : applicationInfos) {
+ IApplication application = getApplicationByName(applicationInfo.getName(), applications);
+ if (application == null) {
+ applications.add(createApplication(applicationInfo));
+ }
+ }
+ }
+
+ private Application createApplication(ApplicationInfo applicationInfo) {
+ return new Application(applicationInfo.getName()
+ , applicationInfo.getCartridge()
+ , applicationInfo
+ , this, service);
+ }
+
+ protected IOpenshiftService getService() {
+ return service;
+ }
+
+}
Property changes on: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/InternalUser.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/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-27 15:39:43 UTC (rev 35065)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/OpenshiftService.java 2011-09-27 15:40:34 UTC (rev 35066)
@@ -52,12 +52,12 @@
private static final String BASE_URL = "https://openshift.redhat.com/broker";
@Override
- public UserInfo getUserInfo(User user) throws OpenshiftException {
- UserInfoRequest request = new UserInfoRequest(user.getRhlogin(), true);
+ public UserInfo getUserInfo(InternalUser internalUser) throws OpenshiftException {
+ UserInfoRequest request = new UserInfoRequest(internalUser.getRhlogin(), true);
String url = request.getUrlString(BASE_URL);
try {
String requestString = new UserInfoRequestJsonMarshaller().marshall(request);
- String openShiftRequestString = new OpenshiftEnvelopeFactory(user.getPassword(), requestString)
+ String openShiftRequestString = new OpenshiftEnvelopeFactory(internalUser.getPassword(), requestString)
.createString();
String responseString = createHttpClient(url).post(openShiftRequestString);
responseString = JsonSanitizer.sanitize(responseString);
@@ -66,21 +66,21 @@
return response.getOpenshiftObject();
} catch (MalformedURLException e) {
throw new OpenshiftEndpointException(
- url, e, "Could not get user info for user \"{0}\" at \"{1}\"", user.getRhlogin(), url, e);
+ url, e, "Could not get user info for user \"{0}\" at \"{1}\"", internalUser.getRhlogin(), url, e);
} catch (HttpClientException e) {
throw new OpenshiftEndpointException(
- url, e, "Could not get user info for user \"{0}\" at \"{1}\"", user.getRhlogin(), url, e);
+ url, e, "Could not get user info for user \"{0}\" at \"{1}\"", internalUser.getRhlogin(), url, e);
}
}
@Override
- public List<ICartridge> getCartridges(User user) throws OpenshiftException {
- ListCartridgesRequest listCartridgesRequest = new ListCartridgesRequest(user.getRhlogin(), true);
+ public List<ICartridge> getCartridges(InternalUser internalUser) throws OpenshiftException {
+ ListCartridgesRequest listCartridgesRequest = new ListCartridgesRequest(internalUser.getRhlogin(), true);
String url = listCartridgesRequest.getUrlString(BASE_URL);
try {
String listCartridgesRequestString =
new ListCartridgesRequestJsonMarshaller().marshall(listCartridgesRequest);
- String request = new OpenshiftEnvelopeFactory(user.getPassword(), listCartridgesRequestString)
+ String request = new OpenshiftEnvelopeFactory(internalUser.getPassword(), listCartridgesRequestString)
.createString();
String listCatridgesReponse = createHttpClient(url).post(request);
listCatridgesReponse = JsonSanitizer.sanitize(listCatridgesReponse);
@@ -95,27 +95,27 @@
}
@Override
- public IDomain createDomain(String name, ISSHPublicKey sshKey, User user) throws OpenshiftException {
- return requestDomainAction(new CreateDomainRequest(name, sshKey, user.getRhlogin(), true), user);
+ public IDomain createDomain(String name, ISSHPublicKey sshKey, InternalUser internalUser) throws OpenshiftException {
+ return requestDomainAction(new CreateDomainRequest(name, sshKey, internalUser.getRhlogin(), true), internalUser);
}
@Override
- public IDomain changeDomain(String newName, ISSHPublicKey sshKey, User user) throws OpenshiftException {
- return requestDomainAction(new ChangeDomainRequest(newName, sshKey, user.getRhlogin(), true), user);
+ public IDomain changeDomain(String newName, ISSHPublicKey sshKey, InternalUser internalUser) throws OpenshiftException {
+ return requestDomainAction(new ChangeDomainRequest(newName, sshKey, internalUser.getRhlogin(), true), internalUser);
}
- protected IDomain requestDomainAction(AbstractDomainRequest request, User user) throws OpenshiftException {
+ protected IDomain requestDomainAction(AbstractDomainRequest request, InternalUser internalUser) throws OpenshiftException {
String url = request.getUrlString(BASE_URL);
try {
String requestString =
new OpenshiftEnvelopeFactory(
- user.getPassword(),
+ internalUser.getPassword(),
new DomainRequestJsonMarshaller().marshall(request))
.createString();
String responseString = createHttpClient(url).post(requestString);
responseString = JsonSanitizer.sanitize(responseString);
OpenshiftResponse<IDomain> response =
- new DomainResponseUnmarshaller(request.getName(), user).unmarshall(responseString);
+ new DomainResponseUnmarshaller(request.getName(), internalUser).unmarshall(responseString);
return response.getOpenshiftObject();
} catch (MalformedURLException e) {
throw new OpenshiftEndpointException(url, e, "Could not list available cartridges at \"{0}\"", url);
@@ -125,35 +125,35 @@
}
@Override
- public Application createApplication(String name, ICartridge cartridge, User user) throws OpenshiftException {
+ public Application createApplication(String name, ICartridge cartridge, InternalUser internalUser) throws OpenshiftException {
Application application = requestApplicationAction(new ApplicationRequest(name, cartridge, ApplicationAction.CONFIGURE,
- user.getRhlogin(), true), user);
+ internalUser.getRhlogin(), true), internalUser);
return application;
}
@Override
- public void destroyApplication(String name, ICartridge cartridge, User user) throws OpenshiftException {
+ public void destroyApplication(String name, ICartridge cartridge, InternalUser internalUser) throws OpenshiftException {
IApplication application = requestApplicationAction(new ApplicationRequest(name, cartridge, ApplicationAction.DECONFIGURE,
- user.getRhlogin(), true), user);
- user.remove(application);
+ internalUser.getRhlogin(), true), internalUser);
+ internalUser.remove(application);
}
@Override
- public IApplication startApplication(String name, ICartridge cartridge, User user) throws OpenshiftException {
+ public IApplication startApplication(String name, ICartridge cartridge, InternalUser internalUser) throws OpenshiftException {
return requestApplicationAction(new ApplicationRequest(name, cartridge, ApplicationAction.START,
- user.getRhlogin(), true), user);
+ internalUser.getRhlogin(), true), internalUser);
}
@Override
- public IApplication restartApplication(String name, ICartridge cartridge, User user) throws OpenshiftException {
+ public IApplication restartApplication(String name, ICartridge cartridge, InternalUser internalUser) throws OpenshiftException {
return requestApplicationAction(new ApplicationRequest(name, cartridge, ApplicationAction.RESTART,
- user.getRhlogin(), true), user);
+ internalUser.getRhlogin(), true), internalUser);
}
@Override
- public IApplication stopApplication(String name, ICartridge cartridge, User user) throws OpenshiftException {
+ public IApplication stopApplication(String name, ICartridge cartridge, InternalUser internalUser) throws OpenshiftException {
return requestApplicationAction(new ApplicationRequest(name, cartridge, ApplicationAction.STOP,
- user.getRhlogin(), true), user);
+ internalUser.getRhlogin(), true), internalUser);
}
/**
@@ -168,14 +168,14 @@
* ,"app_name","api"],"exit_code":0}
*/
@Override
- public String getStatus(String applicationName, ICartridge cartridge, User user) throws OpenshiftException {
+ public String getStatus(String applicationName, ICartridge cartridge, InternalUser internalUser) throws OpenshiftException {
ApplicationRequest applicationRequest =
- new ApplicationRequest(applicationName, cartridge, ApplicationAction.STATUS, user.getRhlogin(), true);
+ new ApplicationRequest(applicationName, cartridge, ApplicationAction.STATUS, internalUser.getRhlogin(), true);
String url = applicationRequest.getUrlString(BASE_URL);
try {
String applicationRequestString =
new ApplicationRequestJsonMarshaller().marshall(applicationRequest);
- String request = new OpenshiftEnvelopeFactory(user.getPassword(), applicationRequestString).createString();
+ String request = new OpenshiftEnvelopeFactory(internalUser.getPassword(), applicationRequestString).createString();
String response = createHttpClient(url).post(request);
response = JsonSanitizer.sanitize(response);
@@ -191,7 +191,7 @@
url, e,
"Could not {0} application \"{1}\" at \"{2}\": Invalid credentials user \"{3}\", password \"{4}\"",
applicationRequest.getAction().toHumanReadable(), applicationRequest.getName(), url,
- user.getRhlogin(), user.getPassword());
+ internalUser.getRhlogin(), internalUser.getPassword());
} catch (HttpClientException e) {
throw new OpenshiftEndpointException(
url, e, "Could not {0} application \"{1}\" at \"{2}\"",
@@ -199,19 +199,19 @@
}
}
- protected Application requestApplicationAction(ApplicationRequest applicationRequest, User user)
+ protected Application requestApplicationAction(ApplicationRequest applicationRequest, InternalUser internalUser)
throws OpenshiftException {
String url = applicationRequest.getUrlString(BASE_URL);
try {
String applicationRequestString =
new ApplicationRequestJsonMarshaller().marshall(applicationRequest);
- String request = new OpenshiftEnvelopeFactory(user.getPassword(), applicationRequestString).createString();
+ String request = new OpenshiftEnvelopeFactory(internalUser.getPassword(), applicationRequestString).createString();
String response = createHttpClient(url).post(request);
response = JsonSanitizer.sanitize(response);
OpenshiftResponse<Application> openshiftResponse =
new ApplicationResponseUnmarshaller(applicationRequest.getName(),
- applicationRequest.getCartridge(), user, this).unmarshall(response);
+ applicationRequest.getCartridge(), internalUser, this).unmarshall(response);
return openshiftResponse.getOpenshiftObject();
} catch (MalformedURLException e) {
throw new OpenshiftException(
@@ -222,8 +222,8 @@
url, e,
"Could not {0} application \"{1}\" at \"{2}\": Invalid credentials user \"{3}\", password \"{4}\"",
applicationRequest.getAction().toHumanReadable(), applicationRequest.getName(), url,
- user.getRhlogin(),
- user.getPassword());
+ internalUser.getRhlogin(),
+ internalUser.getPassword());
} catch (HttpClientException e) {
throw new OpenshiftEndpointException(
url, e, "Could not {0} application \"{1}\" at \"{2}\"",
Deleted: 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-27 15:39:43 UTC (rev 35065)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/User.java 2011-09-27 15:40:34 UTC (rev 35066)
@@ -1,169 +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;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-
-import org.jboss.ide.eclipse.as.openshift.core.IApplication;
-import org.jboss.ide.eclipse.as.openshift.core.ICartridge;
-import org.jboss.ide.eclipse.as.openshift.core.ISSHPublicKey;
-import org.jboss.ide.eclipse.as.openshift.core.IUser;
-import org.jboss.ide.eclipse.as.openshift.core.OpenshiftException;
-
-/**
- * @author André Dietisheim
- */
-public class User implements IUser {
-
- private String rhlogin;
- private String password;
- private ISSHPublicKey sshKey;
- private Domain domain;
- private UserInfo userInfo;
- private List<ICartridge> cartridges;
- private List<IApplication> applications = new ArrayList<IApplication>();
-
- private IOpenshiftService service;
-
- public User(String rhlogin, String password) {
- this(rhlogin, password, (ISSHPublicKey) null, new OpenshiftService());
- }
-
- public User(String rhlogin, String password, IOpenshiftService service) {
- this(rhlogin, password, (ISSHPublicKey) null, service);
- }
-
- public User(String rhlogin, String password, ISSHPublicKey sshKey, IOpenshiftService service) {
- this.rhlogin = rhlogin;
- this.password = password;
- this.sshKey = sshKey;
- this.service = service;
- }
-
- @Override
- public IDomain getDomain() throws OpenshiftException {
- if (domain == null) {
- this.domain = new Domain(
- getUserInfo().getNamespace()
- , getUserInfo().getRhcDomain(), this);
- }
- return domain;
- }
-
- @Override
- public ISSHPublicKey getSshKey() throws OpenshiftException {
- if (sshKey == null) {
- sshKey = getUserInfo().getSshPublicKey();
- }
- return sshKey;
- }
-
- @Override
- public String getRhlogin() {
- return rhlogin;
- }
-
- @Override
- public String getPassword() {
- return password;
- }
-
- public String getUUID() throws OpenshiftException {
- return getUserInfo().getUuid();
- }
-
- @Override
- public List<ICartridge> getCartridges() throws OpenshiftException {
- if (cartridges == null) {
- this.cartridges = service.getCartridges(this);
- }
- return Collections.unmodifiableList(cartridges);
- }
-
- @Override
- public IApplication createApplication(String name, ICartridge cartridge) throws OpenshiftException {
- Application application = service.createApplication(name, cartridge, this);
- add(application);
- return application;
- }
-
- @Override
- public Collection<IApplication> getApplications() throws OpenshiftException {
- if (getUserInfo().getApplicationInfos().size() > applications.size()) {
- update(getUserInfo().getApplicationInfos());
- }
- return Collections.unmodifiableList(applications);
- }
-
- @Override
- public IApplication getApplicationByName(String name) throws OpenshiftException {
- return getApplicationByName(name, getApplications());
- }
-
- private IApplication getApplicationByName(String name, Collection<IApplication> applications) {
- IApplication matchingApplication = null;
- for (IApplication application : applications) {
- if (name.equals(application.getName())) {
- matchingApplication = application;
- }
- }
- return matchingApplication;
- }
-
- public void add(Application application) {
- applications.add(application);
- }
-
- public void remove(IApplication application) {
- applications.remove(application);
- }
-
- public void setSshPublicKey(ISSHPublicKey key) {
- this.sshKey = key;
- }
-
- public UserInfo getUserInfo() throws OpenshiftException {
- if (userInfo == null) {
- this.userInfo = service.getUserInfo(this);
- }
- return userInfo;
- }
-
- public void refresh() throws OpenshiftException {
- this.domain = null;
- this.sshKey = null;
- getUserInfo();
- }
-
- private void update(List<ApplicationInfo> applicationInfos) {
- for (ApplicationInfo applicationInfo : applicationInfos) {
- IApplication application = getApplicationByName(applicationInfo.getName(), applications);
- if (application == null) {
- applications.add(createApplication(applicationInfo));
- }
- }
- }
-
- private Application createApplication(ApplicationInfo applicationInfo) {
- return new Application(applicationInfo.getName()
- , applicationInfo.getCartridge()
- , applicationInfo
- , this, service);
- }
-
- protected IOpenshiftService getService() {
- return service;
- }
-
-}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/UserInfoAware.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/UserInfoAware.java 2011-09-27 15:39:43 UTC (rev 35065)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/UserInfoAware.java 2011-09-27 15:40:34 UTC (rev 35066)
@@ -15,21 +15,21 @@
public class UserInfoAware {
private UserInfo userInfo;
- private User user;
+ private InternalUser internalUser;
- protected UserInfoAware(User user) {
- this.user = user;
+ protected UserInfoAware(InternalUser internalUser) {
+ this.internalUser = internalUser;
}
protected UserInfo getUserInfo() throws OpenshiftException {
if (userInfo == null) {
- this.userInfo = user.getUserInfo();
+ this.userInfo = internalUser.getUserInfo();
}
return userInfo;
}
- protected User getUser() {
- return user;
+ protected InternalUser getUser() {
+ return internalUser;
}
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/unmarshalling/ApplicationResponseUnmarshaller.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/unmarshalling/ApplicationResponseUnmarshaller.java 2011-09-27 15:39:43 UTC (rev 35065)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/unmarshalling/ApplicationResponseUnmarshaller.java 2011-09-27 15:40:34 UTC (rev 35066)
@@ -14,27 +14,27 @@
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.OpenshiftService;
-import org.jboss.ide.eclipse.as.openshift.core.internal.User;
+import org.jboss.ide.eclipse.as.openshift.core.internal.InternalUser;
/**
* @author André Dietisheim
*/
public class ApplicationResponseUnmarshaller extends AbstractOpenshiftJsonResponseUnmarshaller<Application> {
- private User user;
+ private InternalUser internalUser;
private String applicationName;
private ICartridge cartridge;
private OpenshiftService service;
- public ApplicationResponseUnmarshaller(String applicationName, ICartridge cartridge, User user, OpenshiftService service) {
+ public ApplicationResponseUnmarshaller(String applicationName, ICartridge cartridge, InternalUser internalUser, OpenshiftService service) {
this.applicationName = applicationName;
this.cartridge = cartridge;
- this.user = user;
+ this.internalUser = internalUser;
this.service = service;
}
@Override
protected Application createOpenshiftObject(ModelNode node) {
- return new Application(applicationName, cartridge, user, service);
+ return new Application(applicationName, cartridge, internalUser, service);
}
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/unmarshalling/DomainResponseUnmarshaller.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/unmarshalling/DomainResponseUnmarshaller.java 2011-09-27 15:39:43 UTC (rev 35065)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/unmarshalling/DomainResponseUnmarshaller.java 2011-09-27 15:40:34 UTC (rev 35066)
@@ -13,7 +13,7 @@
import org.jboss.dmr.ModelNode;
import org.jboss.ide.eclipse.as.openshift.core.internal.Domain;
import org.jboss.ide.eclipse.as.openshift.core.internal.IDomain;
-import org.jboss.ide.eclipse.as.openshift.core.internal.User;
+import org.jboss.ide.eclipse.as.openshift.core.internal.InternalUser;
/**
* @author André Dietisheim
@@ -21,15 +21,15 @@
public class DomainResponseUnmarshaller extends AbstractOpenshiftJsonResponseUnmarshaller<IDomain> {
private String domainName;
- private User user;
+ private InternalUser internalUser;
- public DomainResponseUnmarshaller(String domainName, User user) {
+ public DomainResponseUnmarshaller(String domainName, InternalUser internalUser) {
this.domainName = domainName;
- this.user = user;
+ this.internalUser = internalUser;
}
@Override
protected IDomain createOpenshiftObject(ModelNode node) {
- return new Domain(domainName, user);
+ return new Domain(domainName, internalUser);
}
}
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-27 15:39:43 UTC (rev 35065)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/ApplicationIntegrationTest.java 2011-09-27 15:40:34 UTC (rev 35066)
@@ -22,7 +22,7 @@
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.core.internal.InternalUser;
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;
@@ -35,13 +35,13 @@
private IOpenshiftService service;
- private User user;
- private User invalidUser;
+ private InternalUser internalUser;
+ private InternalUser invalidUser;
@Before
public void setUp() {
this.service = new OpenshiftService();
- this.user = new TestUser();
+ this.internalUser = new TestUser();
this.invalidUser = new TestUser("bogusPassword");
}
@@ -55,30 +55,30 @@
String applicationName = ApplicationUtils.createRandomApplicationName();
try {
ICartridge cartridge = ICartridge.JBOSSAS_7;
- Application application = service.createApplication(applicationName, cartridge, user);
+ Application application = service.createApplication(applicationName, cartridge, internalUser);
assertNotNull(application);
assertEquals(applicationName, application.getName());
assertEquals(cartridge, application.getCartridge());
} finally {
- ApplicationUtils.silentlyDestroyAS7Application(applicationName, user, service);
+ ApplicationUtils.silentlyDestroyAS7Application(applicationName, internalUser, service);
}
}
@Test
public void canDestroyApplication() throws Exception {
String applicationName = ApplicationUtils.createRandomApplicationName();
- service.createApplication(applicationName, ICartridge.JBOSSAS_7, user);
- service.destroyApplication(applicationName, ICartridge.JBOSSAS_7, user);
+ service.createApplication(applicationName, ICartridge.JBOSSAS_7, internalUser);
+ service.destroyApplication(applicationName, ICartridge.JBOSSAS_7, internalUser);
}
@Test(expected = OpenshiftException.class)
public void createDuplicateApplicationThrowsException() throws Exception {
String applicationName = ApplicationUtils.createRandomApplicationName();
try {
- service.createApplication(applicationName, ICartridge.JBOSSAS_7, user);
- service.createApplication(applicationName, ICartridge.JBOSSAS_7, user);
+ service.createApplication(applicationName, ICartridge.JBOSSAS_7, internalUser);
+ service.createApplication(applicationName, ICartridge.JBOSSAS_7, internalUser);
} finally {
- ApplicationUtils.silentlyDestroyAS7Application(applicationName, user, service);
+ ApplicationUtils.silentlyDestroyAS7Application(applicationName, internalUser, service);
}
}
@@ -86,10 +86,10 @@
public void canStopApplication() throws Exception {
String applicationName = ApplicationUtils.createRandomApplicationName();
try {
- service.createApplication(applicationName, ICartridge.JBOSSAS_7, user);
- service.stopApplication(applicationName, ICartridge.JBOSSAS_7, user);
+ service.createApplication(applicationName, ICartridge.JBOSSAS_7, internalUser);
+ service.stopApplication(applicationName, ICartridge.JBOSSAS_7, internalUser);
} finally {
- ApplicationUtils.silentlyDestroyAS7Application(applicationName, user, service);
+ ApplicationUtils.silentlyDestroyAS7Application(applicationName, internalUser, service);
}
}
@@ -97,11 +97,11 @@
public void canStartStoppedApplication() throws Exception {
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);
+ service.createApplication(applicationName, ICartridge.JBOSSAS_7, internalUser);
+ service.stopApplication(applicationName, ICartridge.JBOSSAS_7, internalUser);
+ service.startApplication(applicationName, ICartridge.JBOSSAS_7, internalUser);
} finally {
- ApplicationUtils.silentlyDestroyAS7Application(applicationName, user, service);
+ ApplicationUtils.silentlyDestroyAS7Application(applicationName, internalUser, service);
}
}
@@ -116,10 +116,10 @@
* https://github.com/openshift/os-client-tools/blob/master/express
* /doc/API
*/
- service.createApplication(applicationName, ICartridge.JBOSSAS_7, user);
- service.startApplication(applicationName, ICartridge.JBOSSAS_7, user);
+ service.createApplication(applicationName, ICartridge.JBOSSAS_7, internalUser);
+ service.startApplication(applicationName, ICartridge.JBOSSAS_7, internalUser);
} finally {
- ApplicationUtils.silentlyDestroyAS7Application(applicationName, user, service);
+ ApplicationUtils.silentlyDestroyAS7Application(applicationName, internalUser, service);
}
}
@@ -134,11 +134,11 @@
* https://github.com/openshift/os-client-tools/blob/master/express
* /doc/API
*/
- service.createApplication(applicationName, ICartridge.JBOSSAS_7, user);
- service.stopApplication(applicationName, ICartridge.JBOSSAS_7, user);
- service.stopApplication(applicationName, ICartridge.JBOSSAS_7, user);
+ service.createApplication(applicationName, ICartridge.JBOSSAS_7, internalUser);
+ service.stopApplication(applicationName, ICartridge.JBOSSAS_7, internalUser);
+ service.stopApplication(applicationName, ICartridge.JBOSSAS_7, internalUser);
} finally {
- ApplicationUtils.silentlyDestroyAS7Application(applicationName, user, service);
+ ApplicationUtils.silentlyDestroyAS7Application(applicationName, internalUser, service);
}
}
@@ -153,10 +153,10 @@
* https://github.com/openshift/os-client-tools/blob/master/express
* /doc/API
*/
- service.createApplication(applicationName, ICartridge.JBOSSAS_7, user);
- service.restartApplication(applicationName, ICartridge.JBOSSAS_7, user);
+ service.createApplication(applicationName, ICartridge.JBOSSAS_7, internalUser);
+ service.restartApplication(applicationName, ICartridge.JBOSSAS_7, internalUser);
} finally {
- ApplicationUtils.silentlyDestroyAS7Application(applicationName, user, service);
+ ApplicationUtils.silentlyDestroyAS7Application(applicationName, internalUser, service);
}
}
@@ -164,11 +164,11 @@
public void canGetStatus() 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 application = service.createApplication(applicationName, ICartridge.JBOSSAS_7, internalUser);
+ String applicationStatus = service.getStatus(application.getName(), application.getCartridge(), internalUser);
assertNotNull(applicationStatus);
} finally {
- ApplicationUtils.silentlyDestroyAS7Application(applicationName, user, service);
+ ApplicationUtils.silentlyDestroyAS7Application(applicationName, internalUser, service);
}
}
@@ -176,12 +176,12 @@
public void returnsValidGitUri() throws Exception {
String applicationName = ApplicationUtils.createRandomApplicationName();
try {
- IApplication application = service.createApplication(applicationName, ICartridge.JBOSSAS_7, user);
+ IApplication application = service.createApplication(applicationName, ICartridge.JBOSSAS_7, internalUser);
String gitUri = application.getGitUri();
assertNotNull(gitUri);
assertGitUri(applicationName, gitUri);
} finally {
- ApplicationUtils.silentlyDestroyAS7Application(applicationName, user, service);
+ ApplicationUtils.silentlyDestroyAS7Application(applicationName, internalUser, service);
}
}
@@ -189,12 +189,12 @@
public void returnsValidApplicationUrl() throws Exception {
String applicationName = ApplicationUtils.createRandomApplicationName();
try {
- IApplication application = service.createApplication(applicationName, ICartridge.JBOSSAS_7, user);
+ IApplication application = service.createApplication(applicationName, ICartridge.JBOSSAS_7, internalUser);
String applicationUrl = application.getApplicationUrl();
assertNotNull(applicationUrl);
assertAppliactionUrl(applicationName, applicationUrl);
} finally {
- ApplicationUtils.silentlyDestroyAS7Application(applicationName, user, service);
+ ApplicationUtils.silentlyDestroyAS7Application(applicationName, internalUser, service);
}
}
}
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-27 15:39:43 UTC (rev 35065)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/ApplicationTest.java 2011-09-27 15:40:34 UTC (rev 35066)
@@ -27,7 +27,7 @@
import org.jboss.ide.eclipse.as.openshift.core.internal.Application;
import org.jboss.ide.eclipse.as.openshift.core.internal.ApplicationInfo;
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.InternalUser;
import org.jboss.ide.eclipse.as.openshift.core.internal.UserInfo;
import org.jboss.ide.eclipse.as.openshift.core.internal.request.ApplicationAction;
import org.jboss.ide.eclipse.as.openshift.core.internal.request.ApplicationRequest;
@@ -46,7 +46,7 @@
*/
public class ApplicationTest {
- private User user = new User(ApplicationResponseFake.RHLOGIN, ApplicationResponseFake.PASSWORD,
+ private InternalUser internalUser = new InternalUser(ApplicationResponseFake.RHLOGIN, ApplicationResponseFake.PASSWORD,
new NoopOpenshiftServiceFake());
@Test
@@ -106,7 +106,7 @@
OpenshiftResponse<Application> openshiftResponse =
new ApplicationResponseUnmarshaller(
ApplicationResponseFake.APPLICATION_NAME, ApplicationResponseFake.APPLICATION_CARTRIDGE,
- user, new NoopOpenshiftServiceFake())
+ internalUser, new NoopOpenshiftServiceFake())
.unmarshall(response);
Application application = openshiftResponse.getOpenshiftObject();
assertNotNull(application);
@@ -117,8 +117,8 @@
@Test
public void returnsValidGitUri() throws OpenshiftException {
OpenshiftService userInfoService = createUserInfoService();
- User user = createUser(userInfoService);
- IApplication application = createApplication(userInfoService, user);
+ InternalUser internalUser = createUser(userInfoService);
+ IApplication application = createApplication(userInfoService, internalUser);
String gitUri = application.getGitUri();
assertNotNull(gitUri);
@@ -133,8 +133,8 @@
@Test
public void returnsValidApplicationUrl() throws OpenshiftException {
OpenshiftService userInfoService = createUserInfoService();
- User user = createUser(userInfoService);
- IApplication application = createApplication(userInfoService, user);
+ InternalUser internalUser = createUser(userInfoService);
+ IApplication application = createApplication(userInfoService, internalUser);
String applicationUrl = application.getApplicationUrl();
assertNotNull(applicationUrl);
@@ -160,15 +160,15 @@
OpenshiftService service = new NoopOpenshiftServiceFake() {
@Override
- public String getStatus(String applicationName, ICartridge cartridge, User user) throws OpenshiftException {
+ public String getStatus(String applicationName, ICartridge cartridge, InternalUser internalUser) throws OpenshiftException {
return ApplicationResponseFake.tail;
}
};
Application application =
new Application(ApplicationResponseFake.APPLICATION_NAME,
- ApplicationResponseFake.APPLICATION_CARTRIDGE, user, service);
- ApplicationLogReader reader = new ApplicationLogReader(application, user, service);
+ ApplicationResponseFake.APPLICATION_CARTRIDGE, internalUser, service);
+ ApplicationLogReader reader = new ApplicationLogReader(application, internalUser, service);
int charactersRead = 0;
int character = -1;
@@ -183,7 +183,7 @@
}
}
- private IApplication createApplication(OpenshiftService userInfoService, User user) {
+ private IApplication createApplication(OpenshiftService userInfoService, InternalUser internalUser) {
Application application = new Application(
ApplicationResponseFake.APPLICATION_NAME
, ApplicationResponseFake.APPLICATION_CARTRIDGE
@@ -193,27 +193,27 @@
, ApplicationResponseFake.APPLICATION_EMBEDDED
, ApplicationResponseFake.APPLICATION_CARTRIDGE
, ApplicationResponseFake.APPLICATION_CREATIONTIME)
- , user
+ , internalUser
, userInfoService);
/**
* we have to add it manually since we dont create the application with
- * the user class
+ * the internalUser class
*
- * @see User#createApplication
+ * @see InternalUser#createApplication
*/
- user.add(application);
+ internalUser.add(application);
return application;
}
- private User createUser(OpenshiftService userInfoService) {
- User user = new User(ApplicationResponseFake.RHLOGIN, ApplicationResponseFake.PASSWORD, userInfoService);
- return user;
+ private InternalUser createUser(OpenshiftService userInfoService) {
+ InternalUser internalUser = new InternalUser(ApplicationResponseFake.RHLOGIN, ApplicationResponseFake.PASSWORD, userInfoService);
+ return internalUser;
}
private OpenshiftService createUserInfoService() {
OpenshiftService userInfoService = new NoopOpenshiftServiceFake() {
@Override
- public UserInfo getUserInfo(User user) throws OpenshiftException {
+ public UserInfo getUserInfo(InternalUser internalUser) throws OpenshiftException {
ApplicationInfo applicationInfo = new ApplicationInfo(
ApplicationResponseFake.APPLICATION_NAME,
ApplicationResponseFake.APPLICATION_UUID,
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-27 15:39:43 UTC (rev 35065)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/CartridgesIntegrationTest.java 2011-09-27 15:40:34 UTC (rev 35066)
@@ -17,7 +17,7 @@
import org.jboss.ide.eclipse.as.openshift.core.ICartridge;
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.InternalUser;
import org.jboss.ide.eclipse.as.openshift.test.internal.core.fakes.TestUser;
import org.junit.Before;
import org.junit.Ignore;
@@ -30,18 +30,18 @@
private OpenshiftService openshiftService;
- private User user;
+ private InternalUser internalUser;
@Before
public void setUp() {
this.openshiftService = new OpenshiftService();
- this.user = new TestUser();
+ this.internalUser = new TestUser();
}
@Ignore
@Test
public void canRequestListCartridges() throws Exception {
- List<ICartridge> cartridges = openshiftService.getCartridges(user);
+ List<ICartridge> cartridges = openshiftService.getCartridges(internalUser);
assertNotNull(cartridges);
assertTrue(cartridges.size() > 0);
}
Modified: trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/DomainTest.java
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/DomainTest.java 2011-09-27 15:39:43 UTC (rev 35065)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/DomainTest.java 2011-09-27 15:40:34 UTC (rev 35066)
@@ -20,7 +20,7 @@
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.internal.IDomain;
-import org.jboss.ide.eclipse.as.openshift.core.internal.User;
+import org.jboss.ide.eclipse.as.openshift.core.internal.InternalUser;
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;
@@ -62,8 +62,8 @@
String responseString = createDomainResponseString(RHLOGIN, UUID);
responseString = JsonSanitizer.sanitize(responseString);
- User user = new User(RHLOGIN, PASSWORD, new NoopOpenshiftServiceFake());
- OpenshiftResponse<IDomain> response = new DomainResponseUnmarshaller(domainName, user).unmarshall(responseString);
+ InternalUser internalUser = new InternalUser(RHLOGIN, PASSWORD, new NoopOpenshiftServiceFake());
+ OpenshiftResponse<IDomain> response = new DomainResponseUnmarshaller(domainName, internalUser).unmarshall(responseString);
assertNotNull(response);
IDomain domain = response.getOpenshiftObject();
Modified: trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/UserTest.java
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/UserTest.java 2011-09-27 15:39:43 UTC (rev 35065)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/UserTest.java 2011-09-27 15:40:34 UTC (rev 35066)
@@ -30,7 +30,7 @@
import org.jboss.ide.eclipse.as.openshift.core.internal.ApplicationInfo;
import org.jboss.ide.eclipse.as.openshift.core.internal.IDomain;
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.InternalUser;
import org.jboss.ide.eclipse.as.openshift.core.internal.UserInfo;
import org.jboss.ide.eclipse.as.openshift.core.internal.utils.RFC822DateUtils;
import org.jboss.ide.eclipse.as.openshift.test.internal.core.fakes.CartridgeResponseFake;
@@ -45,30 +45,30 @@
public class UserTest {
private OpenshiftService userInfoservice;
- private User user;
+ private InternalUser internalUser;
@Before
public void setUp() throws OpenshiftException, DatatypeConfigurationException {
UserInfo userInfo = createUserInfo();
this.userInfoservice = createUserInfoService(userInfo);
- this.user = new User(UserInfoResponseFake.RHLOGIN, UserInfoResponseFake.PASSWORD, userInfoservice);
+ this.internalUser = new InternalUser(UserInfoResponseFake.RHLOGIN, UserInfoResponseFake.PASSWORD, userInfoservice);
}
@Test
public void canGetUserUUID() throws OpenshiftException {
- assertEquals(UserInfoResponseFake.UUID, user.getUUID());
+ assertEquals(UserInfoResponseFake.UUID, internalUser.getUUID());
}
@Test
public void canGetPublicKey() throws OpenshiftException {
- ISSHPublicKey key = user.getSshKey();
+ ISSHPublicKey key = internalUser.getSshKey();
assertNotNull(key);
assertEquals(UserInfoResponseFake.SSH_KEY, key.getPublicKey());
}
@Test
public void canGetDomain() throws OpenshiftException {
- IDomain domain = user.getDomain();
+ IDomain domain = internalUser.getDomain();
assertNotNull(domain);
assertEquals(UserInfoResponseFake.RHC_DOMAIN, domain.getRhcDomain());
assertEquals(UserInfoResponseFake.NAMESPACE, domain.getNamespace());
@@ -79,7 +79,7 @@
OpenshiftService cartridgeListService = new NoopOpenshiftServiceFake() {
@Override
- public List<ICartridge> getCartridges(User user) throws OpenshiftException {
+ public List<ICartridge> getCartridges(InternalUser internalUser) throws OpenshiftException {
ArrayList<ICartridge> cartridges = new ArrayList<ICartridge>();
cartridges.add(new Cartridge(CartridgeResponseFake.CARTRIDGE_JBOSSAS70));
cartridges.add(new Cartridge(CartridgeResponseFake.CARTRIDGE_PERL5));
@@ -89,8 +89,8 @@
return cartridges;
}
};
- User user = new User(UserInfoResponseFake.RHLOGIN, UserInfoResponseFake.PASSWORD, cartridgeListService);
- Collection<ICartridge> cartridges = user.getCartridges();
+ InternalUser internalUser = new InternalUser(UserInfoResponseFake.RHLOGIN, UserInfoResponseFake.PASSWORD, cartridgeListService);
+ Collection<ICartridge> cartridges = internalUser.getCartridges();
assertNotNull(cartridges);
assertEquals(5, cartridges.size());
assertThatContainsCartridge(CartridgeResponseFake.CARTRIDGE_JBOSSAS70, cartridges);
@@ -103,14 +103,14 @@
@Test
public void canGetApplications() throws OpenshiftException {
/** response is UserInfoResponseFake */
- Collection<IApplication> applications = user.getApplications();
+ Collection<IApplication> applications = internalUser.getApplications();
assertNotNull(applications);
assertEquals(2, applications.size());
}
@Test
public void canGetApplicationByName() throws OpenshiftException, DatatypeConfigurationException {
- IApplication application = user.getApplicationByName(UserInfoResponseFake.APP2_NAME);
+ IApplication application = internalUser.getApplicationByName(UserInfoResponseFake.APP2_NAME);
assertApplication(
UserInfoResponseFake.APP2_NAME
, UserInfoResponseFake.APP2_UUID
@@ -146,7 +146,7 @@
return new NoopOpenshiftServiceFake() {
@Override
- public UserInfo getUserInfo(User user) throws OpenshiftException {
+ public UserInfo getUserInfo(InternalUser internalUser) throws OpenshiftException {
return userInfo;
}
};
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-27 15:39:43 UTC (rev 35065)
+++ 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-27 15:40:34 UTC (rev 35066)
@@ -19,7 +19,7 @@
import org.jboss.ide.eclipse.as.openshift.core.internal.Application;
import org.jboss.ide.eclipse.as.openshift.core.internal.IDomain;
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.InternalUser;
import org.jboss.ide.eclipse.as.openshift.core.internal.UserInfo;
/**
@@ -28,52 +28,52 @@
public class NoopOpenshiftServiceFake extends OpenshiftService {
@Override
- public UserInfo getUserInfo(User user) throws OpenshiftException {
+ public UserInfo getUserInfo(InternalUser internalUser) throws OpenshiftException {
throw new UnsupportedOperationException();
}
@Override
- public List<ICartridge> getCartridges(User user) throws OpenshiftException {
+ public List<ICartridge> getCartridges(InternalUser internalUser) throws OpenshiftException {
throw new UnsupportedOperationException();
}
@Override
- public Application createApplication(String name, ICartridge cartridge, User user) throws OpenshiftException {
+ public Application createApplication(String name, ICartridge cartridge, InternalUser internalUser) throws OpenshiftException {
throw new UnsupportedOperationException();
}
@Override
- public void destroyApplication(String name, ICartridge cartridge, User user) throws OpenshiftException {
+ public void destroyApplication(String name, ICartridge cartridge, InternalUser internalUser) throws OpenshiftException {
throw new UnsupportedOperationException();
}
@Override
- public IApplication startApplication(String name, ICartridge cartridge, User user) throws OpenshiftException {
+ public IApplication startApplication(String name, ICartridge cartridge, InternalUser internalUser) throws OpenshiftException {
throw new UnsupportedOperationException();
}
@Override
- public IApplication restartApplication(String name, ICartridge cartridge, User user) throws OpenshiftException {
+ public IApplication restartApplication(String name, ICartridge cartridge, InternalUser internalUser) throws OpenshiftException {
throw new UnsupportedOperationException();
}
@Override
- public IApplication stopApplication(String name, ICartridge cartridge, User user) throws OpenshiftException {
+ public IApplication stopApplication(String name, ICartridge cartridge, InternalUser internalUser) throws OpenshiftException {
throw new UnsupportedOperationException();
}
@Override
- public String getStatus(String applicationName, ICartridge cartridge, User user) throws OpenshiftException {
+ public String getStatus(String applicationName, ICartridge cartridge, InternalUser internalUser) throws OpenshiftException {
throw new UnsupportedOperationException();
}
@Override
- public IDomain changeDomain(String domainName, ISSHPublicKey sshKey, User user) throws OpenshiftException {
+ public IDomain changeDomain(String domainName, ISSHPublicKey sshKey, InternalUser internalUser) throws OpenshiftException {
throw new UnsupportedOperationException();
}
@Override
- public IDomain createDomain(String name, ISSHPublicKey keyPair, User user) throws OpenshiftException {
+ public IDomain createDomain(String name, ISSHPublicKey keyPair, InternalUser internalUser) 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/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-09-27 15:39:43 UTC (rev 35065)
+++ 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-27 15:40:34 UTC (rev 35066)
@@ -13,13 +13,13 @@
import org.jboss.ide.eclipse.as.openshift.core.Cartridge;
import org.jboss.ide.eclipse.as.openshift.core.IApplication;
import org.jboss.ide.eclipse.as.openshift.core.OpenshiftException;
-import org.jboss.ide.eclipse.as.openshift.core.internal.User;
+import org.jboss.ide.eclipse.as.openshift.core.internal.InternalUser;
import org.jboss.ide.eclipse.as.openshift.test.internal.core.utils.ApplicationUtils;
/**
* @author André Dietisheim
*/
-public class TestUser extends User {
+public class TestUser extends InternalUser {
private static final String RHLOGIN = "toolsjboss(a)gmail.com";
private static final String PASSWORD = "1q2w3e";
Modified: 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 2011-09-27 15:39:43 UTC (rev 35065)
+++ 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-27 15:40:34 UTC (rev 35066)
@@ -15,7 +15,7 @@
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;
+import org.jboss.ide.eclipse.as.openshift.core.internal.InternalUser;
/**
* @author André Dietisheim
@@ -26,13 +26,13 @@
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 Application createApplication(InternalUser internalUser, IOpenshiftService service) throws OpenshiftException {
+ return service.createApplication(createRandomApplicationName(), Cartridge.JBOSSAS_7, internalUser);
}
- public static void silentlyDestroyAS7Application(String name, User user, IOpenshiftService service) {
+ public static void silentlyDestroyAS7Application(String name, InternalUser internalUser, IOpenshiftService service) {
try {
- service.destroyApplication(name, ICartridge.JBOSSAS_7, user);
+ service.destroyApplication(name, ICartridge.JBOSSAS_7, internalUser);
} catch (OpenshiftException e) {
e.printStackTrace();
}
14 years, 2 months
JBoss Tools SVN: r35065 - trunk/central.
by jbosstools-commits@lists.jboss.org
Author: nickboldt
Date: 2011-09-27 11:39:43 -0400 (Tue, 27 Sep 2011)
New Revision: 35065
Modified:
trunk/central/pom.xml
Log:
add instructions for building w/ maven
Modified: trunk/central/pom.xml
===================================================================
--- trunk/central/pom.xml 2011-09-27 15:39:28 UTC (rev 35064)
+++ trunk/central/pom.xml 2011-09-27 15:39:43 UTC (rev 35065)
@@ -13,6 +13,11 @@
<version>1.0.0-SNAPSHOT</version>
<name>centrall.all</name>
<packaging>pom</packaging>
+ <!--
+ mvn clean install
+ or
+ mvn clean install -B -U -fae -e -P jbosstools-nightly-staging-composite,jboss-requirements-composite-mirror,jboss-requirements-composite-extras-mirror,local.site -Dlocal.site=file://home/nboldt/tmp/JBT_REPO_Indigo/
+ -->
<modules>
<module>features</module>
<module>plugins</module>
14 years, 2 months
JBoss Tools SVN: r35064 - trunk/central/plugins/org.jboss.tools.central/META-INF.
by jbosstools-commits@lists.jboss.org
Author: nickboldt
Date: 2011-09-27 11:39:28 -0400 (Tue, 27 Sep 2011)
New Revision: 35064
Modified:
trunk/central/plugins/org.jboss.tools.central/META-INF/MANIFEST.MF
Log:
allow wider range of org.eclipse.mylyn.commons.ui dependency -- compiles against 3.6.0 as well as 3.6.1
Modified: trunk/central/plugins/org.jboss.tools.central/META-INF/MANIFEST.MF
===================================================================
--- trunk/central/plugins/org.jboss.tools.central/META-INF/MANIFEST.MF 2011-09-27 15:39:05 UTC (rev 35063)
+++ trunk/central/plugins/org.jboss.tools.central/META-INF/MANIFEST.MF 2011-09-27 15:39:28 UTC (rev 35064)
@@ -21,7 +21,7 @@
org.eclipse.mylyn.commons.core;bundle-version="3.6.0",
org.eclipse.mylyn.discovery.ui;bundle-version="3.6.0",
org.eclipse.mylyn.discovery.core;bundle-version="3.6.0",
- org.eclipse.mylyn.commons.ui;bundle-version="3.6.1",
+ org.eclipse.mylyn.commons.ui;bundle-version="[3.6.0,3.7.0)",
org.eclipse.equinox.p2.ui.sdk;bundle-version="1.0.200",
org.eclipse.equinox.p2.core;bundle-version="2.1.0",
org.eclipse.equinox.p2.engine;bundle-version="2.1.0"
14 years, 2 months
JBoss Tools SVN: r35063 - trunk/build/target-platform.
by jbosstools-commits@lists.jboss.org
Author: nickboldt
Date: 2011-09-27 11:39:05 -0400 (Tue, 27 Sep 2011)
New Revision: 35063
Modified:
trunk/build/target-platform/jbds.target
trunk/build/target-platform/jbds.target.p2mirror.xml
trunk/build/target-platform/multiple.target
trunk/build/target-platform/multiple.target.p2mirror.xml
trunk/build/target-platform/unified.target
trunk/build/target-platform/unified.target.p2mirror.xml
Log:
new JBoss Central plugin requires com.sun.syndication; explicitly add to TP
Modified: trunk/build/target-platform/jbds.target
===================================================================
--- trunk/build/target-platform/jbds.target 2011-09-27 15:33:52 UTC (rev 35062)
+++ trunk/build/target-platform/jbds.target 2011-09-27 15:39:05 UTC (rev 35063)
@@ -42,6 +42,7 @@
<unit id="org.hamcrest.text" version="1.1.0.v20090501071000"/>
<unit id="org.hamcrest.library" version="1.1.0.v20090501071000"/>
<unit id="org.hamcrest.integration" version="1.1.0.v20090501071000"/>
+ <unit id="com.sun.syndication" version="0.9.0.v200803061811"/>
<!-- Orbit bundles needed for Eclipse Checkstyle (eclipse-cs) -->
<unit id="org.apache.lucene.highlighter" version="2.9.1.v20100421-0704"/>
Modified: trunk/build/target-platform/jbds.target.p2mirror.xml
===================================================================
--- trunk/build/target-platform/jbds.target.p2mirror.xml 2011-09-27 15:33:52 UTC (rev 35062)
+++ trunk/build/target-platform/jbds.target.p2mirror.xml 2011-09-27 15:39:05 UTC (rev 35063)
@@ -54,6 +54,7 @@
<iu id="org.hamcrest.text" version=""/>
<iu id="org.hamcrest.library" version=""/>
<iu id="org.hamcrest.integration" version=""/>
+<iu id="com.sun.syndication" version=""/>
<iu id="org.apache.lucene.highlighter" version=""/>
<iu id="org.apache.lucene.memory" version=""/>
<iu id="org.apache.lucene.misc" version=""/>
Modified: trunk/build/target-platform/multiple.target
===================================================================
--- trunk/build/target-platform/multiple.target 2011-09-27 15:33:52 UTC (rev 35062)
+++ trunk/build/target-platform/multiple.target 2011-09-27 15:39:05 UTC (rev 35063)
@@ -44,6 +44,7 @@
<unit id="org.hamcrest.text" version="1.1.0.v20090501071000"/>
<unit id="org.hamcrest.library" version="1.1.0.v20090501071000"/>
<unit id="org.hamcrest.integration" version="1.1.0.v20090501071000"/>
+ <unit id="com.sun.syndication" version="0.9.0.v200803061811"/>
<!-- Orbit bundles needed for Eclipse Checkstyle (eclipse-cs) -->
<unit id="org.apache.lucene.highlighter" version="2.9.1.v20100421-0704"/>
@@ -245,4 +246,4 @@
<feature id="org.mozilla.xpcom.feature"/>
</includeBundles>
<targetJRE path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
-</target>
\ No newline at end of file
+</target>
Modified: trunk/build/target-platform/multiple.target.p2mirror.xml
===================================================================
--- trunk/build/target-platform/multiple.target.p2mirror.xml 2011-09-27 15:33:52 UTC (rev 35062)
+++ trunk/build/target-platform/multiple.target.p2mirror.xml 2011-09-27 15:39:05 UTC (rev 35063)
@@ -55,6 +55,7 @@
<iu id="org.hamcrest.text" version=""/>
<iu id="org.hamcrest.library" version=""/>
<iu id="org.hamcrest.integration" version=""/>
+<iu id="com.sun.syndication" version=""/>
<iu id="org.apache.lucene.highlighter" version=""/>
<iu id="org.apache.lucene.memory" version=""/>
<iu id="org.apache.lucene.misc" version=""/>
Modified: trunk/build/target-platform/unified.target
===================================================================
--- trunk/build/target-platform/unified.target 2011-09-27 15:33:52 UTC (rev 35062)
+++ trunk/build/target-platform/unified.target 2011-09-27 15:39:05 UTC (rev 35063)
@@ -44,6 +44,7 @@
<unit id="org.hamcrest.text" version="1.1.0.v20090501071000"/>
<unit id="org.hamcrest.library" version="1.1.0.v20090501071000"/>
<unit id="org.hamcrest.integration" version="1.1.0.v20090501071000"/>
+ <unit id="com.sun.syndication" version="0.9.0.v200803061811"/>
<!-- Orbit bundles needed for Eclipse Checkstyle (eclipse-cs) -->
<unit id="org.apache.lucene.highlighter" version="2.9.1.v20100421-0704"/>
@@ -245,4 +246,4 @@
<feature id="org.mozilla.xpcom.feature"/>
</includeBundles>
<targetJRE path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
-</target>
\ No newline at end of file
+</target>
Modified: trunk/build/target-platform/unified.target.p2mirror.xml
===================================================================
--- trunk/build/target-platform/unified.target.p2mirror.xml 2011-09-27 15:33:52 UTC (rev 35062)
+++ trunk/build/target-platform/unified.target.p2mirror.xml 2011-09-27 15:39:05 UTC (rev 35063)
@@ -55,6 +55,7 @@
<iu id="org.hamcrest.text" version=""/>
<iu id="org.hamcrest.library" version=""/>
<iu id="org.hamcrest.integration" version=""/>
+<iut id="com.sun.syndication" version=""/>
<iu id="org.apache.lucene.highlighter" version=""/>
<iu id="org.apache.lucene.memory" version=""/>
<iu id="org.apache.lucene.misc" version=""/>
14 years, 2 months
JBoss Tools SVN: r35062 - 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-27 11:33:52 -0400 (Tue, 27 Sep 2011)
New Revision: 35062
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/UserFactory.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/UserInfoAware.java
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/ApplicationLogReader.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/IApplication.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/Domain.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/ApplicationLogReaderIntegrationTest.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/utils/ApplicationAsserts.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/ApplicationLogReader.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/ApplicationLogReader.java 2011-09-27 15:19:36 UTC (rev 35061)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/ApplicationLogReader.java 2011-09-27 15:33:52 UTC (rev 35062)
@@ -21,11 +21,6 @@
import org.jboss.ide.eclipse.as.openshift.core.internal.User;
/**
- * TODO: make sure it behaves correctly on subsequent requests that get app
- * status on the server: The server would either repeat the whole log or just
- * respond with the diff.
- *
- *
* @author André Dietisheim
*/
public class ApplicationLogReader extends Reader {
@@ -80,11 +75,6 @@
return charactersRead;
}
- private boolean isSameStatus(String status, String currentStatus) {
- return currentStatus != null
- && currentStatus.equals(status);
- }
-
protected StringReader createLogReader(String status) throws IOException {
String log = getLog(status);
return new StringReader(log);
@@ -103,7 +93,7 @@
try {
String status = service.getStatus(application.getName(), application.getCartridge(), user);
if (isSameStatus(status, currentStatus)) {
- return null;
+ status = null;
}
return status;
@@ -112,6 +102,11 @@
}
}
+ private boolean isSameStatus(String thisStatus, String otherStatus) {
+ return otherStatus != null
+ && otherStatus.equals(thisStatus);
+ }
+
@Override
public void close() throws IOException {
if (logReader != null) {
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/IApplication.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/IApplication.java 2011-09-27 15:19:36 UTC (rev 35061)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/IApplication.java 2011-09-27 15:33:52 UTC (rev 35062)
@@ -35,7 +35,7 @@
public void stop() throws OpenshiftException;
- public ApplicationLogReader getLog() throws OpenshiftException;
+ public ApplicationLogReader getLogReader() throws OpenshiftException;
public String getGitUri() throws OpenshiftException;
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/UserFactory.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/UserFactory.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/UserFactory.java 2011-09-27 15:33:52 UTC (rev 35062)
@@ -0,0 +1,11 @@
+package org.jboss.ide.eclipse.as.openshift.core;
+
+import org.jboss.ide.eclipse.as.openshift.core.internal.User;
+
+public class UserFactory {
+
+ public static IUser create(String rhlogin, String password) {
+ return new User(rhlogin, password);
+ }
+
+}
Property changes on: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/UserFactory.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/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-27 15:19:36 UTC (rev 35061)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/Application.java 2011-09-27 15:33:52 UTC (rev 35062)
@@ -21,33 +21,26 @@
/**
* @author André Dietisheim
*/
-public class Application implements IApplication {
+public class Application extends UserInfoAware implements IApplication {
private static final String GIT_URI_PATTERN = "ssh://{0}@{1}-{2}.{3}/~/git/{1}.git/";
private static final String APPLICATION_URL_PATTERN = "http://{0}-{1}.{2}/";
private String name;
private ICartridge cartridge;
- private String uuid;
- private Date creationTime;
- private String embedded;
private IOpenshiftService service;
private ApplicationLogReader logReader;
+ private ApplicationInfo applicationInfo;
- private User user;
-
public Application(String name, ICartridge cartridge, User user, IOpenshiftService service) {
- this(name, null, cartridge, null, null, user, service);
+ this(name, cartridge, null, user, service);
}
- public Application(String name, String uuid, ICartridge cartridge, String embedded, Date creationTime, User user,
+ public Application(String name, ICartridge cartridge, ApplicationInfo applicationInfo, User user,
IOpenshiftService service) {
+ super(user);
this.name = name;
this.cartridge = cartridge;
- this.uuid = uuid;
- this.embedded = embedded;
- this.creationTime = creationTime;
- this.user = user;
this.service = service;
}
@@ -57,8 +50,7 @@
@Override
public String getUUID() throws OpenshiftException {
- user.loadLazyValues();
- return uuid;
+ return getApplicationInfo().getUuid();
}
@Override
@@ -68,47 +60,45 @@
@Override
public String getEmbedded() throws OpenshiftException {
- user.loadLazyValues();
- return embedded;
+ return getApplicationInfo().getEmbedded();
}
@Override
public Date getCreationTime() throws OpenshiftException {
- user.loadLazyValues();
- return creationTime;
+ return getApplicationInfo().getCreationTime();
}
@Override
public void destroy() throws OpenshiftException {
- service.destroyApplication(name, cartridge, user);
+ service.destroyApplication(name, cartridge, getUser());
}
@Override
public void start() throws OpenshiftException {
- service.startApplication(name, cartridge, user);
+ service.startApplication(name, cartridge, getUser());
}
@Override
public void restart() throws OpenshiftException {
- service.restartApplication(name, cartridge, user);
+ service.restartApplication(name, cartridge, getUser());
}
@Override
public void stop() throws OpenshiftException {
- service.stopApplication(name, cartridge, user);
+ service.stopApplication(name, cartridge, getUser());
}
@Override
- public ApplicationLogReader getLog() throws OpenshiftException {
+ public ApplicationLogReader getLogReader() throws OpenshiftException {
if (logReader == null) {
- this.logReader = new ApplicationLogReader(this, user, service);
+ this.logReader = new ApplicationLogReader(this, getUser(), service);
}
return logReader;
}
@Override
public String getGitUri() throws OpenshiftException {
- IDomain domain = user.getDomain();
+ IDomain domain = getUser().getDomain();
if (domain == null) {
return null;
}
@@ -118,29 +108,22 @@
@Override
public String getApplicationUrl() throws OpenshiftException {
- IDomain domain = user.getDomain();
+ IDomain domain = getUser().getDomain();
if (domain == null) {
return null;
}
return MessageFormat.format(APPLICATION_URL_PATTERN, name, domain.getNamespace(), domain.getRhcDomain());
}
- void update(ApplicationInfo applicationInfo) {
- if (applicationInfo == null) {
- return;
- }
- this.cartridge = applicationInfo.getCartridge();
- this.creationTime = applicationInfo.getCreationTime();
- this.name = applicationInfo.getName();
- this.uuid = applicationInfo.getUuid();
- }
-
protected IOpenshiftService getService() {
return service;
}
- protected User getUser() {
- return user;
+ protected ApplicationInfo getApplicationInfo() throws OpenshiftException {
+ if (applicationInfo == null) {
+ this.applicationInfo = getUserInfo().getApplicationInfoByName(getName());
+ }
+ return applicationInfo;
}
@Override
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/Domain.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/Domain.java 2011-09-27 15:19:36 UTC (rev 35061)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/Domain.java 2011-09-27 15:33:52 UTC (rev 35062)
@@ -16,20 +16,17 @@
/**
* @author André Dietisheim
*/
-public class Domain implements IDomain {
+public class Domain extends UserInfoAware implements IDomain {
private String namespace;
- private String rhcDomain;
- private User user;
public Domain(String namespace, User user) {
this(namespace, null, user);
}
public Domain(String namespace, String rhcDomain, User user) {
+ super(user);
this.namespace = namespace;
- this.rhcDomain = rhcDomain;
- this.user = user;
}
@Override
@@ -39,12 +36,6 @@
@Override
public String getRhcDomain() throws OpenshiftException {
- user.loadLazyValues();
- return rhcDomain;
+ return getUserInfo().getRhcDomain();
}
-
- void update(UserInfo userInfo) {
- this.rhcDomain = userInfo.getRhcDomain();
- this.namespace = userInfo.getNamespace();
- }
}
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-27 15:19:36 UTC (rev 35061)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/User.java 2011-09-27 15:33:52 UTC (rev 35062)
@@ -28,7 +28,6 @@
private String rhlogin;
private String password;
- private String uuid;
private ISSHPublicKey sshKey;
private Domain domain;
private UserInfo userInfo;
@@ -54,13 +53,19 @@
@Override
public IDomain getDomain() throws OpenshiftException {
- loadLazyValues();
+ if (domain == null) {
+ this.domain = new Domain(
+ getUserInfo().getNamespace()
+ , getUserInfo().getRhcDomain(), this);
+ }
return domain;
}
@Override
public ISSHPublicKey getSshKey() throws OpenshiftException {
- loadLazyValues();
+ if (sshKey == null) {
+ sshKey = getUserInfo().getSshPublicKey();
+ }
return sshKey;
}
@@ -75,8 +80,7 @@
}
public String getUUID() throws OpenshiftException {
- loadLazyValues();
- return uuid;
+ return getUserInfo().getUuid();
}
@Override
@@ -96,14 +100,15 @@
@Override
public Collection<IApplication> getApplications() throws OpenshiftException {
- loadLazyValues();
+ if (getUserInfo().getApplicationInfos().size() > applications.size()) {
+ update(getUserInfo().getApplicationInfos());
+ }
return Collections.unmodifiableList(applications);
}
@Override
public IApplication getApplicationByName(String name) throws OpenshiftException {
- loadLazyValues();
- return getApplicationByName(name, applications);
+ return getApplicationByName(name, getApplications());
}
private IApplication getApplicationByName(String name, Collection<IApplication> applications) {
@@ -128,53 +133,23 @@
this.sshKey = key;
}
- /**
- * Loads the lazy values from the server if needed. Updates itself all
- * referenced objects (applications, domain).
- *
- * @throws OpenshiftException
- * if an error occurred while loading the values
- */
- void loadLazyValues() throws OpenshiftException {
+ public UserInfo getUserInfo() throws OpenshiftException {
if (userInfo == null) {
- refresh();
+ this.userInfo = service.getUserInfo(this);
}
+ return userInfo;
}
public void refresh() throws OpenshiftException {
- this.userInfo = service.getUserInfo(this);
- update(userInfo);
+ this.domain = null;
+ this.sshKey = null;
+ getUserInfo();
}
-
- private void update(UserInfo userInfo) throws OpenshiftException {
- this.uuid = userInfo.getUuid();
- updateDomain(userInfo);
- updateSshPublicKey(userInfo);
- update(userInfo.getApplicationInfos());
- }
-
- private void updateDomain(UserInfo userInfo) {
- if (domain == null) {
- this.domain = new Domain(userInfo.getNamespace(), userInfo.getRhcDomain(), this);
- } else {
- domain.update(userInfo);
- }
- }
-
- private void updateSshPublicKey(UserInfo userInfo) throws OpenshiftException {
- if (sshKey == null) {
- sshKey = userInfo.getSshPublicKey();
- } else {
- sshKey.update(userInfo.getSshPublicKey());
- }
- }
-
+
private void update(List<ApplicationInfo> applicationInfos) {
for (ApplicationInfo applicationInfo : applicationInfos) {
IApplication application = getApplicationByName(applicationInfo.getName(), applications);
- if (application != null) {
- ((Application) application).update(applicationInfo);
- } else {
+ if (application == null) {
applications.add(createApplication(applicationInfo));
}
}
@@ -182,10 +157,8 @@
private Application createApplication(ApplicationInfo applicationInfo) {
return new Application(applicationInfo.getName()
- , applicationInfo.getUuid()
, applicationInfo.getCartridge()
- , applicationInfo.getEmbedded()
- , applicationInfo.getCreationTime()
+ , applicationInfo
, this, service);
}
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/UserInfoAware.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/UserInfoAware.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/UserInfoAware.java 2011-09-27 15:33:52 UTC (rev 35062)
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * 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;
+
+import org.jboss.ide.eclipse.as.openshift.core.OpenshiftException;
+
+public class UserInfoAware {
+
+ private UserInfo userInfo;
+ private User user;
+
+ protected UserInfoAware(User user) {
+ this.user = user;
+ }
+
+ protected UserInfo getUserInfo() throws OpenshiftException {
+ if (userInfo == null) {
+ this.userInfo = user.getUserInfo();
+ }
+ return userInfo;
+ }
+
+ protected User getUser() {
+ return user;
+ }
+
+}
Property changes on: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/UserInfoAware.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/ApplicationLogReaderIntegrationTest.java
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/ApplicationLogReaderIntegrationTest.java 2011-09-27 15:19:36 UTC (rev 35061)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/ApplicationLogReaderIntegrationTest.java 2011-09-27 15:33:52 UTC (rev 35062)
@@ -12,10 +12,14 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
+import java.util.concurrent.BlockingQueue;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
+import java.util.concurrent.LinkedBlockingDeque;
+import java.util.concurrent.TimeUnit;
import org.jboss.ide.eclipse.as.openshift.core.ApplicationLogReader;
import org.jboss.ide.eclipse.as.openshift.core.IApplication;
@@ -34,7 +38,7 @@
*/
public class ApplicationLogReaderIntegrationTest {
- private static final long TIMEOUT = 6 * 1024;
+ private static final long TIMEOUT = 10;
private IOpenshiftService service;
private TestUser user;
@@ -88,22 +92,21 @@
public void logReaderReturnsNewEntriesAfterApplicationRestart() throws Exception {
IApplication application = null;
ExecutorService executor = null;
- long startTime = System.currentTimeMillis();
try {
application = user.createTestApplication();
- ApplicationLogReader logReader = application.getLog();
+ ApplicationLogReader logReader = application.getLogReader();
LogReaderRunnable logReaderRunnable = new LogReaderRunnable(logReader);
executor = Executors.newSingleThreadExecutor();
executor.submit(logReaderRunnable);
- boolean logAvailable = waitForNewLogEntries(0, startTime, System.currentTimeMillis() + TIMEOUT, logReaderRunnable);
- int logLength = logReaderRunnable.getLog().length();
- assertTrue(logReaderRunnable.isRunning());
- assertTrue(logAvailable);
+
+ String log = logReaderRunnable.waitUntilNoNewLogentries();
+ assertNotNull(log);
+ assertTrue(log.length() > 0);
+
application.restart();
- logAvailable = waitForNewLogEntries(logLength, startTime, System.currentTimeMillis() + TIMEOUT, logReaderRunnable);
- assertTrue(logAvailable);
- assertTrue(logReaderRunnable.isRunning());
- assertTrue(logReaderRunnable.getLog().length() > logLength);
+
+ String newLog = logReaderRunnable.waitUntilNoNewLogentries();
+ assertFalse(log.equals(newLog));
} finally {
if (executor != null) {
executor.shutdownNow();
@@ -114,50 +117,42 @@
}
}
- protected boolean waitForNewLogEntries(int logLength, long startTime, long timeout, LogReaderRunnable logReaderRunnable)
- throws InterruptedException {
- while (logReaderRunnable.isEmpty()
- && logReaderRunnable.getLog().length() <= logLength
- && System.currentTimeMillis() <= timeout) {
- Thread.sleep(1 * 1024);
- }
- return logReaderRunnable.getLog().length() > logLength;
- }
-
private static class LogReaderRunnable implements Runnable {
private ApplicationLogReader logReader;
- private StringBuilder builder;
- private boolean running;
+ private BlockingQueue<Character> logQueue;
public LogReaderRunnable(ApplicationLogReader logReader) {
this.logReader = logReader;
- this.builder = new StringBuilder();
+ this.logQueue = new LinkedBlockingDeque<Character>();
}
@Override
public void run() {
- this.running = true;
try {
for (int data = -1; (data = logReader.read()) != -1;) {
- builder.append((char) data);
+ logQueue.put((char) data);
}
} catch (Exception e) {
- this.running = false;
+ // do nothing
}
}
- public boolean isRunning() {
- return running;
+ private boolean waitForNewLogentries(StringBuilder builder) throws InterruptedException {
+ Character character = logQueue.poll(TIMEOUT, TimeUnit.SECONDS);
+ boolean newEntry = character != null;
+ if (newEntry) {
+ builder.append(character);
+ }
+ return newEntry;
}
- public String getLog() {
+ public String waitUntilNoNewLogentries() throws InterruptedException {
+ StringBuilder builder = new StringBuilder();
+ while (waitForNewLogentries(builder)) {
+ ;
+ }
return builder.toString();
}
-
- public boolean isEmpty() {
- return builder.length() == 0;
- }
}
-
}
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-27 15:19:36 UTC (rev 35061)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/ApplicationTest.java 2011-09-27 15:33:52 UTC (rev 35062)
@@ -156,7 +156,7 @@
}
@Test
- public void applicationLogReaderReturnsAllowsToReadFromStatus() throws IOException {
+ public void canReadFromApplicationLogReader() throws IOException {
OpenshiftService service = new NoopOpenshiftServiceFake() {
@Override
@@ -170,27 +170,34 @@
ApplicationResponseFake.APPLICATION_CARTRIDGE, user, service);
ApplicationLogReader reader = new ApplicationLogReader(application, user, service);
- int toMatchIndex = 0;
- for (int character = -1; (character = reader.read()) != -1;) {
+ int charactersRead = 0;
+ int character = -1;
+ while (charactersRead < ApplicationResponseFake.log.length()
+ && (character = reader.read()) != -1) {
+ char characterToMatch = ApplicationResponseFake.log.charAt(charactersRead++);
assertEquals(
- "character at position " + toMatchIndex
- + " was '" + ((char) character) + "'"
- + " but we expected '" + ApplicationResponseFake.log.charAt(toMatchIndex) + "'.",
- ApplicationResponseFake.log.charAt(toMatchIndex++), character);
+ "character at position " + charactersRead
+ + " was '" + character + "'"
+ + " but we expected '" + characterToMatch + "'.",
+ characterToMatch, character);
}
}
private IApplication createApplication(OpenshiftService userInfoService, User user) {
Application application = new Application(
ApplicationResponseFake.APPLICATION_NAME
- , ApplicationResponseFake.APPLICATION_UUID
, ApplicationResponseFake.APPLICATION_CARTRIDGE
- , ApplicationResponseFake.APPLICATION_EMBEDDED
- , ApplicationResponseFake.APPLICATION_CREATIONTIME
+ , new ApplicationInfo(
+ ApplicationResponseFake.APPLICATION_NAME
+ , ApplicationResponseFake.APPLICATION_UUID
+ , ApplicationResponseFake.APPLICATION_EMBEDDED
+ , ApplicationResponseFake.APPLICATION_CARTRIDGE
+ , ApplicationResponseFake.APPLICATION_CREATIONTIME)
, user
, userInfoService);
/**
- * we have to add it manually since we dont create the application with the user class
+ * we have to add it manually since we dont create the application with
+ * the user class
*
* @see User#createApplication
*/
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-27 15:19:36 UTC (rev 35061)
+++ 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-27 15:33:52 UTC (rev 35062)
@@ -69,6 +69,7 @@
public static void assertApplication(String name, String uuid, String cartridgeName, String embedded,
String creationTime, IApplication application) throws OpenshiftException {
+ assertNotNull(application);
assertEquals(embedded, application.getEmbedded());
assertEquals(uuid, application.getUUID());
assertNotNull(application.getCartridge());
14 years, 2 months
JBoss Tools SVN: r35059 - trunk/central/plugins/org.jboss.tools.central/META-INF.
by jbosstools-commits@lists.jboss.org
Author: nickboldt
Date: 2011-09-27 11:10:52 -0400 (Tue, 27 Sep 2011)
New Revision: 35059
Modified:
trunk/central/plugins/org.jboss.tools.central/META-INF/MANIFEST.MF
Log:
point Bundle-Vendor at %BundleVendor instead of %BundleName
Modified: trunk/central/plugins/org.jboss.tools.central/META-INF/MANIFEST.MF
===================================================================
--- trunk/central/plugins/org.jboss.tools.central/META-INF/MANIFEST.MF 2011-09-27 15:10:39 UTC (rev 35058)
+++ trunk/central/plugins/org.jboss.tools.central/META-INF/MANIFEST.MF 2011-09-27 15:10:52 UTC (rev 35059)
@@ -28,4 +28,4 @@
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-Localization: plugin
-Bundle-Vendor: %BundleName
+Bundle-Vendor: %BundleVendor
14 years, 2 months