JBoss Tools SVN: r37000 - workspace.
by jbosstools-commits@lists.jboss.org
Author: tejones
Date: 2011-12-06 10:06:07 -0500 (Tue, 06 Dec 2011)
New Revision: 37000
Removed:
workspace/tejones/
Log:
14 years, 4 months
JBoss Tools SVN: r36999 - 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-06 09:01:59 -0500 (Tue, 06 Dec 2011)
New Revision: 36999
Modified:
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
Log:
[JBIDE-10171] reenabled the default usecase where one would just import the OpenShift application to the workspace
Modified: 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-06 14:01:03 UTC (rev 36998)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ImportProjectWizard.java 2011-12-06 14:01:59 UTC (rev 36999)
@@ -70,17 +70,11 @@
private IStatus performOperations(IProgressMonitor monitor, IStatus status) {
try {
- // File repositoryFile =
- // model.cloneRepository(monitor);
- // model.importProject(repositoryFile, monitor);
- // Repository repository =
- // model.shareProject(monitor);
- // model.mergeWithApplicationRepository(repository,
- // monitor);
- File repositoryFile = model.cloneRepository(monitor);
- model.copyOpenshiftConfiguration(repositoryFile, monitor);
- model.shareProject(monitor);
- model.createServerAdapterIfRequired(monitor);
+ if (model.isEnableProject()) {
+ model.enableProject(monitor);
+ } else {
+ model.importProject(monitor);
+ }
return Status.OK_STATUS;
} catch (IOException e) {
status = OpenShiftUIActivator.createErrorStatus(
Modified: 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-06 14:01:03 UTC (rev 36998)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ImportProjectWizardModel.java 2011-12-06 14:01:59 UTC (rev 36999)
@@ -24,7 +24,7 @@
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.resources.WorkspaceJob;
+import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
@@ -183,22 +183,13 @@
* @return
* @throws CoreException
*/
- public void shareProject(IProgressMonitor monitor) throws CoreException {
+ private void shareProject(IProgressMonitor monitor) throws CoreException {
monitor.subTask(NLS.bind("Sharing project {0}...", getProjectName()));
- shareProject(getProjectName(), monitor);
+ EGitUtils.share(getProject(), monitor);
}
- private Repository shareProject(String projectName, IProgressMonitor monitor) throws CoreException {
- IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
- if (project == null) {
- throw new CoreException(
- OpenShiftUIActivator.createErrorStatus("Could not find project {0} in your workspace."));
- }
- return EGitUtils.share(project, monitor);
- }
-
- public void copyOpenshiftConfiguration(final File sourceFolder, IProgressMonitor monitor)
- throws OpenShiftException, IOException {
+ private void copyOpenshiftConfiguration(final File sourceFolder, IProgressMonitor monitor)
+ throws IOException {
IProject project = getProject();
monitor.subTask(NLS.bind("Copying openshift configuration to project {0}...", getProjectName()));
FileUtils.copy(new File(sourceFolder, ".git"), project.getLocation().toFile(), false);
@@ -214,36 +205,66 @@
*
* @see #getProjectName
*/
- private IProject getProject() throws OpenShiftException {
- IProject project = getProject(getProjectName());
- if (project == null
- || !project.exists()) {
- throw new OpenShiftException("Could not find project {0} in your workspace.", getProjectName());
- }
+ private IProject getProject() {
+ String projectName = getProjectName();
+ IProject project = getProject(projectName);
+ Assert.isTrue(project != null && project.exists(),
+ NLS.bind("Could not find project {0} in your workspace.", projectName));
return project;
}
- public void importProject(final File gitProjectFolder, IProgressMonitor monitor) throws OpenShiftException,
- CoreException,
- InterruptedException {
- new WorkspaceJob(NLS.bind("Importing projects from {0}", gitProjectFolder.getAbsolutePath())) {
+ public void importProject(IProgressMonitor monitor)
+ throws OpenShiftException, CoreException, InterruptedException, URISyntaxException,
+ InvocationTargetException {
+ File repositoryFolder = cloneRepository(monitor);
+ List<IProject> importedProjects = importMavenProject(repositoryFolder, monitor);
+ connectToGitRepo(importedProjects, repositoryFolder, monitor);
+ createServerAdapterIfRequired(importedProjects, monitor);
+ }
- @Override
- public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
- try {
- List<IProject> importedProjects = importMavenProject(gitProjectFolder, monitor);
- connectToGitRepo(importedProjects, gitProjectFolder, monitor);
- createServerAdapterIfRequired(importedProjects, monitor);
- return Status.OK_STATUS;
- } catch (Exception e) {
- IStatus status = new Status(IStatus.ERROR, OpenShiftUIActivator.PLUGIN_ID,
- NLS.bind("Could not import projects from {0}", gitProjectFolder.getAbsolutePath()), e);
- OpenShiftUIActivator.log(status);
- return status;
- }
- }
-
- }.schedule();
+ /**
+ * 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 enableProject(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 repositoryFile = cloneRepository(monitor);
+ copyOpenshiftConfiguration(repositoryFile, monitor);
+ shareProject(monitor);
+ createServerAdapterIfRequired(monitor);
}
public void mergeWithApplicationRepository(Repository repository, IProgressMonitor monitor)
@@ -304,9 +325,8 @@
* @see ImportProjectWizardModel#getApplication()
* @see #getRepositoryPath()
*/
- public File cloneRepository(IProgressMonitor monitor) throws URISyntaxException, OpenShiftException,
- InvocationTargetException,
- InterruptedException {
+ private File cloneRepository(IProgressMonitor monitor)
+ throws OpenShiftException, InvocationTargetException, InterruptedException, URISyntaxException {
IApplication application = getApplication();
monitor.subTask(NLS.bind("Cloning repository for application {0}...", application.getName()));
File destination = new File(getRepositoryPath(), application.getName());
@@ -314,10 +334,8 @@
return destination;
}
- private void cloneRepository(String uri, File destination, IProgressMonitor monitor) throws URISyntaxException,
- OpenShiftException,
- InvocationTargetException,
- InterruptedException {
+ private void cloneRepository(String uri, File destination, IProgressMonitor monitor)
+ throws OpenShiftException, URISyntaxException, InvocationTargetException, InterruptedException {
if (destination.exists()) {
FileUtil.completeDelete(destination);
}
@@ -358,22 +376,23 @@
* the monitor to report progress to.
* @throws OpenShiftException
*/
- public void createServerAdapterIfRequired(IProgressMonitor monitor) throws OpenShiftException {
+ private void createServerAdapterIfRequired(IProgressMonitor monitor) throws OpenShiftException {
monitor.subTask(NLS.bind("Creating server adapter for project {0}", getProjectName()));
createServerAdapterIfRequired(Collections.singletonList(getProject()), monitor);
}
private void createServerAdapterIfRequired(List<IProject> importedProjects, IProgressMonitor monitor) {
- Boolean b = (Boolean)getProperty(AdapterWizardPageModel.CREATE_SERVER);
- if( b != null && b.booleanValue() ) {
+ Boolean b = (Boolean) getProperty(AdapterWizardPageModel.CREATE_SERVER);
+ if (b != null && b.booleanValue()) {
try {
renameWebContextRoot(importedProjects);
IServer server = createServerAdapter();
addModules(getModules(importedProjects), server, monitor);
- } catch(CoreException ce) {
+ } 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);
+ } catch (OpenShiftException ose) {
+ IStatus s = new Status(IStatus.ERROR, OpenShiftUIActivator.PLUGIN_ID,
+ "Cannot create openshift server adapter", ose);
OpenShiftUIActivator.getDefault().getLog().log(s);
}
}
@@ -391,16 +410,16 @@
private IServer createServerAdapter() throws CoreException,
OpenShiftException {
- IServerType type = (IServerType)getProperty(AdapterWizardPageModel.SERVER_TYPE);
- IRuntime rt = (IRuntime)getProperty(AdapterWizardPageModel.RUNTIME_DELEGATE);
- String mode = (String)getProperty(AdapterWizardPageModel.MODE);
+ IServerType type = (IServerType) getProperty(AdapterWizardPageModel.SERVER_TYPE);
+ IRuntime rt = (IRuntime) getProperty(AdapterWizardPageModel.RUNTIME_DELEGATE);
+ String mode = (String) getProperty(AdapterWizardPageModel.MODE);
String serverNameBase = getApplication().getName() + " OpenShift Server";
String serverName = org.jboss.ide.eclipse.as.core.util.ServerUtil.getDefaultServerName(serverNameBase);
-
+
IServer server = ExpressServerUtils.createServer(rt, type, serverName);
- ExpressServerUtils.fillServerWithOpenShiftDetails(server, getApplication().getApplicationUrl(),
- getUser().getRhlogin(), getUser().getPassword(),
+ ExpressServerUtils.fillServerWithOpenShiftDetails(server, getApplication().getApplicationUrl(),
+ getUser().getRhlogin(), getUser().getPassword(),
getUser().getDomain().getNamespace(), getApplication().getName(), getApplication().getUUID(), mode);
return server;
}
@@ -414,7 +433,7 @@
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);
+ ((Server) server).setModulePublishState(add, IServer.PUBLISH_STATE_NONE);
}
private List<IModule> getModules(List<IProject> importedProjects) {
14 years, 4 months
JBoss Tools SVN: r36998 - trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2011-12-06 09:01:03 -0500 (Tue, 06 Dec 2011)
New Revision: 36998
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/PageContextFactory.java
Log:
JBIDE-10300 NPE for tld file which is in jar taglib and opened by "JBoss Tools XML Editor"
NullPointerException issue is fixed.
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/PageContextFactory.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/PageContextFactory.java 2011-12-06 13:19:18 UTC (rev 36997)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/PageContextFactory.java 2011-12-06 14:01:03 UTC (rev 36998)
@@ -432,7 +432,7 @@
return context;
}
- private IProject getActiveProject() {
+ private static IProject getActiveProject() {
ITextEditor editor = EclipseUIUtil.getActiveEditor();
if (editor == null) return null;
@@ -765,10 +765,12 @@
}
Region region = new Region(start, length);
+ IProject project = context.getResource() != null ? context.getResource().getProject() : getActiveProject();
+
INameSpace nameSpace = new NameSpace(
uri, prefix,
TagLibraryManager.getLibraries(
- context.getResource().getProject(), uri));
+ project, uri));
context.addNameSpace(region, nameSpace);
if (prefix.length() == 0)
14 years, 4 months
JBoss Tools SVN: r36997 - trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2011-12-06 08:19:18 -0500 (Tue, 06 Dec 2011)
New Revision: 36997
Modified:
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELResolverFactoryManager.java
Log:
JBIDE-10300 NPE for tld file which is in jar taglib and opened by "JBoss Tools XML Editor"
NullPointerException issue is fixed.
Modified: trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELResolverFactoryManager.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELResolverFactoryManager.java 2011-12-06 12:56:08 UTC (rev 36996)
+++ trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELResolverFactoryManager.java 2011-12-06 13:19:18 UTC (rev 36997)
@@ -102,7 +102,7 @@
* @return
*/
public ELResolver[] getResolvers(IResource resource) {
- if(!resource.isAccessible()) {
+ if(resource == null || !resource.isAccessible()) {
return new ELResolver[0];
}
IProject project = resource.getProject();
14 years, 4 months
JBoss Tools SVN: r36996 - trunk/maven/tests/org.jboss.tools.maven.ui.bot.test/src/org/jboss/tools/maven/ui/bot/test.
by jbosstools-commits@lists.jboss.org
Author: rawagner
Date: 2011-12-06 07:56:08 -0500 (Tue, 06 Dec 2011)
New Revision: 36996
Modified:
trunk/maven/tests/org.jboss.tools.maven.ui.bot.test/src/org/jboss/tools/maven/ui/bot/test/CreateMavenizedEARProjectTest.java
trunk/maven/tests/org.jboss.tools.maven.ui.bot.test/src/org/jboss/tools/maven/ui/bot/test/MavenAllBotTests.java
Log:
added suite classes
Modified: trunk/maven/tests/org.jboss.tools.maven.ui.bot.test/src/org/jboss/tools/maven/ui/bot/test/CreateMavenizedEARProjectTest.java
===================================================================
--- trunk/maven/tests/org.jboss.tools.maven.ui.bot.test/src/org/jboss/tools/maven/ui/bot/test/CreateMavenizedEARProjectTest.java 2011-12-06 12:39:10 UTC (rev 36995)
+++ trunk/maven/tests/org.jboss.tools.maven.ui.bot.test/src/org/jboss/tools/maven/ui/bot/test/CreateMavenizedEARProjectTest.java 2011-12-06 12:56:08 UTC (rev 36996)
@@ -58,6 +58,7 @@
botext.textWithLabel("Goals:").setText("clean package");
botext.button("Run").click();
waitForIdle();
+
}
private void createWarProject(String projectName){
Modified: trunk/maven/tests/org.jboss.tools.maven.ui.bot.test/src/org/jboss/tools/maven/ui/bot/test/MavenAllBotTests.java
===================================================================
--- trunk/maven/tests/org.jboss.tools.maven.ui.bot.test/src/org/jboss/tools/maven/ui/bot/test/MavenAllBotTests.java 2011-12-06 12:39:10 UTC (rev 36995)
+++ trunk/maven/tests/org.jboss.tools.maven.ui.bot.test/src/org/jboss/tools/maven/ui/bot/test/MavenAllBotTests.java 2011-12-06 12:56:08 UTC (rev 36996)
@@ -21,9 +21,9 @@
*/
@RunWith(RequirementAwareSuite.class)
@Suite.SuiteClasses({
- //MavenProfileSelectionTest.class,
- //CreateMavenizedSeamProjectTest.class,
- //CreateMavenProjectsTest.class,
+ MavenProfileSelectionTest.class,
+ CreateMavenizedSeamProjectTest.class,
+ CreateMavenProjectsTest.class,
CreateMavenizedEARProjectTest.class,
CreateMavenizedJSFProjectTest.class
})
14 years, 4 months
JBoss Tools SVN: r36995 - in trunk/maven/tests/org.jboss.tools.maven.ui.bot.test: src/org/jboss/tools/maven/ui/bot/test and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: rawagner
Date: 2011-12-06 07:39:10 -0500 (Tue, 06 Dec 2011)
New Revision: 36995
Added:
trunk/maven/tests/org.jboss.tools.maven.ui.bot.test/src/org/jboss/tools/maven/ui/bot/test/CreateMavenizedEARProjectTest.java
Modified:
trunk/maven/tests/org.jboss.tools.maven.ui.bot.test/.project
trunk/maven/tests/org.jboss.tools.maven.ui.bot.test/build.properties
trunk/maven/tests/org.jboss.tools.maven.ui.bot.test/requirements.properties
trunk/maven/tests/org.jboss.tools.maven.ui.bot.test/src/org/jboss/tools/maven/ui/bot/test/CreateMavenProjectsTest.java
trunk/maven/tests/org.jboss.tools.maven.ui.bot.test/src/org/jboss/tools/maven/ui/bot/test/CreateMavenizedJSFProjectTest.java
trunk/maven/tests/org.jboss.tools.maven.ui.bot.test/src/org/jboss/tools/maven/ui/bot/test/CreateMavenizedSeamProjectTest.java
trunk/maven/tests/org.jboss.tools.maven.ui.bot.test/src/org/jboss/tools/maven/ui/bot/test/MavenAllBotTests.java
trunk/maven/tests/org.jboss.tools.maven.ui.bot.test/src/org/jboss/tools/maven/ui/bot/test/MavenProfileSelectionTest.java
Log:
added EAP test, attempt to fix JBDIE-10276
Modified: trunk/maven/tests/org.jboss.tools.maven.ui.bot.test/.project
===================================================================
--- trunk/maven/tests/org.jboss.tools.maven.ui.bot.test/.project 2011-12-06 11:30:53 UTC (rev 36994)
+++ trunk/maven/tests/org.jboss.tools.maven.ui.bot.test/.project 2011-12-06 12:39:10 UTC (rev 36995)
@@ -31,4 +31,26 @@
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
+ <linkedResources>
+ <link>
+ <name>lib-org.jboss.tools.common_3.3.0.v20111027-1555-H29-M4</name>
+ <type>2</type>
+ <location>/home/eiden/Java/RedHat/Eclipses/jbds5.0.0.M4b/studio/plugins/org.jboss.tools.common_3.3.0.v20111027-1555-H29-M4</location>
+ </link>
+ <link>
+ <name>lib-org.jboss.tools.jst.web.kb_3.3.0.v20111021-1521-H30-M4</name>
+ <type>2</type>
+ <location>/home/eiden/Java/RedHat/Eclipses/jbds5.0.0.M4b/studio/plugins/org.jboss.tools.jst.web.kb_3.3.0.v20111021-1521-H30-M4</location>
+ </link>
+ <link>
+ <name>lib-org.jboss.tools.tests_3.2.0.v20111108-2302-Beta1</name>
+ <type>2</type>
+ <location>/home/eiden/Java/RedHat/Eclipses/jbds5.0.0.M4b/studio/plugins/org.jboss.tools.tests_3.2.0.v20111108-2302-Beta1</location>
+ </link>
+ <link>
+ <name>lib-org.jboss.tools.ui.bot.ext_3.2.0.v20111108-2302-Beta1</name>
+ <type>2</type>
+ <location>/home/eiden/Java/RedHat/Eclipses/jbds5.0.0.M4b/studio/plugins/org.jboss.tools.ui.bot.ext_3.2.0.v20111108-2302-Beta1</location>
+ </link>
+ </linkedResources>
</projectDescription>
Modified: trunk/maven/tests/org.jboss.tools.maven.ui.bot.test/build.properties
===================================================================
--- trunk/maven/tests/org.jboss.tools.maven.ui.bot.test/build.properties 2011-12-06 11:30:53 UTC (rev 36994)
+++ trunk/maven/tests/org.jboss.tools.maven.ui.bot.test/build.properties 2011-12-06 12:39:10 UTC (rev 36995)
@@ -1,4 +1,5 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
- .
+ .,\
+ resources/
Modified: trunk/maven/tests/org.jboss.tools.maven.ui.bot.test/requirements.properties
===================================================================
--- trunk/maven/tests/org.jboss.tools.maven.ui.bot.test/requirements.properties 2011-12-06 11:30:53 UTC (rev 36994)
+++ trunk/maven/tests/org.jboss.tools.maven.ui.bot.test/requirements.properties 2011-12-06 12:39:10 UTC (rev 36995)
@@ -1 +1 @@
-requirements=jbossas-5.1.0.GA,seam-2.2.0.GA
\ No newline at end of file
+requirements=jbossas-5.1.0.GA,seam-2.2.0.GA,jbossas-6.0.0.Final
\ No newline at end of file
Modified: trunk/maven/tests/org.jboss.tools.maven.ui.bot.test/src/org/jboss/tools/maven/ui/bot/test/CreateMavenProjectsTest.java
===================================================================
--- trunk/maven/tests/org.jboss.tools.maven.ui.bot.test/src/org/jboss/tools/maven/ui/bot/test/CreateMavenProjectsTest.java 2011-12-06 11:30:53 UTC (rev 36994)
+++ trunk/maven/tests/org.jboss.tools.maven.ui.bot.test/src/org/jboss/tools/maven/ui/bot/test/CreateMavenProjectsTest.java 2011-12-06 12:39:10 UTC (rev 36995)
@@ -1,73 +1,77 @@
package org.jboss.tools.maven.ui.bot.test;
-
+import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.NullProgressMonitor;
-
+import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
import org.eclipse.swtbot.swt.finder.SWTBot;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
+import org.jboss.tools.ui.bot.ext.SWTBotExt;
+import org.jboss.tools.ui.bot.ext.SWTUtilExt;
+import org.jboss.tools.ui.bot.ext.config.Annotations.Require;
import org.junit.Test;
@SuppressWarnings("restriction")
+@Require(perspective="Java")
public class CreateMavenProjectsTest extends AbstractMavenSWTBotTest{
-
- public static final String JBOSS6_AS_HOME=System.getProperty("jbosstools.test.jboss.home.6.1", "/home/eiden/Java/RedHat/JBossASs/jboss-6.1.0.Final");
- public static final String JBOSS7_AS_HOME=System.getProperty("jbosstools.test.jboss.home.7.0", "/home/eiden/Java/RedHat/JBossASs/jboss-as-7.0.1.Final1");
- public static final String POM_FILE = "pom.xml";
- public static final String PROJECT_NAME6="JSFProject6";
- public static final String PROJECT_NAME7="JSFProject7";
- public static final String SERVER_RUNTIME6="JBoss 6.x Runtime";
- public static final String SERVER_RUNTIME7="JBoss 7.x Runtime";
- public static final String SERVER6="JBoss AS 6.x";
- public static final String SERVER7="JBoss AS 7.x";
- public static final String GROUPID ="javax.faces";
- public static final String ARTIFACTID ="jsf-api";
- public static final String JSF_VERSION_1_1_02 ="1.1.02";
- public static final String JSF_VERSION_1_2 ="2.0";
- public static final String JSF_VERSION_2 ="2.0";
-
+ public static final String REPO_URL = "http://repo1.maven.org/maven2";
+ protected static SWTWorkbenchBot bot = new SWTWorkbenchBot();
@Test
- public void createSimpleJarProject() throws Exception{
+ public void updateRepositories() throws InterruptedException {
+ SWTBotExt botExt = new SWTBotExt();
+ botExt.menu("Window").menu("Show View").menu("Other...").click();
+ waitForIdle();
+ botExt.tree().expandNode("Maven").select("Maven Repositories");
+ botExt.button("OK").click();
+ SWTBot b = botExt.viewByTitle("Maven Repositories").bot();
+ AbstractMavenSWTBotTest.waitForIdle();
+ b.tree().expandNode("Global Repositories").getNode("central (" + REPO_URL + ")").contextMenu("Rebuild Index").click();
+ botExt.button("OK").click();
+ SWTUtilExt util = new SWTUtilExt(botExt);
+ util.waitForAll();
+ }
+
+ @Test
+ public void createSimpleJarProject() throws Exception {
String projectName = "MavenJar";
- createSimpleMavenProject(projectName,"jar");
+ createSimpleMavenProject(projectName, "jar");
IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
assertNoErrors(project);
+ Utils.isMavenProject(projectName);
+ buildProject(projectName,"5 Maven build...");
}
-
+
@Test
- public void createSimpleWarProject() throws Exception{
+ public void createSimpleWarProject() throws Exception {
String projectName = "MavenWar";
createSimpleMavenProject(projectName, "war");
IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
assertNoErrors(project);
+ Utils.isMavenProject(projectName);
+ buildProject(projectName,"5 Maven build...");
}
-
-
+
@Test
- public void createSimpleJarProjectArchetype() throws Exception{
+ public void createSimpleJarProjectArchetype() throws Exception {
String projectName = "ArchetypeQuickstart";
- createSimpleMavenProjectArchetype(projectName, "maven-archetype-quickstart", "All Catalogs");
+ createSimpleMavenProjectArchetype(projectName,"maven-archetype-quickstart", "Nexus Indexer");
IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
assertNoErrors(project);
+ Utils.isMavenProject(projectName);
+ buildProject(projectName, "6 Maven build...");
}
-
- @Test
- public void createSimpleJsfProjectArchetype() throws Exception{
- String projectName = "ArchetypeJSF";
- createSimpleMavenProjectArchetype(projectName, "appfuse-basic-jsf", "All Catalogs");
- IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
- assertNoErrors(project);
- }
-
-
-
-
- private void createSimpleMavenProjectArchetype(String projectName, String projectType, String catalog) throws InterruptedException, CoreException{
- bot.menu("File").menu("New").menu("Other...").click();
- SWTBot shell = bot.shell("New").activate().bot();
+
+ private void createSimpleMavenProjectArchetype(String projectName,String projectType, String catalog) throws InterruptedException,CoreException {
+ SWTBotExt botExt = new SWTBotExt();
+ botExt.menu("File").menu("New").menu("Other...").click();
+ waitForIdle();
+ SWTBot shell = botExt.shell("New").activate().bot();
shell.tree().expandNode("Maven").select("Maven Project");
shell.button("Next >").click();
shell.checkBox("Create a simple project (skip archetype selection)").deselect();
@@ -75,8 +79,8 @@
Thread.sleep(1000);
shell.comboBox().setSelection(catalog);
Thread.sleep(1000);
- int index = bot.table(0).indexOf(projectType,"Artifact Id");
- if(index == -1){
+ int index = botExt.table(0).indexOf(projectType, "Artifact Id");
+ if (index == -1) {
fail(projectType + " not found");
}
shell.table(0).select(index);
@@ -84,13 +88,14 @@
shell.comboBoxWithLabel("Group Id:").setText(projectName);
shell.comboBoxWithLabel("Artifact Id:").setText(projectName);
shell.button("Finish").click();
- waitForJobsToComplete();
+ waitForIdle();
}
-
- private void createSimpleMavenProject(String projectName, String projectType) throws InterruptedException, CoreException{
- bot.menu("File").menu("New").menu("Other...").click();
- SWTBot shell = bot.shell("New").activate().bot();
- shell.tree().expandNode("Maven").select("Maven Project").click() ;
+
+ private void createSimpleMavenProject(String projectName, String projectType) throws InterruptedException, CoreException {
+ SWTBotExt botExt = new SWTBotExt();
+ botExt.menu("File").menu("New").menu("Other...").click();
+ SWTBot shell = botExt.shell("New").activate().bot();
+ shell.tree().expandNode("Maven").select("Maven Project").click();
shell.button("Next >").click();
shell.checkBox("Create a simple project (skip archetype selection)").select();
shell.button("Next >").click();
@@ -98,11 +103,23 @@
shell.comboBoxInGroup("Artifact", 1).setText(projectName);
shell.comboBoxInGroup("Artifact", 4).setText(projectType);
shell.button("Finish").click();
- waitForJobsToComplete();
+ waitForIdle();
}
-
-
-
-
+
+ private void buildProject(String projectName, String mavenBuild) throws CoreException {
+ IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
+ SWTBot explorer = bot.viewByTitle("Package Explorer").bot();
+ SWTBotTreeItem item = explorer.tree().getTreeItem(projectName).select();
+ SWTBotExt swtBot = new SWTBotExt();
+ item.contextMenu("Run As").menu(mavenBuild).click();
+ swtBot.textWithLabel("Goals:").setText("clean package");
+ swtBot.button("Run").click();
+ waitForIdle();
+ project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
+ project.getFolder("target").refreshLocal(IResource.DEPTH_INFINITE,new NullProgressMonitor());
+ IFile jarFile = project.getFile("target/" + projectName + "-0.0.1-SNAPSHOT.jar");
+ assertTrue(jarFile + " is missing ", jarFile.exists());
+ }
+
}
Added: trunk/maven/tests/org.jboss.tools.maven.ui.bot.test/src/org/jboss/tools/maven/ui/bot/test/CreateMavenizedEARProjectTest.java
===================================================================
--- trunk/maven/tests/org.jboss.tools.maven.ui.bot.test/src/org/jboss/tools/maven/ui/bot/test/CreateMavenizedEARProjectTest.java (rev 0)
+++ trunk/maven/tests/org.jboss.tools.maven.ui.bot.test/src/org/jboss/tools/maven/ui/bot/test/CreateMavenizedEARProjectTest.java 2011-12-06 12:39:10 UTC (rev 36995)
@@ -0,0 +1,183 @@
+package org.jboss.tools.maven.ui.bot.test;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.StringWriter;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.jboss.tools.ui.bot.ext.SWTBotExt;
+import org.jboss.tools.ui.bot.ext.config.Annotations.Require;
+import org.junit.Test;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.xml.sax.SAXException;
+
+
+@Require(perspective="Java EE")
+public class CreateMavenizedEARProjectTest {
+
+ public static final String WAR_PROJECT_NAME="earWeb";
+ public static final String EJB_PROJECT_NAME="earEJB";
+ public static final String EAR_PROJECT_NAME="ear";
+
+ private SWTBotExt botext = new SWTBotExt();
+
+
+ @Test
+ public void createEARProject() throws Exception{
+ createWarProject(WAR_PROJECT_NAME);
+ createEJBProject(EJB_PROJECT_NAME);
+ botext.menu("File").menu("Enterprise Application Project").click();
+ botext.textWithLabel("Project name:").setText(EAR_PROJECT_NAME);
+ botext.button("Modify...").click();
+ botext.tree().getTreeItem("JBoss Maven Integration").check();
+ botext.button("OK").click();
+ botext.button("Next >").click();
+ botext.button("Select All").click();
+ botext.button("Next >").click();
+ botext.comboBoxWithLabel("Packaging:").setSelection("ear");
+ botext.button("Finish").click();
+ waitForIdle();
+ installProject(WAR_PROJECT_NAME);
+ installProject(EJB_PROJECT_NAME);
+ editEARPomDependencies();
+ botext.viewByTitle("Project Explorer").bot().tree().getTreeItem(EAR_PROJECT_NAME).contextMenu("Run As").menu("5 Maven build...").click();
+ waitForIdle();
+ botext.textWithLabel("Goals:").setText("clean package");
+ botext.button("Run").click();
+ waitForIdle();
+ }
+
+ private void createWarProject(String projectName){
+ botext.menu("File").menu("Dynamic Web Project").click();
+ botext.textWithLabel("Project name:").setText(projectName);
+ botext.button("Modify...").click();
+ botext.tree().getTreeItem("JBoss Maven Integration").check();
+ botext.button("OK").click();
+ botext.button("Next >").click();
+ botext.button("Next >").click();
+ botext.checkBox("Generate web.xml deployment descriptor").select();
+ botext.button("Next >").click();
+ botext.button("Finish").click();
+ waitForIdle();
+ }
+
+ private void createEJBProject(String projectName){
+ botext.menu("File").menu("EJB Project").click();
+ botext.textWithLabel("Project name:").setText(projectName);
+ botext.button("Modify...").click();
+ botext.tree().getTreeItem("JBoss Maven Integration").check();
+ botext.button("OK").click();
+ botext.button("Next >").click();
+ botext.button("Next >").click();
+ botext.button("Next >").click();
+ botext.comboBoxWithLabel("Packaging:").setSelection("ejb");
+ botext.button("Finish").click();
+ waitForIdle();
+ }
+
+ private void installProject(String projectName) throws InterruptedException{
+ botext.viewByTitle("Project Explorer").bot().tree().getTreeItem(projectName).contextMenu("Run As").menu("5 Maven build...").click();
+ botext.textWithLabel("Goals:").setText("clean package install");
+ botext.button("Run").click();
+ waitForIdle();
+ }
+
+ private void editEARPomDependencies() throws ParserConfigurationException, SAXException, IOException, CoreException, TransformerException{
+ IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(EAR_PROJECT_NAME);
+ DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+ DocumentBuilder docBuilder = factory.newDocumentBuilder();
+ Document docPom = docBuilder.parse(project.getFile("pom.xml").getContents());
+ Element modulesElement = docPom.createElement("modules");
+ Element webModuleElement = docPom.createElement("webModule");
+ Element groupIdWebElement = docPom.createElement("groupId");
+ Element artifactIdWebElement = docPom.createElement("artifactId");
+ Element versionWebElement = docPom.createElement("version");
+ Element bundleFileNameWebElement = docPom.createElement("bundleFileName");
+ Element ejbModuleElement = docPom.createElement("ejbModule");
+ Element groupIdEjbElement = docPom.createElement("groupId");
+ Element artifactIdEjbElement = docPom.createElement("artifactId");
+ Element groupIdEjbModuleElement = docPom.createElement("groupId");
+ Element artifactIdEjbModuleElement = docPom.createElement("artifactId");
+ Element groupIdWebModuleElement = docPom.createElement("groupId");
+ Element artifactIdWebModuleElement = docPom.createElement("artifactId");
+ Element versionEjbElement = docPom.createElement("version");
+ Element bundleFileNameEjbElement = docPom.createElement("bundleFileName");
+ Element dependenciesElement = docPom.createElement("dependencies");
+ Element dependencyEjbElement = docPom.createElement("dependency");
+ Element dependencyWarElement = docPom.createElement("dependency");
+ Element typeEjbElement = docPom.createElement("type");
+ Element typeWarElement = docPom.createElement("type");
+
+ groupIdWebElement.setTextContent("org.jboss.tools");
+ groupIdEjbElement.setTextContent("org.jboss.tools");
+ artifactIdWebElement.setTextContent(WAR_PROJECT_NAME);
+ artifactIdEjbElement.setTextContent(EJB_PROJECT_NAME);
+ groupIdWebModuleElement.setTextContent("org.jboss.tools");
+ groupIdEjbModuleElement.setTextContent("org.jboss.tools");
+ artifactIdWebModuleElement.setTextContent(WAR_PROJECT_NAME);
+ artifactIdEjbModuleElement.setTextContent(EJB_PROJECT_NAME);
+ versionWebElement.setTextContent("0.0.1-SNAPSHOT");
+ versionEjbElement.setTextContent("0.0.1-SNAPSHOT");
+ typeWarElement.setTextContent("war");
+ typeEjbElement.setTextContent("ejb");
+ bundleFileNameWebElement.setTextContent(WAR_PROJECT_NAME+"-0.0.1-SNAPSHOT.war");
+ bundleFileNameEjbElement.setTextContent(EJB_PROJECT_NAME+"-0.0.1-SNAPSHOT.jar");
+
+ webModuleElement.appendChild(groupIdWebModuleElement);
+ webModuleElement.appendChild(artifactIdEjbModuleElement);
+ webModuleElement.appendChild(bundleFileNameWebElement);
+ ejbModuleElement.appendChild(groupIdEjbModuleElement);
+ ejbModuleElement.appendChild(artifactIdEjbModuleElement);
+ ejbModuleElement.appendChild(bundleFileNameEjbElement);
+ modulesElement.appendChild(webModuleElement);
+ modulesElement.appendChild(ejbModuleElement);
+
+ dependencyWarElement.appendChild(groupIdWebElement);
+ dependencyWarElement.appendChild(artifactIdWebElement);
+ dependencyWarElement.appendChild(versionWebElement);
+ dependencyWarElement.appendChild(typeWarElement);
+ dependencyEjbElement.appendChild(groupIdEjbElement);
+ dependencyEjbElement.appendChild(artifactIdEjbElement);
+ dependencyEjbElement.appendChild(versionEjbElement);
+ dependencyEjbElement.appendChild(typeEjbElement);
+ dependenciesElement.appendChild(dependencyWarElement);
+ dependenciesElement.appendChild(dependencyEjbElement);
+
+ Element root = docPom.getDocumentElement();
+ Element buildElement = (Element)root.getElementsByTagName("build").item(0);
+ Node plugin = buildElement.getElementsByTagName("configuration").item(0);
+
+ root.appendChild(dependenciesElement);
+ plugin.appendChild(modulesElement);
+
+ //save xml
+ TransformerFactory transfac = TransformerFactory.newInstance();
+ Transformer trans = transfac.newTransformer();
+ StringWriter xmlAsWriter = new StringWriter();
+ StreamResult result = new StreamResult(xmlAsWriter);
+ DOMSource source = new DOMSource(docPom);
+ trans.transform(source, result);
+ project.getFile("pom.xml").setContents(new ByteArrayInputStream(xmlAsWriter.toString().getBytes("UTF-8")), 0, null);
+ waitForIdle();
+
+ }
+
+ private static void waitForIdle() {
+ AbstractMavenSWTBotTest.waitForIdle();
+ }
+
+
+}
Modified: trunk/maven/tests/org.jboss.tools.maven.ui.bot.test/src/org/jboss/tools/maven/ui/bot/test/CreateMavenizedJSFProjectTest.java
===================================================================
--- trunk/maven/tests/org.jboss.tools.maven.ui.bot.test/src/org/jboss/tools/maven/ui/bot/test/CreateMavenizedJSFProjectTest.java 2011-12-06 11:30:53 UTC (rev 36994)
+++ trunk/maven/tests/org.jboss.tools.maven.ui.bot.test/src/org/jboss/tools/maven/ui/bot/test/CreateMavenizedJSFProjectTest.java 2011-12-06 12:39:10 UTC (rev 36995)
@@ -29,6 +29,10 @@
import org.eclipse.swtbot.swt.finder.keyboard.Keystrokes;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
import org.jboss.tools.ui.bot.ext.SWTBotExt;
+import org.jboss.tools.ui.bot.ext.SWTTestExt;
+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;
import org.junit.BeforeClass;
import org.junit.Test;
import org.w3c.dom.Document;
@@ -37,8 +41,8 @@
import org.xml.sax.SAXException;
@SuppressWarnings("restriction")
+@Require(perspective = "Web Development")
public class CreateMavenizedJSFProjectTest{
-
public static final String JBOSS6_AS_HOME=System.getProperty("jbosstools.test.jboss.home.6.1", "/home/eiden/Java/RedHat/JBossASs/jboss-6.1.0.Final");
public static final String JBOSS7_AS_HOME=System.getProperty("jbosstools.test.jboss.home.7.0", "/home/eiden/Java/RedHat/JBossASs/jboss-as-7.0.1.Final1");
public static final String POM_FILE = "pom.xml";
@@ -136,22 +140,21 @@
private void createJSFProject(String serverRuntime, String server, String serverHome, String jsfVersion, String projectName) throws InterruptedException, CoreException{
- bot.menu("File").menu("New").menu("Other...").click();
- SWTBot shell = bot.shell("New").activate().bot();
- shell.tree().expandNode("JBoss Tools Web").expandNode("JSF").select("JSF Project");
- shell.button("Next >").click();
+ bot.menu("File").menu("New").menu("JSF Project").click();
+ SWTBot shell = bot.shell("New JSF Project").activate().bot();
shell.textWithLabel("Project Name*").setText(projectName);
shell.comboBox(0).setSelection(jsfVersion);
shell.comboBox(1).setSelection("JSFKickStartWithoutLibs");
shell.button("Next >").click();
+ Thread.sleep(1000);
shell.button("New...").click();
SWTBot shellRuntime = bot.shell("New Server Runtime").activate().bot();
- Thread.sleep(1000);
+ Thread.sleep(500);
shellRuntime.tree().expandNode("JBoss Community").select(serverRuntime);
shellRuntime.button("Next >").click();
shellRuntime.textWithLabel("Home Directory").setText(serverHome);
shellRuntime.button("Finish").click();
- Thread.sleep(1000);
+ Thread.sleep(500);
shell.button(1).click();
shellRuntime = bot.shell("New Server").activate().bot();
shellRuntime.tree().expandNode("JBoss Community").select(server);
@@ -197,7 +200,9 @@
private void activateMavenFacet(String projectName) throws InterruptedException, CoreException{
SWTBot explorer = bot.viewByTitle("Package Explorer").bot();
SWTBotTreeItem item = explorer.tree().getTreeItem(projectName).select();
+ Thread.sleep(500);
item.pressShortcut(Keystrokes.ALT,Keystrokes.LF);
+ Thread.sleep(1000);
SWTBot shellProperties = bot.shell("Properties for "+projectName).activate().bot();
shellProperties.tree().select("Project Facets");
shellProperties.tree(1).getTreeItem("JBoss Maven Integration").check();
@@ -209,6 +214,7 @@
waitForIdle();
IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
assertNoErrors(project);
+ Utils.isMavenProject(projectName);
}
private void buildProject(String projectName) throws CoreException{
@@ -293,4 +299,5 @@
private static void assertNoErrors(IProject project) throws CoreException {
WorkspaceHelpers.assertNoErrors(project);
}
+
}
Modified: trunk/maven/tests/org.jboss.tools.maven.ui.bot.test/src/org/jboss/tools/maven/ui/bot/test/CreateMavenizedSeamProjectTest.java
===================================================================
--- trunk/maven/tests/org.jboss.tools.maven.ui.bot.test/src/org/jboss/tools/maven/ui/bot/test/CreateMavenizedSeamProjectTest.java 2011-12-06 11:30:53 UTC (rev 36994)
+++ trunk/maven/tests/org.jboss.tools.maven.ui.bot.test/src/org/jboss/tools/maven/ui/bot/test/CreateMavenizedSeamProjectTest.java 2011-12-06 12:39:10 UTC (rev 36995)
@@ -51,7 +51,6 @@
import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
import org.eclipse.swtbot.swt.finder.SWTBot;
-import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotRadio;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
@@ -77,19 +76,19 @@
import org.jboss.tools.seam.core.project.facet.SeamRuntimeManager;
import org.jboss.tools.seam.core.project.facet.SeamVersion;
import org.jboss.tools.test.util.ResourcesUtils;
+import org.jboss.tools.ui.bot.ext.config.Annotations.Require;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
-import org.junit.runner.RunWith;
/**
* @author Snjeza
*
*/
@SuppressWarnings("restriction")
-(a)RunWith(SWTBotJunit4ClassRunner.class)
+@Require(perspective="Seam 2")
public class CreateMavenizedSeamProjectTest{
protected static final long IDLE_TIME = 1 * 60 * 1000L;
@@ -160,8 +159,6 @@
public final static void beforeClass() throws Exception {
bot = AbstractMavenSWTBotTest.initSWTBot();
- switchPerspective("org.jboss.tools.seam.ui.SeamPerspective");
-
String asLocation = JBOSS_AS_HOME;
String runtimeType = JBOSS_AS_RUNTIME_ID;
Modified: trunk/maven/tests/org.jboss.tools.maven.ui.bot.test/src/org/jboss/tools/maven/ui/bot/test/MavenAllBotTests.java
===================================================================
--- trunk/maven/tests/org.jboss.tools.maven.ui.bot.test/src/org/jboss/tools/maven/ui/bot/test/MavenAllBotTests.java 2011-12-06 11:30:53 UTC (rev 36994)
+++ trunk/maven/tests/org.jboss.tools.maven.ui.bot.test/src/org/jboss/tools/maven/ui/bot/test/MavenAllBotTests.java 2011-12-06 12:39:10 UTC (rev 36995)
@@ -10,6 +10,7 @@
************************************************************************************/
package org.jboss.tools.maven.ui.bot.test;
+import org.jboss.tools.ui.bot.ext.RequirementAwareSuite;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
@@ -18,14 +19,14 @@
* This is a swtbot testcase for an eclipse application.
*
*/
-
+(a)RunWith(RequirementAwareSuite.class)
@Suite.SuiteClasses({
- MavenProfileSelectionTest.class,
- CreateMavenizedSeamProjectTest.class,
- CreateMavenizedJSFProjectTest.class,
- CreateMavenProjectsTest.class
+ //MavenProfileSelectionTest.class,
+ //CreateMavenizedSeamProjectTest.class,
+ //CreateMavenProjectsTest.class,
+ CreateMavenizedEARProjectTest.class,
+ CreateMavenizedJSFProjectTest.class
})
-(a)RunWith(Suite.class)
public class MavenAllBotTests {
Modified: trunk/maven/tests/org.jboss.tools.maven.ui.bot.test/src/org/jboss/tools/maven/ui/bot/test/MavenProfileSelectionTest.java
===================================================================
--- trunk/maven/tests/org.jboss.tools.maven.ui.bot.test/src/org/jboss/tools/maven/ui/bot/test/MavenProfileSelectionTest.java 2011-12-06 11:30:53 UTC (rev 36994)
+++ trunk/maven/tests/org.jboss.tools.maven.ui.bot.test/src/org/jboss/tools/maven/ui/bot/test/MavenProfileSelectionTest.java 2011-12-06 12:39:10 UTC (rev 36995)
@@ -1,5 +1,17 @@
package org.jboss.tools.maven.ui.bot.test;
+import java.io.File;
+import java.io.IOException;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+
import org.eclipse.core.resources.IProject;
import org.eclipse.jface.bindings.keys.KeyStroke;
import org.eclipse.jface.bindings.keys.ParseException;
@@ -12,23 +24,71 @@
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
+import org.jboss.tools.ui.bot.ext.SWTBotExt;
+import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.xml.sax.SAXException;
@SuppressWarnings("restriction")
@RunWith(SWTBotJunit4ClassRunner.class)
public class MavenProfileSelectionTest extends AbstractMavenSWTBotTest {
public static final String AUTOACTIVATED_PROFILE_IN_POM = "active-profile";
- public static final String AUTOACTIVATED_PROFILE_IN_USER_SETTINGS = "environment";
+ public static final String AUTOACTIVATED_PROFILE_IN_USER_SETTINGS = "jboss.repository";
+ /*
+ @BeforeClass
+ public static void setUpUserSettings() throws InterruptedException, IOException, SAXException, ParserConfigurationException, TransformerException{
+ SWTBotExt bot = new SWTBotExt();
+ bot.menu("Window").menu("Preferences").click();
+ bot.tree().expandNode("Maven").select("User Settings");
+ DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+ DocumentBuilder docBuilder = factory.newDocumentBuilder();
+ TransformerFactory transformerFactory = TransformerFactory.newInstance();
+ Transformer transformer = transformerFactory.newTransformer();
+ String settingsLocation = bot.text(1).getText();
+ File settings = null;
+ if(settingsLocation.equals("User settings file doesn't exist")){
+ settingsLocation = bot.text(2).getText();
+ settings = new File(settingsLocation);
+ settings.createNewFile();
+ Document doc = docBuilder.newDocument();
+ Element rootElement = doc.createElement("settings");
+ doc.appendChild(rootElement);
+ DOMSource source = new DOMSource(doc);
+ StreamResult result = new StreamResult(settingsLocation);
+ transformer.transform(source, result);
+ }
+ settings = new File(settingsLocation);
+ Document docPom = docBuilder.parse(settings);
+ Element rootElement = docPom.getDocumentElement();
+ Element profilesElement = docPom.createElement("profiles");
+ Element profileElement = docPom.createElement("profile");
+ Element idElement = docPom.createElement("id");
+ Element activationElement = docPom.createElement("activation");
+ Element activeByDefaultElement = docPom.createElement("activeByDefault");
+
+ idElement.setTextContent(AUTOACTIVATED_PROFILE_IN_USER_SETTINGS);
+ activeByDefaultElement.setTextContent("true");
+
+ activationElement.appendChild(activeByDefaultElement);
+ profileElement.appendChild(activationElement);
+ profileElement.appendChild(idElement);
+ profilesElement.appendChild(profileElement);
+ rootElement.appendChild(profilesElement);
+ DOMSource source = new DOMSource(docPom);
+ StreamResult result = new StreamResult(settingsLocation);
+ transformer.transform(source, result);
+ }
+ */
-
@Test
public void testOpenMavenProfiles() throws Exception {
IProject project = importProject("projects/simple-jar/pom.xml");
waitForJobsToComplete();
- //Select the project
testAutoActivatedProfiles();
final SWTBotView packageExplorer = bot.viewByTitle("Project Explorer");
SWTBot innerBot = packageExplorer.bot();
@@ -59,8 +119,8 @@
private void openProfilesDialog(SWTBotTreeItem projectItem) throws ParseException, InterruptedException{
projectItem.pressShortcut(Keystrokes.CTRL, Keystrokes.ALT,KeyStroke.getInstance("P"));
- projectItem.pressShortcut(Keystrokes.DOWN);
- projectItem.pressShortcut(Keystrokes.LF);
+ //projectItem.pressShortcut(Keystrokes.DOWN);
+ //projectItem.pressShortcut(Keystrokes.LF);
final SWTBotShell selectDialogShell = bot.shell("Select Maven profiles");
assertEquals("Select Maven profiles", selectDialogShell.getText());
Thread.sleep(1000);
14 years, 4 months
JBoss Tools SVN: r36994 - trunk/openshift/plugins/org.jboss.tools.openshift.express.ui.
by jbosstools-commits@lists.jboss.org
Author: fbricon
Date: 2011-12-06 06:30:53 -0500 (Tue, 06 Dec 2011)
New Revision: 36994
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/plugin.xml
Log:
JBIDE-10354: reverted svn merge screw up
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-06 11:19:21 UTC (rev 36993)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/plugin.xml 2011-12-06 11:30:53 UTC (rev 36994)
@@ -62,7 +62,7 @@
<extension
point="org.eclipse.wst.server.core.serverTypes">
<serverType
- behaviourClass="org.jboss.ide.eclipse.as.core.server.internal.DelegatingServerBehavior"
+ behaviourClass="org.jboss.tools.openshift.express.internal.core.behaviour.ExpressBehaviour"
class="org.jboss.ide.eclipse.as.core.server.internal.JBossServer"
name="%openshift.express.name"
description="%openshift.express.description"
14 years, 4 months
JBoss Tools SVN: r36993 - 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-06 06:19:21 -0500 (Tue, 06 Dec 2011)
New Revision: 36993
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/AdapterWizardPageModel.java
Log:
[JBIDE-10171] "enable project" is now only checkable for as7 applications
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-06 11:17:35 UTC (rev 36992)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AdapterWizardPage.java 2011-12-06 11:19:21 UTC (rev 36993)
@@ -66,12 +66,13 @@
private IServerType serverTypeToCreate;
private IObservableValue serverAdapterCheckboxObservable;
-
+ private IObservableValue enableProjectChecboxIsEnabled;
+
public AdapterWizardPage(ImportProjectWizard wizard, ImportProjectWizardModel model) {
super(
"Import Project",
"Select the project to enable, the Git clone destination, the branch to clone"
- + " and configure your server adapter ",
+ + " and configure your server adapter ",
"Server Adapter",
wizard);
this.model = new AdapterWizardPageModel(model);
@@ -102,17 +103,19 @@
.align(SWT.LEFT, SWT.CENTER).align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(mergeGroup);
GridLayoutFactory.fillDefaults().margins(6, 6).numColumns(3).applyTo(mergeGroup);
- Button mergeEnabledButton = new Button(mergeGroup, SWT.CHECK);
- mergeEnabledButton.setText("Enable existing project");
+ Button enableProjectButton = new Button(mergeGroup, SWT.CHECK);
+ enableProjectButton.setText("Enable existing project");
GridDataFactory.fillDefaults()
- .align(SWT.LEFT, SWT.CENTER).applyTo(mergeEnabledButton);
+ .align(SWT.LEFT, SWT.CENTER).applyTo(enableProjectButton);
IObservableValue enableProjectObservable =
BeanProperties.value(AdapterWizardPageModel.PROPERTY_ENABLE_PROJECT).observe(model);
ValueBindingBuilder
- .bind(WidgetProperties.selection().observe(mergeEnabledButton))
+ .bind(WidgetProperties.selection().observe(enableProjectButton))
.to(enableProjectObservable)
.in(dbc);
+ this.enableProjectChecboxIsEnabled = WidgetProperties.enabled().observe(enableProjectButton);
+
Text enabledProjectText = new Text(mergeGroup, SWT.BORDER);
enabledProjectText.setEditable(false);
GridDataFactory
@@ -137,11 +140,12 @@
.bind(WidgetProperties.text().observe(enabledProjectText))
.to(enabledProjectNameObservable)
.in(dbc);
-
ValueBindingBuilder
.bind(enableProjectObservable)
.to(WidgetProperties.enabled().observe(enabledProjectText))
.in(dbc);
+ dbc.addValidationStatusProvider(
+ new EnableProjectValidator(enableProjectObservable, enabledProjectNameObservable));
Button browseProjectsButton = new Button(mergeGroup, SWT.NONE);
browseProjectsButton.setText("Browse");
@@ -154,10 +158,7 @@
.in(dbc);
enableProjectObservable.setValue(false);
-
- dbc.addValidationStatusProvider(new EnableProjectValidator(enableProjectObservable,
- enabledProjectNameObservable));
-
+
return mergeGroup;
}
@@ -405,6 +406,9 @@
}
protected void onPageActivated(DataBindingContext dbc) {
+ // allow to enable a proj only for as7 openshift applications
+ enableProjectChecboxIsEnabled.setValue(model.isJBossAS7Application());
+
model.resetRepositoryPath();
serverTypeToCreate = getServerTypeToCreate();
model.getWizardModel().setProperty(AdapterWizardPageModel.SERVER_TYPE, serverTypeToCreate);
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-06 11:17:35 UTC (rev 36992)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AdapterWizardPageModel.java 2011-12-06 11:19:21 UTC (rev 36993)
@@ -164,6 +164,14 @@
return application.getApplicationUrl();
}
+ public boolean isJBossAS7Application() {
+ IApplication application = wizardModel.getApplication();
+ if (application == null) {
+ return false;
+ }
+ return ICartridge.JBOSSAS_7.equals(application.getCartridge());
+ }
+
public void setApplicationUrl(String applicationUrl) {
firePropertyChange(PROPERTY_APPLICATION_URL, null, applicationUrl);
}
14 years, 4 months
JBoss Tools SVN: r36992 - branches/jbosstools-3.3.0.M5/openshift/plugins/org.jboss.tools.openshift.express.ui.
by jbosstools-commits@lists.jboss.org
Author: fbricon
Date: 2011-12-06 06:17:35 -0500 (Tue, 06 Dec 2011)
New Revision: 36992
Modified:
branches/jbosstools-3.3.0.M5/openshift/plugins/org.jboss.tools.openshift.express.ui/plugin.xml
Log:
JBIDE-10354: add openshift profile template to pom.xml editor
Modified: branches/jbosstools-3.3.0.M5/openshift/plugins/org.jboss.tools.openshift.express.ui/plugin.xml
===================================================================
--- branches/jbosstools-3.3.0.M5/openshift/plugins/org.jboss.tools.openshift.express.ui/plugin.xml 2011-12-06 11:12:00 UTC (rev 36991)
+++ branches/jbosstools-3.3.0.M5/openshift/plugins/org.jboss.tools.openshift.express.ui/plugin.xml 2011-12-06 11:17:35 UTC (rev 36992)
@@ -188,4 +188,30 @@
</extension>
-->
+ <extension point="org.eclipse.ui.editors.templates">
+ <template id="org.jboss.tools.maven.editor.xml.templates.profiles.openshift"
+ contextTypeId="org.eclipse.m2e.editor.xml.templates.contextType.profiles"
+ name="OpenShift Express profile"
+ description="OpenShift Express profile">
+ <pattern> <profile>
+ <!-- When built in OpenShift the 'openshift' profile will be used when invoking mvn. -->
+ <!-- Use this profile for any OpenShift specific customization your app will need. -->
+ <!-- By default that is to put the resulting archive into the 'deployments' folder. -->
+ <!-- http://maven.apache.org/guides/mini/guide-building-for-different-environm... -->
+ <id>openshift</id>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-war-plugin</artifactId>
+ <version>2.1.1</version>
+ <configuration>
+ <outputDirectory>deployments</outputDirectory>
+ <warName>ROOT</warName>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</profile></pattern>
+ </template>
+ </extension>
</plugin>
14 years, 4 months
JBoss Tools SVN: r36991 - in branches/jbosstools-3.3.0.M5: as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal and 3 other directories.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2011-12-06 06:12:00 -0500 (Tue, 06 Dec 2011)
New Revision: 36991
Added:
branches/jbosstools-3.3.0.M5/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/AbstractBehaviourDelegate.java
branches/jbosstools-3.3.0.M5/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressBehaviour.java
Modified:
branches/jbosstools-3.3.0.M5/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/IJBossServerPublishMethod.java
branches/jbosstools-3.3.0.M5/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/AbstractJBossBehaviourDelegate.java
branches/jbosstools-3.3.0.M5/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/DeployableServerBehavior.java
branches/jbosstools-3.3.0.M5/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/extensions/ModuleActionProvider.java
branches/jbosstools-3.3.0.M5/openshift/plugins/org.jboss.tools.openshift.express.ui/plugin.xml
branches/jbosstools-3.3.0.M5/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressBehaviourDelegate.java
branches/jbosstools-3.3.0.M5/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressPublishMethod.java
Log:
JBIDE-10355 - openshift usability for branch
Modified: branches/jbosstools-3.3.0.M5/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/IJBossServerPublishMethod.java
===================================================================
--- branches/jbosstools-3.3.0.M5/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/IJBossServerPublishMethod.java 2011-12-06 11:11:55 UTC (rev 36990)
+++ branches/jbosstools-3.3.0.M5/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/IJBossServerPublishMethod.java 2011-12-06 11:12:00 UTC (rev 36991)
@@ -22,6 +22,17 @@
// public IJBossServerPublishMethodType getPublishMethodType();
public void publishStart(DeployableServerBehavior behaviour, IProgressMonitor monitor) throws CoreException;
public int publishFinish(DeployableServerBehavior behaviour, IProgressMonitor monitor) throws CoreException;
+
+ /**
+ * Publish this module
+ * @param behaviour The behaviour associated with this server
+ * @param kind The kind of publish, as a constant from IServer
+ * @param deltaKind The kind of delta, as a constant from ServerBehaviourDelegate
+ * @param module The module to be published
+ * @param monitor The progress monitor
+ * @return An IServer.STATE_XXX constant, or -1 if the behaviour should not change server state
+ * @throws CoreException
+ */
public int publishModule(DeployableServerBehavior behaviour, int kind, int deltaKind, IModule[] module, IProgressMonitor monitor) throws CoreException;
// Methods moved from publishers into the publish method
Added: branches/jbosstools-3.3.0.M5/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/AbstractBehaviourDelegate.java
===================================================================
--- branches/jbosstools-3.3.0.M5/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/AbstractBehaviourDelegate.java (rev 0)
+++ branches/jbosstools-3.3.0.M5/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/AbstractBehaviourDelegate.java 2011-12-06 11:12:00 UTC (rev 36991)
@@ -0,0 +1,96 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.ide.eclipse.as.core.server.internal;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+
+/**
+ * A complete stub implementation of the interface
+ */
+public abstract class AbstractBehaviourDelegate implements IJBossBehaviourDelegate {
+
+ protected DelegatingServerBehavior actualBehavior;
+
+ @Override
+ public void setActualBehaviour(DelegatingServerBehavior actualBehaviour) {
+ this.actualBehavior = actualBehaviour;
+ }
+
+ @Override
+ public String getBehaviourTypeId() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void stop(boolean force) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void publishStart(IProgressMonitor monitor) throws CoreException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void publishFinish(IProgressMonitor monitor) throws CoreException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void onServerStarting() {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void onServerStopping() {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void onServerStarted() {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void onServerStopped() {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public IStatus canChangeState(String launchMode) {
+ // TODO Auto-generated method stub
+ return Status.CANCEL_STATUS;
+ }
+
+ @Override
+ public String getDefaultStopArguments() throws CoreException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void dispose() {
+ // TODO Auto-generated method stub
+
+ }
+
+}
Modified: branches/jbosstools-3.3.0.M5/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/AbstractJBossBehaviourDelegate.java
===================================================================
--- branches/jbosstools-3.3.0.M5/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/AbstractJBossBehaviourDelegate.java 2011-12-06 11:11:55 UTC (rev 36990)
+++ branches/jbosstools-3.3.0.M5/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/AbstractJBossBehaviourDelegate.java 2011-12-06 11:12:00 UTC (rev 36991)
@@ -11,7 +11,6 @@
package org.jboss.ide.eclipse.as.core.server.internal;
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.wst.server.core.IServer;
@@ -23,28 +22,14 @@
import org.jboss.ide.eclipse.as.core.util.PollThreadUtils;
import org.jboss.ide.eclipse.as.core.util.ServerConverter;
-public abstract class AbstractJBossBehaviourDelegate implements IJBossBehaviourDelegate {
+public abstract class AbstractJBossBehaviourDelegate extends AbstractBehaviourDelegate {
- private DelegatingServerBehavior actualBehavior;
private PollThread pollThread = null;
- @Override
- public void setActualBehaviour(DelegatingServerBehavior actualBehaviour) {
- this.actualBehavior = actualBehaviour;
- }
-
public IServer getServer() {
return actualBehavior.getServer();
}
- @Override
- public void publishStart(IProgressMonitor monitor) throws CoreException {
- }
-
- @Override
- public void publishFinish(IProgressMonitor monitor) throws CoreException {
- }
-
public void stop(boolean force) {
if( LaunchCommandPreferences.isIgnoreLaunchCommand(getServer())) {
actualBehavior.setServerStopped();
@@ -59,18 +44,6 @@
protected abstract IStatus gracefullStop();
- public void onServerStarting() {
- }
-
- public void onServerStopping() {
- }
-
- public void onServerStarted() {
- }
-
- public void onServerStopped() {
- }
-
@Override
public IStatus canChangeState(String launchMode) {
return Status.OK_STATUS;
@@ -157,9 +130,4 @@
protected void setServerStarting() {
actualBehavior.setServerStarting();
}
-
- @Override
- public void dispose() {
- // do nothing
- }
}
Modified: branches/jbosstools-3.3.0.M5/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/DeployableServerBehavior.java
===================================================================
--- branches/jbosstools-3.3.0.M5/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/DeployableServerBehavior.java 2011-12-06 11:11:55 UTC (rev 36990)
+++ branches/jbosstools-3.3.0.M5/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/DeployableServerBehavior.java 2011-12-06 11:12:00 UTC (rev 36991)
@@ -90,8 +90,10 @@
throw new CoreException(new Status(IStatus.ERROR, JBossServerCorePlugin.PLUGIN_ID, "Not publishing")); //$NON-NLS-1$
try {
int result = method.publishModule(this, kind, deltaKind, module, monitor);
- setModulePublishState(module, result);
- setModuleState(module, IServer.STATE_STARTED );
+ if( result != -1 ) {
+ setModulePublishState(module, result);
+ setModuleState(module, IServer.STATE_STARTED );
+ }
} catch(CoreException ce) {
setModulePublishState(module, IServer.PUBLISH_STATE_FULL);
setModuleState(module, IServer.STATE_UNKNOWN );
Modified: branches/jbosstools-3.3.0.M5/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/extensions/ModuleActionProvider.java
===================================================================
--- branches/jbosstools-3.3.0.M5/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/extensions/ModuleActionProvider.java 2011-12-06 11:11:55 UTC (rev 36990)
+++ branches/jbosstools-3.3.0.M5/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/extensions/ModuleActionProvider.java 2011-12-06 11:12:00 UTC (rev 36991)
@@ -4,6 +4,7 @@
import java.util.Iterator;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IContributionItem;
@@ -22,13 +23,12 @@
import org.eclipse.wst.server.core.IServerWorkingCopy;
import org.eclipse.wst.server.core.ServerCore;
import org.eclipse.wst.server.core.ServerUtil;
-import org.eclipse.wst.server.core.internal.PublishServerJob;
import org.eclipse.wst.server.core.internal.Server;
import org.eclipse.wst.server.ui.internal.cnf.ServerActionProvider;
import org.eclipse.wst.server.ui.internal.view.servers.ModuleServer;
-import org.jboss.ide.eclipse.as.core.util.ModuleUtil;
import org.jboss.ide.eclipse.as.ui.JBossServerUISharedImages;
import org.jboss.ide.eclipse.as.ui.Messages;
+import org.jboss.ide.eclipse.as.wtp.core.util.ServerModelUtilities;
public class ModuleActionProvider extends CommonActionProvider {
private Action deleteModuleAction, fullPublishModuleAction, incrementalPublishModuleAction;
@@ -126,12 +126,12 @@
for( int i = 0; i < selection.length; i++ ) {
IModule[] mod = selection[i].module;
s.setModulePublishState(mod, type);
- ArrayList<IModule[]> allChildren = ModuleUtil.getDeepChildren(s, mod);
+ ArrayList<IModule[]> allChildren = ServerModelUtilities.getDeepChildren(s, mod);
for( int j = 0; j < allChildren.size(); j++ ) {
s.setModulePublishState((IModule[])allChildren.get(j), type);
}
}
- new PublishServerJob(s, IServer.PUBLISH_INCREMENTAL, true).schedule();
+ s.publish(IServer.PUBLISH_INCREMENTAL, null, getUserInitiatedAdaptable(), null);
}
}
@@ -152,7 +152,7 @@
(IModule[]) topModsToRemove.toArray(new IModule[topModsToRemove.size()]);
ServerUtil.modifyModules(serverWC, new IModule[0], modsToRemove, new NullProgressMonitor());
IServer server2 = serverWC.save(true, null);
- new PublishServerJob(server2, IServer.PUBLISH_INCREMENTAL, true).schedule();
+ server2.publish(IServer.PUBLISH_INCREMENTAL, null, getUserInitiatedAdaptable(), null);
}
} catch (CoreException e) {
// ignore
@@ -161,4 +161,15 @@
t.start();
}
}
+
+ public IAdaptable getUserInitiatedAdaptable() {
+ IAdaptable info = new IAdaptable() {
+ public Object getAdapter(Class adapter) {
+ if (String.class.equals(adapter))
+ return "user";
+ return null;
+ }
+ };
+ return info;
+ }
}
Modified: branches/jbosstools-3.3.0.M5/openshift/plugins/org.jboss.tools.openshift.express.ui/plugin.xml
===================================================================
--- branches/jbosstools-3.3.0.M5/openshift/plugins/org.jboss.tools.openshift.express.ui/plugin.xml 2011-12-06 11:11:55 UTC (rev 36990)
+++ branches/jbosstools-3.3.0.M5/openshift/plugins/org.jboss.tools.openshift.express.ui/plugin.xml 2011-12-06 11:12:00 UTC (rev 36991)
@@ -62,7 +62,7 @@
<extension
point="org.eclipse.wst.server.core.serverTypes">
<serverType
- behaviourClass="org.jboss.ide.eclipse.as.core.server.internal.DelegatingServerBehavior"
+ behaviourClass="org.jboss.tools.openshift.express.internal.core.behaviour.ExpressBehaviour"
class="org.jboss.ide.eclipse.as.core.server.internal.JBossServer"
name="%openshift.express.name"
description="%openshift.express.description"
Added: branches/jbosstools-3.3.0.M5/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressBehaviour.java
===================================================================
--- branches/jbosstools-3.3.0.M5/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressBehaviour.java (rev 0)
+++ branches/jbosstools-3.3.0.M5/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressBehaviour.java 2011-12-06 11:12:00 UTC (rev 36991)
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat Inc..
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat Incorporated - initial API and implementation
+ *******************************************************************************/
+package org.jboss.tools.openshift.express.internal.core.behaviour;
+
+import java.util.List;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.wst.server.core.IModule;
+import org.jboss.ide.eclipse.as.core.server.internal.DelegatingServerBehavior;
+
+public class ExpressBehaviour extends DelegatingServerBehavior {
+ private IAdaptable publishAdaptableInfo;
+ public void publish(int kind, List<IModule[]> modules, IProgressMonitor monitor, IAdaptable info) throws CoreException {
+ publishAdaptableInfo = info;
+ try {
+ super.publish(kind, modules, monitor, info);
+ } finally {
+ publishAdaptableInfo = null;
+ }
+ }
+
+ public IAdaptable getPublishAdaptableInfo() {
+ return publishAdaptableInfo;
+ }
+}
Modified: branches/jbosstools-3.3.0.M5/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressBehaviourDelegate.java
===================================================================
--- branches/jbosstools-3.3.0.M5/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressBehaviourDelegate.java 2011-12-06 11:11:55 UTC (rev 36990)
+++ branches/jbosstools-3.3.0.M5/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressBehaviourDelegate.java 2011-12-06 11:12:00 UTC (rev 36991)
@@ -10,87 +10,15 @@
*******************************************************************************/
package org.jboss.tools.openshift.express.internal.core.behaviour;
-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.jboss.ide.eclipse.as.core.server.internal.DelegatingServerBehavior;
-import org.jboss.ide.eclipse.as.core.server.internal.IJBossBehaviourDelegate;
+import org.jboss.ide.eclipse.as.core.server.internal.AbstractBehaviourDelegate;
-public class ExpressBehaviourDelegate implements IJBossBehaviourDelegate {
- private DelegatingServerBehavior realBehaviour;
+public class ExpressBehaviourDelegate extends AbstractBehaviourDelegate {
public ExpressBehaviourDelegate() {
- // TODO Auto-generated constructor stub
}
@Override
public String getBehaviourTypeId() {
return "openshift";
}
-
- @Override
- public void setActualBehaviour(DelegatingServerBehavior actualBehaviour) {
- realBehaviour = actualBehaviour;
- }
-
- @Override
- public void stop(boolean force) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void publishStart(IProgressMonitor monitor) throws CoreException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void publishFinish(IProgressMonitor monitor) throws CoreException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void onServerStarting() {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void onServerStopping() {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public IStatus canChangeState(String launchMode) {
- return Status.CANCEL_STATUS;
- }
-
- @Override
- public String getDefaultStopArguments() throws CoreException {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public void dispose() {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void onServerStarted() {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void onServerStopped() {
- // TODO Auto-generated method stub
-
- }
-
}
Modified: branches/jbosstools-3.3.0.M5/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressPublishMethod.java
===================================================================
--- branches/jbosstools-3.3.0.M5/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressPublishMethod.java 2011-12-06 11:11:55 UTC (rev 36990)
+++ branches/jbosstools-3.3.0.M5/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressPublishMethod.java 2011-12-06 11:12:00 UTC (rev 36991)
@@ -14,6 +14,7 @@
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
@@ -54,13 +55,29 @@
shareProjects(projects);
projectsLackingGitRepo = null;
}
- return 0;
- }
+ IModule[] modules = behaviour.getServer().getModules();
+ boolean allpublished= true;
+ for (int i = 0; i < modules.length; i++) {
+ if(behaviour.getServer().getModulePublishState(new IModule[]{modules[i]})!=IServer.PUBLISH_STATE_NONE)
+ allpublished=false;
+ }
+ return allpublished ? IServer.PUBLISH_STATE_NONE : IServer.PUBLISH_STATE_INCREMENTAL;
+ }
@Override
public int publishModule(DeployableServerBehavior behaviour, int kind,
int deltaKind, IModule[] module, IProgressMonitor monitor)
throws CoreException {
+
+ // If this action is not user-initiated, bail!
+ IAdaptable a = ((ExpressBehaviour)behaviour).getPublishAdaptableInfo();
+ if( a == null )
+ return -1;
+ String s = (String)a.getAdapter(String.class);
+ if( s == null || !s.equals("user"))
+ return -1;
+
+
int state = behaviour.getServer().getModulePublishState(module);
IProject p = module[module.length-1].getProject();
@@ -75,20 +92,18 @@
return IServer.PUBLISH_STATE_UNKNOWN;
}
- if((kind == IServer.PUBLISH_FULL || state == IServer.PUBLISH_STATE_FULL)) {
- int changed = EGitUtils.countCommitableChanges(p, new NullProgressMonitor() );
- if( changed != 0 && requestCommitAndPushApproval(module, changed)) {
- monitor.beginTask("Publishing " + p.getName(), 200);
- EGitUtils.commit(p, new SubProgressMonitor(monitor, 100));
- EGitUtils.push(EGitUtils.getRepository(p), new SubProgressMonitor(monitor, 100));
- monitor.done();
- return IServer.PUBLISH_STATE_NONE;
- } else if( changed == 0 && requestPushApproval(module)) {
- monitor.beginTask("Publishing " + p.getName(), 100);
- EGitUtils.push(EGitUtils.getRepository(p), new SubProgressMonitor(monitor, 100));
- monitor.done();
- return IServer.PUBLISH_STATE_NONE;
- }
+ int changed = EGitUtils.countCommitableChanges(p, new NullProgressMonitor() );
+ if( changed != 0 && requestCommitAndPushApproval(module, changed)) {
+ monitor.beginTask("Publishing " + p.getName(), 200);
+ EGitUtils.commit(p, new SubProgressMonitor(monitor, 100));
+ EGitUtils.push(EGitUtils.getRepository(p), new SubProgressMonitor(monitor, 100));
+ monitor.done();
+ return IServer.PUBLISH_STATE_NONE;
+ } else if( changed == 0 && requestPushApproval(module)) {
+ monitor.beginTask("Publishing " + p.getName(), 100);
+ EGitUtils.push(EGitUtils.getRepository(p), new SubProgressMonitor(monitor, 100));
+ monitor.done();
+ return IServer.PUBLISH_STATE_NONE;
}
return state;
}
14 years, 4 months