JBoss Tools SVN: r37170 - trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/launchers.
by jbosstools-commits@lists.jboss.org
Author: ljelinko
Date: 2011-12-09 10:11:40 -0500 (Fri, 09 Dec 2011)
New Revision: 37170
Modified:
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/launchers/AllTestsSuite_allConfigs.launch
Log:
fixed the resources dir location
Modified: trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/launchers/AllTestsSuite_allConfigs.launch
===================================================================
--- trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/launchers/AllTestsSuite_allConfigs.launch 2011-12-09 15:11:19 UTC (rev 37169)
+++ trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/launchers/AllTestsSuite_allConfigs.launch 2011-12-09 15:11:40 UTC (rev 37170)
@@ -30,7 +30,7 @@
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -consoleLog"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.jboss.tools.portlet.ui.bot.test"/>
<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
-<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Dtest.configurations.dir=${workspace_loc}/org.jboss.tools.portlet.ui.bot.test/resources -Xmx1024m -XX:MaxPermSize=256m"/>
+<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Dtest.configurations.dir=${workspace_loc}/org.jboss.tools.portlet.ui.bot.test/resources/generated_config_files -Xmx1024m -XX:MaxPermSize=256m"/>
<stringAttribute key="pde.version" value="3.3"/>
<stringAttribute key="product" value="org.eclipse.platform.ide"/>
<booleanAttribute key="show_selected_only" value="false"/>
14 years, 4 months
JBoss Tools SVN: r37169 - trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-12-09 10:11:19 -0500 (Fri, 09 Dec 2011)
New Revision: 37169
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationWizardPageModel.java
Log:
[JBIDE-10427] applied the fix from JBIDE-9934, refactored the ImportProjectWizardModel and extracted import strategies
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationWizardPageModel.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationWizardPageModel.java 2011-12-09 15:11:13 UTC (rev 37168)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationWizardPageModel.java 2011-12-09 15:11:19 UTC (rev 37169)
@@ -18,6 +18,7 @@
import org.jboss.tools.openshift.express.client.IDomain;
import org.jboss.tools.openshift.express.client.IUser;
import org.jboss.tools.openshift.express.client.OpenShiftException;
+import org.jboss.tools.openshift.express.internal.ui.wizard.appimport.ImportProjectWizardModel;
/**
* @author André Dietisheim
14 years, 4 months
JBoss Tools SVN: r37168 - in trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test: jsf and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: ljelinko
Date: 2011-12-09 10:11:13 -0500 (Fri, 09 Dec 2011)
New Revision: 37168
Added:
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/jsf/CreateJSFPortletRuntime4x.java
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/jsf/CreateJSFPortletRuntime5x.java
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/seam/CreateSeamPortletRuntime4x.java
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/seam/CreateSeamPortletRuntime5x.java
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/template/CreateJSFSeamPortletRuntime4xTemplate.java
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/template/CreateJSFSeamPortletRuntime5xTemplate.java
Removed:
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/jsf/CreateJSFPortlet.java
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/seam/CreateSeamPortlet.java
Modified:
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/AllTestsSuite.java
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/jsf/CreateJSFPortletProject.java
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/jsf/JSFPortletTestSuite.java
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/seam/CreateSeamPortletProject.java
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/seam/SeamPortletTestSuite.java
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/template/CreateJSFSeamPortletTemplate.java
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/template/CreatePortletProjectTemplate.java
Log:
changed tests to support 5.x and 4.x runtime
Modified: trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/AllTestsSuite.java
===================================================================
--- trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/AllTestsSuite.java 2011-12-09 15:09:56 UTC (rev 37167)
+++ trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/AllTestsSuite.java 2011-12-09 15:11:13 UTC (rev 37168)
@@ -6,11 +6,13 @@
import org.jboss.tools.portlet.ui.bot.test.example.JSFPortletExample;
import org.jboss.tools.portlet.ui.bot.test.example.JavaPortletExample;
import org.jboss.tools.portlet.ui.bot.test.example.SeamPortletExample;
-import org.jboss.tools.portlet.ui.bot.test.jsf.CreateJSFPortlet;
import org.jboss.tools.portlet.ui.bot.test.jsf.CreateJSFPortletProject;
+import org.jboss.tools.portlet.ui.bot.test.jsf.CreateJSFPortletRuntime4x;
+import org.jboss.tools.portlet.ui.bot.test.jsf.CreateJSFPortletRuntime5x;
import org.jboss.tools.portlet.ui.bot.test.jsf.RunJSFPortletOnServer;
-import org.jboss.tools.portlet.ui.bot.test.seam.CreateSeamPortlet;
import org.jboss.tools.portlet.ui.bot.test.seam.CreateSeamPortletProject;
+import org.jboss.tools.portlet.ui.bot.test.seam.CreateSeamPortletRuntime4x;
+import org.jboss.tools.portlet.ui.bot.test.seam.CreateSeamPortletRuntime5x;
import org.jboss.tools.portlet.ui.bot.test.seam.RunSeamPortletOnServer;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
@@ -21,10 +23,12 @@
CreateJavaPortlet.class,
RunJavaPortletOnServer.class,
CreateJSFPortletProject.class,
- CreateJSFPortlet.class,
+ CreateJSFPortletRuntime4x.class,
+ CreateJSFPortletRuntime5x.class,
RunJSFPortletOnServer.class,
- CreateSeamPortletProject.class,
- CreateSeamPortlet.class,
+ CreateSeamPortletProject.class,
+ CreateSeamPortletRuntime4x.class,
+ CreateSeamPortletRuntime5x.class,
RunSeamPortletOnServer.class,
JavaPortletExample.class,
JSFPortletExample.class,
Deleted: trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/jsf/CreateJSFPortlet.java
===================================================================
--- trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/jsf/CreateJSFPortlet.java 2011-12-09 15:09:56 UTC (rev 37167)
+++ trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/jsf/CreateJSFPortlet.java 2011-12-09 15:11:13 UTC (rev 37168)
@@ -1,19 +0,0 @@
-package org.jboss.tools.portlet.ui.bot.test.jsf;
-
-import static org.jboss.tools.portlet.ui.bot.test.jsf.CreateJSFPortletProject.PROJECT_NAME;
-
-import org.jboss.tools.portlet.ui.bot.test.template.CreateJSFSeamPortletTemplate;
-
-/**
- * Creates a new jsf portlet and checks if the right files are generated.
- *
- * @author Lucia Jelinkova
- *
- */
-public class CreateJSFPortlet extends CreateJSFSeamPortletTemplate {
-
- @Override
- protected String getProjectName() {
- return PROJECT_NAME;
- }
-}
Modified: trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/jsf/CreateJSFPortletProject.java
===================================================================
--- trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/jsf/CreateJSFPortletProject.java 2011-12-09 15:09:56 UTC (rev 37167)
+++ trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/jsf/CreateJSFPortletProject.java 2011-12-09 15:11:13 UTC (rev 37168)
@@ -44,7 +44,7 @@
tasks.add(new WizardPageDefaultsFillingTask());
tasks.add(new JBossPortletCapabilitiesWizardPageFillingTask(JBossPortletCapabilitiesWizardPageFillingTask.Type.RUNTIME_PROVIDER));
tasks.add(new WizardPageDefaultsFillingTask());
- tasks.add(new JBossJSFPortletCapabilitiesWizardPageFillingTask(JBossJSFPortletCapabilitiesWizardPageFillingTask.Type.RUNTIME_PROVIDER));
+ tasks.add(new JBossJSFPortletCapabilitiesWizardPageFillingTask(JBossJSFPortletCapabilitiesWizardPageFillingTask.Type.RUNTIME_PROVIDER, "/home/ljelinko/programs/jboss/EPP/jboss-epp-5.1/portletbridge"));
return tasks;
}
Added: trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/jsf/CreateJSFPortletRuntime4x.java
===================================================================
--- trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/jsf/CreateJSFPortletRuntime4x.java (rev 0)
+++ trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/jsf/CreateJSFPortletRuntime4x.java 2011-12-09 15:11:13 UTC (rev 37168)
@@ -0,0 +1,19 @@
+package org.jboss.tools.portlet.ui.bot.test.jsf;
+
+import static org.jboss.tools.portlet.ui.bot.test.jsf.CreateJSFPortletProject.PROJECT_NAME;
+
+import org.jboss.tools.portlet.ui.bot.test.template.CreateJSFSeamPortletRuntime4xTemplate;
+
+/**
+ * Creates a new jsf portlet for 4.x runtime and checks if the right files are generated.
+ *
+ * @author Lucia Jelinkova
+ *
+ */
+public class CreateJSFPortletRuntime4x extends CreateJSFSeamPortletRuntime4xTemplate {
+
+ @Override
+ protected String getProjectName() {
+ return PROJECT_NAME;
+ }
+}
Copied: trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/jsf/CreateJSFPortletRuntime5x.java (from rev 37065, trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/jsf/CreateJSFPortlet.java)
===================================================================
--- trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/jsf/CreateJSFPortletRuntime5x.java (rev 0)
+++ trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/jsf/CreateJSFPortletRuntime5x.java 2011-12-09 15:11:13 UTC (rev 37168)
@@ -0,0 +1,19 @@
+package org.jboss.tools.portlet.ui.bot.test.jsf;
+
+import static org.jboss.tools.portlet.ui.bot.test.jsf.CreateJSFPortletProject.PROJECT_NAME;
+
+import org.jboss.tools.portlet.ui.bot.test.template.CreateJSFSeamPortletRuntime5xTemplate;
+
+/**
+ * Creates a new jsf portlet for 5.x runtime and checks if the right files are generated.
+ *
+ * @author Lucia Jelinkova
+ *
+ */
+public class CreateJSFPortletRuntime5x extends CreateJSFSeamPortletRuntime5xTemplate {
+
+ @Override
+ protected String getProjectName() {
+ return PROJECT_NAME;
+ }
+}
Modified: trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/jsf/JSFPortletTestSuite.java
===================================================================
--- trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/jsf/JSFPortletTestSuite.java 2011-12-09 15:09:56 UTC (rev 37167)
+++ trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/jsf/JSFPortletTestSuite.java 2011-12-09 15:11:13 UTC (rev 37168)
@@ -7,7 +7,8 @@
@RunWith(RequirementAwareUsageWindowClosingSuite.class)
@Suite.SuiteClasses({
CreateJSFPortletProject.class,
- CreateJSFPortlet.class,
+ CreateJSFPortletRuntime4x.class,
+ CreateJSFPortletRuntime5x.class,
RunJSFPortletOnServer.class
})
public class JSFPortletTestSuite {
Deleted: trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/seam/CreateSeamPortlet.java
===================================================================
--- trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/seam/CreateSeamPortlet.java 2011-12-09 15:09:56 UTC (rev 37167)
+++ trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/seam/CreateSeamPortlet.java 2011-12-09 15:11:13 UTC (rev 37168)
@@ -1,19 +0,0 @@
-package org.jboss.tools.portlet.ui.bot.test.seam;
-
-import static org.jboss.tools.portlet.ui.bot.test.seam.CreateSeamPortletProject.PROJECT_NAME;
-
-import org.jboss.tools.portlet.ui.bot.test.template.CreateJSFSeamPortletTemplate;
-
-/**
- * Creates a new seam portlet and checks if the right files are generated.
- *
- * @author Lucia Jelinkova
- *
- */
-public class CreateSeamPortlet extends CreateJSFSeamPortletTemplate {
-
- @Override
- protected String getProjectName() {
- return PROJECT_NAME;
- }
-}
Modified: trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/seam/CreateSeamPortletProject.java
===================================================================
--- trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/seam/CreateSeamPortletProject.java 2011-12-09 15:09:56 UTC (rev 37167)
+++ trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/seam/CreateSeamPortletProject.java 2011-12-09 15:11:13 UTC (rev 37168)
@@ -19,6 +19,7 @@
import org.jboss.tools.ui.bot.ext.config.Annotations.Server;
import org.jboss.tools.ui.bot.ext.config.Annotations.ServerState;
import org.jboss.tools.ui.bot.ext.config.Annotations.ServerType;
+import org.jboss.tools.ui.bot.ext.config.TestConfigurator;
/**
@@ -31,6 +32,8 @@
public class CreateSeamPortletProject extends CreatePortletProjectTemplate{
public static final String PROJECT_NAME = "seam-portlet";
+
+ private static final String PORTLET_BRIDGE_AS_RELATIVE_PATH = "/server/default/deploy/jboss-portal.sar/portal-identity.sar/portal-identity.war/WEB-INF/lib";
@Override
public String getProjectName() {
@@ -54,10 +57,13 @@
List<WizardPageFillingTask> tasks = new ArrayList<WizardPageFillingTask>();
tasks.add(new WizardPageDefaultsFillingTask());
tasks.add(new WizardPageDefaultsFillingTask());
- tasks.add(new JBossPortletCapabilitiesWizardPageFillingTask(JBossPortletCapabilitiesWizardPageFillingTask.Type.RUNTIME_PROVIDER));
+ tasks.add(new JBossPortletCapabilitiesWizardPageFillingTask(
+ JBossPortletCapabilitiesWizardPageFillingTask.Type.RUNTIME_PROVIDER));
tasks.add(new WizardPageDefaultsFillingTask());
tasks.add(getSeamFacetPageFillingTask());
- tasks.add(new JBossJSFPortletCapabilitiesWizardPageFillingTask(JBossJSFPortletCapabilitiesWizardPageFillingTask.Type.RUNTIME_PROVIDER, "/home/ljelinko/programs/jboss/EPP/jboss-epp-5.1/portletbridge"));
+ tasks.add(new JBossJSFPortletCapabilitiesWizardPageFillingTask(
+ JBossJSFPortletCapabilitiesWizardPageFillingTask.Type.RUNTIME_PROVIDER,
+ TestConfigurator.currentConfig.getServer().runtimeHome + PORTLET_BRIDGE_AS_RELATIVE_PATH));
return tasks;
}
Added: trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/seam/CreateSeamPortletRuntime4x.java
===================================================================
--- trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/seam/CreateSeamPortletRuntime4x.java (rev 0)
+++ trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/seam/CreateSeamPortletRuntime4x.java 2011-12-09 15:11:13 UTC (rev 37168)
@@ -0,0 +1,19 @@
+package org.jboss.tools.portlet.ui.bot.test.seam;
+
+import static org.jboss.tools.portlet.ui.bot.test.seam.CreateSeamPortletProject.PROJECT_NAME;
+
+import org.jboss.tools.portlet.ui.bot.test.template.CreateJSFSeamPortletRuntime4xTemplate;
+
+/**
+ * Creates a new seam portlet for 4.x runtime and checks if the right files are generated.
+ *
+ * @author Lucia Jelinkova
+ *
+ */
+public class CreateSeamPortletRuntime4x extends CreateJSFSeamPortletRuntime4xTemplate {
+
+ @Override
+ protected String getProjectName() {
+ return PROJECT_NAME;
+ }
+}
Copied: trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/seam/CreateSeamPortletRuntime5x.java (from rev 37065, trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/seam/CreateSeamPortlet.java)
===================================================================
--- trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/seam/CreateSeamPortletRuntime5x.java (rev 0)
+++ trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/seam/CreateSeamPortletRuntime5x.java 2011-12-09 15:11:13 UTC (rev 37168)
@@ -0,0 +1,19 @@
+package org.jboss.tools.portlet.ui.bot.test.seam;
+
+import static org.jboss.tools.portlet.ui.bot.test.seam.CreateSeamPortletProject.PROJECT_NAME;
+
+import org.jboss.tools.portlet.ui.bot.test.template.CreateJSFSeamPortletRuntime5xTemplate;
+
+/**
+ * Creates a new seam portlet for 5.x runtime and checks if the right files are generated.
+ *
+ * @author Lucia Jelinkova
+ *
+ */
+public class CreateSeamPortletRuntime5x extends CreateJSFSeamPortletRuntime5xTemplate {
+
+ @Override
+ protected String getProjectName() {
+ return PROJECT_NAME;
+ }
+}
Modified: trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/seam/SeamPortletTestSuite.java
===================================================================
--- trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/seam/SeamPortletTestSuite.java 2011-12-09 15:09:56 UTC (rev 37167)
+++ trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/seam/SeamPortletTestSuite.java 2011-12-09 15:11:13 UTC (rev 37168)
@@ -7,7 +7,8 @@
@RunWith(RequirementAwareUsageWindowClosingSuite.class)
@Suite.SuiteClasses({
CreateSeamPortletProject.class,
- CreateSeamPortlet.class,
+ CreateSeamPortletRuntime4x.class,
+ CreateSeamPortletRuntime5x.class,
RunSeamPortletOnServer.class
})
public class SeamPortletTestSuite {
Added: trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/template/CreateJSFSeamPortletRuntime4xTemplate.java
===================================================================
--- trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/template/CreateJSFSeamPortletRuntime4xTemplate.java (rev 0)
+++ trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/template/CreateJSFSeamPortletRuntime4xTemplate.java 2011-12-09 15:11:13 UTC (rev 37168)
@@ -0,0 +1,37 @@
+package org.jboss.tools.portlet.ui.bot.test.template;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+import org.jboss.tools.ui.bot.ext.config.Annotations.Require;
+import org.jboss.tools.ui.bot.ext.config.Annotations.Server;
+import org.jboss.tools.ui.bot.ext.config.Annotations.ServerState;
+
+/**
+ * Creates a new jsf portlet with 4.x runtime and checks if the right files are generated.
+ *
+ * @author Lucia Jelinkova
+ *
+ */
+@Require(clearWorkspace=false, clearProjects=false, server=@Server(version="4.3", state=ServerState.Present))
+public abstract class CreateJSFSeamPortletRuntime4xTemplate extends CreateJSFSeamPortletTemplate {
+
+ @Override
+ protected List<String> getExpectedFiles() {
+ return Arrays.asList(
+ JSF_FOLDER + "edit.jsp",
+ JSF_FOLDER + "view.jsp",
+ JSF_FOLDER + "help.jsp",
+ DEFAULT_OBJECTS_XML,
+ PORTLET_INSTANCES_XML,
+ JBOSS_APP_XML,
+ JBOSS_PORTLET_XML
+ );
+ }
+
+ @Override
+ protected List<String> getNonExpectedFiles() {
+ return Collections.emptyList();
+ }
+}
Added: trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/template/CreateJSFSeamPortletRuntime5xTemplate.java
===================================================================
--- trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/template/CreateJSFSeamPortletRuntime5xTemplate.java (rev 0)
+++ trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/template/CreateJSFSeamPortletRuntime5xTemplate.java 2011-12-09 15:11:13 UTC (rev 37168)
@@ -0,0 +1,30 @@
+package org.jboss.tools.portlet.ui.bot.test.template;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.jboss.tools.ui.bot.ext.config.Annotations.Require;
+import org.jboss.tools.ui.bot.ext.config.Annotations.Server;
+import org.jboss.tools.ui.bot.ext.config.Annotations.ServerState;
+
+@Require(clearWorkspace=false, clearProjects=false, server=@Server(version="5.0", operator=">", state=ServerState.Present))
+public abstract class CreateJSFSeamPortletRuntime5xTemplate extends CreateJSFSeamPortletTemplate {
+
+ @Override
+ protected List<String> getExpectedFiles() {
+ return Arrays.asList(
+ JSF_FOLDER + "edit.jsp",
+ JSF_FOLDER + "view.jsp",
+ JSF_FOLDER + "help.jsp"
+ );
+ }
+
+ @Override
+ protected List<String> getNonExpectedFiles() {
+ return Arrays.asList(
+ DEFAULT_OBJECTS_XML,
+ PORTLET_INSTANCES_XML,
+ JBOSS_APP_XML,
+ JBOSS_PORTLET_XML);
+ }
+}
Modified: trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/template/CreateJSFSeamPortletTemplate.java
===================================================================
--- trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/template/CreateJSFSeamPortletTemplate.java 2011-12-09 15:09:56 UTC (rev 37167)
+++ trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/template/CreateJSFSeamPortletTemplate.java 2011-12-09 15:11:13 UTC (rev 37168)
@@ -27,24 +27,6 @@
}
@Override
- protected List<String> getExpectedFiles() {
- return Arrays.asList(
- JSF_FOLDER + "edit.jsp",
- JSF_FOLDER + "view.jsp",
- JSF_FOLDER + "help.jsp"
- );
- }
-
- @Override
- protected List<String> getNonExpectedFiles() {
- return Arrays.asList(
- DEFAULT_OBJECTS_XML,
- PORTLET_INSTANCES_XML,
- JBOSS_APP_XML,
- JBOSS_PORTLET_XML);
- }
-
- @Override
protected List<XMLNode> getExpectedXMLNodes() {
return Arrays.asList(new XMLNode("portlet-app/portlet/portlet-class", FACES_CLASS_NAME));
}
Modified: trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/template/CreatePortletProjectTemplate.java
===================================================================
--- trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/template/CreatePortletProjectTemplate.java 2011-12-09 15:09:56 UTC (rev 37167)
+++ trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/template/CreatePortletProjectTemplate.java 2011-12-09 15:11:13 UTC (rev 37168)
@@ -30,15 +30,13 @@
* @author Lucia Jelinkova
*
*/
-@Require(server=@Server(required=true, state=ServerState.Present, type=ServerType.EPP))
+@Require(server=(a)Server(state=ServerState.Present, type=ServerType.EPP))
public abstract class CreatePortletProjectTemplate extends SWTTaskBasedTestCase {
protected static final FacetDefinition JAVA_FACET = new FacetDefinition("Java", null, "1.6");
protected static final FacetDefinition JSF_FACET = new FacetDefinition("JavaServer Faces");
- public static final FacetDefinition SEAM_2_FACET = new FacetDefinition("Seam 2");
-
protected static final String JBOSS_FACET_CATEGORY = "JBoss Portlets";
protected static final FacetDefinition CORE_PORTLET_FACET = new FacetDefinition("JBoss Core Portlet", JBOSS_FACET_CATEGORY);
14 years, 4 months
JBoss Tools SVN: r37166 - trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/seam.
by jbosstools-commits@lists.jboss.org
Author: ljelinko
Date: 2011-12-09 10:09:56 -0500 (Fri, 09 Dec 2011)
New Revision: 37166
Modified:
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/seam/RunSeamPortletOnServer.java
Log:
changed to be ran only on 5.x runtime
Modified: trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/seam/RunSeamPortletOnServer.java
===================================================================
--- trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/seam/RunSeamPortletOnServer.java 2011-12-09 15:08:50 UTC (rev 37165)
+++ trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/seam/RunSeamPortletOnServer.java 2011-12-09 15:09:56 UTC (rev 37166)
@@ -6,14 +6,25 @@
import org.jboss.tools.portlet.ui.bot.entity.WorkspaceFile;
import org.jboss.tools.portlet.ui.bot.task.server.MarkFileAsDeployableTask;
import org.jboss.tools.portlet.ui.bot.test.template.RunPortletOnServerTemplate;
+import org.jboss.tools.ui.bot.ext.config.Annotations.Require;
+import org.jboss.tools.ui.bot.ext.config.Annotations.Server;
+import org.jboss.tools.ui.bot.ext.config.Annotations.ServerState;
/**
* Performs Run on Server on the jsf portlet project and checks if there is no exception in the
* console.
+ * <br /><br />
+ * NOTE: This test is not permormed on 4.x runtime because of a bunch of issues with Portlet Bridge and Seam 2.0, e. g:
+ * <ul>
+ * <li>JBIDE-8289 </li>
+ * <li>PBR-186 </li>
+ * <li>JBIDE-9481 </li>
+ * </ul>
*
* @author Lucia Jelinkova
*
*/
+@Require(clearWorkspace=false, clearProjects=false, server=@Server(version="5.0", operator=">", state=ServerState.Present))
public class RunSeamPortletOnServer extends RunPortletOnServerTemplate {
private static final WorkspaceFile DATASOURCE_FILE = file(PROJECT_NAME, "resources/" + PROJECT_NAME + "-ds.xml");
14 years, 4 months
JBoss Tools SVN: r37167 - in trunk/openshift/plugins/org.jboss.tools.openshift.express.ui: src/org/jboss/tools/openshift/express/internal/ui/common and 3 other directories.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-12-09 10:09:56 -0500 (Fri, 09 Dec 2011)
New Revision: 37167
Added:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/common/ImportFailedException.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/common/OpenShiftUIException.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/common/WontOverwriteException.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/AbstractImportApplicationStrategy.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/AddToExistingProjectStrategy.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/IImportApplicationStrategy.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ImportNewProjectStrategy.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ImportProjectWizard.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ImportProjectWizardModel.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/project/
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/project/AbstractProjectImportOperation.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/project/GeneralProjectImportOperation.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/project/MavenProjectImportOperation.java
Removed:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ImportProjectWizard.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ImportProjectWizardModel.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/projectimport/
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/plugin.xml
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AdapterWizardPage.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AdapterWizardPageModel.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationWizardPage.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/CredentialsWizardPage.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/CredentialsWizardPageModel.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewDomainDialog.java
Log:
[JBIDE-10427] applied the fix from JBIDE-9934, refactored the ImportProjectWizardModel and extracted import strategies
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/plugin.xml
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/plugin.xml 2011-12-09 15:09:56 UTC (rev 37166)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/plugin.xml 2011-12-09 15:09:56 UTC (rev 37167)
@@ -14,7 +14,7 @@
</category>
<wizard
category="org.jboss.ide.eclipse.as.openshift.express.ui.wizard.category"
- class="org.jboss.tools.openshift.express.internal.ui.wizard.ImportProjectWizard"
+ class="org.jboss.tools.openshift.express.internal.ui.wizard.appimport.ImportProjectWizard"
icon="icons/openshift-logo-white-icon.png"
id="org.jboss.ide.eclipse.as.openshift.express.ui.wizard.ImportProjectNewWizard"
name="OpenShift Express Application">
Added: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/common/ImportFailedException.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/common/ImportFailedException.java (rev 0)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/common/ImportFailedException.java 2011-12-09 15:09:56 UTC (rev 37167)
@@ -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.common;
+
+public class ImportFailedException extends OpenShiftUIException {
+
+ private static final long serialVersionUID = 1L;
+
+ public ImportFailedException(String message, Object... arguments) {
+ super(message, arguments);
+ }
+}
Property changes on: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/common/ImportFailedException.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/common/OpenShiftUIException.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/common/OpenShiftUIException.java (rev 0)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/common/OpenShiftUIException.java 2011-12-09 15:09:56 UTC (rev 37167)
@@ -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.internal.ui.common;
+
+import org.jboss.tools.openshift.express.client.OpenShiftException;
+
+public class OpenShiftUIException extends OpenShiftException {
+
+ private static final long serialVersionUID = 1L;
+
+ public OpenShiftUIException(String message, Object... arguments) {
+ super(message, arguments);
+ }
+
+ public OpenShiftUIException(Throwable cause, String message, Object... arguments) {
+ super(cause, message, arguments);
+ }
+
+}
Property changes on: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/common/OpenShiftUIException.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/common/WontOverwriteException.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/common/WontOverwriteException.java (rev 0)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/common/WontOverwriteException.java 2011-12-09 15:09:56 UTC (rev 37167)
@@ -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.common;
+
+public class WontOverwriteException extends OpenShiftUIException {
+
+ private static final long serialVersionUID = 1L;
+
+ public WontOverwriteException(String message, Object... arguments) {
+ super(message, arguments);
+ }
+}
Property changes on: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/common/WontOverwriteException.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AdapterWizardPage.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AdapterWizardPage.java 2011-12-09 15:09:56 UTC (rev 37166)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AdapterWizardPage.java 2011-12-09 15:09:56 UTC (rev 37167)
@@ -50,6 +50,8 @@
import org.jboss.tools.common.ui.ssh.SshPrivateKeysPreferences;
import org.jboss.tools.openshift.express.client.OpenShiftException;
import org.jboss.tools.openshift.express.internal.ui.OpenShiftUIActivator;
+import org.jboss.tools.openshift.express.internal.ui.wizard.appimport.ImportProjectWizard;
+import org.jboss.tools.openshift.express.internal.ui.wizard.appimport.ImportProjectWizardModel;
/**
* @author André Dietisheim
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AdapterWizardPageModel.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AdapterWizardPageModel.java 2011-12-09 15:09:56 UTC (rev 37166)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AdapterWizardPageModel.java 2011-12-09 15:09:56 UTC (rev 37167)
@@ -15,6 +15,7 @@
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.internal.ui.wizard.appimport.ImportProjectWizardModel;
/**
* @author André Dietisheim
@@ -37,7 +38,6 @@
public static final String MODE = "serverMode";
public static final String MODE_SOURCE = "serverModeSource";
public static final String MODE_BINARY = "serverModeBinary";
- public static final String RUNTIME_DELEGATE = "runtimeDelegate";
public static final String SERVER_TYPE = "serverType";
private ImportProjectWizardModel wizardModel;
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationWizardPage.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationWizardPage.java 2011-12-09 15:09:56 UTC (rev 37166)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationWizardPage.java 2011-12-09 15:09:56 UTC (rev 37167)
@@ -60,6 +60,7 @@
import org.jboss.tools.openshift.express.client.NotFoundOpenShiftException;
import org.jboss.tools.openshift.express.client.OpenShiftException;
import org.jboss.tools.openshift.express.internal.ui.OpenShiftUIActivator;
+import org.jboss.tools.openshift.express.internal.ui.wizard.appimport.ImportProjectWizardModel;
import org.jboss.tools.openshift.express.internal.utils.Logger;
/**
@@ -71,7 +72,7 @@
private ApplicationWizardPageModel model;
private ImportProjectWizardModel wizardModel;
- protected ApplicationWizardPage(IWizard wizard, ImportProjectWizardModel wizardModel) {
+ public ApplicationWizardPage(IWizard wizard, ImportProjectWizardModel wizardModel) {
super("Application selection", "Please select an application to start with, or create a new one.",
"Application selection", wizard);
this.wizardModel = wizardModel;
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/CredentialsWizardPage.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/CredentialsWizardPage.java 2011-12-09 15:09:56 UTC (rev 37166)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/CredentialsWizardPage.java 2011-12-09 15:09:56 UTC (rev 37167)
@@ -40,6 +40,7 @@
import org.jboss.tools.common.ui.databinding.DataBindingUtils;
import org.jboss.tools.common.ui.databinding.ParametrizableWizardPageSupport;
import org.jboss.tools.openshift.express.internal.ui.OpenShiftUIActivator;
+import org.jboss.tools.openshift.express.internal.ui.wizard.appimport.ImportProjectWizardModel;
import org.jboss.tools.openshift.express.internal.utils.UIUtils;
/**
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/CredentialsWizardPageModel.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/CredentialsWizardPageModel.java 2011-12-09 15:09:56 UTC (rev 37166)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/CredentialsWizardPageModel.java 2011-12-09 15:09:56 UTC (rev 37167)
@@ -25,6 +25,7 @@
import org.jboss.tools.openshift.express.client.configuration.SystemProperties;
import org.jboss.tools.openshift.express.client.configuration.UserConfiguration;
import org.jboss.tools.openshift.express.internal.ui.OpenShiftUIActivator;
+import org.jboss.tools.openshift.express.internal.ui.wizard.appimport.ImportProjectWizardModel;
/**
* @author André Dietisheim
Deleted: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ImportProjectWizard.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ImportProjectWizard.java 2011-12-09 15:09:56 UTC (rev 37166)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ImportProjectWizard.java 2011-12-09 15:09:56 UTC (rev 37167)
@@ -1,175 +0,0 @@
-/*******************************************************************************
- * 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.IOException;
-import java.lang.reflect.InvocationTargetException;
-import java.net.URISyntaxException;
-import java.util.concurrent.ArrayBlockingQueue;
-import java.util.concurrent.TimeUnit;
-
-import org.eclipse.core.resources.WorkspaceJob;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.jgit.api.errors.JGitInternalException;
-import org.eclipse.jgit.errors.TransportException;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.ui.INewWizard;
-import org.eclipse.ui.IWorkbench;
-import org.jboss.tools.common.ui.WizardUtils;
-import org.jboss.tools.openshift.express.client.OpenShiftException;
-import org.jboss.tools.openshift.express.internal.ui.OpenShiftUIActivator;
-import org.jboss.tools.openshift.express.internal.ui.common.MavenImportFailedException;
-import org.jboss.tools.openshift.express.internal.ui.common.WontOverwriteException;
-
-/**
- * @author André Dietisheim
- */
-public class ImportProjectWizard extends Wizard implements INewWizard {
-
- private ImportProjectWizardModel model;
-
- public ImportProjectWizard() {
- }
-
- @Override
- public void init(IWorkbench workbench, IStructuredSelection selection) {
- setWindowTitle("OpenShift application wizard");
- setNeedsProgressMonitor(true);
- }
-
- @Override
- public boolean performFinish() {
- try {
- final ArrayBlockingQueue<IStatus> queue = new ArrayBlockingQueue<IStatus>(1);
- WizardUtils.runInWizard(
- new WorkspaceJob("Importing project to workspace...") {
-
- @Override
- public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
- IStatus status = Status.OK_STATUS;
- status = performOperations(monitor, status);
- if (!status.isOK()) {
- OpenShiftUIActivator.log(status);
- }
- queue.offer(status);
- return status;
- }
-
- private IStatus performOperations(IProgressMonitor monitor, IStatus status) {
- try {
- if (model.isNewProject()) {
- model.importProject(monitor);
- } else {
- if (!askForConfirmation(model.getApplicationName(), model.getProjectName())) {
- return Status.CANCEL_STATUS;
- }
- model.addToExistingProject(monitor);
- }
- return Status.OK_STATUS;
- } catch (final WontOverwriteException e) {
- openWarning("Project already present", e.getMessage());
- return Status.CANCEL_STATUS;
- } catch (final MavenImportFailedException e) {
- return OpenShiftUIActivator.createErrorStatus(
- "Could not import maven project {0}.", e,
- model.getProjectName());
- } catch (IOException e) {
- return OpenShiftUIActivator.createErrorStatus(
- "Could not copy openshift configuration files to project {0}", e,
- model.getProjectName());
- } catch (OpenShiftException e) {
- return OpenShiftUIActivator.createErrorStatus(
- "Could not import project to the workspace.", e);
- } catch (URISyntaxException e) {
- return OpenShiftUIActivator.createErrorStatus(
- "The url of the remote git repository is not valid", e);
- } catch (InvocationTargetException e) {
- if (isTransportException(e)) {
- TransportException te = getTransportException(e);
- return OpenShiftUIActivator
- .createErrorStatus(
- "Could not clone the repository. Authentication failed.\n"
- + " Please make sure that you added your private key to the ssh preferences.",
- te);
- } else {
- return OpenShiftUIActivator.createErrorStatus(
- "An exception occurred while creating local git repository.", e);
- }
- } catch (Exception e) {
- return OpenShiftUIActivator.createErrorStatus(
- "Could int import project to the workspace.", e);
- }
- }
- }, getContainer());
- IStatus status = queue.poll(10, TimeUnit.SECONDS);
- return status != null
- && status.isOK();
- } catch (Exception e) {
- ErrorDialog.openError(getShell(), "Error", "Could not create local git repository.",
- new Status(IStatus.ERROR, OpenShiftUIActivator.PLUGIN_ID,
- "An exception occurred while creating local git repository.", e));
- return false;
- }
- }
-
- private boolean askForConfirmation(final String applicationName, final String projectName) {
- final boolean[] confirmed = new boolean[1];
- getShell().getDisplay().syncExec(new Runnable() {
-
- @Override
- public void run() {
- confirmed[0] = MessageDialog.openConfirm(getShell(),
- NLS.bind("Import OpenShift Application ", applicationName),
- NLS.bind(
- "OpenShift application {0} will be enabled on project {1} by copying OpenShift " +
- "configuration and enable Git for the project.\n " +
- "This cannot be undone. Do you wish to continue ?", applicationName, projectName));
- }});
- return confirmed[0];
- }
-
- private void openWarning(final String title, final String message) {
- getShell().getDisplay().syncExec(new Runnable() {
-
- @Override
- public void run() {
- MessageDialog.openWarning(getShell(), title, message);
- }
- });
- }
-
- @Override
- public void addPages() {
- this.model = new ImportProjectWizardModel();
- addPage(new CredentialsWizardPage(this, model));
- addPage(new ApplicationWizardPage(this, model));
- addPage(new AdapterWizardPage(this, model));
- }
-
- private boolean isTransportException(InvocationTargetException e) {
- return e.getTargetException() instanceof JGitInternalException
- && e.getTargetException().getCause() instanceof TransportException;
- }
-
- private TransportException getTransportException(InvocationTargetException e) {
- if (isTransportException(e)) {
- return (TransportException) ((JGitInternalException) e.getTargetException()).getCause();
- }
- return null;
- }
-}
Deleted: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ImportProjectWizardModel.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ImportProjectWizardModel.java 2011-12-09 15:09:56 UTC (rev 37166)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ImportProjectWizardModel.java 2011-12-09 15:09:56 UTC (rev 37167)
@@ -1,557 +0,0 @@
-/*******************************************************************************
- * 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 java.lang.reflect.InvocationTargetException;
-import java.net.MalformedURLException;
-import java.net.URISyntaxException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.egit.core.RepositoryUtil;
-import org.eclipse.egit.core.op.CloneOperation;
-import org.eclipse.egit.ui.Activator;
-import org.eclipse.jgit.lib.Constants;
-import org.eclipse.jgit.lib.Repository;
-import org.eclipse.jgit.transport.JschConfigSessionFactory;
-import org.eclipse.jgit.transport.URIish;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.wst.common.componentcore.internal.util.ComponentUtilities;
-import org.eclipse.wst.server.core.IModule;
-import org.eclipse.wst.server.core.IRuntime;
-import org.eclipse.wst.server.core.IServer;
-import org.eclipse.wst.server.core.IServerType;
-import org.eclipse.wst.server.core.IServerWorkingCopy;
-import org.eclipse.wst.server.core.ServerUtil;
-import org.eclipse.wst.server.core.internal.Server;
-import org.jboss.ide.eclipse.as.core.util.FileUtil;
-import org.jboss.tools.common.ui.databinding.ObservableUIPojo;
-import org.jboss.tools.openshift.egit.core.EGitUtils;
-import org.jboss.tools.openshift.egit.core.GitIgnore;
-import org.jboss.tools.openshift.express.client.IApplication;
-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.core.behaviour.ExpressServerUtils;
-import org.jboss.tools.openshift.express.internal.ui.OpenShiftUIActivator;
-import org.jboss.tools.openshift.express.internal.ui.common.FileUtils;
-import org.jboss.tools.openshift.express.internal.ui.common.MavenImportFailedException;
-import org.jboss.tools.openshift.express.internal.ui.common.WontOverwriteException;
-import org.jboss.tools.openshift.express.internal.ui.wizard.projectimport.GeneralProjectImportOperation;
-import org.jboss.tools.openshift.express.internal.ui.wizard.projectimport.MavenProjectImportOperation;
-
-/**
- * @author André Dietisheim <adietish(a)redhat.com>
- */
-public class ImportProjectWizardModel extends ObservableUIPojo {
-
- private static final int CLONE_TIMEOUT = 10 * 1024;
-
- private HashMap<String, Object> dataModel = new HashMap<String, Object>();
-
- public static final String NEW_PROJECT = "enableProject";
- public static final String USER = "user";
- public static final String APPLICATION = "application";
- public static final String REMOTE_NAME = "remoteName";
- public static final String REPOSITORY_PATH = "repositoryPath";
- public static final String PROJECT_NAME = "projectName";
- public static final String MERGE_URI = "mergeUri";
-
- public ImportProjectWizardModel() {
- dataModel.put(NEW_PROJECT, false);
- }
-
- /**
- * Returns the destination folder that the OpenShift application will get
- * cloned to.
- *
- * @return the destination that the application will get cloned to.
- *
- * @see #setRepositoryPath(String)
- * @see #getRepositoryPath()
- * @see #getApplicationName()
- */
- public File getCloneDestination() {
- String repositoryPath = getRepositoryPath();
- if (repositoryPath == null
- || repositoryPath.length() == 0) {
- return null;
- }
- return new File(repositoryPath, getApplicationName());
- }
-
- private void shareProject(IProject project, IProgressMonitor monitor) throws CoreException {
- monitor.subTask(NLS.bind("Sharing project {0}...", project.getName()));
- EGitUtils.share(project, monitor);
- }
-
- /**
- * Copies the openshift configuration from the given source folder to the
- * given project.
- *
- * @param sourceFolder
- * the source to copy the openshift config from
- * @param project
- * the project to copy the configuration to.
- * @param monitor
- * the monitor to report progress to
- * @throws IOException
- */
- private void copyOpenshiftConfiguration(final File sourceFolder, IProject project, IProgressMonitor monitor)
- throws IOException {
- Assert.isLegal(project != null);
- File projectFolder = project.getLocation().toFile();
- monitor.subTask(NLS.bind("Copying openshift configuration to project {0}...", project.getName()));
- FileUtils.copy(new File(sourceFolder, ".git"), projectFolder, false);
- FileUtils.copy(new File(sourceFolder, ".openshift"), projectFolder, false);
- FileUtils.copy(new File(sourceFolder, "deployments"), projectFolder, false);
- FileUtils.copy(new File(sourceFolder, "pom.xml"), projectFolder, false);
- createGitIgnore(projectFolder);
- }
-
- /**
- * Creates the git ignore file with a predefined set of entries. An existing
- * .gitignore file is not overwritten, we then just dont do anything.
- *
- * @param projectFolder
- * @throws IOException
- */
- private void createGitIgnore(File projectFolder) throws IOException {
- GitIgnore gitIgnore = new GitIgnore(projectFolder);
- // TODO: merge existing .gitignore
- // (https://issues.jboss.org/browse/JBIDE-10391)
- if (gitIgnore.exists()) {
- return;
- }
- gitIgnore.add("target")
- .add(".settings")
- .add(".project")
- .add(".classpath")
- .add(".factorypath");
- gitIgnore.write(false);
- }
-
- /**
- * Imports the project that the user has chosen into the workspace.
- *
- * @param monitor
- * the monitor to report progress to
- * @throws OpenShiftException
- * @throws CoreException
- * @throws InterruptedException
- * @throws URISyntaxException
- * @throws InvocationTargetException
- *
- * @see #setProjectName(String)
- * @see #getProjectName()
- * @see #
- */
- public void importProject(IProgressMonitor monitor)
- throws OpenShiftException, CoreException, InterruptedException, URISyntaxException,
- InvocationTargetException {
- File cloneDestination = getCloneDestination();
- if (cloneDestination != null
- && cloneDestination.exists()) {
- throw new WontOverwriteException(
- NLS.bind(
- "There's already a folder at {0}. The new OpenShift project would overwrite it. " +
- "Please choose another destination to clone to.",
- cloneDestination.getAbsolutePath()));
- }
- File repositoryFolder = cloneRepository(getApplication(), getRemoteName(), getCloneDestination(), monitor);
- List<IProject> importedProjects = importProjectsFrom(repositoryFolder, monitor);
- if (importedProjects.size() == 0) {
- throw new MavenImportFailedException(
- "The maven import failed. One of the possible reasons is that there's already a project " +
- "in your workspace that matches the maven name of the OpenShift application. " +
- "Please rename your workspace project in that case and start over again.");
- }
-
- connectToGitRepo(importedProjects, repositoryFolder, monitor);
- if (isCreateServer()) {
- createServerAdapter(
- importedProjects, getServerType(), getRuntime(), getMode(), getApplication(), getUser(), monitor);
- }
- }
-
- /**
- * Enables the user chosen project to be used on the chosen OpenShift
- * application. Clones the application git repository, copies the
- * configuration files to the user project (in the workspace), shares the
- * user project with git and creates the server adapter.
- *
- * @param monitor
- * the monitor to report progress to
- * @throws URISyntaxException
- * The OpenShift application repository could not be cloned,
- * because the uri it is located at is not a valid git uri
- * @throws OpenShiftException
- *
- * @throws InvocationTargetException
- * The OpenShift application repository could not be cloned, the
- * clone operation failed.
- * @throws InterruptedException
- * The OpenShift application repository could not be cloned, the
- * clone operation was interrupted.
- * @throws IOException
- * The configuration files could not be copied from the git
- * clone to the user project
- * @throws CoreException
- * The user project could not be shared with the git
- *
- * @see #cloneRepository
- * @see #copyOpenshiftConfiguration
- * @see #shareProject
- * @see #createServerAdapterIfRequired
- */
- public void addToExistingProject(IProgressMonitor monitor)
- throws OpenShiftException, InvocationTargetException, InterruptedException, IOException, CoreException,
- URISyntaxException {
- // File repositoryFile =
- // model.cloneRepository(monitor);
- // model.importProject(repositoryFile, monitor);
- // Repository repository =
- // model.shareProject(monitor);
- // model.mergeWithApplicationRepository(repository,
- // monitor);
- IApplication application = getApplication();
- File tmpFolder = FileUtils.getRandomTmpFolder();
- File repositoryFile = cloneRepository(application, getRemoteName(), tmpFolder, monitor);
- String projectName = getProjectName();
- IProject project = getProject(projectName);
- copyOpenshiftConfiguration(repositoryFile, project, monitor);
- FileUtil.safeDelete(tmpFolder);
-
- shareProject(project, monitor);
- if (isCreateServer()) {
- createServerAdapter(
- project, getServerType(), getRuntime(), getMode(), application, getUser(), monitor);
- }
- }
-
- @SuppressWarnings("unused")
- private void mergeWithApplicationRepository(Repository repository, IProgressMonitor monitor)
- throws MalformedURLException, URISyntaxException, IOException, OpenShiftException, CoreException,
- InvocationTargetException {
- String uri = getApplication().getGitUri();
- EGitUtils.addRemoteTo("openshift", new URIish(uri), repository);
- EGitUtils.mergeWithRemote(new URIish(uri), "refs/remotes/openshift/HEAD", repository, monitor);
- }
-
- /**
- * Imports the projects that are within the given folder. Supports maven and
- * general projects
- *
- * @param folder
- * the folder the projects are located in
- * @param monitor
- * the monitor to report progress to
- * @return
- * @throws CoreException
- * @throws InterruptedException
- */
- private List<IProject> importProjectsFrom(final File folder, IProgressMonitor monitor)
- throws CoreException, InterruptedException {
- MavenProjectImportOperation mavenImport = new MavenProjectImportOperation(folder);
- List<IProject> importedProjects = Collections.emptyList();
- if (mavenImport.isMavenProject()) {
- importedProjects = mavenImport.importToWorkspace(monitor);
- } else {
- importedProjects = new GeneralProjectImportOperation(folder).importToWorkspace(monitor);
- }
- return importedProjects;
- }
-
- private void connectToGitRepo(List<IProject> projects, File projectFolder, IProgressMonitor monitor)
- throws CoreException {
- for (IProject project : projects) {
- if (project != null) {
- EGitUtils.connect(project, monitor);
- }
- }
- }
-
- /**
- * Clones the repository of the selected OpenShift application to the user
- * provided path
- *
- * @param monitor
- * the monitor to report progress to
- * @return
- * @throws URISyntaxException
- * @throws OpenShiftException
- * @throws InvocationTargetException
- * @throws InterruptedException
- *
- * @see ImportProjectWizardModel#getApplication()
- * @see #getRepositoryPath()
- */
- private File cloneRepository(IApplication application, String remoteName, File destination, IProgressMonitor monitor)
- throws OpenShiftException, InvocationTargetException, InterruptedException, URISyntaxException {
- monitor.subTask(NLS.bind("Cloning repository for application {0}...", application.getName()));
- cloneRepository(application.getGitUri(), remoteName, destination, monitor);
- return destination;
- }
-
- private void cloneRepository(String uri, String remoteName, File destination, IProgressMonitor monitor)
- throws OpenShiftException, URISyntaxException, InvocationTargetException, InterruptedException {
- ensureEgitUIIsStarted();
- URIish gitUri = new URIish(uri);
- CloneOperation cloneOperation =
- new CloneOperation(gitUri, true, null, destination, Constants.HEAD, remoteName, CLONE_TIMEOUT);
- cloneOperation.run(monitor);
- RepositoryUtil repositoryUtil = Activator.getDefault().getRepositoryUtil();
- repositoryUtil.addConfiguredRepository(new File(destination, Constants.DOT_GIT));
- }
-
- /**
- * Returns the workspace project with the given name if it exists. Returns
- * <code>null</code> otherwise.
- *
- * @param name
- * the project name
- * @return the project with the given name
- */
- public IProject getProject(String name) {
- IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(name);
- Assert.isTrue(project != null && project.exists(),
- NLS.bind("Could not find project {0} in your workspace.", name));
- return project;
- }
-
- /**
- * The EGit UI plugin initializes the ssh factory to present the user a
- * passphrase prompt if the ssh key was not read yet. If this initialization
- * is not executed, the ssh connection to the git repo would just fail with
- * an authentication error. We therefore have to make sure that the EGit UI
- * plugin is started and initializes the JSchConfigSessionFactory.
- * <p>
- * EGit initializes the SshSessionFactory with the EclipseSshSessionFactory.
- * The EclipseSshSessionFactory overrides JschConfigSessionFactory#configure
- * to present a UserInfoPrompter if the key passphrase was not entered
- * before.
- *
- * @see Activator#start(org.osgi.framework.BundleContext)
- * @see Activator#setupSSH
- * @see JschConfigSessionFactory#configure
- * @see EclipseSshSessionFactory#configure
- */
- private void ensureEgitUIIsStarted() {
- Activator.getDefault();
- }
-
- /**
- * creates an OpenShift server adapter for the user chosen project.
- *
- * @param monitor
- * the monitor to report progress to.
- * @throws OpenShiftException
- */
- private void createServerAdapter(IProject project, IServerType serverType, IRuntime runtime, String mode,
- IApplication application, IUser user, IProgressMonitor monitor) throws OpenShiftException {
- String name = project.getName();
- monitor.subTask(NLS.bind("Creating server adapter for project {0}", name));
- createServerAdapter(Collections.singletonList(project), serverType, runtime, mode, application, user,
- monitor);
- }
-
- private void createServerAdapter(List<IProject> importedProjects, IServerType serverType,
- IRuntime runtime, String mode, IApplication application, IUser user, IProgressMonitor monitor) {
- try {
- renameWebContextRoot(importedProjects);
- IServer server = doCreateServerAdapter(serverType, runtime, mode, application, user);
- addModules(getModules(importedProjects), server, monitor);
- } catch (CoreException ce) {
- OpenShiftUIActivator.getDefault().getLog().log(ce.getStatus());
- } catch (OpenShiftException ose) {
- IStatus s = new Status(IStatus.ERROR, OpenShiftUIActivator.PLUGIN_ID,
- "Cannot create openshift server adapter", ose);
- OpenShiftUIActivator.getDefault().getLog().log(s);
- }
- }
-
- private void renameWebContextRoot(List<IProject> importedProjects) {
- for (IProject project : importedProjects) {
- ComponentUtilities.setServerContextRoot(project, "/");
- }
- }
-
- private IServer doCreateServerAdapter(IServerType serverType, IRuntime rt, String mode, IApplication application,
- IUser user) throws CoreException,
- OpenShiftException {
- Assert.isLegal(serverType != null);
- Assert.isLegal(rt != null);
- Assert.isLegal(mode != null);
- Assert.isLegal(application != null);
- Assert.isLegal(user != null);
-
- String serverNameBase = application.getName() + " OpenShift Server";
- String serverName = org.jboss.ide.eclipse.as.core.util.ServerUtil.getDefaultServerName(serverNameBase);
-
- IServer server = ExpressServerUtils.createServer(rt, serverType, serverName);
- ExpressServerUtils.fillServerWithOpenShiftDetails(server, application.getApplicationUrl(),
- user.getRhlogin(), user.getPassword(),
- user.getDomain().getNamespace(), application.getName(), application.getUUID(), mode);
- return server;
- }
-
- private void addModules(List<IModule> modules, IServer server, IProgressMonitor monitor) throws CoreException {
- if (modules == null
- || modules.size() == 0) {
- return;
- }
- IServerWorkingCopy wc = server.createWorkingCopy();
- IModule[] add = modules.toArray(new IModule[modules.size()]);
- wc.modifyModules(add, new IModule[0], new NullProgressMonitor());
- server = wc.save(true, monitor);
- ((Server) server).setModulePublishState(add, IServer.PUBLISH_STATE_NONE);
- }
-
- private List<IModule> getModules(List<IProject> importedProjects) {
- Iterator<IProject> i = importedProjects.iterator();
- ArrayList<IModule> toAdd = new ArrayList<IModule>();
- while (i.hasNext()) {
- IProject p = i.next();
- IModule[] m = ServerUtil.getModules(p);
- if (m != null && m.length > 0) {
- toAdd.addAll(Arrays.asList(m));
- }
- }
- return toAdd;
- }
-
- public Object setProperty(String key, Object value) {
- Object oldVal = dataModel.get(key);
- dataModel.put(key, value);
- firePropertyChange(key, oldVal, value);
- return value;
- }
-
- public Object getProperty(String key) {
- return dataModel.get(key);
- }
-
- public void setUser(IUser user) {
- setProperty(USER, user);
- }
-
- public IUser getUser() {
- return (IUser) getProperty(USER);
- }
-
- public IApplication getApplication() {
- return (IApplication) getProperty(APPLICATION);
- }
-
- public String getApplicationName() {
- String applicationName = null;
- IApplication application = getApplication();
- if (application != null) {
- applicationName = application.getName();
- }
- return applicationName;
- }
-
- public ICartridge getApplicationCartridge() {
- ICartridge cartridge = null;
- IApplication application = getApplication();
- if (application != null) {
- cartridge = application.getCartridge();
- }
- return cartridge;
- }
-
- public String getApplicationCartridgeName() {
- String cartridgeName = null;
- ICartridge cartridge = getApplicationCartridge();
- if (cartridge != null) {
- cartridgeName = cartridge.getName();
- }
- return cartridgeName;
- }
-
- public void setApplication(IApplication application) {
- setProperty(APPLICATION, application);
- }
-
- public String setRemoteName(String remoteName) {
- setProperty(REMOTE_NAME, remoteName);
- return remoteName;
- }
-
- public String getRemoteName() {
- return (String) getProperty(REMOTE_NAME);
- }
-
- public String setRepositoryPath(String repositoryPath) {
- return (String) setProperty(REPOSITORY_PATH, repositoryPath);
- }
-
- public String getRepositoryPath() {
- return (String) getProperty(REPOSITORY_PATH);
- }
-
- public boolean isNewProject() {
- return (Boolean) getProperty(NEW_PROJECT);
- }
-
- public Boolean setNewProject(boolean newProject) {
- return (Boolean) setProperty(NEW_PROJECT, newProject);
- }
-
- public String setProjectName(String projectName) {
- return (String) setProperty(PROJECT_NAME, projectName);
- }
-
- public String getProjectName() {
- return (String) getProperty(PROJECT_NAME);
- }
-
- public String setMergeUri(String mergeUri) {
- return (String) setProperty(MERGE_URI, mergeUri);
- }
-
- public String getMergeUri() {
- return (String) getProperty(MERGE_URI);
- }
-
- public IServerType getServerType() {
- return (IServerType) getProperty(AdapterWizardPageModel.SERVER_TYPE);
- }
-
- public IRuntime getRuntime() {
- return (IRuntime) getProperty(AdapterWizardPageModel.RUNTIME_DELEGATE);
- }
-
- public String getMode() {
- return (String) getProperty(AdapterWizardPageModel.MODE);
- }
-
- public boolean isCreateServer() {
- Boolean isCreateServer = (Boolean) getProperty(AdapterWizardPageModel.CREATE_SERVER);
- return isCreateServer != null
- && isCreateServer.booleanValue();
- }
-}
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewDomainDialog.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewDomainDialog.java 2011-12-09 15:09:56 UTC (rev 37166)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewDomainDialog.java 2011-12-09 15:09:56 UTC (rev 37167)
@@ -20,6 +20,7 @@
import org.eclipse.osgi.util.NLS;
import org.jboss.tools.common.ui.WizardUtils;
import org.jboss.tools.openshift.express.internal.ui.OpenShiftUIActivator;
+import org.jboss.tools.openshift.express.internal.ui.wizard.appimport.ImportProjectWizardModel;
/**
* @author André Dietisheim
Added: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/AbstractImportApplicationStrategy.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/AbstractImportApplicationStrategy.java (rev 0)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/AbstractImportApplicationStrategy.java 2011-12-09 15:09:56 UTC (rev 37167)
@@ -0,0 +1,260 @@
+/*******************************************************************************
+ * 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.appimport;
+
+import java.io.File;
+import java.lang.reflect.InvocationTargetException;
+import java.net.URISyntaxException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.egit.core.RepositoryUtil;
+import org.eclipse.egit.core.op.CloneOperation;
+import org.eclipse.egit.ui.Activator;
+import org.eclipse.jgit.lib.Constants;
+import org.eclipse.jgit.transport.JschConfigSessionFactory;
+import org.eclipse.jgit.transport.URIish;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.wst.common.componentcore.internal.util.ComponentUtilities;
+import org.eclipse.wst.server.core.IModule;
+import org.eclipse.wst.server.core.IRuntime;
+import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.core.IServerType;
+import org.eclipse.wst.server.core.IServerWorkingCopy;
+import org.eclipse.wst.server.core.ServerUtil;
+import org.eclipse.wst.server.core.internal.Server;
+import org.jboss.tools.openshift.express.client.IApplication;
+import org.jboss.tools.openshift.express.client.IUser;
+import org.jboss.tools.openshift.express.client.OpenShiftException;
+import org.jboss.tools.openshift.express.internal.core.behaviour.ExpressServerUtils;
+import org.jboss.tools.openshift.express.internal.ui.OpenShiftUIActivator;
+
+/**
+ * @author André Dietisheim <adietish(a)redhat.com>
+ */
+abstract class AbstractImportApplicationStrategy implements IImportApplicationStrategy {
+
+ private static final int CLONE_TIMEOUT = 10 * 1024;
+
+ private String projectName;
+ private IApplication application;
+ private String remoteName;
+ private boolean isCreateServer;
+ private IServerType serverType;
+ private IRuntime runtime;
+ private String mode;
+ private IUser user;
+
+ public AbstractImportApplicationStrategy(String projectName, IApplication application, String remoteName,
+ boolean isCreateServer, IServerType serverType, IRuntime runtime, String mode,
+ IUser user) {
+ this.projectName = projectName;
+ this.application = application;
+ this.remoteName = remoteName;
+ this.isCreateServer = isCreateServer;
+ this.serverType = serverType;
+ this.runtime = runtime;
+ this.mode = mode;
+ this.user = user;
+ }
+
+ /**
+ * Clones the repository of the selected OpenShift application to the user
+ * provided path
+ *
+ * @param monitor
+ * the monitor to report progress to
+ * @return
+ * @throws URISyntaxException
+ * @throws OpenShiftException
+ * @throws InvocationTargetException
+ * @throws InterruptedException
+ *
+ * @see AbstractImportApplicationStrategy#getApplication()
+ * @see #getRepositoryPath()
+ */
+ protected File cloneRepository(IApplication application, String remoteName, File destination, IProgressMonitor monitor)
+ throws OpenShiftException, InvocationTargetException, InterruptedException, URISyntaxException {
+ monitor.subTask(NLS.bind("Cloning repository for application {0}...", application.getName()));
+ cloneRepository(application.getGitUri(), remoteName, destination, monitor);
+ return destination;
+ }
+
+ private void cloneRepository(String uri, String remoteName, File destination, IProgressMonitor monitor)
+ throws OpenShiftException, URISyntaxException, InvocationTargetException, InterruptedException {
+ ensureEgitUIIsStarted();
+ URIish gitUri = new URIish(uri);
+ CloneOperation cloneOperation =
+ new CloneOperation(gitUri, true, null, destination, Constants.HEAD, remoteName, CLONE_TIMEOUT);
+ cloneOperation.run(monitor);
+ RepositoryUtil repositoryUtil = Activator.getDefault().getRepositoryUtil();
+ repositoryUtil.addConfiguredRepository(new File(destination, Constants.DOT_GIT));
+ }
+
+ /**
+ * The EGit UI plugin initializes the ssh factory to present the user a
+ * passphrase prompt if the ssh key was not read yet. If this initialization
+ * is not executed, the ssh connection to the git repo would just fail with
+ * an authentication error. We therefore have to make sure that the EGit UI
+ * plugin is started and initializes the JSchConfigSessionFactory.
+ * <p>
+ * EGit initializes the SshSessionFactory with the EclipseSshSessionFactory.
+ * The EclipseSshSessionFactory overrides JschConfigSessionFactory#configure
+ * to present a UserInfoPrompter if the key passphrase was not entered
+ * before.
+ *
+ * @see Activator#start(org.osgi.framework.BundleContext)
+ * @see Activator#setupSSH
+ * @see JschConfigSessionFactory#configure
+ * @see EclipseSshSessionFactory#configure
+ */
+ private void ensureEgitUIIsStarted() {
+ Activator.getDefault();
+ }
+
+ /**
+ * creates an OpenShift server adapter for the user chosen project.
+ *
+ * @param monitor
+ * the monitor to report progress to.
+ * @throws OpenShiftException
+ */
+ protected void createServerAdapter(IProject project, IServerType serverType, IRuntime runtime, String mode,
+ IApplication application, IUser user, IProgressMonitor monitor) throws OpenShiftException {
+ String name = project.getName();
+ monitor.subTask(NLS.bind("Creating server adapter for project {0}", name));
+ createServerAdapter(Collections.singletonList(project), serverType, runtime, mode, application, user,
+ monitor);
+ }
+
+ protected void createServerAdapter(List<IProject> importedProjects, IServerType serverType,
+ IRuntime runtime, String mode, IApplication application, IUser user, IProgressMonitor monitor) {
+ try {
+ renameWebContextRoot(importedProjects);
+ IServer server = doCreateServerAdapter(serverType, runtime, mode, application, user);
+ addModules(getModules(importedProjects), server, monitor);
+ } catch (CoreException ce) {
+ OpenShiftUIActivator.getDefault().getLog().log(ce.getStatus());
+ } catch (OpenShiftException ose) {
+ IStatus s = new Status(IStatus.ERROR, OpenShiftUIActivator.PLUGIN_ID,
+ "Cannot create openshift server adapter", ose);
+ OpenShiftUIActivator.getDefault().getLog().log(s);
+ }
+ }
+
+ private void renameWebContextRoot(List<IProject> importedProjects) {
+ for (IProject project : importedProjects) {
+ ComponentUtilities.setServerContextRoot(project, "/");
+ }
+ }
+
+ private IServer doCreateServerAdapter(IServerType serverType, IRuntime rt, String mode, IApplication application,
+ IUser user) throws CoreException,
+ OpenShiftException {
+ Assert.isLegal(serverType != null);
+ Assert.isLegal(mode != null);
+ Assert.isLegal(application != null);
+ Assert.isLegal(user != null);
+
+ String serverNameBase = application.getName() + " OpenShift Server";
+ String serverName = org.jboss.ide.eclipse.as.core.util.ServerUtil.getDefaultServerName(serverNameBase);
+
+ IServer server = ExpressServerUtils.createServer(rt, serverType, serverName);
+ ExpressServerUtils.fillServerWithOpenShiftDetails(server, application.getApplicationUrl(),
+ user.getRhlogin(), user.getPassword(),
+ user.getDomain().getNamespace(), application.getName(), application.getUUID(), mode);
+ return server;
+ }
+
+ private void addModules(List<IModule> modules, IServer server, IProgressMonitor monitor) throws CoreException {
+ if (modules == null
+ || modules.size() == 0) {
+ return;
+ }
+ IServerWorkingCopy wc = server.createWorkingCopy();
+ IModule[] add = modules.toArray(new IModule[modules.size()]);
+ wc.modifyModules(add, new IModule[0], new NullProgressMonitor());
+ server = wc.save(true, monitor);
+ ((Server) server).setModulePublishState(add, IServer.PUBLISH_STATE_NONE);
+ }
+
+ private List<IModule> getModules(List<IProject> importedProjects) {
+ Iterator<IProject> i = importedProjects.iterator();
+ ArrayList<IModule> toAdd = new ArrayList<IModule>();
+ while (i.hasNext()) {
+ IProject p = i.next();
+ IModule[] m = ServerUtil.getModules(p);
+ if (m != null && m.length > 0) {
+ toAdd.addAll(Arrays.asList(m));
+ }
+ }
+ return toAdd;
+ }
+
+ public String getProjectName() {
+ return projectName;
+ }
+
+ /**
+ * Returns the workspace project with the given name if it exists. Returns
+ * <code>null</code> otherwise.
+ *
+ * @param name
+ * the project name
+ * @return the project with the given name
+ */
+ protected IProject getProject(String name) {
+ IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(name);
+ Assert.isTrue(project != null && project.exists(),
+ NLS.bind("Could not find project {0} in your workspace.", name));
+ return project;
+ }
+
+ public IApplication getApplication() {
+ return application;
+ }
+
+ public String getRemoteName() {
+ return remoteName;
+ }
+
+ public boolean isCreateServer() {
+ return isCreateServer;
+ }
+
+ public IServerType getServerType() {
+ return serverType;
+ }
+
+ public IRuntime getRuntime() {
+ return runtime;
+ }
+
+ public String getMode() {
+ return mode;
+ }
+
+ public IUser getUser() {
+ return user;
+ }
+
+}
Property changes on: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/AbstractImportApplicationStrategy.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/AddToExistingProjectStrategy.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/AddToExistingProjectStrategy.java (rev 0)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/AddToExistingProjectStrategy.java 2011-12-09 15:09:56 UTC (rev 37167)
@@ -0,0 +1,161 @@
+/*******************************************************************************
+ * 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.appimport;
+
+import java.io.File;
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+import java.net.MalformedURLException;
+import java.net.URISyntaxException;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jgit.lib.Repository;
+import org.eclipse.jgit.transport.URIish;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.wst.server.core.IRuntime;
+import org.eclipse.wst.server.core.IServerType;
+import org.jboss.ide.eclipse.as.core.util.FileUtil;
+import org.jboss.tools.openshift.egit.core.EGitUtils;
+import org.jboss.tools.openshift.egit.core.GitIgnore;
+import org.jboss.tools.openshift.express.client.IApplication;
+import org.jboss.tools.openshift.express.client.IUser;
+import org.jboss.tools.openshift.express.client.OpenShiftException;
+import org.jboss.tools.openshift.express.internal.ui.common.FileUtils;
+
+/**
+ * @author André Dietisheim <adietish(a)redhat.com>
+ */
+public class AddToExistingProjectStrategy extends AbstractImportApplicationStrategy {
+
+ public AddToExistingProjectStrategy(String projectName, IApplication application, String remoteName,
+ boolean isCreateServer, IServerType serverType, IRuntime runtime, String mode,
+ IUser user) {
+ super(projectName, application, remoteName, isCreateServer, serverType, runtime, mode, user);
+ }
+
+ /**
+ * Enables the user chosen project to be used on the chosen OpenShift
+ * application. Clones the application git repository, copies the
+ * configuration files to the user project (in the workspace), shares the
+ * user project with git and creates the server adapter.
+ *
+ * @param monitor
+ * the monitor to report progress to
+ * @throws URISyntaxException
+ * The OpenShift application repository could not be cloned,
+ * because the uri it is located at is not a valid git uri
+ * @throws OpenShiftException
+ *
+ * @throws InvocationTargetException
+ * The OpenShift application repository could not be cloned, the
+ * clone operation failed.
+ * @throws InterruptedException
+ * The OpenShift application repository could not be cloned, the
+ * clone operation was interrupted.
+ * @throws IOException
+ * The configuration files could not be copied from the git
+ * clone to the user project
+ * @throws CoreException
+ * The user project could not be shared with the git
+ *
+ * @see #cloneRepository
+ * @see #copyOpenshiftConfiguration
+ * @see #shareProject
+ * @see #createServerAdapterIfRequired
+ */
+ @Override
+ public void execute(IProgressMonitor monitor)
+ throws OpenShiftException, InvocationTargetException, InterruptedException, IOException, CoreException,
+ URISyntaxException {
+ // File repositoryFile =
+ // model.cloneRepository(monitor);
+ // model.importProject(repositoryFile, monitor);
+ // Repository repository =
+ // model.shareProject(monitor);
+ // model.mergeWithApplicationRepository(repository,
+ // monitor);
+ File tmpFolder = FileUtils.getRandomTmpFolder();
+ File repositoryFile = cloneRepository(getApplication(), getRemoteName(), tmpFolder, monitor);
+ IProject project = getProject(getProjectName());
+ copyOpenshiftConfiguration(repositoryFile, project, monitor);
+ FileUtil.safeDelete(tmpFolder);
+
+ shareProject(project, monitor);
+ if (isCreateServer()) {
+ createServerAdapter(
+ project, getServerType(), getRuntime(), getMode(), getApplication(), getUser(), monitor);
+ }
+ }
+
+ private void shareProject(IProject project, IProgressMonitor monitor) throws CoreException {
+ monitor.subTask(NLS.bind("Sharing project {0}...", project.getName()));
+ EGitUtils.share(project, monitor);
+ }
+
+ /**
+ * Copies the openshift configuration from the given source folder to the
+ * given project.
+ *
+ * @param sourceFolder
+ * the source to copy the openshift config from
+ * @param project
+ * the project to copy the configuration to.
+ * @param monitor
+ * the monitor to report progress to
+ * @throws IOException
+ */
+ private void copyOpenshiftConfiguration(final File sourceFolder, IProject project, IProgressMonitor monitor)
+ throws IOException {
+ Assert.isLegal(project != null);
+ File projectFolder = project.getLocation().toFile();
+ monitor.subTask(NLS.bind("Copying openshift configuration to project {0}...", project.getName()));
+ FileUtils.copy(new File(sourceFolder, ".git"), projectFolder, false);
+ FileUtils.copy(new File(sourceFolder, ".openshift"), projectFolder, false);
+ FileUtils.copy(new File(sourceFolder, "deployments"), projectFolder, false);
+ FileUtils.copy(new File(sourceFolder, "pom.xml"), projectFolder, false);
+ createGitIgnore(projectFolder);
+ }
+
+ /**
+ * Creates the git ignore file with a predefined set of entries. An existing
+ * .gitignore file is not overwritten, we then just dont do anything.
+ *
+ * @param projectFolder
+ * @throws IOException
+ */
+ private void createGitIgnore(File projectFolder) throws IOException {
+ GitIgnore gitIgnore = new GitIgnore(projectFolder);
+ // TODO: merge existing .gitignore
+ // (https://issues.jboss.org/browse/JBIDE-10391)
+ if (gitIgnore.exists()) {
+ return;
+ }
+ gitIgnore.add("target")
+ .add(".settings")
+ .add(".project")
+ .add(".classpath")
+ .add(".factorypath");
+ gitIgnore.write(false);
+ }
+
+ @SuppressWarnings("unused")
+ private void mergeWithApplicationRepository(Repository repository, IApplication application,
+ IProgressMonitor monitor)
+ throws MalformedURLException, URISyntaxException, IOException, OpenShiftException, CoreException,
+ InvocationTargetException {
+ URIish uri = new URIish(application.getGitUri());
+ EGitUtils.addRemoteTo("openshift", uri, repository);
+ EGitUtils.mergeWithRemote(uri, "refs/remotes/openshift/HEAD", repository, monitor);
+ }
+}
Property changes on: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/AddToExistingProjectStrategy.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/IImportApplicationStrategy.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/IImportApplicationStrategy.java (rev 0)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/IImportApplicationStrategy.java 2011-12-09 15:09:56 UTC (rev 37167)
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * 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.appimport;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+
+/**
+ * @author André Dietisheim
+ */
+public interface IImportApplicationStrategy {
+
+ public void execute(IProgressMonitor monitor) throws Exception;
+
+}
Property changes on: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/IImportApplicationStrategy.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ImportNewProjectStrategy.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ImportNewProjectStrategy.java (rev 0)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ImportNewProjectStrategy.java 2011-12-09 15:09:56 UTC (rev 37167)
@@ -0,0 +1,144 @@
+/*******************************************************************************
+ * 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.appimport;
+
+import java.io.File;
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+import java.net.MalformedURLException;
+import java.net.URISyntaxException;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jgit.lib.Repository;
+import org.eclipse.jgit.transport.URIish;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.wst.server.core.IRuntime;
+import org.eclipse.wst.server.core.IServerType;
+import org.jboss.tools.openshift.egit.core.EGitUtils;
+import org.jboss.tools.openshift.express.client.IApplication;
+import org.jboss.tools.openshift.express.client.IUser;
+import org.jboss.tools.openshift.express.client.OpenShiftException;
+import org.jboss.tools.openshift.express.internal.ui.common.ImportFailedException;
+import org.jboss.tools.openshift.express.internal.ui.common.WontOverwriteException;
+import org.jboss.tools.openshift.express.internal.ui.wizard.appimport.project.GeneralProjectImportOperation;
+import org.jboss.tools.openshift.express.internal.ui.wizard.appimport.project.MavenProjectImportOperation;
+
+/**
+ * @author André Dietisheim <adietish(a)redhat.com>
+ */
+public class ImportNewProjectStrategy extends AbstractImportApplicationStrategy {
+
+ private File cloneDestination;
+
+ public ImportNewProjectStrategy(String projectName, IApplication application, String remoteName,
+ File cloneDestination, boolean isCreateServer, IServerType serverType, IRuntime runtime, String mode,
+ IUser user) {
+ super(projectName, application, remoteName, isCreateServer, serverType, runtime, mode, user);
+ this.cloneDestination = cloneDestination;
+ }
+
+ /**
+ * Imports the (new) project that the user has chosen into the workspace.
+ *
+ * @param monitor
+ * the monitor to report progress to
+ * @throws OpenShiftException
+ * @throws CoreException
+ * @throws InterruptedException
+ * @throws URISyntaxException
+ * @throws InvocationTargetException
+ */
+ public void execute(IProgressMonitor monitor)
+ throws OpenShiftException, CoreException, InterruptedException, URISyntaxException,
+ InvocationTargetException {
+ if (cloneDestinationExists()) {
+ throw new WontOverwriteException(
+ NLS.bind("There's already a folder at {0}. The new OpenShift project would overwrite it. " +
+ "Please choose another destination to clone to.",
+ getCloneDestination().getAbsolutePath()));
+ }
+
+ File repositoryFolder =
+ cloneRepository(getApplication(), getRemoteName(), cloneDestination, monitor);
+ List<IProject> importedProjects = importProjectsFrom(repositoryFolder, monitor);
+ if (importedProjects.size() == 0) {
+ throw new ImportFailedException(
+ NLS.bind("Could not import project {0}. One of the possible reasons is that there's already a " +
+ "project in your workspace that matches the openshift application/maven name of the " +
+ "OpenShift application. " +
+ "Please rename your workspace project in that case and start over again."
+ , getProjectName()));
+ }
+
+ connectToGitRepo(importedProjects, repositoryFolder, monitor);
+ if (isCreateServer()) {
+ createServerAdapter(importedProjects, getServerType(), getRuntime(), getMode(), getApplication(),
+ getUser(), monitor);
+ }
+ }
+
+ @SuppressWarnings("unused")
+ private void mergeWithApplicationRepository(Repository repository, IApplication application,
+ IProgressMonitor monitor)
+ throws MalformedURLException, URISyntaxException, IOException, OpenShiftException, CoreException,
+ InvocationTargetException {
+ URIish uri = new URIish(application.getGitUri());
+ EGitUtils.addRemoteTo("openshift", uri, repository);
+ EGitUtils.mergeWithRemote(uri, "refs/remotes/openshift/HEAD", repository, monitor);
+ }
+
+ /**
+ * Imports the projects that are within the given folder. Supports maven and
+ * general projects
+ *
+ * @param folder
+ * the folder the projects are located in
+ * @param monitor
+ * the monitor to report progress to
+ * @return
+ * @throws CoreException
+ * @throws InterruptedException
+ */
+ private List<IProject> importProjectsFrom(final File folder, IProgressMonitor monitor)
+ throws CoreException, InterruptedException {
+ MavenProjectImportOperation mavenImport = new MavenProjectImportOperation(folder);
+ List<IProject> importedProjects = Collections.emptyList();
+ if (mavenImport.isMavenProject()) {
+ importedProjects = mavenImport.importToWorkspace(monitor);
+ } else {
+ importedProjects = new GeneralProjectImportOperation(folder).importToWorkspace(monitor);
+ }
+ return importedProjects;
+ }
+
+ private void connectToGitRepo(List<IProject> projects, File projectFolder, IProgressMonitor monitor)
+ throws CoreException {
+ for (IProject project : projects) {
+ if (project != null) {
+ EGitUtils.connect(project, monitor);
+ }
+ }
+ }
+
+ protected File getCloneDestination() {
+ return cloneDestination;
+ }
+
+ protected boolean cloneDestinationExists() {
+ return cloneDestination != null
+ && cloneDestination.exists();
+ }
+
+}
Property changes on: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ImportNewProjectStrategy.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Copied: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ImportProjectWizard.java (from rev 37155, trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ImportProjectWizard.java)
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ImportProjectWizard.java (rev 0)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ImportProjectWizard.java 2011-12-09 15:09:56 UTC (rev 37167)
@@ -0,0 +1,178 @@
+/*******************************************************************************
+ * 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.appimport;
+
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+import java.net.URISyntaxException;
+import java.util.concurrent.ArrayBlockingQueue;
+import java.util.concurrent.TimeUnit;
+
+import org.eclipse.core.resources.WorkspaceJob;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.dialogs.ErrorDialog;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.jgit.api.errors.JGitInternalException;
+import org.eclipse.jgit.errors.TransportException;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.ui.INewWizard;
+import org.eclipse.ui.IWorkbench;
+import org.jboss.tools.common.ui.WizardUtils;
+import org.jboss.tools.openshift.express.client.OpenShiftException;
+import org.jboss.tools.openshift.express.internal.ui.OpenShiftUIActivator;
+import org.jboss.tools.openshift.express.internal.ui.common.ImportFailedException;
+import org.jboss.tools.openshift.express.internal.ui.common.WontOverwriteException;
+import org.jboss.tools.openshift.express.internal.ui.wizard.AdapterWizardPage;
+import org.jboss.tools.openshift.express.internal.ui.wizard.ApplicationWizardPage;
+import org.jboss.tools.openshift.express.internal.ui.wizard.CredentialsWizardPage;
+
+/**
+ * @author André Dietisheim
+ */
+public class ImportProjectWizard extends Wizard implements INewWizard {
+
+ private ImportProjectWizardModel model;
+
+ public ImportProjectWizard() {
+ }
+
+ @Override
+ public void init(IWorkbench workbench, IStructuredSelection selection) {
+ setWindowTitle("OpenShift application wizard");
+ setNeedsProgressMonitor(true);
+ }
+
+ @Override
+ public boolean performFinish() {
+ try {
+ final ArrayBlockingQueue<IStatus> queue = new ArrayBlockingQueue<IStatus>(1);
+ WizardUtils.runInWizard(
+ new WorkspaceJob("Importing project to workspace...") {
+
+ @Override
+ public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
+ IStatus status = Status.OK_STATUS;
+ status = performOperations(monitor, status);
+ if (!status.isOK()) {
+ OpenShiftUIActivator.log(status);
+ }
+ queue.offer(status);
+ return status;
+ }
+
+ private IStatus performOperations(IProgressMonitor monitor, IStatus status) {
+ try {
+ if (model.isNewProject()) {
+ model.importProject(monitor);
+ } else {
+ if (!askForConfirmation(model.getApplicationName(), model.getProjectName())) {
+ return Status.CANCEL_STATUS;
+ }
+ model.addToExistingProject(monitor);
+ }
+ return Status.OK_STATUS;
+ } catch (final WontOverwriteException e) {
+ openWarning("Project already present", e.getMessage());
+ return Status.CANCEL_STATUS;
+ } catch (final ImportFailedException e) {
+ return OpenShiftUIActivator.createErrorStatus(
+ "Could not import maven project {0}.", e,
+ model.getProjectName());
+ } catch (IOException e) {
+ return OpenShiftUIActivator.createErrorStatus(
+ "Could not copy openshift configuration files to project {0}", e,
+ model.getProjectName());
+ } catch (OpenShiftException e) {
+ return OpenShiftUIActivator.createErrorStatus(
+ "Could not import project to the workspace.", e);
+ } catch (URISyntaxException e) {
+ return OpenShiftUIActivator.createErrorStatus(
+ "The url of the remote git repository is not valid", e);
+ } catch (InvocationTargetException e) {
+ if (isTransportException(e)) {
+ TransportException te = getTransportException(e);
+ return OpenShiftUIActivator
+ .createErrorStatus(
+ "Could not clone the repository. Authentication failed.\n"
+ + " Please make sure that you added your private key to the ssh preferences.",
+ te);
+ } else {
+ return OpenShiftUIActivator.createErrorStatus(
+ "An exception occurred while creating local git repository.", e);
+ }
+ } catch (Exception e) {
+ return OpenShiftUIActivator.createErrorStatus(
+ "Could not import project to the workspace.", e);
+ }
+ }
+ }, getContainer());
+ IStatus status = queue.poll(10, TimeUnit.SECONDS);
+ return status != null
+ && status.isOK();
+ } catch (Exception e) {
+ ErrorDialog.openError(getShell(), "Error", "Could not create local git repository.",
+ new Status(IStatus.ERROR, OpenShiftUIActivator.PLUGIN_ID,
+ "An exception occurred while creating local git repository.", e));
+ return false;
+ }
+ }
+
+ private boolean askForConfirmation(final String applicationName, final String projectName) {
+ final boolean[] confirmed = new boolean[1];
+ getShell().getDisplay().syncExec(new Runnable() {
+
+ @Override
+ public void run() {
+ confirmed[0] = MessageDialog.openConfirm(getShell(),
+ NLS.bind("Import OpenShift Application ", applicationName),
+ NLS.bind(
+ "OpenShift application {0} will be enabled on project {1} by copying OpenShift " +
+ "configuration and enable Git for the project.\n " +
+ "This cannot be undone. Do you wish to continue ?", applicationName, projectName));
+ }});
+ return confirmed[0];
+ }
+
+ private void openWarning(final String title, final String message) {
+ getShell().getDisplay().syncExec(new Runnable() {
+
+ @Override
+ public void run() {
+ MessageDialog.openWarning(getShell(), title, message);
+ }
+ });
+ }
+
+ @Override
+ public void addPages() {
+ this.model = new ImportProjectWizardModel();
+ addPage(new CredentialsWizardPage(this, model));
+ addPage(new ApplicationWizardPage(this, model));
+ addPage(new AdapterWizardPage(this, model));
+ }
+
+ private boolean isTransportException(InvocationTargetException e) {
+ return e.getTargetException() instanceof JGitInternalException
+ && e.getTargetException().getCause() instanceof TransportException;
+ }
+
+ private TransportException getTransportException(InvocationTargetException e) {
+ if (isTransportException(e)) {
+ return (TransportException) ((JGitInternalException) e.getTargetException()).getCause();
+ }
+ return null;
+ }
+}
Copied: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ImportProjectWizardModel.java (from rev 37155, trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ImportProjectWizardModel.java)
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ImportProjectWizardModel.java (rev 0)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ImportProjectWizardModel.java 2011-12-09 15:09:56 UTC (rev 37167)
@@ -0,0 +1,240 @@
+/*******************************************************************************
+ * 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.appimport;
+
+import java.io.File;
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+import java.net.URISyntaxException;
+import java.util.HashMap;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.wst.server.core.IRuntime;
+import org.eclipse.wst.server.core.IServerType;
+import org.jboss.tools.common.ui.databinding.ObservableUIPojo;
+import org.jboss.tools.openshift.express.client.IApplication;
+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.wizard.AdapterWizardPageModel;
+
+/**
+ * @author André Dietisheim <adietish(a)redhat.com>
+ */
+public class ImportProjectWizardModel extends ObservableUIPojo {
+
+ private HashMap<String, Object> dataModel = new HashMap<String, Object>();
+
+ public static final String NEW_PROJECT = "enableProject";
+ public static final String USER = "user";
+ public static final String APPLICATION = "application";
+ public static final String REMOTE_NAME = "remoteName";
+ public static final String REPOSITORY_PATH = "repositoryPath";
+ public static final String PROJECT_NAME = "projectName";
+ public static final String MERGE_URI = "mergeUri";
+ public static final String RUNTIME_DELEGATE = "runtimeDelegate";
+ public static final String CREATE_SERVER = "createServer";
+
+ public ImportProjectWizardModel() {
+ dataModel.put(NEW_PROJECT, false);
+ }
+
+ /**
+ * Imports the project that the user has chosen into the workspace.
+ *
+ * @param monitor
+ * the monitor to report progress to
+ * @throws OpenShiftException
+ * @throws CoreException
+ * @throws InterruptedException
+ * @throws URISyntaxException
+ * @throws InvocationTargetException
+ */
+ public void importProject(IProgressMonitor monitor) throws OpenShiftException, CoreException, InterruptedException,
+ URISyntaxException, InvocationTargetException {
+ new ImportNewProjectStrategy(getProjectName()
+ , getApplication()
+ , getRemoteName()
+ , getRepositoryFile()
+ , isCreateServer()
+ , getServerType()
+ , getRuntime()
+ , getMode()
+ , getUser()).execute(monitor);
+ }
+
+ /**
+ * Enables the user chosen project to be used on the chosen OpenShift
+ * application. Clones the application git repository, copies the
+ * configuration files to the user project (in the workspace), shares the
+ * user project with git and creates the server adapter.
+ *
+ * @param monitor
+ * the monitor to report progress to
+ * @throws URISyntaxException
+ * The OpenShift application repository could not be cloned,
+ * because the uri it is located at is not a valid git uri
+ * @throws OpenShiftException
+ *
+ * @throws InvocationTargetException
+ * The OpenShift application repository could not be cloned, the
+ * clone operation failed.
+ * @throws InterruptedException
+ * The OpenShift application repository could not be cloned, the
+ * clone operation was interrupted.
+ * @throws IOException
+ * The configuration files could not be copied from the git
+ * clone to the user project
+ * @throws CoreException
+ * The user project could not be shared with the git
+ */
+ public void addToExistingProject(IProgressMonitor monitor)
+ throws OpenShiftException, InvocationTargetException, InterruptedException, IOException, CoreException,
+ URISyntaxException {
+ new AddToExistingProjectStrategy(
+ getProjectName()
+ , getApplication()
+ , getRemoteName()
+ , isCreateServer()
+ , getServerType()
+ , getRuntime()
+ , getMode()
+ , getUser())
+ .execute(monitor);
+ }
+
+ public File getRepositoryFile() {
+ String repositoryPath = getRepositoryPath();
+ if (repositoryPath == null
+ || repositoryPath.length() == 0) {
+ return null;
+ }
+ return new File(repositoryPath, getApplicationName());
+ }
+
+ public Object setProperty(String key, Object value) {
+ Object oldVal = dataModel.get(key);
+ dataModel.put(key, value);
+ firePropertyChange(key, oldVal, value);
+ return value;
+ }
+
+ public Object getProperty(String key) {
+ return dataModel.get(key);
+ }
+
+ public void setUser(IUser user) {
+ setProperty(USER, user);
+ }
+
+ public IUser getUser() {
+ return (IUser) getProperty(USER);
+ }
+
+ public IApplication getApplication() {
+ return (IApplication) getProperty(APPLICATION);
+ }
+
+ public String getApplicationName() {
+ String applicationName = null;
+ IApplication application = getApplication();
+ if (application != null) {
+ applicationName = application.getName();
+ }
+ return applicationName;
+ }
+
+ public ICartridge getApplicationCartridge() {
+ ICartridge cartridge = null;
+ IApplication application = getApplication();
+ if (application != null) {
+ cartridge = application.getCartridge();
+ }
+ return cartridge;
+ }
+
+ public String getApplicationCartridgeName() {
+ String cartridgeName = null;
+ ICartridge cartridge = getApplicationCartridge();
+ if (cartridge != null) {
+ cartridgeName = cartridge.getName();
+ }
+ return cartridgeName;
+ }
+
+ public void setApplication(IApplication application) {
+ setProperty(APPLICATION, application);
+ }
+
+ public String setRemoteName(String remoteName) {
+ setProperty(REMOTE_NAME, remoteName);
+ return remoteName;
+ }
+
+ public String getRemoteName() {
+ return (String) getProperty(REMOTE_NAME);
+ }
+
+ public String setRepositoryPath(String repositoryPath) {
+ return (String) setProperty(REPOSITORY_PATH, repositoryPath);
+ }
+
+ public String getRepositoryPath() {
+ return (String) getProperty(REPOSITORY_PATH);
+ }
+
+ public boolean isNewProject() {
+ return (Boolean) getProperty(NEW_PROJECT);
+ }
+
+ public Boolean setNewProject(boolean newProject) {
+ return (Boolean) setProperty(NEW_PROJECT, newProject);
+ }
+
+ public String setProjectName(String projectName) {
+ return (String) setProperty(PROJECT_NAME, projectName);
+ }
+
+ public String getProjectName() {
+ return (String) getProperty(PROJECT_NAME);
+ }
+
+ public String setMergeUri(String mergeUri) {
+ return (String) setProperty(MERGE_URI, mergeUri);
+ }
+
+ public String getMergeUri() {
+ return (String) getProperty(MERGE_URI);
+ }
+
+ public IServerType getServerType() {
+ return (IServerType) getProperty(AdapterWizardPageModel.SERVER_TYPE);
+ }
+
+ public IRuntime getRuntime() {
+ return (IRuntime) getProperty(RUNTIME_DELEGATE);
+ }
+
+ public String getMode() {
+ return (String) getProperty(AdapterWizardPageModel.MODE);
+ }
+
+ public void setCreateServer() {
+
+ }
+
+ public boolean isCreateServer() {
+ Boolean isCreateServer = (Boolean) getProperty(CREATE_SERVER);
+ return isCreateServer != null
+ && isCreateServer.booleanValue();
+ }
+}
Added: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/project/AbstractProjectImportOperation.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/project/AbstractProjectImportOperation.java (rev 0)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/project/AbstractProjectImportOperation.java 2011-12-09 15:09:56 UTC (rev 37167)
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * 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.appimport.project;
+
+import java.io.File;
+
+/**
+ * @author André Dietisheim <adietish(a)redhat.com>
+ */
+public class AbstractProjectImportOperation {
+
+ private File projectFolder;
+
+ public AbstractProjectImportOperation(File projectDirectory) {
+ this.projectFolder = projectDirectory;
+ }
+
+ protected File getProjectDirectory() {
+ return projectFolder;
+ }
+
+ protected boolean isReadable(File destination) {
+ return destination != null
+ && destination.exists()
+ && destination.canRead();
+ }
+}
\ No newline at end of file
Property changes on: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/project/AbstractProjectImportOperation.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/project/GeneralProjectImportOperation.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/project/GeneralProjectImportOperation.java (rev 0)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/project/GeneralProjectImportOperation.java 2011-12-09 15:09:56 UTC (rev 37167)
@@ -0,0 +1,87 @@
+/*******************************************************************************
+ * 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.appimport.project;
+
+import java.io.File;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IProjectDescription;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * @author Andre Dietisheim <adietish(a)redhat.com>
+ *
+ */
+public class GeneralProjectImportOperation extends AbstractProjectImportOperation {
+
+ public GeneralProjectImportOperation(File projectDirectory) {
+ super(projectDirectory);
+ }
+
+ public List<IProject> importToWorkspace(IProgressMonitor monitor)
+ throws CoreException, InterruptedException {
+
+ IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ IProject project = workspace.getRoot().getProject(getProjectDirectory().getName());
+ overwriteExistingProject(project, workspace, monitor);
+ importToWorkspace(getProjectDirectory(), workspace, monitor);
+ return Collections.singletonList(project);
+ }
+
+ private void importToWorkspace(File projectDirectory, IWorkspace workspace, IProgressMonitor monitor)
+ throws CoreException {
+ String projectName = projectDirectory.getName();
+ IProjectDescription description = workspace.newProjectDescription(projectName);
+ description.setLocation(Path.fromOSString(projectDirectory.getAbsolutePath()));
+ IProject project = workspace.getRoot().getProject(projectName);
+ project.create(description, monitor);
+ project.open(IResource.BACKGROUND_REFRESH, monitor);
+ }
+
+ private void overwriteExistingProject(final IProject project, IWorkspace workspace, IProgressMonitor monitor)
+ throws CoreException {
+ if (project == null
+ || !project.exists()) {
+ return;
+ }
+
+ final boolean[] overwrite = new boolean[1];
+ Display.getDefault().syncExec(new Runnable() {
+
+ public void run() {
+ overwrite[0] = MessageDialog.openQuestion(
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
+ "Overwrite project?",
+ NLS.bind(
+ "A project \"{0}\" already exists in the workspace.\n"
+ + "If you want to import the OpenShift \"{0}\", the project in your workspace will "
+ + "get overwritten and may not be recovered.\n\n"
+ + "Are you sure that you want to overwrite the project \"{0}\" in your workspace?",
+ project.getName()));
+ }
+
+ });
+ if (overwrite[0]) {
+ project.delete(true, true, monitor);
+ }
+ }
+}
Property changes on: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/project/GeneralProjectImportOperation.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/project/MavenProjectImportOperation.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/project/MavenProjectImportOperation.java (rev 0)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/project/MavenProjectImportOperation.java 2011-12-09 15:09:56 UTC (rev 37167)
@@ -0,0 +1,79 @@
+/*******************************************************************************
+ * 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.appimport.project;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.m2e.core.embedder.MavenModelManager;
+import org.eclipse.m2e.core.internal.MavenPluginActivator;
+import org.eclipse.m2e.core.project.IMavenProjectImportResult;
+import org.eclipse.m2e.core.project.IProjectConfigurationManager;
+import org.eclipse.m2e.core.project.LocalProjectScanner;
+import org.eclipse.m2e.core.project.MavenProjectInfo;
+import org.eclipse.m2e.core.project.ProjectImportConfiguration;
+
+/**
+ * @author Andre Dietisheim <adietish(a)redhat.com>
+ *
+ */
+public class MavenProjectImportOperation extends AbstractProjectImportOperation {
+
+ private static final String POM_FILE = "pom.xml";
+
+ public MavenProjectImportOperation(File projectFolder) {
+ super(projectFolder);
+ }
+
+ public List<IProject> importToWorkspace(IProgressMonitor monitor)
+ throws CoreException, InterruptedException {
+ MavenPluginActivator mavenPlugin = MavenPluginActivator.getDefault();
+ IProjectConfigurationManager configurationManager = mavenPlugin.getProjectConfigurationManager();
+ MavenModelManager modelManager = mavenPlugin.getMavenModelManager();
+ List<MavenProjectInfo> projectInfos = getMavenProjects(getProjectDirectory(), modelManager, monitor);
+ ProjectImportConfiguration projectImportConfiguration = new ProjectImportConfiguration();
+ List<IMavenProjectImportResult> importResults =
+ configurationManager.importProjects(projectInfos, projectImportConfiguration, monitor);
+ return toProjects(importResults);
+ }
+
+ private List<IProject> toProjects(List<IMavenProjectImportResult> importResults) {
+ List<IProject> projects = new ArrayList<IProject>();
+ for (IMavenProjectImportResult importResult : importResults) {
+ IProject project = importResult.getProject();
+ if (project != null) {
+ projects.add(importResult.getProject());
+ }
+ }
+ return projects;
+ }
+
+ private List<MavenProjectInfo> getMavenProjects(File directory, MavenModelManager modelManager,
+ IProgressMonitor monitor) throws InterruptedException {
+ LocalProjectScanner scanner = new LocalProjectScanner(directory, directory.toString(), false,
+ modelManager);
+ scanner.run(monitor);
+ return scanner.getProjects();
+ }
+
+ public boolean isMavenProject() {
+ if (!isReadable(getProjectDirectory())
+ || !getProjectDirectory().isDirectory()) {
+ return false;
+ }
+
+ return isReadable(new File(getProjectDirectory(), POM_FILE));
+ }
+}
Property changes on: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/project/MavenProjectImportOperation.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
14 years, 4 months
JBoss Tools SVN: r37165 - trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/template.
by jbosstools-commits@lists.jboss.org
Author: ljelinko
Date: 2011-12-09 10:08:50 -0500 (Fri, 09 Dec 2011)
New Revision: 37165
Modified:
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/template/CreatePortletTemplate.java
Log:
added check for number of expected non existing files
Modified: trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/template/CreatePortletTemplate.java
===================================================================
--- trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/template/CreatePortletTemplate.java 2011-12-09 15:07:56 UTC (rev 37164)
+++ trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/template/CreatePortletTemplate.java 2011-12-09 15:08:50 UTC (rev 37165)
@@ -23,19 +23,19 @@
*
*/
public abstract class CreatePortletTemplate extends SWTTaskBasedTestCase {
-
+
protected static final String WEB_INF = "WebContent/WEB-INF/";
-
+
protected static final String DEFAULT_OBJECTS_XML = WEB_INF + "default-object.xml";
-
+
protected static final String PORTLET_INSTANCES_XML = WEB_INF + "portlet-instances.xml";
-
+
protected static final String JBOSS_APP_XML = WEB_INF + "jboss-app.xml";
-
+
protected static final String JBOSS_PORTLET_XML = WEB_INF + "jboss-portlet.xml";
protected static final String JSF_FOLDER = "WebContent/jsf/";
-
+
protected abstract String getProjectName();
protected abstract AbstractPortletCreationTask getCreatePortletTask();
@@ -52,7 +52,9 @@
doAssertThat(0, isNumberOfErrors());
doAssertThat(getExpectedWorkspaceFiles(), exist());
- doAssertThat(getNonExpectedWorkspaceFiles(), not(exist()));
+ if (getNonExpectedWorkspaceFiles().size() > 0){
+ doAssertThat(getNonExpectedWorkspaceFiles(), not(exist()));
+ }
doAssertThat(file(getProjectName(), WEB_INF + "portlet.xml"),
containsNodes(getExpectedXMLNodes()));
}
14 years, 4 months
JBoss Tools SVN: r37164 - trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/template.
by jbosstools-commits@lists.jboss.org
Author: ljelinko
Date: 2011-12-09 10:07:56 -0500 (Fri, 09 Dec 2011)
New Revision: 37164
Modified:
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/template/RunPortletOnServerTemplate.java
Log:
changed searched exception string
Modified: trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/template/RunPortletOnServerTemplate.java
===================================================================
--- trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/template/RunPortletOnServerTemplate.java 2011-12-09 13:40:44 UTC (rev 37163)
+++ trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/template/RunPortletOnServerTemplate.java 2011-12-09 15:07:56 UTC (rev 37164)
@@ -20,7 +20,7 @@
* @author Lucia Jelinkova
*
*/
-@Require(clearWorkspace=false, clearProjects=false, server=@Server(required=true, state=ServerState.Running, type=ServerType.EPP))
+@Require(clearWorkspace=false, clearProjects=false, server=(a)Server(state=ServerState.Running, type=ServerType.EPP))
public abstract class RunPortletOnServerTemplate extends SWTTaskBasedTestCase {
protected abstract String getProjectName();
@@ -30,6 +30,6 @@
doPerform(new ConsoleClearingTask());
doPerform(new RunninngProjectOnServerTask(getProjectName()));
- assertThat("Exception", not(inConsoleOutput()));
+ assertThat("Exception:", not(inConsoleOutput()));
}
}
14 years, 4 months
JBoss Tools SVN: r37163 - in trunk/vpe/plugins/org.jboss.tools.vpe.browsersim.eclipse: src/org/jboss/tools/vpe/browsersim/eclipse and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: yradtsevich
Date: 2011-12-09 08:40:44 -0500 (Fri, 09 Dec 2011)
New Revision: 37163
Added:
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim.eclipse/src/org/jboss/tools/vpe/browsersim/eclipse/actions/
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim.eclipse/src/org/jboss/tools/vpe/browsersim/eclipse/actions/RunBrowserSimAction.java
Removed:
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim.eclipse/src/org/jboss/tools/vpe/browsersim/eclipse/handlers/
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim.eclipse/plugin.xml
Log:
https://issues.jboss.org/browse/JBIDE-10424 : CLONE - BrowserSim icon is active on *all* perspectives
- added an actionSet for browsersim and replaced browsersim command handler by the same action handler.
Modified: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim.eclipse/plugin.xml
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.browsersim.eclipse/plugin.xml 2011-12-09 13:29:49 UTC (rev 37162)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.browsersim.eclipse/plugin.xml 2011-12-09 13:40:44 UTC (rev 37163)
@@ -13,13 +13,6 @@
id="org.jboss.tools.vpe.browsersim.eclipse.commands.runBrowserSim">
</command>
</extension>
- <extension
- point="org.eclipse.ui.handlers">
- <handler
- commandId="org.jboss.tools.vpe.browsersim.eclipse.commands.runBrowserSim"
- class="org.jboss.tools.vpe.browsersim.eclipse.handlers.RunBrowserSimHandler">
- </handler>
- </extension>
<!--extension
point="org.eclipse.ui.bindings">
<key
@@ -30,19 +23,20 @@
</key>
</extension-->
<extension
- point="org.eclipse.ui.menus">
- <menuContribution
- locationURI="toolbar:org.eclipse.ui.main.toolbar?after=additions">
- <toolbar
- id="org.jboss.tools.vpe.browsersim.eclipse.toolbars.sampleToolbar">
- <command
- commandId="org.jboss.tools.vpe.browsersim.eclipse.commands.runBrowserSim"
- icon="icons/sample.gif"
- tooltip="Run Mobile Browser Simulator"
- id="org.jboss.tools.vpe.browsersim.eclipse.toolbars.runBrowserSim">
- </command>
- </toolbar>
- </menuContribution>
+ point="org.eclipse.ui.actionSets">
+ <actionSet
+ id="org.jboss.tools.vpe.browsersim.eclipse.actionSet"
+ label="Mobile Browser Simulator"
+ visible="false">
+ <action
+ id="org.jboss.tools.vpe.browsersim.eclipse.runBrowserSim"
+ definitionId="org.jboss.tools.vpe.browsersim.eclipse.commands.runBrowserSim"
+ toolbarPath="browserSim"
+ label="Run Mobile Browser Simulator"
+ class="org.jboss.tools.vpe.browsersim.eclipse.actions.RunBrowserSimAction"
+ icon="icons/sample.gif">
+ </action>
+ </actionSet>
</extension>
<extension
point="org.eclipse.ui.editors">
Added: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim.eclipse/src/org/jboss/tools/vpe/browsersim/eclipse/actions/RunBrowserSimAction.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.browsersim.eclipse/src/org/jboss/tools/vpe/browsersim/eclipse/actions/RunBrowserSimAction.java (rev 0)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.browsersim.eclipse/src/org/jboss/tools/vpe/browsersim/eclipse/actions/RunBrowserSimAction.java 2011-12-09 13:40:44 UTC (rev 37163)
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2007-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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.vpe.browsersim.eclipse.actions;
+
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.IWorkbenchWindowActionDelegate;
+import org.jboss.tools.vpe.browsersim.eclipse.util.BrowserSimLauncher;
+
+/**
+ * @author "Yahor Radtsevich (yradtsevich)"
+ */
+public class RunBrowserSimAction implements IWorkbenchWindowActionDelegate {
+
+ @Override
+ public void run(IAction action) {
+ BrowserSimLauncher.launchBrowserSim(null);
+ }
+
+ @Override
+ public void selectionChanged(IAction action, ISelection selection) {
+ }
+
+ @Override
+ public void dispose() {
+ }
+
+ @Override
+ public void init(IWorkbenchWindow window) {
+ }
+}
14 years, 4 months
JBoss Tools SVN: r37161 - in trunk/documentation/whatsnew/hibernate: images and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: dgeraskov
Date: 2011-12-09 08:14:10 -0500 (Fri, 09 Dec 2011)
New Revision: 37161
Added:
trunk/documentation/whatsnew/hibernate/hibernate-news-3.5.0.M5.html
trunk/documentation/whatsnew/hibernate/images/console_configuration_hibernate_version.png
Log:
https://issues.jboss.org/browse/JBIDE-10374
Hibernate N&N
Added: trunk/documentation/whatsnew/hibernate/hibernate-news-3.5.0.M5.html
===================================================================
--- trunk/documentation/whatsnew/hibernate/hibernate-news-3.5.0.M5.html (rev 0)
+++ trunk/documentation/whatsnew/hibernate/hibernate-news-3.5.0.M5.html 2011-12-09 13:14:10 UTC (rev 37161)
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Language" content="en-us" />
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+<link rel="stylesheet" href="../whatsnew.css"/>
+<title>Hibernate tools 3.5.0.M5 What's New</title>
+<script type="text/javascript">
+
+ var _gaq = _gaq || [];
+ _gaq.push(['_setAccount', 'UA-17645367-5']);
+ _gaq.push(['_trackPageview']);
+
+ (function() {
+ var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
+ ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
+ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
+ })();
+
+</script></head>
+<body>
+<h1>Hibernate tools 3.5.0.M5 What's New</h1>
+
+<p align="right"><a href="../index.html">< Main
+ Index</a> <a href="../as/as-news-3.3.0.M5.html">JBoss AS Tools ></a></p>
+
+<table border="0" cellpadding="10" cellspacing="0" width="80%">
+
+ <tr>
+ <td colspan="2">
+ <hr/>
+ <h3>Hibernate Multiversion support</h3>
+ <hr/>
+ </td>
+ </tr>
+
+ <tr>
+ <td valign="top" align="right"><a name="itemname1" id="itemname1"></a><b>Select Hibernate Version</b></td>
+ <td valign="top">
+ <p>Because of incompatible API changes between hibernate 3.5 and hibernate 4 we have to ask user about the version of hibernate he uses in the mappings.
+ This should be specified for Console Configuration. This allows us to support both hibernate versions in single plugins installation.</p>
+
+ <img src="images/console_configuration_hibernate_version.png"/>
+
+ <p><small>Related jiras:<a href="https://issues.jboss.org/browse/JBIDE-10098">1</a>, <a href="https://issues.jboss.org/browse/JBIDE-9825">2</a></p>
+
+ </td>
+ </tr>
+
+ <tr>
+ <td colspan="2">
+ <hr/>
+ </td>
+ </tr>
+
+</table>
+
+</body>
+
+</html>
+
+
Added: trunk/documentation/whatsnew/hibernate/images/console_configuration_hibernate_version.png
===================================================================
(Binary files differ)
Property changes on: trunk/documentation/whatsnew/hibernate/images/console_configuration_hibernate_version.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
14 years, 4 months