Author: dgolovin
Date: 2009-02-17 21:07:26 -0500 (Tue, 17 Feb 2009)
New Revision: 13652
Added:
trunk/as/tests/org.jboss.ide.eclipse.as.ui.test/.classpath
trunk/as/tests/org.jboss.ide.eclipse.as.ui.test/.project
trunk/as/tests/org.jboss.ide.eclipse.as.ui.test/.settings/
trunk/as/tests/org.jboss.ide.eclipse.as.ui.test/.settings/org.eclipse.jdt.core.prefs
trunk/as/tests/org.jboss.ide.eclipse.as.ui.test/META-INF/
trunk/as/tests/org.jboss.ide.eclipse.as.ui.test/META-INF/MANIFEST.MF
trunk/as/tests/org.jboss.ide.eclipse.as.ui.test/build.properties
trunk/as/tests/org.jboss.ide.eclipse.as.ui.test/plugin.xml
trunk/as/tests/org.jboss.ide.eclipse.as.ui.test/server/
trunk/as/tests/org.jboss.ide.eclipse.as.ui.test/server/default/
trunk/as/tests/org.jboss.ide.eclipse.as.ui.test/server/default/tmp/
trunk/as/tests/org.jboss.ide.eclipse.as.ui.test/server/default/tmp/jbosstoolsTemp/
trunk/as/tests/org.jboss.ide.eclipse.as.ui.test/src/
trunk/as/tests/org.jboss.ide.eclipse.as.ui.test/src/org/
trunk/as/tests/org.jboss.ide.eclipse.as.ui.test/src/org/jboss/
trunk/as/tests/org.jboss.ide.eclipse.as.ui.test/src/org/jboss/ide/
trunk/as/tests/org.jboss.ide.eclipse.as.ui.test/src/org/jboss/ide/eclipse/
trunk/as/tests/org.jboss.ide.eclipse.as.ui.test/src/org/jboss/ide/eclipse/as/
trunk/as/tests/org.jboss.ide.eclipse.as.ui.test/src/org/jboss/ide/eclipse/as/ui/
trunk/as/tests/org.jboss.ide.eclipse.as.ui.test/src/org/jboss/ide/eclipse/as/ui/test/
trunk/as/tests/org.jboss.ide.eclipse.as.ui.test/src/org/jboss/ide/eclipse/as/ui/test/AllAsUiTests.java
trunk/as/tests/org.jboss.ide.eclipse.as.ui.test/src/org/jboss/ide/eclipse/as/ui/wizards/
trunk/as/tests/org.jboss.ide.eclipse.as.ui.test/src/org/jboss/ide/eclipse/as/ui/wizards/test/
trunk/as/tests/org.jboss.ide.eclipse.as.ui.test/src/org/jboss/ide/eclipse/as/ui/wizards/test/NewServerWizardTest.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-3824 JUnit Test added
Added: trunk/as/tests/org.jboss.ide.eclipse.as.ui.test/.classpath
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.ui.test/.classpath
(rev 0)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.ui.test/.classpath 2009-02-18 02:07:26 UTC
(rev 13652)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con"
path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Property changes on: trunk/as/tests/org.jboss.ide.eclipse.as.ui.test/.classpath
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/as/tests/org.jboss.ide.eclipse.as.ui.test/.project
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.ui.test/.project (rev
0)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.ui.test/.project 2009-02-18 02:07:26 UTC (rev
13652)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.jboss.ide.eclipse.as.ui.test</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Property changes on: trunk/as/tests/org.jboss.ide.eclipse.as.ui.test/.project
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/as/tests/org.jboss.ide.eclipse.as.ui.test/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.ui.test/.settings/org.eclipse.jdt.core.prefs
(rev 0)
+++
trunk/as/tests/org.jboss.ide.eclipse.as.ui.test/.settings/org.eclipse.jdt.core.prefs 2009-02-18
02:07:26 UTC (rev 13652)
@@ -0,0 +1,7 @@
+#Fri Feb 13 13:01:05 PST 2009
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6
Property changes on:
trunk/as/tests/org.jboss.ide.eclipse.as.ui.test/.settings/org.eclipse.jdt.core.prefs
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/as/tests/org.jboss.ide.eclipse.as.ui.test/META-INF/MANIFEST.MF
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.ui.test/META-INF/MANIFEST.MF
(rev 0)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.ui.test/META-INF/MANIFEST.MF 2009-02-18
02:07:26 UTC (rev 13652)
@@ -0,0 +1,15 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Test Plug-in
+Bundle-SymbolicName: org.jboss.ide.eclipse.as.ui.test;singleton:=true
+Bundle-Version: 1.0.0
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Require-Bundle: org.junit,
+ org.eclipse.ui,
+ org.jboss.tools.tests;bundle-version="2.0.0",
+ org.eclipse.wst.server.core;bundle-version="1.1.3",
+ org.eclipse.equinox.common;bundle-version="3.4.0",
+ org.eclipse.jdt.launching;bundle-version="3.4.1",
+ org.eclipse.core.runtime;bundle-version="3.4.0",
+ org.eclipse.core.resources;bundle-version="3.4.2",
+ org.jboss.ide.eclipse.as.ui;bundle-version="1.0.0"
Property changes on: trunk/as/tests/org.jboss.ide.eclipse.as.ui.test/META-INF/MANIFEST.MF
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/as/tests/org.jboss.ide.eclipse.as.ui.test/build.properties
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.ui.test/build.properties
(rev 0)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.ui.test/build.properties 2009-02-18 02:07:26
UTC (rev 13652)
@@ -0,0 +1,5 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml
Property changes on: trunk/as/tests/org.jboss.ide.eclipse.as.ui.test/build.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/as/tests/org.jboss.ide.eclipse.as.ui.test/plugin.xml
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.ui.test/plugin.xml
(rev 0)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.ui.test/plugin.xml 2009-02-18 02:07:26 UTC
(rev 13652)
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+
+</plugin>
Property changes on: trunk/as/tests/org.jboss.ide.eclipse.as.ui.test/plugin.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/as/tests/org.jboss.ide.eclipse.as.ui.test/src/org/jboss/ide/eclipse/as/ui/test/AllAsUiTests.java
===================================================================
---
trunk/as/tests/org.jboss.ide.eclipse.as.ui.test/src/org/jboss/ide/eclipse/as/ui/test/AllAsUiTests.java
(rev 0)
+++
trunk/as/tests/org.jboss.ide.eclipse.as.ui.test/src/org/jboss/ide/eclipse/as/ui/test/AllAsUiTests.java 2009-02-18
02:07:26 UTC (rev 13652)
@@ -0,0 +1,16 @@
+package org.jboss.ide.eclipse.as.ui.test;
+
+import org.jboss.ide.eclipse.as.ui.wizards.test.NewServerWizardTest;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+public class AllAsUiTests {
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite(AllAsUiTests.class.getName());
+ suite.addTestSuite(NewServerWizardTest.class);
+ return suite;
+ }
+
+}
Property changes on:
trunk/as/tests/org.jboss.ide.eclipse.as.ui.test/src/org/jboss/ide/eclipse/as/ui/test/AllAsUiTests.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/as/tests/org.jboss.ide.eclipse.as.ui.test/src/org/jboss/ide/eclipse/as/ui/wizards/test/NewServerWizardTest.java
===================================================================
---
trunk/as/tests/org.jboss.ide.eclipse.as.ui.test/src/org/jboss/ide/eclipse/as/ui/wizards/test/NewServerWizardTest.java
(rev 0)
+++
trunk/as/tests/org.jboss.ide.eclipse.as.ui.test/src/org/jboss/ide/eclipse/as/ui/wizards/test/NewServerWizardTest.java 2009-02-18
02:07:26 UTC (rev 13652)
@@ -0,0 +1,128 @@
+package org.jboss.ide.eclipse.as.ui.wizards.test;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+
+import junit.framework.TestCase;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.ILogListener;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jdt.launching.IVMInstall;
+import org.eclipse.jdt.launching.JavaRuntime;
+import org.eclipse.jface.wizard.IWizard;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.swt.widgets.TreeItem;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.wst.server.core.IRuntimeType;
+import org.eclipse.wst.server.core.IRuntimeWorkingCopy;
+import org.eclipse.wst.server.core.ServerUtil;
+import org.eclipse.wst.server.core.internal.RuntimeWorkingCopy;
+import org.jboss.ide.eclipse.as.ui.wizards.JBossServerWizardFragment;
+import org.jboss.tools.test.util.JobUtils;
+import org.jboss.tools.test.util.SwtUtils;
+import org.jboss.tools.test.util.WorkbenchUtils;
+
+public class NewServerWizardTest extends TestCase implements ILogListener {
+
+ public static final String JBOSS_AS_4_2 = "JBoss AS 4.2";
+ public static final String JBOSS_COMMUNITY = "JBoss Community";
+ public static final String NEW_SERVER_WIZARD_ID =
"org.eclipse.wst.server.ui.new.server";
+ public static final String JBOSS_AS_CORE_RUNTIME_CONFIGURATION_NAME =
"org.jboss.ide.eclipse.as.core.runtime.configurationName";
+ public static final String PROPERTY_VM_TYPE_ID = "PROPERTY_VM_TYPE_ID";
+ public static final String PROPERTY_VM_ID = "PROPERTY_VM_ID";
+ public static final String JBOSS_PATH_PROP_NAME =
"jbosstools.test.jboss.home.4.2";
+ public static final String JBOSS_AS_RUNTIME_ID =
"org.jboss.ide.eclipse.as.runtime.42";
+
+ public NewServerWizardTest(String name) {
+ super(name);
+ Platform.addLogListener(this);
+ }
+
+ public void testJbide() throws CoreException {
+
+ String jbossPath = System.getProperty(JBOSS_PATH_PROP_NAME);
+ if(jbossPath==null) {
+ throw new IllegalArgumentException("Yo have to define " +
JBOSS_PATH_PROP_NAME
+ + "system property which points to JBoss AS 4.2 home folder");
+ }
+
+ IRuntimeType[] runtimeTypes = ServerUtil.getRuntimeTypes(null, null,
JBOSS_AS_RUNTIME_ID
+ );
+ if (runtimeTypes.length > 0) {
+ IRuntimeWorkingCopy runtime = runtimeTypes[0].createRuntime(null, null);
+ runtime.setLocation(new Path(JBOSS_PATH_PROP_NAME));
+ runtime.setName("test");
+ IVMInstall defaultVM = JavaRuntime.getDefaultVMInstall();
+ ((RuntimeWorkingCopy) runtime).setAttribute(PROPERTY_VM_ID,
+ defaultVM.getId());
+ ((RuntimeWorkingCopy) runtime).setAttribute(PROPERTY_VM_TYPE_ID,
+ defaultVM.getVMInstallType().getId());
+ ((RuntimeWorkingCopy) runtime).setAttribute(
+ JBOSS_AS_CORE_RUNTIME_CONFIGURATION_NAME,
+ "default");
+ runtime.save(false, null);
+ }
+
+ IWizard newServerWizard = WorkbenchUtils.findWizardByDefId(NEW_SERVER_WIZARD_ID);
+
+ WizardDialog dialog = new WizardDialog(
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
+ newServerWizard);
+ dialog.setBlockOnOpen(false);
+ dialog.open();
+ Composite pageControl = (Composite)newServerWizard.getStartingPage().getControl();
+
+ Tree tree = (Tree)SwtUtils.findControlByClass(pageControl, Tree.class);
+ TreeItem[] items = tree.getItems();
+ for (TreeItem treeItem : items) {
+ if(treeItem.getText().equals(JBOSS_COMMUNITY)) {
+ treeItem.clearAll(true);
+ TreeItem jBossAS42 = new TreeItem(treeItem,SWT.NONE);
+ jBossAS42.setText(JBOSS_AS_4_2);
+ tree.setSelection(jBossAS42);
+ JobUtils.delay(1000);
+ dialog.showPage(newServerWizard.getStartingPage().getNextPage());
+ JobUtils.delay(1000);
+ }
+ }
+ dialog.close();
+ newServerWizard = WorkbenchUtils.findWizardByDefId(NEW_SERVER_WIZARD_ID);
+ dialog = new WizardDialog(
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
+ newServerWizard);
+ dialog.setBlockOnOpen(false);
+ dialog.open();
+ pageControl = (Composite)newServerWizard.getStartingPage().getControl();
+ tree = (Tree)SwtUtils.findControlByClass(pageControl, Tree.class);
+ items = tree.getItems();
+ for (TreeItem treeItem : items) {
+ if(treeItem.getText().equals(JBOSS_COMMUNITY)) {
+ treeItem.clearAll(true);
+ TreeItem jBossAS42 = new TreeItem(treeItem,SWT.NONE);
+ jBossAS42.setText(JBOSS_AS_4_2);
+ tree.setSelection(jBossAS42);
+ JobUtils.delay(1000);
+ newServerWizard.performFinish();
+ JobUtils.delay(1000);
+ }
+ }
+ dialog.close();
+
+ }
+
+ @Override
+ public void logging(IStatus status, String plugin) {
+ StringWriter out = new StringWriter();
+ out.append(status.getMessage()).append('\n');
+ status.getException().printStackTrace(new PrintWriter(out));
+ if(out.toString().contains(JBossServerWizardFragment.class.getName())) {
+ fail(out.toString());
+ }
+ }
+}
Property changes on:
trunk/as/tests/org.jboss.ide.eclipse.as.ui.test/src/org/jboss/ide/eclipse/as/ui/wizards/test/NewServerWizardTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain