Author: adietish
Date: 2011-09-26 06:04:04 -0400 (Mon, 26 Sep 2011)
New Revision: 35038
Added:
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/ICartridge.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/ApplicationInfo.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/IOpenshiftJsonConstants.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/SSHPublicKey.java
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/UserInfo.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/unmarshalling/
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/unmarshalling/AbstractOpenshiftJsonResponseUnmarshaller.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/ApplicationStatusResponseUnmarshaller.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/response/unmarshalling/JsonSanitizer.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/unmarshalling/ListCartridgesResponseUnmarshaller.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/unmarshalling/UserInfoResponseUnmarshaller.java
Removed:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/Application.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/ApplicationInfo.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/Domain.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/IOpenshiftJsonConstants.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/IOpenshiftService.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/SSHPublicKey.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/User.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/UserInfo.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/AbstractOpenshiftJsonResponseUnmarshaller.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/ApplicationResponseUnmarshaller.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/ApplicationStatusResponseUnmarshaller.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/DomainResponseUnmarshaller.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/JsonSanitizer.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/ListCartridgesResponseUnmarshaller.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/UserInfoResponseUnmarshaller.java
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/META-INF/MANIFEST.MF
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/ApplicationLogReader.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/Cartridge.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/IHttpClient.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/IUser.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/OpenshiftService.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/httpclient/UrlConnectionHttpClient.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/request/ApplicationRequest.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/request/marshalling/AbstractJsonMarshaller.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/request/marshalling/ApplicationRequestJsonMarshaller.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/request/marshalling/DomainRequestJsonMarshaller.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/request/marshalling/ListCartridgesRequestJsonMarshaller.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/CartridgeTest.java
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/CartridgesIntegrationTest.java
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/DomainIntegrationTest.java
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/DomainTest.java
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/JsonSanitizerTest.java
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/ListCartridgesIntegrationTest.java
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/ListCartridgesTest.java
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/UserInfoIntegrationTest.java
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/UserInfoTest.java
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/UserTest.java
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/fakes/ApplicationResponseFake.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/utils/ApplicationAsserts.java
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/utils/ApplicationInfoAsserts.java
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/utils/CartridgeAsserts.java
Log:
[JBIDE-9762] cleaned package structure, accessible API
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/META-INF/MANIFEST.MF
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/META-INF/MANIFEST.MF 2011-09-26
08:56:14 UTC (rev 35037)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/META-INF/MANIFEST.MF 2011-09-26
10:04:04 UTC (rev 35038)
@@ -17,4 +17,5 @@
org.jboss.ide.eclipse.as.openshift.core.internal.request;x-friends:="org.jboss.ide.eclipse.as.openshift.test",
org.jboss.ide.eclipse.as.openshift.core.internal.request.marshalling;x-friends:="org.jboss.ide.eclipse.as.openshift.test",
org.jboss.ide.eclipse.as.openshift.core.internal.response;x-friends:="org.jboss.ide.eclipse.as.openshift.test",
+
org.jboss.ide.eclipse.as.openshift.core.internal.response.unmarshalling;x-friends:="org.jboss.ide.eclipse.as.openshift.test",
org.jboss.ide.eclipse.as.openshift.core.internal.utils;x-friends:="org.jboss.ide.eclipse.as.openshift.test"
Deleted:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/Application.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/Application.java 2011-09-26
08:56:14 UTC (rev 35037)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/Application.java 2011-09-26
10:04:04 UTC (rev 35038)
@@ -1,147 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at
http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.ide.eclipse.as.openshift.core;
-
-import java.text.MessageFormat;
-import java.util.Date;
-
-/**
- * @author André Dietisheim
- */
-public class Application {
-
- 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 Cartridge cartridge;
- private String uuid;
- private Date creationTime;
- private String embedded;
- private IOpenshiftService service;
- private ApplicationLogReader logReader;
-
- private User user;
-
- public Application(String name, Cartridge cartridge, User user, IOpenshiftService
service) {
- this(name, null, cartridge, null, null, user, service);
- }
-
- public Application(String name, String uuid, Cartridge cartridge, String embedded, Date
creationTime, User user,
- IOpenshiftService service) {
- this.name = name;
- this.cartridge = cartridge;
- this.uuid = uuid;
- this.embedded = embedded;
- this.creationTime = creationTime;
- this.user = user;
- this.service = service;
- }
-
- public String getName() {
- return name;
- }
-
- public String getUUID() throws OpenshiftException {
- user.loadLazyValues();
- return uuid;
- }
-
- public Cartridge getCartridge() {
- return cartridge;
- }
-
- public String getEmbedded() throws OpenshiftException {
- user.loadLazyValues();
- return embedded;
- }
-
- public Date getCreationTime() throws OpenshiftException {
- user.loadLazyValues();
- return creationTime;
- }
-
- public void destroy() throws OpenshiftException {
- service.destroyApplication(name, cartridge, user);
- }
-
- public void start() throws OpenshiftException {
- service.startApplication(name, cartridge, user);
- }
-
- public void restart() throws OpenshiftException {
- service.restartApplication(name, cartridge, user);
- }
-
- public void stop() throws OpenshiftException {
- service.stopApplication(name, cartridge, user);
- }
-
- public ApplicationLogReader getLog() throws OpenshiftException {
- if (logReader == null) {
- this.logReader = new ApplicationLogReader(this, user, service);
- }
- return logReader;
- }
-
- public String getGitUri() throws OpenshiftException {
- Domain domain = user.getDomain();
- if (domain == null) {
- return null;
- }
- return MessageFormat
- .format(GIT_URI_PATTERN, getUUID(), getName(), domain.getNamespace(),
domain.getRhcDomain());
- }
-
- public String getApplicationUrl() throws OpenshiftException {
- Domain domain = user.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();
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((name == null) ? 0 : name.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object object) {
- if (this == object)
- return true;
- if (object == null)
- return false;
- if (getClass() != object.getClass())
- return false;
- Application other = (Application) object;
- if (name == null) {
- if (other.name != null)
- return false;
- } else if (!name.equals(other.name))
- return false;
- return true;
- }
-
-}
Deleted:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/ApplicationInfo.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/ApplicationInfo.java 2011-09-26
08:56:14 UTC (rev 35037)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/ApplicationInfo.java 2011-09-26
10:04:04 UTC (rev 35038)
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at
http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.ide.eclipse.as.openshift.core;
-
-import java.util.Date;
-
-/**
- * @author André Dietisheim
- */
-public class ApplicationInfo {
-
- private String name;
- private String uuid;
- private String embedded;
- private Cartridge cartridge;
- private Date creationTime;
-
- public ApplicationInfo(String name, String uuid, String embedded, Cartridge cartridge,
Date creationTime) {
- this.name = name;
- this.uuid = uuid;
- this.embedded = embedded;
- this.cartridge = cartridge;
- this.creationTime = creationTime;
- }
-
- public String getName() {
- return name;
- }
-
- public String getEmbedded() {
- return embedded;
- }
-
- public String getUuid() {
- return uuid;
- }
-
- public Cartridge getCartridge() {
- return cartridge;
- }
-
- public Date getCreationTime() {
- return creationTime;
- }
-
-}
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-26
08:56:14 UTC (rev 35037)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/ApplicationLogReader.java 2011-09-26
10:04:04 UTC (rev 35038)
@@ -16,6 +16,10 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+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;
+
/**
* 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
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/Cartridge.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/Cartridge.java 2011-09-26
08:56:14 UTC (rev 35037)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/Cartridge.java 2011-09-26
10:04:04 UTC (rev 35038)
@@ -11,26 +11,25 @@
package org.jboss.ide.eclipse.as.openshift.core;
/**
- * CA cartridge that is available on the openshift server. This class is no enum
+ * A cartridge that is available on the openshift server. This class is no enum
* since we dont know all available types and they may change at any time.
*
* @author André Dietisheim
*/
-public class Cartridge {
+public class Cartridge implements ICartridge {
- public static final Cartridge JBOSSAS_7 = new Cartridge("jbossas-7.0");
-
private String name;
public Cartridge(String name) {
this.name = name;
}
+ @Override
public String getName() {
return name;
}
- public static Cartridge valueOf(String name) {
+ public static ICartridge valueOf(String name) {
if (JBOSSAS_7.getName().equals(name)) {
return JBOSSAS_7;
}
Deleted:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/Domain.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/Domain.java 2011-09-26
08:56:14 UTC (rev 35037)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/Domain.java 2011-09-26
10:04:04 UTC (rev 35038)
@@ -1,46 +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;
-
-
-/**
- * @author André Dietisheim
- */
-public class Domain {
-
- 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) {
- this.namespace = namespace;
- this.rhcDomain = rhcDomain;
- this.user = user;
- }
-
- public String getNamespace() throws OpenshiftException {
- return namespace;
- }
-
- public String getRhcDomain() throws OpenshiftException {
- user.loadLazyValues();
- return rhcDomain;
- }
-
- void update(UserInfo userInfo) {
- this.rhcDomain = userInfo.getRhcDomain();
- this.namespace = userInfo.getNamespace();
- }
-}
Added:
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
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/IApplication.java 2011-09-26
10:04:04 UTC (rev 35038)
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.ide.eclipse.as.openshift.core;
+
+import java.util.Date;
+
+/**
+ * @author André Dietisheim
+ */
+public interface IApplication {
+
+ public abstract String getUUID() throws OpenshiftException;
+
+ public abstract ICartridge getCartridge();
+
+ public abstract String getEmbedded() throws OpenshiftException;
+
+ public abstract Date getCreationTime() throws OpenshiftException;
+
+ public abstract void destroy() throws OpenshiftException;
+
+ public abstract void start() throws OpenshiftException;
+
+ public abstract void restart() throws OpenshiftException;
+
+ public abstract void stop() throws OpenshiftException;
+
+ public abstract ApplicationLogReader getLog() throws OpenshiftException;
+
+ public abstract String getGitUri() throws OpenshiftException;
+
+ public abstract String getApplicationUrl() throws OpenshiftException;
+
+}
\ No newline at end of file
Property changes on:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/IApplication.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/ICartridge.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/ICartridge.java
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/ICartridge.java 2011-09-26
10:04:04 UTC (rev 35038)
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.ide.eclipse.as.openshift.core;
+
+/**
+ * @author André Dietisheim
+ */
+public interface ICartridge {
+
+ public static final ICartridge JBOSSAS_7 = new Cartridge("jbossas-7.0");
+
+ public abstract String getName();
+
+}
\ No newline at end of file
Property changes on:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/ICartridge.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/IHttpClient.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/IHttpClient.java 2011-09-26
08:56:14 UTC (rev 35037)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/IHttpClient.java 2011-09-26
10:04:04 UTC (rev 35038)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
package org.jboss.ide.eclipse.as.openshift.core;
import org.jboss.ide.eclipse.as.openshift.core.internal.httpclient.HttpClientException;
@@ -2,2 +12,5 @@
+/**
+ * @author André Dietisheim
+ */
public interface IHttpClient {
Deleted:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/IOpenshiftJsonConstants.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/IOpenshiftJsonConstants.java 2011-09-26
08:56:14 UTC (rev 35037)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/IOpenshiftJsonConstants.java 2011-09-26
10:04:04 UTC (rev 35038)
@@ -1,43 +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;
-
-/**
- * @author André Dietisheim
- */
-public class IOpenshiftJsonConstants {
-
- public static final String PROPERTY_DEBUG = "debug";
- public static final String PROPERTY_RHLOGIN = "rhlogin";
-
- public static final String PROPERTY_CART_TYPE = "cart_type";
-
- public static final String PROPERTY_MESSAGES = "messages";
- public static final String PROPERTY_RESULT = "result";
- public static final String PROPERTY_EXIT_CODE = "exit_code";
- public static final String PROPERTY_DATA = "data";
- public static final String PROPERTY_APP_NAME = "app_name";
- public static final String PROPERTY_ACTION = "action";
- public static final String PROPERTY_CARTRIDGE = "cartridge";
- public static final String PROPERTY_CARTS = "carts";
- public static final String PROPERTY_NAMESPACE = "namespace";
- public static final String PROPERTY_ALTER = "alter";
- public static final String PROPERTY_SSH = "ssh";
- public static final String PROPERTY_UUID = "uuid";
- public static final String PROPERTY_USER_INFO = "user_info";
- public static final String PROPERTY_APP_INFO = "app_info";
- public static final String PROPERTY_RHC_DOMAIN = "rhc_domain";
- public static final String PROPERTY_EMBEDDED = "embedded";
- public static final String PROPERTY_FRAMEWORK = "framework";
- public static final String PROPERTY_CREATION_TIME = "creation_time";
- public static final String PROPERTY_SSH_KEY = "ssh_key";
-
-}
Deleted:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/IOpenshiftService.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/IOpenshiftService.java 2011-09-26
08:56:14 UTC (rev 35037)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/IOpenshiftService.java 2011-09-26
10:04:04 UTC (rev 35038)
@@ -1,39 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at
http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.ide.eclipse.as.openshift.core;
-
-import java.util.List;
-
-/**
- * @author André Dietisheim
- */
-public interface IOpenshiftService {
-
- public UserInfo getUserInfo(User user) throws OpenshiftException;
-
- public List<Cartridge> getCartridges(User user) throws OpenshiftException;
-
- public Application createApplication(String name, Cartridge cartridge, User user) throws
OpenshiftException;
-
- public void destroyApplication(String name, Cartridge cartridge, User user) throws
OpenshiftException;
-
- public Application startApplication(String name, Cartridge cartridge, User user) throws
OpenshiftException;
-
- public Application restartApplication(String name, Cartridge cartridge, User user)
throws OpenshiftException;
-
- public Application stopApplication(String name, Cartridge cartridge, User user) throws
OpenshiftException;
-
- public String getStatus(String name, Cartridge cartridge, User user) throws
OpenshiftException;
-
- public Domain changeDomain(String name, ISSHPublicKey sshKey, User user) throws
OpenshiftException;
-
- public Domain createDomain(String name, ISSHPublicKey sshKey, User user) throws
OpenshiftException;
-}
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/IUser.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/IUser.java 2011-09-26
08:56:14 UTC (rev 35037)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/IUser.java 2011-09-26
10:04:04 UTC (rev 35038)
@@ -12,6 +12,9 @@
import java.util.Collection;
+import org.jboss.ide.eclipse.as.openshift.core.internal.Application;
+import org.jboss.ide.eclipse.as.openshift.core.internal.Domain;
+
/**
* @author André Dietisheim
*/
Deleted:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/SSHPublicKey.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/SSHPublicKey.java 2011-09-26
08:56:14 UTC (rev 35037)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/SSHPublicKey.java 2011-09-26
10:04:04 UTC (rev 35038)
@@ -1,34 +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;
-
-/**
- * @author André Dietisheim
- */
-public class SSHPublicKey implements ISSHPublicKey {
-
- private String publicKey;
-
- public SSHPublicKey(String publicKey) {
- this.publicKey = publicKey;
- }
-
- public String getPublicKey() {
- return publicKey;
- }
-
- void update(String publicKey) {
- }
-
- public void update(ISSHPublicKey sshPublicKey) throws OpenshiftException {
- this.publicKey = sshPublicKey.getPublicKey();
- }
-}
Deleted:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/User.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/User.java 2011-09-26
08:56:14 UTC (rev 35037)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/User.java 2011-09-26
10:04:04 UTC (rev 35038)
@@ -1,179 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at
http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.ide.eclipse.as.openshift.core;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-
-import org.jboss.ide.eclipse.as.openshift.core.internal.OpenshiftService;
-
-/**
- * @author André Dietisheim
- */
-public class User implements IUser {
-
- private String rhlogin;
- private String password;
- private String uuid;
- private ISSHPublicKey sshKey;
- private Domain domain;
- private UserInfo userInfo;
- private List<Cartridge> cartridges;
- private List<Application> applications = new ArrayList<Application>();
-
- private OpenshiftService service;
-
- public User(String rhlogin, String password) {
- this(rhlogin, password, (ISSHPublicKey) null, new OpenshiftService());
- }
-
- public User(String rhlogin, String password, OpenshiftService service) {
- this(rhlogin, password, (ISSHPublicKey) null, service);
- }
-
- public User(String rhlogin, String password, ISSHPublicKey sshKey, OpenshiftService
service) {
- this.rhlogin = rhlogin;
- this.password = password;
- this.sshKey = sshKey;
- this.service = service;
- }
-
- @Override
- public Domain getDomain() throws OpenshiftException {
- loadLazyValues();
- return domain;
- }
-
- @Override
- public ISSHPublicKey getSshKey() throws OpenshiftException {
- loadLazyValues();
- return sshKey;
- }
-
- @Override
- public String getRhlogin() {
- return rhlogin;
- }
-
- @Override
- public String getPassword() {
- return password;
- }
-
- public String getUUID() throws OpenshiftException {
- loadLazyValues();
- return uuid;
- }
-
- @Override
- public List<Cartridge> getCartridges() throws OpenshiftException {
- if (cartridges == null) {
- this.cartridges = service.getCartridges(this);
- }
- return Collections.unmodifiableList(cartridges);
- }
-
- @Override
- public Collection<Application> getApplications() throws OpenshiftException {
- loadLazyValues();
- return Collections.unmodifiableList(applications);
- }
-
- public Application getApplicationByName(String name) throws OpenshiftException {
- loadLazyValues();
- return getApplicationByName(name, applications);
- }
-
- private Application getApplicationByName(String name, Collection<Application>
applications) {
- Application matchingApplication = null;
- for (Application application : applications) {
- if (name.equals(application.getName())) {
- matchingApplication = application;
- }
- }
- return matchingApplication;
- }
-
- public void add(Application application) {
- applications.add(application);
- }
-
- public void remove(Application application) {
- applications.remove(application);
- }
-
- /**
- * 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 {
- if (userInfo == null) {
- refresh();
- }
- }
-
- public void refresh() throws OpenshiftException {
- this.userInfo = service.getUserInfo(this);
- update(userInfo);
- }
-
- 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) {
- Application application = getApplicationByName(applicationInfo.getName(),
applications);
- if (application != null) {
- application.update(applicationInfo);
- } else {
- applications.add(createApplication(applicationInfo));
- }
- }
- }
-
- private Application createApplication(ApplicationInfo applicationInfo) {
- return new Application(applicationInfo.getName()
- , applicationInfo.getUuid()
- , applicationInfo.getCartridge()
- , applicationInfo.getEmbedded()
- , applicationInfo.getCreationTime()
- , this, service);
- }
-
- public void setSshPublicKey(ISSHPublicKey key) {
- this.sshKey = key;
- }
-}
Deleted:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/UserInfo.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/UserInfo.java 2011-09-26
08:56:14 UTC (rev 35037)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/UserInfo.java 2011-09-26
10:04:04 UTC (rev 35038)
@@ -1,71 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at
http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.ide.eclipse.as.openshift.core;
-
-import java.util.List;
-
-/**
- * @author André Dietisheim
- */
-public class UserInfo {
-
- private String rhLogin;
- private String uuid;
- private SSHPublicKey sshPublicKey;
- private String rhcDomain;
- private String namespace;
- private List<ApplicationInfo> applicationInfos;
-
- public UserInfo(String rhLogin, String uuid, String sshPublicKey, String rhcDomain,
String namespace, List<ApplicationInfo> applicationInfos) {
- this.rhLogin = rhLogin;
- this.uuid = uuid;
- this.sshPublicKey = new SSHPublicKey(sshPublicKey);
- this.rhcDomain = rhcDomain;
- this.namespace = namespace;
- this.applicationInfos = applicationInfos;
- }
-
- public String getUuid() {
- return uuid;
- }
-
- public SSHPublicKey getSshPublicKey() {
- return sshPublicKey;
- }
-
- public String getRhLogin() {
- return rhLogin;
- }
-
- public String getNamespace() {
- return namespace;
- }
-
- public List<ApplicationInfo> getApplicationInfos() {
- return applicationInfos;
- }
-
- public ApplicationInfo getApplicationInfoByName(String name) {
- ApplicationInfo matchingApplicationInfo = null;
- for (ApplicationInfo applicationInfo : applicationInfos) {
- if (name.equals(applicationInfo.getName())) {
- matchingApplicationInfo = applicationInfo;
- break;
- }
- }
- return matchingApplicationInfo;
- }
-
- public String getRhcDomain() {
- return rhcDomain;
- }
-
-}
Copied:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/Application.java
(from rev 35036,
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/Application.java)
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/Application.java
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/Application.java 2011-09-26
10:04:04 UTC (rev 35038)
@@ -0,0 +1,163 @@
+/*******************************************************************************
+ * 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.text.MessageFormat;
+import java.util.Date;
+
+import org.jboss.ide.eclipse.as.openshift.core.ApplicationLogReader;
+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.OpenshiftException;
+
+/**
+ * @author André Dietisheim
+ */
+public class Application 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 User user;
+
+ public Application(String name, ICartridge cartridge, User user, IOpenshiftService
service) {
+ this(name, null, cartridge, null, null, user, service);
+ }
+
+ public Application(String name, String uuid, ICartridge cartridge, String embedded, Date
creationTime, User user,
+ IOpenshiftService service) {
+ this.name = name;
+ this.cartridge = cartridge;
+ this.uuid = uuid;
+ this.embedded = embedded;
+ this.creationTime = creationTime;
+ this.user = user;
+ this.service = service;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ @Override
+ public String getUUID() throws OpenshiftException {
+ user.loadLazyValues();
+ return uuid;
+ }
+
+ @Override
+ public ICartridge getCartridge() {
+ return cartridge;
+ }
+
+ @Override
+ public String getEmbedded() throws OpenshiftException {
+ user.loadLazyValues();
+ return embedded;
+ }
+
+ @Override
+ public Date getCreationTime() throws OpenshiftException {
+ user.loadLazyValues();
+ return creationTime;
+ }
+
+ @Override
+ public void destroy() throws OpenshiftException {
+ service.destroyApplication(name, cartridge, user);
+ }
+
+ @Override
+ public void start() throws OpenshiftException {
+ service.startApplication(name, cartridge, user);
+ }
+
+ @Override
+ public void restart() throws OpenshiftException {
+ service.restartApplication(name, cartridge, user);
+ }
+
+ @Override
+ public void stop() throws OpenshiftException {
+ service.stopApplication(name, cartridge, user);
+ }
+
+ @Override
+ public ApplicationLogReader getLog() throws OpenshiftException {
+ if (logReader == null) {
+ this.logReader = new ApplicationLogReader(this, user, service);
+ }
+ return logReader;
+ }
+
+ @Override
+ public String getGitUri() throws OpenshiftException {
+ Domain domain = user.getDomain();
+ if (domain == null) {
+ return null;
+ }
+ return MessageFormat
+ .format(GIT_URI_PATTERN, getUUID(), getName(), domain.getNamespace(),
domain.getRhcDomain());
+ }
+
+ @Override
+ public String getApplicationUrl() throws OpenshiftException {
+ Domain domain = user.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();
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((name == null) ? 0 : name.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object object) {
+ if (this == object)
+ return true;
+ if (object == null)
+ return false;
+ if (getClass() != object.getClass())
+ return false;
+ Application other = (Application) object;
+ if (name == null) {
+ if (other.name != null)
+ return false;
+ } else if (!name.equals(other.name))
+ return false;
+ return true;
+ }
+
+}
Property changes on:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/Application.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Copied:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/ApplicationInfo.java
(from rev 35033,
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/ApplicationInfo.java)
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/ApplicationInfo.java
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/ApplicationInfo.java 2011-09-26
10:04:04 UTC (rev 35038)
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * 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.Date;
+
+import org.jboss.ide.eclipse.as.openshift.core.ICartridge;
+
+/**
+ * @author André Dietisheim
+ */
+public class ApplicationInfo {
+
+ private String name;
+ private String uuid;
+ private String embedded;
+ private ICartridge cartridge;
+ private Date creationTime;
+
+ public ApplicationInfo(String name, String uuid, String embedded, ICartridge cartridge,
Date creationTime) {
+ this.name = name;
+ this.uuid = uuid;
+ this.embedded = embedded;
+ this.cartridge = cartridge;
+ this.creationTime = creationTime;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getEmbedded() {
+ return embedded;
+ }
+
+ public String getUuid() {
+ return uuid;
+ }
+
+ public ICartridge getCartridge() {
+ return cartridge;
+ }
+
+ public Date getCreationTime() {
+ return creationTime;
+ }
+
+}
Property changes on:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/ApplicationInfo.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Copied:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/Domain.java
(from rev 35033,
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/Domain.java)
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/Domain.java
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/Domain.java 2011-09-26
10:04:04 UTC (rev 35038)
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * 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;
+
+
+/**
+ * @author André Dietisheim
+ */
+public class Domain {
+
+ 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) {
+ this.namespace = namespace;
+ this.rhcDomain = rhcDomain;
+ this.user = user;
+ }
+
+ public String getNamespace() throws OpenshiftException {
+ return namespace;
+ }
+
+ public String getRhcDomain() throws OpenshiftException {
+ user.loadLazyValues();
+ return rhcDomain;
+ }
+
+ void update(UserInfo userInfo) {
+ this.rhcDomain = userInfo.getRhcDomain();
+ this.namespace = userInfo.getNamespace();
+ }
+}
Property changes on:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/Domain.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Copied:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/IOpenshiftJsonConstants.java
(from rev 35033,
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/IOpenshiftJsonConstants.java)
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/IOpenshiftJsonConstants.java
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/IOpenshiftJsonConstants.java 2011-09-26
10:04:04 UTC (rev 35038)
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * 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;
+
+/**
+ * @author André Dietisheim
+ */
+public class IOpenshiftJsonConstants {
+
+ public static final String PROPERTY_DEBUG = "debug";
+ public static final String PROPERTY_RHLOGIN = "rhlogin";
+
+ public static final String PROPERTY_CART_TYPE = "cart_type";
+
+ public static final String PROPERTY_MESSAGES = "messages";
+ public static final String PROPERTY_RESULT = "result";
+ public static final String PROPERTY_EXIT_CODE = "exit_code";
+ public static final String PROPERTY_DATA = "data";
+ public static final String PROPERTY_APP_NAME = "app_name";
+ public static final String PROPERTY_ACTION = "action";
+ public static final String PROPERTY_CARTRIDGE = "cartridge";
+ public static final String PROPERTY_CARTS = "carts";
+ public static final String PROPERTY_NAMESPACE = "namespace";
+ public static final String PROPERTY_ALTER = "alter";
+ public static final String PROPERTY_SSH = "ssh";
+ public static final String PROPERTY_UUID = "uuid";
+ public static final String PROPERTY_USER_INFO = "user_info";
+ public static final String PROPERTY_APP_INFO = "app_info";
+ public static final String PROPERTY_RHC_DOMAIN = "rhc_domain";
+ public static final String PROPERTY_EMBEDDED = "embedded";
+ public static final String PROPERTY_FRAMEWORK = "framework";
+ public static final String PROPERTY_CREATION_TIME = "creation_time";
+ public static final String PROPERTY_SSH_KEY = "ssh_key";
+
+}
Property changes on:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/IOpenshiftJsonConstants.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Copied:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/IOpenshiftService.java
(from rev 35034,
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/IOpenshiftService.java)
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/IOpenshiftService.java
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/IOpenshiftService.java 2011-09-26
10:04:04 UTC (rev 35038)
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * 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.List;
+
+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.ICartridge;
+import org.jboss.ide.eclipse.as.openshift.core.ISSHPublicKey;
+import org.jboss.ide.eclipse.as.openshift.core.OpenshiftException;
+
+/**
+ * @author André Dietisheim
+ */
+public interface IOpenshiftService {
+
+ public List<Cartridge> getCartridges(User user) throws OpenshiftException;
+
+ public Application createApplication(String name, ICartridge cartridge, User user)
throws OpenshiftException;
+
+ public void destroyApplication(String name, ICartridge cartridge, User user) throws
OpenshiftException;
+
+ public IApplication startApplication(String name, ICartridge cartridge, User user)
throws OpenshiftException;
+
+ public IApplication restartApplication(String name, ICartridge cartridge, User user)
throws OpenshiftException;
+
+ public IApplication stopApplication(String name, ICartridge cartridge, User user) throws
OpenshiftException;
+
+ public String getStatus(String name, ICartridge cartridge, User user) throws
OpenshiftException;
+
+ public Domain changeDomain(String name, ISSHPublicKey sshKey, User user) throws
OpenshiftException;
+
+ public Domain createDomain(String name, ISSHPublicKey sshKey, User user) throws
OpenshiftException;
+
+ public UserInfo getUserInfo(User user) throws OpenshiftException;
+}
Property changes on:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/IOpenshiftService.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-26
08:56:14 UTC (rev 35037)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/OpenshiftService.java 2011-09-26
10:04:04 UTC (rev 35038)
@@ -14,17 +14,14 @@
import java.net.URL;
import java.util.List;
-import org.jboss.ide.eclipse.as.openshift.core.Application;
import org.jboss.ide.eclipse.as.openshift.core.Cartridge;
-import org.jboss.ide.eclipse.as.openshift.core.Domain;
+import org.jboss.ide.eclipse.as.openshift.core.IApplication;
+import org.jboss.ide.eclipse.as.openshift.core.ICartridge;
import org.jboss.ide.eclipse.as.openshift.core.IHttpClient;
-import org.jboss.ide.eclipse.as.openshift.core.IOpenshiftService;
import org.jboss.ide.eclipse.as.openshift.core.ISSHPublicKey;
import org.jboss.ide.eclipse.as.openshift.core.InvalidCredentialsOpenshiftException;
import org.jboss.ide.eclipse.as.openshift.core.OpenshiftEndpointException;
import org.jboss.ide.eclipse.as.openshift.core.OpenshiftException;
-import org.jboss.ide.eclipse.as.openshift.core.User;
-import org.jboss.ide.eclipse.as.openshift.core.UserInfo;
import org.jboss.ide.eclipse.as.openshift.core.internal.httpclient.HttpClientException;
import
org.jboss.ide.eclipse.as.openshift.core.internal.httpclient.UnauthorizedException;
import
org.jboss.ide.eclipse.as.openshift.core.internal.httpclient.UrlConnectionHttpClient;
@@ -40,13 +37,13 @@
import
org.jboss.ide.eclipse.as.openshift.core.internal.request.marshalling.DomainRequestJsonMarshaller;
import
org.jboss.ide.eclipse.as.openshift.core.internal.request.marshalling.ListCartridgesRequestJsonMarshaller;
import
org.jboss.ide.eclipse.as.openshift.core.internal.request.marshalling.UserInfoRequestJsonMarshaller;
-import
org.jboss.ide.eclipse.as.openshift.core.internal.response.ApplicationResponseUnmarshaller;
-import
org.jboss.ide.eclipse.as.openshift.core.internal.response.ApplicationStatusResponseUnmarshaller;
-import
org.jboss.ide.eclipse.as.openshift.core.internal.response.DomainResponseUnmarshaller;
-import org.jboss.ide.eclipse.as.openshift.core.internal.response.JsonSanitizer;
-import
org.jboss.ide.eclipse.as.openshift.core.internal.response.ListCartridgesResponseUnmarshaller;
import org.jboss.ide.eclipse.as.openshift.core.internal.response.OpenshiftResponse;
-import
org.jboss.ide.eclipse.as.openshift.core.internal.response.UserInfoResponseUnmarshaller;
+import
org.jboss.ide.eclipse.as.openshift.core.internal.response.unmarshalling.ApplicationResponseUnmarshaller;
+import
org.jboss.ide.eclipse.as.openshift.core.internal.response.unmarshalling.ApplicationStatusResponseUnmarshaller;
+import
org.jboss.ide.eclipse.as.openshift.core.internal.response.unmarshalling.DomainResponseUnmarshaller;
+import
org.jboss.ide.eclipse.as.openshift.core.internal.response.unmarshalling.JsonSanitizer;
+import
org.jboss.ide.eclipse.as.openshift.core.internal.response.unmarshalling.ListCartridgesResponseUnmarshaller;
+import
org.jboss.ide.eclipse.as.openshift.core.internal.response.unmarshalling.UserInfoResponseUnmarshaller;
/**
* @author André Dietisheim
@@ -55,6 +52,7 @@
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);
String url = request.getUrlString(BASE_URL);
@@ -128,7 +126,7 @@
}
@Override
- public Application createApplication(String name, Cartridge cartridge, User user) throws
OpenshiftException {
+ public Application createApplication(String name, ICartridge cartridge, User user)
throws OpenshiftException {
Application application = requestApplicationAction(new ApplicationRequest(name,
cartridge, ApplicationAction.CONFIGURE,
user.getRhlogin(), true), user);
user.add(application);
@@ -136,26 +134,26 @@
}
@Override
- public void destroyApplication(String name, Cartridge cartridge, User user) throws
OpenshiftException {
- Application application = requestApplicationAction(new ApplicationRequest(name,
cartridge, ApplicationAction.DECONFIGURE,
+ public void destroyApplication(String name, ICartridge cartridge, User user) throws
OpenshiftException {
+ IApplication application = requestApplicationAction(new ApplicationRequest(name,
cartridge, ApplicationAction.DECONFIGURE,
user.getRhlogin(), true), user);
user.remove(application);
}
@Override
- public Application startApplication(String name, Cartridge cartridge, User user) throws
OpenshiftException {
+ public IApplication startApplication(String name, ICartridge cartridge, User user)
throws OpenshiftException {
return requestApplicationAction(new ApplicationRequest(name, cartridge,
ApplicationAction.START,
user.getRhlogin(), true), user);
}
@Override
- public Application restartApplication(String name, Cartridge cartridge, User user)
throws OpenshiftException {
+ public IApplication restartApplication(String name, ICartridge cartridge, User user)
throws OpenshiftException {
return requestApplicationAction(new ApplicationRequest(name, cartridge,
ApplicationAction.RESTART,
user.getRhlogin(), true), user);
}
@Override
- public Application stopApplication(String name, Cartridge cartridge, User user) throws
OpenshiftException {
+ public IApplication stopApplication(String name, ICartridge cartridge, User user) throws
OpenshiftException {
return requestApplicationAction(new ApplicationRequest(name, cartridge,
ApplicationAction.STOP,
user.getRhlogin(), true), user);
}
@@ -172,7 +170,7 @@
* ,"app_name","api"],"exit_code":0}
*/
@Override
- public String getStatus(String applicationName, Cartridge cartridge, User user) throws
OpenshiftException {
+ public String getStatus(String applicationName, ICartridge cartridge, User user) throws
OpenshiftException {
ApplicationRequest applicationRequest =
new ApplicationRequest(applicationName, cartridge, ApplicationAction.STATUS,
user.getRhlogin(), true);
String url = applicationRequest.getUrlString(BASE_URL);
Copied:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/SSHPublicKey.java
(from rev 35033,
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/SSHPublicKey.java)
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/SSHPublicKey.java
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/SSHPublicKey.java 2011-09-26
10:04:04 UTC (rev 35038)
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * 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.ISSHPublicKey;
+import org.jboss.ide.eclipse.as.openshift.core.OpenshiftException;
+
+/**
+ * @author André Dietisheim
+ */
+public class SSHPublicKey implements ISSHPublicKey {
+
+ private String publicKey;
+
+ public SSHPublicKey(String publicKey) {
+ this.publicKey = publicKey;
+ }
+
+ public String getPublicKey() {
+ return publicKey;
+ }
+
+ void update(String publicKey) {
+ }
+
+ public void update(ISSHPublicKey sshPublicKey) throws OpenshiftException {
+ this.publicKey = sshPublicKey.getPublicKey();
+ }
+}
Property changes on:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/SSHPublicKey.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Copied:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/User.java
(from rev 35034,
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/User.java
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/User.java 2011-09-26
10:04:04 UTC (rev 35038)
@@ -0,0 +1,183 @@
+/*******************************************************************************
+ * 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.Cartridge;
+import org.jboss.ide.eclipse.as.openshift.core.IApplication;
+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 String uuid;
+ private ISSHPublicKey sshKey;
+ private Domain domain;
+ private UserInfo userInfo;
+ private List<Cartridge> cartridges;
+ private List<Application> applications = new ArrayList<Application>();
+
+ private OpenshiftService service;
+
+ public User(String rhlogin, String password) {
+ this(rhlogin, password, (ISSHPublicKey) null, new OpenshiftService());
+ }
+
+ public User(String rhlogin, String password, OpenshiftService service) {
+ this(rhlogin, password, (ISSHPublicKey) null, service);
+ }
+
+ public User(String rhlogin, String password, ISSHPublicKey sshKey, OpenshiftService
service) {
+ this.rhlogin = rhlogin;
+ this.password = password;
+ this.sshKey = sshKey;
+ this.service = service;
+ }
+
+ @Override
+ public Domain getDomain() throws OpenshiftException {
+ loadLazyValues();
+ return domain;
+ }
+
+ @Override
+ public ISSHPublicKey getSshKey() throws OpenshiftException {
+ loadLazyValues();
+ return sshKey;
+ }
+
+ @Override
+ public String getRhlogin() {
+ return rhlogin;
+ }
+
+ @Override
+ public String getPassword() {
+ return password;
+ }
+
+ public String getUUID() throws OpenshiftException {
+ loadLazyValues();
+ return uuid;
+ }
+
+ @Override
+ public List<Cartridge> getCartridges() throws OpenshiftException {
+ if (cartridges == null) {
+ this.cartridges = service.getCartridges(this);
+ }
+ return Collections.unmodifiableList(cartridges);
+ }
+
+ @Override
+ public Collection<Application> getApplications() throws OpenshiftException {
+ loadLazyValues();
+ return Collections.unmodifiableList(applications);
+ }
+
+ public IApplication getApplicationByName(String name) throws OpenshiftException {
+ loadLazyValues();
+ return getApplicationByName(name, applications);
+ }
+
+ private Application getApplicationByName(String name, Collection<Application>
applications) {
+ Application matchingApplication = null;
+ for (Application 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);
+ }
+
+ /**
+ * 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 {
+ if (userInfo == null) {
+ refresh();
+ }
+ }
+
+ public void refresh() throws OpenshiftException {
+ this.userInfo = service.getUserInfo(this);
+ update(userInfo);
+ }
+
+ 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) {
+ Application application = getApplicationByName(applicationInfo.getName(),
applications);
+ if (application != null) {
+ application.update(applicationInfo);
+ } else {
+ applications.add(createApplication(applicationInfo));
+ }
+ }
+ }
+
+ private Application createApplication(ApplicationInfo applicationInfo) {
+ return new Application(applicationInfo.getName()
+ , applicationInfo.getUuid()
+ , applicationInfo.getCartridge()
+ , applicationInfo.getEmbedded()
+ , applicationInfo.getCreationTime()
+ , this, service);
+ }
+
+ public void setSshPublicKey(ISSHPublicKey key) {
+ this.sshKey = key;
+ }
+}
Property changes on:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/User.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Copied:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/UserInfo.java
(from rev 35033,
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/UserInfo.java)
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/UserInfo.java
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/UserInfo.java 2011-09-26
10:04:04 UTC (rev 35038)
@@ -0,0 +1,72 @@
+/*******************************************************************************
+ * 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.List;
+
+
+/**
+ * @author André Dietisheim
+ */
+public class UserInfo {
+
+ private String rhLogin;
+ private String uuid;
+ private SSHPublicKey sshPublicKey;
+ private String rhcDomain;
+ private String namespace;
+ private List<ApplicationInfo> applicationInfos;
+
+ public UserInfo(String rhLogin, String uuid, String sshPublicKey, String rhcDomain,
String namespace, List<ApplicationInfo> applicationInfos) {
+ this.rhLogin = rhLogin;
+ this.uuid = uuid;
+ this.sshPublicKey = new SSHPublicKey(sshPublicKey);
+ this.rhcDomain = rhcDomain;
+ this.namespace = namespace;
+ this.applicationInfos = applicationInfos;
+ }
+
+ public String getUuid() {
+ return uuid;
+ }
+
+ public SSHPublicKey getSshPublicKey() {
+ return sshPublicKey;
+ }
+
+ public String getRhLogin() {
+ return rhLogin;
+ }
+
+ public String getNamespace() {
+ return namespace;
+ }
+
+ public List<ApplicationInfo> getApplicationInfos() {
+ return applicationInfos;
+ }
+
+ public ApplicationInfo getApplicationInfoByName(String name) {
+ ApplicationInfo matchingApplicationInfo = null;
+ for (ApplicationInfo applicationInfo : applicationInfos) {
+ if (name.equals(applicationInfo.getName())) {
+ matchingApplicationInfo = applicationInfo;
+ break;
+ }
+ }
+ return matchingApplicationInfo;
+ }
+
+ public String getRhcDomain() {
+ return rhcDomain;
+ }
+
+}
Property changes on:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/UserInfo.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/httpclient/UrlConnectionHttpClient.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/httpclient/UrlConnectionHttpClient.java 2011-09-26
08:56:14 UTC (rev 35037)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/httpclient/UrlConnectionHttpClient.java 2011-09-26
10:04:04 UTC (rev 35038)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * 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.httpclient;
import java.io.FileNotFoundException;
@@ -9,6 +19,9 @@
import org.jboss.ide.eclipse.as.openshift.core.IHttpClient;
import org.jboss.ide.eclipse.as.openshift.core.internal.utils.StreamUtils;
+/**
+ * @author André Dietisheim
+ */
public class UrlConnectionHttpClient implements IHttpClient {
private static final String PROPERTY_CONTENT_TYPE = "Content-Type";
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/request/ApplicationRequest.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/request/ApplicationRequest.java 2011-09-26
08:56:14 UTC (rev 35037)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/request/ApplicationRequest.java 2011-09-26
10:04:04 UTC (rev 35038)
@@ -10,7 +10,7 @@
******************************************************************************/
package org.jboss.ide.eclipse.as.openshift.core.internal.request;
-import org.jboss.ide.eclipse.as.openshift.core.Cartridge;
+import org.jboss.ide.eclipse.as.openshift.core.ICartridge;
/**
* @author André Dietisheim
@@ -18,14 +18,14 @@
public class ApplicationRequest extends AbstractOpenshiftRequest {
private String name;
- private Cartridge cartridge ;
+ private ICartridge cartridge ;
private ApplicationAction action;
- public ApplicationRequest(String name, Cartridge cartridge, ApplicationAction action,
String username) {
+ public ApplicationRequest(String name, ICartridge cartridge, ApplicationAction action,
String username) {
this(name, cartridge, action, username, false);
}
- public ApplicationRequest(String name, Cartridge cartridge, ApplicationAction action,
String username, boolean debug) {
+ public ApplicationRequest(String name, ICartridge cartridge, ApplicationAction action,
String username, boolean debug) {
super(username, debug);
this.name = name;
this.cartridge = cartridge;
@@ -40,7 +40,7 @@
return name;
}
- public Cartridge getCartridge() {
+ public ICartridge getCartridge() {
return cartridge;
}
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/request/marshalling/AbstractJsonMarshaller.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/request/marshalling/AbstractJsonMarshaller.java 2011-09-26
08:56:14 UTC (rev 35037)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/request/marshalling/AbstractJsonMarshaller.java 2011-09-26
10:04:04 UTC (rev 35038)
@@ -11,8 +11,8 @@
package org.jboss.ide.eclipse.as.openshift.core.internal.request.marshalling;
import org.jboss.dmr.ModelNode;
-import org.jboss.ide.eclipse.as.openshift.core.IOpenshiftJsonConstants;
import org.jboss.ide.eclipse.as.openshift.core.OpenshiftException;
+import org.jboss.ide.eclipse.as.openshift.core.internal.IOpenshiftJsonConstants;
import
org.jboss.ide.eclipse.as.openshift.core.internal.request.AbstractOpenshiftRequest;
/**
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/request/marshalling/ApplicationRequestJsonMarshaller.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/request/marshalling/ApplicationRequestJsonMarshaller.java 2011-09-26
08:56:14 UTC (rev 35037)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/request/marshalling/ApplicationRequestJsonMarshaller.java 2011-09-26
10:04:04 UTC (rev 35038)
@@ -11,8 +11,8 @@
package org.jboss.ide.eclipse.as.openshift.core.internal.request.marshalling;
import org.jboss.dmr.ModelNode;
-import org.jboss.ide.eclipse.as.openshift.core.Cartridge;
-import org.jboss.ide.eclipse.as.openshift.core.IOpenshiftJsonConstants;
+import org.jboss.ide.eclipse.as.openshift.core.ICartridge;
+import org.jboss.ide.eclipse.as.openshift.core.internal.IOpenshiftJsonConstants;
import org.jboss.ide.eclipse.as.openshift.core.internal.request.ApplicationAction;
import org.jboss.ide.eclipse.as.openshift.core.internal.request.ApplicationRequest;
@@ -28,7 +28,7 @@
setStringProperty(IOpenshiftJsonConstants.PROPERTY_APP_NAME, request.getName(), node);
}
- private String getCartridgeName(Cartridge cartridge) {
+ private String getCartridgeName(ICartridge cartridge) {
if (cartridge == null) {
return null;
}
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/request/marshalling/DomainRequestJsonMarshaller.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/request/marshalling/DomainRequestJsonMarshaller.java 2011-09-26
08:56:14 UTC (rev 35037)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/request/marshalling/DomainRequestJsonMarshaller.java 2011-09-26
10:04:04 UTC (rev 35038)
@@ -11,8 +11,8 @@
package org.jboss.ide.eclipse.as.openshift.core.internal.request.marshalling;
import org.jboss.dmr.ModelNode;
-import org.jboss.ide.eclipse.as.openshift.core.IOpenshiftJsonConstants;
import org.jboss.ide.eclipse.as.openshift.core.OpenshiftException;
+import org.jboss.ide.eclipse.as.openshift.core.internal.IOpenshiftJsonConstants;
import org.jboss.ide.eclipse.as.openshift.core.internal.request.AbstractDomainRequest;
/**
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/request/marshalling/ListCartridgesRequestJsonMarshaller.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/request/marshalling/ListCartridgesRequestJsonMarshaller.java 2011-09-26
08:56:14 UTC (rev 35037)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/request/marshalling/ListCartridgesRequestJsonMarshaller.java 2011-09-26
10:04:04 UTC (rev 35038)
@@ -11,7 +11,7 @@
package org.jboss.ide.eclipse.as.openshift.core.internal.request.marshalling;
import org.jboss.dmr.ModelNode;
-import org.jboss.ide.eclipse.as.openshift.core.IOpenshiftJsonConstants;
+import org.jboss.ide.eclipse.as.openshift.core.internal.IOpenshiftJsonConstants;
import org.jboss.ide.eclipse.as.openshift.core.internal.request.ListCartridgesRequest;
/**
Deleted:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/AbstractOpenshiftJsonResponseUnmarshaller.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/AbstractOpenshiftJsonResponseUnmarshaller.java 2011-09-26
08:56:14 UTC (rev 35037)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/AbstractOpenshiftJsonResponseUnmarshaller.java 2011-09-26
10:04:04 UTC (rev 35038)
@@ -1,75 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at
http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.ide.eclipse.as.openshift.core.internal.response;
-
-import java.util.Date;
-
-import javax.xml.datatype.DatatypeConfigurationException;
-
-import org.jboss.dmr.ModelNode;
-import org.jboss.dmr.ModelType;
-import org.jboss.ide.eclipse.as.openshift.core.IOpenshiftJsonConstants;
-import org.jboss.ide.eclipse.as.openshift.core.OpenshiftException;
-import org.jboss.ide.eclipse.as.openshift.core.internal.utils.RFC822DateUtils;
-
-/**
- * @author André Dietisheim
- */
-public abstract class AbstractOpenshiftJsonResponseUnmarshaller<OPENSHIFTOBJECT> {
-
- private String response;
-
- public OpenshiftResponse<OPENSHIFTOBJECT> unmarshall(String response) throws
OpenshiftException {
- try {
- ModelNode node = ModelNode.fromJSONString(response);
- boolean debug = node.get(IOpenshiftJsonConstants.PROPERTY_DEBUG).asBoolean();
- String messages = getString(IOpenshiftJsonConstants.PROPERTY_MESSAGES, node);
- String result = getString(IOpenshiftJsonConstants.PROPERTY_RESULT, node);
- int exitCode = node.get(IOpenshiftJsonConstants.PROPERTY_EXIT_CODE).asInt();
- OPENSHIFTOBJECT openshiftObject = createOpenshiftObject(node);
- return new OpenshiftResponse<OPENSHIFTOBJECT>(debug, messages, result,
openshiftObject, exitCode);
- } catch (IllegalArgumentException e) {
- throw new OpenshiftException(e, "Could not parse response
\"{0}\"", response);
- } catch (Exception e) {
- throw new OpenshiftException(e, "Could not unmarshall response
\"{0}\"", response);
- }
- }
-
- protected abstract OPENSHIFTOBJECT createOpenshiftObject(ModelNode responseNode) throws
Exception;
-
- protected String getResponse() {
- return response;
- }
-
- protected String getString(String property, ModelNode node) {
- ModelNode propertyNode = node.get(property);
- if (!isSet(propertyNode)) {
- // replace "undefined" by null
- return null;
- }
- return propertyNode.asString();
- }
-
- protected boolean isSet(ModelNode node) {
- return node != null
- && node.getType() != ModelType.UNDEFINED;
- }
-
- protected Date getDate(String property, ModelNode node) throws
DatatypeConfigurationException {
- ModelNode propertyNode = node.get(property);
- return RFC822DateUtils.getDate(propertyNode.asString());
- }
-
- protected long getLong(String property, ModelNode node) {
- ModelNode propertyNode = node.get(property);
- return propertyNode.asLong(-1);
- }
-}
Deleted:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/ApplicationResponseUnmarshaller.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/ApplicationResponseUnmarshaller.java 2011-09-26
08:56:14 UTC (rev 35037)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/ApplicationResponseUnmarshaller.java 2011-09-26
10:04:04 UTC (rev 35038)
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at
http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.ide.eclipse.as.openshift.core.internal.response;
-
-import org.jboss.dmr.ModelNode;
-import org.jboss.ide.eclipse.as.openshift.core.Application;
-import org.jboss.ide.eclipse.as.openshift.core.Cartridge;
-import org.jboss.ide.eclipse.as.openshift.core.IOpenshiftService;
-import org.jboss.ide.eclipse.as.openshift.core.User;
-
-/**
- * @author André Dietisheim
- */
-public class ApplicationResponseUnmarshaller extends
AbstractOpenshiftJsonResponseUnmarshaller<Application> {
-
- private User user;
- private String applicationName;
- private Cartridge cartridge;
- private IOpenshiftService service;
-
- public ApplicationResponseUnmarshaller(String applicationName, Cartridge cartridge, User
user, IOpenshiftService service) {
- this.applicationName = applicationName;
- this.cartridge = cartridge;
- this.user = user;
- this.service = service;
- }
-
- @Override
- protected Application createOpenshiftObject(ModelNode node) {
- return new Application(applicationName, cartridge, user, service);
- }
-}
Deleted:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/ApplicationStatusResponseUnmarshaller.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/ApplicationStatusResponseUnmarshaller.java 2011-09-26
08:56:14 UTC (rev 35037)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/ApplicationStatusResponseUnmarshaller.java 2011-09-26
10:04:04 UTC (rev 35038)
@@ -1,28 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at
http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.ide.eclipse.as.openshift.core.internal.response;
-
-import org.jboss.dmr.ModelNode;
-import org.jboss.ide.eclipse.as.openshift.core.IOpenshiftJsonConstants;
-
-
-/**
- * @author André Dietisheim
- */
-public class ApplicationStatusResponseUnmarshaller extends
AbstractOpenshiftJsonResponseUnmarshaller<String> {
-
- @Override
- protected String createOpenshiftObject(ModelNode responseNode) {
- ModelNode resultNode = responseNode.get(IOpenshiftJsonConstants.PROPERTY_RESULT);
- return resultNode.asString();
- }
-
-}
Deleted:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/DomainResponseUnmarshaller.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/DomainResponseUnmarshaller.java 2011-09-26
08:56:14 UTC (rev 35037)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/DomainResponseUnmarshaller.java 2011-09-26
10:04:04 UTC (rev 35038)
@@ -1,34 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at
http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.ide.eclipse.as.openshift.core.internal.response;
-
-import org.jboss.dmr.ModelNode;
-import org.jboss.ide.eclipse.as.openshift.core.Domain;
-import org.jboss.ide.eclipse.as.openshift.core.User;
-
-/**
- * @author André Dietisheim
- */
-public class DomainResponseUnmarshaller extends
AbstractOpenshiftJsonResponseUnmarshaller<Domain> {
-
- private String domainName;
- private User user;
-
- public DomainResponseUnmarshaller(String domainName, User user) {
- this.domainName = domainName;
- this.user = user;
- }
-
- @Override
- protected Domain createOpenshiftObject(ModelNode node) {
- return new Domain(domainName, user);
- }
-}
Deleted:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/JsonSanitizer.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/JsonSanitizer.java 2011-09-26
08:56:14 UTC (rev 35037)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/JsonSanitizer.java 2011-09-26
10:04:04 UTC (rev 35038)
@@ -1,51 +0,0 @@
-package org.jboss.ide.eclipse.as.openshift.core.internal.response;
-
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-/*******************************************************************************
- * 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
- ******************************************************************************/
-
-/**
- * @author André Dietisheim
- */
-public class JsonSanitizer {
-
- private static final Pattern QUOTED_JSON_OBJECT_PATTERN =
Pattern.compile("\"\\{(.+)\\}\"");
- private static final Pattern ESCAPED_QUOTES_PATTERN =
Pattern.compile("\\\"");
-
- public static String sanitize(String json) {
- return correctEscapedJsonObjects(json);
- }
-
- /**
- * Corrects erroneously quoted json objects in the given string.
- * <p>
- * corrects: "{ \"property\": \"value\" }" to {
"propery" : "value" }
- *
- * @param json
- * @return
- */
- protected static String correctEscapedJsonObjects(String json) {
- String sanitizedJson = json;
- Matcher matcher = QUOTED_JSON_OBJECT_PATTERN.matcher(json);
- if (matcher.find()
- && matcher.groupCount() > 0) {
- sanitizedJson = matcher.replaceAll("{" + unescapeQuotes(matcher.group(1)) +
"}");
- }
- return sanitizedJson;
- }
-
- private static String unescapeQuotes(String responseFragment) {
- return
ESCAPED_QUOTES_PATTERN.matcher(responseFragment).replaceAll("\"");
- }
-
-}
Deleted:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/ListCartridgesResponseUnmarshaller.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/ListCartridgesResponseUnmarshaller.java 2011-09-26
08:56:14 UTC (rev 35037)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/ListCartridgesResponseUnmarshaller.java 2011-09-26
10:04:04 UTC (rev 35038)
@@ -1,50 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at
http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.ide.eclipse.as.openshift.core.internal.response;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.jboss.dmr.ModelNode;
-import org.jboss.ide.eclipse.as.openshift.core.Cartridge;
-import org.jboss.ide.eclipse.as.openshift.core.IOpenshiftJsonConstants;
-
-/**
- * WARNING: the current (9-7-2011) response from the openshift rest service is
- * invalid. It quotes the nested json object in the data property: '"data"
:
- * "{'. My current unmarshalling code does not handle this bad json.
- *
- * @author André Dietisheim
- */
-public class ListCartridgesResponseUnmarshaller extends
AbstractOpenshiftJsonResponseUnmarshaller<List<Cartridge>> {
-
- @Override
- protected List<Cartridge> createOpenshiftObject(ModelNode responseNode) {
- List<Cartridge> cartridges = new ArrayList<Cartridge>();
- ModelNode dataNode = responseNode.get(IOpenshiftJsonConstants.PROPERTY_DATA);
- if (dataNode == null) {
- return cartridges;
- }
- ModelNode cartridgesNode = dataNode.get(IOpenshiftJsonConstants.PROPERTY_CARTS);
- if (cartridgesNode == null) {
- return cartridges;
- }
- for (ModelNode cartridgeNode : cartridgesNode.asList()) {
- cartridges.add(createCartridge(cartridgeNode));
- }
- return cartridges;
- }
-
- private Cartridge createCartridge(ModelNode cartridgeNode) {
- String name = cartridgeNode.asString();
- return new Cartridge(name);
- }
-}
Deleted:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/UserInfoResponseUnmarshaller.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/UserInfoResponseUnmarshaller.java 2011-09-26
08:56:14 UTC (rev 35037)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/UserInfoResponseUnmarshaller.java 2011-09-26
10:04:04 UTC (rev 35038)
@@ -1,72 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at
http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.ide.eclipse.as.openshift.core.internal.response;
-
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-
-import javax.xml.datatype.DatatypeConfigurationException;
-
-import org.jboss.dmr.ModelNode;
-import org.jboss.ide.eclipse.as.openshift.core.ApplicationInfo;
-import org.jboss.ide.eclipse.as.openshift.core.Cartridge;
-import org.jboss.ide.eclipse.as.openshift.core.IOpenshiftJsonConstants;
-import org.jboss.ide.eclipse.as.openshift.core.UserInfo;
-
-/**
- * @author André Dietisheim
- */
-public class UserInfoResponseUnmarshaller extends
AbstractOpenshiftJsonResponseUnmarshaller<UserInfo> {
-
- @Override
- protected UserInfo createOpenshiftObject(ModelNode node) throws
DatatypeConfigurationException {
- ModelNode dataNode = node.get(IOpenshiftJsonConstants.PROPERTY_DATA);
- if (!isSet(dataNode)) {
- return null;
- }
-
- ModelNode userInfoNode = dataNode.get(IOpenshiftJsonConstants.PROPERTY_USER_INFO);
- if (!isSet(userInfoNode)) {
- return null;
- }
-
- String sshPublicKey = getString(IOpenshiftJsonConstants.PROPERTY_SSH_KEY,
userInfoNode);
- String rhlogin = getString(IOpenshiftJsonConstants.PROPERTY_RHLOGIN, userInfoNode);
- String uuid = getString(IOpenshiftJsonConstants.PROPERTY_UUID, userInfoNode);
- String namespace = getString(IOpenshiftJsonConstants.PROPERTY_NAMESPACE,
userInfoNode);
- String rhcDomain = getString(IOpenshiftJsonConstants.PROPERTY_RHC_DOMAIN,
userInfoNode);
-
- List<ApplicationInfo> applicationInfos =
createApplicationInfos(dataNode.get(IOpenshiftJsonConstants.PROPERTY_APP_INFO));
-
- return new UserInfo(rhlogin, uuid, sshPublicKey, rhcDomain, namespace,
applicationInfos);
- }
-
- private List<ApplicationInfo> createApplicationInfos(ModelNode appInfoNode) throws
DatatypeConfigurationException {
- List<ApplicationInfo> applicationInfos = new ArrayList<ApplicationInfo>();
- if (!isSet(appInfoNode)) {
- return applicationInfos;
- }
-
- for (String name : appInfoNode.keys()) {
- applicationInfos.add(createApplicationInfo(name, appInfoNode.get(name)));
- }
- return applicationInfos;
- }
-
- private ApplicationInfo createApplicationInfo(String name, ModelNode appNode) throws
DatatypeConfigurationException {
- String uuid = getString(IOpenshiftJsonConstants.PROPERTY_UUID, appNode);
- String embedded = getString(IOpenshiftJsonConstants.PROPERTY_EMBEDDED, appNode);
- Cartridge cartrdige = new
Cartridge(getString(IOpenshiftJsonConstants.PROPERTY_FRAMEWORK, appNode));
- Date creationTime = getDate(IOpenshiftJsonConstants.PROPERTY_CREATION_TIME, appNode);
- return new ApplicationInfo(name, uuid, embedded, cartrdige, creationTime);
- }
-}
Copied:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/unmarshalling/AbstractOpenshiftJsonResponseUnmarshaller.java
(from rev 35033,
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/AbstractOpenshiftJsonResponseUnmarshaller.java)
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/unmarshalling/AbstractOpenshiftJsonResponseUnmarshaller.java
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/unmarshalling/AbstractOpenshiftJsonResponseUnmarshaller.java 2011-09-26
10:04:04 UTC (rev 35038)
@@ -0,0 +1,76 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.ide.eclipse.as.openshift.core.internal.response.unmarshalling;
+
+import java.util.Date;
+
+import javax.xml.datatype.DatatypeConfigurationException;
+
+import org.jboss.dmr.ModelNode;
+import org.jboss.dmr.ModelType;
+import org.jboss.ide.eclipse.as.openshift.core.OpenshiftException;
+import org.jboss.ide.eclipse.as.openshift.core.internal.IOpenshiftJsonConstants;
+import org.jboss.ide.eclipse.as.openshift.core.internal.response.OpenshiftResponse;
+import org.jboss.ide.eclipse.as.openshift.core.internal.utils.RFC822DateUtils;
+
+/**
+ * @author André Dietisheim
+ */
+public abstract class AbstractOpenshiftJsonResponseUnmarshaller<OPENSHIFTOBJECT> {
+
+ private String response;
+
+ public OpenshiftResponse<OPENSHIFTOBJECT> unmarshall(String response) throws
OpenshiftException {
+ try {
+ ModelNode node = ModelNode.fromJSONString(response);
+ boolean debug = node.get(IOpenshiftJsonConstants.PROPERTY_DEBUG).asBoolean();
+ String messages = getString(IOpenshiftJsonConstants.PROPERTY_MESSAGES, node);
+ String result = getString(IOpenshiftJsonConstants.PROPERTY_RESULT, node);
+ int exitCode = node.get(IOpenshiftJsonConstants.PROPERTY_EXIT_CODE).asInt();
+ OPENSHIFTOBJECT openshiftObject = createOpenshiftObject(node);
+ return new OpenshiftResponse<OPENSHIFTOBJECT>(debug, messages, result,
openshiftObject, exitCode);
+ } catch (IllegalArgumentException e) {
+ throw new OpenshiftException(e, "Could not parse response
\"{0}\"", response);
+ } catch (Exception e) {
+ throw new OpenshiftException(e, "Could not unmarshall response
\"{0}\"", response);
+ }
+ }
+
+ protected abstract OPENSHIFTOBJECT createOpenshiftObject(ModelNode responseNode) throws
Exception;
+
+ protected String getResponse() {
+ return response;
+ }
+
+ protected String getString(String property, ModelNode node) {
+ ModelNode propertyNode = node.get(property);
+ if (!isSet(propertyNode)) {
+ // replace "undefined" by null
+ return null;
+ }
+ return propertyNode.asString();
+ }
+
+ protected boolean isSet(ModelNode node) {
+ return node != null
+ && node.getType() != ModelType.UNDEFINED;
+ }
+
+ protected Date getDate(String property, ModelNode node) throws
DatatypeConfigurationException {
+ ModelNode propertyNode = node.get(property);
+ return RFC822DateUtils.getDate(propertyNode.asString());
+ }
+
+ protected long getLong(String property, ModelNode node) {
+ ModelNode propertyNode = node.get(property);
+ return propertyNode.asLong(-1);
+ }
+}
Property changes on:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/unmarshalling/AbstractOpenshiftJsonResponseUnmarshaller.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Copied:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/unmarshalling/ApplicationResponseUnmarshaller.java
(from rev 35033,
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/ApplicationResponseUnmarshaller.java)
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/unmarshalling/ApplicationResponseUnmarshaller.java
(rev 0)
+++
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-26
10:04:04 UTC (rev 35038)
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.ide.eclipse.as.openshift.core.internal.response.unmarshalling;
+
+import org.jboss.dmr.ModelNode;
+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;
+
+/**
+ * @author André Dietisheim
+ */
+public class ApplicationResponseUnmarshaller extends
AbstractOpenshiftJsonResponseUnmarshaller<Application> {
+
+ private User user;
+ private String applicationName;
+ private ICartridge cartridge;
+ private OpenshiftService service;
+
+ public ApplicationResponseUnmarshaller(String applicationName, ICartridge cartridge,
User user, OpenshiftService service) {
+ this.applicationName = applicationName;
+ this.cartridge = cartridge;
+ this.user = user;
+ this.service = service;
+ }
+
+ @Override
+ protected Application createOpenshiftObject(ModelNode node) {
+ return new Application(applicationName, cartridge, user, service);
+ }
+}
Property changes on:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/unmarshalling/ApplicationResponseUnmarshaller.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Copied:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/unmarshalling/ApplicationStatusResponseUnmarshaller.java
(from rev 35033,
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/ApplicationStatusResponseUnmarshaller.java)
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/unmarshalling/ApplicationStatusResponseUnmarshaller.java
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/unmarshalling/ApplicationStatusResponseUnmarshaller.java 2011-09-26
10:04:04 UTC (rev 35038)
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.ide.eclipse.as.openshift.core.internal.response.unmarshalling;
+
+import org.jboss.dmr.ModelNode;
+import org.jboss.ide.eclipse.as.openshift.core.internal.IOpenshiftJsonConstants;
+
+
+/**
+ * @author André Dietisheim
+ */
+public class ApplicationStatusResponseUnmarshaller extends
AbstractOpenshiftJsonResponseUnmarshaller<String> {
+
+ @Override
+ protected String createOpenshiftObject(ModelNode responseNode) {
+ ModelNode resultNode = responseNode.get(IOpenshiftJsonConstants.PROPERTY_RESULT);
+ return resultNode.asString();
+ }
+
+}
Property changes on:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/unmarshalling/ApplicationStatusResponseUnmarshaller.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Copied:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/unmarshalling/DomainResponseUnmarshaller.java
(from rev 35033,
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/DomainResponseUnmarshaller.java)
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/unmarshalling/DomainResponseUnmarshaller.java
(rev 0)
+++
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-26
10:04:04 UTC (rev 35038)
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.ide.eclipse.as.openshift.core.internal.response.unmarshalling;
+
+import org.jboss.dmr.ModelNode;
+import org.jboss.ide.eclipse.as.openshift.core.internal.Domain;
+import org.jboss.ide.eclipse.as.openshift.core.internal.User;
+
+/**
+ * @author André Dietisheim
+ */
+public class DomainResponseUnmarshaller extends
AbstractOpenshiftJsonResponseUnmarshaller<Domain> {
+
+ private String domainName;
+ private User user;
+
+ public DomainResponseUnmarshaller(String domainName, User user) {
+ this.domainName = domainName;
+ this.user = user;
+ }
+
+ @Override
+ protected Domain createOpenshiftObject(ModelNode node) {
+ return new Domain(domainName, user);
+ }
+}
Property changes on:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/unmarshalling/DomainResponseUnmarshaller.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Copied:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/unmarshalling/JsonSanitizer.java
(from rev 35033,
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/JsonSanitizer.java)
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/unmarshalling/JsonSanitizer.java
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/unmarshalling/JsonSanitizer.java 2011-09-26
10:04:04 UTC (rev 35038)
@@ -0,0 +1,51 @@
+package org.jboss.ide.eclipse.as.openshift.core.internal.response.unmarshalling;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/*******************************************************************************
+ * 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
+ ******************************************************************************/
+
+/**
+ * @author André Dietisheim
+ */
+public class JsonSanitizer {
+
+ private static final Pattern QUOTED_JSON_OBJECT_PATTERN =
Pattern.compile("\"\\{(.+)\\}\"");
+ private static final Pattern ESCAPED_QUOTES_PATTERN =
Pattern.compile("\\\"");
+
+ public static String sanitize(String json) {
+ return correctEscapedJsonObjects(json);
+ }
+
+ /**
+ * Corrects erroneously quoted json objects in the given string.
+ * <p>
+ * corrects: "{ \"property\": \"value\" }" to {
"propery" : "value" }
+ *
+ * @param json
+ * @return
+ */
+ protected static String correctEscapedJsonObjects(String json) {
+ String sanitizedJson = json;
+ Matcher matcher = QUOTED_JSON_OBJECT_PATTERN.matcher(json);
+ if (matcher.find()
+ && matcher.groupCount() > 0) {
+ sanitizedJson = matcher.replaceAll("{" + unescapeQuotes(matcher.group(1)) +
"}");
+ }
+ return sanitizedJson;
+ }
+
+ private static String unescapeQuotes(String responseFragment) {
+ return
ESCAPED_QUOTES_PATTERN.matcher(responseFragment).replaceAll("\"");
+ }
+
+}
Property changes on:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/unmarshalling/JsonSanitizer.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Copied:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/unmarshalling/ListCartridgesResponseUnmarshaller.java
(from rev 35033,
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/ListCartridgesResponseUnmarshaller.java)
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/unmarshalling/ListCartridgesResponseUnmarshaller.java
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/unmarshalling/ListCartridgesResponseUnmarshaller.java 2011-09-26
10:04:04 UTC (rev 35038)
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.ide.eclipse.as.openshift.core.internal.response.unmarshalling;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.dmr.ModelNode;
+import org.jboss.ide.eclipse.as.openshift.core.Cartridge;
+import org.jboss.ide.eclipse.as.openshift.core.internal.IOpenshiftJsonConstants;
+
+/**
+ * WARNING: the current (9-7-2011) response from the openshift rest service is
+ * invalid. It quotes the nested json object in the data property: '"data"
:
+ * "{'. My current unmarshalling code does not handle this bad json.
+ *
+ * @author André Dietisheim
+ */
+public class ListCartridgesResponseUnmarshaller extends
AbstractOpenshiftJsonResponseUnmarshaller<List<Cartridge>> {
+
+ @Override
+ protected List<Cartridge> createOpenshiftObject(ModelNode responseNode) {
+ List<Cartridge> cartridges = new ArrayList<Cartridge>();
+ ModelNode dataNode = responseNode.get(IOpenshiftJsonConstants.PROPERTY_DATA);
+ if (dataNode == null) {
+ return cartridges;
+ }
+ ModelNode cartridgesNode = dataNode.get(IOpenshiftJsonConstants.PROPERTY_CARTS);
+ if (cartridgesNode == null) {
+ return cartridges;
+ }
+ for (ModelNode cartridgeNode : cartridgesNode.asList()) {
+ cartridges.add(createCartridge(cartridgeNode));
+ }
+ return cartridges;
+ }
+
+ private Cartridge createCartridge(ModelNode cartridgeNode) {
+ String name = cartridgeNode.asString();
+ return new Cartridge(name);
+ }
+}
Property changes on:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/unmarshalling/ListCartridgesResponseUnmarshaller.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Copied:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/unmarshalling/UserInfoResponseUnmarshaller.java
(from rev 35033,
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/UserInfoResponseUnmarshaller.java)
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/unmarshalling/UserInfoResponseUnmarshaller.java
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/unmarshalling/UserInfoResponseUnmarshaller.java 2011-09-26
10:04:04 UTC (rev 35038)
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.ide.eclipse.as.openshift.core.internal.response.unmarshalling;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+import javax.xml.datatype.DatatypeConfigurationException;
+
+import org.jboss.dmr.ModelNode;
+import org.jboss.ide.eclipse.as.openshift.core.Cartridge;
+import org.jboss.ide.eclipse.as.openshift.core.ICartridge;
+import org.jboss.ide.eclipse.as.openshift.core.internal.ApplicationInfo;
+import org.jboss.ide.eclipse.as.openshift.core.internal.IOpenshiftJsonConstants;
+import org.jboss.ide.eclipse.as.openshift.core.internal.UserInfo;
+
+/**
+ * @author André Dietisheim
+ */
+public class UserInfoResponseUnmarshaller extends
AbstractOpenshiftJsonResponseUnmarshaller<UserInfo> {
+
+ @Override
+ protected UserInfo createOpenshiftObject(ModelNode node) throws
DatatypeConfigurationException {
+ ModelNode dataNode = node.get(IOpenshiftJsonConstants.PROPERTY_DATA);
+ if (!isSet(dataNode)) {
+ return null;
+ }
+
+ ModelNode userInfoNode = dataNode.get(IOpenshiftJsonConstants.PROPERTY_USER_INFO);
+ if (!isSet(userInfoNode)) {
+ return null;
+ }
+
+ String sshPublicKey = getString(IOpenshiftJsonConstants.PROPERTY_SSH_KEY,
userInfoNode);
+ String rhlogin = getString(IOpenshiftJsonConstants.PROPERTY_RHLOGIN, userInfoNode);
+ String uuid = getString(IOpenshiftJsonConstants.PROPERTY_UUID, userInfoNode);
+ String namespace = getString(IOpenshiftJsonConstants.PROPERTY_NAMESPACE,
userInfoNode);
+ String rhcDomain = getString(IOpenshiftJsonConstants.PROPERTY_RHC_DOMAIN,
userInfoNode);
+
+ List<ApplicationInfo> applicationInfos =
createApplicationInfos(dataNode.get(IOpenshiftJsonConstants.PROPERTY_APP_INFO));
+
+ return new UserInfo(rhlogin, uuid, sshPublicKey, rhcDomain, namespace,
applicationInfos);
+ }
+
+ private List<ApplicationInfo> createApplicationInfos(ModelNode appInfoNode) throws
DatatypeConfigurationException {
+ List<ApplicationInfo> applicationInfos = new ArrayList<ApplicationInfo>();
+ if (!isSet(appInfoNode)) {
+ return applicationInfos;
+ }
+
+ for (String name : appInfoNode.keys()) {
+ applicationInfos.add(createApplicationInfo(name, appInfoNode.get(name)));
+ }
+ return applicationInfos;
+ }
+
+ private ApplicationInfo createApplicationInfo(String name, ModelNode appNode) throws
DatatypeConfigurationException {
+ String uuid = getString(IOpenshiftJsonConstants.PROPERTY_UUID, appNode);
+ String embedded = getString(IOpenshiftJsonConstants.PROPERTY_EMBEDDED, appNode);
+ ICartridge cartrdige = new
Cartridge(getString(IOpenshiftJsonConstants.PROPERTY_FRAMEWORK, appNode));
+ Date creationTime = getDate(IOpenshiftJsonConstants.PROPERTY_CREATION_TIME, appNode);
+ return new ApplicationInfo(name, uuid, embedded, cartrdige, creationTime);
+ }
+}
Property changes on:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/response/unmarshalling/UserInfoResponseUnmarshaller.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/ApplicationIntegrationTest.java
===================================================================
---
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/ApplicationIntegrationTest.java 2011-09-26
08:56:14 UTC (rev 35037)
+++
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/ApplicationIntegrationTest.java 2011-09-26
10:04:04 UTC (rev 35038)
@@ -16,13 +16,14 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
-import org.jboss.ide.eclipse.as.openshift.core.Application;
-import org.jboss.ide.eclipse.as.openshift.core.Cartridge;
-import org.jboss.ide.eclipse.as.openshift.core.IOpenshiftService;
+import org.jboss.ide.eclipse.as.openshift.core.IApplication;
+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.User;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
@@ -50,7 +51,7 @@
@Ignore
@Test(expected = InvalidCredentialsOpenshiftException.class)
public void createApplicationWithInvalidCredentialsThrowsException() throws Exception {
- service.createApplication(createRandomApplicationName(), Cartridge.JBOSSAS_7,
invalidUser);
+ service.createApplication(createRandomApplicationName(), ICartridge.JBOSSAS_7,
invalidUser);
}
@Ignore
@@ -58,7 +59,7 @@
public void canCreateApplication() throws Exception {
String applicationName = createRandomApplicationName();
try {
- Cartridge cartridge = Cartridge.JBOSSAS_7;
+ ICartridge cartridge = ICartridge.JBOSSAS_7;
Application application = service.createApplication(applicationName, cartridge,
user);
assertNotNull(application);
assertEquals(applicationName, application.getName());
@@ -72,8 +73,8 @@
@Test
public void canDestroyApplication() throws Exception {
String applicationName = createRandomApplicationName();
- service.createApplication(applicationName, Cartridge.JBOSSAS_7, user);
- service.destroyApplication(applicationName, Cartridge.JBOSSAS_7, user);
+ service.createApplication(applicationName, ICartridge.JBOSSAS_7, user);
+ service.destroyApplication(applicationName, ICartridge.JBOSSAS_7, user);
}
@Ignore
@@ -81,8 +82,8 @@
public void createDuplicateApplicationThrowsException() throws Exception {
String applicationName = createRandomApplicationName();
try {
- service.createApplication(applicationName, Cartridge.JBOSSAS_7, user);
- service.createApplication(applicationName, Cartridge.JBOSSAS_7, user);
+ service.createApplication(applicationName, ICartridge.JBOSSAS_7, user);
+ service.createApplication(applicationName, ICartridge.JBOSSAS_7, user);
} finally {
silentlyDestroyAS7Application(applicationName, service);
}
@@ -93,8 +94,8 @@
public void canStopApplication() throws Exception {
String applicationName = createRandomApplicationName();
try {
- service.createApplication(applicationName, Cartridge.JBOSSAS_7, user);
- service.stopApplication(applicationName, Cartridge.JBOSSAS_7, user);
+ service.createApplication(applicationName, ICartridge.JBOSSAS_7, user);
+ service.stopApplication(applicationName, ICartridge.JBOSSAS_7, user);
} finally {
silentlyDestroyAS7Application(applicationName, service);
}
@@ -105,9 +106,9 @@
public void canStartStoppedApplication() throws Exception {
String applicationName = createRandomApplicationName();
try {
- service.createApplication(applicationName, Cartridge.JBOSSAS_7, user);
- service.stopApplication(applicationName, Cartridge.JBOSSAS_7, user);
- service.startApplication(applicationName, Cartridge.JBOSSAS_7, user);
+ service.createApplication(applicationName, ICartridge.JBOSSAS_7, user);
+ service.stopApplication(applicationName, ICartridge.JBOSSAS_7, user);
+ service.startApplication(applicationName, ICartridge.JBOSSAS_7, user);
} finally {
silentlyDestroyAS7Application(applicationName, service);
}
@@ -125,8 +126,8 @@
*
https://github.com/openshift/os-client-tools/blob/master/express
* /doc/API
*/
- service.createApplication(applicationName, Cartridge.JBOSSAS_7, user);
- service.startApplication(applicationName, Cartridge.JBOSSAS_7, user);
+ service.createApplication(applicationName, ICartridge.JBOSSAS_7, user);
+ service.startApplication(applicationName, ICartridge.JBOSSAS_7, user);
} finally {
silentlyDestroyAS7Application(applicationName, service);
}
@@ -144,9 +145,9 @@
*
https://github.com/openshift/os-client-tools/blob/master/express
* /doc/API
*/
- service.createApplication(applicationName, Cartridge.JBOSSAS_7, user);
- service.stopApplication(applicationName, Cartridge.JBOSSAS_7, user);
- service.stopApplication(applicationName, Cartridge.JBOSSAS_7, user);
+ service.createApplication(applicationName, ICartridge.JBOSSAS_7, user);
+ service.stopApplication(applicationName, ICartridge.JBOSSAS_7, user);
+ service.stopApplication(applicationName, ICartridge.JBOSSAS_7, user);
} finally {
silentlyDestroyAS7Application(applicationName, service);
}
@@ -164,8 +165,8 @@
*
https://github.com/openshift/os-client-tools/blob/master/express
* /doc/API
*/
- service.createApplication(applicationName, Cartridge.JBOSSAS_7, user);
- service.restartApplication(applicationName, Cartridge.JBOSSAS_7, user);
+ service.createApplication(applicationName, ICartridge.JBOSSAS_7, user);
+ service.restartApplication(applicationName, ICartridge.JBOSSAS_7, user);
} finally {
silentlyDestroyAS7Application(applicationName, service);
}
@@ -176,7 +177,7 @@
public void canGetStatus() throws Exception {
String applicationName = createRandomApplicationName();
try {
- Application application = service.createApplication(applicationName,
Cartridge.JBOSSAS_7, user);
+ Application application = service.createApplication(applicationName,
ICartridge.JBOSSAS_7, user);
String applicationStatus = service.getStatus(application.getName(),
application.getCartridge(), user);
assertNotNull(applicationStatus);
} finally {
@@ -189,7 +190,7 @@
public void getStatusReturnsTheWholeLog() throws Exception {
String applicationName = createRandomApplicationName();
try {
- Application application = service.createApplication(applicationName,
Cartridge.JBOSSAS_7, user);
+ Application application = service.createApplication(applicationName,
ICartridge.JBOSSAS_7, user);
String applicationStatus = service.getStatus(application.getName(),
application.getCartridge(), user);
String applicationStatus2 = service.getStatus(application.getName(),
application.getCartridge(), user);
assertEquals(applicationStatus, applicationStatus2);
@@ -202,7 +203,7 @@
public void returnsValidGitUri() throws Exception {
String applicationName = createRandomApplicationName();
try {
- Application application = service.createApplication(applicationName,
Cartridge.JBOSSAS_7, user);
+ IApplication application = service.createApplication(applicationName,
ICartridge.JBOSSAS_7, user);
String gitUri = application.getGitUri();
assertNotNull(gitUri);
assertGitUri(applicationName, gitUri);
@@ -215,7 +216,7 @@
public void returnsValidApplicationUrl() throws Exception {
String applicationName = createRandomApplicationName();
try {
- Application application = service.createApplication(applicationName,
Cartridge.JBOSSAS_7, user);
+ IApplication application = service.createApplication(applicationName,
ICartridge.JBOSSAS_7, user);
String applicationUrl = application.getApplicationUrl();
assertNotNull(applicationUrl);
assertAppliactionUrl(applicationName, applicationUrl);
@@ -230,7 +231,7 @@
private void silentlyDestroyAS7Application(String name, IOpenshiftService service) {
try {
- service.destroyApplication(name, Cartridge.JBOSSAS_7, user);
+ service.destroyApplication(name, ICartridge.JBOSSAS_7, user);
} catch (OpenshiftException e) {
e.printStackTrace();
}
Modified:
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/ApplicationTest.java
===================================================================
---
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/ApplicationTest.java 2011-09-26
08:56:14 UTC (rev 35037)
+++
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/ApplicationTest.java 2011-09-26
10:04:04 UTC (rev 35038)
@@ -20,23 +20,23 @@
import java.net.URLEncoder;
import java.util.Arrays;
-import org.jboss.ide.eclipse.as.openshift.core.Application;
-import org.jboss.ide.eclipse.as.openshift.core.ApplicationInfo;
import org.jboss.ide.eclipse.as.openshift.core.ApplicationLogReader;
-import org.jboss.ide.eclipse.as.openshift.core.Cartridge;
-import org.jboss.ide.eclipse.as.openshift.core.IOpenshiftService;
+import org.jboss.ide.eclipse.as.openshift.core.IApplication;
+import org.jboss.ide.eclipse.as.openshift.core.ICartridge;
import org.jboss.ide.eclipse.as.openshift.core.OpenshiftException;
-import org.jboss.ide.eclipse.as.openshift.core.User;
-import org.jboss.ide.eclipse.as.openshift.core.UserInfo;
+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.UserInfo;
import org.jboss.ide.eclipse.as.openshift.core.internal.request.ApplicationAction;
import org.jboss.ide.eclipse.as.openshift.core.internal.request.ApplicationRequest;
import
org.jboss.ide.eclipse.as.openshift.core.internal.request.OpenshiftEnvelopeFactory;
import
org.jboss.ide.eclipse.as.openshift.core.internal.request.marshalling.ApplicationRequestJsonMarshaller;
-import
org.jboss.ide.eclipse.as.openshift.core.internal.response.ApplicationResponseUnmarshaller;
-import
org.jboss.ide.eclipse.as.openshift.core.internal.response.ApplicationStatusResponseUnmarshaller;
-import org.jboss.ide.eclipse.as.openshift.core.internal.response.JsonSanitizer;
import org.jboss.ide.eclipse.as.openshift.core.internal.response.OpenshiftResponse;
+import
org.jboss.ide.eclipse.as.openshift.core.internal.response.unmarshalling.ApplicationResponseUnmarshaller;
+import
org.jboss.ide.eclipse.as.openshift.core.internal.response.unmarshalling.ApplicationStatusResponseUnmarshaller;
+import
org.jboss.ide.eclipse.as.openshift.core.internal.response.unmarshalling.JsonSanitizer;
import
org.jboss.ide.eclipse.as.openshift.test.internal.core.fakes.ApplicationResponseFake;
import
org.jboss.ide.eclipse.as.openshift.test.internal.core.fakes.NoopOpenshiftServiceFake;
import org.junit.Test;
@@ -67,7 +67,7 @@
String createApplicationRequest = new ApplicationRequestJsonMarshaller().marshall(
new ApplicationRequest(
- "test-application", Cartridge.JBOSSAS_7, ApplicationAction.CONFIGURE,
+ "test-application", ICartridge.JBOSSAS_7, ApplicationAction.CONFIGURE,
ApplicationResponseFake.RHLOGIN, true));
String effectiveRequest = new
OpenshiftEnvelopeFactory(ApplicationResponseFake.PASSWORD,
createApplicationRequest).createString();
@@ -92,7 +92,7 @@
String createApplicationRequest = new ApplicationRequestJsonMarshaller().marshall(
new ApplicationRequest(
- "test-application", Cartridge.JBOSSAS_7, ApplicationAction.DECONFIGURE,
+ "test-application", ICartridge.JBOSSAS_7, ApplicationAction.DECONFIGURE,
ApplicationResponseFake.RHLOGIN, true));
String effectiveRequest = new
OpenshiftEnvelopeFactory(ApplicationResponseFake.PASSWORD,
createApplicationRequest).createString();
@@ -118,7 +118,7 @@
public void returnsValidGitUri() throws OpenshiftException {
OpenshiftService userInfoService = createUserInfoService();
User user = createUser(userInfoService);
- Application application = createApplication(userInfoService, user);
+ IApplication application = createApplication(userInfoService, user);
String gitUri = application.getGitUri();
assertNotNull(gitUri);
@@ -134,7 +134,7 @@
public void returnsValidApplicationUrl() throws OpenshiftException {
OpenshiftService userInfoService = createUserInfoService();
User user = createUser(userInfoService);
- Application application = createApplication(userInfoService, user);
+ IApplication application = createApplication(userInfoService, user);
String applicationUrl = application.getApplicationUrl();
assertNotNull(applicationUrl);
@@ -158,9 +158,9 @@
@Test
public void applicationLogReaderReturnsAllowsToReadFromStatus() throws IOException {
- IOpenshiftService service = new NoopOpenshiftServiceFake() {
+ OpenshiftService service = new NoopOpenshiftServiceFake() {
@Override
- public String getStatus(String applicationName, Cartridge cartridge, User user) throws
OpenshiftException {
+ public String getStatus(String applicationName, ICartridge cartridge, User user)
throws OpenshiftException {
return ApplicationResponseFake.tail;
}
};
@@ -180,7 +180,7 @@
}
}
- private Application createApplication(OpenshiftService userInfoService, User user) {
+ private IApplication createApplication(OpenshiftService userInfoService, User user) {
Application application = new Application(
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/CartridgeTest.java
===================================================================
---
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/CartridgeTest.java 2011-09-26
08:56:14 UTC (rev 35037)
+++
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/CartridgeTest.java 2011-09-26
10:04:04 UTC (rev 35038)
@@ -17,9 +17,9 @@
import org.jboss.ide.eclipse.as.openshift.core.Cartridge;
import org.jboss.ide.eclipse.as.openshift.core.OpenshiftException;
-import org.jboss.ide.eclipse.as.openshift.core.internal.response.JsonSanitizer;
-import
org.jboss.ide.eclipse.as.openshift.core.internal.response.ListCartridgesResponseUnmarshaller;
import org.jboss.ide.eclipse.as.openshift.core.internal.response.OpenshiftResponse;
+import
org.jboss.ide.eclipse.as.openshift.core.internal.response.unmarshalling.JsonSanitizer;
+import
org.jboss.ide.eclipse.as.openshift.core.internal.response.unmarshalling.ListCartridgesResponseUnmarshaller;
import
org.jboss.ide.eclipse.as.openshift.test.internal.core.fakes.CartridgeResponseFake;
import org.junit.Test;
Modified:
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/CartridgesIntegrationTest.java
===================================================================
---
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/CartridgesIntegrationTest.java 2011-09-26
08:56:14 UTC (rev 35037)
+++
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/CartridgesIntegrationTest.java 2011-09-26
10:04:04 UTC (rev 35038)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
package org.jboss.ide.eclipse.as.openshift.test.internal.core;
import static org.junit.Assert.assertNotNull;
@@ -6,12 +16,15 @@
import java.util.List;
import org.jboss.ide.eclipse.as.openshift.core.Cartridge;
-import org.jboss.ide.eclipse.as.openshift.core.User;
import org.jboss.ide.eclipse.as.openshift.core.internal.OpenshiftService;
+import org.jboss.ide.eclipse.as.openshift.core.internal.User;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
+/**
+ * @author André Dietisheim
+ */
public class CartridgesIntegrationTest {
private OpenshiftService openshiftService;
Modified:
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/DomainIntegrationTest.java
===================================================================
---
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/DomainIntegrationTest.java 2011-09-26
08:56:14 UTC (rev 35037)
+++
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/DomainIntegrationTest.java 2011-09-26
10:04:04 UTC (rev 35038)
@@ -13,10 +13,10 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
-import org.jboss.ide.eclipse.as.openshift.core.Domain;
import org.jboss.ide.eclipse.as.openshift.core.SSHKeyPair;
-import org.jboss.ide.eclipse.as.openshift.core.User;
+import org.jboss.ide.eclipse.as.openshift.core.internal.Domain;
import org.jboss.ide.eclipse.as.openshift.core.internal.OpenshiftService;
+import org.jboss.ide.eclipse.as.openshift.core.internal.User;
import org.jboss.ide.eclipse.as.openshift.test.internal.core.fakes.TestSSHKey;
import org.junit.Before;
import org.junit.Test;
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-26
08:56:14 UTC (rev 35037)
+++
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/DomainTest.java 2011-09-26
10:04:04 UTC (rev 35038)
@@ -17,17 +17,17 @@
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
-import org.jboss.ide.eclipse.as.openshift.core.Domain;
import org.jboss.ide.eclipse.as.openshift.core.OpenshiftException;
import org.jboss.ide.eclipse.as.openshift.core.SSHKeyPair;
-import org.jboss.ide.eclipse.as.openshift.core.User;
+import org.jboss.ide.eclipse.as.openshift.core.internal.Domain;
+import org.jboss.ide.eclipse.as.openshift.core.internal.User;
import org.jboss.ide.eclipse.as.openshift.core.internal.request.ChangeDomainRequest;
import org.jboss.ide.eclipse.as.openshift.core.internal.request.CreateDomainRequest;
import
org.jboss.ide.eclipse.as.openshift.core.internal.request.OpenshiftEnvelopeFactory;
import
org.jboss.ide.eclipse.as.openshift.core.internal.request.marshalling.DomainRequestJsonMarshaller;
-import
org.jboss.ide.eclipse.as.openshift.core.internal.response.DomainResponseUnmarshaller;
-import org.jboss.ide.eclipse.as.openshift.core.internal.response.JsonSanitizer;
import org.jboss.ide.eclipse.as.openshift.core.internal.response.OpenshiftResponse;
+import
org.jboss.ide.eclipse.as.openshift.core.internal.response.unmarshalling.DomainResponseUnmarshaller;
+import
org.jboss.ide.eclipse.as.openshift.core.internal.response.unmarshalling.JsonSanitizer;
import
org.jboss.ide.eclipse.as.openshift.test.internal.core.fakes.NoopOpenshiftServiceFake;
import org.jboss.ide.eclipse.as.openshift.test.internal.core.fakes.TestSSHKey;
import org.junit.Test;
Modified:
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/JsonSanitizerTest.java
===================================================================
---
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/JsonSanitizerTest.java 2011-09-26
08:56:14 UTC (rev 35037)
+++
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/JsonSanitizerTest.java 2011-09-26
10:04:04 UTC (rev 35038)
@@ -14,7 +14,7 @@
import org.jboss.dmr.ModelNode;
import org.jboss.ide.eclipse.as.openshift.core.OpenshiftException;
-import org.jboss.ide.eclipse.as.openshift.core.internal.response.JsonSanitizer;
+import
org.jboss.ide.eclipse.as.openshift.core.internal.response.unmarshalling.JsonSanitizer;
import org.junit.Test;
/**
Modified:
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/ListCartridgesIntegrationTest.java
===================================================================
---
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/ListCartridgesIntegrationTest.java 2011-09-26
08:56:14 UTC (rev 35037)
+++
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/ListCartridgesIntegrationTest.java 2011-09-26
10:04:04 UTC (rev 35038)
@@ -17,8 +17,8 @@
import java.util.List;
import org.jboss.ide.eclipse.as.openshift.core.Cartridge;
-import org.jboss.ide.eclipse.as.openshift.core.User;
import org.jboss.ide.eclipse.as.openshift.core.internal.OpenshiftService;
+import org.jboss.ide.eclipse.as.openshift.core.internal.User;
import org.junit.Before;
import org.junit.Test;
Modified:
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/ListCartridgesTest.java
===================================================================
---
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/ListCartridgesTest.java 2011-09-26
08:56:14 UTC (rev 35037)
+++
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/ListCartridgesTest.java 2011-09-26
10:04:04 UTC (rev 35038)
@@ -21,9 +21,9 @@
import org.jboss.ide.eclipse.as.openshift.core.internal.request.ListCartridgesRequest;
import
org.jboss.ide.eclipse.as.openshift.core.internal.request.OpenshiftEnvelopeFactory;
import
org.jboss.ide.eclipse.as.openshift.core.internal.request.marshalling.ListCartridgesRequestJsonMarshaller;
-import org.jboss.ide.eclipse.as.openshift.core.internal.response.JsonSanitizer;
-import
org.jboss.ide.eclipse.as.openshift.core.internal.response.ListCartridgesResponseUnmarshaller;
import org.jboss.ide.eclipse.as.openshift.core.internal.response.OpenshiftResponse;
+import
org.jboss.ide.eclipse.as.openshift.core.internal.response.unmarshalling.JsonSanitizer;
+import
org.jboss.ide.eclipse.as.openshift.core.internal.response.unmarshalling.ListCartridgesResponseUnmarshaller;
import org.junit.Test;
/**
Modified:
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/UserInfoIntegrationTest.java
===================================================================
---
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/UserInfoIntegrationTest.java 2011-09-26
08:56:14 UTC (rev 35037)
+++
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/UserInfoIntegrationTest.java 2011-09-26
10:04:04 UTC (rev 35038)
@@ -15,14 +15,14 @@
import java.util.List;
-import org.jboss.ide.eclipse.as.openshift.core.ApplicationInfo;
-import org.jboss.ide.eclipse.as.openshift.core.Cartridge;
-import org.jboss.ide.eclipse.as.openshift.core.IOpenshiftService;
+import org.jboss.ide.eclipse.as.openshift.core.ICartridge;
import org.jboss.ide.eclipse.as.openshift.core.ISSHPublicKey;
import org.jboss.ide.eclipse.as.openshift.core.OpenshiftException;
-import org.jboss.ide.eclipse.as.openshift.core.User;
-import org.jboss.ide.eclipse.as.openshift.core.UserInfo;
+import org.jboss.ide.eclipse.as.openshift.core.internal.ApplicationInfo;
+import org.jboss.ide.eclipse.as.openshift.core.internal.IOpenshiftService;
import org.jboss.ide.eclipse.as.openshift.core.internal.OpenshiftService;
+import org.jboss.ide.eclipse.as.openshift.core.internal.User;
+import org.jboss.ide.eclipse.as.openshift.core.internal.UserInfo;
import
org.jboss.ide.eclipse.as.openshift.test.internal.core.utils.ApplicationInfoAsserts;
import org.junit.Before;
import org.junit.Test;
@@ -32,7 +32,7 @@
*/
public class UserInfoIntegrationTest {
- private IOpenshiftService openshiftService;
+ private OpenshiftService openshiftService;
private static final String RHLOGIN = "toolsjboss(a)gmail.com";
private static final String PASSWORD = "1q2w3e";
@@ -62,7 +62,7 @@
String applicationName = createRandomName();
try {
- openshiftService.createApplication(applicationName, Cartridge.JBOSSAS_7, user);
+ openshiftService.createApplication(applicationName, ICartridge.JBOSSAS_7, user);
UserInfo userInfo2 = openshiftService.getUserInfo(user);
assertEquals(numberOfApplicationInfos + 1, userInfo2.getApplicationInfos().size());
@@ -88,7 +88,7 @@
private void silentlyDestroyAS7Application(String name, IOpenshiftService service) {
try {
- service.destroyApplication(name, Cartridge.JBOSSAS_7, new User(RHLOGIN, PASSWORD));
+ service.destroyApplication(name, ICartridge.JBOSSAS_7, new User(RHLOGIN, PASSWORD));
} catch (OpenshiftException e) {
e.printStackTrace();
}
Modified:
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/UserInfoTest.java
===================================================================
---
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/UserInfoTest.java 2011-09-26
08:56:14 UTC (rev 35037)
+++
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/UserInfoTest.java 2011-09-26
10:04:04 UTC (rev 35038)
@@ -17,16 +17,16 @@
import java.net.URLEncoder;
import java.util.List;
-import org.jboss.ide.eclipse.as.openshift.core.ApplicationInfo;
import org.jboss.ide.eclipse.as.openshift.core.ISSHPublicKey;
import org.jboss.ide.eclipse.as.openshift.core.OpenshiftException;
-import org.jboss.ide.eclipse.as.openshift.core.UserInfo;
+import org.jboss.ide.eclipse.as.openshift.core.internal.ApplicationInfo;
+import org.jboss.ide.eclipse.as.openshift.core.internal.UserInfo;
import
org.jboss.ide.eclipse.as.openshift.core.internal.request.OpenshiftEnvelopeFactory;
import org.jboss.ide.eclipse.as.openshift.core.internal.request.UserInfoRequest;
import
org.jboss.ide.eclipse.as.openshift.core.internal.request.marshalling.UserInfoRequestJsonMarshaller;
-import org.jboss.ide.eclipse.as.openshift.core.internal.response.JsonSanitizer;
import org.jboss.ide.eclipse.as.openshift.core.internal.response.OpenshiftResponse;
-import
org.jboss.ide.eclipse.as.openshift.core.internal.response.UserInfoResponseUnmarshaller;
+import
org.jboss.ide.eclipse.as.openshift.core.internal.response.unmarshalling.JsonSanitizer;
+import
org.jboss.ide.eclipse.as.openshift.core.internal.response.unmarshalling.UserInfoResponseUnmarshaller;
import org.jboss.ide.eclipse.as.openshift.test.internal.core.fakes.UserInfoResponseFake;
import org.junit.Test;
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-26
08:56:14 UTC (rev 35037)
+++
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/UserTest.java 2011-09-26
10:04:04 UTC (rev 35038)
@@ -22,15 +22,16 @@
import javax.xml.datatype.DatatypeConfigurationException;
-import org.jboss.ide.eclipse.as.openshift.core.Application;
-import org.jboss.ide.eclipse.as.openshift.core.ApplicationInfo;
import org.jboss.ide.eclipse.as.openshift.core.Cartridge;
-import org.jboss.ide.eclipse.as.openshift.core.Domain;
+import org.jboss.ide.eclipse.as.openshift.core.IApplication;
import org.jboss.ide.eclipse.as.openshift.core.ISSHPublicKey;
import org.jboss.ide.eclipse.as.openshift.core.OpenshiftException;
-import org.jboss.ide.eclipse.as.openshift.core.User;
-import org.jboss.ide.eclipse.as.openshift.core.UserInfo;
+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.Domain;
import org.jboss.ide.eclipse.as.openshift.core.internal.OpenshiftService;
+import org.jboss.ide.eclipse.as.openshift.core.internal.User;
+import org.jboss.ide.eclipse.as.openshift.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;
import
org.jboss.ide.eclipse.as.openshift.test.internal.core.fakes.NoopOpenshiftServiceFake;
@@ -109,7 +110,7 @@
@Test
public void canGetApplicationByName() throws OpenshiftException,
DatatypeConfigurationException {
- Application application = user.getApplicationByName(UserInfoResponseFake.APP2_NAME);
+ IApplication application = user.getApplicationByName(UserInfoResponseFake.APP2_NAME);
assertApplication(
UserInfoResponseFake.APP2_NAME
, UserInfoResponseFake.APP2_UUID
Modified:
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/fakes/ApplicationResponseFake.java
===================================================================
---
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/fakes/ApplicationResponseFake.java 2011-09-26
08:56:14 UTC (rev 35037)
+++
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/fakes/ApplicationResponseFake.java 2011-09-26
10:04:04 UTC (rev 35038)
@@ -12,7 +12,7 @@
import java.util.Date;
-import org.jboss.ide.eclipse.as.openshift.core.Cartridge;
+import org.jboss.ide.eclipse.as.openshift.core.ICartridge;
/**
* @author André Dietisheim
@@ -28,7 +28,7 @@
public static final String NAMESPACE = "1315839296868";
public static final String APPLICATION_NAME = "1316010645406";
- public static final Cartridge APPLICATION_CARTRIDGE = Cartridge.JBOSSAS_7;
+ public static final ICartridge APPLICATION_CARTRIDGE = ICartridge.JBOSSAS_7;
public static final String APPLICATION_UUID = "0123456789abcdefg";
public static final String APPLICATION_EMBEDDED = null;
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-26
08:56:14 UTC (rev 35037)
+++
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-26
10:04:04 UTC (rev 35038)
@@ -12,14 +12,16 @@
import java.util.List;
-import org.jboss.ide.eclipse.as.openshift.core.Application;
import org.jboss.ide.eclipse.as.openshift.core.Cartridge;
-import org.jboss.ide.eclipse.as.openshift.core.Domain;
+import org.jboss.ide.eclipse.as.openshift.core.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.OpenshiftException;
-import org.jboss.ide.eclipse.as.openshift.core.User;
-import org.jboss.ide.eclipse.as.openshift.core.UserInfo;
+import org.jboss.ide.eclipse.as.openshift.core.internal.Application;
+import org.jboss.ide.eclipse.as.openshift.core.internal.Domain;
import org.jboss.ide.eclipse.as.openshift.core.internal.OpenshiftService;
+import org.jboss.ide.eclipse.as.openshift.core.internal.User;
+import org.jboss.ide.eclipse.as.openshift.core.internal.UserInfo;
/**
* @author André Dietisheim
@@ -37,32 +39,32 @@
}
@Override
- public Application createApplication(String name, Cartridge cartridge, User user) throws
OpenshiftException {
+ public Application createApplication(String name, ICartridge cartridge, User user)
throws OpenshiftException {
throw new UnsupportedOperationException();
}
@Override
- public void destroyApplication(String name, Cartridge cartridge, User user) throws
OpenshiftException {
+ public void destroyApplication(String name, ICartridge cartridge, User user) throws
OpenshiftException {
throw new UnsupportedOperationException();
}
@Override
- public Application startApplication(String name, Cartridge cartridge, User user) throws
OpenshiftException {
+ public IApplication startApplication(String name, ICartridge cartridge, User user)
throws OpenshiftException {
throw new UnsupportedOperationException();
}
@Override
- public Application restartApplication(String name, Cartridge cartridge, User user)
throws OpenshiftException {
+ public IApplication restartApplication(String name, ICartridge cartridge, User user)
throws OpenshiftException {
throw new UnsupportedOperationException();
}
@Override
- public Application stopApplication(String name, Cartridge cartridge, User user) throws
OpenshiftException {
+ public IApplication stopApplication(String name, ICartridge cartridge, User user) throws
OpenshiftException {
throw new UnsupportedOperationException();
}
@Override
- public String getStatus(String applicationName, Cartridge cartridge, User user) throws
OpenshiftException {
+ public String getStatus(String applicationName, ICartridge cartridge, User 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/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-26
08:56:14 UTC (rev 35037)
+++
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-26
10:04:04 UTC (rev 35038)
@@ -22,8 +22,9 @@
import javax.xml.datatype.DatatypeConfigurationException;
-import org.jboss.ide.eclipse.as.openshift.core.Application;
+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.Application;
import org.jboss.ide.eclipse.as.openshift.core.internal.utils.RFC822DateUtils;
/**
@@ -44,7 +45,7 @@
public static void assertThatContainsApplication(String applicationName, String
embedded, String applicationUUID,
String cartridgeName, String creationTime, List<Application> applications)
throws OpenshiftException {
- Application application = getApplication(applicationName, applications);
+ IApplication application = getApplication(applicationName, applications);
if (application == null) {
fail(MessageFormat.format("Could not find application with name
\"{0}\"", applicationName));
}
@@ -55,8 +56,8 @@
assertNotNull(getApplication(applicationName, applications));
}
- private static Application getApplication(String name, List<Application>
applications) {
- Application matchingApplication = null;
+ private static IApplication getApplication(String name, List<Application>
applications) {
+ IApplication matchingApplication = null;
for (Application application : applications) {
if (name.equals(application.getName())) {
matchingApplication = application;
@@ -67,7 +68,7 @@
}
public static void assertApplication(String name, String uuid, String cartridgeName,
String embedded,
- String creationTime, Application application) throws OpenshiftException {
+ String creationTime, IApplication application) throws OpenshiftException {
assertEquals(embedded, application.getEmbedded());
assertEquals(uuid, application.getUUID());
assertNotNull(application.getCartridge());
Modified:
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/utils/ApplicationInfoAsserts.java
===================================================================
---
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/utils/ApplicationInfoAsserts.java 2011-09-26
08:56:14 UTC (rev 35037)
+++
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/utils/ApplicationInfoAsserts.java 2011-09-26
10:04:04 UTC (rev 35038)
@@ -19,8 +19,8 @@
import javax.xml.datatype.DatatypeConfigurationException;
-import org.jboss.ide.eclipse.as.openshift.core.ApplicationInfo;
import org.jboss.ide.eclipse.as.openshift.core.OpenshiftException;
+import org.jboss.ide.eclipse.as.openshift.core.internal.ApplicationInfo;
import org.jboss.ide.eclipse.as.openshift.core.internal.utils.RFC822DateUtils;
/**
Modified:
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/utils/CartridgeAsserts.java
===================================================================
---
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/utils/CartridgeAsserts.java 2011-09-26
08:56:14 UTC (rev 35037)
+++
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/utils/CartridgeAsserts.java 2011-09-26
10:04:04 UTC (rev 35038)
@@ -16,6 +16,7 @@
import java.util.Collection;
import org.jboss.ide.eclipse.as.openshift.core.Cartridge;
+import org.jboss.ide.eclipse.as.openshift.core.ICartridge;
/**
* @author André Dietisheim
@@ -24,7 +25,7 @@
public static void assertThatContainsCartridge(String cartridgeName,
Collection<Cartridge> cartridges) {
boolean found = false;
- for (Cartridge cartridge : cartridges) {
+ for (ICartridge cartridge : cartridges) {
if (cartridgeName.equals(cartridge.getName())) {
found = true;
break;