[jbosstools-commits] JBoss Tools SVN: r35898 - in trunk/cdi/tests/org.jboss.tools.cdi.bot.test: resources/cdi and 7 other directories.
jbosstools-commits at lists.jboss.org
jbosstools-commits at lists.jboss.org
Fri Oct 21 08:27:53 EDT 2011
Author: jjankovi
Date: 2011-10-21 08:27:51 -0400 (Fri, 21 Oct 2011)
New Revision: 35898
Added:
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/CDISmokeBotTests.launch
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/resources/cdi/MyBean3.java.cdi
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/resources/cdi/MyBean4.java.cdi
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/resources/cdi/DisposerProducerBean.java.cdi
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/CDIAllBotTests.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/CDISmokeBotTests.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/editor/BeansEditorTest.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/openon/CDIOpenOnTest.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/CDIQuickFixTest.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/seam3/CDISeam3Test.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/actions/CDIBase.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/wizard/CdiATWizardTest.java
Log:
CDI OpenOn test correction + huge refactoring of all CDI tests
Added: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/CDISmokeBotTests.launch
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/CDISmokeBotTests.launch (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/CDISmokeBotTests.launch 2011-10-21 12:27:51 UTC (rev 35898)
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.swtbot.eclipse.ui.launcher.JunitLaunchConfig">
+<booleanAttribute key="append.args" value="true"/>
+<booleanAttribute key="askclear" value="false"/>
+<booleanAttribute key="automaticAdd" value="true"/>
+<booleanAttribute key="automaticValidate" value="false"/>
+<stringAttribute key="bootstrap" value=""/>
+<stringAttribute key="checked" value="[NONE]"/>
+<booleanAttribute key="clearConfig" value="true"/>
+<booleanAttribute key="clearws" value="true"/>
+<booleanAttribute key="clearwslog" value="false"/>
+<booleanAttribute key="com.mountainminds.eclemma.core.INPLACE_INSTRUMENTATION" value="true"/>
+<listAttribute key="com.mountainminds.eclemma.core.INSTRUMENTATION_PATHS">
+<listEntry value="/org.jboss.tools.cdi.core/bin"/>
+<listEntry value="/org.jboss.tools.cdi.solder.core/bin"/>
+<listEntry value="/org.jboss.tools.cdi.text.ext/bin"/>
+<listEntry value="/org.jboss.tools.cdi.xml/bin"/>
+<listEntry value="/org.jboss.tools.cdi.xml.ui/bin"/>
+<listEntry value="/org.jboss.tools.cdi.ui/bin"/>
+</listAttribute>
+<stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/pde-junit"/>
+<booleanAttribute key="default" value="true"/>
+<booleanAttribute key="includeOptional" value="true"/>
+<stringAttribute key="location" value="${workspace_loc}/../junit-workspace"/>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
+<listEntry value="/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/CDISmokeBotTests.java"/>
+</listAttribute>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
+<listEntry value="1"/>
+</listAttribute>
+<mapAttribute key="org.eclipse.debug.core.environmentVariables">
+<mapEntry key="DISPLAY" value=":1"/>
+</mapAttribute>
+<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>
+<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
+<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
+<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
+<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.jboss.tools.cdi.bot.test.CDISmokeBotTests"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -consoleLog"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.jboss.tools.cdi.bot.test"/>
+<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
+<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Dosgi.requiredJavaVersion=1.5 -XX:MaxPermSize=256m -Xms256m -Xmx512m -Dswtbot.test.properties.file=${env_var:HOME}/swtbot.properties -Dusage_reporting_enabled=false"/>
+<stringAttribute key="pde.version" value="3.3"/>
+<stringAttribute key="product" value="org.eclipse.platform.ide"/>
+<booleanAttribute key="show_selected_only" value="false"/>
+<stringAttribute key="templateConfig" value="${target_home}/configuration/config.ini"/>
+<booleanAttribute key="tracing" value="false"/>
+<booleanAttribute key="useCustomFeatures" value="false"/>
+<booleanAttribute key="useDefaultConfig" value="true"/>
+<booleanAttribute key="useDefaultConfigArea" value="false"/>
+<booleanAttribute key="useProduct" value="true"/>
+</launchConfiguration>
Modified: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/resources/cdi/DisposerProducerBean.java.cdi
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/resources/cdi/DisposerProducerBean.java.cdi 2011-10-21 12:12:17 UTC (rev 35897)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/resources/cdi/DisposerProducerBean.java.cdi 2011-10-21 12:27:51 UTC (rev 35898)
@@ -4,12 +4,12 @@
import javax.enterprise.inject.Produces;
import javax.inject.Inject;
-public class Disposes1 {
+public class DisposesProducerBean {
@Inject
MyBean mybean;
- public Disposes1() {
+ public DisposesProducerBean() {
}
Added: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/resources/cdi/MyBean3.java.cdi
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/resources/cdi/MyBean3.java.cdi (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/resources/cdi/MyBean3.java.cdi 2011-10-21 12:27:51 UTC (rev 35898)
@@ -0,0 +1,16 @@
+package org.cdi.test;
+
+import javax.enterprise.event.Event;
+import javax.inject.Inject;
+
+public class MyBean3 {
+
+ public MyBean3() {
+
+ }
+
+ @Inject
+ @Q1
+ Event<MyBean4> event;
+
+}
Added: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/resources/cdi/MyBean4.java.cdi
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/resources/cdi/MyBean4.java.cdi (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/resources/cdi/MyBean4.java.cdi 2011-10-21 12:27:51 UTC (rev 35898)
@@ -0,0 +1,15 @@
+package org.cdi.test;
+
+import javax.enterprise.event.Observes;
+
+public class MyBean4 {
+
+ public MyBean4() {
+
+ }
+
+ public void observerMethod(@Observes MyBean4 bean) {
+
+ }
+
+}
\ No newline at end of file
Modified: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/CDIAllBotTests.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/CDIAllBotTests.java 2011-10-21 12:12:17 UTC (rev 35897)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/CDIAllBotTests.java 2011-10-21 12:27:51 UTC (rev 35898)
@@ -53,16 +53,15 @@
CDISeam3Test.class
})
public class CDIAllBotTests extends CDIBase{
-
-
+
/*
* init method "setup()" shows a project explorer view as default,
* disable folding (due to easier source code editing)
*/
@BeforeClass
- public static void setUpSuite() {
+ public static void setUpSuite() {
eclipse.showView(ViewType.PROJECT_EXPLORER);
- CDIUtil.disableFolding(bot, util);
+ CDIUtil.disableFolding(bot, util);
}
}
Modified: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/CDISmokeBotTests.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/CDISmokeBotTests.java 2011-10-21 12:12:17 UTC (rev 35897)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/CDISmokeBotTests.java 2011-10-21 12:27:51 UTC (rev 35898)
@@ -10,8 +10,12 @@
******************************************************************************/
package org.jboss.tools.cdi.bot.test;
+import org.jboss.tools.cdi.bot.test.uiutils.actions.CDIBase;
+import org.jboss.tools.cdi.bot.test.uiutils.actions.CDIUtil;
import org.jboss.tools.cdi.bot.test.wizard.CdiATWizardTest;
import org.jboss.tools.ui.bot.ext.RequirementAwareSuite;
+import org.jboss.tools.ui.bot.ext.types.ViewType;
+import org.junit.BeforeClass;
import org.junit.runner.RunWith;
import org.junit.runners.Suite.SuiteClasses;
@@ -33,12 +37,21 @@
*
* Suite duration: aprox. 12min
*
- * @author Lukas Jungmann
* @author Jaroslav Jankovic
*/
@RunWith(RequirementAwareSuite.class)
@SuiteClasses({
CdiATWizardTest.class,
})
-public class CDISmokeBotTests {
+public class CDISmokeBotTests extends CDIBase {
+
+ /*
+ * init method "setup()" shows a project explorer view as default,
+ * disable folding (due to easier source code editing)
+ */
+ @BeforeClass
+ public static void setUpSuite() {
+ eclipse.showView(ViewType.PROJECT_EXPLORER);
+ CDIUtil.disableFolding(bot, util);
+ }
}
Modified: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/editor/BeansEditorTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/editor/BeansEditorTest.java 2011-10-21 12:12:17 UTC (rev 35897)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/editor/BeansEditorTest.java 2011-10-21 12:27:51 UTC (rev 35898)
@@ -29,15 +29,16 @@
import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor;
import org.jboss.tools.cdi.bot.test.CDIAllBotTests;
+import org.jboss.tools.cdi.bot.test.uiutils.actions.CDIBase;
import org.jboss.tools.cdi.bot.test.uiutils.editor.BeansEditor;
import org.jboss.tools.cdi.bot.test.uiutils.editor.BeansEditor.Item;
import org.jboss.tools.ui.bot.ext.RequirementAwareSuite;
-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.jboss.tools.ui.bot.ext.view.ProjectExplorer;
import org.junit.After;
+import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.Before;
import org.junit.BeforeClass;
@@ -51,23 +52,31 @@
/**
* @author Lukas Jungmann
+ * @author jjankovi
*/
@Require(clearProjects = false, perspective = "Java EE", server = @Server(state = ServerState.NotRunning, version = "6.0", operator = ">="))
@RunWith(RequirementAwareSuite.class)
@SuiteClasses({ CDIAllBotTests.class })
-public class BeansEditorTest extends SWTTestExt {
+public class BeansEditorTest extends CDIBase {
private static final String descPath = "WebContent/WEB-INF/beans.xml";
- private static final String project = "CDIProject1";
+ private static final String project = "CDIProject";
+ private static final String PACKAGE_NAME = "org.cdi.test";
private static final Logger LOGGER = Logger.getLogger(BeansEditorTest.class.getName());
@BeforeClass
public static void prepare() {
copyResource("resources/beans.xml", descPath);
- copyResource("resources/Foo.jav_", "src/cdi/Foo.java");
- copyResource("resources/Bar.jav_", "src/cdi/Bar.java");
+ copyResource("resources/Foo.jav_", "src/" + PACKAGE_NAME + "/Foo.java");
+ copyResource("resources/Bar.jav_", "src/" + PACKAGE_NAME + "/Bar.java");
}
+ @AfterClass
+ public static void clean() {
+ removeObjectInProjectExplorer(PACKAGE_NAME, project + "/Java Resources/src");
+ removeObjectInProjectExplorer("beans.xml", project + "/WebContent/WEB-INF");
+ }
+
@Before
public void setup() {
new ProjectExplorer().openFile(project, descPath.split("/"));
@@ -80,32 +89,32 @@
@Test
public void testInterceptors() {
- addItem(Item.INTERCEPTOR, "cdi.I1");
- removeItem(Item.INTERCEPTOR, "cdi.I1");
- addItem(Item.INTERCEPTOR, "cdi.I2");
+ addItem(Item.INTERCEPTOR, PACKAGE_NAME + ".I1");
+ removeItem(Item.INTERCEPTOR, PACKAGE_NAME + ".I1");
+ addItem(Item.INTERCEPTOR, PACKAGE_NAME + ".I2");
}
@Test
public void testDecorators() {
- addItem(Item.DECORATOR, "cdi.MapDecorator");
- addItem(Item.DECORATOR, "cdi.ComparableDecorator");
- removeItem(Item.DECORATOR, "cdi.ComparableDecorator");
+ addItem(Item.DECORATOR, PACKAGE_NAME + ".MapDecorator");
+ addItem(Item.DECORATOR, PACKAGE_NAME + ".ComparableDecorator");
+ removeItem(Item.DECORATOR, PACKAGE_NAME + ".ComparableDecorator");
}
@Test
public void testClasses() {
- addItem(Item.CLASS, "cdi.Foo");
- addItem(Item.CLASS, "cdi.Bar");
- removeItem(Item.CLASS, "cdi.Foo");
+ addItem(Item.CLASS, PACKAGE_NAME + ".Foo");
+ addItem(Item.CLASS, PACKAGE_NAME + ".Bar");
+ removeItem(Item.CLASS, PACKAGE_NAME + ".Foo");
}
@Test
public void testStereotypes() {
- addItem(Item.STEREOTYPE, "cdi.S2");
- addItem(Item.STEREOTYPE, "cdi.S3");
- removeItem(Item.STEREOTYPE, "cdi.S3");
- addItem(Item.STEREOTYPE, "cdi.S1");
- removeItem(Item.STEREOTYPE, "cdi.S2");
+ addItem(Item.STEREOTYPE, PACKAGE_NAME + ".S2");
+ addItem(Item.STEREOTYPE, PACKAGE_NAME + ".S3");
+ removeItem(Item.STEREOTYPE, PACKAGE_NAME + ".S3");
+ addItem(Item.STEREOTYPE, PACKAGE_NAME + ".S1");
+ removeItem(Item.STEREOTYPE, PACKAGE_NAME + ".S2");
}
@Test
@@ -116,19 +125,19 @@
String text = be.toTextEditor().getText();
List<Node> nl = getItems(text, Item.INTERCEPTOR);
assertEquals(1, nl.size());
- assertTrue(containsItem(nl, "cdi.I2"));
+ assertTrue(containsItem(nl, PACKAGE_NAME + ".I2"));
nl = getItems(text, Item.DECORATOR);
assertEquals(1, nl.size());
- assertTrue(containsItem(nl, "cdi.MapDecorator"));
+ assertTrue(containsItem(nl, PACKAGE_NAME + ".MapDecorator"));
nl = getItems(text, Item.CLASS);
assertEquals(1, nl.size());
- assertTrue(containsItem(nl, "cdi.Bar"));
+ assertTrue(containsItem(nl, PACKAGE_NAME + ".Bar"));
nl = getItems(text, Item.STEREOTYPE);
assertEquals(1, nl.size());
- assertTrue(containsItem(nl, "cdi.S1"));
+ assertTrue(containsItem(nl, PACKAGE_NAME + ".S1"));
}
private void addItem(Item item, String name) {
Modified: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/openon/CDIOpenOnTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/openon/CDIOpenOnTest.java 2011-10-21 12:12:17 UTC (rev 35897)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/openon/CDIOpenOnTest.java 2011-10-21 12:27:51 UTC (rev 35898)
@@ -21,11 +21,12 @@
import org.jboss.tools.ui.bot.ext.config.Annotations.Server;
import org.jboss.tools.ui.bot.ext.config.Annotations.ServerState;
import org.junit.After;
+import org.junit.AfterClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Suite.SuiteClasses;
-/*
+/**
* Test operates on hyperlinks-openons using CDI tools
*
* @author Jaroslav Jankovic
@@ -39,23 +40,31 @@
*
*/
- at Require(perspective = "Java EE", server = @Server(state = ServerState.NotRunning, version = "6.0", operator = ">="))
+ at Require(clearProjects = false, perspective = "Java EE", server = @Server(state = ServerState.NotRunning, version = "6.0", operator = ">="))
@RunWith(RequirementAwareSuite.class)
@SuiteClasses({ CDIAllBotTests.class })
public class CDIOpenOnTest extends CDIBase {
private static final Logger LOGGER = Logger.getLogger(CDIQuickFixTest.class.getName());
- private static final String PROJECT_NAME = "CDIProject3";
+ private static final String PROJECT_NAME = "CDIProject";
private static final String PACKAGE_NAME = "org.cdi.test";
@After
public void waitForJobs() {
util.waitForNonIgnoredJobs();
}
-
+
+ @AfterClass
+ public static void clean() {
+ removeObjectInProjectExplorer("beans.xml", PROJECT_NAME + "/WebContent/WEB-INF");
+ }
+
@Test
- public void testCreateProject() {
- createAndCheckCDIProject(bot, util, projectExplorer, PROJECT_NAME);
+ public void testCheckProjectExists() {
+ if (!projectExists(PROJECT_NAME)) {
+ createAndCheckCDIProject(bot, util, projectExplorer,PROJECT_NAME);
+ }
+ assertTrue(projectExists(PROJECT_NAME));
}
@Test
@@ -136,27 +145,30 @@
assertTrue(getEd().toTextEditor().getSelection().equals("produceMethod"));
openOn("produceMethod", testedBean + ".java", "Open Bound Disposer");
- assertTrue(getEd().toTextEditor().getSelection().equals("disposeMethod"));
+ assertTrue(getEd().toTextEditor().getSelection().equals("disposeMethod"));
}
-
-
+
@Test
public void testObserverOpenOn() {
- /*
- * not implemented yet
- *
- * Bean 1
- * @Inject
- * @Qualifier1
- * Event<MyBean> event2;
- *
- * Bean 2
- * void myObserver(@Observes MyBean bean) {
- *
- * }
- *
- */
+ createComponent(CDICOMPONENT.QUALIFIER, "Q1", PACKAGE_NAME, null);
+ createComponent(CDICOMPONENT.BEAN, "MyBean3", PACKAGE_NAME, null);
+ CDIUtil.copyResourceToClass(getEd(), CDIOpenOnTest.class
+ .getResourceAsStream("/resources/cdi/MyBean3.java.cdi"),
+ false);
+ createComponent(CDICOMPONENT.BEAN, "MyBean4", PACKAGE_NAME, null);
+ CDIUtil.copyResourceToClass(getEd(), CDIOpenOnTest.class
+ .getResourceAsStream("/resources/cdi/MyBean4.java.cdi"),
+ false);
+ bot.editorByTitle("MyBean3.java").show();
+ setEd(bot.activeEditor().toTextEditor());
+ CDIUtil.replaceInEditor(getEd(), bot, " event", " event");
+
+ openOn("observerMethod", "MyBean4.java", "Open CDI Events");
+ assertTrue(getEd().toTextEditor().getSelection().equals("event"));
+
+ openOn("Event<MyBean4> event", "MyBean3.java", "Open CDI Observer Methods");
+ assertTrue(getEd().toTextEditor().getSelection().equals("observerMethod"));
}
Modified: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/CDIQuickFixTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/CDIQuickFixTest.java 2011-10-21 12:12:17 UTC (rev 35897)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/CDIQuickFixTest.java 2011-10-21 12:27:51 UTC (rev 35898)
@@ -22,22 +22,23 @@
import org.jboss.tools.ui.bot.ext.config.Annotations.ServerState;
import org.jboss.tools.ui.bot.ext.view.ProblemsView;
import org.junit.After;
+import org.junit.AfterClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Suite.SuiteClasses;
-/*
+/**
* Test operates on quick fixes of CDI components validation
*
* @author Jaroslav Jankovic
*/
- at Require(perspective = "Java EE", server = @Server(state = ServerState.NotRunning, version = "6.0", operator = ">="))
+ at Require(clearProjects = false, perspective = "Java EE", server = @Server(state = ServerState.NotRunning, version = "6.0", operator = ">="))
@RunWith(RequirementAwareSuite.class)
@SuiteClasses({ CDIAllBotTests.class })
public class CDIQuickFixTest extends CDIBase {
- private static final String PROJECT_NAME = "CDIProject2";
+ private static final String PROJECT_NAME = "CDIProject";
private static final String PACKAGE_NAME = "org.cdi.test";
private static SWTBotTreeItem[] problemsTrees;
private static final String LINE_SEPARATOR = System.getProperty("line.separator");
@@ -51,9 +52,17 @@
util.waitForNonIgnoredJobs();
}
+ @AfterClass
+ public static void clean() {
+ removeObjectInProjectExplorer(PACKAGE_NAME, PROJECT_NAME + "/Java Resources/src");
+ }
+
@Test
- public void testCreateProject() {
- createAndCheckCDIProject(bot, util, projectExplorer,PROJECT_NAME);
+ public void testCheckProjectExists() {
+ if (!projectExists(PROJECT_NAME)) {
+ createAndCheckCDIProject(bot, util, projectExplorer,PROJECT_NAME);
+ }
+ assertTrue(projectExists(PROJECT_NAME));
}
@Test
Modified: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/seam3/CDISeam3Test.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/seam3/CDISeam3Test.java 2011-10-21 12:12:17 UTC (rev 35897)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/seam3/CDISeam3Test.java 2011-10-21 12:27:51 UTC (rev 35898)
@@ -15,37 +15,32 @@
import java.util.logging.Level;
import java.util.logging.Logger;
-import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
import org.jboss.tools.cdi.bot.test.CDIAllBotTests;
import org.jboss.tools.cdi.bot.test.quickfix.CDIQuickFixTest;
import org.jboss.tools.cdi.bot.test.uiutils.actions.CDIBase;
import org.jboss.tools.cdi.bot.test.uiutils.actions.CDIUtil;
import org.jboss.tools.ui.bot.ext.RequirementAwareSuite;
-import org.jboss.tools.ui.bot.ext.SWTJBTExt;
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.jboss.tools.ui.bot.ext.helper.TreeHelper;
import org.junit.After;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Suite.SuiteClasses;
-/*
+/**
* Test operates on seam3 features using CDI tools
*
* @author Jaroslav Jankovic
*/
- at Require(perspective = "Java EE", server = @Server(state = ServerState.NotRunning, version = "6.0", operator = ">="))
+ at Require(clearProjects = false, perspective = "Java EE", server = @Server(state = ServerState.NotRunning, version = "6.0", operator = ">="))
@RunWith(RequirementAwareSuite.class)
@SuiteClasses({ CDIAllBotTests.class })
public class CDISeam3Test extends CDIBase {
private static final Logger LOGGER = Logger.getLogger(CDISeam3Test.class.getName());
- private static final String PROJECT_NAME = "CDISeamProject";
+ private static final String PROJECT_NAME = "CDIProject";
private static final String PACKAGE_NAME = "org.cdi.test";
private static final String GENERIC_PACKAGE_NAME = "org.cdi.generic";
@@ -56,7 +51,10 @@
@Test
public void testCreateProjectWithSeamLibraries() {
- createAndCheckCDIProject(bot, util, projectExplorer, PROJECT_NAME);
+ if (!projectExists(PROJECT_NAME)) {
+ createAndCheckCDIProject(bot, util, projectExplorer,PROJECT_NAME);
+ }
+ assertTrue(projectExists(PROJECT_NAME));
addLibrary("seam-solder.jar");
checkLibrary("seam-solder.jar");
}
@@ -125,24 +123,6 @@
*/
}
-
- private void moveFileInProjectExplorer(String file, String sourceFolder, String destFolder) {
- SWTBotTree tree = projectExplorer.bot().tree();
- SWTBotTreeItem item = projectExplorer.selectTreeItem(file, sourceFolder.split("/"));
-
- CDIUtil.nodeContextMenu(tree, item, "Move...").click();
-
- assertFalse(bot.button("OK").isEnabled());
-
- tree = bot.tree();
- tree.collapseNode(destFolder.split("/")[0]);
-
- TreeHelper.expandNode(bot, destFolder.split("/")).select();
-
- assertTrue(bot.button("OK").isEnabled());
- bot.button("OK").click();
- }
-
private void addLibrary(String libraryName) {
try {
addLibraryIntoProject(PROJECT_NAME, libraryName);
Modified: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/actions/CDIBase.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/actions/CDIBase.java 2011-10-21 12:12:17 UTC (rev 35897)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/actions/CDIBase.java 2011-10-21 12:27:51 UTC (rev 35898)
@@ -20,6 +20,7 @@
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEclipseEditor;
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor;
import org.eclipse.swtbot.swt.finder.SWTBot;
+import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
import org.eclipse.swtbot.swt.finder.keyboard.Keystrokes;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
@@ -34,6 +35,7 @@
import org.jboss.tools.ui.bot.ext.SWTUtilExt;
import org.jboss.tools.ui.bot.ext.Timing;
import org.jboss.tools.ui.bot.ext.helper.ContextMenuHelper;
+import org.jboss.tools.ui.bot.ext.helper.TreeHelper;
import org.jboss.tools.ui.bot.ext.types.IDELabel;
import org.jboss.tools.ui.bot.ext.view.ProjectExplorer;
@@ -261,5 +263,46 @@
bot.button(IDELabel.Button.CANCEL).click();
bot.sleep(TIME_1S);
}
+
+ public void moveFileInProjectExplorer(String file, String sourceFolder, String destFolder) {
+ SWTBotTree tree = projectExplorer.bot().tree();
+ SWTBotTreeItem item = projectExplorer.selectTreeItem(file, sourceFolder.split("/"));
+
+ CDIUtil.nodeContextMenu(tree, item, "Move...").click();
+
+ assertFalse(bot.button("OK").isEnabled());
+
+ tree = bot.tree();
+ tree.collapseNode(destFolder.split("/")[0]);
+
+ TreeHelper.expandNode(bot, destFolder.split("/")).select();
+ assertTrue(bot.button("OK").isEnabled());
+ bot.button("OK").click();
+ }
+
+ public static void removeObjectInProjectExplorer(String object, String sourceFolder) {
+ SWTBotTree tree = projectExplorer.bot().tree();
+ SWTBotTreeItem item = projectExplorer.selectTreeItem(object, sourceFolder.split("/"));
+
+ CDIUtil.nodeContextMenu(tree, item, "Delete").click();
+
+ assertTrue(bot.button("OK").isEnabled());
+
+ bot.button("OK").click();
+
+ bot.sleep(TIME_1S*2);
+ }
+
+ public boolean projectExists(String projectName) {
+ SWTBotTree tree = projectExplorer.bot().tree();
+ boolean projectExists = false;
+ try {
+ tree.getTreeItem(projectName);
+ projectExists = true;
+ }catch (WidgetNotFoundException exc) {
+ }
+ return projectExists;
+ }
+
}
\ No newline at end of file
Modified: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/wizard/CdiATWizardTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/wizard/CdiATWizardTest.java 2011-10-21 12:12:17 UTC (rev 35897)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/wizard/CdiATWizardTest.java 2011-10-21 12:27:51 UTC (rev 35898)
@@ -30,19 +30,24 @@
import org.junit.runner.RunWith;
import org.junit.runners.Suite.SuiteClasses;
+/**
+ * @author Lukas Jungmann
+ * @author jjankovi
+ */
@Require(perspective = "Java EE", server = @Server(state = ServerState.NotRunning, version = "6.0", operator = ">="))
@RunWith(RequirementAwareSuite.class)
@SuiteClasses({ CDIAllBotTests.class, CDISmokeBotTests.class })
public class CdiATWizardTest extends CDIBase {
- private static final String PROJECT_NAME = "CDIProject1";
+ private static final String PROJECT_NAME = "CDIProject";
+ private static final String PACKAGE_NAME = "org.cdi.test";
private static final Logger L = Logger.getLogger(CdiATWizardTest.class.getName());
@After
public void waitForJobs() {
util.waitForNonIgnoredJobs();
}
-
+
@Test
public void createProject() {
createAndCheckCDIProject(bot, util, projectExplorer, PROJECT_NAME);
@@ -50,7 +55,7 @@
@Test
public void testQualifier() {
- CDIUtil.qualifier("cdi", "Q1", false, false).finish();
+ CDIUtil.qualifier(PACKAGE_NAME, "Q1", false, false).finish();
util.waitForNonIgnoredJobs();
SWTBotEditor ed = new SWTWorkbenchBot().activeEditor();
assertTrue(("Q1.java").equals(ed.getTitle()));
@@ -62,7 +67,7 @@
assertFalse(code.contains("@Inherited"));
assertFalse(code.startsWith("/**"));
- CDIUtil.qualifier("cdi", "Q2", true, true).finish();
+ CDIUtil.qualifier(PACKAGE_NAME, "Q2", true, true).finish();
util.waitForNonIgnoredJobs();
ed = new SWTWorkbenchBot().activeEditor();
assertTrue(("Q2.java").equals(ed.getTitle()));
@@ -77,7 +82,7 @@
@Test
public void testScope() {
- CDIUtil.scope("cdi", "Scope1", true, false, true, false).finish();
+ CDIUtil.scope(PACKAGE_NAME, "Scope1", true, false, true, false).finish();
util.waitForNonIgnoredJobs();
SWTBotEditor ed = new SWTWorkbenchBot().activeEditor();
assertTrue(("Scope1.java").equals(ed.getTitle()));
@@ -91,7 +96,7 @@
assertTrue(code.contains("@Inherited"));
assertFalse(code.startsWith("/**"));
- CDIUtil.scope("cdi", "Scope2", false, true, true, true).finish();
+ CDIUtil.scope(PACKAGE_NAME, "Scope2", false, true, true, true).finish();
util.waitForNonIgnoredJobs();
ed = new SWTWorkbenchBot().activeEditor();
assertTrue(("Scope2.java").equals(ed.getTitle()));
@@ -104,7 +109,7 @@
assertFalse(code.contains("@Inherited"));
assertTrue(code.startsWith("/**"));
- CDIUtil.scope("cdi", "Scope3", false, true, false, false).finish();
+ CDIUtil.scope(PACKAGE_NAME, "Scope3", false, true, false, false).finish();
util.waitForNonIgnoredJobs();
ed = new SWTWorkbenchBot().activeEditor();
assertTrue(("Scope3.java").equals(ed.getTitle()));
@@ -120,7 +125,7 @@
@Test
public void testIBinding() {
- CDIWizard w = CDIUtil.binding("cdi", "B1", null, true, false);
+ CDIWizard w = CDIUtil.binding(PACKAGE_NAME, "B1", null, true, false);
assertEquals(2, w.getTargets().size());
w.finish();
util.waitForNonIgnoredJobs();
@@ -134,7 +139,7 @@
assertTrue(code.contains("@Inherited"));
assertFalse(code.startsWith("/**"));
- CDIUtil.binding("cdi", "B2", "TYPE", false, true).finish();
+ CDIUtil.binding(PACKAGE_NAME, "B2", "TYPE", false, true).finish();
util.waitForNonIgnoredJobs();
ed = new SWTWorkbenchBot().activeEditor();
assertTrue(("B2.java").equals(ed.getTitle()));
@@ -146,7 +151,7 @@
assertFalse(code.contains("@Inherited"));
assertTrue(code.startsWith("/**"));
- CDIUtil.binding("cdi", "B3", "TYPE", false, true).finish();
+ CDIUtil.binding(PACKAGE_NAME, "B3", "TYPE", false, true).finish();
util.waitForNonIgnoredJobs();
ed = new SWTWorkbenchBot().activeEditor();
assertTrue(("B3.java").equals(ed.getTitle()));
@@ -158,8 +163,8 @@
assertFalse(code.contains("@Inherited"));
assertTrue(code.startsWith("/**"));
- w = CDIUtil.binding("cdi", "B4", "TYPE", true, false);
- w.addIBinding("cdi.B2");
+ w = CDIUtil.binding(PACKAGE_NAME, "B4", "TYPE", true, false);
+ w.addIBinding(PACKAGE_NAME + ".B2");
w.finish();
util.waitForNonIgnoredJobs();
ed = new SWTWorkbenchBot().activeEditor();
@@ -176,7 +181,7 @@
@Test
public void testStereotype() {
- CDIWizard w = CDIUtil.stereotype("cdi", "S1", null, null, false, false, false, false,
+ CDIWizard w = CDIUtil.stereotype(PACKAGE_NAME, "S1", null, null, false, false, false, false,
false);
assertEquals(9, w.getScopes().size());
assertEquals(5, w.getTargets().size());
@@ -194,7 +199,7 @@
assertFalse(code.contains("@Inherited"));
assertFalse(code.startsWith("/**"));
- CDIUtil.stereotype("cdi", "S2", "@Scope3", "FIELD", true, true, true, false, true)
+ CDIUtil.stereotype(PACKAGE_NAME, "S2", "@Scope3", "FIELD", true, true, true, false, true)
.finish();
util.waitForNonIgnoredJobs();
ed = new SWTWorkbenchBot().activeEditor();
@@ -210,9 +215,9 @@
assertTrue(code.contains("@Target({ FIELD })"));
assertTrue(code.startsWith("/**"));
- w = CDIUtil.stereotype("cdi", "S3", null, null, false, false, true, false, false);
- w.addIBinding("cdi.B1");
- w.addStereotype("cdi.S1");
+ w = CDIUtil.stereotype(PACKAGE_NAME, "S3", null, null, false, false, true, false, false);
+ w.addIBinding(PACKAGE_NAME + ".B1");
+ w.addStereotype(PACKAGE_NAME + ".S1");
w.finish();
util.waitForNonIgnoredJobs();
ed = new SWTWorkbenchBot().activeEditor();
@@ -233,7 +238,7 @@
@Test
public void testDecorator() {
- CDIWizard w = CDIUtil.decorator("cdi", "", "java.lang.Comparable", null, true, true, false, false);
+ CDIWizard w = CDIUtil.decorator(PACKAGE_NAME, "", "java.lang.Comparable", null, true, true, false, false);
w.finish();
util.waitForNonIgnoredJobs();
SWTBotEditor ed = new SWTWorkbenchBot().editorByTitle("ComparableDecorator.java");
@@ -249,7 +254,7 @@
assertFalse(code.contains("final"));
assertFalse(code.startsWith("/**"));
- w = CDIUtil.decorator("cdi", "", "java.util.Map", "field", false, false, true, true);
+ w = CDIUtil.decorator(PACKAGE_NAME, "", "java.util.Map", "field", false, false, true, true);
w.finish();
util.waitForNonIgnoredJobs();
ed = new SWTWorkbenchBot().editorByTitle("MapDecorator.java");
@@ -268,7 +273,7 @@
@Test
public void testInterceptor() {
- CDIWizard w = CDIUtil.interceptor("cdi", "I1", "B2", null, null, false);
+ CDIWizard w = CDIUtil.interceptor(PACKAGE_NAME, "I1", "B2", null, null, false);
w.finish();
util.waitForNonIgnoredJobs();
SWTBotEditor ed = new SWTWorkbenchBot().editorByTitle("I1.java");
@@ -282,7 +287,7 @@
assertFalse(code.contains("final"));
assertFalse(code.startsWith("/**"));
- w = CDIUtil.interceptor("cdi", "I2", "B4", "java.util.Date", "sample", true);
+ w = CDIUtil.interceptor(PACKAGE_NAME, "I2", "B4", "java.util.Date", "sample", true);
w.finish();
util.waitForNonIgnoredJobs();
ed = new SWTWorkbenchBot().editorByTitle("I2.java");
@@ -303,9 +308,9 @@
CDIWizard w = new NewCDIFileWizard(CDIWizardType.BEANS_XML).run();
w.setSourceFolder(PROJECT_NAME + "/WebContent/WEB-INF");
assertFalse(w.canFinish());
- w.setSourceFolder(PROJECT_NAME + "/src/cdi");
+ w.setSourceFolder(PROJECT_NAME + "/src/" + PACKAGE_NAME.replaceAll(".", "/"));
assertTrue(w.canFinish());
- w.finish();
+ w.cancel();
w = new NewCDIFileWizard(CDIWizardType.BEANS_XML).run();
assertFalse(w.canFinish());
w.cancel();
@@ -313,41 +318,41 @@
@Test
public void testBean() {
- CDIWizard w = CDIUtil.bean("cdi", "Bean1", true, true, false, false, false, false, null, null, null, null);
+ CDIWizard w = CDIUtil.bean(PACKAGE_NAME, "Bean1", true, true, false, false, false, false, null, null, null, null);
w.finish();
util.waitForNonIgnoredJobs();
SWTBotEditor ed = new SWTWorkbenchBot().activeEditor();
assertTrue(("Bean1.java").equals(ed.getTitle()));
String code = ed.toTextEditor().getText();
L.fine(code);
- assertTrue(code.contains("package cdi;"));
+ assertTrue(code.contains("package org.cdi.test;"));
assertTrue(code.contains("public abstract class Bean1 {"));
assertFalse(code.contains("@Named"));
assertFalse(code.contains("final"));
assertFalse(code.startsWith("/**"));
- w = CDIUtil.bean("cdi", "Bean2", false, false, true, true, false, false, "", null, "@Dependent", null);
+ w = CDIUtil.bean(PACKAGE_NAME, "Bean2", false, false, true, true, false, false, "", null, "@Dependent", null);
w.finish();
util.waitForNonIgnoredJobs();
ed = new SWTWorkbenchBot().activeEditor();
assertTrue(("Bean2.java").equals(ed.getTitle()));
code = ed.toTextEditor().getText();
L.fine(code);
- assertTrue(code.contains("package cdi;"));
+ assertTrue(code.contains("package org.cdi.test;"));
assertTrue(code.contains("@Named"));
assertFalse(code.contains("@Named("));
assertTrue(code.contains("@Dependent"));
assertTrue(code.contains("final class Bean2 {"));
assertTrue(code.startsWith("/**"));
- w = CDIUtil.bean("cdi", "Bean3", true, false, false, true, false, false, "TestedBean", null, "@Scope2", "Q1");
+ w = CDIUtil.bean(PACKAGE_NAME, "Bean3", true, false, false, true, false, false, "TestedBean", null, "@Scope2", "Q1");
w.finish();
util.waitForNonIgnoredJobs();
ed = new SWTWorkbenchBot().activeEditor();
assertTrue(("Bean3.java").equals(ed.getTitle()));
code = ed.toTextEditor().getText();
L.fine(code);
- assertTrue(code.contains("package cdi;"));
+ assertTrue(code.contains("package org.cdi.test;"));
assertTrue(code.contains("@Named(\"TestedBean\")"));
assertTrue(code.contains("@Scope2"));
assertTrue(code.contains("@Q1"));
@@ -358,27 +363,27 @@
@Test
public void testAnnLiteral() {
- CDIWizard w = CDIUtil.annLiteral("cdi", "AnnL1", true, false, true, false, "cdi.Q1");
+ CDIWizard w = CDIUtil.annLiteral(PACKAGE_NAME, "AnnL1", true, false, true, false, PACKAGE_NAME + ".Q1");
w.finish();
util.waitForNonIgnoredJobs();
SWTBotEditor ed = new SWTWorkbenchBot().activeEditor();
assertTrue(("AnnL1.java").equals(ed.getTitle()));
String code = ed.toTextEditor().getText();
L.info(code);
- assertTrue(code.contains("package cdi;"));
+ assertTrue(code.contains("package org.cdi.test;"));
assertTrue(code.contains("public final class AnnL1 extends AnnotationLiteral<Q1> implements Q1"));
assertTrue(code.contains("public static final Q1 INSTANCE = new AnnL1();"));
assertFalse(code.contains("abstract"));
assertFalse(code.startsWith("/**"));
- w = CDIUtil.annLiteral("cdi", "AnnL2", false, true, false, true, "Q2");
+ w = CDIUtil.annLiteral(PACKAGE_NAME, "AnnL2", false, true, false, true, "Q2");
w.finish();
util.waitForNonIgnoredJobs();
ed = new SWTWorkbenchBot().activeEditor();
assertTrue(("AnnL2.java").equals(ed.getTitle()));
code = ed.toTextEditor().getText();
L.info(code);
- assertTrue(code.contains("package cdi;"));
+ assertTrue(code.contains("package org.cdi.test;"));
assertTrue(code.contains("abstract class AnnL2 extends AnnotationLiteral<Q2> implements Q2 {"));
assertTrue(code.contains("public static final Q2 INSTANCE = new AnnL2();"));
assertFalse(code.substring(code.indexOf("final") + 5).contains("final"));
More information about the jbosstools-commits
mailing list