Author: jjankovi
Date: 2011-09-23 07:35:48 -0400 (Fri, 23 Sep 2011)
New Revision: 34993
Removed:
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/hyperlinks/
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/editor/BeansEditorTest.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/uiutils/actions/CDIUtil.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/wizard/CdiATWizardTest.java
Log:
Refactoring and new QuickFix test added
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-09-23
06:35:15 UTC (rev 34992)
+++
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/CDIAllBotTests.java 2011-09-23
11:35:48 UTC (rev 34993)
@@ -11,7 +11,7 @@
package org.jboss.tools.cdi.bot.test;
import org.jboss.tools.cdi.bot.test.editor.BeansEditorTest;
-import org.jboss.tools.cdi.bot.test.hyperlinks.CDIHyperlinksTest;
+import org.jboss.tools.cdi.bot.test.openon.CDIOpenOnTest;
import org.jboss.tools.cdi.bot.test.quickfix.CDIQuickFixTest;
import org.jboss.tools.cdi.bot.test.wizard.CdiATWizardTest;
import org.jboss.tools.ui.bot.ext.RequirementAwareSuite;
@@ -34,7 +34,7 @@
* JAVA=1.6,/space/java/sdk/jdk1.6.0_22
*
*
- * Suite duration: aprox. 11min
+ * Suite duration: aprox. 12min
*
* @author Lukas Jungmann
* @author Jaroslav Jankovic
@@ -44,7 +44,7 @@
CdiATWizardTest.class,
BeansEditorTest.class,
CDIQuickFixTest.class,
- CDIHyperlinksTest.class
+ CDIOpenOnTest.class
})
public class CDIAllBotTests {
}
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-09-23
06:35:15 UTC (rev 34992)
+++
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/editor/BeansEditorTest.java 2011-09-23
11:35:48 UTC (rev 34993)
@@ -28,6 +28,7 @@
import org.eclipse.core.runtime.NullProgressMonitor;
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.editor.BeansEditor;
import org.jboss.tools.cdi.bot.test.uiutils.editor.BeansEditor.Item;
import org.jboss.tools.ui.bot.ext.RequirementAwareSuite;
@@ -53,7 +54,7 @@
*/
@Require(clearProjects = false, perspective = "Java EE", server = @Server(state
= ServerState.NotRunning, version = "6.0", operator = ">="))
@RunWith(RequirementAwareSuite.class)
-@SuiteClasses({ BeansEditorTest.class })
+@SuiteClasses({ CDIAllBotTests.class })
public class BeansEditorTest extends SWTTestExt {
private static final String descPath = "WebContent/WEB-INF/beans.xml";
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-09-23
06:35:15 UTC (rev 34992)
+++
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/CDIQuickFixTest.java 2011-09-23
11:35:48 UTC (rev 34993)
@@ -16,7 +16,6 @@
import org.jboss.tools.ui.bot.ext.view.ProblemsView;
import org.junit.After;
import org.junit.BeforeClass;
-import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Suite.SuiteClasses;
@@ -38,8 +37,8 @@
private static SWTBotTreeItem[] problemsTrees;
private static final String LINE_SEPARATOR =
System.getProperty("line.separator");
private enum ANNOTATIONS {TARGET, RETENTION, NAMED, TYPED, DISPOSES, OBSERVES,
INTERCEPTOR,
- SPECIALIZES, DECORATOR}
- private enum CDICOMPONENT {STEREOSCOPE, QUALIFIER, SCOPE, BEAN, ANNOTATION,
INTERBINDING}
+ SPECIALIZES, DECORATOR, NONBINDING}
+ private enum CDICOMPONENT {STEREOSCOPE, QUALIFIER, SCOPE, BEAN, ANNOTATION,
INTERBINDING, INTERCEPTOR}
private SWTBotEclipseEditor ed;
@BeforeClass
@@ -53,7 +52,7 @@
public void waitForJobs() {
util.waitForNonIgnoredJobs();
}
-
+
@Test
public void testSerializableQF() {
createComponent(CDICOMPONENT.BEAN, "B1");
@@ -148,7 +147,7 @@
"BrokenFarm.java", "CDI Problem");
assertTrue(problemsTrees.length == 0);
}
-
+
@Test
public void testStereoscopeQF() {
String className = "S1";
@@ -177,6 +176,10 @@
// 2.QF -
https://issues.jboss.org/browse/JBIDE-7632
checkTargetAnnotation(CDICOMPONENT.QUALIFIER, className);
+
+ // 3.QF -
https://issues.jboss.org/browse/JBIDE-7641
+ checkNonBindingAnnotation(CDICOMPONENT.QUALIFIER, className);
+
}
@Test
@@ -232,7 +235,8 @@
// 5.QF -
https://issues.jboss.org/browse/JBIDE-7686
checkSpecializeAnnotation(CDICOMPONENT.BEAN, "TestBean");
- //
https://issues.jboss.org/browse/JBIDE-7641 - NIE INTER DECOR
+ // 6.QF -
https://issues.jboss.org/browse/JBIDE-7641
+ checkNonBindingAnnotation(CDICOMPONENT.INTERCEPTOR, "Interceptor");
}
private void prepareCdiComponent(CDICOMPONENT component, String name) {
@@ -592,10 +596,39 @@
checkQuickFix(ANNOTATIONS.SPECIALIZES, comp, className, replacement);
}
+ private void checkNonBindingAnnotation(CDICOMPONENT comp, String className) {
+ checkNonBindingAnnotationWithAddon(comp, className, "Annotation");
+ checkNonBindingAnnotationWithAddon(comp, className, "Array");
+ }
+
+ private void checkNonBindingAnnotationWithAddon(CDICOMPONENT comp, String className,
+ String replacement) {
+ if (comp == CDICOMPONENT.INTERCEPTOR) {
+ boolean interceptorCreated = projectExplorer.isFilePresent(PROJECT_NAME,
+ "Java Resources", "src", PACKAGE_NAME, className +
".java");
+ if (!interceptorCreated) {
+ CDIUtil.binding(PACKAGE_NAME, className, null, false, false).finish();
+ }
+ }
+ if (replacement.equals("Annotation")) {
+ boolean annotationCreated = projectExplorer.isFilePresent(PROJECT_NAME,
+ "Java Resources", "src", PACKAGE_NAME,
"AAnnotation.java");
+ if (!annotationCreated) {
+ CDIUtil.annotation(open, util, PACKAGE_NAME, "AAnnotation");
+ bot.editorByTitle(className + ".java").show();
+ ed = bot.activeEditor().toTextEditor();
+ }
+ CDIUtil.insertInEditor(ed, bot, ed.getLineCount()-3, 1, "AAnnotation
annotValue();" + LINE_SEPARATOR);
+ }else {
+ CDIUtil.insertInEditor(ed, bot, ed.getLineCount()-3, 1, "String[] array();"
+ LINE_SEPARATOR);
+ }
+ checkQuickFix(ANNOTATIONS.NONBINDING, comp, className, replacement);
+ }
+
private void checkQuickFix(ANNOTATIONS annonType, CDICOMPONENT comp,
String className, String replacement) {
String componentClass = className + ".java";
- problemsTrees = getProblems(annonType, comp, componentClass);
+ problemsTrees = getProblems(annonType, comp, componentClass);
assertTrue(problemsTrees.length != 0);
resolveQuickFix(annonType, comp, replacement);
problemsTrees = getProblems(annonType, comp, componentClass);
@@ -605,7 +638,7 @@
private SWTBotTreeItem[] getProblems(ANNOTATIONS annonType, CDICOMPONENT comp, String
className) {
SWTBotTreeItem[] problemsTree;
boolean warningType = true;
- switch (annonType) {
+ switch (annonType) {
case NAMED:
case SPECIALIZES:
warningType = ((comp == CDICOMPONENT.BEAN)?true:false);
@@ -623,6 +656,9 @@
if (annonType == ANNOTATIONS.SPECIALIZES) {
problemsContains = "@Specializes";
}
+ if (annonType == ANNOTATIONS.NONBINDING) {
+ problemsContains = "@Nonbinding";
+ }
problemsTree = ProblemsView.getFilteredWarningsTreeItems(bot, problemsContains,
"/"
+ PROJECT_NAME, className, "CDI Problem");
} else {
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/actions/CDIUtil.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/actions/CDIUtil.java 2011-09-23
06:35:15 UTC (rev 34992)
+++
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/actions/CDIUtil.java 2011-09-23
11:35:48 UTC (rev 34993)
@@ -5,8 +5,10 @@
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.finders.UIThreadRunnable;
import org.eclipse.swtbot.swt.finder.results.Result;
+import org.eclipse.swtbot.swt.finder.utils.SWTUtils;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotCheckBox;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
@@ -15,8 +17,12 @@
import org.jboss.tools.cdi.bot.test.uiutils.wizards.CDIWizardType;
import org.jboss.tools.cdi.bot.test.uiutils.wizards.DynamicWebProjectWizard;
import org.jboss.tools.ui.bot.ext.SWTBotExt;
+import org.jboss.tools.ui.bot.ext.SWTOpenExt;
import org.jboss.tools.ui.bot.ext.SWTUtilExt;
import org.jboss.tools.ui.bot.ext.Timing;
+import org.jboss.tools.ui.bot.ext.gen.ActionItem;
+import org.jboss.tools.ui.bot.ext.gen.ActionItem.NewObject;
+import org.jboss.tools.ui.bot.ext.gen.ActionItem.NewObject.JavaAnnotation;
import org.jboss.tools.ui.bot.ext.helper.ContextMenuHelper;
import org.jboss.tools.ui.bot.ext.view.ProjectExplorer;
@@ -176,10 +182,12 @@
if (method != null) {
w = w.setMethodName(method);
}
- return w.addIBinding(ibinding);
+ if (ibinding != null) {
+ w = w.addIBinding(ibinding);
+ }
+ return w;
}
-
public static CDIWizard bean(String pkg, String name, boolean isPublic, boolean
isAbstract,
boolean isFinal, boolean comments, String named,
String interfaces, String scope, String qualifier) {
@@ -203,6 +211,14 @@
return w;
}
+ public static void annotation(SWTOpenExt open, SWTUtilExt util, String pkg, String name)
{
+ SWTBot openWizard = open.newObject(JavaAnnotation.LABEL);
+ openWizard.textWithLabel("Name:").setText(name);
+ openWizard.textWithLabel("Package:").setText(pkg);
+ openWizard.button("Finish").click();
+ util.waitForNonIgnoredJobs();
+ }
+
public static CDIWizard annLiteral(String pkg, String name, boolean isPublic, boolean
isAbstract,
boolean isFinal, boolean comments, String qualifier) {
assert qualifier != null && !"".equals(qualifier.trim()) :
"Qualifier has to be set";
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-09-23
06:35:15 UTC (rev 34992)
+++
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/wizard/CdiATWizardTest.java 2011-09-23
11:35:48 UTC (rev 34993)
@@ -17,6 +17,7 @@
import org.eclipse.swtbot.swt.finder.SWTBot;
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.uiutils.actions.CDIUtil;
import org.jboss.tools.cdi.bot.test.uiutils.actions.NewCDIFileWizard;
import org.jboss.tools.cdi.bot.test.uiutils.actions.NewFileWizardAction;
@@ -37,7 +38,7 @@
@Require(perspective = "Java EE", server = @Server(state =
ServerState.NotRunning, version = "6.0", operator = ">="))
@RunWith(RequirementAwareSuite.class)
-@SuiteClasses({ CdiATWizardTest.class })
+@SuiteClasses({ CDIAllBotTests.class })
public class CdiATWizardTest extends SWTTestExt {
private static final String PROJECT_NAME = "CDIProject";