JBoss Tools SVN: r35361 - in trunk/maven/plugins: org.jboss.tools.maven.project.examples/META-INF and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: fbricon
Date: 2011-10-05 07:24:10 -0400 (Wed, 05 Oct 2011)
New Revision: 35361
Modified:
trunk/maven/plugins/org.jboss.tools.maven.core/META-INF/MANIFEST.MF
trunk/maven/plugins/org.jboss.tools.maven.project.examples/META-INF/MANIFEST.MF
trunk/maven/plugins/org.jboss.tools.maven.ui/META-INF/MANIFEST.MF
Log:
JBIDE-9843 : Update m2e and m2e-wtp version range in JBoss Maven plugins MANIFEST.MF
Modified: trunk/maven/plugins/org.jboss.tools.maven.core/META-INF/MANIFEST.MF
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.core/META-INF/MANIFEST.MF 2011-10-05 11:07:12 UTC (rev 35360)
+++ trunk/maven/plugins/org.jboss.tools.maven.core/META-INF/MANIFEST.MF 2011-10-05 11:24:10 UTC (rev 35361)
@@ -12,18 +12,19 @@
org.eclipse.wst.common.frameworks;visibility:=reexport,
org.eclipse.jst.common.frameworks;visibility:=reexport,
org.eclipse.wst.common.modulecore;visibility:=reexport,
- org.eclipse.m2e.core;bundle-version="[1.0,1.1)";visibility:=reexport,
- org.eclipse.m2e.maven.runtime;bundle-version="[1.0,1.1)";visibility:=reexport,
+ org.eclipse.m2e.core;bundle-version="[1.0,1.2)";visibility:=reexport,
+ org.eclipse.m2e.maven.runtime;bundle-version="[1.0,1.2)";visibility:=reexport,
org.eclipse.jdt.core;visibility:=reexport,
- org.eclipse.m2e.jdt;bundle-version="[1.0,1.1)";visibility:=reexport,
+ org.eclipse.m2e.jdt;bundle-version="[1.0,1.2)";visibility:=reexport,
org.eclipse.jst.j2ee;visibility:=reexport,
org.eclipse.jst.j2ee.web;visibility:=reexport,
org.jboss.tools.common;visibility:=reexport,
org.eclipse.jdt.launching;visibility:=reexport,
org.eclipse.ui.workbench;visibility:=reexport,
- org.eclipse.m2e.model.edit;bundle-version="[1.0,1.1)";visibility:=reexport,
+ org.eclipse.m2e.model.edit;bundle-version="[1.0,1.2)";visibility:=reexport,
org.eclipse.core.expressions,
- org.maven.ide.eclipse.wtp;bundle-version="[0.13.0,0.15.0)";visibility:=reexport
+ org.maven.ide.eclipse.wtp;bundle-version="[0.13.0,0.16.0)";visibility:=reexport,
+ org.eclipse.jdt.ui;bundle-version="3.7.0"
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-Vendor: %Bundle-Vendor
Modified: trunk/maven/plugins/org.jboss.tools.maven.project.examples/META-INF/MANIFEST.MF
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.project.examples/META-INF/MANIFEST.MF 2011-10-05 11:07:12 UTC (rev 35360)
+++ trunk/maven/plugins/org.jboss.tools.maven.project.examples/META-INF/MANIFEST.MF 2011-10-05 11:24:10 UTC (rev 35361)
@@ -10,8 +10,8 @@
org.jboss.tools.maven.core,
org.jboss.tools.project.examples,
org.eclipse.ui.ide,
- org.eclipse.m2e.archetype.common;bundle-version="[1.0,1.1)",
- org.eclipse.m2e.core.ui;bundle-version="[1.0,1.1)"
+ org.eclipse.m2e.archetype.common;bundle-version="[1.0,1.2)",
+ org.eclipse.m2e.core.ui;bundle-version="[1.0,1.2)"
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-Vendor: %Bundle-Vendor
Modified: trunk/maven/plugins/org.jboss.tools.maven.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.ui/META-INF/MANIFEST.MF 2011-10-05 11:07:12 UTC (rev 35360)
+++ trunk/maven/plugins/org.jboss.tools.maven.ui/META-INF/MANIFEST.MF 2011-10-05 11:24:10 UTC (rev 35361)
@@ -12,9 +12,11 @@
org.eclipse.wst.common.frameworks.ui,
org.eclipse.core.resources,
org.jboss.tools.maven.core,
- org.eclipse.m2e.core.ui;bundle-version="[1.0.0,1.1.0)",
+ org.eclipse.m2e.core.ui;bundle-version="[1.0.0,1.2.0)",
org.eclipse.ui.ide,
- org.eclipse.jface.text
+ org.eclipse.jface.text,
+ org.eclipse.jdt.ui;bundle-version="3.7.0",
+ org.eclipse.jdt;bundle-version="3.7.0"
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-Vendor: %Bundle-Vendor
13 years, 3 months
JBoss Tools SVN: r35360 - trunk/as/plugins.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-10-05 07:07:12 -0400 (Wed, 05 Oct 2011)
New Revision: 35360
Modified:
trunk/as/plugins/pom.xml
Log:
[JBIDE-9841] renamed org.jboss.ide.eclipse.as.openshift plugins
Modified: trunk/as/plugins/pom.xml
===================================================================
--- trunk/as/plugins/pom.xml 2011-10-05 11:06:15 UTC (rev 35359)
+++ trunk/as/plugins/pom.xml 2011-10-05 11:07:12 UTC (rev 35360)
@@ -26,9 +26,8 @@
<module>org.jboss.ide.eclipse.as.management.as7</module>
<module>org.jboss.ide.eclipse.as.egit.core</module>
<module>org.jboss.ide.eclipse.as.egit.ui</module>
- <module>org.jboss.ide.eclipse.as.openshift.core</module>
- <module>org.jboss.ide.eclipse.as.openshift.ui</module>
-
+ <module>org.jboss.tools.openshift.express.client</module>
+ <module>org.jboss.tools.openshift.express.ui</module>
</modules>
</project>
13 years, 3 months
JBoss Tools SVN: r35359 - in trunk/as/tests/org.jboss.tools.openshift.express.client.test: .settings and 12 other directories.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-10-05 07:06:15 -0400 (Wed, 05 Oct 2011)
New Revision: 35359
Added:
trunk/as/tests/org.jboss.tools.openshift.express.client.test/.classpath
trunk/as/tests/org.jboss.tools.openshift.express.client.test/.project
trunk/as/tests/org.jboss.tools.openshift.express.client.test/.settings/
trunk/as/tests/org.jboss.tools.openshift.express.client.test/.settings/org.eclipse.jdt.core.prefs
trunk/as/tests/org.jboss.tools.openshift.express.client.test/META-INF/
trunk/as/tests/org.jboss.tools.openshift.express.client.test/META-INF/MANIFEST.MF
trunk/as/tests/org.jboss.tools.openshift.express.client.test/build.properties
trunk/as/tests/org.jboss.tools.openshift.express.client.test/pom.xml
trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/
trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/
trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/
trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/
trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/
trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/
trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/
trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/
trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/
trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/Activator.java
trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/ApplicationIntegrationTest.java
trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/ApplicationLogReaderIntegrationTest.java
trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/ApplicationLogReaderTest.java
trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/ApplicationTest.java
trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/CartridgeTest.java
trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/CartridgesIntegrationTest.java
trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/DomainIntegrationTest.java
trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/DomainTest.java
trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/IOpenshiftTestService.java
trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/JsonSanitizerTest.java
trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/ListCartridgesIntegrationTest.java
trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/ListCartridgesTest.java
trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/LogReaderRunnable.java
trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/OpenshiftIntegrationTestSuite.java
trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/OpenshiftTestSuite.java
trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/SSHKeyTest.java
trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/UserConfigurationTest.java
trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/UserInfoIntegrationTest.java
trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/UserInfoTest.java
trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/UserIntegrationTest.java
trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/UserTest.java
trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/fakes/
trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/fakes/ApplicationResponseFake.java
trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/fakes/CartridgeResponseFake.java
trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/fakes/NoopOpenshiftServiceFake.java
trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/fakes/OpenshiftCredentials.java
trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/fakes/OpenshiftTestService.java
trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/fakes/TestSSHKey.java
trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/fakes/TestUser.java
trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/fakes/UserConfigurationFake.java
trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/fakes/UserInfoResponseFake.java
trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/utils/
trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/utils/ApplicationAsserts.java
trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/utils/ApplicationInfoAsserts.java
trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/utils/ApplicationUtils.java
trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/utils/CartridgeAsserts.java
trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/utils/StreamUtils.java
Log:
[JBIDE-9841] renamed org.jboss.ide.eclipse.as.openshift.core.test to org.jboss.tools.openshift.express.client.test
Added: trunk/as/tests/org.jboss.tools.openshift.express.client.test/.classpath
===================================================================
--- trunk/as/tests/org.jboss.tools.openshift.express.client.test/.classpath (rev 0)
+++ trunk/as/tests/org.jboss.tools.openshift.express.client.test/.classpath 2011-10-05 11:06:15 UTC (rev 35359)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Property changes on: trunk/as/tests/org.jboss.tools.openshift.express.client.test/.classpath
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/tests/org.jboss.tools.openshift.express.client.test/.project
===================================================================
--- trunk/as/tests/org.jboss.tools.openshift.express.client.test/.project (rev 0)
+++ trunk/as/tests/org.jboss.tools.openshift.express.client.test/.project 2011-10-05 11:06:15 UTC (rev 35359)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.jboss.tools.openshift.express.client.test</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Property changes on: trunk/as/tests/org.jboss.tools.openshift.express.client.test/.project
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/tests/org.jboss.tools.openshift.express.client.test/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/as/tests/org.jboss.tools.openshift.express.client.test/.settings/org.eclipse.jdt.core.prefs (rev 0)
+++ trunk/as/tests/org.jboss.tools.openshift.express.client.test/.settings/org.eclipse.jdt.core.prefs 2011-10-05 11:06:15 UTC (rev 35359)
@@ -0,0 +1,8 @@
+#Thu Aug 25 16:44:11 CEST 2011
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6
Property changes on: trunk/as/tests/org.jboss.tools.openshift.express.client.test/.settings/org.eclipse.jdt.core.prefs
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/tests/org.jboss.tools.openshift.express.client.test/META-INF/MANIFEST.MF
===================================================================
--- trunk/as/tests/org.jboss.tools.openshift.express.client.test/META-INF/MANIFEST.MF (rev 0)
+++ trunk/as/tests/org.jboss.tools.openshift.express.client.test/META-INF/MANIFEST.MF 2011-10-05 11:06:15 UTC (rev 35359)
@@ -0,0 +1,12 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Openshift Test Plugin
+Bundle-SymbolicName: org.jboss.tools.openshift.express.client.test
+Bundle-Version: 2.3.0.qualifier
+Bundle-Activator: org.jboss.tools.openshift.express.internal.client.test.Activator
+Bundle-Vendor: JBoss by Red Hat
+Require-Bundle: org.jboss.tools.openshift.express.client;bundle-version="2.3.0",
+ org.junit;bundle-version="[4.8.0,5.0.0)",
+ org.eclipse.core.runtime;bundle-version="[3.7.0,4.0.0)"
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-ActivationPolicy: lazy
Property changes on: trunk/as/tests/org.jboss.tools.openshift.express.client.test/META-INF/MANIFEST.MF
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/tests/org.jboss.tools.openshift.express.client.test/build.properties
===================================================================
--- trunk/as/tests/org.jboss.tools.openshift.express.client.test/build.properties (rev 0)
+++ trunk/as/tests/org.jboss.tools.openshift.express.client.test/build.properties 2011-10-05 11:06:15 UTC (rev 35359)
@@ -0,0 +1,4 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .
Property changes on: trunk/as/tests/org.jboss.tools.openshift.express.client.test/build.properties
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/tests/org.jboss.tools.openshift.express.client.test/pom.xml
===================================================================
--- trunk/as/tests/org.jboss.tools.openshift.express.client.test/pom.xml (rev 0)
+++ trunk/as/tests/org.jboss.tools.openshift.express.client.test/pom.xml 2011-10-05 11:06:15 UTC (rev 35359)
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.jboss.tools.as</groupId>
+ <artifactId>plugins</artifactId>
+ <version>2.3.0-SNAPSHOT</version>
+ </parent>
+ <groupId>org.jboss.tools.as.plugins</groupId>
+ <artifactId>org.jboss.tools.openshift.express.client.test</artifactId>
+ <packaging>eclipse-plugin</packaging>
+</project>
Property changes on: trunk/as/tests/org.jboss.tools.openshift.express.client.test/pom.xml
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/Activator.java
===================================================================
--- trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/Activator.java (rev 0)
+++ trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/Activator.java 2011-10-05 11:06:15 UTC (rev 35359)
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * 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.tools.openshift.express.internal.client.test;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+public class Activator implements BundleActivator {
+
+ private static BundleContext context;
+
+ static BundleContext getContext() {
+ return context;
+ }
+
+ public void start(BundleContext bundleContext) throws Exception {
+ Activator.context = bundleContext;
+ }
+
+ public void stop(BundleContext bundleContext) throws Exception {
+ Activator.context = null;
+ }
+
+}
Property changes on: trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/Activator.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/ApplicationIntegrationTest.java
===================================================================
--- trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/ApplicationIntegrationTest.java (rev 0)
+++ trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/ApplicationIntegrationTest.java 2011-10-05 11:06:15 UTC (rev 35359)
@@ -0,0 +1,199 @@
+/*******************************************************************************
+ * 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.tools.openshift.express.internal.client.test;
+
+import static org.jboss.tools.openshift.express.internal.client.test.utils.ApplicationAsserts.assertAppliactionUrl;
+import static org.jboss.tools.openshift.express.internal.client.test.utils.ApplicationAsserts.assertGitUri;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import org.jboss.tools.openshift.express.client.IApplication;
+import org.jboss.tools.openshift.express.client.ICartridge;
+import org.jboss.tools.openshift.express.client.IOpenshiftService;
+import org.jboss.tools.openshift.express.client.InvalidCredentialsOpenshiftException;
+import org.jboss.tools.openshift.express.client.OpenshiftException;
+import org.jboss.tools.openshift.express.client.OpenshiftService;
+import org.jboss.tools.openshift.express.client.User;
+import org.jboss.tools.openshift.express.internal.client.test.fakes.TestUser;
+import org.jboss.tools.openshift.express.internal.client.test.utils.ApplicationUtils;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * @author André Dietisheim
+ */
+public class ApplicationIntegrationTest {
+
+ private IOpenshiftService service;
+
+ private User user;
+ private User invalidUser;
+
+ @Before
+ public void setUp() {
+ this.service = new OpenshiftService();
+ this.user = new TestUser();
+ this.invalidUser = new TestUser("bogusPassword");
+ }
+
+ @Test(expected = InvalidCredentialsOpenshiftException.class)
+ public void createApplicationWithInvalidCredentialsThrowsException() throws Exception {
+ service.createApplication(ApplicationUtils.createRandomApplicationName(), ICartridge.JBOSSAS_7, invalidUser);
+ }
+
+ @Test
+ public void canCreateApplication() throws Exception {
+ String applicationName = ApplicationUtils.createRandomApplicationName();
+ try {
+ ICartridge cartridge = ICartridge.JBOSSAS_7;
+ IApplication application = service.createApplication(applicationName, cartridge, user);
+ assertNotNull(application);
+ assertEquals(applicationName, application.getName());
+ assertEquals(cartridge, application.getCartridge());
+ } finally {
+ ApplicationUtils.silentlyDestroyAS7Application(applicationName, user, service);
+ }
+ }
+
+ @Test
+ public void canDestroyApplication() throws Exception {
+ String applicationName = ApplicationUtils.createRandomApplicationName();
+ service.createApplication(applicationName, ICartridge.JBOSSAS_7, user);
+ service.destroyApplication(applicationName, ICartridge.JBOSSAS_7, user);
+ }
+
+ @Test(expected = OpenshiftException.class)
+ public void createDuplicateApplicationThrowsException() throws Exception {
+ String applicationName = ApplicationUtils.createRandomApplicationName();
+ try {
+ service.createApplication(applicationName, ICartridge.JBOSSAS_7, user);
+ service.createApplication(applicationName, ICartridge.JBOSSAS_7, user);
+ } finally {
+ ApplicationUtils.silentlyDestroyAS7Application(applicationName, user, service);
+ }
+ }
+
+ @Test
+ public void canStopApplication() throws Exception {
+ String applicationName = ApplicationUtils.createRandomApplicationName();
+ try {
+ service.createApplication(applicationName, ICartridge.JBOSSAS_7, user);
+ service.stopApplication(applicationName, ICartridge.JBOSSAS_7, user);
+ } finally {
+ ApplicationUtils.silentlyDestroyAS7Application(applicationName, user, service);
+ }
+ }
+
+ @Test
+ public void canStartStoppedApplication() throws Exception {
+ String applicationName = ApplicationUtils.createRandomApplicationName();
+ try {
+ service.createApplication(applicationName, ICartridge.JBOSSAS_7, user);
+ service.stopApplication(applicationName, ICartridge.JBOSSAS_7, user);
+ service.startApplication(applicationName, ICartridge.JBOSSAS_7, user);
+ } finally {
+ ApplicationUtils.silentlyDestroyAS7Application(applicationName, user, service);
+ }
+ }
+
+ @Test
+ public void canStartStartedApplication() throws Exception {
+ String applicationName = ApplicationUtils.createRandomApplicationName();
+ try {
+ /**
+ * freshly created apps are started
+ *
+ * @link
+ * https://github.com/openshift/os-client-tools/blob/master/express
+ * /doc/API
+ */
+ service.createApplication(applicationName, ICartridge.JBOSSAS_7, user);
+ service.startApplication(applicationName, ICartridge.JBOSSAS_7, user);
+ } finally {
+ ApplicationUtils.silentlyDestroyAS7Application(applicationName, user, service);
+ }
+ }
+
+ @Test
+ public void canStopStoppedApplication() throws Exception {
+ String applicationName = ApplicationUtils.createRandomApplicationName();
+ try {
+ /**
+ * freshly created apps are started
+ *
+ * @link
+ * https://github.com/openshift/os-client-tools/blob/master/express
+ * /doc/API
+ */
+ service.createApplication(applicationName, ICartridge.JBOSSAS_7, user);
+ service.stopApplication(applicationName, ICartridge.JBOSSAS_7, user);
+ service.stopApplication(applicationName, ICartridge.JBOSSAS_7, user);
+ } finally {
+ ApplicationUtils.silentlyDestroyAS7Application(applicationName, user, service);
+ }
+ }
+
+ @Test
+ public void canRestartApplication() throws Exception {
+ String applicationName = ApplicationUtils.createRandomApplicationName();
+ try {
+ /**
+ * freshly created apps are started
+ *
+ * @link
+ * https://github.com/openshift/os-client-tools/blob/master/express
+ * /doc/API
+ */
+ service.createApplication(applicationName, ICartridge.JBOSSAS_7, user);
+ service.restartApplication(applicationName, ICartridge.JBOSSAS_7, user);
+ } finally {
+ ApplicationUtils.silentlyDestroyAS7Application(applicationName, user, service);
+ }
+ }
+
+ @Test
+ public void canGetStatus() throws Exception {
+ String applicationName = ApplicationUtils.createRandomApplicationName();
+ try {
+ IApplication application = service.createApplication(applicationName, ICartridge.JBOSSAS_7, user);
+ String applicationStatus = service.getStatus(application.getName(), application.getCartridge(), user);
+ assertNotNull(applicationStatus);
+ } finally {
+ ApplicationUtils.silentlyDestroyAS7Application(applicationName, user, service);
+ }
+ }
+
+ @Test
+ public void returnsValidGitUri() throws Exception {
+ String applicationName = ApplicationUtils.createRandomApplicationName();
+ try {
+ IApplication application = service.createApplication(applicationName, ICartridge.JBOSSAS_7, user);
+ String gitUri = application.getGitUri();
+ assertNotNull(gitUri);
+ assertGitUri(applicationName, gitUri);
+ } finally {
+ ApplicationUtils.silentlyDestroyAS7Application(applicationName, user, service);
+ }
+ }
+
+ @Test
+ public void returnsValidApplicationUrl() throws Exception {
+ String applicationName = ApplicationUtils.createRandomApplicationName();
+ try {
+ IApplication application = service.createApplication(applicationName, ICartridge.JBOSSAS_7, user);
+ String applicationUrl = application.getApplicationUrl();
+ assertNotNull(applicationUrl);
+ assertAppliactionUrl(applicationName, applicationUrl);
+ } finally {
+ ApplicationUtils.silentlyDestroyAS7Application(applicationName, user, service);
+ }
+ }
+}
Property changes on: trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/ApplicationIntegrationTest.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/ApplicationLogReaderIntegrationTest.java
===================================================================
--- trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/ApplicationLogReaderIntegrationTest.java (rev 0)
+++ trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/ApplicationLogReaderIntegrationTest.java 2011-10-05 11:06:15 UTC (rev 35359)
@@ -0,0 +1,116 @@
+/*******************************************************************************
+ * 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.tools.openshift.express.internal.client.test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+import org.jboss.tools.openshift.express.client.ApplicationLogReader;
+import org.jboss.tools.openshift.express.client.IApplication;
+import org.jboss.tools.openshift.express.client.ICartridge;
+import org.jboss.tools.openshift.express.client.IOpenshiftService;
+import org.jboss.tools.openshift.express.client.OpenshiftService;
+import org.jboss.tools.openshift.express.internal.client.test.fakes.TestUser;
+import org.jboss.tools.openshift.express.internal.client.test.utils.ApplicationUtils;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+
+/**
+ * @author André Dietisheim
+ */
+public class ApplicationLogReaderIntegrationTest {
+
+ private static final int LOGREADER_TIMEOUT = 10 * 1024;
+ private IOpenshiftService service;
+ private TestUser user;
+
+ @Before
+ public void setUp() {
+ this.service = new OpenshiftService();
+ this.user = new TestUser();
+ }
+
+ /**
+ * Asserts the service implementation: getStatus returns the same log if no
+ * new log entry is available
+ *
+ * @throws Exception
+ */
+ @Ignore
+ @Test
+ public void getStatusReturnsTheWholeLogIfNoNewLogEntryOnServer() throws Exception {
+ String applicationName = ApplicationUtils.createRandomApplicationName();
+ try {
+ IApplication application = service.createApplication(applicationName, ICartridge.JBOSSAS_7, user);
+ String applicationStatus = service.getStatus(application.getName(), application.getCartridge(), user);
+ String applicationStatus2 = service.getStatus(application.getName(), application.getCartridge(), user);
+ assertEquals(applicationStatus, applicationStatus2);
+ } finally {
+ ApplicationUtils.silentlyDestroyAS7Application(applicationName, user, service);
+ }
+ }
+
+ /**
+ * Asserts the service implementation: getStatus returns the new entries
+ * (and a tailing-header) if new log entries are available
+ */
+ @Ignore
+ @Test
+ public void getStatusReturnsNewEntriesIfNewLogEntriesOnServer() throws Exception {
+ String applicationName = ApplicationUtils.createRandomApplicationName();
+ try {
+ IApplication application = service.createApplication(applicationName, ICartridge.JBOSSAS_7, user);
+ String applicationStatus = service.getStatus(application.getName(), application.getCartridge(), user);
+ application.restart();
+ String applicationStatus2 = service.getStatus(application.getName(), application.getCartridge(), user);
+ assertFalse(applicationStatus.equals(applicationStatus2));
+ } finally {
+ ApplicationUtils.silentlyDestroyAS7Application(applicationName, user, service);
+ }
+ }
+
+ @Test
+ public void logReaderReturnsNewEntriesAfterApplicationRestart() throws Exception {
+ IApplication application = null;
+ ExecutorService executor = null;
+ try {
+ application = user.createTestApplication();
+ ApplicationLogReader logReader = application.getLogReader();
+ LogReaderRunnable logReaderRunnable = new LogReaderRunnable(logReader, LOGREADER_TIMEOUT);
+ executor = Executors.newSingleThreadExecutor();
+ executor.submit(logReaderRunnable);
+
+ String log = logReaderRunnable.waitUntilNoNewLogentries();
+ assertNotNull(log);
+ assertTrue(log.length() > 0);
+
+ application.restart();
+
+ String newLog = logReaderRunnable.waitUntilNoNewLogentries();
+ assertNotNull(newLog);
+ assertTrue(newLog.length() > 0);
+ assertFalse(log.equals(newLog));
+ } finally {
+ if (executor != null) {
+ executor.shutdownNow();
+ }
+ if (application != null) {
+ user.silentlyDestroyApplication(application);
+ }
+ }
+ }
+}
Property changes on: trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/ApplicationLogReaderIntegrationTest.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/ApplicationLogReaderTest.java
===================================================================
--- trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/ApplicationLogReaderTest.java (rev 0)
+++ trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/ApplicationLogReaderTest.java 2011-10-05 11:06:15 UTC (rev 35359)
@@ -0,0 +1,123 @@
+/*******************************************************************************
+ * 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.tools.openshift.express.internal.client.test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+import org.jboss.tools.openshift.express.client.ApplicationLogReader;
+import org.jboss.tools.openshift.express.client.ICartridge;
+import org.jboss.tools.openshift.express.client.IOpenshiftService;
+import org.jboss.tools.openshift.express.client.OpenshiftException;
+import org.jboss.tools.openshift.express.internal.client.Application;
+import org.jboss.tools.openshift.express.internal.client.InternalUser;
+import org.jboss.tools.openshift.express.internal.client.test.fakes.NoopOpenshiftServiceFake;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * @author André Dietisheim
+ */
+public class ApplicationLogReaderTest {
+
+ private static final int LOGREADER_TIMEOUT = 2 * 1024;
+
+ private static final String LOG_HEADER =
+ "tailing /var/lib/libra/f36a4acf8a73450cb98637ed4483ea02/1317146294966//jbossas-7.0/standalone/log/server.log"
+ + "------ Tail of 1317146294966 application server.log ------\n";
+
+ private static final String INITIAL_LOG =
+ "11:31:36,289 INFO [org.jboss.as.ee] (Controller Boot Thread) Activating EE subsystem\n"
+ + "11:31:36,340 INFO [org.apache.coyote.http11.Http11Protocol] (MSC service thread 1-1) Starting Coyote HTTP/1.1 on http--127.1.9.1-8080\n"
+ + "11:31:36,440 INFO [org.jboss.as.connector] (MSC service thread 1-4) Starting JCA Subsystem (JBoss IronJacamar 1.0.3.Final)\n"
+ + "11:31:36,471 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-1) Bound data source [java:jboss/datasources/ExampleDS]\n"
+ + "11:31:36,966 INFO [org.jboss.as.deployment] (MSC service thread 1-3) Started FileSystemDeploymentService for directory /var/lib/libra/b8ea642ed6aa4dd0af2a4fe94c0ff07c/1317137507620/jbossas-7.0/standalone/deployments\n"
+ + "11:31:36,982 INFO [org.jboss.as] (Controller Boot Thread) JBoss AS 7.0.1.Final \"Zap\" started in 2796ms - Started 82 of 107 services (22 services are passive or on-demand)\n"
+ + "11:31:37,004 INFO [org.jboss.as.server.deployment] (MSC service thread 1-2) Starting deployment of \"ROOT.war\"\n"
+ + "11:31:37,084 INFO [org.jboss.as.jpa] (MSC service thread 1-4) added javax.persistence.api dependency to ROOT.war\n"
+ + "11:31:37,403 INFO [org.jboss.web] (MSC service thread 1-3) registering web context: \n"
+ + "11:31:37,445 INFO [org.jboss.as.server.controller] (DeploymentScanner-threads - 2) Deployed \"ROOT.war\"\n";
+
+ private static final String LOG_CONTINUATION =
+ "11:32:13,187 INFO [org.apache.catalina.core.AprLifecycleListener] (MSC service thread 1-3) The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/lib/amd64/server:/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/lib/amd64:/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/../lib/amd64:/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib\n"
+ + "11:32:13,295 INFO [org.apache.coyote.http11.Http11Protocol] (MSC service thread 1-1) Starting Coyote HTTP/1.1 on http--127.1.9.1-8080\n"
+ + "11:32:13,344 INFO [org.jboss.as.connector] (MSC service thread 1-1) Starting JCA Subsystem (JBoss IronJacamar 1.0.3.Final)\n"
+ + "11:32:13,383 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-2) Bound data source [java:jboss/datasources/ExampleDS]\n"
+ + "11:32:13,746 INFO [org.jboss.as.deployment] (MSC service thread 1-2) Started FileSystemDeploymentService for directory /var/lib/libra/b8ea642ed6aa4dd0af2a4fe94c0ff07c/1317137507620/jbossas-7.0/standalone/deployments\n"
+ + "11:32:13,764 INFO [org.jboss.as] (Controller Boot Thread) JBoss AS 7.0.1.Final \"Zap\" started in 2736ms - Started 82 of 107 services (22 services are passive or on-demand)\n"
+ + "11:32:13,772 INFO [org.jboss.as.server.deployment] (MSC service thread 1-4) Starting deployment of \"ROOT.war\"\n"
+ + "11:32:13,868 INFO [org.jboss.as.jpa] (MSC service thread 1-1) added javax.persistence.api dependency to ROOT.war\n"
+ + "11:32:14,176 INFO [org.jboss.web] (MSC service thread 1-2) registering web context: \n"
+ + "11:32:14,207 INFO [org.jboss.as.server.controller] (DeploymentScanner-threads - 2) Deployed \"ROOT.war\"\n";
+
+ private String status = LOG_HEADER + INITIAL_LOG;
+ private IOpenshiftService statusService;
+ private Application application;
+
+ @Before
+ public void setUp() {
+ this.statusService = new NoopOpenshiftServiceFake() {
+
+ @Override
+ public String getStatus(String applicationName, ICartridge cartridge, InternalUser user)
+ throws OpenshiftException {
+ return status;
+ }
+ };
+
+ this.application = new ApplicationLogFake(statusService);
+ }
+
+ @Test
+ public void logReaderReturnsNewEntriesAfterApplicationRestart() throws Exception {
+ ExecutorService executor = null;
+ try {
+ ApplicationLogReader logReader = application.getLogReader();
+ LogReaderRunnable logReaderRunnable = new LogReaderRunnable(logReader, LOGREADER_TIMEOUT);
+ executor = Executors.newSingleThreadExecutor();
+ executor.submit(logReaderRunnable);
+
+ String log = logReaderRunnable.waitUntilNoNewLogentries();
+ assertNotNull(log);
+ assertTrue(log.length() > 0);
+
+ application.restart();
+
+ String newLog = logReaderRunnable.waitUntilNoNewLogentries();
+ assertNotNull(newLog);
+ assertTrue(newLog.length() > 0);
+ assertFalse(log.equals(newLog));
+ assertEquals(INITIAL_LOG + LOG_CONTINUATION, logReaderRunnable.getLog());
+ } finally {
+ if (executor != null) {
+ executor.shutdownNow();
+ }
+ }
+ }
+
+ private class ApplicationLogFake extends Application {
+
+ private ApplicationLogFake(IOpenshiftService service) {
+ super("fakeApplication", ICartridge.JBOSSAS_7, null, service);
+ }
+
+ @Override
+ public synchronized void restart() throws OpenshiftException {
+ status = LOG_CONTINUATION;
+ this.notifyAll();
+ }
+ };
+}
Property changes on: trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/ApplicationLogReaderTest.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/ApplicationTest.java
===================================================================
--- trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/ApplicationTest.java (rev 0)
+++ trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/ApplicationTest.java 2011-10-05 11:06:15 UTC (rev 35359)
@@ -0,0 +1,233 @@
+/*******************************************************************************
+ * 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.tools.openshift.express.internal.client.test;
+
+import static org.jboss.tools.openshift.express.internal.client.test.utils.ApplicationAsserts.assertAppliactionUrl;
+import static org.jboss.tools.openshift.express.internal.client.test.utils.ApplicationAsserts.assertGitUri;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.IOException;
+import java.net.URLEncoder;
+import java.util.Arrays;
+
+import org.jboss.tools.openshift.express.client.ApplicationLogReader;
+import org.jboss.tools.openshift.express.client.IApplication;
+import org.jboss.tools.openshift.express.client.ICartridge;
+import org.jboss.tools.openshift.express.client.OpenshiftException;
+import org.jboss.tools.openshift.express.client.OpenshiftService;
+import org.jboss.tools.openshift.express.internal.client.Application;
+import org.jboss.tools.openshift.express.internal.client.ApplicationInfo;
+import org.jboss.tools.openshift.express.internal.client.InternalUser;
+import org.jboss.tools.openshift.express.internal.client.UserInfo;
+import org.jboss.tools.openshift.express.internal.client.request.ApplicationAction;
+import org.jboss.tools.openshift.express.internal.client.request.ApplicationRequest;
+import org.jboss.tools.openshift.express.internal.client.request.OpenshiftEnvelopeFactory;
+import org.jboss.tools.openshift.express.internal.client.request.marshalling.ApplicationRequestJsonMarshaller;
+import org.jboss.tools.openshift.express.internal.client.response.OpenshiftResponse;
+import org.jboss.tools.openshift.express.internal.client.response.unmarshalling.ApplicationResponseUnmarshaller;
+import org.jboss.tools.openshift.express.internal.client.response.unmarshalling.ApplicationStatusResponseUnmarshaller;
+import org.jboss.tools.openshift.express.internal.client.response.unmarshalling.JsonSanitizer;
+import org.jboss.tools.openshift.express.internal.client.test.fakes.ApplicationResponseFake;
+import org.jboss.tools.openshift.express.internal.client.test.fakes.NoopOpenshiftServiceFake;
+import org.junit.Test;
+
+/**
+ * @author André Dietisheim
+ */
+public class ApplicationTest {
+
+ private InternalUser user = new InternalUser(ApplicationResponseFake.RHLOGIN, ApplicationResponseFake.PASSWORD,
+ new NoopOpenshiftServiceFake());
+
+ @Test
+ public void canMarshallApplicationCreateRequest() throws Exception {
+ String expectedRequestString =
+ "password="
+ + URLEncoder.encode(ApplicationResponseFake.PASSWORD, "UTF-8")
+ + "&json_data=%7B"
+ + "%22rhlogin%22+%3A+%22"
+ + URLEncoder.encode(ApplicationResponseFake.RHLOGIN, "UTF-8")
+ + "%22"
+ + "%2C+%22debug%22+%3A+%22true%22"
+ + "%2C+%22cartridge%22+%3A+%22jbossas-7.0%22"
+ + "%2C+%22action%22+%3A+%22"
+ + "configure"
+ + "%22%2C+%22app_name%22+%3A+%22test-application%22"
+ + "%7D";
+
+ String createApplicationRequest = new ApplicationRequestJsonMarshaller().marshall(
+ new ApplicationRequest(
+ "test-application", ICartridge.JBOSSAS_7, ApplicationAction.CONFIGURE,
+ ApplicationResponseFake.RHLOGIN, true));
+ String effectiveRequest = new OpenshiftEnvelopeFactory(ApplicationResponseFake.PASSWORD,
+ createApplicationRequest).createString();
+
+ assertEquals(expectedRequestString, effectiveRequest);
+ }
+
+ @Test
+ public void canMarshallApplicationDestroyRequest() throws Exception {
+ String expectedRequestString =
+ "password="
+ + URLEncoder.encode(ApplicationResponseFake.PASSWORD, "UTF-8")
+ + "&json_data=%7B"
+ + "%22rhlogin%22+%3A+"
+ + "%22" + URLEncoder.encode(ApplicationResponseFake.RHLOGIN, "UTF-8") + "%22"
+ + "%2C+%22debug%22+%3A+%22true%22"
+ + "%2C+%22cartridge%22+%3A+%22jbossas-7.0%22"
+ + "%2C+%22action%22+%3A+%22"
+ + "deconfigure"
+ + "%22%2C+%22app_name%22+%3A+%22test-application%22"
+ + "%7D";
+
+ String createApplicationRequest = new ApplicationRequestJsonMarshaller().marshall(
+ new ApplicationRequest(
+ "test-application", ICartridge.JBOSSAS_7, ApplicationAction.DECONFIGURE,
+ ApplicationResponseFake.RHLOGIN, true));
+ String effectiveRequest = new OpenshiftEnvelopeFactory(ApplicationResponseFake.PASSWORD,
+ createApplicationRequest).createString();
+
+ assertEquals(expectedRequestString, effectiveRequest);
+ }
+
+ @Test
+ public void canUnmarshallApplicationResponse() throws OpenshiftException {
+ String response = JsonSanitizer.sanitize(ApplicationResponseFake.appResponse);
+ OpenshiftResponse<Application> openshiftResponse =
+ new ApplicationResponseUnmarshaller(
+ ApplicationResponseFake.APPLICATION_NAME, ApplicationResponseFake.APPLICATION_CARTRIDGE,
+ user, new NoopOpenshiftServiceFake())
+ .unmarshall(response);
+ Application application = openshiftResponse.getOpenshiftObject();
+ assertNotNull(application);
+ assertEquals(ApplicationResponseFake.APPLICATION_NAME, application.getName());
+ assertEquals(ApplicationResponseFake.APPLICATION_CARTRIDGE, application.getCartridge());
+ }
+
+ @Test
+ public void returnsValidGitUri() throws OpenshiftException {
+ OpenshiftService userInfoService = createUserInfoService();
+ InternalUser user = createUser(userInfoService);
+ IApplication application = createApplication(userInfoService, user);
+
+ String gitUri = application.getGitUri();
+ assertNotNull(gitUri);
+ assertGitUri(
+ ApplicationResponseFake.APPLICATION_UUID
+ , ApplicationResponseFake.APPLICATION_NAME
+ , ApplicationResponseFake.NAMESPACE
+ , ApplicationResponseFake.RHC_DOMAIN
+ , gitUri);
+ }
+
+ @Test
+ public void returnsValidApplicationUrl() throws OpenshiftException {
+ OpenshiftService userInfoService = createUserInfoService();
+ InternalUser user = createUser(userInfoService);
+ IApplication application = createApplication(userInfoService, user);
+
+ String applicationUrl = application.getApplicationUrl();
+ assertNotNull(applicationUrl);
+ assertAppliactionUrl(
+ ApplicationResponseFake.APPLICATION_NAME
+ , ApplicationResponseFake.NAMESPACE
+ , ApplicationResponseFake.RHC_DOMAIN
+ , applicationUrl);
+ }
+
+ @Test
+ public void canUnmarshallApplicationStatus() throws OpenshiftException {
+ String response = JsonSanitizer.sanitize(ApplicationResponseFake.statusResponse);
+ OpenshiftResponse<String> openshiftResponse =
+ new ApplicationStatusResponseUnmarshaller().unmarshall(response);
+ String status = openshiftResponse.getOpenshiftObject();
+ assertNotNull(status);
+ assertTrue(status.startsWith("tailing "));
+ }
+
+ @Test
+ public void canReadFromApplicationLogReader() throws IOException {
+
+ OpenshiftService service = new NoopOpenshiftServiceFake() {
+ @Override
+ public String getStatus(String applicationName, ICartridge cartridge, InternalUser user) throws OpenshiftException {
+ return ApplicationResponseFake.tail;
+ }
+ };
+
+ Application application =
+ new Application(ApplicationResponseFake.APPLICATION_NAME,
+ ApplicationResponseFake.APPLICATION_CARTRIDGE, user, service);
+ ApplicationLogReader reader = new ApplicationLogReader(application, user, service);
+
+ int charactersRead = 0;
+ int character = -1;
+ while (charactersRead < ApplicationResponseFake.log.length()
+ && (character = reader.read()) != -1) {
+ char characterToMatch = ApplicationResponseFake.log.charAt(charactersRead++);
+ assertEquals(
+ "character at position " + charactersRead
+ + " was '" + character + "'"
+ + " but we expected '" + characterToMatch + "'.",
+ characterToMatch, character);
+ }
+ }
+
+ private IApplication createApplication(OpenshiftService userInfoService, InternalUser user) {
+ Application application = new Application(
+ ApplicationResponseFake.APPLICATION_NAME
+ , ApplicationResponseFake.APPLICATION_CARTRIDGE
+ , new ApplicationInfo(
+ ApplicationResponseFake.APPLICATION_NAME
+ , ApplicationResponseFake.APPLICATION_UUID
+ , ApplicationResponseFake.APPLICATION_EMBEDDED
+ , ApplicationResponseFake.APPLICATION_CARTRIDGE
+ , ApplicationResponseFake.APPLICATION_CREATIONTIME)
+ , user
+ , userInfoService);
+ /**
+ * we have to add it manually since we dont create the application with
+ * the user class
+ *
+ * @see user#createApplication
+ */
+ user.add(application);
+ return application;
+ }
+
+ private InternalUser createUser(OpenshiftService userInfoService) {
+ return new InternalUser(ApplicationResponseFake.RHLOGIN, ApplicationResponseFake.PASSWORD, userInfoService);
+ }
+
+ private OpenshiftService createUserInfoService() {
+ OpenshiftService userInfoService = new NoopOpenshiftServiceFake() {
+ @Override
+ public UserInfo getUserInfo(InternalUser user) throws OpenshiftException {
+ ApplicationInfo applicationInfo = new ApplicationInfo(
+ ApplicationResponseFake.APPLICATION_NAME,
+ ApplicationResponseFake.APPLICATION_UUID,
+ ApplicationResponseFake.APPLICATION_EMBEDDED,
+ ApplicationResponseFake.APPLICATION_CARTRIDGE,
+ ApplicationResponseFake.APPLICATION_CREATIONTIME);
+ return new UserInfo(
+ ApplicationResponseFake.RHLOGIN,
+ ApplicationResponseFake.UUID,
+ ApplicationResponseFake.SSHPUBLICKEY,
+ ApplicationResponseFake.RHC_DOMAIN,
+ ApplicationResponseFake.NAMESPACE,
+ Arrays.asList(new ApplicationInfo[] { applicationInfo }));
+ }
+ };
+ return userInfoService;
+ }
+}
Property changes on: trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/ApplicationTest.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/CartridgeTest.java
===================================================================
--- trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/CartridgeTest.java (rev 0)
+++ trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/CartridgeTest.java 2011-10-05 11:06:15 UTC (rev 35359)
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * 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.tools.openshift.express.internal.client.test;
+
+import static org.jboss.tools.openshift.express.internal.client.test.utils.CartridgeAsserts.assertThatContainsCartridge;
+import static org.junit.Assert.assertNotNull;
+
+import java.util.List;
+
+import org.jboss.tools.openshift.express.client.ICartridge;
+import org.jboss.tools.openshift.express.client.OpenshiftException;
+import org.jboss.tools.openshift.express.internal.client.response.OpenshiftResponse;
+import org.jboss.tools.openshift.express.internal.client.response.unmarshalling.JsonSanitizer;
+import org.jboss.tools.openshift.express.internal.client.response.unmarshalling.ListCartridgesResponseUnmarshaller;
+import org.jboss.tools.openshift.express.internal.client.test.fakes.CartridgeResponseFake;
+import org.junit.Test;
+
+/**
+ * @author André Dietisheim
+ */
+public class CartridgeTest {
+
+ @Test
+ public void canUnmarshallApplicationResponse() throws OpenshiftException {
+ String response = JsonSanitizer.sanitize(CartridgeResponseFake.RESPONSE);
+ OpenshiftResponse<List<ICartridge>> openshiftResponse =
+ new ListCartridgesResponseUnmarshaller().unmarshall(response);
+ List<ICartridge> cartridges = openshiftResponse.getOpenshiftObject();
+ assertNotNull(cartridges);
+ assertThatContainsCartridge(CartridgeResponseFake.CARTRIDGE_JBOSSAS70, cartridges);
+ assertThatContainsCartridge(CartridgeResponseFake.CARTRIDGE_PERL5, cartridges);
+ assertThatContainsCartridge(CartridgeResponseFake.CARTRIDGE_PHP53, cartridges);
+ assertThatContainsCartridge(CartridgeResponseFake.CARTRIDGE_RACK11, cartridges);
+ assertThatContainsCartridge(CartridgeResponseFake.CARTRIDGE_WSGI32, cartridges);
+ }
+}
Property changes on: trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/CartridgeTest.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/CartridgesIntegrationTest.java
===================================================================
--- trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/CartridgesIntegrationTest.java (rev 0)
+++ trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/CartridgesIntegrationTest.java 2011-10-05 11:06:15 UTC (rev 35359)
@@ -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.tools.openshift.express.internal.client.test;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.List;
+
+import org.jboss.tools.openshift.express.client.ICartridge;
+import org.jboss.tools.openshift.express.client.OpenshiftService;
+import org.jboss.tools.openshift.express.client.User;
+import org.jboss.tools.openshift.express.internal.client.test.fakes.TestUser;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+
+/**
+ * @author André Dietisheim
+ */
+public class CartridgesIntegrationTest {
+
+ private OpenshiftService openshiftService;
+
+ private User user;
+
+ @Before
+ public void setUp() {
+ this.openshiftService = new OpenshiftService();
+ this.user = new TestUser();
+ }
+
+ @Ignore
+ @Test
+ public void canRequestListCartridges() throws Exception {
+ List<ICartridge> cartridges = openshiftService.getCartridges(user);
+ assertNotNull(cartridges);
+ assertTrue(cartridges.size() > 0);
+ }
+}
Property changes on: trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/CartridgesIntegrationTest.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/DomainIntegrationTest.java
===================================================================
--- trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/DomainIntegrationTest.java (rev 0)
+++ trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/DomainIntegrationTest.java 2011-10-05 11:06:15 UTC (rev 35359)
@@ -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.tools.openshift.express.internal.client.test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import org.jboss.tools.openshift.express.client.IDomain;
+import org.jboss.tools.openshift.express.client.OpenshiftService;
+import org.jboss.tools.openshift.express.client.SSHKeyPair;
+import org.jboss.tools.openshift.express.internal.client.test.fakes.TestSSHKey;
+import org.jboss.tools.openshift.express.internal.client.test.fakes.TestUser;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+
+public class DomainIntegrationTest {
+
+ private OpenshiftService openshiftService;
+ private TestUser user;
+
+ @Before
+ public void setUp() {
+ this.openshiftService = new OpenshiftService();
+ this.user = new TestUser();
+ }
+
+ @Ignore
+ @Test
+ public void canCreateDomain() throws Exception {
+
+ String domainName = createRandomString();
+ SSHKeyPair sshKey = TestSSHKey.create();
+ IDomain domain = openshiftService.createDomain(domainName, sshKey, user);
+
+ assertNotNull(domain);
+ assertEquals(domainName, domain.getNamespace());
+ }
+
+ @Ignore
+ @Test
+ public void canChangeDomain() throws Exception {
+
+ String domainName = createRandomString();
+ SSHKeyPair sshKey = TestSSHKey.create();
+ IDomain domain = openshiftService.changeDomain(domainName, sshKey, user);
+
+ assertNotNull(domain);
+ assertEquals(domainName, domain.getNamespace());
+ }
+
+ @Test
+ public void canSetNamespaceOnDomain() throws Exception {
+ IDomain domain = user.getDomain();
+ assertNotNull(domain);
+ String newDomainName = createRandomString();
+ domain.setNamespace(newDomainName);
+ assertEquals(newDomainName, domain.getNamespace());
+ }
+
+ private String createRandomString() {
+ return String.valueOf(System.currentTimeMillis());
+ }
+}
Property changes on: trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/DomainIntegrationTest.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/DomainTest.java
===================================================================
--- trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/DomainTest.java (rev 0)
+++ trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/DomainTest.java 2011-10-05 11:06:15 UTC (rev 35359)
@@ -0,0 +1,124 @@
+/*******************************************************************************
+ * 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.tools.openshift.express.internal.client.test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
+
+import org.jboss.tools.openshift.express.client.IDomain;
+import org.jboss.tools.openshift.express.client.IOpenshiftService;
+import org.jboss.tools.openshift.express.client.OpenshiftException;
+import org.jboss.tools.openshift.express.client.SSHKeyPair;
+import org.jboss.tools.openshift.express.internal.client.InternalUser;
+import org.jboss.tools.openshift.express.internal.client.request.ChangeDomainRequest;
+import org.jboss.tools.openshift.express.internal.client.request.CreateDomainRequest;
+import org.jboss.tools.openshift.express.internal.client.request.OpenshiftEnvelopeFactory;
+import org.jboss.tools.openshift.express.internal.client.request.marshalling.DomainRequestJsonMarshaller;
+import org.jboss.tools.openshift.express.internal.client.response.OpenshiftResponse;
+import org.jboss.tools.openshift.express.internal.client.response.unmarshalling.DomainResponseUnmarshaller;
+import org.jboss.tools.openshift.express.internal.client.response.unmarshalling.JsonSanitizer;
+import org.jboss.tools.openshift.express.internal.client.test.fakes.NoopOpenshiftServiceFake;
+import org.jboss.tools.openshift.express.internal.client.test.fakes.TestSSHKey;
+import org.junit.Test;
+
+/**
+ * @author André Dietisheim
+ */
+public class DomainTest {
+
+ private static final String RHLOGIN = "toolsjboss(a)gmail.com";
+ private static final String PASSWORD = "1q2w3e";
+ private static final String UUID = "0c82860dae904a4d87f8e5d87a5af840";
+
+ @Test
+ public void canMarshallDomainCreateRequest() throws IOException, OpenshiftException {
+ SSHKeyPair sshKey = TestSSHKey.create();
+ String expectedRequestString = createDomainRequestString(PASSWORD, RHLOGIN, true, "myDomain", false,
+ sshKey.getPublicKey());
+
+ CreateDomainRequest request = new CreateDomainRequest("myDomain", sshKey, RHLOGIN, true);
+ String requestString =
+ new OpenshiftEnvelopeFactory(
+ PASSWORD,
+ new DomainRequestJsonMarshaller().marshall(request))
+ .createString();
+ assertEquals(expectedRequestString, requestString);
+ }
+
+ @Test
+ public void canUnmarshallDomainCreateResponse() throws IOException, OpenshiftException {
+ String domainName = "myDomain";
+ String responseString = createDomainResponseString(RHLOGIN, UUID);
+
+ responseString = JsonSanitizer.sanitize(responseString);
+ IOpenshiftService service = new NoopOpenshiftServiceFake();
+ InternalUser user = new InternalUser(RHLOGIN, PASSWORD, service);
+ OpenshiftResponse<IDomain> response = new DomainResponseUnmarshaller(domainName, user, service).unmarshall(responseString);
+
+ assertNotNull(response);
+ IDomain domain = response.getOpenshiftObject();
+ assertEquals(domainName, domain.getNamespace());
+ }
+
+ @Test
+ public void canMarshallDomainAlterRequest() throws IOException, OpenshiftException {
+ SSHKeyPair sshKey = TestSSHKey.create();
+ String expectedRequestString = createDomainRequestString(PASSWORD, RHLOGIN, true, "myDomain", true,
+ sshKey.getPublicKey());
+
+ ChangeDomainRequest request = new ChangeDomainRequest("myDomain", sshKey, RHLOGIN, true);
+ String requestString =
+ new OpenshiftEnvelopeFactory(
+ PASSWORD,
+ new DomainRequestJsonMarshaller().marshall(request))
+ .createString();
+ assertEquals(expectedRequestString, requestString);
+ }
+
+ private String createDomainRequestString(String password, String username, boolean debug, String namespace,
+ boolean alter, String sshPublicKey) throws UnsupportedEncodingException {
+ return "password="
+ + password
+ + "&json_data=%7B"
+ + "%22rhlogin%22+%3A+"
+ + "%22"
+ + URLEncoder.encode(username, "UTF-8")
+ + "%22"
+ + "%2C+%22debug%22+%3A+%22" + String.valueOf(debug) + "%22"
+ + "%2C+%22namespace%22+%3A+%22" + URLEncoder.encode(namespace, "UTF-8") + "%22"
+ + "%2C+%22alter%22+%3A+%22" + String.valueOf(alter) + "%22"
+ + "%2C+%22ssh%22+%3A+%22"
+ + URLEncoder.encode(sshPublicKey, "UTF-8")
+ + "%22"
+ + "%7D";
+ }
+
+ /**
+ * WARNING: the response this method returns matches the actual response
+ * from the openshift service (9-12-2011). It is not valid json since it quotes the
+ * nested json object
+ * <p>
+ * "data": "{\"rhlogin\": ...
+ */
+ private String createDomainResponseString(String username, String uuid) {
+ return "{\"messages\":\"\",\"debug\":\"\",\"data\":\""
+ + "{\\\"rhlogin\\\":\\\""
+ + username
+ + "\\\",\\\"uuid\\\":\\\""
+ + uuid
+ + "\\\"}"
+ + "\",\"api\":\"1.1.1\",\"api_c\":[\"placeholder\"],\"result\":null,\"broker\":\"1.1.1\",\"broker_c\":[\"namespace\",\"rhlogin\",\"ssh\",\"app_uuid\",\"debug\",\"alter\",\"cartridge\",\"cart_type\",\"action\",\"app_name\",\"api\"],\"exit_code\":0}";
+ }
+}
Property changes on: trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/DomainTest.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/IOpenshiftTestService.java
===================================================================
--- trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/IOpenshiftTestService.java (rev 0)
+++ trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/IOpenshiftTestService.java 2011-10-05 11:06:15 UTC (rev 35359)
@@ -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.tools.openshift.express.internal.client.test;
+
+import org.jboss.tools.openshift.express.client.IOpenshiftService;
+
+/**
+ * @author André Dietisheim
+ */
+public interface IOpenshiftTestService extends IOpenshiftService {
+
+ public static final String STAGING_BASE_URL = "";
+
+}
Property changes on: trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/IOpenshiftTestService.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/JsonSanitizerTest.java
===================================================================
--- trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/JsonSanitizerTest.java (rev 0)
+++ trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/JsonSanitizerTest.java 2011-10-05 11:06:15 UTC (rev 35359)
@@ -0,0 +1,77 @@
+/*******************************************************************************
+ * 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.tools.openshift.express.internal.client.test;
+
+import static org.junit.Assert.assertEquals;
+
+import org.jboss.dmr.ModelNode;
+import org.jboss.tools.openshift.express.client.OpenshiftException;
+import org.jboss.tools.openshift.express.internal.client.response.unmarshalling.JsonSanitizer;
+import org.junit.Test;
+
+/**
+ * @author André Dietisheim
+ */
+public class JsonSanitizerTest {
+
+ @Test
+ public void canSanitizeQuotedJsonObject() throws OpenshiftException {
+ String quotedJsonObject =
+ "\"{"
+ + "\\\"carts\\\":"
+ + "\\\"perl-5.10\\\""
+ + "}\"";
+
+ String sanitizedJson = JsonSanitizer.sanitize(quotedJsonObject);
+ assertEquals("{\"carts\":\"perl-5.10\"}", sanitizedJson);
+ }
+
+ @Test
+ public void doesNotTuchValidJson() throws OpenshiftException {
+ String quotedJsonObject =
+ "{"
+ + "\"carts\":"
+ + "\"perl-5.10\""
+ + "}";
+
+ String sanitizedJson = JsonSanitizer.sanitize(quotedJsonObject);
+ assertEquals("{\"carts\":\"perl-5.10\"}", sanitizedJson);
+ }
+
+ @Test
+ public void doesNotRemoveEscapedQuoteInStringValue() throws OpenshiftException {
+ String quotedJsonObject =
+ "\"{"
+ + "\\\"property\\\":"
+ + "\\\"stringWithA\\\\\"Quote\""
+ + "}\"";
+
+ String sanitizedJson = JsonSanitizer.sanitize(quotedJsonObject);
+ assertEquals("{\"property\":\"stringWithA\\\"Quote\"}", sanitizedJson);
+ ModelNode node = ModelNode.fromJSONString(sanitizedJson);
+ assertEquals("stringWithA\"Quote", node.get("property").asString());
+ }
+
+ @Test
+ public void doesNotRemoveEscapedQuoteInStringValueWithinValidJsonObject() throws OpenshiftException {
+ String quotedJsonObject =
+ "{"
+ + "\"property\":"
+ + "\"stringWithA\\\"Quote\""
+ + "}";
+
+ String sanitizedJson = JsonSanitizer.sanitize(quotedJsonObject);
+ assertEquals("{\"property\":\"stringWithA\\\"Quote\"}", sanitizedJson);
+ ModelNode node = ModelNode.fromJSONString(sanitizedJson);
+ assertEquals("stringWithA\"Quote", node.get("property").asString());
+ }
+
+}
Property changes on: trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/JsonSanitizerTest.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/ListCartridgesIntegrationTest.java
===================================================================
--- trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/ListCartridgesIntegrationTest.java (rev 0)
+++ trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/ListCartridgesIntegrationTest.java 2011-10-05 11:06:15 UTC (rev 35359)
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * 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.tools.openshift.express.internal.client.test;
+
+import static org.jboss.tools.openshift.express.internal.client.test.utils.CartridgeAsserts.assertThatContainsCartridge;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.List;
+
+import org.jboss.tools.openshift.express.client.ICartridge;
+import org.jboss.tools.openshift.express.client.OpenshiftService;
+import org.jboss.tools.openshift.express.internal.client.test.fakes.TestUser;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * @author André Dietisheim
+ */
+public class ListCartridgesIntegrationTest {
+
+ private OpenshiftService openshiftService;
+ private TestUser user;
+
+ @Before
+ public void setUp() {
+ this.openshiftService = new OpenshiftService();
+ this.user = new TestUser();
+ }
+
+ @Test
+ public void canListCartridges() throws Exception {
+ List<ICartridge> cartridges = openshiftService.getCartridges(user);
+ assertNotNull(cartridges);
+ assertTrue(cartridges.size() > 0);
+ assertThatContainsCartridge("jbossas-7.0", cartridges);
+ }
+}
Property changes on: trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/ListCartridgesIntegrationTest.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/ListCartridgesTest.java
===================================================================
--- trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/ListCartridgesTest.java (rev 0)
+++ trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/ListCartridgesTest.java 2011-10-05 11:06:15 UTC (rev 35359)
@@ -0,0 +1,94 @@
+/*******************************************************************************
+ * 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.tools.openshift.express.internal.client.test;
+
+import static org.jboss.tools.openshift.express.internal.client.test.utils.CartridgeAsserts.assertThatContainsCartridge;
+import static org.junit.Assert.assertEquals;
+
+import java.net.URLEncoder;
+import java.util.List;
+
+import org.jboss.tools.openshift.express.client.ICartridge;
+import org.jboss.tools.openshift.express.client.OpenshiftException;
+import org.jboss.tools.openshift.express.internal.client.request.ListCartridgesRequest;
+import org.jboss.tools.openshift.express.internal.client.request.OpenshiftEnvelopeFactory;
+import org.jboss.tools.openshift.express.internal.client.request.marshalling.ListCartridgesRequestJsonMarshaller;
+import org.jboss.tools.openshift.express.internal.client.response.OpenshiftResponse;
+import org.jboss.tools.openshift.express.internal.client.response.unmarshalling.JsonSanitizer;
+import org.jboss.tools.openshift.express.internal.client.response.unmarshalling.ListCartridgesResponseUnmarshaller;
+import org.junit.Test;
+
+/**
+ * @author André Dietisheim
+ */
+public class ListCartridgesTest {
+
+ private static final String USERNAME = "toolsjboss(a)gmail.com";
+ private static final String PASSWORD = "1q2w3e";
+
+ @Test
+ public void canMarshallListCartridgesRequest() throws Exception {
+ String expectedRequestString = "password=" + PASSWORD + "&json_data=%7B%22rhlogin%22+%3A+%22"
+ + URLEncoder.encode(USERNAME, "UTF-8")
+ + "%22%2C+%22debug%22+%3A+%22true%22%2C+%22cart_type%22+%3A+%22standalone%22%7D";
+
+ String listCartridgeRequest = new ListCartridgesRequestJsonMarshaller().marshall(
+ new ListCartridgesRequest(USERNAME, true));
+ String effectiveRequest = new OpenshiftEnvelopeFactory(PASSWORD, listCartridgeRequest).createString();
+
+ assertEquals(expectedRequestString, effectiveRequest);
+ }
+
+ @Test
+ public void canUnmarshallCartridgeListResponse() throws OpenshiftException {
+ String cartridgeListResponse =
+ "{"
+ + "\"messages\":\"\","
+ + "\"debug\":\"\","
+ + "\"data\":"
+ + "\"{\\\"carts\\\":[\\\"perl-5.10\\\",\\\"jbossas-7.0\\\",\\\"wsgi-3.2\\\",\\\"rack-1.1\\\",\\\"php-5.3\\\"]}\","
+ + "\"api\":\"1.1.1\","
+ + "\"api_c\":[\"placeholder\"],"
+ + "\"result\":null,"
+ + "\"broker\":\"1.1.1\","
+ + "\"broker_c\":["
+ + "\"namespace\","
+ + "\"rhlogin\","
+ + "\"ssh\","
+ + "\"app_uuid\","
+ + "\"debug\","
+ + "\"alter\","
+ + "\"cartridge\","
+ + "\"cart_type\","
+ + "\"action\","
+ + "\"app_name\","
+ + "\"api"
+ + "\"],"
+ + "\"exit_code\":0}";
+
+ cartridgeListResponse = JsonSanitizer.sanitize(cartridgeListResponse);
+ OpenshiftResponse<List<ICartridge>> response =
+ new ListCartridgesResponseUnmarshaller().unmarshall(cartridgeListResponse);
+ assertEquals("", response.getMessages());
+ assertEquals(false, response.isDebug());
+
+ List<ICartridge> cartridges = response.getOpenshiftObject();
+ assertEquals(5, cartridges.size());
+ assertThatContainsCartridge("perl-5.10", cartridges);
+ assertThatContainsCartridge("jbossas-7.0", cartridges);
+ assertThatContainsCartridge("wsgi-3.2", cartridges);
+ assertThatContainsCartridge("rack-1.1", cartridges);
+ assertThatContainsCartridge("php-5.3", cartridges);
+ assertEquals(null, response.getResult());
+ assertEquals(0, response.getExitCode());
+ }
+
+}
Property changes on: trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/ListCartridgesTest.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/LogReaderRunnable.java
===================================================================
--- trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/LogReaderRunnable.java (rev 0)
+++ trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/LogReaderRunnable.java 2011-10-05 11:06:15 UTC (rev 35359)
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * 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.tools.openshift.express.internal.client.test;
+
+import static org.junit.Assert.fail;
+
+import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.LinkedBlockingDeque;
+import java.util.concurrent.TimeUnit;
+
+import org.jboss.tools.openshift.express.client.ApplicationLogReader;
+
+public class LogReaderRunnable implements Runnable {
+
+ private ApplicationLogReader logReader;
+ private long timeout;
+ private BlockingQueue<Character> logQueue = new LinkedBlockingDeque<Character>();
+ private StringBuilder logBuilder = new StringBuilder();
+
+ public LogReaderRunnable(ApplicationLogReader logReader, long timeout) {
+ this.logReader = logReader;
+ this.timeout = timeout;
+ }
+
+ @Override
+ public void run() {
+ try {
+ for (int data = -1; (data = logReader.read()) != -1;) {
+ logQueue.put((char) data);
+ }
+ } catch (Exception e) {
+ fail(e.getMessage());
+ }
+ }
+
+ private boolean waitForNewLogentries(StringBuilder builder) throws InterruptedException {
+ Character character = logQueue.poll(timeout, TimeUnit.MILLISECONDS);
+ boolean isNewEntry = character != null;
+ if (isNewEntry) {
+ builder.append(character);
+ logBuilder.append(character);
+ }
+ return isNewEntry;
+ }
+
+ public String waitUntilNoNewLogentries() throws InterruptedException {
+ StringBuilder builder = new StringBuilder();
+ while (waitForNewLogentries(builder)) {
+ ;
+ }
+ return builder.toString();
+ }
+
+ public String getLog() {
+ return logBuilder.toString();
+ }
+}
\ No newline at end of file
Property changes on: trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/LogReaderRunnable.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/OpenshiftIntegrationTestSuite.java
===================================================================
--- trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/OpenshiftIntegrationTestSuite.java (rev 0)
+++ trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/OpenshiftIntegrationTestSuite.java 2011-10-05 11:06:15 UTC (rev 35359)
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * 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.tools.openshift.express.internal.client.test;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+
+(a)RunWith(Suite.class)
+(a)Suite.SuiteClasses({
+ ApplicationIntegrationTest.class,
+ ApplicationLogReaderIntegrationTest.class,
+ CartridgesIntegrationTest.class,
+ DomainIntegrationTest.class,
+ ListCartridgesIntegrationTest.class,
+ UserInfoIntegrationTest.class,
+ UserIntegrationTest.class
+})
+/**
+ * @author André Dietisheim
+ */
+public class OpenshiftIntegrationTestSuite {
+
+}
Property changes on: trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/OpenshiftIntegrationTestSuite.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/OpenshiftTestSuite.java
===================================================================
--- trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/OpenshiftTestSuite.java (rev 0)
+++ trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/OpenshiftTestSuite.java 2011-10-05 11:06:15 UTC (rev 35359)
@@ -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.tools.openshift.express.internal.client.test;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+
+(a)RunWith(Suite.class)
+(a)Suite.SuiteClasses({
+ UserConfigurationTest.class,
+ ApplicationTest.class,
+ ApplicationLogReaderTest.class,
+ ListCartridgesTest.class,
+ DomainTest.class,
+ UserInfoTest.class,
+ UserTest.class,
+ CartridgeTest.class,
+ SSHKeyTest.class
+})
+/**
+ * @author André Dietisheim
+ */
+public class OpenshiftTestSuite {
+
+}
Property changes on: trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/OpenshiftTestSuite.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/SSHKeyTest.java
===================================================================
--- trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/SSHKeyTest.java (rev 0)
+++ trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/SSHKeyTest.java 2011-10-05 11:06:15 UTC (rev 35359)
@@ -0,0 +1,75 @@
+/*******************************************************************************
+ * 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.tools.openshift.express.internal.client.test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.jboss.tools.openshift.express.client.ISSHPublicKey;
+import org.jboss.tools.openshift.express.client.SSHKeyPair;
+import org.jboss.tools.openshift.express.client.SSHPublicKey;
+import org.junit.Test;
+
+public class SSHKeyTest {
+
+ private static final String PASSPHRASE = "12345";
+
+ @Test
+ public void canCreatePublicKey() throws Exception {
+ String publicKeyPath = createTempFile().getAbsolutePath();
+ String privateKeyPath = createTempFile().getAbsolutePath();
+ SSHKeyPair sshKey = SSHKeyPair.create(PASSPHRASE, privateKeyPath, publicKeyPath);
+ String publicKey = sshKey.getPublicKey();
+
+ assertNotNull(publicKey);
+ assertTrue(!publicKey.contains("ssh-rsa")); // no identifier
+ assertTrue(!publicKey.contains(" ")); // no comment
+ }
+
+ @Test
+ public void canLoadKeyPair() throws Exception {
+ String publicKeyPath = createTempFile().getAbsolutePath();
+ String privateKeyPath = createTempFile().getAbsolutePath();
+ SSHKeyPair.create(PASSPHRASE, privateKeyPath, publicKeyPath);
+
+ SSHKeyPair sshKey = SSHKeyPair.load(privateKeyPath, publicKeyPath);
+ String publicKey = sshKey.getPublicKey();
+
+ assertNotNull(publicKey);
+ assertTrue(!publicKey.contains("ssh-rsa")); // no identifier
+ assertTrue(!publicKey.contains(" ")); // no comment
+ }
+
+ @Test
+ public void canLoadPublicKey() throws Exception {
+ String publicKeyPath = createTempFile().getAbsolutePath();
+ String privateKeyPath = createTempFile().getAbsolutePath();
+ SSHKeyPair.create(PASSPHRASE, privateKeyPath, publicKeyPath);
+
+ ISSHPublicKey sshKey = new SSHPublicKey(new File(publicKeyPath));
+ String publicKey = sshKey.getPublicKey();
+
+ assertNotNull(publicKey);
+ assertTrue(!publicKey.contains("ssh-rsa")); // no identifier
+ assertTrue(!publicKey.contains(" ")); // no comment
+
+ SSHKeyPair keyPair = SSHKeyPair.load(privateKeyPath, publicKeyPath);
+ assertEquals(publicKey, keyPair.getPublicKey());
+ }
+
+ private File createTempFile() throws IOException {
+ return File.createTempFile(String.valueOf(System.currentTimeMillis()), null);
+ }
+}
Property changes on: trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/SSHKeyTest.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/UserConfigurationTest.java
===================================================================
--- trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/UserConfigurationTest.java (rev 0)
+++ trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/UserConfigurationTest.java 2011-10-05 11:06:15 UTC (rev 35359)
@@ -0,0 +1,96 @@
+/*******************************************************************************
+ * 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.tools.openshift.express.internal.client.test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.Writer;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.jboss.tools.openshift.express.client.OpenshiftException;
+import org.jboss.tools.openshift.express.internal.client.test.fakes.UserConfigurationFake;
+import org.jboss.tools.openshift.express.internal.client.utils.StreamUtils;
+import org.junit.Test;
+
+/**
+ * @author André Dietisheim
+ */
+public class UserConfigurationTest {
+
+ private static final String USERNAME_REGEX = "[^=]+=(.+)";
+ private static final String USERNAME = "dummyUser";
+ private static final String ANOTHER_USERNAME = "anotherUser";
+
+ @Test
+ public void canReadUsername() throws OpenshiftException, IOException {
+ UserConfigurationFake userConfiguration = new UserConfigurationFake() {
+
+ @Override
+ protected void initFile(Writer writer) throws IOException {
+ writer.append(KEY_RHLOGIN).append('=').append(USERNAME).append('\n');
+ }
+
+ };
+ assertEquals(USERNAME, userConfiguration.getRhlogin());
+ }
+
+ @Test
+ public void canStoreUsername() throws OpenshiftException, IOException {
+ UserConfigurationFake userConfiguration = new UserConfigurationFake() {
+
+ @Override
+ protected void initFile(Writer writer) throws IOException {
+ writer.append(KEY_RHLOGIN).append('=').append(USERNAME).append('\n');
+ }
+
+ };
+ userConfiguration.setRhlogin(ANOTHER_USERNAME);
+ userConfiguration.store();
+ final File userConfigurationFile = userConfiguration.getFile();
+ assertNotNull(userConfigurationFile);
+ String fileContent = StreamUtils.readToString(new FileReader(userConfigurationFile));
+ Pattern pattern = Pattern.compile(USERNAME_REGEX);
+ Matcher matcher = pattern.matcher(fileContent);
+ assertTrue(matcher.matches());
+ assertEquals(1, matcher.groupCount());
+ assertEquals(ANOTHER_USERNAME, matcher.group(1));
+ }
+
+ @Test
+ public void canStoreAndReadUsername() throws OpenshiftException, IOException {
+ UserConfigurationFake userConfiguration = new UserConfigurationFake() {
+
+ @Override
+ protected void initFile(Writer writer) throws IOException {
+ writer.append(KEY_RHLOGIN).append('=').append(USERNAME).append('\n');
+ }
+
+ };
+ userConfiguration.setRhlogin(ANOTHER_USERNAME);
+ userConfiguration.store();
+ final File userConfigurationFile = userConfiguration.getFile();
+ assertNotNull(userConfigurationFile);
+ UserConfigurationFake userConfiguration2 = new UserConfigurationFake() {
+
+ @Override
+ protected File getUserConfigurationFile() throws OpenshiftException, IOException {
+ return userConfigurationFile;
+ }
+ };
+ assertEquals(ANOTHER_USERNAME, userConfiguration2.getRhlogin());
+ }
+}
Property changes on: trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/UserConfigurationTest.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/UserInfoIntegrationTest.java
===================================================================
--- trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/UserInfoIntegrationTest.java (rev 0)
+++ trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/UserInfoIntegrationTest.java 2011-10-05 11:06:15 UTC (rev 35359)
@@ -0,0 +1,112 @@
+/*******************************************************************************
+ * 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.tools.openshift.express.internal.client.test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.util.List;
+
+import org.jboss.tools.openshift.express.client.ICartridge;
+import org.jboss.tools.openshift.express.client.IOpenshiftService;
+import org.jboss.tools.openshift.express.client.ISSHPublicKey;
+import org.jboss.tools.openshift.express.client.InvalidCredentialsOpenshiftException;
+import org.jboss.tools.openshift.express.client.NotFoundOpenshiftException;
+import org.jboss.tools.openshift.express.client.OpenshiftException;
+import org.jboss.tools.openshift.express.client.OpenshiftService;
+import org.jboss.tools.openshift.express.internal.client.ApplicationInfo;
+import org.jboss.tools.openshift.express.internal.client.InternalUser;
+import org.jboss.tools.openshift.express.internal.client.UserInfo;
+import org.jboss.tools.openshift.express.internal.client.test.fakes.TestUser;
+import org.jboss.tools.openshift.express.internal.client.test.utils.ApplicationInfoAsserts;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * @author André Dietisheim
+ */
+public class UserInfoIntegrationTest {
+
+ private OpenshiftService openshiftService;
+ private TestUser user;
+
+ @Before
+ public void setUp() {
+ this.openshiftService = new OpenshiftService();
+ this.user = new TestUser();
+ }
+
+ @Test
+ public void canGetUserInfo() throws Exception {
+ UserInfo userInfo = openshiftService.getUserInfo(user);
+ assertNotNull(userInfo);
+
+ assertEquals(user.getRhlogin(), userInfo.getRhLogin());
+ }
+
+ @Test(expected = InvalidCredentialsOpenshiftException.class)
+ public void getUserInfoForInexistantUserThrowsException() throws Exception {
+ TestUser inexistantUser = new TestUser("inexistantUsername", "bogusPassword");
+ openshiftService.getUserInfo(inexistantUser);
+ }
+
+ /**
+ * {@link OpenshiftService#getUserInfo(InternalUser)} for a user without
+ * domain throws {@link NotFoundOpenshiftException}
+ */
+ @Test(expected = NotFoundOpenshiftException.class)
+ public void canGetUserInfoForUserWithoutDomain() throws Exception {
+ TestUser inexistantUser = new TestUser(TestUser.RHLOGIN_USER_WITHOUT_DOMAIN, TestUser.PASSWORD_USER_WITHOUT_DOMAIN);
+ openshiftService.getUserInfo(inexistantUser);
+ }
+
+ @Test
+ public void userInfoContainsOneMoreApplicationAfterCreatingNewApplication() throws Exception {
+ UserInfo userInfo = openshiftService.getUserInfo(user);
+ assertNotNull(userInfo);
+
+ List<ApplicationInfo> applicationInfos = userInfo.getApplicationInfos();
+ assertNotNull(applicationInfos);
+ int numberOfApplicationInfos = applicationInfos.size();
+
+ String applicationName = createRandomName();
+ try {
+ openshiftService.createApplication(applicationName, ICartridge.JBOSSAS_7, user);
+
+ UserInfo userInfo2 = openshiftService.getUserInfo(user);
+ assertEquals(numberOfApplicationInfos + 1, userInfo2.getApplicationInfos().size());
+ ApplicationInfoAsserts.assertThatContainsApplicationInfo(applicationName, userInfo2.getApplicationInfos());
+ } finally {
+ silentlyDestroyAS7Application(applicationName, openshiftService);
+ }
+ }
+
+ @Test
+ public void canUseReturnedSSHKeyToChangeDomain() throws Exception {
+ UserInfo userInfo = openshiftService.getUserInfo(user);
+ assertNotNull(userInfo);
+
+ ISSHPublicKey sshKey = userInfo.getSshPublicKey();
+ openshiftService.changeDomain(createRandomName(), sshKey, user);
+ }
+
+ private String createRandomName() {
+ return String.valueOf(System.currentTimeMillis());
+ }
+
+ private void silentlyDestroyAS7Application(String name, IOpenshiftService service) {
+ try {
+ service.destroyApplication(name, ICartridge.JBOSSAS_7, user);
+ } catch (OpenshiftException e) {
+ e.printStackTrace();
+ }
+ }
+}
Property changes on: trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/UserInfoIntegrationTest.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/UserInfoTest.java
===================================================================
--- trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/UserInfoTest.java (rev 0)
+++ trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/UserInfoTest.java 2011-10-05 11:06:15 UTC (rev 35359)
@@ -0,0 +1,102 @@
+/*******************************************************************************
+ * 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.tools.openshift.express.internal.client.test;
+
+import static org.jboss.tools.openshift.express.internal.client.test.utils.ApplicationInfoAsserts.assertThatContainsApplicationInfo;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.net.URLEncoder;
+import java.util.List;
+
+import org.jboss.tools.openshift.express.client.ISSHPublicKey;
+import org.jboss.tools.openshift.express.client.OpenshiftException;
+import org.jboss.tools.openshift.express.internal.client.ApplicationInfo;
+import org.jboss.tools.openshift.express.internal.client.UserInfo;
+import org.jboss.tools.openshift.express.internal.client.request.OpenshiftEnvelopeFactory;
+import org.jboss.tools.openshift.express.internal.client.request.UserInfoRequest;
+import org.jboss.tools.openshift.express.internal.client.request.marshalling.UserInfoRequestJsonMarshaller;
+import org.jboss.tools.openshift.express.internal.client.response.OpenshiftResponse;
+import org.jboss.tools.openshift.express.internal.client.response.unmarshalling.JsonSanitizer;
+import org.jboss.tools.openshift.express.internal.client.response.unmarshalling.UserInfoResponseUnmarshaller;
+import org.jboss.tools.openshift.express.internal.client.test.fakes.UserInfoResponseFake;
+import org.junit.Test;
+
+/**
+ * @author André Dietisheim
+ */
+public class UserInfoTest {
+
+ @Test
+ public void canMarshallUserInfoRequest() throws Exception {
+ String expectedRequestString =
+ "password=" + URLEncoder.encode(UserInfoResponseFake.PASSWORD, "UTF-8")
+ + "&json_data=%7B"
+ + "%22rhlogin%22+%3A+%22" + URLEncoder.encode(UserInfoResponseFake.RHLOGIN, "UTF-8")
+ + "%22%2C+"
+ + "%22debug%22+%3A+%22true%22"
+ + "%7D";
+
+ String userInfoRequest = new UserInfoRequestJsonMarshaller().marshall(
+ new UserInfoRequest(UserInfoResponseFake.RHLOGIN, true));
+ String effectiveRequest =
+ new OpenshiftEnvelopeFactory(UserInfoResponseFake.PASSWORD, userInfoRequest).createString();
+
+ assertEquals(expectedRequestString, effectiveRequest);
+ }
+
+ @Test
+ public void canUnmarshallUserInfoResponse() throws Exception {
+ UserInfo userInfo = getUserInfo(JsonSanitizer.sanitize(UserInfoResponseFake.RESPONSE));
+ assertNotNull(userInfo);
+
+ assertEquals(UserInfoResponseFake.RHLOGIN, userInfo.getRhLogin());
+ assertEquals(UserInfoResponseFake.UUID, userInfo.getUuid());
+ ISSHPublicKey sshPublicKey = userInfo.getSshPublicKey();
+ assertNotNull(sshPublicKey);
+ assertEquals(UserInfoResponseFake.SSH_KEY, sshPublicKey.getPublicKey());
+
+ assertEquals(UserInfoResponseFake.NAMESPACE, userInfo.getNamespace());
+ assertEquals(UserInfoResponseFake.RHC_DOMAIN, userInfo.getRhcDomain());
+
+ List<ApplicationInfo> applicationInfos = userInfo.getApplicationInfos();
+ assertNotNull(applicationInfos);
+ assertEquals(2, applicationInfos.size());
+ assertThatContainsApplicationInfo(
+ UserInfoResponseFake.APP1_NAME,
+ UserInfoResponseFake.APP1_EMBEDDED,
+ UserInfoResponseFake.APP1_UUID,
+ UserInfoResponseFake.APP1_CARTRIDGE,
+ UserInfoResponseFake.APP1_CREATION_TIME,
+ applicationInfos);
+ assertThatContainsApplicationInfo(
+ UserInfoResponseFake.APP2_NAME,
+ UserInfoResponseFake.APP2_EMBEDDED,
+ UserInfoResponseFake.APP2_UUID,
+ UserInfoResponseFake.APP2_CARTRIDGE,
+ UserInfoResponseFake.APP2_CREATION_TIME,
+ applicationInfos);
+ }
+
+ @Test
+ public void canGetApplicationByName() throws OpenshiftException {
+ UserInfo userInfo = getUserInfo(JsonSanitizer.sanitize(UserInfoResponseFake.RESPONSE));
+ ApplicationInfo applicationInfo = userInfo.getApplicationInfoByName(UserInfoResponseFake.APP1_NAME);
+ assertNotNull(applicationInfo);
+ assertEquals(UserInfoResponseFake.APP1_NAME, applicationInfo.getName());
+ }
+
+ protected UserInfo getUserInfo(String response) throws OpenshiftException {
+ UserInfoResponseUnmarshaller unmarshaller = new UserInfoResponseUnmarshaller();
+ OpenshiftResponse<UserInfo> openshiftResponse = unmarshaller.unmarshall(response);
+ return openshiftResponse.getOpenshiftObject();
+ }
+}
Property changes on: trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/UserInfoTest.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/UserIntegrationTest.java
===================================================================
--- trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/UserIntegrationTest.java (rev 0)
+++ trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/UserIntegrationTest.java 2011-10-05 11:06:15 UTC (rev 35359)
@@ -0,0 +1,151 @@
+/*******************************************************************************
+ * 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.tools.openshift.express.internal.client.test;
+
+import static org.jboss.tools.openshift.express.internal.client.test.utils.ApplicationAsserts.assertApplication;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.Collection;
+
+import javax.xml.datatype.DatatypeConfigurationException;
+
+import org.jboss.tools.openshift.express.client.IApplication;
+import org.jboss.tools.openshift.express.client.ICartridge;
+import org.jboss.tools.openshift.express.client.IDomain;
+import org.jboss.tools.openshift.express.client.ISSHPublicKey;
+import org.jboss.tools.openshift.express.client.NotFoundOpenshiftException;
+import org.jboss.tools.openshift.express.client.OpenshiftEndpointException;
+import org.jboss.tools.openshift.express.client.OpenshiftException;
+import org.jboss.tools.openshift.express.client.OpenshiftService;
+import org.jboss.tools.openshift.express.client.User;
+import org.jboss.tools.openshift.express.internal.client.test.fakes.TestUser;
+import org.jboss.tools.openshift.express.internal.client.test.utils.ApplicationUtils;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * @author André Dietisheim
+ */
+public class UserIntegrationTest {
+
+ private User user;
+ private TestUser invalidUser;
+ private TestUser badUrlUser;
+ private TestUser userWithoutDomain;
+
+ @Before
+ public void setUp() throws OpenshiftException, DatatypeConfigurationException {
+ this.user = new TestUser();
+ this.invalidUser = new TestUser("bogusPassword");
+ this.badUrlUser = new TestUser(TestUser.RHLOGIN, TestUser.PASSWORD, "http://www.redhat.com");
+ this.userWithoutDomain = new TestUser(TestUser.RHLOGIN_USER_WITHOUT_DOMAIN, TestUser.PASSWORD_USER_WITHOUT_DOMAIN);
+ }
+
+ @Test
+ public void canCheckIfUserIsValid() throws OpenshiftException {
+ assertTrue(user.isValid());
+ }
+
+ @Test
+ public void throwsExceptionIfInvalidCredentials() throws OpenshiftException {
+ assertFalse(invalidUser.isValid());
+ }
+
+ @Test(expected = NotFoundOpenshiftException.class)
+ public void throwsExceptionIfBadUrl() throws OpenshiftException {
+ badUrlUser.isValid();
+ }
+
+ @Test
+ public void canGetUserUUID() throws OpenshiftException {
+ String uuid = user.getUUID();
+ assertNotNull(uuid);
+ assertTrue(uuid.length() > 0);
+ }
+
+ @Test
+ public void canGetPublicKey() throws OpenshiftException {
+ ISSHPublicKey key = user.getSshKey();
+ assertNotNull(key);
+ assertNotNull(key.getPublicKey());
+ assertTrue(key.getPublicKey().length() > 0);
+ }
+
+ @Test
+ public void canGetDomain() throws OpenshiftException {
+ IDomain domain = user.getDomain();
+ assertNotNull(domain);
+ assertNotNull(domain.getRhcDomain());
+ assertTrue(domain.getRhcDomain().length() > 0);
+ assertNotNull(domain.getNamespace());
+ assertTrue(domain.getNamespace().length() > 0);
+ }
+
+ @Test(expected = OpenshiftEndpointException.class)
+ public void cannotCreateDomainIfAlreadyExists() throws OpenshiftException {
+ IDomain domain = user.getDomain();
+ assertNotNull(domain);
+ ISSHPublicKey key = user.getSshKey();
+ assertNotNull(key);
+ user.createDomain("newDomain", key);
+ }
+
+ @Test
+ public void getNullIfNoDomainPresent() throws OpenshiftException {
+ IDomain domain = userWithoutDomain.getDomain();
+ assertNull(domain);
+ }
+
+ @Test
+ public void canGetCartridges() throws OpenshiftException {
+ Collection<ICartridge> cartridges = user.getCartridges();
+ assertNotNull(cartridges);
+ assertTrue(cartridges.size() >= 5);
+ }
+
+ @Test
+ public void canGetApplications() throws OpenshiftException {
+ Collection<IApplication> applications = user.getApplications();
+ assertNotNull(applications);
+ }
+
+ @Test
+ public void canCreateApplication() throws OpenshiftException {
+ String applicationName = ApplicationUtils.createRandomApplicationName();
+ try {
+ Collection<IApplication> applications = user.getApplications();
+ assertNotNull(applications);
+ int numOfApplications = applications.size();
+ IApplication application = user.createApplication(applicationName, ICartridge.JBOSSAS_7);
+ assertEquals(numOfApplications + 1, applications.size());
+ assertApplication(applicationName, ICartridge.JBOSSAS_7.getName(), application);
+ } finally {
+ ApplicationUtils.silentlyDestroyAS7Application(applicationName, user, new OpenshiftService());
+ }
+ }
+
+ @Test
+ public void canGetApplicationByName() throws OpenshiftException, DatatypeConfigurationException {
+ String applicationName = ApplicationUtils.createRandomApplicationName();
+ try {
+ IApplication application = user.createApplication(applicationName, ICartridge.JBOSSAS_7);
+ IApplication applicationFound = user.getApplicationByName(applicationName);
+ assertNotNull(applicationFound);
+ assertEquals(application, applicationFound);
+ } finally {
+ ApplicationUtils.silentlyDestroyAS7Application(applicationName, user, new OpenshiftService());
+ }
+ }
+}
Property changes on: trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/UserIntegrationTest.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/UserTest.java
===================================================================
--- trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/UserTest.java (rev 0)
+++ trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/UserTest.java 2011-10-05 11:06:15 UTC (rev 35359)
@@ -0,0 +1,154 @@
+/*******************************************************************************
+ * 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.tools.openshift.express.internal.client.test;
+
+import static org.jboss.tools.openshift.express.internal.client.test.utils.ApplicationAsserts.assertApplication;
+import static org.jboss.tools.openshift.express.internal.client.test.utils.CartridgeAsserts.assertThatContainsCartridge;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+
+import javax.xml.datatype.DatatypeConfigurationException;
+
+import org.jboss.tools.openshift.express.client.Cartridge;
+import org.jboss.tools.openshift.express.client.IApplication;
+import org.jboss.tools.openshift.express.client.ICartridge;
+import org.jboss.tools.openshift.express.client.IDomain;
+import org.jboss.tools.openshift.express.client.ISSHPublicKey;
+import org.jboss.tools.openshift.express.client.OpenshiftException;
+import org.jboss.tools.openshift.express.client.OpenshiftService;
+import org.jboss.tools.openshift.express.internal.client.ApplicationInfo;
+import org.jboss.tools.openshift.express.internal.client.InternalUser;
+import org.jboss.tools.openshift.express.internal.client.UserInfo;
+import org.jboss.tools.openshift.express.internal.client.test.fakes.CartridgeResponseFake;
+import org.jboss.tools.openshift.express.internal.client.test.fakes.NoopOpenshiftServiceFake;
+import org.jboss.tools.openshift.express.internal.client.test.fakes.UserInfoResponseFake;
+import org.jboss.tools.openshift.express.internal.client.utils.RFC822DateUtils;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * @author André Dietisheim
+ */
+public class UserTest {
+
+ private OpenshiftService userInfoservice;
+ private InternalUser user;
+
+ @Before
+ public void setUp() throws OpenshiftException, DatatypeConfigurationException {
+ UserInfo userInfo = createUserInfo();
+ this.userInfoservice = createUserInfoService(userInfo);
+ this.user = new InternalUser(UserInfoResponseFake.RHLOGIN, UserInfoResponseFake.PASSWORD, userInfoservice);
+ }
+
+ @Test
+ public void canGetUserUUID() throws OpenshiftException {
+ assertEquals(UserInfoResponseFake.UUID, user.getUUID());
+ }
+
+ @Test
+ public void canGetPublicKey() throws OpenshiftException {
+ ISSHPublicKey key = user.getSshKey();
+ assertNotNull(key);
+ assertEquals(UserInfoResponseFake.SSH_KEY, key.getPublicKey());
+ }
+
+ @Test
+ public void canGetDomain() throws OpenshiftException {
+ IDomain domain = user.getDomain();
+ assertNotNull(domain);
+ assertEquals(UserInfoResponseFake.RHC_DOMAIN, domain.getRhcDomain());
+ assertEquals(UserInfoResponseFake.NAMESPACE, domain.getNamespace());
+ }
+
+ @Test
+ public void canGetCartridges() throws OpenshiftException {
+ OpenshiftService cartridgeListService = new NoopOpenshiftServiceFake() {
+
+ @Override
+ public List<ICartridge> getCartridges(InternalUser user) throws OpenshiftException {
+ ArrayList<ICartridge> cartridges = new ArrayList<ICartridge>();
+ cartridges.add(new Cartridge(CartridgeResponseFake.CARTRIDGE_JBOSSAS70));
+ cartridges.add(new Cartridge(CartridgeResponseFake.CARTRIDGE_PERL5));
+ cartridges.add(new Cartridge(CartridgeResponseFake.CARTRIDGE_PHP53));
+ cartridges.add(new Cartridge(CartridgeResponseFake.CARTRIDGE_RACK11));
+ cartridges.add(new Cartridge(CartridgeResponseFake.CARTRIDGE_WSGI32));
+ return cartridges;
+ }
+ };
+ InternalUser user = new InternalUser(UserInfoResponseFake.RHLOGIN, UserInfoResponseFake.PASSWORD, cartridgeListService);
+ Collection<ICartridge> cartridges = user.getCartridges();
+ assertNotNull(cartridges);
+ assertEquals(5, cartridges.size());
+ assertThatContainsCartridge(CartridgeResponseFake.CARTRIDGE_JBOSSAS70, cartridges);
+ assertThatContainsCartridge(CartridgeResponseFake.CARTRIDGE_PERL5, cartridges);
+ assertThatContainsCartridge(CartridgeResponseFake.CARTRIDGE_PHP53, cartridges);
+ assertThatContainsCartridge(CartridgeResponseFake.CARTRIDGE_RACK11, cartridges);
+ assertThatContainsCartridge(CartridgeResponseFake.CARTRIDGE_WSGI32, cartridges);
+ }
+
+ @Test
+ public void canGetApplications() throws OpenshiftException {
+ /** response is UserInfoResponseFake */
+ Collection<IApplication> applications = user.getApplications();
+ assertNotNull(applications);
+ assertEquals(2, applications.size());
+ }
+
+ @Test
+ public void canGetApplicationByName() throws OpenshiftException, DatatypeConfigurationException {
+ IApplication application = user.getApplicationByName(UserInfoResponseFake.APP2_NAME);
+ assertApplication(
+ UserInfoResponseFake.APP2_NAME
+ , UserInfoResponseFake.APP2_UUID
+ , UserInfoResponseFake.APP2_CARTRIDGE
+ , UserInfoResponseFake.APP2_EMBEDDED
+ , UserInfoResponseFake.APP2_CREATION_TIME
+ , application);
+ }
+
+ private UserInfo createUserInfo() throws OpenshiftException, DatatypeConfigurationException {
+ ApplicationInfo[] applicationInfos = new ApplicationInfo[] {
+ new ApplicationInfo(UserInfoResponseFake.APP1_NAME
+ , UserInfoResponseFake.APP1_UUID
+ , UserInfoResponseFake.APP1_EMBEDDED
+ , Cartridge.valueOf(UserInfoResponseFake.APP1_CARTRIDGE)
+ , RFC822DateUtils.getDate(UserInfoResponseFake.APP1_CREATION_TIME))
+ , new ApplicationInfo(UserInfoResponseFake.APP2_NAME
+ , UserInfoResponseFake.APP2_UUID
+ , UserInfoResponseFake.APP2_EMBEDDED
+ , Cartridge.valueOf(UserInfoResponseFake.APP2_CARTRIDGE)
+ , RFC822DateUtils.getDate(UserInfoResponseFake.APP2_CREATION_TIME))
+ };
+ return new UserInfo(
+ UserInfoResponseFake.RHLOGIN
+ , UserInfoResponseFake.UUID
+ , UserInfoResponseFake.SSH_KEY
+ , UserInfoResponseFake.RHC_DOMAIN
+ , UserInfoResponseFake.NAMESPACE
+ , Arrays.asList(applicationInfos));
+ }
+
+ private OpenshiftService createUserInfoService(final UserInfo userInfo) {
+ return new NoopOpenshiftServiceFake() {
+
+ @Override
+ public UserInfo getUserInfo(InternalUser user) throws OpenshiftException {
+ return userInfo;
+ }
+ };
+ }
+}
Property changes on: trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/UserTest.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/fakes/ApplicationResponseFake.java
===================================================================
--- trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/fakes/ApplicationResponseFake.java (rev 0)
+++ trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/fakes/ApplicationResponseFake.java 2011-10-05 11:06:15 UTC (rev 35359)
@@ -0,0 +1,113 @@
+/*******************************************************************************
+ * 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.tools.openshift.express.internal.client.test.fakes;
+
+import java.util.Date;
+
+import org.jboss.tools.openshift.express.client.ICartridge;
+
+/**
+ * @author André Dietisheim
+ */
+public class ApplicationResponseFake {
+
+ public static final String RHLOGIN = "jbosstools(a)redhat.com";
+ public static final String PASSWORD = "$!445password%&";
+ public static final String UUID = "0123456789abcdefghijklmnopqrstuvwz";
+ public static final String SSHPUBLICKEY = "sshpublicKey&!%$123456";
+
+ public static final String RHC_DOMAIN = "rhcloud.com";
+ public static final String NAMESPACE = "1315839296868";
+
+ public static final String APPLICATION_NAME = "1316010645406";
+ public static final ICartridge APPLICATION_CARTRIDGE = ICartridge.JBOSSAS_7;
+
+ public static final String APPLICATION_UUID = "0123456789abcdefg";
+ public static final String APPLICATION_EMBEDDED = null;
+ public static final Date APPLICATION_CREATIONTIME = new Date();
+
+ public static final String appResponse =
+ "{"
+ + " \"messages\":\"\","
+ + " \"debug\":\"Validating application limit toolsjboss(a)gmail.com: num of apps(0) must be < app limit(5)\n\","
+ + " \"data\":{"
+ + " \"health_check_path\":\"health\""
+ + " },"
+ + " \"api\":\"1.1.1\","
+ + " \"api_c\":[\"placeholder\"],"
+ + " \"result\":\"Successfully created application: "
+
+ + APPLICATION_NAME
+
+ + "\","
+ + " \"broker\":\"1.1.1\","
+ + " \"broker_c\":[\"namespace\","
+ + " \"rhlogin\","
+ + " \"ssh\","
+ + " \"app_uuid\","
+ + " \"debug\","
+ + " \"alter\","
+ + " \"cartridge\","
+ + " \"cart_type\","
+ + " \"action\","
+ + " \"app_name\","
+ + " \"api\"],"
+ + " \"exit_code\":0"
+ + "}";
+
+
+
+
+ public static final String log =
+ "10:30:38,700 INFO [org.apache.catalina.core.AprLifecycleListener] (MSC service thread 1-1) "
+ + "The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path:"
+ + "/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/lib/amd64/server:/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/lib/amd64:"
+ + "/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/../lib/amd64:/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib\n"
+ + "10:30:38,792 INFO [org.apache.coyote.http11.Http11Protocol] (MSC service thread 1-3) Starting Coyote HTTP/1.1 on http--127.1.7.1-8080\n"
+ + "10:30:38,836 INFO [org.jboss.as.connector] (MSC service thread 1-4) Starting JCA Subsystem (JBoss IronJacamar 1.0.3.Final)\n"
+ + "10:30:38,892 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-1) Bound data source [java:jboss/datasources/ExampleDS]\n"
+ + "10:30:39,293 INFO [org.jboss.as.deployment] (MSC service thread 1-2) Started FileSystemDeploymentService for directory /var/lib/libra/664e4d4dbce74c69ac321053149546df/1316010645406/jbossas-7.0/standalone/deployments\n"
+ + "10:30:39,314 INFO [org.jboss.as] (Controller Boot Thread) JBoss AS 7.0.1.Final \\\"Zap\\\" started in 2732ms - Started 82 of 107 services (22 services are passive or on-demand)\n"
+ + "10:30:39,339 INFO [org.jboss.as.server.deployment] (MSC service thread 1-3) Starting deployment of \\\"ROOT.war\\\"\n"
+ + "10:30:39,424 INFO [org.jboss.as.jpa] (MSC service thread 1-1) added javax.persistence.api dependency to ROOT.war\n"
+ + "10:30:39,700 INFO [org.jboss.web] (MSC service thread 1-2) registering web context: \n"
+ + "10:30:39,742 INFO [org.jboss.as.server.controller] (DeploymentScanner-threads - 2) Deployed \\\"ROOT.war\\\"\n";
+
+ public static final String tail =
+ "tailing /var/lib/libra/664e4d4dbce74c69ac321053149546df/"
+
+ + APPLICATION_NAME
+
+ + "//"
+
+ + APPLICATION_CARTRIDGE
+
+ + "/standalone/log/server.log\n"
+ + "------ Tail of 1316010645406 application server.log ------\n"
+
+ + log;
+
+ public static final String statusResponse =
+ "{\"messages\":\"\","
+ + "\"debug\":\"\","
+ + "\"data\":null,"
+ + "\"api\":\"1.1.1\","
+ + "\"api_c\":[\"placeholder\"],"
+ + "\"result\":\""
+
+ + tail
+
+ + "\","
+ + "\"broker\":\"1.1.1\","
+ + "\"broker_c\":[\"namespace\",\"rhlogin\",\"ssh\",\"app_uuid\",\"debug\",\"alter\",\"cartridge\",\"cart_type\",\"action\",\"app_name\",\"api\"],"
+ + "\"exit_code\":0}";
+
+}
Property changes on: trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/fakes/ApplicationResponseFake.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/fakes/CartridgeResponseFake.java
===================================================================
--- trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/fakes/CartridgeResponseFake.java (rev 0)
+++ trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/fakes/CartridgeResponseFake.java 2011-10-05 11:06:15 UTC (rev 35359)
@@ -0,0 +1,45 @@
+package org.jboss.tools.openshift.express.internal.client.test.fakes;
+
+/**
+ *
+ * @author André Dietisheim
+ *
+ */
+public class CartridgeResponseFake {
+
+ public static final String CARTRIDGE_PERL5 = "perl-5.10";
+ public static final String CARTRIDGE_JBOSSAS70 = "jbossas-7.0";
+ public static final String CARTRIDGE_WSGI32 = "wsgi-3.2";
+ public static final String CARTRIDGE_RACK11 = "rack-1.1";
+ public static final String CARTRIDGE_PHP53 = "php-5.3";
+
+ public static final String RESPONSE =
+ "{"
+ +" \"messages\":\"\","
+ +" \"debug\":\"\","
+ +" \"data\":\"{"
+ +" \\\"carts\\\":"
+ +" [\\\"" + CARTRIDGE_PERL5 +"\\\","
+ +" \\\"" + CARTRIDGE_JBOSSAS70 + "\\\","
+ +" \\\"" + CARTRIDGE_WSGI32+ "\\\","
+ +" \\\"" + CARTRIDGE_RACK11 + "\\\","
+ +" \\\"" + CARTRIDGE_PHP53 + "\\\"]"
+ +" }\","
+ +" \"api\":\"1.1.1\","
+ +" \"api_c\":[\"placeholder\"],"
+ +" \"result\":null,"
+ +" \"broker\":\"1.1.1\","
+ +" \"broker_c\":[\"namespace\","
+ +" \"rhlogin\","
+ +" \"ssh\","
+ +" \"app_uuid\","
+ +" \"debug\","
+ +" \"alter\","
+ +" \"cartridge\","
+ +" \"cart_type\","
+ +" \"action\","
+ +" \"app_name\","
+ +" \"api\"],"
+ +" \"exit_code\":0"
+ + "}";
+}
Property changes on: trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/fakes/CartridgeResponseFake.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/fakes/NoopOpenshiftServiceFake.java
===================================================================
--- trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/fakes/NoopOpenshiftServiceFake.java (rev 0)
+++ trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/fakes/NoopOpenshiftServiceFake.java 2011-10-05 11:06:15 UTC (rev 35359)
@@ -0,0 +1,78 @@
+/*******************************************************************************
+ * 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.tools.openshift.express.internal.client.test.fakes;
+
+import java.util.List;
+
+import org.jboss.tools.openshift.express.client.IApplication;
+import org.jboss.tools.openshift.express.client.ICartridge;
+import org.jboss.tools.openshift.express.client.IDomain;
+import org.jboss.tools.openshift.express.client.ISSHPublicKey;
+import org.jboss.tools.openshift.express.client.OpenshiftException;
+import org.jboss.tools.openshift.express.internal.client.Application;
+import org.jboss.tools.openshift.express.internal.client.InternalUser;
+import org.jboss.tools.openshift.express.internal.client.UserInfo;
+
+/**
+ * @author André Dietisheim
+ */
+public class NoopOpenshiftServiceFake extends OpenshiftTestService {
+
+ @Override
+ public UserInfo getUserInfo(InternalUser user) throws OpenshiftException {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public List<ICartridge> getCartridges(InternalUser user) throws OpenshiftException {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public Application createApplication(String name, ICartridge cartridge, InternalUser user) throws OpenshiftException {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public void destroyApplication(String name, ICartridge cartridge, InternalUser user) throws OpenshiftException {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public IApplication startApplication(String name, ICartridge cartridge, InternalUser user) throws OpenshiftException {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public IApplication restartApplication(String name, ICartridge cartridge, InternalUser user) throws OpenshiftException {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public IApplication stopApplication(String name, ICartridge cartridge, InternalUser user) throws OpenshiftException {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public String getStatus(String applicationName, ICartridge cartridge, InternalUser user) throws OpenshiftException {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public IDomain changeDomain(String domainName, ISSHPublicKey sshKey, InternalUser user) throws OpenshiftException {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public IDomain createDomain(String name, ISSHPublicKey keyPair, InternalUser user) throws OpenshiftException {
+ throw new UnsupportedOperationException();
+ }
+}
Property changes on: trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/fakes/NoopOpenshiftServiceFake.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/fakes/OpenshiftCredentials.java
===================================================================
--- trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/fakes/OpenshiftCredentials.java (rev 0)
+++ trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/fakes/OpenshiftCredentials.java 2011-10-05 11:06:15 UTC (rev 35359)
@@ -0,0 +1,18 @@
+/*******************************************************************************
+ * 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.tools.openshift.express.internal.client.test.fakes;
+
+public class OpenshiftCredentials {
+
+ public static final String USERNAME = "toolsjboss(a)gmail.com";
+ public static final String PASSWORD = "1q2w3e";
+
+}
Property changes on: trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/fakes/OpenshiftCredentials.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/fakes/OpenshiftTestService.java
===================================================================
--- trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/fakes/OpenshiftTestService.java (rev 0)
+++ trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/fakes/OpenshiftTestService.java 2011-10-05 11:06:15 UTC (rev 35359)
@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * 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.tools.openshift.express.internal.client.test.fakes;
+
+import org.jboss.tools.openshift.express.client.OpenshiftService;
+import org.jboss.tools.openshift.express.internal.client.test.IOpenshiftTestService;
+
+public class OpenshiftTestService extends OpenshiftService implements IOpenshiftTestService {
+
+ public OpenshiftTestService() {
+ super(STAGING_BASE_URL);
+ }
+}
Property changes on: trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/fakes/OpenshiftTestService.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/fakes/TestSSHKey.java
===================================================================
--- trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/fakes/TestSSHKey.java (rev 0)
+++ trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/fakes/TestSSHKey.java 2011-10-05 11:06:15 UTC (rev 35359)
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * 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.tools.openshift.express.internal.client.test.fakes;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.jboss.tools.openshift.express.client.OpenshiftException;
+import org.jboss.tools.openshift.express.client.SSHKeyPair;
+import org.jboss.tools.openshift.express.internal.client.test.utils.StreamUtils;
+
+/**
+ * @author André Dietisheim
+ */
+public class TestSSHKey {
+
+ private static final String privateKey =
+ "-----BEGIN RSA PRIVATE KEY-----\n" +
+ "Proc-Type: 4,ENCRYPTED\n" +
+ "DEK-Info: DES-EDE3-CBC,30E8B3A668E44D77\n" +
+ "\n" +
+ "wsXCU31SUTYhjPnOiW56UlZ7VXKlIjItLo5Wrk5LwCLv/OERK7UWJkrwM2bHPb6n\n" +
+ "3zAaDDZfQe786URQjfmUYWBdVeI7DrRMwoLaaUcR1tuJtMu3Jv3CK72YMkOzGapZ\n" +
+ "ZAAoTno/GRhTwptXG1KPSqKyzfqlxjbZry1HZmY+P6ikw9DWOPZC6rISIqQ3u9zm\n" +
+ "iPvi/Oo7JWZtX1d1MYp3vVt2bo2duD4RSoXWWaW471WUOIQZUh0V4dxp+eAHZziu\n" +
+ "osAfU4WoIrrSCSVl2uiKS2Zijn77PvcCXnm45eMQpww32AlslzIBNsMzUXhPtVAZ\n" +
+ "a9uvfZxlOIRu4ObN7AB3WExucbBHCvTOgxpSs95br1QtfMVl62d9VkIAXg1x9gH8\n" +
+ "kjcEP+0OS3EItYTFj1tCKC8GgBImj44AxbPSWu3SfTnYfAtFnO0pUqhPOBN63DCC\n" +
+ "XxzMm13UeER7Z3s968Swa48r6LRAbHI8JD0Ld4E02fgBYM/N/aGtPppD0FoJJwo3\n" +
+ "QVafS2PY+bALgy4qrI9daOo1mTS3gWDSAG0QbLoKd3hD8ZnLEk6rfR/0SE34Fc7j\n" +
+ "mviCy78C16hkllhWz27ROl5pheHV0Xt6ZlUsNWVz7tg/AcIFB0geMuzuM0Kd7ufj\n" +
+ "g5c8mhlI06n4vzo0uB6UXtwTBzNqyUl8yxA31S2VJfBZxkEwKc5cktNUiejQuWbU\n" +
+ "iwapdiSR0gNGyYBNMYax9OOfYH+BBQeD5kboVU3yvT7UNcz0T9GZiEhfvcaYSP8C\n" +
+ "ejQ1vuTNTKMrgyLpNi/4Sq8lm8OukRqQyE0EKYCwvkI=\n" +
+ "-----END RSA PRIVATE KEY-----";
+
+ private static final String publicKey =
+ "ssh-rsa "
+ +
+ "AAAAB3NzaC1yc2EAAAADAQABAAAAgQC6BGRDydfGsQHhnZgo43dEfLzSJBke/hE8MLBBG1+5Z" +
+ "wktsrE+f2VdVt0McRLVAO6rdJRyMUX0rTbm7SABRVSX+zeQjlfqbbUtYFc7TIfd4RQc3GaISG" +
+ "1rS3C4svRSjdWaG36vDY2KxowdFvpKj8i8IYNPlLoRA/7EzzyneS6iyw" +
+ "== created by org.jboss.tools.openshift.express.client";
+
+ public static SSHKeyPair create() throws IOException, OpenshiftException {
+ File privateKeyFile = File.createTempFile(createRandomString(), null);
+ StreamUtils.writeTo(privateKey, privateKeyFile);
+
+ File publicKeyFile = File.createTempFile(createRandomString(), null);
+ StreamUtils.writeTo(publicKey, publicKeyFile);
+
+ return SSHKeyPair.load(privateKeyFile.getAbsolutePath(), publicKeyFile.getAbsolutePath());
+ }
+
+ private static String createRandomString() {
+ return String.valueOf(System.currentTimeMillis());
+ }
+
+
+}
Property changes on: trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/fakes/TestSSHKey.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/fakes/TestUser.java
===================================================================
--- trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/fakes/TestUser.java (rev 0)
+++ trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/fakes/TestUser.java 2011-10-05 11:06:15 UTC (rev 35359)
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * 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.tools.openshift.express.internal.client.test.fakes;
+
+import org.jboss.tools.openshift.express.client.Cartridge;
+import org.jboss.tools.openshift.express.client.IApplication;
+import org.jboss.tools.openshift.express.client.OpenshiftException;
+import org.jboss.tools.openshift.express.client.User;
+import org.jboss.tools.openshift.express.internal.client.test.utils.ApplicationUtils;
+
+/**
+ * @author André Dietisheim
+ */
+public class TestUser extends User {
+
+ public static final String RHLOGIN_USER_WITHOUT_DOMAIN = "toolsjboss.no.domain2(a)gmail.com";
+ public static final String PASSWORD_USER_WITHOUT_DOMAIN = "1q2w3e";
+
+ public static final String RHLOGIN = "toolsjboss(a)gmail.com";
+ public static final String PASSWORD = "1q2w3e";
+
+ public TestUser() {
+ super(RHLOGIN, PASSWORD);
+ }
+
+ public TestUser(String password) {
+ super(RHLOGIN, password);
+ }
+
+ public TestUser(String rhlogin, String password) {
+ super(rhlogin, password);
+ }
+
+ public TestUser(String rhlogin, String password, String url) {
+ super(rhlogin, password, url);
+ }
+
+ public IApplication createTestApplication() throws OpenshiftException {
+ return createApplication(ApplicationUtils.createRandomApplicationName(), Cartridge.JBOSSAS_7);
+ }
+
+ public void silentlyDestroyApplication(IApplication application) {
+ try {
+ getService().destroyApplication(application.getName(), application.getCartridge(), this);
+ } catch (OpenshiftException e) {
+ e.printStackTrace();
+ }
+ }
+}
Property changes on: trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/fakes/TestUser.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/fakes/UserConfigurationFake.java
===================================================================
--- trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/fakes/UserConfigurationFake.java (rev 0)
+++ trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/fakes/UserConfigurationFake.java 2011-10-05 11:06:15 UTC (rev 35359)
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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.tools.openshift.express.internal.client.test.fakes;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.Writer;
+
+import org.jboss.tools.openshift.express.client.OpenshiftException;
+import org.jboss.tools.openshift.express.client.UserConfiguration;
+import org.jboss.tools.openshift.express.internal.client.utils.StreamUtils;
+
+/**
+ * @author André Dietisheim
+ */
+public class UserConfigurationFake extends UserConfiguration {
+
+
+ public UserConfigurationFake() throws OpenshiftException, IOException {
+ super();
+ }
+
+ @Override
+ protected File getUserConfigurationFile() throws OpenshiftException, IOException {
+ Writer writer = null;
+ try {
+ File file = File.createTempFile(createRandomString(), null);
+ writer = new FileWriter(file);
+ initFile(writer);
+ return file;
+ } finally {
+ StreamUtils.close(writer);
+ }
+ }
+
+ protected void initFile(Writer writer) throws IOException {
+ }
+
+ public File getFile() {
+ return file;
+ }
+
+ private String createRandomString() {
+ return String.valueOf(System.currentTimeMillis());
+ }
+
+}
Property changes on: trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/fakes/UserConfigurationFake.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/fakes/UserInfoResponseFake.java
===================================================================
--- trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/fakes/UserInfoResponseFake.java (rev 0)
+++ trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/fakes/UserInfoResponseFake.java 2011-10-05 11:06:15 UTC (rev 35359)
@@ -0,0 +1,81 @@
+package org.jboss.tools.openshift.express.internal.client.test.fakes;
+
+public class UserInfoResponseFake {
+
+ public static final String RHLOGIN = "jbosstools(a)redhat.com";
+ public static final String PASSWORD = "$!445password%&";
+
+ public static final String RHC_DOMAIN = "rhcloud.com";
+ public static final String NAMESPACE = "1315839296868";
+ public static final String UUID = "5f34b742db754cc9ab70fd1db2c9a2bd";
+ public static final String SSH_KEY =
+ "AAAAB3NzaC1yc2EAAAADAQABAAAAgQC6BGRDydfGsQHhnZgo43dEfLz"
+ + "SJBke/hE8MLBBG1+5ZwktsrE+f2VdVt0McRLVAO6rdJRyMUX0rTbm7"
+ + "SABRVSX+zeQjlfqbbUtYFc7TIfd4RQc3GaISG1rS3C4svRSjdWaG36"
+ + "vDY2KxowdFvpKj8i8IYNPlLoRA/7EzzyneS6iyw==";
+
+ public static final String APP1_NAME = "1315836963263";
+ public static final String APP1_EMBEDDED = null;
+ public static final String APP1_UUID = "810540bafc1c4b5e8cac830fb8ca786f";
+ public static final String APP1_CARTRIDGE = "jbossas-7.0";
+ public static final String APP1_CREATION_TIME = "2011-09-12T10:15:48-04:00";
+
+ public static final String APP2_NAME = "1315903559289";
+ public static final String APP2_EMBEDDED = null;
+ public static final String APP2_UUID = "f5496311f43b42cd8fa5db5ecf83a352";
+ public static final String APP2_CARTRIDGE = "jbossas-7.0";
+ public static final String APP2_CREATION_TIME = "2011-09-13T04:45:44-04:00";
+
+ public static final String RESPONSE =
+ "{"
+ + " \"messages\":\"\","
+ + " \"debug\":\"\","
+ + " \"data\":"
+ + ""
+ + "\"{"
+ + " \\\"user_info\\\":"
+ + " {"
+ + " \\\"rhc_domain\\\":\\\"" + RHC_DOMAIN + "\\\"," //
+ + " \\\"rhlogin\\\":\\\"" + RHLOGIN + "\\\","
+ + " \\\"namespace\\\":\\\"" + NAMESPACE + "\\\","
+ + " \\\"uuid\\\":\\\"" + UUID + "\\\","
+ + " \\\"ssh_key\\\":\\\"" + SSH_KEY + "\\\""
+ + " },"
+ + " \\\"app_info\\\":"
+ + " {"
+ + " \\\"" + APP1_NAME + "\\\":"
+ + " {"
+ + " \\\"embedded\\\":" + APP1_EMBEDDED + ","
+ + " \\\"uuid\\\":\\\"" + APP1_UUID + "\\\","
+ + " \\\"framework\\\":\\\"" + APP1_CARTRIDGE + "\\\","
+ + " \\\"creation_time\\\":\\\"" + APP1_CREATION_TIME + "\\\""
+ + " },"
+ + " \\\"" + APP2_NAME + "\\\":"
+ + " {"
+ + " \\\"embedded\\\":" + APP2_EMBEDDED + ","
+ + " \\\"uuid\\\":\\\"" + APP2_UUID + "\\\","
+ + " \\\"framework\\\":\\\"" + APP2_CARTRIDGE + "\\\","
+ + " \\\"creation_time\\\":\\\"" + APP2_CREATION_TIME + "\\\""
+ + " }"
+ + " }"
+ + " }\","
+ + " \"api\":\"1.1.1\","
+ + " \"api_c\":[\"placeholder\"],"
+ + " \"result\":null,"
+ + " \"broker\":\"1.1.1\","
+ + " \"broker_c\":["
+ + " \"namespace\","
+ + " \"rhlogin\","
+ + " \"ssh\","
+ + " \"app_uuid\","
+ + " \"debug\","
+ + " \"alter\","
+ + " \"cartridge\","
+ + " \"cart_type\","
+ + " \"action\","
+ + " \"app_name\","
+ + " \"api\""
+ + " ],"
+ + " \"exit_code\":0"
+ + "}";
+}
Property changes on: trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/fakes/UserInfoResponseFake.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/utils/ApplicationAsserts.java
===================================================================
--- trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/utils/ApplicationAsserts.java (rev 0)
+++ trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/utils/ApplicationAsserts.java 2011-10-05 11:06:15 UTC (rev 35359)
@@ -0,0 +1,122 @@
+/*******************************************************************************
+ * 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.tools.openshift.express.internal.client.test.utils;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.text.MessageFormat;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import javax.xml.datatype.DatatypeConfigurationException;
+
+import org.jboss.tools.openshift.express.client.IApplication;
+import org.jboss.tools.openshift.express.client.OpenshiftException;
+import org.jboss.tools.openshift.express.internal.client.Application;
+import org.jboss.tools.openshift.express.internal.client.utils.RFC822DateUtils;
+
+/**
+ * @author André Dietisheim
+ */
+public class ApplicationAsserts {
+
+ /**
+ * $1 = application uuid
+ * $2 = application name
+ * $3 = InternalUser uuid
+ * $4 = rhc cloud domain (rhcloud.com)
+ * $5 = application name
+ */
+ public static final Pattern GIT_URI_REGEXP = Pattern.compile("ssh://(.+)@(.+)-([^\\.]+)\\.(.+)/~/git/(.+).git/");
+
+ public static final Pattern APPLICATION_URL_REGEXP = Pattern.compile("http://(.+)-([^\\.]+)\\.(.+)/");
+
+ public static void assertThatContainsApplication(String applicationName, String embedded, String applicationUUID,
+ String cartridgeName, String creationTime, List<Application> applications) throws OpenshiftException {
+ IApplication application = getApplication(applicationName, applications);
+ if (application == null) {
+ fail(MessageFormat.format("Could not find application with name \"{0}\"", applicationName));
+ }
+ assertApplication(applicationName, applicationUUID, cartridgeName, embedded, creationTime, application);
+ }
+
+ public static void assertThatContainsApplication(String applicationName, List<Application> applications) {
+ assertNotNull(getApplication(applicationName, applications));
+ }
+
+ private static IApplication getApplication(String name, List<Application> applications) {
+ IApplication matchingApplication = null;
+ for (Application application : applications) {
+ if (name.equals(application.getName())) {
+ matchingApplication = application;
+ break;
+ }
+ }
+ return matchingApplication;
+ }
+
+ public static void assertApplication(String name, String uuid, String cartridgeName, String embedded,
+ String creationTime, IApplication application) throws OpenshiftException {
+ assertNotNull(application);
+ assertEquals(embedded, application.getEmbedded());
+ assertEquals(uuid, application.getUUID());
+ try {
+ assertEquals(RFC822DateUtils.getDate(creationTime), application.getCreationTime());
+ } catch (DatatypeConfigurationException e) {
+ fail(e.getMessage());
+ }
+ }
+
+ public static void assertApplication(String name, String cartridgeName, IApplication application) throws OpenshiftException {
+ assertNotNull(application);
+ assertNotNull(application.getCartridge());
+ assertEquals(cartridgeName, application.getCartridge().getName());
+ }
+
+ public static void assertGitUri(String applicationName, String gitUri) {
+ Matcher matcher = GIT_URI_REGEXP.matcher(gitUri);
+ assertTrue(matcher.matches());
+ assertEquals(5, matcher.groupCount());
+ assertEquals(applicationName, matcher.group(2));
+ assertEquals(applicationName, matcher.group(5));
+ }
+
+ public static void assertGitUri(String uuid, String name, String namespace, String rhcDomain, String gitUri) {
+ Matcher matcher = GIT_URI_REGEXP.matcher(gitUri);
+ assertTrue(matcher.matches());
+ assertEquals(5, matcher.groupCount());
+ assertEquals(uuid, matcher.group(1));
+ assertEquals(name, matcher.group(2));
+ assertEquals(namespace, matcher.group(3));
+ assertEquals(rhcDomain, matcher.group(4));
+ assertEquals(name, matcher.group(5));
+ }
+
+ public static void assertAppliactionUrl(String name, String applicationUrl) {
+ Matcher matcher = APPLICATION_URL_REGEXP.matcher(applicationUrl);
+ assertTrue(matcher.matches());
+ assertEquals(3, matcher.groupCount());
+ assertEquals(name, matcher.group(1));
+ }
+
+ public static void assertAppliactionUrl(String name, String namespace, String rhcDomain, String applicationUrl) {
+ Matcher matcher = APPLICATION_URL_REGEXP.matcher(applicationUrl);
+ assertTrue(matcher.matches());
+ assertEquals(3, matcher.groupCount());
+ assertEquals(name, matcher.group(1));
+ assertEquals(namespace, matcher.group(2));
+ assertEquals(rhcDomain, matcher.group(3));
+ }
+}
Property changes on: trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/utils/ApplicationAsserts.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/utils/ApplicationInfoAsserts.java
===================================================================
--- trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/utils/ApplicationInfoAsserts.java (rev 0)
+++ trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/utils/ApplicationInfoAsserts.java 2011-10-05 11:06:15 UTC (rev 35359)
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * 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.tools.openshift.express.internal.client.test.utils;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.fail;
+
+import java.text.MessageFormat;
+import java.util.List;
+
+import javax.xml.datatype.DatatypeConfigurationException;
+
+import org.jboss.tools.openshift.express.client.OpenshiftException;
+import org.jboss.tools.openshift.express.internal.client.ApplicationInfo;
+import org.jboss.tools.openshift.express.internal.client.utils.RFC822DateUtils;
+
+/**
+ * @author André Dietisheim
+ */
+public class ApplicationInfoAsserts {
+
+ public static void assertThatContainsApplicationInfo(String applicationName, String embedded, String applicationUUID,
+ String cartridgeName, String creationTime, List<ApplicationInfo> applicationInfos) throws OpenshiftException {
+ ApplicationInfo applicationInfo = getApplicationInfo(applicationName, applicationInfos);
+ if (applicationInfo == null) {
+ fail(MessageFormat.format("Could not find application with name \"{0}\"", applicationName));
+ }
+ assertApplicationInfo(embedded, applicationUUID, cartridgeName, creationTime, applicationInfo);
+ }
+
+ public static void assertThatContainsApplicationInfo(String applicationName, List<ApplicationInfo> applicationInfos) {
+ assertNotNull(getApplicationInfo(applicationName, applicationInfos));
+ }
+
+ private static ApplicationInfo getApplicationInfo(String name, List<ApplicationInfo> applicationInfos) {
+ ApplicationInfo matchingApplicationInfo = null;
+ for (ApplicationInfo applicationInfo : applicationInfos) {
+ if (name.equals(applicationInfo.getName())) {
+ matchingApplicationInfo = applicationInfo;
+ break;
+ }
+ }
+ return matchingApplicationInfo;
+ }
+
+ private static void assertApplicationInfo(String embedded, String uuid, String cartridgeName,
+ String creationTime, ApplicationInfo applicationInfo) throws OpenshiftException {
+ assertEquals(embedded, applicationInfo.getEmbedded());
+ assertEquals(uuid, applicationInfo.getUuid());
+ assertNotNull(applicationInfo.getCartridge());
+ assertEquals(cartridgeName, applicationInfo.getCartridge().getName());
+ try {
+ assertEquals(RFC822DateUtils.getDate(creationTime), applicationInfo.getCreationTime());
+ } catch (DatatypeConfigurationException e) {
+ fail(e.getMessage());
+ }
+ }
+
+}
Property changes on: trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/utils/ApplicationInfoAsserts.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/utils/ApplicationUtils.java
===================================================================
--- trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/utils/ApplicationUtils.java (rev 0)
+++ trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/utils/ApplicationUtils.java 2011-10-05 11:06:15 UTC (rev 35359)
@@ -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.tools.openshift.express.internal.client.test.utils;
+
+import org.jboss.tools.openshift.express.client.Cartridge;
+import org.jboss.tools.openshift.express.client.IApplication;
+import org.jboss.tools.openshift.express.client.ICartridge;
+import org.jboss.tools.openshift.express.client.IOpenshiftService;
+import org.jboss.tools.openshift.express.client.OpenshiftException;
+import org.jboss.tools.openshift.express.client.User;
+
+/**
+ * @author André Dietisheim
+ */
+public class ApplicationUtils {
+
+ public static String createRandomApplicationName() {
+ return String.valueOf(System.currentTimeMillis());
+ }
+
+ public static IApplication createApplication(User user, IOpenshiftService service) throws OpenshiftException {
+ return service.createApplication(createRandomApplicationName(), Cartridge.JBOSSAS_7, user);
+ }
+
+ public static void silentlyDestroyAS7Application(String name, User user, IOpenshiftService service) {
+ try {
+ service.destroyApplication(name, ICartridge.JBOSSAS_7, user);
+ } catch (OpenshiftException e) {
+ e.printStackTrace();
+ }
+ }
+}
Property changes on: trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/utils/ApplicationUtils.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/utils/CartridgeAsserts.java
===================================================================
--- trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/utils/CartridgeAsserts.java (rev 0)
+++ trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/utils/CartridgeAsserts.java 2011-10-05 11:06:15 UTC (rev 35359)
@@ -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.tools.openshift.express.internal.client.test.utils;
+
+import static org.junit.Assert.fail;
+
+import java.text.MessageFormat;
+import java.util.Collection;
+
+import org.jboss.tools.openshift.express.client.ICartridge;
+
+/**
+ * @author André Dietisheim
+ */
+public class CartridgeAsserts {
+
+ public static void assertThatContainsCartridge(String cartridgeName, Collection<ICartridge> cartridges) {
+ boolean found = false;
+ for (ICartridge cartridge : cartridges) {
+ if (cartridgeName.equals(cartridge.getName())) {
+ found = true;
+ break;
+ }
+ }
+ if (!found) {
+ fail(MessageFormat.format("Could not find cartridge with name \"{0}\"", cartridgeName));
+ }
+ }
+}
Property changes on: trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/utils/CartridgeAsserts.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/utils/StreamUtils.java
===================================================================
--- trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/utils/StreamUtils.java (rev 0)
+++ trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/utils/StreamUtils.java 2011-10-05 11:06:15 UTC (rev 35359)
@@ -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.tools.openshift.express.internal.client.test.utils;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.StringReader;
+
+public class StreamUtils {
+
+ public static void writeTo(String data, String path) throws IOException {
+ writeTo(data, new File(path));
+ }
+
+ public static void writeTo(String data, File file) throws IOException {
+ StringReader reader = null;
+ FileWriter writer = null;
+ try {
+ writer = new FileWriter(file);
+ reader = new StringReader(data);
+ for (int character = -1; (character = reader.read()) != -1;) {
+ writer.write(character);
+ }
+ } finally {
+ if (writer != null) {
+ writer.flush();
+ writer.close();
+ }
+ if (reader != null) {
+ reader.close();
+ }
+ }
+ }
+}
Property changes on: trunk/as/tests/org.jboss.tools.openshift.express.client.test/src/org/jboss/tools/openshift/express/internal/client/test/utils/StreamUtils.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
13 years, 3 months
JBoss Tools SVN: r35358 - trunk/as/tests.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-10-05 07:05:12 -0400 (Wed, 05 Oct 2011)
New Revision: 35358
Added:
trunk/as/tests/org.jboss.tools.openshift.express.client.test/
Log:
[JBIDE-9841] renamed org.jboss.ide.eclipse.as.openshift.core.test to org.jboss.tools.openshift.express.client.test
13 years, 3 months
JBoss Tools SVN: r35356 - in trunk/as/plugins/org.jboss.tools.openshift.express.ui: .settings and 12 other directories.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-10-05 07:03:07 -0400 (Wed, 05 Oct 2011)
New Revision: 35356
Added:
trunk/as/plugins/org.jboss.tools.openshift.express.ui/.classpath
trunk/as/plugins/org.jboss.tools.openshift.express.ui/.project
trunk/as/plugins/org.jboss.tools.openshift.express.ui/.settings/
trunk/as/plugins/org.jboss.tools.openshift.express.ui/.settings/org.eclipse.jdt.core.prefs
trunk/as/plugins/org.jboss.tools.openshift.express.ui/META-INF/
trunk/as/plugins/org.jboss.tools.openshift.express.ui/META-INF/MANIFEST.MF
trunk/as/plugins/org.jboss.tools.openshift.express.ui/build.properties
trunk/as/plugins/org.jboss.tools.openshift.express.ui/icons/
trunk/as/plugins/org.jboss.tools.openshift.express.ui/icons/openshift-logo-dark-icon.png
trunk/as/plugins/org.jboss.tools.openshift.express.ui/icons/openshift-logo-dark.png
trunk/as/plugins/org.jboss.tools.openshift.express.ui/icons/openshift-logo-white-icon.png
trunk/as/plugins/org.jboss.tools.openshift.express.ui/icons/openshift-logo-white-medium.png
trunk/as/plugins/org.jboss.tools.openshift.express.ui/icons/openshift-logo-white.png
trunk/as/plugins/org.jboss.tools.openshift.express.ui/plugin.xml
trunk/as/plugins/org.jboss.tools.openshift.express.ui/pom.xml
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/OpenshiftImages.java
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/OpenshiftUIActivator.java
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/common/
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/common/ImageRepository.java
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AbstractOpenshiftWizardPage.java
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AbstractSkippingWizard.java
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationWizardPage.java
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationWizardPageModel.java
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/CredentialsWizardPage.java
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/CredentialsWizardPageModel.java
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ISkipableWizardPage.java
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewApplicationDialog.java
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewApplicationWizardPage.java
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewApplicationWizardPageModel.java
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewDomainWizardPage.java
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewDomainWizardPageModel.java
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ServerAdapterWizard.java
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ServerAdapterWizardModel.java
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/TrimTrailingSlashConverter.java
Log:
[JBIDE-9841] renamed org.jboss.ide.eclipse.as.openshift.ui to org.jboss.tools.openshift.express.ui
Added: trunk/as/plugins/org.jboss.tools.openshift.express.ui/.classpath
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.ui/.classpath (rev 0)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.ui/.classpath 2011-10-05 11:03:07 UTC (rev 35356)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.ui/.classpath
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/plugins/org.jboss.tools.openshift.express.ui/.project
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.ui/.project (rev 0)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.ui/.project 2011-10-05 11:03:07 UTC (rev 35356)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.jboss.tools.openshift.express.ui</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.ui/.project
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/plugins/org.jboss.tools.openshift.express.ui/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.ui/.settings/org.eclipse.jdt.core.prefs (rev 0)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.ui/.settings/org.eclipse.jdt.core.prefs 2011-10-05 11:03:07 UTC (rev 35356)
@@ -0,0 +1,8 @@
+#Wed Sep 14 11:53:06 CEST 2011
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.ui/.settings/org.eclipse.jdt.core.prefs
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/plugins/org.jboss.tools.openshift.express.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.ui/META-INF/MANIFEST.MF (rev 0)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.ui/META-INF/MANIFEST.MF 2011-10-05 11:03:07 UTC (rev 35356)
@@ -0,0 +1,20 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Openshift UI
+Bundle-SymbolicName: org.jboss.tools.openshift.express.ui;singleton:=true
+Bundle-Version: 2.3.0.qualifier
+Bundle-Activator: org.jboss.tools.openshift.express.internal.ui.OpenshiftUIActivator
+Require-Bundle: org.jboss.tools.openshift.express.client;bundle-version="2.3.0",
+ org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.core.databinding;bundle-version="1.4.0",
+ org.eclipse.core.databinding.beans;bundle-version="1.2.100",
+ org.eclipse.core.databinding.observable;bundle-version="1.4.0",
+ org.eclipse.core.databinding.property;bundle-version="1.4.0",
+ org.eclipse.jface.databinding;bundle-version="1.5.0"
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Import-Package: org.jboss.tools.common.databinding,
+ org.jboss.tools.common.ui,
+ org.jboss.tools.common.ui.databinding,
+ org.jboss.tools.common.ui.preferencevalue
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.ui/META-INF/MANIFEST.MF
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/plugins/org.jboss.tools.openshift.express.ui/build.properties
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.ui/build.properties (rev 0)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.ui/build.properties 2011-10-05 11:03:07 UTC (rev 35356)
@@ -0,0 +1,11 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml
+src.includes = .classpath,\
+ .project,\
+ META-INF/,\
+ build.properties,\
+ plugin.xml,\
+ pom.xml
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.ui/build.properties
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/plugins/org.jboss.tools.openshift.express.ui/icons/openshift-logo-dark-icon.png
===================================================================
(Binary files differ)
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.ui/icons/openshift-logo-dark-icon.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/as/plugins/org.jboss.tools.openshift.express.ui/icons/openshift-logo-dark.png
===================================================================
(Binary files differ)
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.ui/icons/openshift-logo-dark.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/as/plugins/org.jboss.tools.openshift.express.ui/icons/openshift-logo-white-icon.png
===================================================================
(Binary files differ)
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.ui/icons/openshift-logo-white-icon.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/as/plugins/org.jboss.tools.openshift.express.ui/icons/openshift-logo-white-medium.png
===================================================================
(Binary files differ)
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.ui/icons/openshift-logo-white-medium.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/as/plugins/org.jboss.tools.openshift.express.ui/icons/openshift-logo-white.png
===================================================================
(Binary files differ)
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.ui/icons/openshift-logo-white.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/as/plugins/org.jboss.tools.openshift.express.ui/plugin.xml
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.ui/plugin.xml (rev 0)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.ui/plugin.xml 2011-10-05 11:03:07 UTC (rev 35356)
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension
+ point="org.eclipse.ui.newWizards">
+ <category
+ id="org.jboss.ide.eclipse.as.openshift.express.ui.wizard.category"
+ name="Openshift Express">
+ </category>
+ <wizard
+ category="org.jboss.ide.eclipse.as.openshift.express.ui.wizard.category"
+ class="org.jboss.tools.openshift.express.internal.ui.wizard.ServerAdapterWizard"
+ icon="icons/openshift-logo-white-icon.png"
+ id="org.jboss.ide.eclipse.as.openshift.express.ui.wizard.NewServerAdapter"
+ name="New Server Adapter">
+ </wizard>
+ </extension>
+</plugin>
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.ui/plugin.xml
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/plugins/org.jboss.tools.openshift.express.ui/pom.xml
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.ui/pom.xml (rev 0)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.ui/pom.xml 2011-10-05 11:03:07 UTC (rev 35356)
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.jboss.tools.as</groupId>
+ <artifactId>plugins</artifactId>
+ <version>2.3.0-SNAPSHOT</version>
+ </parent>
+ <groupId>org.jboss.tools.as.plugins</groupId>
+ <artifactId>org.jboss.tools.openshift.express.ui</artifactId>
+ <packaging>eclipse-plugin</packaging>
+</project>
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.ui/pom.xml
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/OpenshiftImages.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/OpenshiftImages.java (rev 0)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/OpenshiftImages.java 2011-10-05 11:03:07 UTC (rev 35356)
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat Inc..
+ * All rights reserved. This program and the accompanying materials
+ * are 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 Incorporated - initial API and implementation
+ *******************************************************************************/
+package org.jboss.tools.openshift.express.internal.ui;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.jboss.tools.openshift.express.internal.ui.common.ImageRepository;
+
+public class OpenshiftImages {
+
+ private static final String ICONS_FOLDER = "icons/";
+
+ private static final ImageRepository repo =
+ new ImageRepository(ICONS_FOLDER, OpenshiftUIActivator.getDefault(), OpenshiftUIActivator.getDefault().getImageRegistry());
+
+ public static final ImageDescriptor OPENSHIFT_LOGO_DARK = repo.create("openshift-logo-dark.png"); //$NON-NLS-1$
+ public static final ImageDescriptor OPENSHIFT_LOGO_WHITE = repo.create("openshift-logo-white.png"); //$NON-NLS-1$
+ public static final ImageDescriptor OPENSHIFT_LOGO_WHITE_MEDIUM = repo.create("openshift-logo-white-medium.png"); //$NON-NLS-1$
+}
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/OpenshiftImages.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/OpenshiftUIActivator.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/OpenshiftUIActivator.java (rev 0)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/OpenshiftUIActivator.java 2011-10-05 11:03:07 UTC (rev 35356)
@@ -0,0 +1,60 @@
+package org.jboss.tools.openshift.express.internal.ui;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class OpenshiftUIActivator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.jboss.ide.eclipse.as.openshift.ui"; //$NON-NLS-1$
+
+ // The shared instance
+ private static OpenshiftUIActivator plugin;
+
+ /**
+ * The constructor
+ */
+ public OpenshiftUIActivator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static OpenshiftUIActivator getDefault() {
+ return plugin;
+ }
+
+ public static void log(IStatus status) {
+ plugin.getLog().log(status);
+ }
+
+ public static void log(Throwable e) {
+ log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.ERROR, e.getMessage(), e));
+ }
+
+}
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/OpenshiftUIActivator.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/common/ImageRepository.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/common/ImageRepository.java (rev 0)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/common/ImageRepository.java 2011-10-05 11:03:07 UTC (rev 35356)
@@ -0,0 +1,78 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat Inc..
+ * All rights reserved. This program and the accompanying materials
+ * are 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 Incorporated - initial API and implementation
+ *******************************************************************************/
+package org.jboss.tools.openshift.express.internal.ui.common;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Plugin;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.resource.ImageRegistry;
+import org.eclipse.osgi.util.NLS;
+import org.jboss.tools.openshift.express.internal.ui.OpenshiftUIActivator;
+
+public class ImageRepository {
+
+ private ImageRegistry imageRegistry;
+ private URL baseUrl;
+ private Plugin plugin;
+ private String imageFolder;
+
+ public ImageRepository(String imageFolder, Plugin plugin, ImageRegistry imageRegistry) {
+ this.imageFolder = imageFolder;
+ this.plugin = plugin;
+ this.imageRegistry = imageRegistry;
+ }
+
+ protected URL getBaseUrl() {
+ try {
+ if (baseUrl == null) {
+ this.baseUrl = new URL(plugin.getBundle().getEntry("/"), imageFolder);
+ }
+ return baseUrl;
+ } catch (MalformedURLException e) {
+ OpenshiftUIActivator.log(e);
+ return null;
+ }
+ }
+
+ public ImageDescriptor create(String name) {
+ return create(imageRegistry, name);
+ }
+
+ private ImageDescriptor create(ImageRegistry registry,String name) {
+ return create(registry, name, getBaseUrl());
+ }
+
+ private ImageDescriptor create(ImageRegistry registry, String name, URL baseUrl) {
+ if (baseUrl == null) {
+ return null;
+ }
+
+ ImageDescriptor imageDescriptor =
+ ImageDescriptor.createFromURL(createFileURL(name, baseUrl));
+ registry.put(name, imageDescriptor);
+ return imageDescriptor;
+ }
+
+ private URL createFileURL(String name, URL baseUrl) {
+ try {
+ return new URL(baseUrl, name);
+ } catch (MalformedURLException e) {
+ plugin.getLog().log(
+ new Status(IStatus.ERROR, plugin.getBundle().getSymbolicName(), NLS.bind(
+ "Could not create URL for image {0}", name), e));
+ return null;
+ }
+ }
+}
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/common/ImageRepository.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AbstractOpenshiftWizardPage.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AbstractOpenshiftWizardPage.java (rev 0)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AbstractOpenshiftWizardPage.java 2011-10-05 11:03:07 UTC (rev 35356)
@@ -0,0 +1,83 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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.tools.openshift.express.internal.ui.wizard;
+
+import org.eclipse.core.databinding.DataBindingContext;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jface.dialogs.IPageChangedListener;
+import org.eclipse.jface.dialogs.PageChangedEvent;
+import org.eclipse.jface.wizard.IWizard;
+import org.eclipse.jface.wizard.IWizardContainer;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.jboss.tools.common.ui.databinding.ParametrizableWizardPageSupport;
+import org.jboss.tools.openshift.express.internal.ui.OpenshiftImages;
+
+/**
+ * @author André Dietisheim
+ */
+public abstract class AbstractOpenshiftWizardPage extends WizardPage {
+
+ private DataBindingContext dbc;
+
+ protected AbstractOpenshiftWizardPage(String title, String description, String pageName, IWizard wizard) {
+ super(pageName);
+ setWizard(wizard);
+ setTitle(title);
+ setDescription(description);
+ setImageDescriptor(OpenshiftImages.OPENSHIFT_LOGO_WHITE_MEDIUM);
+ }
+
+ @Override
+ public void createControl(Composite parent) {
+ this.dbc = new DataBindingContext();
+ ParametrizableWizardPageSupport.create(
+ IStatus.ERROR | IStatus.INFO | IStatus.WARNING | IStatus.CANCEL, this,
+ dbc);
+ Composite container = new Composite(parent, SWT.NONE);
+ setControl(container);
+ initPageChangedListener();
+
+ // container.addListener(SWT.Show, new Listener() {
+ // @Override
+ // public void handleEvent(Event event) {
+ // onPageVisible(dbc);
+ // }
+ // });
+ doCreateControls(container, dbc);
+ }
+
+ protected void initPageChangedListener() {
+ IWizardContainer wizardContainer = getContainer();
+ if (wizardContainer instanceof WizardDialog) {
+ ((WizardDialog) getContainer()).addPageChangedListener(new IPageChangedListener() {
+
+ @Override
+ public void pageChanged(PageChangedEvent event) {
+ if (event.getSelectedPage() == AbstractOpenshiftWizardPage.this) {
+ onPageActivated(dbc);
+ }
+ }
+ });
+ }
+ }
+
+ protected DataBindingContext getDatabindingContext() {
+ return dbc;
+ }
+
+ protected void onPageActivated(DataBindingContext dbc) {
+ }
+
+ protected abstract void doCreateControls(Composite parent, DataBindingContext dbc);
+}
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AbstractOpenshiftWizardPage.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AbstractSkippingWizard.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AbstractSkippingWizard.java (rev 0)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AbstractSkippingWizard.java 2011-10-05 11:03:07 UTC (rev 35356)
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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.tools.openshift.express.internal.ui.wizard;
+
+import org.eclipse.jface.wizard.IWizardPage;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.ui.INewWizard;
+
+/**
+ * @author André Dietisheim
+ */
+public abstract class AbstractSkippingWizard extends Wizard implements INewWizard {
+
+ @Override
+ public IWizardPage getNextPage(IWizardPage page) {
+ IWizardPage nextPage = null;
+ while ((nextPage = super.getNextPage(page)) != null) {
+ if (ISkipableWizardPage.class.isAssignableFrom(nextPage.getClass())
+ && ((ISkipableWizardPage) nextPage).isSkip()) {
+ page = nextPage;
+ continue;
+ } else {
+ break;
+ }
+ }
+ return nextPage;
+ }
+
+ @Override
+ public IWizardPage getPreviousPage(IWizardPage page) {
+ IWizardPage previousPage = null;
+ while ((previousPage = super.getPreviousPage(page)) != null) {
+ if (ISkipableWizardPage.class.isAssignableFrom(previousPage.getClass())
+ && ((ISkipableWizardPage) previousPage).isSkip()) {
+ page = previousPage;
+ continue;
+ } else {
+ break;
+ }
+ }
+ return previousPage;
+ }
+}
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AbstractSkippingWizard.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationWizardPage.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationWizardPage.java (rev 0)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationWizardPage.java 2011-10-05 11:03:07 UTC (rev 35356)
@@ -0,0 +1,266 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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.tools.openshift.express.internal.ui.wizard;
+
+import java.util.Collection;
+
+import org.eclipse.core.databinding.Binding;
+import org.eclipse.core.databinding.DataBindingContext;
+import org.eclipse.core.databinding.UpdateValueStrategy;
+import org.eclipse.core.databinding.beans.BeanProperties;
+import org.eclipse.core.databinding.validation.IValidator;
+import org.eclipse.core.databinding.validation.ValidationStatus;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.jface.databinding.viewers.ViewerProperties;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.layout.GridDataFactory;
+import org.eclipse.jface.layout.GridLayoutFactory;
+import org.eclipse.jface.layout.TableColumnLayout;
+import org.eclipse.jface.viewers.ArrayContentProvider;
+import org.eclipse.jface.viewers.CellLabelProvider;
+import org.eclipse.jface.viewers.ColumnWeightData;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.TableViewerColumn;
+import org.eclipse.jface.viewers.ViewerCell;
+import org.eclipse.jface.wizard.IWizard;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.ui.PlatformUI;
+import org.jboss.tools.common.ui.BrowserUtil;
+import org.jboss.tools.common.ui.WizardUtils;
+import org.jboss.tools.common.ui.databinding.DataBindingUtils;
+import org.jboss.tools.openshift.express.client.IApplication;
+import org.jboss.tools.openshift.express.client.OpenshiftException;
+import org.jboss.tools.openshift.express.internal.ui.OpenshiftUIActivator;
+
+/**
+ * @author André Dietisheim
+ */
+public class ApplicationWizardPage extends AbstractOpenshiftWizardPage {
+
+ private TableViewer viewer;
+ private ApplicationWizardPageModel model;
+
+ protected ApplicationWizardPage(IWizard wizard, ServerAdapterWizardModel wizardModel) {
+ super("Application selection", "Please select an Openshift Express application",
+ "Application selection", wizard);
+ this.model = new ApplicationWizardPageModel(wizardModel);
+ }
+
+ @Override
+ protected void doCreateControls(Composite container, DataBindingContext dbc) {
+ GridLayoutFactory.fillDefaults().numColumns(3).margins(10, 10).spacing(4, 4).applyTo(container);
+
+ Group group = new Group(container, SWT.BORDER);
+ group.setText("Available applications");
+ GridDataFactory.fillDefaults().grab(true, true).align(SWT.FILL, SWT.FILL).span(3, 1).applyTo(group);
+ FillLayout fillLayout = new FillLayout(SWT.VERTICAL);
+ fillLayout.marginHeight = 6;
+ fillLayout.marginWidth = 6;
+ group.setLayout(fillLayout);
+
+ this.viewer = createApplicationTable(group);
+ viewer.addDoubleClickListener(onApplicationDoubleClick());
+
+ Binding selectedApplicationBinding = dbc.bindValue(
+ ViewerProperties.singleSelection().observe(viewer),
+ BeanProperties.value(ApplicationWizardPageModel.PROPERTY_SELECTED_APPLICATION).observe(model),
+ new UpdateValueStrategy().setAfterGetValidator(new IValidator() {
+
+ @Override
+ public IStatus validate(Object value) {
+ if (value != null) {
+ return ValidationStatus.ok();
+ }
+ else {
+ return ValidationStatus.info("You have to select an application...");
+ }
+ }
+ }),
+ null);
+
+ Button newButton = new Button(container, SWT.PUSH);
+ newButton.setText("Ne&w");
+ GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).hint(80, 30).applyTo(newButton);
+ newButton.addSelectionListener(onNew(dbc));
+
+ Button deleteButton = new Button(container, SWT.PUSH);
+ deleteButton.setText("&Delete");
+ GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).hint(80, 30).applyTo(deleteButton);
+ DataBindingUtils.bindButtonEnablementToValidationStatus(deleteButton, dbc, selectedApplicationBinding);
+ deleteButton.addSelectionListener(onDelete(dbc));
+ }
+
+ protected IDoubleClickListener onApplicationDoubleClick() {
+ return new IDoubleClickListener() {
+
+ @Override
+ public void doubleClick(DoubleClickEvent event) {
+ try {
+ ISelection selection = event.getSelection();
+ if (selection instanceof StructuredSelection) {
+ Object firstElement = ((IStructuredSelection) selection).getFirstElement();
+ if (firstElement instanceof IApplication) {
+ String url = ((IApplication) firstElement).getApplicationUrl();
+ BrowserUtil.checkedCreateExternalBrowser(url, OpenshiftUIActivator.PLUGIN_ID,
+ OpenshiftUIActivator.getDefault().getLog());
+ }
+ }
+ } catch (OpenshiftException e) {
+ IStatus status = new Status(IStatus.ERROR, OpenshiftUIActivator.PLUGIN_ID,
+ "Could not open Openshift Express application in browser", e);
+ OpenshiftUIActivator.getDefault().getLog().log(status);
+ }
+ }
+ };
+ }
+
+ protected SelectionAdapter onNew(DataBindingContext dbc) {
+ return new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ Shell shell = getContainer().getShell();
+ if (WizardUtils.openWizardDialog(new NewApplicationDialog(model.getUser()), shell)
+ == Dialog.OK) {
+ viewer.refresh();
+ }
+ }
+ };
+ }
+
+ protected TableViewer createApplicationTable(Group group) {
+ Composite tableContainer = new Composite(group, SWT.NONE);
+ Table table = new Table(tableContainer, SWT.BORDER | SWT.FULL_SELECTION | SWT.V_SCROLL | SWT.H_SCROLL);
+ table.setLinesVisible(true);
+ table.setHeaderVisible(true);
+ TableColumnLayout tableLayout = new TableColumnLayout();
+ tableContainer.setLayout(tableLayout);
+ TableViewer viewer = new TableViewer(table);
+ viewer.setContentProvider(new ArrayContentProvider());
+
+ createTableColumn("Name", 1, new CellLabelProvider() {
+
+ @Override
+ public void update(ViewerCell cell) {
+ IApplication application = (IApplication) cell.getElement();
+ cell.setText(application.getName());
+ }
+ }, viewer, tableLayout);
+ createTableColumn("URL", 3, new CellLabelProvider() {
+
+ @Override
+ public void update(ViewerCell cell) {
+ try {
+ IApplication application = (IApplication) cell.getElement();
+ cell.setText(application.getApplicationUrl());
+ } catch (OpenshiftException e) {
+ // ignore
+ }
+ }
+ }, viewer, tableLayout);
+ return viewer;
+ }
+
+ private void createTableColumn(String name, int weight, CellLabelProvider cellLabelProvider, TableViewer viewer,
+ TableColumnLayout layout) {
+ TableViewerColumn column = new TableViewerColumn(viewer, SWT.LEFT);
+ column.getColumn().setText(name);
+ column.setLabelProvider(cellLabelProvider);
+
+ layout.setColumnData(column.getColumn(), new ColumnWeightData(weight, true));
+ }
+
+ private SelectionAdapter onDelete(final DataBindingContext dbc) {
+ return new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ try {
+ WizardUtils.runInWizard(new DeleteApplicationJob(), getWizard().getContainer(), dbc);
+ } catch (Exception ex) {
+ // ignore
+ }
+ }
+ };
+ }
+
+ @Override
+ protected void onPageActivated(DataBindingContext dbc) {
+ try {
+ WizardUtils.runInWizard(new LoadApplicationsJob(), getWizard().getContainer(), dbc);
+ } catch (Exception ex) {
+ // ignore
+ }
+ }
+
+ private class LoadApplicationsJob extends Job {
+ private LoadApplicationsJob() {
+ super("Loading applications");
+ }
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ try {
+ final Collection<IApplication> applications = model.getApplications();
+ Display display = PlatformUI.getWorkbench().getDisplay();
+ display.syncExec(new Runnable() {
+
+ @Override
+ public void run() {
+ viewer.setInput(applications);
+ }
+ });
+ return Status.OK_STATUS;
+ } catch (OpenshiftException e) {
+ return new Status(IStatus.ERROR, OpenshiftUIActivator.PLUGIN_ID,
+ "Could not load applications from Openshift Express");
+ }
+ }
+ }
+
+ private class DeleteApplicationJob extends Job {
+
+ public DeleteApplicationJob() {
+ super("Deleteing application");
+ }
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ try {
+ model.destroyCurrentApplication();
+ return Status.OK_STATUS;
+ } catch (OpenshiftException e) {
+ return new Status(IStatus.ERROR, OpenshiftUIActivator.PLUGIN_ID, NLS.bind(
+ "Could not delete application \"{0}\"",
+ model.getSelectedApplication().getName()));
+ }
+ }
+
+ }
+}
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationWizardPage.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationWizardPageModel.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationWizardPageModel.java (rev 0)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationWizardPageModel.java 2011-10-05 11:03:07 UTC (rev 35356)
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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.tools.openshift.express.internal.ui.wizard;
+
+import java.util.Collection;
+import java.util.Collections;
+
+import org.jboss.tools.common.ui.databinding.ObservableUIPojo;
+import org.jboss.tools.openshift.express.client.IApplication;
+import org.jboss.tools.openshift.express.client.IUser;
+import org.jboss.tools.openshift.express.client.OpenshiftException;
+
+/**
+ * @author André Dietisheim
+ *
+ */
+public class ApplicationWizardPageModel extends ObservableUIPojo {
+
+ public static final String PROPERTY_SELECTED_APPLICATION = "selectedApplication";
+
+ private IApplication selectedApplication;
+ private ServerAdapterWizardModel wizardModel;
+
+ public ApplicationWizardPageModel(ServerAdapterWizardModel wizardModel) {
+ this.wizardModel = wizardModel;
+ }
+
+ public Collection<IApplication> getApplications() throws OpenshiftException {
+ IUser user = wizardModel.getUser();
+ if (user == null) {
+ return Collections.emptyList();
+ }
+ return user.getApplications();
+ }
+
+ public IApplication getSelectedApplication() {
+ return selectedApplication;
+ }
+
+ public void setSelectedApplication(IApplication application) {
+ firePropertyChange(PROPERTY_SELECTED_APPLICATION, this.selectedApplication, this.selectedApplication = application);
+ }
+
+ public void destroyCurrentApplication() throws OpenshiftException {
+ if (selectedApplication == null) {
+ return;
+ }
+
+ selectedApplication.destroy();
+ }
+
+ public IUser getUser() {
+ return wizardModel.getUser();
+ }
+
+}
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationWizardPageModel.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/CredentialsWizardPage.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/CredentialsWizardPage.java (rev 0)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/CredentialsWizardPage.java 2011-10-05 11:03:07 UTC (rev 35356)
@@ -0,0 +1,170 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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.tools.openshift.express.internal.ui.wizard;
+
+import org.eclipse.core.databinding.Binding;
+import org.eclipse.core.databinding.DataBindingContext;
+import org.eclipse.core.databinding.UpdateValueStrategy;
+import org.eclipse.core.databinding.beans.BeanProperties;
+import org.eclipse.core.databinding.observable.value.WritableValue;
+import org.eclipse.core.databinding.validation.IValidator;
+import org.eclipse.core.databinding.validation.ValidationStatus;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.jface.layout.GridDataFactory;
+import org.eclipse.jface.layout.GridLayoutFactory;
+import org.eclipse.jface.wizard.IWizard;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Link;
+import org.eclipse.swt.widgets.Text;
+import org.jboss.tools.common.ui.BrowserUtil;
+import org.jboss.tools.common.ui.WizardUtils;
+import org.jboss.tools.common.ui.databinding.DataBindingUtils;
+import org.jboss.tools.openshift.express.internal.ui.OpenshiftUIActivator;
+
+/**
+ * @author André Dietisheim
+ */
+public class CredentialsWizardPage extends AbstractOpenshiftWizardPage {
+
+ protected static final String OPENSHIFT_EXPRESS_SIGNUP_URL = "https://openshift.redhat.com/app/user/new/express"; //$NON-NLS-1$
+
+ private Button validateButton;
+
+ private CredentialsWizardPageModel model;
+
+ public CredentialsWizardPage(IWizard wizard, ServerAdapterWizardModel wizardModel) {
+ super("Server connetion", "Please provide the credentails of your user account on Openshift Express",
+ "Server Connection", wizard);
+ this.model = new CredentialsWizardPageModel(wizardModel);
+ }
+
+ protected void doCreateControls(Composite container, DataBindingContext dbc) {
+ GridLayoutFactory.fillDefaults().numColumns(3).margins(10, 10).applyTo(container);
+
+ Link signupLink = new Link(container, SWT.WRAP);
+ signupLink.setText("If you have no user account on Openshit Express yet, please sign up <a>here</a>.");
+ GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).span(3, 1).hint(SWT.DEFAULT, 30).applyTo(signupLink);
+ signupLink.addSelectionListener(onSignupLinkClicked());
+
+ // Label serverUrlLabel = new Label(container, SWT.NONE);
+ // serverUrlLabel.setText("Server URL");
+ // GridDataFactory.fillDefaults().align(SWT.LEFT,
+ // SWT.CENTER).applyTo(serverUrlLabel);
+ // Text serverUrlText = new Text(container, SWT.BORDER);
+ // GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true,
+ // false).span(2, 1).applyTo(serverUrlText);
+ // dbc.bindValue(
+ // WidgetProperties.text(SWT.Modify).observe(serverUrlText),
+ // BeanProperties.value(
+ // ServerAdapterWizardModel.class,
+ // ServerAdapterWizardModel.PROPERTY_SERVER_URL).observe(model),
+ // new UpdateValueStrategy()
+ // .setAfterGetValidator(new
+ // MandatoryStringValidator("You have to provide a value for the server url."))
+ // .setBeforeSetValidator(new SimpleUrlStringValidator())
+ // .setConverter(new TrimTrailingSlashConverter()),
+ // null);
+
+ Label rhLoginLabel = new Label(container, SWT.NONE);
+ rhLoginLabel.setText("&Username");
+ GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).applyTo(rhLoginLabel);
+ Text rhLoginText = new Text(container, SWT.BORDER);
+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).span(2, 1).applyTo(rhLoginText);
+ Binding rhLoginBining = DataBindingUtils.bindMandatoryTextField(
+ rhLoginText, "Username", CredentialsWizardPageModel.PROPERTY_RHLOGIN, model, dbc);
+
+ Label passwordLabel = new Label(container, SWT.NONE);
+ passwordLabel.setText("&Password");
+ GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).applyTo(passwordLabel);
+ Text passwordText = new Text(container, SWT.BORDER | SWT.PASSWORD);
+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).span(2, 1).applyTo(passwordText);
+ Binding passwordBinding = DataBindingUtils.bindMandatoryTextField(
+ passwordText, "Password", CredentialsWizardPageModel.PROPERTY_PASSWORD, model, dbc);
+
+ Label spacerLabel = new Label(container, SWT.None);
+ GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).span(2, 1).applyTo(spacerLabel);
+
+ // Label credentialsValidatyLabel = new Label(container, SWT.None);
+ // GridDataFactory.fillDefaults().align(SWT.CENTER, SWT.CENTER).hint(64,
+ // 64).applyTo(credentialsValidatyLabel);
+
+ this.validateButton = new Button(container, SWT.NONE);
+ validateButton.setText("&Validate");
+ GridDataFactory.fillDefaults().align(SWT.RIGHT, SWT.CENTER).indent(0, 10).hint(100, 30).applyTo(validateButton);
+ DataBindingUtils.bindButtonEnablementToValidationStatus(
+ validateButton,
+ dbc,
+ rhLoginBining, passwordBinding);
+ validateButton.addSelectionListener(onValidate(dbc));
+ dbc.bindValue(
+ new WritableValue(null, IStatus.class),
+ BeanProperties.value(CredentialsWizardPageModel.PROPERTY_CREDENTIALS_VALIDITY).observe(model),
+ new UpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER),
+ new UpdateValueStrategy().setAfterGetValidator(
+ new CredentialsStatusValidator()));
+ }
+
+ protected SelectionAdapter onValidate(final DataBindingContext dbc) {
+ return new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ try {
+ WizardUtils.runInWizard(
+ new Job("Testing user credentials") {
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ model.validateCredentials();
+ return Status.OK_STATUS;
+ }
+ }, getWizard().getContainer(), dbc);
+ } catch (Exception ex) {
+ // ignore
+ }
+ };
+ };
+ }
+
+ protected SelectionAdapter onSignupLinkClicked() {
+ return new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ BrowserUtil.checkedCreateInternalBrowser(OPENSHIFT_EXPRESS_SIGNUP_URL, OPENSHIFT_EXPRESS_SIGNUP_URL,
+ OpenshiftUIActivator.PLUGIN_ID, OpenshiftUIActivator.getDefault().getLog());
+ getWizard().getContainer().getShell().close();
+ }
+ };
+ }
+
+ private static class CredentialsStatusValidator implements IValidator {
+ public IStatus validate(Object value) {
+ if (value instanceof IStatus) {
+ int currentSeverity = ((IStatus) value).getSeverity();
+ if (currentSeverity < IStatus.ERROR) {
+ return ValidationStatus.ok();
+ }
+ } else if (value == null) {
+ return ValidationStatus.info("You have to validate your credentials");
+ }
+ return ValidationStatus.error("The given credentials are not valid");
+ }
+ }
+}
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/CredentialsWizardPage.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/CredentialsWizardPageModel.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/CredentialsWizardPageModel.java (rev 0)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/CredentialsWizardPageModel.java 2011-10-05 11:03:07 UTC (rev 35356)
@@ -0,0 +1,139 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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.tools.openshift.express.internal.ui.wizard;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.jboss.tools.common.ui.databinding.ObservableUIPojo;
+import org.jboss.tools.common.ui.preferencevalue.StringPreferenceValue;
+import org.jboss.tools.openshift.express.client.IOpenshiftService;
+import org.jboss.tools.openshift.express.client.IUser;
+import org.jboss.tools.openshift.express.client.NotFoundOpenshiftException;
+import org.jboss.tools.openshift.express.client.OpenshiftException;
+import org.jboss.tools.openshift.express.client.User;
+import org.jboss.tools.openshift.express.client.UserConfiguration;
+import org.jboss.tools.openshift.express.internal.ui.OpenshiftUIActivator;
+
+/**
+ * @author André Dietisheim
+ */
+public class CredentialsWizardPageModel extends ObservableUIPojo {
+
+ private static final String RHLOGIN_PREFS_KEY = "org.jboss.tools.openshift.express.internal.ui.wizard.CredentialsWizardModel_RHLOGIN";
+
+ public static final String PROPERTY_SERVER_URL = "serverUrl";
+ public static final String PROPERTY_RHLOGIN = "rhLogin";
+ public static final String PROPERTY_PASSWORD = "password";
+ public static final String PROPERTY_CREDENTIALS_VALIDITY = "credentialsValidity";
+
+ private String serverUrl;
+ private String rhLogin;
+ private String password;
+ private IStatus credentialsValidity;
+ private IUser user;
+ private StringPreferenceValue rhLoginPreferenceValue;
+
+ private ServerAdapterWizardModel wizardModel;
+
+ public CredentialsWizardPageModel(ServerAdapterWizardModel model) {
+ this.wizardModel = model;
+ this.serverUrl = IOpenshiftService.BASE_URL;
+ this.rhLoginPreferenceValue = new StringPreferenceValue(RHLOGIN_PREFS_KEY, OpenshiftUIActivator.PLUGIN_ID);
+ this.rhLogin = initRhLogin();
+ resetCredentialsStatus();
+ }
+
+ protected String initRhLogin() {
+ String rhLogin = null;
+ rhLogin = rhLoginPreferenceValue.get();
+ if (rhLogin == null) {
+ rhLogin = getUserConfiguration();
+ }
+ return rhLogin;
+ }
+
+ protected String getUserConfiguration() {
+ String configuredUsername = null;
+ try {
+ configuredUsername = new UserConfiguration().getRhlogin();
+ } catch (Exception e) {
+ // do nothing
+ }
+ return configuredUsername;
+ }
+
+ public String getServerUrl() {
+ return serverUrl;
+ }
+
+ public void setServerUrl(String serverUrl) {
+ firePropertyChange(PROPERTY_SERVER_URL, this.serverUrl, this.serverUrl = serverUrl);
+ }
+
+ public String getRhLogin() {
+ return rhLogin;
+ }
+
+ public void setRhLogin(String rhLogin) {
+ if (rhLogin != null
+ && !rhLogin.equals(this.rhLogin)) {
+ rhLoginPreferenceValue.store(rhLogin);
+ firePropertyChange(PROPERTY_RHLOGIN, this.rhLogin, this.rhLogin = rhLogin);
+ resetCredentialsStatus();
+ }
+ }
+
+ public String getPassword() {
+ return password;
+ }
+
+ public void setPassword(String password) {
+ if (password != null
+ && !password.equals(this.password)) {
+ firePropertyChange(PROPERTY_PASSWORD, this.password, this.password = password);
+ resetCredentialsStatus();
+ }
+ }
+
+ private void resetCredentialsStatus() {
+ setCredentialsStatus(null);
+ }
+
+ private void setCredentialsStatus(IStatus status) {
+ firePropertyChange(PROPERTY_CREDENTIALS_VALIDITY, this.credentialsValidity,
+ this.credentialsValidity = status);
+ }
+
+ public IStatus getCredentialsValidity() {
+ return credentialsValidity;
+ }
+
+ public void validateCredentials() {
+ IStatus status = new Status(IStatus.ERROR, OpenshiftUIActivator.PLUGIN_ID, "Your credentails are not valid.");
+ try {
+ this.user = new User(getRhLogin(), getPassword());
+ if (user.isValid()) {
+ status = Status.OK_STATUS;
+ }
+ } catch (NotFoundOpenshiftException e) {
+ // valid user without domain
+ status = Status.OK_STATUS;
+ } catch (OpenshiftException e) {
+ this.user = null;
+ }
+ wizardModel.setUser(user);
+ setCredentialsStatus(status);
+ }
+
+ public IUser getUser() {
+ return user;
+ }
+}
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/CredentialsWizardPageModel.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ISkipableWizardPage.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ISkipableWizardPage.java (rev 0)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ISkipableWizardPage.java 2011-10-05 11:03:07 UTC (rev 35356)
@@ -0,0 +1,20 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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.tools.openshift.express.internal.ui.wizard;
+
+/**
+ * @author André Dietisheim
+ */
+public interface ISkipableWizardPage {
+
+ public boolean isSkip();
+
+}
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ISkipableWizardPage.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewApplicationDialog.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewApplicationDialog.java (rev 0)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewApplicationDialog.java 2011-10-05 11:03:07 UTC (rev 35356)
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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.tools.openshift.express.internal.ui.wizard;
+
+import java.util.concurrent.ArrayBlockingQueue;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.osgi.util.NLS;
+import org.jboss.tools.common.ui.WizardUtils;
+import org.jboss.tools.openshift.express.client.IUser;
+import org.jboss.tools.openshift.express.client.OpenshiftException;
+import org.jboss.tools.openshift.express.internal.ui.OpenshiftUIActivator;
+
+/**
+ * @author André Dietisheim
+ */
+public class NewApplicationDialog extends Wizard {
+
+ private NewApplicationWizardPageModel newApplicationModel;
+
+ public NewApplicationDialog(IUser user) {
+ this.newApplicationModel = new NewApplicationWizardPageModel(user);
+ setNeedsProgressMonitor(true);
+ }
+
+ @Override
+ public boolean performFinish() {
+ final ArrayBlockingQueue<Boolean> queue = new ArrayBlockingQueue<Boolean>(1);
+ try {
+ WizardUtils.runInWizard(new Job("Creating application") {
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ try {
+ newApplicationModel.createApplication();
+ queue.offer(true);
+ } catch (OpenshiftException e) {
+ queue.offer(false);
+ return new Status(IStatus.ERROR, OpenshiftUIActivator.PLUGIN_ID,
+ NLS.bind("Could not create application \"{0}\"", newApplicationModel.getName()), e);
+ }
+ return Status.OK_STATUS;
+ }
+ }, getContainer());
+ } catch (Exception e) {
+ // ignore
+ }
+ return queue.poll();
+ }
+
+ @Override
+ public void addPages() {
+ addPage(new NewApplicationWizardPage(newApplicationModel, this));
+ }
+}
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewApplicationDialog.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewApplicationWizardPage.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewApplicationWizardPage.java (rev 0)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewApplicationWizardPage.java 2011-10-05 11:03:07 UTC (rev 35356)
@@ -0,0 +1,128 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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.tools.openshift.express.internal.ui.wizard;
+
+import org.eclipse.core.databinding.Binding;
+import org.eclipse.core.databinding.DataBindingContext;
+import org.eclipse.core.databinding.UpdateListStrategy;
+import org.eclipse.core.databinding.UpdateValueStrategy;
+import org.eclipse.core.databinding.beans.BeanProperties;
+import org.eclipse.core.databinding.conversion.Converter;
+import org.eclipse.core.databinding.validation.IValidator;
+import org.eclipse.core.databinding.validation.ValidationStatus;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.jface.databinding.fieldassist.ControlDecorationSupport;
+import org.eclipse.jface.databinding.swt.WidgetProperties;
+import org.eclipse.jface.layout.GridDataFactory;
+import org.eclipse.jface.layout.GridLayoutFactory;
+import org.eclipse.jface.wizard.IWizard;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+import org.jboss.tools.common.ui.WizardUtils;
+import org.jboss.tools.openshift.express.client.ICartridge;
+import org.jboss.tools.openshift.express.client.OpenshiftException;
+import org.jboss.tools.openshift.express.internal.ui.OpenshiftUIActivator;
+
+/**
+ * @author André Dietisheim
+ */
+public class NewApplicationWizardPage extends AbstractOpenshiftWizardPage {
+
+ private NewApplicationWizardPageModel model;
+
+ public NewApplicationWizardPage(NewApplicationWizardPageModel model, IWizard wizard) {
+ super("Create new Openshift Express application", "Create new Openshift Express application",
+ "Create new Openshift Express application", wizard);
+ this.model = model;
+ }
+
+ @Override
+ protected void doCreateControls(Composite parent, DataBindingContext dbc) {
+ GridLayoutFactory.fillDefaults().numColumns(2).margins(10, 10).applyTo(parent);
+
+ Label nameLabel = new Label(parent, SWT.NONE);
+ nameLabel.setText("Na&me");
+ GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).applyTo(nameLabel);
+ Text nameText = new Text(parent, SWT.BORDER);
+ nameText.setTextLimit(13);
+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(nameText);
+ Binding nameBinding = dbc.bindValue(
+ WidgetProperties.text().observe(nameText)
+ , BeanProperties.value(NewApplicationWizardPageModel.PROPERTY_NAME).observe(model)
+ , new UpdateValueStrategy().setAfterGetValidator(new ApplicationNameValidator())
+ , null);
+ ControlDecorationSupport.create(nameBinding, SWT.LEFT | SWT.TOP);
+
+ Label cartridgeLabel = new Label(parent, SWT.WRAP);
+ cartridgeLabel.setText("&Cartridge");
+ GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).applyTo(cartridgeLabel);
+ Combo cartridgesCombo = new Combo(parent, SWT.BORDER | SWT.READ_ONLY);
+ dbc.bindList(
+ WidgetProperties.items().observe(cartridgesCombo)
+ , BeanProperties.list(NewApplicationWizardPageModel.PROPERTY_CARTRIDGES).observe(model)
+ , new UpdateListStrategy(UpdateListStrategy.POLICY_NEVER)
+ , new UpdateListStrategy().setConverter(new Converter(Object.class, String.class) {
+
+ @Override
+ public Object convert(Object fromObject) {
+ if (!(fromObject instanceof ICartridge)) {
+ return null;
+ }
+ return ((ICartridge) fromObject).getName();
+ }
+ }));
+ dbc.bindValue(WidgetProperties.selection().observe(cartridgesCombo)
+ , BeanProperties.value(NewApplicationWizardPageModel.PROPERTY_SELECTED_CARTRIDGE).observe(model));
+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(cartridgesCombo);
+ }
+
+ @Override
+ protected void onPageActivated(DataBindingContext dbc) {
+ try {
+ WizardUtils.runInWizard(new Job("Loading cartridges") {
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ try {
+ model.loadCartridges();
+ } catch (OpenshiftException e) {
+ return new Status(IStatus.ERROR, OpenshiftUIActivator.PLUGIN_ID, "Could not load cartridges", e);
+ }
+ return Status.OK_STATUS;
+ }
+ }, getContainer());
+ } catch (Exception e) {
+ // ignore
+ }
+ }
+
+ private class ApplicationNameValidator implements IValidator {
+
+ @Override
+ public IStatus validate(Object value) {
+ String name = (String) value;
+ if (name.length() == 0) {
+ return ValidationStatus.error("You have to provide a name");
+ } else if (model.hasApplication(name)) {
+ return ValidationStatus.error(NLS.bind(
+ "Names must be unique. You already have an application named \"{0}\"", name));
+ }
+ return ValidationStatus.ok();
+ }
+ }
+}
\ No newline at end of file
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewApplicationWizardPage.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewApplicationWizardPageModel.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewApplicationWizardPageModel.java (rev 0)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewApplicationWizardPageModel.java 2011-10-05 11:03:07 UTC (rev 35356)
@@ -0,0 +1,97 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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.tools.openshift.express.internal.ui.wizard;
+
+import java.util.Collection;
+
+import org.jboss.tools.common.ui.databinding.ObservableUIPojo;
+import org.jboss.tools.common.ui.preferencevalue.StringPreferenceValue;
+import org.jboss.tools.openshift.express.client.ICartridge;
+import org.jboss.tools.openshift.express.client.IUser;
+import org.jboss.tools.openshift.express.client.OpenshiftException;
+import org.jboss.tools.openshift.express.internal.ui.OpenshiftUIActivator;
+
+/**
+ * @author André Dietisheim
+ */
+public class NewApplicationWizardPageModel extends ObservableUIPojo {
+
+ public static final String PROPERTY_NAME = "name";
+ public static final String PROPERTY_CARTRIDGES = "cartridges";
+ public static final String PROPERTY_SELECTED_CARTRIDGE = "selectedCartridge";
+
+ private IUser user;
+ private String name;
+
+ private Collection<ICartridge> cartridges;
+ private String selectedCartridge;
+ private StringPreferenceValue selectedCartridgePreference;
+
+ public NewApplicationWizardPageModel(IUser user) {
+ this.user = user;
+ this.selectedCartridgePreference = new StringPreferenceValue(
+ "org.jboss.tools.openshift.express.internal.ui.wizard.NewApplicationWizard.selectedCartridge", OpenshiftUIActivator.PLUGIN_ID);
+ initSelectedCartridge();
+ }
+
+ private void initSelectedCartridge() {
+ String selectedCartridge = selectedCartridgePreference.get();
+ if (selectedCartridge == null
+ || selectedCartridge.length() == 0) {
+ selectedCartridge = ICartridge.JBOSSAS_7.getName();
+ }
+ this.selectedCartridge = selectedCartridge;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ firePropertyChange(PROPERTY_NAME, this.name, this.name = name);
+ }
+
+ public void loadCartridges() throws OpenshiftException {
+ setCartridges(user.getCartridges());
+ }
+
+ public void setCartridges(Collection<ICartridge> cartridges) {
+ firePropertyChange(PROPERTY_CARTRIDGES, this.cartridges, this.cartridges = cartridges);
+ }
+
+ public Collection<ICartridge> getCartridges() {
+ return cartridges;
+ }
+
+ public String getSelectedCartridge() {
+ return selectedCartridge;
+ }
+
+ public void setSelectedCartridge(String name) {
+ selectedCartridgePreference.store(name);
+ firePropertyChange(PROPERTY_SELECTED_CARTRIDGE, selectedCartridge, this.selectedCartridge = name);
+ }
+
+ public void createApplication() throws OpenshiftException {
+ user.createApplication(name, user.getCartridgeByName(selectedCartridge));
+ }
+
+ public boolean hasApplication(String name) {
+ try {
+ return user.getApplicationByName(name) != null;
+ } catch (OpenshiftException e) {
+ // TODO proper logging
+ return false;
+ }
+ }
+
+
+}
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewApplicationWizardPageModel.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewDomainWizardPage.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewDomainWizardPage.java (rev 0)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewDomainWizardPage.java 2011-10-05 11:03:07 UTC (rev 35356)
@@ -0,0 +1,227 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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.tools.openshift.express.internal.ui.wizard;
+
+import java.io.File;
+import java.util.concurrent.ArrayBlockingQueue;
+import java.util.concurrent.TimeUnit;
+
+import org.eclipse.core.databinding.DataBindingContext;
+import org.eclipse.core.databinding.UpdateValueStrategy;
+import org.eclipse.core.databinding.ValidationStatusProvider;
+import org.eclipse.core.databinding.beans.BeanProperties;
+import org.eclipse.core.databinding.observable.IObservableCollection;
+import org.eclipse.core.databinding.observable.list.WritableList;
+import org.eclipse.core.databinding.observable.value.WritableValue;
+import org.eclipse.core.databinding.validation.IValidator;
+import org.eclipse.core.databinding.validation.ValidationStatus;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.jface.layout.GridDataFactory;
+import org.eclipse.jface.layout.GridLayoutFactory;
+import org.eclipse.jface.wizard.IWizard;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.PlatformUI;
+import org.jboss.tools.common.ui.BrowserUtil;
+import org.jboss.tools.common.ui.WizardUtils;
+import org.jboss.tools.common.ui.databinding.DataBindingUtils;
+import org.jboss.tools.openshift.express.client.IDomain;
+import org.jboss.tools.openshift.express.internal.ui.OpenshiftUIActivator;
+
+/**
+ * @author André Dietisheim
+ */
+public class NewDomainWizardPage extends AbstractOpenshiftWizardPage implements ISkipableWizardPage {
+
+ private static final String OPENSHIFT_EXPRESS_SIGNUP_URL = "https://openshift.redhat.com/app/user/new/express"; //$NON-NLS-1$
+
+ private static final String DIRECTORY_SSH_KEYS = ".ssh";
+ private static final String FILTEREXPRESSION_PUBLIC_SSH_KEY = "*.pub";
+ private static final String FILTERNAME_PUBLIC_SSH_KEY = "Public ssh key file (*.pub)";
+
+ private NewDomainWizardPageModel model;
+
+ public NewDomainWizardPage(IWizard wizard, ServerAdapterWizardModel wizardModel) {
+ super("New Domain", "Please create a new domain",
+ "new Domain", wizard);
+ this.model = new NewDomainWizardPageModel(wizardModel);
+ }
+
+ protected void doCreateControls(Composite container, DataBindingContext dbc) {
+ GridLayoutFactory.fillDefaults().numColumns(3).margins(10, 10).applyTo(container);
+
+ Label namespaceLabel = new Label(container, SWT.NONE);
+ namespaceLabel.setText("&Domain name");
+ GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).applyTo(namespaceLabel);
+ Text namespaceText = new Text(container, SWT.BORDER);
+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).span(2, 1).applyTo(namespaceText);
+ DataBindingUtils.bindMandatoryTextField(namespaceText, "Domain name",
+ NewDomainWizardPageModel.PROPERTY_NAMESPACE, model, dbc);
+
+ Label sshKeyLabel = new Label(container, SWT.NONE);
+ sshKeyLabel.setText("SSH Key");
+ GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).applyTo(sshKeyLabel);
+ Text sshKeyText = new Text(container, SWT.READ_ONLY | SWT.BORDER);
+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(sshKeyText);
+ DataBindingUtils.bindMandatoryTextField(sshKeyText, "SSH Key", NewDomainWizardPageModel.PROPERTY_SSHKEY, model,
+ dbc);
+ Button browseSShKeyButton = new Button(container, SWT.PUSH);
+ browseSShKeyButton.setText("Browse");
+ GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).hint(100, SWT.DEFAULT).applyTo(browseSShKeyButton);
+ browseSShKeyButton.addSelectionListener(onBrowseSshKey());
+
+ Label spacerLabel = new Label(container, SWT.None);
+ GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).applyTo(spacerLabel);
+
+ Button createButton = new Button(container, SWT.NONE);
+ createButton.setText("&Create New Domain");
+ GridDataFactory.fillDefaults().align(SWT.RIGHT, SWT.CENTER).span(2, 1).indent(0, 10).hint(160, 34)
+ .applyTo(createButton);
+ createButton.addSelectionListener(onCreate(dbc));
+ DataBindingUtils.bindButtonEnablementToValidationStatus(createButton, dbc);
+
+ dbc.bindValue(
+ new WritableValue(null, IDomain.class)
+ , BeanProperties.value(NewDomainWizardPageModel.PROPERTY_DOMAIN).observe(model)
+ , new UpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER)
+ , new UpdateValueStrategy().setAfterGetValidator(new DomainCreatedValidator()));
+ }
+
+ private SelectionListener onBrowseSshKey() {
+ return new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
+ FileDialog dialog = new FileDialog(shell);
+ dialog.setFilterPath(getSshKeysDirectory());
+ dialog.setFilterNames(new String[] { FILTERNAME_PUBLIC_SSH_KEY });
+ dialog.setFilterExtensions(new String[] { FILTEREXPRESSION_PUBLIC_SSH_KEY });
+ String sshKeyPath = dialog.open();
+ if (sshKeyPath != null) {
+ model.setSshKey(sshKeyPath);
+ }
+ }
+ };
+ }
+
+ private String getSshKeysDirectory() {
+ String userHome = System.getProperty("user.home");
+ File sshKeysDirectory = new File(userHome, DIRECTORY_SSH_KEYS);
+ return sshKeysDirectory.getAbsolutePath();
+ }
+
+ protected SelectionAdapter onCreate(final DataBindingContext dbc) {
+ return new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ try {
+ WizardUtils.runInWizard(
+ new Job("Creating new domain") {
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ try {
+ model.createDomain();
+ } catch (Exception e) {
+ return new Status(IStatus.ERROR, OpenshiftUIActivator.PLUGIN_ID, NLS.bind(
+ "Could not create a new domain with the name \"{0}\"",
+ model.getNamespace()), e);
+ }
+ return Status.OK_STATUS;
+ }
+ }, getWizard().getContainer(), dbc);
+ } catch (Exception ex) {
+ // ignore
+ }
+ };
+ };
+ }
+
+ protected SelectionAdapter onSignupLinkClicked() {
+ return new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ BrowserUtil.checkedCreateInternalBrowser(OPENSHIFT_EXPRESS_SIGNUP_URL, OPENSHIFT_EXPRESS_SIGNUP_URL,
+ OpenshiftUIActivator.PLUGIN_ID, OpenshiftUIActivator.getDefault().getLog());
+ getWizard().getContainer().getShell().close();
+ }
+ };
+ }
+
+ protected IObservableCollection toObservableCollection(ValidationStatusProvider... validationStatusProviders) {
+ WritableList validationProviders = new WritableList();
+ for (ValidationStatusProvider provider : validationStatusProviders) {
+ validationProviders.add(provider);
+ }
+ return validationProviders;
+ }
+
+ @Override
+ public boolean isSkip() {
+ if (!model.hasUser()) {
+ return false;
+ }
+
+ final ArrayBlockingQueue<Boolean> queue = new ArrayBlockingQueue<Boolean>(1);
+ try {
+ WizardUtils.runInWizard(
+ new Job("Checking presence of domain") {
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ try {
+ queue.offer(model.hasDomain());
+ } catch (Exception e) {
+ queue.offer(false);
+ return new Status(IStatus.ERROR, OpenshiftUIActivator.PLUGIN_ID,
+ "Could not get domain", e);
+ }
+ return Status.OK_STATUS;
+ }
+ }, getWizard().getContainer(), getDatabindingContext());
+ } catch (Exception ex) {
+ // ignore
+ }
+
+ try {
+ return queue.poll(6, TimeUnit.SECONDS);
+ } catch (InterruptedException e) {
+ return false;
+ }
+ }
+
+ private static class DomainCreatedValidator implements IValidator {
+ @Override
+ public IStatus validate(Object value) {
+ if (value != null) {
+ return ValidationStatus.ok();
+ } else {
+ return ValidationStatus.info("You have to create a domain...");
+ }
+ }
+ };
+
+}
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewDomainWizardPage.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewDomainWizardPageModel.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewDomainWizardPageModel.java (rev 0)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewDomainWizardPageModel.java 2011-10-05 11:03:07 UTC (rev 35356)
@@ -0,0 +1,89 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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.tools.openshift.express.internal.ui.wizard;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.jboss.tools.common.ui.databinding.ObservableUIPojo;
+import org.jboss.tools.openshift.express.client.IDomain;
+import org.jboss.tools.openshift.express.client.ISSHPublicKey;
+import org.jboss.tools.openshift.express.client.IUser;
+import org.jboss.tools.openshift.express.client.OpenshiftException;
+import org.jboss.tools.openshift.express.client.SSHPublicKey;
+
+/**
+ * @author André Dietisheim
+ */
+public class NewDomainWizardPageModel extends ObservableUIPojo {
+
+ public static final String PROPERTY_NAMESPACE = "namespace";
+ public static final String PROPERTY_SSHKEY = "sshKey";
+ public static final String PROPERTY_DOMAIN = "domain";
+
+ private String namespace;
+ private IDomain domain;
+ private String sshKey;
+ private ServerAdapterWizardModel wizardModel;
+
+ public NewDomainWizardPageModel(ServerAdapterWizardModel wizardModel) {
+ this.wizardModel = wizardModel;
+ }
+
+ public String getNamespace() {
+ return this.namespace;
+ }
+
+ public void createDomain() throws OpenshiftException, IOException {
+ IUser user = getUser();
+ IDomain domain = user.createDomain(namespace, loadSshKey());
+ setDomain(domain);
+ }
+
+ public String getSshKey() {
+ return sshKey;
+ }
+
+ public void setSshKey(String sshKey) {
+ firePropertyChange(PROPERTY_SSHKEY, this.sshKey, this.sshKey = sshKey);
+ }
+
+ private ISSHPublicKey loadSshKey() throws IOException, OpenshiftException {
+ return new SSHPublicKey(new File(sshKey));
+ }
+
+ public void setNamespace(String namespace) throws OpenshiftException {
+ firePropertyChange(PROPERTY_NAMESPACE, this.namespace, this.namespace = namespace);
+ }
+
+ public boolean hasDomain() throws OpenshiftException {
+ if (!hasUser()) {
+ return false;
+ }
+ return getUser().hasDomain();
+ }
+
+ public IDomain getDomain() {
+ return domain;
+ }
+
+ public void setDomain(IDomain domain) {
+ firePropertyChange(PROPERTY_DOMAIN, this.domain, this.domain = domain);
+ }
+
+ public boolean hasUser() {
+ return wizardModel.getUser() != null;
+ }
+
+ public IUser getUser() {
+ return wizardModel.getUser();
+ }
+}
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewDomainWizardPageModel.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ServerAdapterWizard.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ServerAdapterWizard.java (rev 0)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ServerAdapterWizard.java 2011-10-05 11:03:07 UTC (rev 35356)
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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.tools.openshift.express.internal.ui.wizard;
+
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.IWorkbench;
+
+/**
+ * @author André Dietisheim
+ */
+public class ServerAdapterWizard extends AbstractSkippingWizard {
+
+ public ServerAdapterWizard() {
+ }
+
+ @Override
+ public void init(IWorkbench workbench, IStructuredSelection selection) {
+ setWindowTitle("Create new Openshift Express Server Adapter");
+ setNeedsProgressMonitor(true);
+ }
+
+ @Override
+ public boolean performFinish() {
+ return true;
+ }
+
+ @Override
+ public void addPages() {
+ ServerAdapterWizardModel model = new ServerAdapterWizardModel();
+ addPage(new CredentialsWizardPage(this, model));
+ addPage(new NewDomainWizardPage(this, model));
+ addPage(new ApplicationWizardPage(this, model));
+ }
+}
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ServerAdapterWizard.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ServerAdapterWizardModel.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ServerAdapterWizardModel.java (rev 0)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ServerAdapterWizardModel.java 2011-10-05 11:03:07 UTC (rev 35356)
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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.tools.openshift.express.internal.ui.wizard;
+
+import org.jboss.tools.common.ui.databinding.ObservableUIPojo;
+import org.jboss.tools.openshift.express.client.IUser;
+
+/**
+ * @author André Dietisheim
+ */
+public class ServerAdapterWizardModel extends ObservableUIPojo {
+
+ private IUser user;
+
+ public void setUser(IUser user) {
+ this.user = user;
+ }
+
+ public IUser getUser() {
+ return user;
+ }
+}
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ServerAdapterWizardModel.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/TrimTrailingSlashConverter.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/TrimTrailingSlashConverter.java (rev 0)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/TrimTrailingSlashConverter.java 2011-10-05 11:03:07 UTC (rev 35356)
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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.tools.openshift.express.internal.ui.wizard;
+
+import org.eclipse.core.databinding.conversion.Converter;
+import org.eclipse.core.runtime.Assert;
+
+/**
+ * @author André Dietisheim
+ */
+public class TrimTrailingSlashConverter extends Converter {
+
+ public TrimTrailingSlashConverter() {
+ super(String.class, String.class);
+ }
+
+ @Override
+ public Object convert(Object fromObject) {
+ Assert.isLegal(fromObject instanceof String);
+ String url = (String) fromObject;
+ if (url.charAt(url.length() - 1) == '/') {
+ return url.substring(0, url.length() - 1);
+ }
+ return url;
+ }
+}
\ No newline at end of file
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/TrimTrailingSlashConverter.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
13 years, 3 months
JBoss Tools SVN: r35355 - trunk/as/plugins.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-10-05 07:02:23 -0400 (Wed, 05 Oct 2011)
New Revision: 35355
Added:
trunk/as/plugins/org.jboss.tools.openshift.express.ui/
Log:
[JBIDE-9841] renamed org.jboss.ide.eclipse.as.openshift.ui to org.jboss.tools.openshift.express.ui
13 years, 3 months
JBoss Tools SVN: r35354 - in trunk/as/plugins/org.jboss.tools.openshift.express.client: .settings and 33 other directories.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-10-05 07:00:47 -0400 (Wed, 05 Oct 2011)
New Revision: 35354
Added:
trunk/as/plugins/org.jboss.tools.openshift.express.client/.classpath
trunk/as/plugins/org.jboss.tools.openshift.express.client/.gitignore
trunk/as/plugins/org.jboss.tools.openshift.express.client/.project
trunk/as/plugins/org.jboss.tools.openshift.express.client/.settings/
trunk/as/plugins/org.jboss.tools.openshift.express.client/.settings/org.eclipse.jdt.core.prefs
trunk/as/plugins/org.jboss.tools.openshift.express.client/META-INF/
trunk/as/plugins/org.jboss.tools.openshift.express.client/META-INF/MANIFEST.MF
trunk/as/plugins/org.jboss.tools.openshift.express.client/build.properties
trunk/as/plugins/org.jboss.tools.openshift.express.client/jboss-dmr-1.0.0.Final.jar
trunk/as/plugins/org.jboss.tools.openshift.express.client/pom.xml
trunk/as/plugins/org.jboss.tools.openshift.express.client/src/
trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/
trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/
trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/
trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/
trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/
trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/client/
trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/client/ApplicationLogReader.java
trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/client/Cartridge.java
trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/client/IApplication.java
trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/client/ICartridge.java
trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/client/IDomain.java
trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/client/IHttpClient.java
trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/client/IOpenshiftService.java
trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/client/ISSHPublicKey.java
trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/client/IUser.java
trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/client/InvalidCredentialsOpenshiftException.java
trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/client/NotFoundOpenshiftException.java
trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/client/OpenshiftEndpointException.java
trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/client/OpenshiftException.java
trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/client/OpenshiftService.java
trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/client/SSHKeyPair.java
trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/client/SSHPublicKey.java
trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/client/User.java
trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/client/UserConfiguration.java
trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/
trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/
trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/Application.java
trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/ApplicationInfo.java
trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/Domain.java
trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/IOpenshiftJsonConstants.java
trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/InternalUser.java
trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/OpenshiftCoreActivator.java
trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/UserInfo.java
trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/UserInfoAware.java
trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/httpclient/
trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/httpclient/BadRequestException.java
trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/httpclient/HttpClientException.java
trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/httpclient/InternalServerErrorException.java
trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/httpclient/NotFoundException.java
trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/httpclient/UnauthorizedException.java
trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/httpclient/UrlConnectionHttpClient.java
trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/request/
trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/request/AbstractDomainRequest.java
trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/request/AbstractOpenshiftRequest.java
trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/request/ApplicationAction.java
trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/request/ApplicationRequest.java
trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/request/ChangeDomainRequest.java
trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/request/CreateDomainRequest.java
trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/request/IOpenshiftRequest.java
trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/request/IOpenshiftRequestFactory.java
trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/request/ListCartridgesRequest.java
trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/request/OpenshiftEnvelopeFactory.java
trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/request/UserInfoRequest.java
trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/request/marshalling/
trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/request/marshalling/AbstractJsonMarshaller.java
trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/request/marshalling/AbstractOpenshiftMarshaller.java
trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/request/marshalling/ApplicationRequestJsonMarshaller.java
trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/request/marshalling/DomainRequestJsonMarshaller.java
trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/request/marshalling/IOpenshiftMarshaller.java
trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/request/marshalling/ListCartridgesRequestJsonMarshaller.java
trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/request/marshalling/UserInfoRequestJsonMarshaller.java
trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/response/
trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/response/OpenshiftResponse.java
trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/response/unmarshalling/
trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/response/unmarshalling/AbstractOpenshiftJsonResponseUnmarshaller.java
trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/response/unmarshalling/ApplicationResponseUnmarshaller.java
trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/response/unmarshalling/ApplicationStatusResponseUnmarshaller.java
trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/response/unmarshalling/DomainResponseUnmarshaller.java
trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/response/unmarshalling/JsonSanitizer.java
trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/response/unmarshalling/ListCartridgesResponseUnmarshaller.java
trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/response/unmarshalling/UserInfoResponseUnmarshaller.java
trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/utils/
trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/utils/Assert.java
trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/utils/Base64Encoder.java
trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/utils/RFC822DateUtils.java
trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/utils/StreamUtils.java
trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/utils/StringUtils.java
trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/utils/UrlBuilder.java
trunk/as/plugins/org.jboss.tools.openshift.express.client/target/
trunk/as/plugins/org.jboss.tools.openshift.express.client/target/MANIFEST.MF
trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/
trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/
trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/
trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/
trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/
trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/
trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/client/
trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/client/ApplicationLogReader.class
trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/client/Cartridge.class
trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/client/IApplication.class
trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/client/ICartridge.class
trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/client/IDomain.class
trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/client/IHttpClient.class
trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/client/IOpenshiftService.class
trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/client/ISSHPublicKey.class
trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/client/IUser.class
trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/client/InvalidCredentialsOpenshiftException.class
trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/client/NotFoundOpenshiftException.class
trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/client/OpenshiftEndpointException.class
trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/client/OpenshiftException.class
trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/client/OpenshiftService.class
trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/client/SSHKeyPair.class
trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/client/SSHPublicKey.class
trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/client/User.class
trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/client/UserConfiguration.class
trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/
trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/
trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/Application.class
trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/ApplicationInfo.class
trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/Domain.class
trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/IOpenshiftJsonConstants.class
trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/InternalUser.class
trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/OpenshiftCoreActivator.class
trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/UserInfo.class
trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/UserInfoAware.class
trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/httpclient/
trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/httpclient/BadRequestException.class
trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/httpclient/HttpClientException.class
trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/httpclient/InternalServerErrorException.class
trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/httpclient/NotFoundException.class
trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/httpclient/UnauthorizedException.class
trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/httpclient/UrlConnectionHttpClient.class
trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/request/
trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/request/AbstractDomainRequest.class
trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/request/AbstractOpenshiftRequest.class
trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/request/ApplicationAction.class
trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/request/ApplicationRequest.class
trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/request/ChangeDomainRequest.class
trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/request/CreateDomainRequest.class
trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/request/IOpenshiftRequest.class
trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/request/IOpenshiftRequestFactory.class
trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/request/ListCartridgesRequest.class
trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/request/OpenshiftEnvelopeFactory.class
trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/request/UserInfoRequest.class
trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/request/marshalling/
trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/request/marshalling/AbstractJsonMarshaller.class
trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/request/marshalling/AbstractOpenshiftMarshaller.class
trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/request/marshalling/ApplicationRequestJsonMarshaller.class
trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/request/marshalling/DomainRequestJsonMarshaller.class
trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/request/marshalling/IOpenshiftMarshaller.class
trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/request/marshalling/ListCartridgesRequestJsonMarshaller.class
trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/request/marshalling/UserInfoRequestJsonMarshaller.class
trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/response/
trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/response/OpenshiftResponse.class
trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/response/unmarshalling/
trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/response/unmarshalling/AbstractOpenshiftJsonResponseUnmarshaller.class
trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/response/unmarshalling/ApplicationResponseUnmarshaller.class
trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/response/unmarshalling/ApplicationStatusResponseUnmarshaller.class
trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/response/unmarshalling/DomainResponseUnmarshaller.class
trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/response/unmarshalling/JsonSanitizer.class
trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/response/unmarshalling/ListCartridgesResponseUnmarshaller.class
trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/response/unmarshalling/UserInfoResponseUnmarshaller.class
trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/utils/
trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/utils/Assert$AssertionFailedException.class
trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/utils/Assert.class
trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/utils/Base64Encoder.class
trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/utils/RFC822DateUtils.class
trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/utils/StreamUtils.class
trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/utils/StringUtils.class
trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/utils/UrlBuilder.class
trunk/as/plugins/org.jboss.tools.openshift.express.client/target/local-artifacts.properties
trunk/as/plugins/org.jboss.tools.openshift.express.client/target/maven-archiver/
trunk/as/plugins/org.jboss.tools.openshift.express.client/target/maven-archiver/pom.properties
trunk/as/plugins/org.jboss.tools.openshift.express.client/target/org.jboss.tools.openshift.express.client-2.3.0-SNAPSHOT-sources.jar
trunk/as/plugins/org.jboss.tools.openshift.express.client/target/org.jboss.tools.openshift.express.client-2.3.0-SNAPSHOT.jar
trunk/as/plugins/org.jboss.tools.openshift.express.client/target/p2artifacts.xml
trunk/as/plugins/org.jboss.tools.openshift.express.client/target/p2content.xml
Log:
[JBIDE-9841] renamed org.jboss.ide.eclipse.as.openshift.core to org.jboss.tools.openshift.express.client
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/.classpath
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.client/.classpath (rev 0)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.client/.classpath 2011-10-05 11:00:47 UTC (rev 35354)
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry exported="true" kind="lib" path="jboss-dmr-1.0.0.Final.jar"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/.classpath
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/.gitignore
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.client/.gitignore (rev 0)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.client/.gitignore 2011-10-05 11:00:47 UTC (rev 35354)
@@ -0,0 +1,2 @@
+target
+*.class
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/.project
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.client/.project (rev 0)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.client/.project 2011-10-05 11:00:47 UTC (rev 35354)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.jboss.tools.openshift.express.client</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/.project
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.client/.settings/org.eclipse.jdt.core.prefs (rev 0)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.client/.settings/org.eclipse.jdt.core.prefs 2011-10-05 11:00:47 UTC (rev 35354)
@@ -0,0 +1,8 @@
+#Thu Aug 25 15:26:22 CEST 2011
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/.settings/org.eclipse.jdt.core.prefs
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/META-INF/MANIFEST.MF
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.client/META-INF/MANIFEST.MF (rev 0)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.client/META-INF/MANIFEST.MF 2011-10-05 11:00:47 UTC (rev 35354)
@@ -0,0 +1,21 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Openshift Core Plugin
+Bundle-SymbolicName: org.jboss.tools.openshift.express.client
+Bundle-Version: 2.3.0.qualifier
+Bundle-Activator: org.jboss.tools.openshift.express.internal.client.OpenshiftCoreActivator
+Bundle-Vendor: JBoss by Red Hat
+Require-Bundle: org.eclipse.core.runtime,
+ com.jcraft.jsch;bundle-version="[0.1.41,2.0.0)"
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-ActivationPolicy: lazy
+Bundle-ClassPath: jboss-dmr-1.0.0.Final.jar,
+ .
+Export-Package: org.jboss.dmr;x-friends:="org.jboss.ide.eclipse.as.openshift.test",
+ org.jboss.tools.openshift.express.client,
+ org.jboss.tools.openshift.express.internal.client;x-friends:="org.jboss.ide.eclipse.as.openshift.test",
+ org.jboss.tools.openshift.express.internal.client.request;x-friends:="org.jboss.ide.eclipse.as.openshift.test",
+ org.jboss.tools.openshift.express.internal.client.request.marshalling;x-friends:="org.jboss.ide.eclipse.as.openshift.test",
+ org.jboss.tools.openshift.express.internal.client.response;x-friends:="org.jboss.ide.eclipse.as.openshift.test",
+ org.jboss.tools.openshift.express.internal.client.response.unmarshalling;x-friends:="org.jboss.ide.eclipse.as.openshift.test",
+ org.jboss.tools.openshift.express.internal.client.utils;x-friends:="org.jboss.ide.eclipse.as.openshift.test"
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/META-INF/MANIFEST.MF
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/build.properties
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.client/build.properties (rev 0)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.client/build.properties 2011-10-05 11:00:47 UTC (rev 35354)
@@ -0,0 +1,5 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ jboss-dmr-1.0.0.Final.jar
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/build.properties
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/jboss-dmr-1.0.0.Final.jar
===================================================================
(Binary files differ)
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/jboss-dmr-1.0.0.Final.jar
___________________________________________________________________
Added: svn:executable
+ *
Added: svn:mime-type
+ application/octet-stream
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/pom.xml
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.client/pom.xml (rev 0)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.client/pom.xml 2011-10-05 11:00:47 UTC (rev 35354)
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.jboss.tools.as</groupId>
+ <artifactId>plugins</artifactId>
+ <version>2.3.0-SNAPSHOT</version>
+ </parent>
+ <groupId>org.jboss.tools.as.plugins</groupId>
+ <artifactId>org.jboss.tools.openshift.express.client</artifactId>
+ <packaging>eclipse-plugin</packaging>
+</project>
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/pom.xml
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/client/ApplicationLogReader.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/client/ApplicationLogReader.java (rev 0)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/client/ApplicationLogReader.java 2011-10-05 11:00:47 UTC (rev 35354)
@@ -0,0 +1,104 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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.tools.openshift.express.client;
+
+import java.io.IOException;
+import java.io.Reader;
+import java.io.StringReader;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.jboss.tools.openshift.express.internal.client.Application;
+import org.jboss.tools.openshift.express.internal.client.InternalUser;
+
+/**
+ * @author André Dietisheim
+ */
+public class ApplicationLogReader extends Reader {
+
+ private static final Pattern LOG_REGEX = Pattern.compile("Tail of .+$", Pattern.MULTILINE);
+
+ private static final long STATUS_REQUEST_DELAY = 4 * 1024;
+
+ private IOpenshiftService service;
+ private Reader logReader;
+ private Application application;
+ private InternalUser user;
+ private String currentStatus;
+
+ public ApplicationLogReader(Application application, InternalUser user, IOpenshiftService service) {
+ this.application = application;
+ this.user = user;
+ this.service = service;
+ }
+
+ @Override
+ public int read(char[] cbuf, int off, int len) throws IOException {
+ int charactersRead = -1;
+ try {
+ while (charactersRead == -1) {
+ if (logReader == null) {
+ this.logReader = createLogReader(requestStatus());
+ }
+ charactersRead = logReader.read(cbuf, off, len);
+ if (charactersRead == -1) {
+ this.logReader = null;
+ }
+ }
+ return charactersRead;
+ } catch (OpenshiftException e) {
+ throw new IOException(e);
+ } catch (InterruptedException e) {
+ return -1;
+ }
+ }
+
+ private Reader createLogReader(String status) throws InterruptedException, IOException {
+ String log = getLog(status);
+ return new StringReader(log);
+ }
+
+ private String getLog(String status) throws IOException {
+ Matcher matcher = LOG_REGEX.matcher(status);
+ int logStart = 0;
+ if (matcher.find()
+ && matcher.end() < status.length()) {
+ logStart = matcher.end() + 1;
+ }
+ return status.substring(logStart);
+ }
+
+ protected String requestStatus() throws InterruptedException, OpenshiftException {
+ String status = null;
+ while (status == null) {
+ status = service.getStatus(application.getName(), application.getCartridge(), user);
+ if (isSameStatus(currentStatus, status)) {
+ Thread.sleep(STATUS_REQUEST_DELAY);
+ status = null;
+ continue;
+ }
+ }
+ this.currentStatus = status;
+ return status;
+ }
+
+ private boolean isSameStatus(String thisStatus, String otherStatus) {
+ return otherStatus != null
+ && otherStatus.equals(thisStatus);
+ }
+
+ @Override
+ public void close() throws IOException {
+ if (logReader != null) {
+ logReader.close();
+ }
+ }
+}
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/client/ApplicationLogReader.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/client/Cartridge.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/client/Cartridge.java (rev 0)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/client/Cartridge.java 2011-10-05 11:00:47 UTC (rev 35354)
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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.tools.openshift.express.client;
+
+/**
+ * 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 implements ICartridge {
+
+ private String name;
+
+ public Cartridge(String name) {
+ this.name = name;
+ }
+
+ @Override
+ public String getName() {
+ return name;
+ }
+
+ public static ICartridge valueOf(String name) {
+ if (JBOSSAS_7.getName().equals(name)) {
+ return JBOSSAS_7;
+ }
+ return null;
+ }
+}
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/client/Cartridge.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/client/IApplication.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/client/IApplication.java (rev 0)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/client/IApplication.java 2011-10-05 11:00:47 UTC (rev 35354)
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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.tools.openshift.express.client;
+
+import java.util.Date;
+
+/**
+ * @author André Dietisheim
+ */
+public interface IApplication {
+
+ public String getName();
+
+ public String getUUID() throws OpenshiftException;
+
+ public ICartridge getCartridge();
+
+ public String getEmbedded() throws OpenshiftException;
+
+ public Date getCreationTime() throws OpenshiftException;
+
+ public void destroy() throws OpenshiftException;
+
+ public void start() throws OpenshiftException;
+
+ public void restart() throws OpenshiftException;
+
+ public void stop() throws OpenshiftException;
+
+ public ApplicationLogReader getLogReader() throws OpenshiftException;
+
+ public String getGitUri() throws OpenshiftException;
+
+ public String getApplicationUrl() throws OpenshiftException;
+
+}
\ No newline at end of file
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/client/IApplication.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/client/ICartridge.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/client/ICartridge.java (rev 0)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/client/ICartridge.java 2011-10-05 11:00:47 UTC (rev 35354)
@@ -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.tools.openshift.express.client;
+
+/**
+ * @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.tools.openshift.express.client/src/org/jboss/tools/openshift/express/client/ICartridge.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/client/IDomain.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/client/IDomain.java (rev 0)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/client/IDomain.java 2011-10-05 11:00:47 UTC (rev 35354)
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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.tools.openshift.express.client;
+
+/**
+ * @author André Dietisheim
+ */
+public interface IDomain {
+
+ public abstract void setNamespace(String namespace) throws OpenshiftException;
+
+ public abstract String getNamespace();
+
+ public abstract String getRhcDomain() throws OpenshiftException;
+
+}
\ No newline at end of file
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/client/IDomain.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/client/IHttpClient.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/client/IHttpClient.java (rev 0)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/client/IHttpClient.java 2011-10-05 11:00:47 UTC (rev 35354)
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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.tools.openshift.express.client;
+
+import org.jboss.tools.openshift.express.internal.client.httpclient.HttpClientException;
+
+/**
+ * @author André Dietisheim
+ */
+public interface IHttpClient {
+
+ public String post(String data) throws HttpClientException;
+
+ public String get() throws HttpClientException;
+}
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/client/IHttpClient.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/client/IOpenshiftService.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/client/IOpenshiftService.java (rev 0)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/client/IOpenshiftService.java 2011-10-05 11:00:47 UTC (rev 35354)
@@ -0,0 +1,244 @@
+/*******************************************************************************
+ * 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.tools.openshift.express.client;
+
+import java.net.MalformedURLException;
+import java.util.List;
+
+import org.jboss.tools.openshift.express.internal.client.ApplicationInfo;
+import org.jboss.tools.openshift.express.internal.client.InternalUser;
+import org.jboss.tools.openshift.express.internal.client.UserInfo;
+
+/**
+ * @author André Dietisheim
+ */
+public interface IOpenshiftService {
+
+ /**
+ * The platform base url
+ */
+ public static final String BASE_URL = "https://openshift.redhat.com";
+
+ /**
+ * The path (url path addition) to the service
+ */
+ public static final String SERVICE_PATH = "/broker";
+
+ /**
+ * Returns the url at which the service is reachable.
+ *
+ * @return
+ */
+ public String getServiceUrl();
+
+ /**
+ * Returns the url at which the platform is reachable.
+ *
+ * @return
+ */
+ public String getPlatformUrl();
+
+ /**
+ * Returns <code>true</code> if given user has valid credentials. Returns
+ * <code>false</code> otherwise.
+ *
+ * @return
+ * @throws OpenshiftException
+ * @throws MalformedURLException
+ */
+ public boolean isValid(InternalUser user) throws OpenshiftException;
+
+ /**
+ * List all cartridges that are available on the Openshift Express platform.
+ *
+ * @param user
+ * the user account that shall be used
+ * @return the list of cartridges available on the platform
+ * @throws OpenshiftException
+ * @throws MalformedURLException
+ *
+ * @see InternalUser
+ */
+ public List<ICartridge> getCartridges(InternalUser user) throws OpenshiftException;
+
+ /**
+ * Creates an application with the given name and cartridge for the given
+ * user.
+ *
+ * @param name
+ * the application name
+ * @param cartridge
+ * the cartridge to use
+ * @param user
+ * the user account
+ * @return the application that was created
+ * @throws OpenshiftException
+ *
+ * @see ICartridge
+ * @see InternalUser
+ * @see IApplication
+ */
+ public IApplication createApplication(String name, ICartridge cartridge, InternalUser user)
+ throws OpenshiftException;
+
+ /**
+ * Destroys the application with the given name and cartridge for the given
+ * user.
+ *
+ * @param name
+ * the name of the application that shall be destroyed
+ * @param cartridge
+ * the cartridge that the application is running on
+ * @param user
+ * the user account
+ * @throws OpenshiftException
+ *
+ * @see ICartridge
+ * @see InternalUser
+ */
+ public void destroyApplication(String name, ICartridge cartridge, InternalUser user) throws OpenshiftException;
+
+ /**
+ * Starts the application with the given name and cartridge for the given
+ * user account. Starting an application that is already started has no
+ * effect.
+ *
+ * @param name
+ * of the application that shall be started
+ * @param cartridge
+ * the cartridge the application is running on
+ * @param user
+ * the user account to use
+ * @return the application that was started
+ * @throws OpenshiftException
+ *
+ * @see ICartridge
+ * @see InternalUser
+ * @see IApplication
+ */
+ public IApplication startApplication(String name, ICartridge cartridge, InternalUser user)
+ throws OpenshiftException;
+
+ /**
+ * Restarts the application with the given name and cartridge for the given
+ * user account.
+ *
+ * @param name
+ * the name of the application that shall be restarted
+ * @param cartridge
+ * the cartridge the application is running on
+ * @param user
+ * the user account to use
+ * @return the application that was started
+ * @throws OpenshiftException
+ *
+ * @see ICartridge
+ * @see InternalUser
+ * @see IApplication
+ */
+ public IApplication restartApplication(String name, ICartridge cartridge, InternalUser user)
+ throws OpenshiftException;
+
+ /**
+ * Stops the application with the given name and cartridge for the given
+ * user account. Stopping an application that is already stopped has no
+ * effect.
+ *
+ * @param name
+ * the name of the application that shall be restarted
+ * @param cartridge
+ * the cartridge the application is running on
+ * @param user
+ * the user account to use
+ * @return the application that was stopped
+ * @throws OpenshiftException
+ *
+ * @see ICartridge
+ * @see InternalUser
+ * @see IApplication
+ */
+ public IApplication stopApplication(String name, ICartridge cartridge, InternalUser user) throws OpenshiftException;
+
+ /**
+ * Returns the log of the application with the given name and cartridge.
+ * Returns the whole log if no new log entry was created since the last
+ * call. Returns the new entries otherwise.
+ *
+ * @param name
+ * of the application that the log shall be returned of
+ * @param cartridge
+ * the cartridge the application is running on
+ * @param user
+ * the user account to use
+ * @return the log of the application
+ * @throws OpenshiftException
+ *
+ * @see ICartridge
+ * @see InternalUser
+ */
+ public String getStatus(String name, ICartridge cartridge, InternalUser user) throws OpenshiftException;
+
+ /**
+ * Changes the current domain (namespace) to the given name.
+ *
+ * @param name
+ * the new domain name(-space)
+ * @param sshKey
+ * the ssh key that shall be used.
+ * @param user
+ * the user account to use
+ * @return the domain that was changed
+ * @throws OpenshiftException
+ *
+ * @see ICartridge
+ * @see InternalUser
+ * @see SSHKeyPair
+ * @see ISSHPublicKey
+ * @see IDomain
+ */
+ public IDomain changeDomain(String name, ISSHPublicKey sshKey, InternalUser user) throws OpenshiftException;
+
+ /**
+ * Creates a domain (namespace) with the given name for the given user
+ * account with the given ssh public key. If a domain already exists an
+ * OpenshiftEndpointException is thrown.
+ *
+ * @param name
+ * the new domain name(-space)
+ * @param sshKey
+ * the ssh key that shall be used.
+ * @param user
+ * the user account to use
+ * @return the domain that was changed
+ * @throws OpenshiftException
+ *
+ * @see ICartridge
+ * @see InternalUser
+ * @see SSHKeyPair
+ * @see ISSHPublicKey
+ * @see IDomain
+ */
+ public IDomain createDomain(String name, ISSHPublicKey sshKey, InternalUser user) throws OpenshiftException;
+
+ /**
+ * Returns all informations for the given user and its applications.
+ *
+ * @param user
+ * the user account to use
+ * @return all user informations (user related info and applications)
+ * @throws OpenshiftException
+ *
+ * @see InternalUser
+ * @see InternalUserInfo
+ * @see ApplicationInfo
+ */
+ public UserInfo getUserInfo(InternalUser user) throws OpenshiftException;
+}
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/client/IOpenshiftService.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/client/ISSHPublicKey.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/client/ISSHPublicKey.java (rev 0)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/client/ISSHPublicKey.java 2011-10-05 11:00:47 UTC (rev 35354)
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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.tools.openshift.express.client;
+
+/**
+ * @author André Dietisheim
+ */
+public interface ISSHPublicKey {
+
+ /**
+ * Returns the content of the public key (key content without ssh-rsa
+ * identifier nor comment) of the ssh key
+ *
+ * @return the content of the public key (without signature, without
+ * comment)
+ * @throws OpenshiftException
+ */
+ public String getPublicKey() throws OpenshiftException ;
+
+}
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/client/ISSHPublicKey.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/client/IUser.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/client/IUser.java (rev 0)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/client/IUser.java 2011-10-05 11:00:47 UTC (rev 35354)
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * 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.tools.openshift.express.client;
+
+import java.util.Collection;
+
+/**
+ * @author André Dietisheim
+ */
+public interface IUser {
+
+ public String getRhlogin();
+
+ public String getPassword();
+
+ public boolean isValid() throws OpenshiftException;
+
+ public String getUUID() throws OpenshiftException;
+
+ public IDomain createDomain(String name, ISSHPublicKey key) throws OpenshiftException;
+
+ /**
+ * Returns the domain that this user created previously. Returns
+ * <code>null</code> if no domain was created.
+ *
+ * @return the domain that this user created
+ * @throws OpenshiftException
+ *
+ * @see #createDomain
+ */
+ public IDomain getDomain() throws OpenshiftException;
+
+ public boolean hasDomain() throws OpenshiftException;
+
+ public ISSHPublicKey getSshKey() throws OpenshiftException;
+
+ public Collection<ICartridge> getCartridges() throws OpenshiftException;
+
+ public ICartridge getCartridgeByName(String name) throws OpenshiftException;
+
+ public IApplication createApplication(String name, ICartridge cartridge) throws OpenshiftException;
+
+ public Collection<IApplication> getApplications() throws OpenshiftException;
+
+ public IApplication getApplicationByName(String name) throws OpenshiftException;
+
+ public void refresh() throws OpenshiftException;
+
+}
\ No newline at end of file
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/client/IUser.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/client/InvalidCredentialsOpenshiftException.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/client/InvalidCredentialsOpenshiftException.java (rev 0)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/client/InvalidCredentialsOpenshiftException.java 2011-10-05 11:00:47 UTC (rev 35354)
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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.tools.openshift.express.client;
+
+
+/**
+ * @author André Dietisheim
+ */
+public class InvalidCredentialsOpenshiftException extends OpenshiftEndpointException {
+
+ private static final long serialVersionUID = 1L;
+
+ public InvalidCredentialsOpenshiftException(String url, Throwable cause) {
+ super(url, cause, "Your credentials are not authorized to access \"{0}\"", url);
+ }
+}
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/client/InvalidCredentialsOpenshiftException.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/client/NotFoundOpenshiftException.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/client/NotFoundOpenshiftException.java (rev 0)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/client/NotFoundOpenshiftException.java 2011-10-05 11:00:47 UTC (rev 35354)
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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.tools.openshift.express.client;
+
+
+/**
+ * @author André Dietisheim
+ */
+public class NotFoundOpenshiftException extends OpenshiftEndpointException {
+
+ private static final long serialVersionUID = 1L;
+
+ public NotFoundOpenshiftException(String url, Throwable cause) {
+ super(url, cause, "Could not find any Openshift Express resource at \"{0}\"", url);
+ }
+}
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/client/NotFoundOpenshiftException.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/client/OpenshiftEndpointException.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/client/OpenshiftEndpointException.java (rev 0)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/client/OpenshiftEndpointException.java 2011-10-05 11:00:47 UTC (rev 35354)
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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.tools.openshift.express.client;
+
+
+/**
+ * @author André Dietisheim
+ */
+public class OpenshiftEndpointException extends OpenshiftException {
+
+ private static final long serialVersionUID = 1L;
+
+ private String url;
+
+ public OpenshiftEndpointException(String url, Throwable cause, String message, Object... arguments) {
+ super(cause, message, arguments);
+ this.url = url;
+ }
+
+ protected String getUrl() {
+ return url;
+ }
+
+}
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/client/OpenshiftEndpointException.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/client/OpenshiftException.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/client/OpenshiftException.java (rev 0)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/client/OpenshiftException.java 2011-10-05 11:00:47 UTC (rev 35354)
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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.tools.openshift.express.client;
+
+import java.text.MessageFormat;
+
+/**
+ * @author André Dietisheim
+ */
+public class OpenshiftException extends Exception {
+
+ private static final long serialVersionUID = 1L;
+
+ public OpenshiftException(Throwable cause, String message, Object... arguments) {
+ super(MessageFormat.format(message, arguments), cause);
+ }
+
+ public OpenshiftException(String message, Object... arguments) {
+ super(MessageFormat.format(message, arguments));
+ }
+}
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/client/OpenshiftException.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/client/OpenshiftService.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/client/OpenshiftService.java (rev 0)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/client/OpenshiftService.java 2011-10-05 11:00:47 UTC (rev 35354)
@@ -0,0 +1,259 @@
+/*******************************************************************************
+ * 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.tools.openshift.express.client;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.List;
+
+import org.jboss.tools.openshift.express.internal.client.Application;
+import org.jboss.tools.openshift.express.internal.client.InternalUser;
+import org.jboss.tools.openshift.express.internal.client.UserInfo;
+import org.jboss.tools.openshift.express.internal.client.httpclient.HttpClientException;
+import org.jboss.tools.openshift.express.internal.client.httpclient.NotFoundException;
+import org.jboss.tools.openshift.express.internal.client.httpclient.UnauthorizedException;
+import org.jboss.tools.openshift.express.internal.client.httpclient.UrlConnectionHttpClient;
+import org.jboss.tools.openshift.express.internal.client.request.AbstractDomainRequest;
+import org.jboss.tools.openshift.express.internal.client.request.ApplicationAction;
+import org.jboss.tools.openshift.express.internal.client.request.ApplicationRequest;
+import org.jboss.tools.openshift.express.internal.client.request.ChangeDomainRequest;
+import org.jboss.tools.openshift.express.internal.client.request.CreateDomainRequest;
+import org.jboss.tools.openshift.express.internal.client.request.ListCartridgesRequest;
+import org.jboss.tools.openshift.express.internal.client.request.OpenshiftEnvelopeFactory;
+import org.jboss.tools.openshift.express.internal.client.request.UserInfoRequest;
+import org.jboss.tools.openshift.express.internal.client.request.marshalling.ApplicationRequestJsonMarshaller;
+import org.jboss.tools.openshift.express.internal.client.request.marshalling.DomainRequestJsonMarshaller;
+import org.jboss.tools.openshift.express.internal.client.request.marshalling.ListCartridgesRequestJsonMarshaller;
+import org.jboss.tools.openshift.express.internal.client.request.marshalling.UserInfoRequestJsonMarshaller;
+import org.jboss.tools.openshift.express.internal.client.response.OpenshiftResponse;
+import org.jboss.tools.openshift.express.internal.client.response.unmarshalling.ApplicationResponseUnmarshaller;
+import org.jboss.tools.openshift.express.internal.client.response.unmarshalling.ApplicationStatusResponseUnmarshaller;
+import org.jboss.tools.openshift.express.internal.client.response.unmarshalling.DomainResponseUnmarshaller;
+import org.jboss.tools.openshift.express.internal.client.response.unmarshalling.JsonSanitizer;
+import org.jboss.tools.openshift.express.internal.client.response.unmarshalling.ListCartridgesResponseUnmarshaller;
+import org.jboss.tools.openshift.express.internal.client.response.unmarshalling.UserInfoResponseUnmarshaller;
+
+/**
+ * @author André Dietisheim
+ */
+public class OpenshiftService implements IOpenshiftService {
+
+ private String baseUrl;
+
+ public OpenshiftService() {
+ this(BASE_URL);
+ }
+
+ public OpenshiftService(String baseUrl) {
+ this.baseUrl = baseUrl;
+ }
+
+ @Override
+ public String getServiceUrl() {
+ return baseUrl + SERVICE_PATH;
+ }
+
+ @Override
+ public String getPlatformUrl() {
+ return baseUrl;
+ }
+
+ @Override
+ public boolean isValid(InternalUser user) throws OpenshiftException {
+ return getUserInfo(user) != null;
+ }
+
+ @Override
+ public UserInfo getUserInfo(InternalUser user) throws OpenshiftException {
+ UserInfoRequest request = new UserInfoRequest(user.getRhlogin(), true);
+ String url = request.getUrlString(getServiceUrl());
+ try {
+ String requestString = new UserInfoRequestJsonMarshaller().marshall(request);
+ String openShiftRequestString = new OpenshiftEnvelopeFactory(user.getPassword(), requestString)
+ .createString();
+ String responseString = createHttpClient(url).post(openShiftRequestString);
+ responseString = JsonSanitizer.sanitize(responseString);
+ OpenshiftResponse<UserInfo> response =
+ new UserInfoResponseUnmarshaller().unmarshall(responseString);
+ return response.getOpenshiftObject();
+ } catch (MalformedURLException e) {
+ throw new OpenshiftEndpointException(
+ url, e, "Could not get user info for user \"{0}\" at \"{1}\"", user.getRhlogin(), url);
+ } catch (UnauthorizedException e) {
+ throw new InvalidCredentialsOpenshiftException(url, e);
+ } catch (NotFoundException e) {
+ throw new NotFoundOpenshiftException(url, e);
+ } catch (HttpClientException e) {
+ throw new OpenshiftEndpointException(
+ url, e, "Could not get user info for user \"{0}\" at \"{1}\"", user.getRhlogin(), url);
+ }
+ }
+
+ @Override
+ public List<ICartridge> getCartridges(InternalUser user) throws OpenshiftException {
+ ListCartridgesRequest listCartridgesRequest = new ListCartridgesRequest(user.getRhlogin(), true);
+ String url = listCartridgesRequest.getUrlString(getServiceUrl());
+ try {
+ String listCartridgesRequestString =
+ new ListCartridgesRequestJsonMarshaller().marshall(listCartridgesRequest);
+ String request = new OpenshiftEnvelopeFactory(user.getPassword(), listCartridgesRequestString)
+ .createString();
+ String listCatridgesReponse = createHttpClient(url).post(request);
+ listCatridgesReponse = JsonSanitizer.sanitize(listCatridgesReponse);
+ OpenshiftResponse<List<ICartridge>> response =
+ new ListCartridgesResponseUnmarshaller().unmarshall(listCatridgesReponse);
+ return response.getOpenshiftObject();
+ /**
+ * always allowed to list cartridges, even with invalid credentials
+ */
+ } catch (MalformedURLException e) {
+ throw new OpenshiftEndpointException(url, e, "Could not list available cartridges at \"{0}\"", url);
+ } catch (NotFoundException e) {
+ throw new NotFoundOpenshiftException(url, e);
+ } catch (HttpClientException e) {
+ throw new OpenshiftEndpointException(url, e, "Could not list available cartridges at \"{0}\"", url);
+ }
+ }
+
+ @Override
+ public IDomain createDomain(String name, ISSHPublicKey sshKey, InternalUser user) throws OpenshiftException {
+ return requestDomainAction(new CreateDomainRequest(name, sshKey, user.getRhlogin(), true), user);
+ }
+
+ @Override
+ public IDomain changeDomain(String newName, ISSHPublicKey sshKey, InternalUser user) throws OpenshiftException {
+ return requestDomainAction(new ChangeDomainRequest(newName, sshKey, user.getRhlogin(), true), user);
+ }
+
+ protected IDomain requestDomainAction(AbstractDomainRequest request, InternalUser user) throws OpenshiftException {
+ String url = request.getUrlString(getServiceUrl());
+ try {
+ String requestString =
+ new OpenshiftEnvelopeFactory(
+ user.getPassword(),
+ new DomainRequestJsonMarshaller().marshall(request))
+ .createString();
+ String responseString = createHttpClient(url).post(requestString);
+ responseString = JsonSanitizer.sanitize(responseString);
+ OpenshiftResponse<IDomain> response =
+ new DomainResponseUnmarshaller(request.getName(), user, this).unmarshall(responseString);
+ return response.getOpenshiftObject();
+ } catch (MalformedURLException e) {
+ throw new OpenshiftEndpointException(url, e, "Could reach openshift platform at \"{0}\"", url);
+ } catch (UnauthorizedException e) {
+ throw new InvalidCredentialsOpenshiftException(url, e);
+ } catch (NotFoundException e) {
+ throw new NotFoundOpenshiftException(url, e);
+ } catch (HttpClientException e) {
+ throw new OpenshiftEndpointException(url, e, "Could not {0}", request.toHumanReadable());
+ }
+ }
+
+ @Override
+ public Application createApplication(String name, ICartridge cartridge, InternalUser user)
+ throws OpenshiftException {
+ Application application = requestApplicationAction(new ApplicationRequest(name, cartridge,
+ ApplicationAction.CONFIGURE,
+ user.getRhlogin(), true), user);
+ return application;
+ }
+
+ @Override
+ public void destroyApplication(String name, ICartridge cartridge, InternalUser user) throws OpenshiftException {
+ IApplication application = requestApplicationAction(new ApplicationRequest(name, cartridge,
+ ApplicationAction.DECONFIGURE,
+ user.getRhlogin(), true), user);
+ user.remove(application);
+ }
+
+ @Override
+ public IApplication startApplication(String name, ICartridge cartridge, InternalUser user)
+ throws OpenshiftException {
+ return requestApplicationAction(new ApplicationRequest(name, cartridge, ApplicationAction.START,
+ user.getRhlogin(), true), user);
+ }
+
+ @Override
+ public IApplication restartApplication(String name, ICartridge cartridge, InternalUser user)
+ throws OpenshiftException {
+ return requestApplicationAction(new ApplicationRequest(name, cartridge, ApplicationAction.RESTART,
+ user.getRhlogin(), true), user);
+ }
+
+ @Override
+ public IApplication stopApplication(String name, ICartridge cartridge, InternalUser user) throws OpenshiftException {
+ return requestApplicationAction(new ApplicationRequest(name, cartridge, ApplicationAction.STOP,
+ user.getRhlogin(), true), user);
+ }
+
+ @Override
+ public String getStatus(String applicationName, ICartridge cartridge, InternalUser user) throws OpenshiftException {
+ ApplicationRequest applicationRequest =
+ new ApplicationRequest(applicationName, cartridge, ApplicationAction.STATUS, user.getRhlogin(), true);
+ String url = applicationRequest.getUrlString(getServiceUrl());
+ try {
+ String applicationRequestString =
+ new ApplicationRequestJsonMarshaller().marshall(applicationRequest);
+ String request = new OpenshiftEnvelopeFactory(user.getPassword(), applicationRequestString).createString();
+ String response = createHttpClient(url).post(request);
+
+ response = JsonSanitizer.sanitize(response);
+ OpenshiftResponse<String> openshiftResponse =
+ new ApplicationStatusResponseUnmarshaller().unmarshall(response);
+ return openshiftResponse.getOpenshiftObject();
+ } catch (MalformedURLException e) {
+ throw new OpenshiftException(
+ e, "Could not {0} application \"{1}\" at \"{2}\": Invalid url \"{2}\"",
+ applicationRequest.getAction().toHumanReadable(), applicationRequest.getName(), url);
+ } catch (UnauthorizedException e) {
+ throw new InvalidCredentialsOpenshiftException(url, e);
+ } catch (NotFoundException e) {
+ throw new NotFoundOpenshiftException(url, e);
+ } catch (HttpClientException e) {
+ throw new OpenshiftEndpointException(
+ url, e, "Could not {0} application \"{1}\" at \"{2}\"",
+ applicationRequest.getAction().toHumanReadable(), applicationRequest.getName(), url);
+ }
+ }
+
+ protected Application requestApplicationAction(ApplicationRequest applicationRequest, InternalUser user)
+ throws OpenshiftException {
+ String url = applicationRequest.getUrlString(getServiceUrl());
+ try {
+ String applicationRequestString =
+ new ApplicationRequestJsonMarshaller().marshall(applicationRequest);
+ String request = new OpenshiftEnvelopeFactory(user.getPassword(), applicationRequestString).createString();
+ String response = createHttpClient(url).post(request);
+
+ response = JsonSanitizer.sanitize(response);
+ OpenshiftResponse<Application> openshiftResponse =
+ new ApplicationResponseUnmarshaller(applicationRequest.getName(),
+ applicationRequest.getCartridge(), user, this).unmarshall(response);
+ return openshiftResponse.getOpenshiftObject();
+ } catch (MalformedURLException e) {
+ throw new OpenshiftException(
+ e, "Could not {0} application \"{1}\" at \"{2}\": Invalid url \"{2}\"",
+ applicationRequest.getAction().toHumanReadable(), applicationRequest.getName(), url);
+ } catch (UnauthorizedException e) {
+ throw new InvalidCredentialsOpenshiftException(url, e);
+ } catch (NotFoundException e) {
+ throw new NotFoundOpenshiftException(url, e);
+ } catch (HttpClientException e) {
+ throw new OpenshiftEndpointException(
+ url, e, "Could not {0} application \"{1}\" at \"{2}\"",
+ applicationRequest.getAction().toHumanReadable(), applicationRequest.getName(), url);
+ }
+ }
+
+ private IHttpClient createHttpClient(String url) throws MalformedURLException {
+ return new UrlConnectionHttpClient(new URL(url));
+ }
+}
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/client/OpenshiftService.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/client/SSHKeyPair.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/client/SSHKeyPair.java (rev 0)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/client/SSHKeyPair.java 2011-10-05 11:00:47 UTC (rev 35354)
@@ -0,0 +1,103 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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.tools.openshift.express.client;
+
+import org.jboss.tools.openshift.express.internal.client.OpenshiftCoreActivator;
+import org.jboss.tools.openshift.express.internal.client.utils.Base64Encoder;
+
+import com.jcraft.jsch.JSch;
+import com.jcraft.jsch.JSchException;
+import com.jcraft.jsch.KeyPair;
+
+/**
+ * @author André Dietisheim
+ */
+public class SSHKeyPair implements ISSHPublicKey {
+
+ /**
+ * the length of the key that is created when using #create. ssh-keygen uses
+ * a default of 2048
+ *
+ * @see #create(String, String, String)
+ * @see http://en.wikipedia.org/wiki/Ssh-keygen
+ */
+ private static final int KEYLENGTH = 2048;
+
+ private KeyPair keyPair;
+ private String privateKeyPath;
+
+ private String publicKeyPath;
+
+ private SSHKeyPair(KeyPair keyPair, String privateKeyPath, String publicKeyPath) throws OpenshiftException {
+ this.keyPair = keyPair;
+ this.privateKeyPath = privateKeyPath;
+ this.publicKeyPath = publicKeyPath;
+ }
+
+ /**
+ * Creates private and public ssh-rsa keys and stores them to the given
+ * paths. The key is created while using the given pass phrase.
+ *
+ * @param passPhrase
+ * the pass phrase to set to the new key
+ * @param privateKeyPath
+ * the path where the new private key gets stored
+ * @param publicKeyPath
+ * the path where the new public key gets stored
+ * @return
+ * @throws OpenshiftException
+ * if the key could not be created
+ */
+ public static SSHKeyPair create(String passPhrase, String privateKeyPath, String publicKeyPath)
+ throws OpenshiftException {
+ try {
+ KeyPair keyPair = KeyPair.genKeyPair(new JSch(), KeyPair.RSA, KEYLENGTH);
+ keyPair.setPassphrase(passPhrase);
+ keyPair.writePublicKey(publicKeyPath, "created by " + OpenshiftCoreActivator.PLUGIN_ID);
+ keyPair.writePrivateKey(privateKeyPath);
+ return new SSHKeyPair(keyPair, privateKeyPath, publicKeyPath);
+ } catch (Exception e) {
+ throw new OpenshiftException(e, "Could not create new rsa key", e);
+ }
+ }
+
+ /**
+ * Loads existing private and public ssh key from the given paths.
+ *
+ * @param privateKeyPath
+ * the path to the private key
+ * @param publicKeyPath
+ * the path to the public key
+ * @return
+ * @throws OpenshiftException
+ */
+ public static SSHKeyPair load(String privateKeyPath, String publicKeyPath)
+ throws OpenshiftException {
+ try {
+ KeyPair keyPair = KeyPair.load(new JSch(), privateKeyPath, publicKeyPath);
+ return new SSHKeyPair(keyPair, privateKeyPath, publicKeyPath);
+ } catch (JSchException e) {
+ throw new OpenshiftException(e, "Could not create new rsa key");
+ }
+ }
+
+ public String getPublicKey() throws OpenshiftException {
+ return new String(Base64Encoder.encode(keyPair.getPublicKeyBlob()));
+ }
+
+ protected String getPrivateKeyPath() {
+ return privateKeyPath;
+ }
+
+ protected String getPublicKeyPath() {
+ return publicKeyPath;
+ }
+}
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/client/SSHKeyPair.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/client/SSHPublicKey.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/client/SSHPublicKey.java (rev 0)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/client/SSHPublicKey.java 2011-10-05 11:00:47 UTC (rev 35354)
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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.tools.openshift.express.client;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.IOException;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.jboss.tools.openshift.express.internal.client.utils.StreamUtils;
+
+/**
+ * @author André Dietisheim
+ */
+public class SSHPublicKey implements ISSHPublicKey {
+
+ private static final Pattern PUBLICKEY_PATTERN = Pattern.compile("[^ ]+ ([^ ]+)( .+)*");
+
+ private String publicKey;
+
+ public SSHPublicKey(File publicKeyFilePath) throws IOException, OpenshiftException {
+ this.publicKey = extractPublicKey(publicKeyFilePath);
+ }
+
+ public SSHPublicKey(String publicKey) {
+ this.publicKey = publicKey;
+ }
+
+ private String extractPublicKey(File file) throws OpenshiftException, FileNotFoundException, IOException {
+ String keyWithIdAndComment = StreamUtils.readToString(new FileReader(file));
+ Matcher matcher = PUBLICKEY_PATTERN.matcher(keyWithIdAndComment);
+ if (!matcher.find()
+ || matcher.groupCount() < 1) {
+ throw new OpenshiftException("Could not load public key from file \"{0}\"", file.getAbsolutePath());
+ }
+
+ return matcher.group(1);
+ }
+
+ public String getPublicKey() {
+ return publicKey;
+ }
+
+ void update(String publicKey) {
+ this.publicKey = publicKey;
+ }
+}
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/client/SSHPublicKey.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/client/User.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/client/User.java (rev 0)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/client/User.java 2011-10-05 11:00:47 UTC (rev 35354)
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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.tools.openshift.express.client;
+
+import org.jboss.tools.openshift.express.internal.client.InternalUser;
+
+/**
+ * @author André Dietisheim
+ */
+public class User extends InternalUser {
+
+ public User(String rhlogin, String password) {
+ super(rhlogin, password);
+ }
+
+ protected User(String rhlogin, String password, String url) {
+ super(rhlogin, password, url);
+ }
+}
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/client/User.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/client/UserConfiguration.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/client/UserConfiguration.java (rev 0)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/client/UserConfiguration.java 2011-10-05 11:00:47 UTC (rev 35354)
@@ -0,0 +1,78 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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.tools.openshift.express.client;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.Writer;
+import java.util.Properties;
+
+import org.jboss.tools.openshift.express.internal.client.utils.StreamUtils;
+
+/**
+ * @author André Dietisheim
+ */
+public class UserConfiguration {
+
+ private static final String CONFIGURATION_FOLDER = ".openshift";
+ private static final String CONFIGURATION_FILE = "express.conf";
+ private static final String PROPERTY_USERHOME = "user.home";
+ protected static final String KEY_RHLOGIN = "default_rhlogin";
+
+ private Properties properties;
+ protected File file;
+
+ public UserConfiguration() throws OpenshiftException, IOException {
+ this.file = getUserConfigurationFile();
+ this.properties = getUserProperties(file);
+ }
+
+ protected File getUserConfigurationFile() throws OpenshiftException, IOException {
+ String userHome = System.getProperty(PROPERTY_USERHOME);
+ if (userHome == null) {
+ throw new OpenshiftException("Could not read user configuration: user home directory not found");
+ }
+ return new File(CONFIGURATION_FILE, userHome + File.separatorChar + CONFIGURATION_FOLDER);
+ }
+
+ protected Properties getUserProperties(File userConfigurationFile) throws FileNotFoundException, IOException {
+ FileReader reader = null;
+ try {
+ Properties userConfigurationProperties = new Properties();
+ reader = new FileReader(userConfigurationFile);
+ userConfigurationProperties.load(reader);
+ return userConfigurationProperties;
+ } finally {
+ StreamUtils.close(reader);
+ }
+ }
+
+ public String getRhlogin() {
+ return properties.getProperty(KEY_RHLOGIN);
+ }
+
+ public void setRhlogin(String rhlogin) {
+ properties.put(KEY_RHLOGIN, rhlogin);
+ }
+
+ public void store() throws IOException {
+ Writer writer = null;
+ try {
+ writer = new FileWriter(file);
+ properties.store(writer, "");
+ } finally {
+ StreamUtils.close(writer);
+ }
+ }
+}
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/client/UserConfiguration.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/Application.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/Application.java (rev 0)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/Application.java 2011-10-05 11:00:47 UTC (rev 35354)
@@ -0,0 +1,155 @@
+/*******************************************************************************
+ * 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.tools.openshift.express.internal.client;
+
+import java.text.MessageFormat;
+import java.util.Date;
+
+import org.jboss.tools.openshift.express.client.ApplicationLogReader;
+import org.jboss.tools.openshift.express.client.IApplication;
+import org.jboss.tools.openshift.express.client.ICartridge;
+import org.jboss.tools.openshift.express.client.IDomain;
+import org.jboss.tools.openshift.express.client.IOpenshiftService;
+import org.jboss.tools.openshift.express.client.OpenshiftException;
+
+/**
+ * @author André Dietisheim
+ */
+public class Application extends UserInfoAware implements IApplication {
+
+ private static final String GIT_URI_PATTERN = "ssh://{0}@{1}-{2}.{3}/~/git/{1}.git/";
+ private static final String APPLICATION_URL_PATTERN = "http://{0}-{1}.{2}/";
+
+ private String name;
+ private ICartridge cartridge;
+ private IOpenshiftService service;
+ private ApplicationLogReader logReader;
+ private ApplicationInfo applicationInfo;
+
+ public Application(String name, ICartridge cartridge, InternalUser user, IOpenshiftService service) {
+ this(name, cartridge, null, user, service);
+ }
+
+ public Application(String name, ICartridge cartridge, ApplicationInfo applicationInfo, InternalUser user,
+ IOpenshiftService service) {
+ super(user);
+ this.name = name;
+ this.cartridge = cartridge;
+ this.service = service;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ @Override
+ public String getUUID() throws OpenshiftException {
+ return getApplicationInfo().getUuid();
+ }
+
+ @Override
+ public ICartridge getCartridge() {
+ return cartridge;
+ }
+
+ @Override
+ public String getEmbedded() throws OpenshiftException {
+ return getApplicationInfo().getEmbedded();
+ }
+
+ @Override
+ public Date getCreationTime() throws OpenshiftException {
+ return getApplicationInfo().getCreationTime();
+ }
+
+ @Override
+ public void destroy() throws OpenshiftException {
+ service.destroyApplication(name, cartridge, getUser());
+ }
+
+ @Override
+ public void start() throws OpenshiftException {
+ service.startApplication(name, cartridge, getUser());
+ }
+
+ @Override
+ public void restart() throws OpenshiftException {
+ service.restartApplication(name, cartridge, getUser());
+ }
+
+ @Override
+ public void stop() throws OpenshiftException {
+ service.stopApplication(name, cartridge, getUser());
+ }
+
+ @Override
+ public ApplicationLogReader getLogReader() throws OpenshiftException {
+ if (logReader == null) {
+ this.logReader = new ApplicationLogReader(this, getUser(), service);
+ }
+ return logReader;
+ }
+
+ @Override
+ public String getGitUri() throws OpenshiftException {
+ IDomain domain = getUser().getDomain();
+ if (domain == null) {
+ return null;
+ }
+ return MessageFormat
+ .format(GIT_URI_PATTERN, getUUID(), getName(), domain.getNamespace(), domain.getRhcDomain());
+ }
+
+ @Override
+ public String getApplicationUrl() throws OpenshiftException {
+ IDomain domain = getUser().getDomain();
+ if (domain == null) {
+ return null;
+ }
+ return MessageFormat.format(APPLICATION_URL_PATTERN, name, domain.getNamespace(), domain.getRhcDomain());
+ }
+
+ protected IOpenshiftService getService() {
+ return service;
+ }
+
+ protected ApplicationInfo getApplicationInfo() throws OpenshiftException {
+ if (applicationInfo == null) {
+ this.applicationInfo = getUserInfo().getApplicationInfoByName(getName());
+ }
+ return applicationInfo;
+ }
+
+ @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.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/Application.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/ApplicationInfo.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/ApplicationInfo.java (rev 0)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/ApplicationInfo.java 2011-10-05 11:00:47 UTC (rev 35354)
@@ -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.tools.openshift.express.internal.client;
+
+import java.util.Date;
+
+import org.jboss.tools.openshift.express.client.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.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/ApplicationInfo.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/Domain.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/Domain.java (rev 0)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/Domain.java 2011-10-05 11:00:47 UTC (rev 35354)
@@ -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.tools.openshift.express.internal.client;
+
+import org.jboss.tools.openshift.express.client.IDomain;
+import org.jboss.tools.openshift.express.client.IOpenshiftService;
+import org.jboss.tools.openshift.express.client.OpenshiftException;
+
+
+/**
+ * @author André Dietisheim
+ */
+public class Domain extends UserInfoAware implements IDomain {
+
+ private String namespace;
+ private IOpenshiftService service;
+
+ public Domain(String namespace, InternalUser user, IOpenshiftService service) {
+ this(namespace, null, user, service);
+ }
+
+ public Domain(String namespace, String rhcDomain, InternalUser user, IOpenshiftService service) {
+ super(user);
+ this.namespace = namespace;
+ this.service = service;
+ }
+
+ @Override
+ public String getNamespace() {
+ return namespace;
+ }
+
+ @Override
+ public String getRhcDomain() throws OpenshiftException {
+ return getUserInfo().getRhcDomain();
+ }
+
+ @Override
+ public void setNamespace(String namespace) throws OpenshiftException {
+ InternalUser user = getUser();
+ IDomain domain = service.changeDomain(namespace, user.getSshKey(), user);
+ update(domain);
+ }
+
+ private void update(IDomain domain) {
+ this.namespace = domain.getNamespace();
+ }
+}
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/Domain.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/IOpenshiftJsonConstants.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/IOpenshiftJsonConstants.java (rev 0)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/IOpenshiftJsonConstants.java 2011-10-05 11:00:47 UTC (rev 35354)
@@ -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.tools.openshift.express.internal.client;
+
+/**
+ * @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.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/IOpenshiftJsonConstants.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/InternalUser.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/InternalUser.java (rev 0)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/InternalUser.java 2011-10-05 11:00:47 UTC (rev 35354)
@@ -0,0 +1,231 @@
+/*******************************************************************************
+ * 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.tools.openshift.express.internal.client;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+
+import org.jboss.tools.openshift.express.client.IApplication;
+import org.jboss.tools.openshift.express.client.ICartridge;
+import org.jboss.tools.openshift.express.client.IDomain;
+import org.jboss.tools.openshift.express.client.IOpenshiftService;
+import org.jboss.tools.openshift.express.client.ISSHPublicKey;
+import org.jboss.tools.openshift.express.client.IUser;
+import org.jboss.tools.openshift.express.client.InvalidCredentialsOpenshiftException;
+import org.jboss.tools.openshift.express.client.NotFoundOpenshiftException;
+import org.jboss.tools.openshift.express.client.OpenshiftException;
+import org.jboss.tools.openshift.express.client.OpenshiftService;
+import org.jboss.tools.openshift.express.client.UserConfiguration;
+
+/**
+ * @author André Dietisheim
+ */
+public class InternalUser implements IUser {
+
+ private String rhlogin;
+ private String password;
+ private ISSHPublicKey sshKey;
+ private IDomain domain;
+ private UserInfo userInfo;
+ private List<ICartridge> cartridges;
+ private List<IApplication> applications = new ArrayList<IApplication>();
+
+ private IOpenshiftService service;
+
+ public InternalUser(String password) throws OpenshiftException, IOException {
+ this(new UserConfiguration(), password);
+ }
+
+ public InternalUser(UserConfiguration configuration, String password) {
+ this(configuration.getRhlogin(), password, (ISSHPublicKey) null, new OpenshiftService());
+ }
+
+ public InternalUser(String rhlogin, String password) {
+ this(rhlogin, password, (ISSHPublicKey) null, new OpenshiftService());
+ }
+
+ public InternalUser(String rhlogin, String password, String url) {
+ this(rhlogin, password, (ISSHPublicKey) null, new OpenshiftService(url));
+ }
+
+ public InternalUser(String rhlogin, String password, IOpenshiftService service) {
+ this(rhlogin, password, (ISSHPublicKey) null, service);
+ }
+
+ public InternalUser(String rhlogin, String password, ISSHPublicKey sshKey, IOpenshiftService service) {
+ this.rhlogin = rhlogin;
+ this.password = password;
+ this.sshKey = sshKey;
+ this.service = service;
+ }
+
+ @Override
+ public boolean isValid() throws OpenshiftException {
+ try {
+ return service.isValid(this);
+ } catch (InvalidCredentialsOpenshiftException e) {
+ return false;
+ }
+ }
+
+ @Override
+ public IDomain createDomain(String name, ISSHPublicKey key) throws OpenshiftException {
+ setSshKey(key);
+ this.domain = getService().createDomain(name, key, this);
+ return domain;
+ }
+
+ @Override
+ public IDomain getDomain() throws OpenshiftException {
+ if (domain == null) {
+ try {
+ this.domain = new Domain(
+ getUserInfo().getNamespace()
+ , getUserInfo().getRhcDomain()
+ , this
+ , service);
+ } catch (NotFoundOpenshiftException e) {
+ return null;
+ }
+ }
+ return domain;
+ }
+
+ public boolean hasDomain() throws OpenshiftException {
+ return getDomain() != null;
+ }
+
+ private void setSshKey(ISSHPublicKey key) {
+ this.sshKey = key;
+ }
+
+ @Override
+ public ISSHPublicKey getSshKey() throws OpenshiftException {
+ if (sshKey == null) {
+ this.sshKey = getUserInfo().getSshPublicKey();
+ }
+ return sshKey;
+ }
+
+ @Override
+ public String getRhlogin() {
+ return rhlogin;
+ }
+
+ @Override
+ public String getPassword() {
+ return password;
+ }
+
+ @Override
+ public String getUUID() throws OpenshiftException {
+ return getUserInfo().getUuid();
+ }
+
+ @Override
+ public List<ICartridge> getCartridges() throws OpenshiftException {
+ if (cartridges == null) {
+ this.cartridges = service.getCartridges(this);
+ }
+ return Collections.unmodifiableList(cartridges);
+ }
+
+ @Override
+ public ICartridge getCartridgeByName(String name) throws OpenshiftException {
+ ICartridge matchingCartridge = null;
+ for(ICartridge cartridge : getCartridges()) {
+ if (name.equals(cartridge.getName())) {
+ matchingCartridge = cartridge;
+ break;
+ }
+ }
+ return matchingCartridge;
+ }
+
+ @Override
+ public IApplication createApplication(String name, ICartridge cartridge) throws OpenshiftException {
+ IApplication application = service.createApplication(name, cartridge, this);
+ add(application);
+ return application;
+ }
+
+ @Override
+ public Collection<IApplication> getApplications() throws OpenshiftException {
+ if (getUserInfo().getApplicationInfos().size() > applications.size()) {
+ update(getUserInfo().getApplicationInfos());
+ }
+ return Collections.unmodifiableList(applications);
+ }
+
+ @Override
+ public IApplication getApplicationByName(String name) throws OpenshiftException {
+ return getApplicationByName(name, getApplications());
+ }
+
+ private IApplication getApplicationByName(String name, Collection<IApplication> applications) {
+ IApplication matchingApplication = null;
+ for (IApplication application : applications) {
+ if (name.equals(application.getName())) {
+ matchingApplication = application;
+ }
+ }
+ return matchingApplication;
+ }
+
+ public void add(IApplication application) {
+ applications.add(application);
+ }
+
+ public void remove(IApplication application) {
+ applications.remove(application);
+ }
+
+ public void setSshPublicKey(ISSHPublicKey key) {
+ this.sshKey = key;
+ }
+
+ protected UserInfo getUserInfo() throws OpenshiftException {
+ if (userInfo == null) {
+ this.userInfo = service.getUserInfo(this);
+ }
+ return userInfo;
+ }
+
+ @Override
+ public void refresh() throws OpenshiftException {
+ this.domain = null;
+ this.sshKey = null;
+ getUserInfo();
+ }
+
+ private void update(List<ApplicationInfo> applicationInfos) {
+ for (ApplicationInfo applicationInfo : applicationInfos) {
+ IApplication application = getApplicationByName(applicationInfo.getName(), applications);
+ if (application == null) {
+ applications.add(createApplication(applicationInfo));
+ }
+ }
+ }
+
+ private Application createApplication(ApplicationInfo applicationInfo) {
+ return new Application(applicationInfo.getName()
+ , applicationInfo.getCartridge()
+ , applicationInfo
+ , this, service);
+ }
+
+ protected IOpenshiftService getService() {
+ return service;
+ }
+}
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/InternalUser.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/OpenshiftCoreActivator.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/OpenshiftCoreActivator.java (rev 0)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/OpenshiftCoreActivator.java 2011-10-05 11:00:47 UTC (rev 35354)
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * 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.tools.openshift.express.internal.client;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+public class OpenshiftCoreActivator implements BundleActivator {
+
+ public static final String PLUGIN_ID = "org.jboss.tools.openshift.express.client";
+
+ private static BundleContext context;
+
+ static BundleContext getContext() {
+ return context;
+ }
+
+ public void start(BundleContext bundleContext) throws Exception {
+ OpenshiftCoreActivator.context = bundleContext;
+ }
+
+ public void stop(BundleContext bundleContext) throws Exception {
+ OpenshiftCoreActivator.context = null;
+ }
+}
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/OpenshiftCoreActivator.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/UserInfo.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/UserInfo.java (rev 0)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/UserInfo.java 2011-10-05 11:00:47 UTC (rev 35354)
@@ -0,0 +1,74 @@
+/*******************************************************************************
+ * 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.tools.openshift.express.internal.client;
+
+import java.util.List;
+
+import org.jboss.tools.openshift.express.client.SSHPublicKey;
+
+
+/**
+ * @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.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/UserInfo.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/UserInfoAware.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/UserInfoAware.java (rev 0)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/UserInfoAware.java 2011-10-05 11:00:47 UTC (rev 35354)
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.openshift.express.internal.client;
+
+import org.jboss.tools.openshift.express.client.OpenshiftException;
+
+public class UserInfoAware {
+
+ private UserInfo userInfo;
+ private InternalUser user;
+
+ protected UserInfoAware(InternalUser user) {
+ this.user = user;
+ }
+
+ protected UserInfo getUserInfo() throws OpenshiftException {
+ if (userInfo == null) {
+ this.userInfo = user.getUserInfo();
+ }
+ return userInfo;
+ }
+
+ protected InternalUser getUser() {
+ return user;
+ }
+
+}
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/UserInfoAware.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/httpclient/BadRequestException.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/httpclient/BadRequestException.java (rev 0)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/httpclient/BadRequestException.java 2011-10-05 11:00:47 UTC (rev 35354)
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.openshift.express.internal.client.httpclient;
+
+/**
+ * @author André Dietisheim
+ */
+public class BadRequestException extends HttpClientException {
+
+ private static final long serialVersionUID = 1L;
+
+ public BadRequestException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public BadRequestException(Throwable cause) {
+ super(cause);
+ }
+}
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/httpclient/BadRequestException.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/httpclient/HttpClientException.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/httpclient/HttpClientException.java (rev 0)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/httpclient/HttpClientException.java 2011-10-05 11:00:47 UTC (rev 35354)
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * 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.tools.openshift.express.internal.client.httpclient;
+
+/**
+ * @author André Dietisheim
+ */
+public class HttpClientException extends Exception {
+
+ private static final long serialVersionUID = 1L;
+
+ public HttpClientException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public HttpClientException(String message) {
+ super(message);
+ }
+
+ public HttpClientException(Throwable cause) {
+ super(cause);
+ }
+
+}
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/httpclient/HttpClientException.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/httpclient/InternalServerErrorException.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/httpclient/InternalServerErrorException.java (rev 0)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/httpclient/InternalServerErrorException.java 2011-10-05 11:00:47 UTC (rev 35354)
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * 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.tools.openshift.express.internal.client.httpclient;
+
+/**
+ * @author André Dietisheim
+ */
+public class InternalServerErrorException extends HttpClientException {
+
+ private static final long serialVersionUID = 1L;
+
+ public InternalServerErrorException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public InternalServerErrorException(String message) {
+ super(message);
+ }
+
+ public InternalServerErrorException(Throwable cause) {
+ super(cause);
+ }
+
+}
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/httpclient/InternalServerErrorException.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/httpclient/NotFoundException.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/httpclient/NotFoundException.java (rev 0)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/httpclient/NotFoundException.java 2011-10-05 11:00:47 UTC (rev 35354)
@@ -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.tools.openshift.express.internal.client.httpclient;
+
+/**
+ * @author André Dietisheim
+ */
+public class NotFoundException extends HttpClientException {
+
+ private static final long serialVersionUID = 1L;
+
+ public NotFoundException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ private NotFoundException(Throwable cause) {
+ super(cause);
+ }
+
+}
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/httpclient/NotFoundException.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/httpclient/UnauthorizedException.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/httpclient/UnauthorizedException.java (rev 0)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/httpclient/UnauthorizedException.java 2011-10-05 11:00:47 UTC (rev 35354)
@@ -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.tools.openshift.express.internal.client.httpclient;
+
+/**
+ * @author André Dietisheim
+ */
+public class UnauthorizedException extends HttpClientException {
+
+ private static final long serialVersionUID = 1L;
+
+ public UnauthorizedException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public UnauthorizedException(Throwable cause) {
+ super(cause);
+ }
+
+}
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/httpclient/UnauthorizedException.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/httpclient/UrlConnectionHttpClient.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/httpclient/UrlConnectionHttpClient.java (rev 0)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/httpclient/UrlConnectionHttpClient.java 2011-10-05 11:00:47 UTC (rev 35354)
@@ -0,0 +1,101 @@
+/*******************************************************************************
+ * 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.tools.openshift.express.internal.client.httpclient;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.text.MessageFormat;
+
+import org.jboss.tools.openshift.express.client.IHttpClient;
+import org.jboss.tools.openshift.express.internal.client.utils.StreamUtils;
+
+/**
+ * @author André Dietisheim
+ */
+public class UrlConnectionHttpClient implements IHttpClient {
+
+ private static final String PROPERTY_CONTENT_TYPE = "Content-Type";
+ private static final int TIMEOUT = 10 * 1024;
+
+ private URL url;
+
+ public UrlConnectionHttpClient(URL url) {
+ this.url = url;
+ }
+
+ public String post(String data) throws HttpClientException {
+ HttpURLConnection connection = null;
+ try {
+ connection = createConnection(url);
+ connection.setDoOutput(true);
+ StreamUtils.writeTo(data.getBytes(), connection.getOutputStream());
+ return StreamUtils.readToString(connection.getInputStream());
+ } catch (FileNotFoundException e) {
+ throw new NotFoundException(
+ MessageFormat.format("Could not find resource {0}", url.toString()), e);
+ } catch (IOException e) {
+ throw createException(e, connection);
+ } finally {
+ if (connection != null) {
+ connection.disconnect();
+ }
+ }
+ }
+
+ public String get() throws HttpClientException {
+ HttpURLConnection connection = null;
+ try {
+ connection = createConnection(url);
+ return StreamUtils.readToString(connection.getInputStream());
+ } catch (FileNotFoundException e) {
+ throw new NotFoundException(
+ MessageFormat.format("Could not find resource {0}", url.toString()), e);
+ } catch (IOException e) {
+ throw createException(e, connection);
+ } finally {
+ if (connection != null) {
+ connection.disconnect();
+ }
+ }
+ }
+
+ private HttpClientException createException(IOException ioe, HttpURLConnection connection) {
+ try {
+ int responseCode = connection.getResponseCode();
+ String errorMessage = StreamUtils.readToString(connection.getErrorStream());
+ switch (responseCode) {
+ case 500:
+ return new InternalServerErrorException(errorMessage, ioe);
+ case 400:
+ return new BadRequestException(errorMessage, ioe);
+ case 401:
+ return new UnauthorizedException(errorMessage, ioe);
+ default:
+ return new HttpClientException(errorMessage, ioe);
+ }
+ } catch (IOException e) {
+ return new HttpClientException(e);
+ }
+ }
+
+ private HttpURLConnection createConnection(URL url) throws IOException {
+ HttpURLConnection connection = (HttpURLConnection) url.openConnection();
+ connection.setUseCaches(false);
+ connection.setDoInput(true);
+ connection.setAllowUserInteraction(false);
+ connection.setConnectTimeout(TIMEOUT);
+ connection.setRequestProperty(PROPERTY_CONTENT_TYPE, "application/x-www-form-urlencoded");
+ connection.setInstanceFollowRedirects(true);
+ return connection;
+ }
+}
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/httpclient/UrlConnectionHttpClient.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/request/AbstractDomainRequest.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/request/AbstractDomainRequest.java (rev 0)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/request/AbstractDomainRequest.java 2011-10-05 11:00:47 UTC (rev 35354)
@@ -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.tools.openshift.express.internal.client.request;
+
+import org.jboss.tools.openshift.express.client.ISSHPublicKey;
+
+
+/**
+ * @author André Dietisheim
+ */
+public abstract class AbstractDomainRequest extends AbstractOpenshiftRequest {
+
+ private String name;
+ private ISSHPublicKey sshKey;
+
+ public AbstractDomainRequest(String name, ISSHPublicKey sshKey, String username) {
+ this(name, sshKey, username, false);
+ }
+
+ public AbstractDomainRequest(String name, ISSHPublicKey sshKey, String username, boolean debug) {
+ super(username, debug);
+ this.name = name;
+ this.sshKey = sshKey;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public ISSHPublicKey getSshKey() {
+ return sshKey;
+ }
+
+ @Override
+ public String getResourcePath() {
+ return "domain";
+ }
+
+ public abstract boolean isAlter();
+
+ public abstract String toHumanReadable();
+}
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/request/AbstractDomainRequest.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/request/AbstractOpenshiftRequest.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/request/AbstractOpenshiftRequest.java (rev 0)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/request/AbstractOpenshiftRequest.java 2011-10-05 11:00:47 UTC (rev 35354)
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * 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.tools.openshift.express.internal.client.request;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import org.jboss.tools.openshift.express.internal.client.utils.UrlBuilder;
+
+/**
+ * @author André Dietisheim
+ */
+public abstract class AbstractOpenshiftRequest implements IOpenshiftRequest {
+
+ private String rhlogin;
+ private boolean debug;
+
+ public AbstractOpenshiftRequest(String username) {
+ this(username, false);
+ }
+
+ public AbstractOpenshiftRequest(String username, boolean debug) {
+ this.rhlogin = username;
+ this.debug = debug;
+ }
+
+ public String getRhLogin() {
+ return rhlogin;
+ }
+
+ public boolean isDebug() {
+ return debug;
+ }
+
+ public URL getUrl(String baseUrl) throws MalformedURLException {
+ return new UrlBuilder(baseUrl).path(getResourcePath()).toUrl();
+ }
+
+ public String getUrlString(String baseUrl) {
+ return new UrlBuilder(baseUrl).path(getResourcePath()).toString();
+ }
+
+ protected abstract String getResourcePath();
+
+}
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/request/AbstractOpenshiftRequest.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/request/ApplicationAction.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/request/ApplicationAction.java (rev 0)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/request/ApplicationAction.java 2011-10-05 11:00:47 UTC (rev 35354)
@@ -0,0 +1,19 @@
+/*******************************************************************************
+ * 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.tools.openshift.express.internal.client.request;
+
+public enum ApplicationAction {
+ CONFIGURE, DECONFIGURE, START, STOP, RESTART, STATUS;
+
+ public String toHumanReadable() {
+ return name().toLowerCase();
+ }
+}
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/request/ApplicationAction.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/request/ApplicationRequest.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/request/ApplicationRequest.java (rev 0)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/request/ApplicationRequest.java 2011-10-05 11:00:47 UTC (rev 35354)
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * 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.tools.openshift.express.internal.client.request;
+
+import org.jboss.tools.openshift.express.client.ICartridge;
+
+/**
+ * @author André Dietisheim
+ */
+public class ApplicationRequest extends AbstractOpenshiftRequest {
+
+ private String name;
+ private ICartridge cartridge ;
+ private ApplicationAction action;
+
+ public ApplicationRequest(String name, ICartridge cartridge, ApplicationAction action, String username) {
+ this(name, cartridge, action, username, false);
+ }
+
+ public ApplicationRequest(String name, ICartridge cartridge, ApplicationAction action, String username, boolean debug) {
+ super(username, debug);
+ this.name = name;
+ this.cartridge = cartridge;
+ this.action = action;
+ }
+
+ public ApplicationAction getAction() {
+ return action;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public ICartridge getCartridge() {
+ return cartridge;
+ }
+
+ @Override
+ public String getResourcePath() {
+ return "cartridge";
+ }
+}
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/request/ApplicationRequest.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/request/ChangeDomainRequest.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/request/ChangeDomainRequest.java (rev 0)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/request/ChangeDomainRequest.java 2011-10-05 11:00:47 UTC (rev 35354)
@@ -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.tools.openshift.express.internal.client.request;
+
+import org.jboss.tools.openshift.express.client.ISSHPublicKey;
+
+
+/**
+ * @author André Dietisheim
+ */
+public class ChangeDomainRequest extends AbstractDomainRequest {
+
+ public ChangeDomainRequest(String name, ISSHPublicKey sshKey, String username) {
+ this(name, sshKey, username, false);
+ }
+
+ public ChangeDomainRequest(String name, ISSHPublicKey sshKey, String username, boolean debug) {
+ super(name, sshKey, username, debug);
+ }
+
+ public boolean isAlter() {
+ return true;
+ }
+
+ @Override
+ public String toHumanReadable() {
+ return "change domain to " + getName();
+ }
+}
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/request/ChangeDomainRequest.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/request/CreateDomainRequest.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/request/CreateDomainRequest.java (rev 0)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/request/CreateDomainRequest.java 2011-10-05 11:00:47 UTC (rev 35354)
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * 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.tools.openshift.express.internal.client.request;
+
+import org.jboss.tools.openshift.express.client.ISSHPublicKey;
+
+
+/**
+ * @author André Dietisheim
+ */
+public class CreateDomainRequest extends AbstractDomainRequest {
+
+ public CreateDomainRequest(String name, ISSHPublicKey sshKey, ApplicationAction action, String username) {
+ this(name, sshKey, username, false);
+ }
+
+ public CreateDomainRequest(String name, ISSHPublicKey sshKey, String username, boolean debug) {
+ super(name, sshKey, username, debug);
+ }
+
+ public boolean isAlter() {
+ return false;
+ }
+
+ @Override
+ public String toHumanReadable() {
+ return "create domain " + getName();
+ }
+
+}
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/request/CreateDomainRequest.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/request/IOpenshiftRequest.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/request/IOpenshiftRequest.java (rev 0)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/request/IOpenshiftRequest.java 2011-10-05 11:00:47 UTC (rev 35354)
@@ -0,0 +1,18 @@
+/*******************************************************************************
+ * 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.tools.openshift.express.internal.client.request;
+
+/**
+ * @author André Dietisheim
+ */
+public interface IOpenshiftRequest {
+
+}
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/request/IOpenshiftRequest.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/request/IOpenshiftRequestFactory.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/request/IOpenshiftRequestFactory.java (rev 0)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/request/IOpenshiftRequestFactory.java 2011-10-05 11:00:47 UTC (rev 35354)
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.openshift.express.internal.client.request;
+
+import org.jboss.tools.openshift.express.client.OpenshiftException;
+
+/**
+ * @author André Dietisheim
+ */
+public interface IOpenshiftRequestFactory {
+
+ /**
+ * Creates an request String that may be sent to the openshift server
+ * @return
+ * @throws OpenshiftException
+ */
+ public String createString() throws OpenshiftException;
+
+}
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/request/IOpenshiftRequestFactory.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/request/ListCartridgesRequest.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/request/ListCartridgesRequest.java (rev 0)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/request/ListCartridgesRequest.java 2011-10-05 11:00:47 UTC (rev 35354)
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * 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.tools.openshift.express.internal.client.request;
+
+
+/**
+ * @author André Dietisheim
+ */
+public class ListCartridgesRequest extends AbstractOpenshiftRequest {
+
+ private static final String CART_TYPE_STANDALONE = "standalone";
+
+ public ListCartridgesRequest(String username) {
+ this(username, false);
+ }
+
+ public ListCartridgesRequest(String username, boolean debug) {
+ super(username, debug);
+ }
+
+ public String getCartType() {
+ return CART_TYPE_STANDALONE;
+ }
+
+ @Override
+ protected String getResourcePath() {
+ return "cartlist";
+ }
+
+}
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/request/ListCartridgesRequest.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/request/OpenshiftEnvelopeFactory.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/request/OpenshiftEnvelopeFactory.java (rev 0)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/request/OpenshiftEnvelopeFactory.java 2011-10-05 11:00:47 UTC (rev 35354)
@@ -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.tools.openshift.express.internal.client.request;
+
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
+
+import org.jboss.tools.openshift.express.client.OpenshiftException;
+
+/**
+ * A factory that creates the json string that the openshift rest service
+ * would consume.
+ *
+ * @author André Dietisheim
+ */
+public class OpenshiftEnvelopeFactory implements IOpenshiftRequestFactory {
+
+ private static final char EQ = '=';
+ private static final String PROPERTY_PASSWORD = "password";
+ private static final String PROPERTY_JSON_DATA = "json_data";
+ private static final String DATA_ENCODING = "UTF-8";
+ private static final char AMP = '&';
+
+ private String[] payloads;
+ private String password;
+
+ public OpenshiftEnvelopeFactory(String password, String... payloads) {
+ this.password = password;
+ this.payloads = payloads;
+ }
+
+ public String createString() throws OpenshiftException {
+ try {
+ StringBuilder builder = new StringBuilder();
+ appendPassword(builder);
+ builder.append(AMP);
+ appendPayload(builder);
+ return builder.toString();
+ } catch (UnsupportedEncodingException e) {
+ throw new OpenshiftException(e, "Could not create request");
+ }
+ }
+
+ private void appendPassword(StringBuilder builder) throws UnsupportedEncodingException {
+ builder.append(PROPERTY_PASSWORD)
+ .append(EQ)
+ .append(URLEncoder.encode(password, DATA_ENCODING));
+ }
+
+ private void appendPayload(StringBuilder builder) throws UnsupportedEncodingException {
+ StringBuilder payloadBuilder = new StringBuilder();
+ for (int i = 0; i < payloads.length; i++) {
+ if (i > 0
+ && i < payloads.length + 1) {
+ payloadBuilder.append(AMP);
+ }
+ payloadBuilder.append(payloads[i]);
+ }
+
+ if (builder.length() > 0) {
+ builder
+ .append(PROPERTY_JSON_DATA)
+ .append(EQ)
+ .append(URLEncoder.encode(payloadBuilder.toString(), DATA_ENCODING));
+ }
+
+ }
+}
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/request/OpenshiftEnvelopeFactory.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/request/UserInfoRequest.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/request/UserInfoRequest.java (rev 0)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/request/UserInfoRequest.java 2011-10-05 11:00:47 UTC (rev 35354)
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.openshift.express.internal.client.request;
+
+/**
+ * @author André Dietisheim
+ */
+public class UserInfoRequest extends AbstractOpenshiftRequest {
+
+ public UserInfoRequest(String username) {
+ this(username, false);
+ }
+
+ public UserInfoRequest(String username, boolean debug) {
+ super(username, debug);
+ }
+
+ @Override
+ protected String getResourcePath() {
+ return "userinfo";
+ }
+}
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/request/UserInfoRequest.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/request/marshalling/AbstractJsonMarshaller.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/request/marshalling/AbstractJsonMarshaller.java (rev 0)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/request/marshalling/AbstractJsonMarshaller.java 2011-10-05 11:00:47 UTC (rev 35354)
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * 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.tools.openshift.express.internal.client.request.marshalling;
+
+import org.jboss.dmr.ModelNode;
+import org.jboss.tools.openshift.express.client.OpenshiftException;
+import org.jboss.tools.openshift.express.internal.client.IOpenshiftJsonConstants;
+import org.jboss.tools.openshift.express.internal.client.request.AbstractOpenshiftRequest;
+
+/**
+ * @author André Dietisheim
+ */
+public abstract class AbstractJsonMarshaller<REQUEST extends AbstractOpenshiftRequest> implements
+ IOpenshiftMarshaller<REQUEST> {
+
+ public String marshall(REQUEST request) throws OpenshiftException {
+ ModelNode node = new ModelNode();
+ setStringProperty(IOpenshiftJsonConstants.PROPERTY_RHLOGIN, request.getRhLogin(), node);
+ setStringProperty(IOpenshiftJsonConstants.PROPERTY_DEBUG, String.valueOf(request.isDebug()), node);
+ setJsonDataProperties(node, request);
+ return node.toJSONString(true);
+ }
+
+ protected void setJsonDataProperties(ModelNode node, REQUEST request) throws OpenshiftException {
+ // empty default implementation
+ }
+
+ protected void setStringProperty(String propertyName, Object value, ModelNode node) {
+ if (!(value instanceof String)
+ && !isSet((String) value)) {
+ return;
+ }
+
+ setStringProperty((String) value, propertyName, node);
+ }
+
+ protected void setStringProperty(String propertyName, String value, ModelNode node) {
+ if (!isSet(value)) {
+ return;
+ }
+
+ node.get(propertyName).set(value);
+ }
+
+ protected boolean isSet(String value) {
+ return value != null
+ && value.length() > 0;
+ }
+
+ protected boolean isSet(Object value) {
+ return value != null;
+ }
+
+}
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/request/marshalling/AbstractJsonMarshaller.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/request/marshalling/AbstractOpenshiftMarshaller.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/request/marshalling/AbstractOpenshiftMarshaller.java (rev 0)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/request/marshalling/AbstractOpenshiftMarshaller.java 2011-10-05 11:00:47 UTC (rev 35354)
@@ -0,0 +1,17 @@
+package org.jboss.tools.openshift.express.internal.client.request.marshalling;
+
+import org.jboss.tools.openshift.express.internal.client.request.IOpenshiftRequest;
+
+
+public abstract class AbstractOpenshiftMarshaller<REQUEST extends IOpenshiftRequest> implements IOpenshiftMarshaller<REQUEST> {
+
+ @Override
+ public String marshall(REQUEST object) {
+ StringBuilder builder = new StringBuilder();
+ append(builder);
+ return builder.toString();
+ }
+
+ protected abstract void append(StringBuilder builder);
+
+}
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/request/marshalling/AbstractOpenshiftMarshaller.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/request/marshalling/ApplicationRequestJsonMarshaller.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/request/marshalling/ApplicationRequestJsonMarshaller.java (rev 0)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/request/marshalling/ApplicationRequestJsonMarshaller.java 2011-10-05 11:00:47 UTC (rev 35354)
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * 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.tools.openshift.express.internal.client.request.marshalling;
+
+import org.jboss.dmr.ModelNode;
+import org.jboss.tools.openshift.express.client.ICartridge;
+import org.jboss.tools.openshift.express.internal.client.IOpenshiftJsonConstants;
+import org.jboss.tools.openshift.express.internal.client.request.ApplicationAction;
+import org.jboss.tools.openshift.express.internal.client.request.ApplicationRequest;
+
+/**
+ * @author André Dietisheim
+ */
+public class ApplicationRequestJsonMarshaller extends AbstractJsonMarshaller<ApplicationRequest> {
+
+ @Override
+ protected void setJsonDataProperties(ModelNode node, ApplicationRequest request) {
+ setStringProperty(IOpenshiftJsonConstants.PROPERTY_CARTRIDGE, getCartridgeName(request.getCartridge()), node);
+ setStringProperty(IOpenshiftJsonConstants.PROPERTY_ACTION, getActionName(request.getAction()), node);
+ setStringProperty(IOpenshiftJsonConstants.PROPERTY_APP_NAME, request.getName(), node);
+ }
+
+ private String getCartridgeName(ICartridge cartridge) {
+ if (cartridge == null) {
+ return null;
+ }
+ return cartridge.getName();
+ }
+
+ private String getActionName(ApplicationAction action) {
+ if (action == null) {
+ return null;
+ }
+ return action.name().toLowerCase();
+ }
+}
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/request/marshalling/ApplicationRequestJsonMarshaller.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/request/marshalling/DomainRequestJsonMarshaller.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/request/marshalling/DomainRequestJsonMarshaller.java (rev 0)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/request/marshalling/DomainRequestJsonMarshaller.java 2011-10-05 11:00:47 UTC (rev 35354)
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * 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.tools.openshift.express.internal.client.request.marshalling;
+
+import org.jboss.dmr.ModelNode;
+import org.jboss.tools.openshift.express.client.OpenshiftException;
+import org.jboss.tools.openshift.express.internal.client.IOpenshiftJsonConstants;
+import org.jboss.tools.openshift.express.internal.client.request.AbstractDomainRequest;
+
+/**
+ * @author André Dietisheim
+ */
+public class DomainRequestJsonMarshaller extends AbstractJsonMarshaller<AbstractDomainRequest> {
+
+ @Override
+ protected void setJsonDataProperties(ModelNode node, AbstractDomainRequest request) throws OpenshiftException {
+ node.get(IOpenshiftJsonConstants.PROPERTY_NAMESPACE).set(request.getName());
+ node.get(IOpenshiftJsonConstants.PROPERTY_ALTER).set(String.valueOf(request.isAlter()));
+ node.get(IOpenshiftJsonConstants.PROPERTY_SSH).set(request.getSshKey().getPublicKey());
+ }
+}
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/request/marshalling/DomainRequestJsonMarshaller.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/request/marshalling/IOpenshiftMarshaller.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/request/marshalling/IOpenshiftMarshaller.java (rev 0)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/request/marshalling/IOpenshiftMarshaller.java 2011-10-05 11:00:47 UTC (rev 35354)
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * 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.tools.openshift.express.internal.client.request.marshalling;
+
+import org.jboss.tools.openshift.express.client.OpenshiftException;
+import org.jboss.tools.openshift.express.internal.client.request.IOpenshiftRequest;
+
+/**
+ * @author André Dietisheim
+ */
+public interface IOpenshiftMarshaller<REQUEST extends IOpenshiftRequest> {
+
+ public String marshall(REQUEST object) throws OpenshiftException;
+
+}
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/request/marshalling/IOpenshiftMarshaller.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/request/marshalling/ListCartridgesRequestJsonMarshaller.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/request/marshalling/ListCartridgesRequestJsonMarshaller.java (rev 0)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/request/marshalling/ListCartridgesRequestJsonMarshaller.java 2011-10-05 11:00:47 UTC (rev 35354)
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * 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.tools.openshift.express.internal.client.request.marshalling;
+
+import org.jboss.dmr.ModelNode;
+import org.jboss.tools.openshift.express.internal.client.IOpenshiftJsonConstants;
+import org.jboss.tools.openshift.express.internal.client.request.ListCartridgesRequest;
+
+/**
+ * @author André Dietisheim
+ */
+public class ListCartridgesRequestJsonMarshaller extends AbstractJsonMarshaller<ListCartridgesRequest> {
+
+ @Override
+ protected void setJsonDataProperties(ModelNode node, ListCartridgesRequest request) {
+ setStringProperty(IOpenshiftJsonConstants.PROPERTY_CART_TYPE, request.getCartType(), node);
+ }
+}
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/request/marshalling/ListCartridgesRequestJsonMarshaller.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/request/marshalling/UserInfoRequestJsonMarshaller.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/request/marshalling/UserInfoRequestJsonMarshaller.java (rev 0)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/request/marshalling/UserInfoRequestJsonMarshaller.java 2011-10-05 11:00:47 UTC (rev 35354)
@@ -0,0 +1,19 @@
+/*******************************************************************************
+ * 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.tools.openshift.express.internal.client.request.marshalling;
+
+import org.jboss.tools.openshift.express.internal.client.request.UserInfoRequest;
+
+/**
+ * @author André Dietisheim
+ */
+public class UserInfoRequestJsonMarshaller extends AbstractJsonMarshaller<UserInfoRequest> {
+}
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/request/marshalling/UserInfoRequestJsonMarshaller.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/response/OpenshiftResponse.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/response/OpenshiftResponse.java (rev 0)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/response/OpenshiftResponse.java 2011-10-05 11:00:47 UTC (rev 35354)
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * 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.tools.openshift.express.internal.client.response;
+
+
+/**
+ * @author André Dietisheim
+ */
+public class OpenshiftResponse<OPENSHIFTOBJECT> {
+
+ private boolean debug;
+ private String messages;
+ private String result;
+ private OPENSHIFTOBJECT openshiftObject;
+ private int exitCode;
+
+ public OpenshiftResponse(boolean debug, String messages, String result, OPENSHIFTOBJECT openshiftObject, int exitCode) {
+ this.debug = debug;
+ this.messages = messages;
+ this.result = result;
+ this.openshiftObject = openshiftObject;
+ this.exitCode = exitCode;
+ }
+
+ public boolean isDebug() {
+ return debug;
+ }
+
+ public String getMessages() {
+ return messages;
+ }
+
+ public String getResult() {
+ return result;
+ }
+
+ public OPENSHIFTOBJECT getOpenshiftObject() {
+ return openshiftObject;
+ }
+
+ public int getExitCode() {
+ return exitCode;
+ }
+}
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/response/OpenshiftResponse.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/response/unmarshalling/AbstractOpenshiftJsonResponseUnmarshaller.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/response/unmarshalling/AbstractOpenshiftJsonResponseUnmarshaller.java (rev 0)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/response/unmarshalling/AbstractOpenshiftJsonResponseUnmarshaller.java 2011-10-05 11:00:47 UTC (rev 35354)
@@ -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.tools.openshift.express.internal.client.response.unmarshalling;
+
+import java.util.Date;
+
+import javax.xml.datatype.DatatypeConfigurationException;
+
+import org.jboss.dmr.ModelNode;
+import org.jboss.dmr.ModelType;
+import org.jboss.tools.openshift.express.client.OpenshiftException;
+import org.jboss.tools.openshift.express.internal.client.IOpenshiftJsonConstants;
+import org.jboss.tools.openshift.express.internal.client.response.OpenshiftResponse;
+import org.jboss.tools.openshift.express.internal.client.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.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/response/unmarshalling/AbstractOpenshiftJsonResponseUnmarshaller.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/response/unmarshalling/ApplicationResponseUnmarshaller.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/response/unmarshalling/ApplicationResponseUnmarshaller.java (rev 0)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/response/unmarshalling/ApplicationResponseUnmarshaller.java 2011-10-05 11:00:47 UTC (rev 35354)
@@ -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.tools.openshift.express.internal.client.response.unmarshalling;
+
+import org.jboss.dmr.ModelNode;
+import org.jboss.tools.openshift.express.client.ICartridge;
+import org.jboss.tools.openshift.express.client.OpenshiftService;
+import org.jboss.tools.openshift.express.internal.client.Application;
+import org.jboss.tools.openshift.express.internal.client.InternalUser;
+
+/**
+ * @author André Dietisheim
+ */
+public class ApplicationResponseUnmarshaller extends AbstractOpenshiftJsonResponseUnmarshaller<Application> {
+
+ private InternalUser user;
+ private String applicationName;
+ private ICartridge cartridge;
+ private OpenshiftService service;
+
+ public ApplicationResponseUnmarshaller(String applicationName, ICartridge cartridge, InternalUser 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.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/response/unmarshalling/ApplicationResponseUnmarshaller.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/response/unmarshalling/ApplicationStatusResponseUnmarshaller.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/response/unmarshalling/ApplicationStatusResponseUnmarshaller.java (rev 0)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/response/unmarshalling/ApplicationStatusResponseUnmarshaller.java 2011-10-05 11:00:47 UTC (rev 35354)
@@ -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.tools.openshift.express.internal.client.response.unmarshalling;
+
+import org.jboss.dmr.ModelNode;
+import org.jboss.tools.openshift.express.internal.client.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.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/response/unmarshalling/ApplicationStatusResponseUnmarshaller.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/response/unmarshalling/DomainResponseUnmarshaller.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/response/unmarshalling/DomainResponseUnmarshaller.java (rev 0)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/response/unmarshalling/DomainResponseUnmarshaller.java 2011-10-05 11:00:47 UTC (rev 35354)
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * 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.tools.openshift.express.internal.client.response.unmarshalling;
+
+import org.jboss.dmr.ModelNode;
+import org.jboss.tools.openshift.express.client.IDomain;
+import org.jboss.tools.openshift.express.client.IOpenshiftService;
+import org.jboss.tools.openshift.express.internal.client.Domain;
+import org.jboss.tools.openshift.express.internal.client.InternalUser;
+
+/**
+ * @author André Dietisheim
+ */
+public class DomainResponseUnmarshaller extends AbstractOpenshiftJsonResponseUnmarshaller<IDomain> {
+
+ private String domainName;
+ private InternalUser user;
+ private IOpenshiftService service;
+
+ public DomainResponseUnmarshaller(String domainName, InternalUser user, IOpenshiftService service) {
+ this.domainName = domainName;
+ this.user = user;
+ this.service = service;
+ }
+
+ @Override
+ protected IDomain createOpenshiftObject(ModelNode node) {
+ return new Domain(domainName, user, service);
+ }
+}
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/response/unmarshalling/DomainResponseUnmarshaller.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/response/unmarshalling/JsonSanitizer.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/response/unmarshalling/JsonSanitizer.java (rev 0)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/response/unmarshalling/JsonSanitizer.java 2011-10-05 11:00:47 UTC (rev 35354)
@@ -0,0 +1,51 @@
+package org.jboss.tools.openshift.express.internal.client.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.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/response/unmarshalling/JsonSanitizer.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/response/unmarshalling/ListCartridgesResponseUnmarshaller.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/response/unmarshalling/ListCartridgesResponseUnmarshaller.java (rev 0)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/response/unmarshalling/ListCartridgesResponseUnmarshaller.java 2011-10-05 11:00:47 UTC (rev 35354)
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * 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.tools.openshift.express.internal.client.response.unmarshalling;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.dmr.ModelNode;
+import org.jboss.tools.openshift.express.client.Cartridge;
+import org.jboss.tools.openshift.express.client.ICartridge;
+import org.jboss.tools.openshift.express.internal.client.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<ICartridge>> {
+
+ @Override
+ protected List<ICartridge> createOpenshiftObject(ModelNode responseNode) {
+ List<ICartridge> cartridges = new ArrayList<ICartridge>();
+ 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.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/response/unmarshalling/ListCartridgesResponseUnmarshaller.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/response/unmarshalling/UserInfoResponseUnmarshaller.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/response/unmarshalling/UserInfoResponseUnmarshaller.java (rev 0)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/response/unmarshalling/UserInfoResponseUnmarshaller.java 2011-10-05 11:00:47 UTC (rev 35354)
@@ -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.tools.openshift.express.internal.client.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.tools.openshift.express.client.Cartridge;
+import org.jboss.tools.openshift.express.client.ICartridge;
+import org.jboss.tools.openshift.express.internal.client.ApplicationInfo;
+import org.jboss.tools.openshift.express.internal.client.IOpenshiftJsonConstants;
+import org.jboss.tools.openshift.express.internal.client.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.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/response/unmarshalling/UserInfoResponseUnmarshaller.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/utils/Assert.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/utils/Assert.java (rev 0)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/utils/Assert.java 2011-10-05 11:00:47 UTC (rev 35354)
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.openshift.express.internal.client.utils;
+
+
+/**
+ * @author André Dietisheim
+ */
+public class Assert {
+
+ public static final class AssertionFailedException extends RuntimeException {
+
+ private static final long serialVersionUID = 1L;
+
+ public AssertionFailedException() {
+ super();
+ }
+
+ }
+
+ public static <V> V assertNotNull(V value) {
+ if (value == null) {
+ throw new AssertionFailedException();
+ }
+ return value;
+ }
+
+}
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/utils/Assert.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/utils/Base64Encoder.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/utils/Base64Encoder.java (rev 0)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/utils/Base64Encoder.java 2011-10-05 11:00:47 UTC (rev 35354)
@@ -0,0 +1,79 @@
+/* -*-mode:java; c-basic-offset:2; indent-tabs-mode:nil -*- */
+/*
+Copyright (c) 2002-2008 ymnk, JCraft,Inc. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the distribution.
+
+ 3. The names of the authors may not be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,
+INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
+OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+package org.jboss.tools.openshift.express.internal.client.utils;
+
+public class Base64Encoder {
+
+ private static final byte[] b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".getBytes();
+
+ public static byte[] encode(byte[] buf) {
+ return encode(buf, 0, buf.length);
+ }
+
+ public static byte[] encode(byte[] buf, int start, int length) {
+ byte[] tmp = new byte[length * 2];
+ int i, j, k;
+
+ int foo = (length / 3) * 3 + start;
+ i = 0;
+ for (j = start; j < foo; j += 3) {
+ k = (buf[j] >>> 2) & 0x3f;
+ tmp[i++] = b64[k];
+ k = (buf[j] & 0x03) << 4 | (buf[j + 1] >>> 4) & 0x0f;
+ tmp[i++] = b64[k];
+ k = (buf[j + 1] & 0x0f) << 2 | (buf[j + 2] >>> 6) & 0x03;
+ tmp[i++] = b64[k];
+ k = buf[j + 2] & 0x3f;
+ tmp[i++] = b64[k];
+ }
+
+ foo = (start + length) - foo;
+ if (foo == 1) {
+ k = (buf[j] >>> 2) & 0x3f;
+ tmp[i++] = b64[k];
+ k = ((buf[j] & 0x03) << 4) & 0x3f;
+ tmp[i++] = b64[k];
+ tmp[i++] = (byte) '=';
+ tmp[i++] = (byte) '=';
+ }
+ else if (foo == 2) {
+ k = (buf[j] >>> 2) & 0x3f;
+ tmp[i++] = b64[k];
+ k = (buf[j] & 0x03) << 4 | (buf[j + 1] >>> 4) & 0x0f;
+ tmp[i++] = b64[k];
+ k = ((buf[j + 1] & 0x0f) << 2) & 0x3f;
+ tmp[i++] = b64[k];
+ tmp[i++] = (byte) '=';
+ }
+ byte[] bar = new byte[i];
+ System.arraycopy(tmp, 0, bar, 0, i);
+ return bar;
+ }
+
+}
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/utils/Base64Encoder.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/utils/RFC822DateUtils.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/utils/RFC822DateUtils.java (rev 0)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/utils/RFC822DateUtils.java 2011-10-05 11:00:47 UTC (rev 35354)
@@ -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.tools.openshift.express.internal.client.utils;
+
+import java.util.Date;
+import java.util.GregorianCalendar;
+
+import javax.xml.datatype.DatatypeConfigurationException;
+import javax.xml.datatype.DatatypeFactory;
+
+/**
+ * @author André Dietisheim
+ */
+public class RFC822DateUtils {
+
+ public static Date getDate(String rfc822DateString) throws DatatypeConfigurationException {
+ // SimpleDateFormat can't handle RFC822 (-04:00 instead of GMT-04:00)
+ // date formats
+ //
+ // SimpleDateFormat dateFormat = new
+ // SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ");
+ // return dateFormat.parse(propertyNode.asString());
+ GregorianCalendar calendar =
+ DatatypeFactory.newInstance().newXMLGregorianCalendar(rfc822DateString).toGregorianCalendar();
+ return calendar.getTime();
+ }
+
+ public static String getString(Date date) throws DatatypeConfigurationException {
+ GregorianCalendar calendar = (GregorianCalendar) GregorianCalendar.getInstance();
+ return DatatypeFactory.newInstance().newXMLGregorianCalendar(calendar).toXMLFormat();
+ }
+}
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/utils/RFC822DateUtils.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/utils/StreamUtils.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/utils/StreamUtils.java (rev 0)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/utils/StreamUtils.java 2011-10-05 11:00:47 UTC (rev 35354)
@@ -0,0 +1,96 @@
+package org.jboss.tools.openshift.express.internal.client.utils;
+
+import java.io.BufferedReader;
+import java.io.ByteArrayInputStream;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.io.Reader;
+import java.io.StringWriter;
+import java.io.Writer;
+import java.util.ArrayList;
+import java.util.List;
+
+public class StreamUtils {
+
+ /**
+ * Writes the content of the given input stream to the given output stream
+ * and returns and input stream that may still be used to read from.
+ *
+ * @param outputStream
+ * the output stream to write to
+ * @param inputStream
+ * the input stream to read from
+ * @return a new, unread input stream
+ * @throws IOException
+ */
+ public static InputStream writeTo(InputStream inputStream, OutputStream outputStream) throws IOException {
+ List<Byte> data = new ArrayList<Byte>();
+ for (int character = -1; (character = inputStream.read()) != -1;) {
+ data.add((byte) character);
+ outputStream.write(character);
+ }
+ byte[] byteArray = new byte[data.size()];
+ for (int i = byteArray.length - 1; i >= 0; i--) {
+ byteArray[i] = data.get(i);
+ }
+ return new ByteArrayInputStream(byteArray);
+ }
+
+ public static String readToString(InputStream inputStream) throws IOException {
+ return readToString(new InputStreamReader(inputStream));
+ }
+
+ public static String readToString(Reader reader) throws IOException {
+ BufferedReader bufferedReader = new BufferedReader(reader);
+ StringWriter writer = new StringWriter();
+ String line = null;
+ while ((line = bufferedReader.readLine()) != null) {
+ writer.write(line);
+ }
+ return writer.toString();
+ }
+
+ /**
+ * Writes the given string to the given output stream. The stream is closed
+ * after writing all data.
+ *
+ * @param data
+ * the data to write
+ * @param outputStream
+ * the stream to write to
+ * @throws IOException
+ */
+ public static void writeTo(byte[] data, OutputStream outputStream) throws IOException {
+ outputStream.write(data);
+ outputStream.flush();
+ outputStream.close();
+ }
+
+ public static void close(InputStream inputStream) throws IOException {
+ if (inputStream != null) {
+ inputStream.close();
+ }
+ }
+
+ public static void close(OutputStream outputStream) throws IOException {
+ if (outputStream != null) {
+ outputStream.close();
+ }
+ }
+
+ public static void close(Reader reader) throws IOException {
+ if (reader != null) {
+ reader.close();
+ }
+ }
+
+ public static void close(Writer writer) throws IOException {
+ if (writer != null) {
+ writer.close();
+ }
+ }
+
+}
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/utils/StreamUtils.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/utils/StringUtils.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/utils/StringUtils.java (rev 0)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/utils/StringUtils.java 2011-10-05 11:00:47 UTC (rev 35354)
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * 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.tools.openshift.express.internal.client.utils;
+
+
+/**
+ * @author André Dietisheim
+ */
+public class StringUtils {
+
+ public static String toLowerCase(String message) {
+ if (message == null) {
+ return null;
+ }
+ return message.toLowerCase();
+ }
+
+ public static String toLowerCase(Enum<?> aEnum) {
+ if (aEnum == null) {
+ return null;
+ }
+ return toLowerCase(aEnum.name());
+ }
+
+}
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/utils/StringUtils.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/utils/UrlBuilder.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/utils/UrlBuilder.java (rev 0)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/utils/UrlBuilder.java 2011-10-05 11:00:47 UTC (rev 35354)
@@ -0,0 +1,133 @@
+package org.jboss.tools.openshift.express.internal.client.utils;
+
+import java.io.UnsupportedEncodingException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLEncoder;
+import java.util.Collection;
+
+/**
+ * A builder for an url. Currently no state checking is done, the InternalUser is
+ * responsible to build something that makes sense.
+ *
+ * @author André Dietisheim
+ */
+public class UrlBuilder {
+ private static final String URL_ENCODING = "UTF-8";
+ private static final String HOST_PROTOCOL_DELIMITER = ":";
+ private static final String HTTP_PROTOCOL_PREFIX = "http://";
+ private static final char PARAMETER_URL_DELIMITER = '?';
+ private static final char PARAMETER_DELIMITER = '&';
+ private static final char PARAMETER_NAME_VALUE_DELIMITER = '=';
+ private static final char PATH_SEPARATOR = '/';
+
+ private StringBuilder urlStringBuilder = new StringBuilder();
+
+ private boolean parametersAdded = false;
+
+ public UrlBuilder() {
+ }
+
+ public UrlBuilder(String baseUrl) {
+ urlStringBuilder.append(baseUrl);
+ }
+
+ public UrlBuilder(URL baseUrl) {
+ urlStringBuilder.append(baseUrl.toString());
+ }
+
+ /**
+ * adds a host to .
+ *
+ * @param host
+ * the host
+ *
+ * @return the url builder
+ */
+ public UrlBuilder host(String host) {
+ urlStringBuilder.append(HTTP_PROTOCOL_PREFIX);
+ urlStringBuilder.append(host);
+ return this;
+ }
+
+ /**
+ * Adds a port.
+ *
+ * @param port
+ * the port
+ *
+ * @return the url builder
+ */
+ public UrlBuilder port(String port) {
+ urlStringBuilder.append(HOST_PROTOCOL_DELIMITER);
+ urlStringBuilder.append(port);
+ return this;
+ }
+
+ /**
+ * adds a path to the url.
+ *
+ * @param path
+ * the path
+ *
+ * @return the url builder
+ */
+ public UrlBuilder path(String path) {
+ urlStringBuilder.append(PATH_SEPARATOR);
+ urlStringBuilder.append(path);
+ return this;
+ }
+
+ public UrlBuilder path(Collection<String> paths) {
+ for (String path : paths) {
+ path(path);
+ }
+ return this;
+ }
+
+ public UrlBuilder parameter(String name, String value) {
+ if (value != null) {
+ appendParameterDelimiter();
+ urlStringBuilder.append(name).append(PARAMETER_NAME_VALUE_DELIMITER).append(urlEncode(value));
+ }
+ return this;
+ }
+
+ private void appendParameterDelimiter() {
+ if (!parametersAdded) {
+ urlStringBuilder.append(PARAMETER_URL_DELIMITER);
+ parametersAdded = true;
+ } else {
+ urlStringBuilder.append(PARAMETER_DELIMITER);
+ }
+ }
+
+ public UrlBuilder parameters(String... parameters) {
+ for (String parameter : parameters) {
+ parameter(parameter);
+ }
+ return this;
+ }
+
+ public UrlBuilder parameter(String parameter) {
+ appendParameterDelimiter();
+ urlStringBuilder.append(urlEncode(parameter));
+ return this;
+ }
+
+ private String urlEncode(String value) {
+ try {
+ return URLEncoder.encode(value, URL_ENCODING);
+ } catch (UnsupportedEncodingException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public URL toUrl() throws MalformedURLException {
+ return new URL(urlStringBuilder.toString());
+ }
+
+ public String toString() {
+ return urlStringBuilder.toString();
+ }
+}
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/src/org/jboss/tools/openshift/express/internal/client/utils/UrlBuilder.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/MANIFEST.MF
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.client/target/MANIFEST.MF (rev 0)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.client/target/MANIFEST.MF 2011-10-05 11:00:47 UTC (rev 35354)
@@ -0,0 +1,26 @@
+Manifest-Version: 1.0
+Export-Package: org.jboss.dmr;x-friends:="org.jboss.ide.eclipse.as.ope
+ nshift.test",org.jboss.tools.openshift.express.client,org.jboss.tools
+ .openshift.express.internal.client;x-friends:="org.jboss.ide.eclipse.
+ as.openshift.test",org.jboss.tools.openshift.express.internal.client.
+ request;x-friends:="org.jboss.ide.eclipse.as.openshift.test",org.jbos
+ s.tools.openshift.express.internal.client.request.marshalling;x-frien
+ ds:="org.jboss.ide.eclipse.as.openshift.test",org.jboss.tools.openshi
+ ft.express.internal.client.response;x-friends:="org.jboss.ide.eclipse
+ .as.openshift.test",org.jboss.tools.openshift.express.internal.client
+ .response.unmarshalling;x-friends:="org.jboss.ide.eclipse.as.openshif
+ t.test",org.jboss.tools.openshift.express.internal.client.utils;x-fri
+ ends:="org.jboss.ide.eclipse.as.openshift.test"
+Require-Bundle: org.eclipse.core.runtime,com.jcraft.jsch;bundle-versio
+ n="[0.1.41,2.0.0)"
+Bundle-Vendor: JBoss by Red Hat
+Bundle-ActivationPolicy: lazy
+Bundle-ClassPath: jboss-dmr-1.0.0.Final.jar,.
+Bundle-Version: 2.3.0.v20111005-1239-M4
+Bundle-Name: Openshift Core Plugin
+Bundle-Activator: org.jboss.tools.openshift.express.internal.client.Op
+ enshiftCoreActivator
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: org.jboss.tools.openshift.express.client
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/MANIFEST.MF
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/client/ApplicationLogReader.class
===================================================================
(Binary files differ)
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/client/ApplicationLogReader.class
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/client/Cartridge.class
===================================================================
(Binary files differ)
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/client/Cartridge.class
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/client/IApplication.class
===================================================================
(Binary files differ)
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/client/IApplication.class
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/client/ICartridge.class
===================================================================
(Binary files differ)
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/client/ICartridge.class
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/client/IDomain.class
===================================================================
(Binary files differ)
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/client/IDomain.class
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/client/IHttpClient.class
===================================================================
(Binary files differ)
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/client/IHttpClient.class
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/client/IOpenshiftService.class
===================================================================
(Binary files differ)
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/client/IOpenshiftService.class
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/client/ISSHPublicKey.class
===================================================================
(Binary files differ)
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/client/ISSHPublicKey.class
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/client/IUser.class
===================================================================
(Binary files differ)
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/client/IUser.class
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/client/InvalidCredentialsOpenshiftException.class
===================================================================
(Binary files differ)
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/client/InvalidCredentialsOpenshiftException.class
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/client/NotFoundOpenshiftException.class
===================================================================
(Binary files differ)
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/client/NotFoundOpenshiftException.class
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/client/OpenshiftEndpointException.class
===================================================================
(Binary files differ)
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/client/OpenshiftEndpointException.class
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/client/OpenshiftException.class
===================================================================
(Binary files differ)
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/client/OpenshiftException.class
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/client/OpenshiftService.class
===================================================================
(Binary files differ)
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/client/OpenshiftService.class
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/client/SSHKeyPair.class
===================================================================
(Binary files differ)
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/client/SSHKeyPair.class
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/client/SSHPublicKey.class
===================================================================
(Binary files differ)
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/client/SSHPublicKey.class
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/client/User.class
===================================================================
(Binary files differ)
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/client/User.class
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/client/UserConfiguration.class
===================================================================
(Binary files differ)
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/client/UserConfiguration.class
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/Application.class
===================================================================
(Binary files differ)
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/Application.class
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/ApplicationInfo.class
===================================================================
(Binary files differ)
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/ApplicationInfo.class
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/Domain.class
===================================================================
(Binary files differ)
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/Domain.class
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/IOpenshiftJsonConstants.class
===================================================================
(Binary files differ)
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/IOpenshiftJsonConstants.class
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/InternalUser.class
===================================================================
(Binary files differ)
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/InternalUser.class
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/OpenshiftCoreActivator.class
===================================================================
(Binary files differ)
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/OpenshiftCoreActivator.class
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/UserInfo.class
===================================================================
(Binary files differ)
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/UserInfo.class
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/UserInfoAware.class
===================================================================
(Binary files differ)
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/UserInfoAware.class
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/httpclient/BadRequestException.class
===================================================================
(Binary files differ)
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/httpclient/BadRequestException.class
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/httpclient/HttpClientException.class
===================================================================
(Binary files differ)
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/httpclient/HttpClientException.class
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/httpclient/InternalServerErrorException.class
===================================================================
(Binary files differ)
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/httpclient/InternalServerErrorException.class
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/httpclient/NotFoundException.class
===================================================================
(Binary files differ)
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/httpclient/NotFoundException.class
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/httpclient/UnauthorizedException.class
===================================================================
(Binary files differ)
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/httpclient/UnauthorizedException.class
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/httpclient/UrlConnectionHttpClient.class
===================================================================
(Binary files differ)
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/httpclient/UrlConnectionHttpClient.class
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/request/AbstractDomainRequest.class
===================================================================
(Binary files differ)
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/request/AbstractDomainRequest.class
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/request/AbstractOpenshiftRequest.class
===================================================================
(Binary files differ)
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/request/AbstractOpenshiftRequest.class
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/request/ApplicationAction.class
===================================================================
(Binary files differ)
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/request/ApplicationAction.class
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/request/ApplicationRequest.class
===================================================================
(Binary files differ)
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/request/ApplicationRequest.class
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/request/ChangeDomainRequest.class
===================================================================
(Binary files differ)
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/request/ChangeDomainRequest.class
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/request/CreateDomainRequest.class
===================================================================
(Binary files differ)
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/request/CreateDomainRequest.class
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/request/IOpenshiftRequest.class
===================================================================
(Binary files differ)
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/request/IOpenshiftRequest.class
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/request/IOpenshiftRequestFactory.class
===================================================================
(Binary files differ)
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/request/IOpenshiftRequestFactory.class
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/request/ListCartridgesRequest.class
===================================================================
(Binary files differ)
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/request/ListCartridgesRequest.class
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/request/OpenshiftEnvelopeFactory.class
===================================================================
(Binary files differ)
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/request/OpenshiftEnvelopeFactory.class
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/request/UserInfoRequest.class
===================================================================
(Binary files differ)
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/request/UserInfoRequest.class
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/request/marshalling/AbstractJsonMarshaller.class
===================================================================
(Binary files differ)
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/request/marshalling/AbstractJsonMarshaller.class
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/request/marshalling/AbstractOpenshiftMarshaller.class
===================================================================
(Binary files differ)
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/request/marshalling/AbstractOpenshiftMarshaller.class
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/request/marshalling/ApplicationRequestJsonMarshaller.class
===================================================================
(Binary files differ)
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/request/marshalling/ApplicationRequestJsonMarshaller.class
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/request/marshalling/DomainRequestJsonMarshaller.class
===================================================================
(Binary files differ)
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/request/marshalling/DomainRequestJsonMarshaller.class
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/request/marshalling/IOpenshiftMarshaller.class
===================================================================
(Binary files differ)
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/request/marshalling/IOpenshiftMarshaller.class
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/request/marshalling/ListCartridgesRequestJsonMarshaller.class
===================================================================
(Binary files differ)
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/request/marshalling/ListCartridgesRequestJsonMarshaller.class
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/request/marshalling/UserInfoRequestJsonMarshaller.class
===================================================================
(Binary files differ)
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/request/marshalling/UserInfoRequestJsonMarshaller.class
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/response/OpenshiftResponse.class
===================================================================
(Binary files differ)
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/response/OpenshiftResponse.class
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/response/unmarshalling/AbstractOpenshiftJsonResponseUnmarshaller.class
===================================================================
(Binary files differ)
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/response/unmarshalling/AbstractOpenshiftJsonResponseUnmarshaller.class
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/response/unmarshalling/ApplicationResponseUnmarshaller.class
===================================================================
(Binary files differ)
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/response/unmarshalling/ApplicationResponseUnmarshaller.class
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/response/unmarshalling/ApplicationStatusResponseUnmarshaller.class
===================================================================
(Binary files differ)
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/response/unmarshalling/ApplicationStatusResponseUnmarshaller.class
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/response/unmarshalling/DomainResponseUnmarshaller.class
===================================================================
(Binary files differ)
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/response/unmarshalling/DomainResponseUnmarshaller.class
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/response/unmarshalling/JsonSanitizer.class
===================================================================
(Binary files differ)
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/response/unmarshalling/JsonSanitizer.class
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/response/unmarshalling/ListCartridgesResponseUnmarshaller.class
===================================================================
(Binary files differ)
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/response/unmarshalling/ListCartridgesResponseUnmarshaller.class
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/response/unmarshalling/UserInfoResponseUnmarshaller.class
===================================================================
(Binary files differ)
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/response/unmarshalling/UserInfoResponseUnmarshaller.class
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/utils/Assert$AssertionFailedException.class
===================================================================
(Binary files differ)
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/utils/Assert$AssertionFailedException.class
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/utils/Assert.class
===================================================================
(Binary files differ)
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/utils/Assert.class
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/utils/Base64Encoder.class
===================================================================
(Binary files differ)
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/utils/Base64Encoder.class
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/utils/RFC822DateUtils.class
===================================================================
(Binary files differ)
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/utils/RFC822DateUtils.class
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/utils/StreamUtils.class
===================================================================
(Binary files differ)
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/utils/StreamUtils.class
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/utils/StringUtils.class
===================================================================
(Binary files differ)
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/utils/StringUtils.class
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/utils/UrlBuilder.class
===================================================================
(Binary files differ)
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/classes/org/jboss/tools/openshift/express/internal/client/utils/UrlBuilder.class
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/local-artifacts.properties
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.client/target/local-artifacts.properties (rev 0)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.client/target/local-artifacts.properties 2011-10-05 11:00:47 UTC (rev 35354)
@@ -0,0 +1,5 @@
+#Wed Oct 05 12:39:13 CEST 2011
+artifact.attached.p2metadata=/home/adietish/jboss-workspaces/jboss-tools/jbosstools-src/as/plugins/org.jboss.tools.openshift.express.client/target/p2content.xml
+artifact.main=/home/adietish/jboss-workspaces/jboss-tools/jbosstools-src/as/plugins/org.jboss.tools.openshift.express.client/target/org.jboss.tools.openshift.express.client-2.3.0-SNAPSHOT.jar
+artifact.attached.sources=/home/adietish/jboss-workspaces/jboss-tools/jbosstools-src/as/plugins/org.jboss.tools.openshift.express.client/target/org.jboss.tools.openshift.express.client-2.3.0-SNAPSHOT-sources.jar
+artifact.attached.p2artifacts=/home/adietish/jboss-workspaces/jboss-tools/jbosstools-src/as/plugins/org.jboss.tools.openshift.express.client/target/p2artifacts.xml
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/local-artifacts.properties
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/maven-archiver/pom.properties
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.client/target/maven-archiver/pom.properties (rev 0)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.client/target/maven-archiver/pom.properties 2011-10-05 11:00:47 UTC (rev 35354)
@@ -0,0 +1,5 @@
+#Generated by Maven
+#Wed Oct 05 12:39:13 CEST 2011
+version=2.3.0-SNAPSHOT
+groupId=org.jboss.tools.as.plugins
+artifactId=org.jboss.tools.openshift.express.client
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/maven-archiver/pom.properties
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/org.jboss.tools.openshift.express.client-2.3.0-SNAPSHOT-sources.jar
===================================================================
(Binary files differ)
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/org.jboss.tools.openshift.express.client-2.3.0-SNAPSHOT-sources.jar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/org.jboss.tools.openshift.express.client-2.3.0-SNAPSHOT.jar
===================================================================
(Binary files differ)
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/org.jboss.tools.openshift.express.client-2.3.0-SNAPSHOT.jar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/p2artifacts.xml
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.client/target/p2artifacts.xml (rev 0)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.client/target/p2artifacts.xml 2011-10-05 11:00:47 UTC (rev 35354)
@@ -0,0 +1,25 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<?artifactRepository version='1.1.0'?>
+<artifacts size='2'>
+ <artifact classifier='osgi.bundle' id='org.jboss.tools.openshift.express.client' version='2.3.0.v20111005-1239-M4'>
+ <properties size='6'>
+ <property name='artifact.size' value='156891'/>
+ <property name='download.size' value='156891'/>
+ <property name='download.md5' value='869f8065a6537aeaf1079413baffdcea'/>
+ <property name='maven-groupId' value='org.jboss.tools.as.plugins'/>
+ <property name='maven-artifactId' value='org.jboss.tools.openshift.express.client'/>
+ <property name='maven-version' value='2.3.0-SNAPSHOT'/>
+ </properties>
+ </artifact>
+ <artifact classifier='osgi.bundle' id='org.jboss.tools.openshift.express.client.source' version='2.3.0.v20111005-1239-M4'>
+ <properties size='7'>
+ <property name='artifact.size' value='59659'/>
+ <property name='download.size' value='59659'/>
+ <property name='download.md5' value='940dd8c22e7b6a2cd34dc07a09a16728'/>
+ <property name='maven-groupId' value='org.jboss.tools.as.plugins'/>
+ <property name='maven-artifactId' value='org.jboss.tools.openshift.express.client'/>
+ <property name='maven-version' value='2.3.0-SNAPSHOT'/>
+ <property name='maven-classifier' value='sources'/>
+ </properties>
+ </artifact>
+</artifacts>
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/p2artifacts.xml
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/p2content.xml
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.client/target/p2content.xml (rev 0)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.client/target/p2content.xml 2011-10-05 11:00:47 UTC (rev 35354)
@@ -0,0 +1,66 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<units size='2'>
+ <unit id='org.jboss.tools.openshift.express.client' version='2.3.0.v20111005-1239-M4' singleton='false'>
+ <update id='org.jboss.tools.openshift.express.client' range='[0.0.0,2.3.0.v20111005-1239-M4)' severity='0'/>
+ <properties size='5'>
+ <property name='org.eclipse.equinox.p2.name' value='Openshift Core Plugin'/>
+ <property name='org.eclipse.equinox.p2.provider' value='JBoss by Red Hat'/>
+ <property name='maven-groupId' value='org.jboss.tools.as.plugins'/>
+ <property name='maven-artifactId' value='org.jboss.tools.openshift.express.client'/>
+ <property name='maven-version' value='2.3.0-SNAPSHOT'/>
+ </properties>
+ <provides size='11'>
+ <provided namespace='org.eclipse.equinox.p2.iu' name='org.jboss.tools.openshift.express.client' version='2.3.0.v20111005-1239-M4'/>
+ <provided namespace='osgi.bundle' name='org.jboss.tools.openshift.express.client' version='2.3.0.v20111005-1239-M4'/>
+ <provided namespace='java.package' name='org.jboss.dmr' version='0.0.0'/>
+ <provided namespace='java.package' name='org.jboss.tools.openshift.express.client' version='0.0.0'/>
+ <provided namespace='java.package' name='org.jboss.tools.openshift.express.internal.client' version='0.0.0'/>
+ <provided namespace='java.package' name='org.jboss.tools.openshift.express.internal.client.request' version='0.0.0'/>
+ <provided namespace='java.package' name='org.jboss.tools.openshift.express.internal.client.request.marshalling' version='0.0.0'/>
+ <provided namespace='java.package' name='org.jboss.tools.openshift.express.internal.client.response' version='0.0.0'/>
+ <provided namespace='java.package' name='org.jboss.tools.openshift.express.internal.client.response.unmarshalling' version='0.0.0'/>
+ <provided namespace='java.package' name='org.jboss.tools.openshift.express.internal.client.utils' version='0.0.0'/>
+ <provided namespace='org.eclipse.equinox.p2.eclipse.type' name='bundle' version='1.0.0'/>
+ </provides>
+ <requires size='2'>
+ <required namespace='osgi.bundle' name='org.eclipse.core.runtime' range='0.0.0'/>
+ <required namespace='osgi.bundle' name='com.jcraft.jsch' range='[0.1.41,2.0.0)'/>
+ </requires>
+ <artifacts size='1'>
+ <artifact classifier='osgi.bundle' id='org.jboss.tools.openshift.express.client' version='2.3.0.v20111005-1239-M4'/>
+ </artifacts>
+ <touchpoint id='org.eclipse.equinox.p2.osgi' version='1.0.0'/>
+ <touchpointData size='1'>
+ <instructions size='1'>
+ <instruction key='manifest'>
+ Bundle-ManifestVersion: 2
Created-By: Apache Maven
Archiver-Version: Plexus Archiver
Manifest-Version: 1.0
Bundle-Name: Openshift Core Plugin
Bundle-Vendor: JBoss by Red Hat
Bundle-ActivationPolicy: lazy
Bundle-ClassPath: jboss-dmr-1.0.0.Final.jar,.
Build-Jdk: 1.6.0_24
Bundle-Version: 2.3.0.v20111005-1239-M4
Export-Package: org.jboss.dmr;x-friends:="org.jboss.ide.eclipse.as.openshift.test",org.jboss.tools.openshift.express.client,org.jboss.tools.openshift.express.internal.client;x-friends:="org.jboss.ide.eclipse.as.openshift.test",org.jboss.tools.openshift.express.internal.client.request;x-friends:="org.jboss.ide.eclipse.as.openshift.test",org.jboss.tools.openshift.express.internal.client.request.marshalling;x-friends:="org.jboss.ide.eclipse.as.openshift.test",org.jboss.tools.openshift.express.internal.client.response;x-friends:="org.jboss.ide.eclipse.as.openshift.test",org.j!
boss.tools.openshift.express.internal.client.response.unmarshalling;x-friends:="org.jboss.ide.eclipse.as.openshift.test",org.jboss.tools.openshift.express.internal.client.utils;x-friends:="org.jboss.ide.eclipse.as.openshift.test"
Require-Bundle: org.eclipse.core.runtime,com.jcraft.jsch;bundle-version="[0.1.41,2.0.0)"
Bundle-Activator: org.jboss.tools.openshift.express.internal.client.OpenshiftCoreActivator
Bundle-SymbolicName: org.jboss.tools.openshift.express.client
Built-By: adietish
Bundle-RequiredExecutionEnvironment: JavaSE-1.6

+ </instruction>
+ </instructions>
+ </touchpointData>
+ </unit>
+ <unit id='org.jboss.tools.openshift.express.client.source' version='2.3.0.v20111005-1239-M4' singleton='false'>
+ <update id='org.jboss.tools.openshift.express.client.source' range='[0.0.0,2.3.0.v20111005-1239-M4)' severity='0'/>
+ <properties size='4'>
+ <property name='maven-groupId' value='org.jboss.tools.as.plugins'/>
+ <property name='maven-artifactId' value='org.jboss.tools.openshift.express.client'/>
+ <property name='maven-version' value='2.3.0-SNAPSHOT'/>
+ <property name='maven-classifier' value='sources'/>
+ </properties>
+ <provides size='3'>
+ <provided namespace='org.eclipse.equinox.p2.iu' name='org.jboss.tools.openshift.express.client.source' version='2.3.0.v20111005-1239-M4'/>
+ <provided namespace='osgi.bundle' name='org.jboss.tools.openshift.express.client.source' version='2.3.0.v20111005-1239-M4'/>
+ <provided namespace='org.eclipse.equinox.p2.eclipse.type' name='source' version='1.0.0'/>
+ </provides>
+ <artifacts size='1'>
+ <artifact classifier='osgi.bundle' id='org.jboss.tools.openshift.express.client.source' version='2.3.0.v20111005-1239-M4'/>
+ </artifacts>
+ <touchpoint id='org.eclipse.equinox.p2.osgi' version='1.0.0'/>
+ <touchpointData size='1'>
+ <instructions size='1'>
+ <instruction key='manifest'>
+ Bundle-ManifestVersion: 2
Built-By: adietish
Bundle-Version: 2.3.0.v20111005-1239-M4
Build-Jdk: 1.6.0_24
Eclipse-SourceBundle: org.jboss.tools.openshift.express.client;version="2.3.0.v20111005-1239-M4";roots:="."
Created-By: Apache Maven
Bundle-SymbolicName: org.jboss.tools.openshift.express.client.source
Manifest-Version: 1.0
Archiver-Version: Plexus Archiver

+ </instruction>
+ </instructions>
+ </touchpointData>
+ </unit>
+</units>
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.client/target/p2content.xml
___________________________________________________________________
Added: svn:mime-type
+ text/plain
13 years, 3 months
JBoss Tools SVN: r35353 - trunk/as/plugins.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-10-05 06:58:42 -0400 (Wed, 05 Oct 2011)
New Revision: 35353
Added:
trunk/as/plugins/org.jboss.tools.openshift.express.client/
Log:
[JBIDE-9841] renamed org.jboss.ide.eclipse.as.openshift.core to org.jboss.tools.openshift.express.client
13 years, 3 months
JBoss Tools SVN: r35352 - trunk/as/plugins.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-10-05 06:57:20 -0400 (Wed, 05 Oct 2011)
New Revision: 35352
Removed:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/
trunk/as/plugins/org.jboss.tools.openshift.express.client/
Log:
[JBIDE-9841] removing org.jboss.ide.eclipse.as.openshift plugins (in order to check them in renamed)
13 years, 3 months