Author: jjankovi
Date: 2012-01-24 05:47:26 -0500 (Tue, 24 Jan 2012)
New Revision: 38082
Added:
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/base/
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/base/BeansXMLQuickFixTestBase.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/base/EligibleInjectionQuickFixTestBase.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/base/QuickFixTestBase.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/BeansXMLHelper.java
Removed:
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/annotations/BeansXMLValidationErrors.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/annotations/CDIAnnotationsType.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/BeansXMLQuickFixTestBase.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/EligibleInjectionQuickFixTestBase.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/QuickFixTestBase.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/BeansXMLValidationHelper.java
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/requirements.properties
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/CDIBase.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/CDITestBase.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/annotations/ValidationType.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/beansxml/BeansXMLCompletionTest.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/beansxml/BeansXMLValidationTest.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/decorator/DecoratorCreatingTest.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/jsf/JSFTestBase.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/named/NamedComponentsSearchingTest.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/named/NamedRefactoringTest.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/openon/OpenOnBase.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/openon/OpenOnTest.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/injection/ProblemEligibleInjectionTest.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/test/BeanValidationQuickFixTest.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/test/BeansXMLValidationQuickFixTest.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/test/DecoratorValidationQuickFixTest.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/test/IBindingValidationQuickFixTest.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/test/InterceptorValidationQuickFixTest.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/test/QualifierValidationQuickFixTest.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/test/ScopeValidationQuickFixTest.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/test/StereotypeValidationQuickFixTest.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/validators/BeansXmlValidationProvider.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/CDIProjectHelper.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/EditorResourceHelper.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/LibraryHelper.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/OpenOnHelper.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/QuickFixHelper.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/SWTEclipseCDIExtUtil.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/actions/NewCDIFileWizard.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/wizards/DynamicWebProjectWizard.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/wizards/QuickFixDialogWizard.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/wizards/SearchNamedDialogWizard.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/wizard/FacetTest.java
Log:
Huge refactoring and moving some tests
Modified: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/requirements.properties
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/requirements.properties 2012-01-24
10:42:38 UTC (rev 38081)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/requirements.properties 2012-01-24
10:47:26 UTC (rev 38082)
@@ -1,2 +1,2 @@
-#requirements=jbossas-6.0.0.Final
-requirements=jbossas
+requirements=jbossas-6.0.0.Final
+#requirements=jbossas
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 2012-01-24
10:42:38 UTC (rev 38081)
+++
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/CDIAllBotTests.java 2012-01-24
10:47:26 UTC (rev 38082)
@@ -30,6 +30,7 @@
import org.jboss.tools.cdi.bot.test.seam3.Seam3GenericOpenOnTest;
import org.jboss.tools.cdi.bot.test.seam3.Seam3ResourceOpenOnTest;
import org.jboss.tools.cdi.bot.test.wizard.CDISupportTest;
+import org.jboss.tools.cdi.bot.test.wizard.CDIWebProjectWizardTest;
import org.jboss.tools.cdi.bot.test.wizard.ConfigurationPresetTest;
import org.jboss.tools.cdi.bot.test.wizard.FacetTest;
import org.jboss.tools.cdi.bot.test.wizard.WizardTest;
@@ -64,6 +65,7 @@
ConfigurationPresetTest.class,
FacetTest.class,
CDISupportTest.class,
+ CDIWebProjectWizardTest.class,
WizardTest.class,
BeansEditorTest.class,
NamedRefactoringTest.class,
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/CDIBase.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/CDIBase.java 2012-01-24
10:42:38 UTC (rev 38081)
+++
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/CDIBase.java 2012-01-24
10:47:26 UTC (rev 38082)
@@ -12,7 +12,7 @@
package org.jboss.tools.cdi.bot.test;
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEclipseEditor;
-import org.jboss.tools.cdi.bot.test.uiutils.BeansXMLValidationHelper;
+import org.jboss.tools.cdi.bot.test.uiutils.BeansXMLHelper;
import org.jboss.tools.cdi.bot.test.uiutils.CDIProjectHelper;
import org.jboss.tools.cdi.bot.test.uiutils.CDIWizardHelper;
import org.jboss.tools.cdi.bot.test.uiutils.EditorResourceHelper;
@@ -23,10 +23,10 @@
import org.jboss.tools.ui.bot.ext.SWTTestExt;
public class CDIBase extends SWTTestExt {
-
+
private static SWTBotEclipseEditor ed;
protected static CDIProjectHelper projectHelper = new CDIProjectHelper();
- protected static BeansXMLValidationHelper beansHelper = new BeansXMLValidationHelper();
+ protected static BeansXMLHelper beansHelper = new BeansXMLHelper();
protected static CDIWizardHelper wizard = new CDIWizardHelper();
protected static CDIWizardBaseExt wizardExt = new CDIWizardBaseExt();
protected static OpenOnHelper openOnUtil = new OpenOnHelper();
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/CDITestBase.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/CDITestBase.java 2012-01-24
10:42:38 UTC (rev 38081)
+++
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/CDITestBase.java 2012-01-24
10:47:26 UTC (rev 38082)
@@ -11,8 +11,6 @@
package org.jboss.tools.cdi.bot.test;
-import java.util.Arrays;
-import java.util.List;
import java.util.logging.Logger;
import org.jboss.tools.ui.bot.ext.RequirementAwareSuite;
@@ -31,23 +29,15 @@
@SuiteClasses({ CDIAllBotTests.class })
public class CDITestBase extends CDIBase {
- protected static final String BEANS_XML = "beans.xml";
- protected static final String CLASS_END_TAG = "</class>";
- protected static final String CLASS_OPEN_TAG = "<class>";
- protected static final String STEREOTYPE_END_TAG = "</stereotype>";
- protected static final String STEREOTYPE_OPEN_TAG = "<stereotype>";
- protected static final List<String> BEANS_XML_TAGS = Arrays.asList(
- "alternatives", "decorators", "interceptors");
-
private String projectName = "CDIProject";
private String packageName = "cdi";
- protected final String LINE_SEPARATOR = System.getProperty("line.separator");
+
protected static final Logger LOGGER = Logger.getLogger(CDITestBase.class.getName());
@Before
public void prepareWorkspace() {
if (!projectHelper.projectExists(getProjectName())) {
- projectHelper.createCDIProjectWithCDIWizard(getProjectName());
+ projectHelper.createCDIProjectWithDynamicWizard(getProjectName());
}
}
Deleted:
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/annotations/BeansXMLValidationErrors.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/annotations/BeansXMLValidationErrors.java 2012-01-24
10:42:38 UTC (rev 38081)
+++
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/annotations/BeansXMLValidationErrors.java 2012-01-24
10:47:26 UTC (rev 38082)
@@ -1,30 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at
http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.cdi.bot.test.annotations;
-
-public enum BeansXMLValidationErrors {
-
- ALTERNATIVE("must specify the name of an alternative bean class"),
- DECORATOR("must specify the name of a decorator bean class"),
- INTERCEPTOR("must specify the name of an interceptor class"),
- NO_SUCH_CLASS("There is no class with the specified name");
-
- private String validationError;
-
- private BeansXMLValidationErrors(String validationError) {
- this.validationError = validationError;
- }
-
- public String message() {
- return validationError;
- }
-
-}
Deleted:
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/annotations/CDIAnnotationsType.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/annotations/CDIAnnotationsType.java 2012-01-24
10:42:38 UTC (rev 38081)
+++
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/annotations/CDIAnnotationsType.java 2012-01-24
10:47:26 UTC (rev 38082)
@@ -1,20 +0,0 @@
-/*******************************************************************************
- * 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.tools.cdi.bot.test.annotations;
-
-public enum CDIAnnotationsType {
-
- SERIALIZABLE, TARGET, RETENTION, NAMED, TYPED, DISPOSES, OBSERVES, INTERCEPTOR,
- SPECIALIZES, DECORATOR, PRODUCES, NONBINDING, STATELESS, INJECT,
- MULTIPLE_BEAN_ELIGIBLE, NO_BEAN_ELIGIBLE;
-
-}
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/annotations/ValidationType.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/annotations/ValidationType.java 2012-01-24
10:42:38 UTC (rev 38081)
+++
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/annotations/ValidationType.java 2012-01-24
10:47:26 UTC (rev 38082)
@@ -14,6 +14,7 @@
SERIALIZABLE, MULTIPLE_BEAN_ELIGIBLE, NO_BEAN_ELIGIBLE, DISPOSES, OBSERVES,
PRODUCES, TARGET, RETENTION, TYPED, NAMED, NONBINDING, SPECIALIZES, STATELESS,
- NO_CLASS, NO_ANNOTATION, ALTERNATIVE_BEAN_XML, ALTERNATIVE_STEREOTYPE_BEAN_XML
+ NO_CLASS, NO_ANNOTATION, ALTERNATIVE_BEAN_XML, ALTERNATIVE_STEREOTYPE_BEAN_XML,
+ SPECIFY_ALTERNATIVE, SPECIFY_DECORATOR, SPECIFY_INTERCEPTOR,
}
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/beansxml/BeansXMLCompletionTest.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/beansxml/BeansXMLCompletionTest.java 2012-01-24
10:42:38 UTC (rev 38081)
+++
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/beansxml/BeansXMLCompletionTest.java 2012-01-24
10:47:26 UTC (rev 38082)
@@ -14,6 +14,7 @@
import java.util.Arrays;
import java.util.List;
+import org.jboss.tools.cdi.bot.test.CDIConstants;
import org.jboss.tools.cdi.bot.test.CDITestBase;
import org.jboss.tools.cdi.bot.test.annotations.CDIWizardType;
import org.jboss.tools.ui.bot.ext.SWTJBTExt;
@@ -41,6 +42,9 @@
"A1", "A2", "A3");
private static final List<String> STEREOTYPES_NAMES = Arrays.asList(
"S1", "S2", "S3");
+
+ private static final List<String> BEANS_XML_TAGS = Arrays.asList(
+ "alternatives", "decorators", "interceptors");
@Override
public String getProjectName() {
@@ -49,10 +53,11 @@
@Test
public void testPossibleCompletionInBeansXML() {
- beansHelper.createClearBeansXML(getProjectName());
+
+ beansHelper.createBeansXMLWithEmptyTag(getProjectName());
LOGGER.info("Clear beans.xml was created");
- checkAutoCompletion(3, 0, "<>", BEANS_XML, BEANS_XML_TAGS);
+ checkAutoCompletion(3, 0, "<>", CDIConstants.BEANS_XML,
BEANS_XML_TAGS);
}
@Test
@@ -64,7 +69,7 @@
beansHelper.createBeansXMLWithInterceptor(getProjectName(), getPackageName(), null);
LOGGER.info("Beans.xml with interceptors tag was created");
- List<String> proposalList = getProposalList(BEANS_XML, CLASS_END_TAG, 0, 0);
+ List<String> proposalList = getProposalList(CDIConstants.BEANS_XML,
CDIConstants.CLASS_END_TAG, 0, 0);
for (String interceptor : INTERCEPTOR_NAMES) {
assertTrue(proposalList.contains(interceptor + " - " + getPackageName()));
}
@@ -79,7 +84,8 @@
beansHelper.createBeansXMLWithDecorator(getProjectName(), getPackageName(), null);
LOGGER.info("Beans.xml with decorators tag was created");
- List<String> proposalList = getProposalList(BEANS_XML, CLASS_END_TAG, 0, 0);
+ List<String> proposalList = getProposalList(CDIConstants.BEANS_XML,
+ CDIConstants.CLASS_END_TAG, 0, 0);
for (String decorator : DECORATORS_NAMES) {
assertTrue(proposalList.contains(decorator + " - " + getPackageName()));
}
@@ -95,7 +101,8 @@
beansHelper.createBeansXMLWithStereotype(getProjectName(), getPackageName(), null);
LOGGER.info("Beans.xml with stereotype tag was created");
- List<String> proposalList = getProposalList(BEANS_XML, STEREOTYPE_END_TAG, 0,
0);
+ List<String> proposalList = getProposalList(CDIConstants.BEANS_XML,
+ CDIConstants.STEREOTYPE_END_TAG, 0, 0);
for (String stereotype : STEREOTYPES_NAMES) {
assertTrue(proposalList.contains(stereotype + " - " + getPackageName()));
}
@@ -111,7 +118,8 @@
beansHelper.createBeansXMLWithAlternative(getProjectName(), getPackageName(), null);
LOGGER.info("Beans.xml with alternative tag was created");
- List<String> proposalList = getProposalList(BEANS_XML, CLASS_END_TAG, 0, 0);
+ List<String> proposalList = getProposalList(CDIConstants.BEANS_XML,
+ CDIConstants.CLASS_END_TAG, 0, 0);
for (String alternative : ALTERNATIVES_NAMES) {
assertTrue(proposalList.contains(alternative + " - " + getPackageName()));
}
@@ -134,10 +142,10 @@
wizard.createCDIComponent(CDIWizardType.SCOPE, components[4],
getPackageName(), null);
- beansHelper.createClearBeansXMLWithEmptyTag(getProjectName());
+ beansHelper.createBeansXMLWithEmptyTag(getProjectName());
LOGGER.info("Clear beans.xml with empty tag was created");
- List<String> proposalList = getProposalList(BEANS_XML, "<>", 1,
0);
+ List<String> proposalList = getProposalList(CDIConstants.BEANS_XML,
"<>", 1, 0);
List<String> nonSupportedComponents = Arrays.asList(components);
for (String nonSupportedComponent : nonSupportedComponents) {
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/beansxml/BeansXMLValidationTest.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/beansxml/BeansXMLValidationTest.java 2012-01-24
10:42:38 UTC (rev 38081)
+++
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/beansxml/BeansXMLValidationTest.java 2012-01-24
10:47:26 UTC (rev 38082)
@@ -11,9 +11,10 @@
package org.jboss.tools.cdi.bot.test.beansxml;
-import org.jboss.tools.cdi.bot.test.CDITestBase;
-import org.jboss.tools.cdi.bot.test.annotations.BeansXMLValidationErrors;
+import org.jboss.tools.cdi.bot.test.CDIConstants;
import org.jboss.tools.cdi.bot.test.annotations.CDIWizardType;
+import org.jboss.tools.cdi.bot.test.annotations.ValidationType;
+import org.jboss.tools.cdi.bot.test.quickfix.base.BeansXMLQuickFixTestBase;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -24,7 +25,7 @@
*
*/
-public class BeansXMLValidationTest extends CDITestBase {
+public class BeansXMLValidationTest extends BeansXMLQuickFixTestBase {
private final String someBean = "Bean1";
private final String nonExistingPackage = "somePackage";
@@ -40,12 +41,11 @@
}
@Test
- public void testClearBeansXMLValidation() {
+ public void testEmptyBeansXMLValidation() {
- beansHelper.createClearBeansXML(getProjectName());
+ beansHelper.createEmptyBeansXML(getProjectName());
- assertTrue(beansHelper.getBeansXMLValidationErrors(
- getProjectName()).length == 0);
+ assertTrue(isBeanXMLValidationErrorEmpty());
}
@@ -55,27 +55,24 @@
String className = "I1";
if (!projectExplorer.isFilePresent(getProjectName(),
- ("Java Resources/src/" + getPackageName() +
+ (CDIConstants.JAVA_RESOURCES_SRC_FOLDER + getPackageName() +
"/" + someBean + ".java").split("/"))) {
wizard.createCDIComponent(CDIWizardType.BEAN, someBean, getPackageName(), null);
}
wizard.createCDIComponent(CDIWizardType.INTERCEPTOR, className, getPackageName(),
null);
- assertTrue(beansHelper.checkInterceptorInBeansXML(getProjectName(),
- getPackageName(), className));
+ beansHelper.createBeansXMLWithInterceptor(getProjectName(), getPackageName(),
className);
+ assertTrue(isBeanXMLValidationErrorEmpty());
+ beansHelper.createBeansXMLWithInterceptor(getProjectName(), nonExistingPackage,
className);
+ assertFalse(isBeanXMLValidationErrorEmpty());
+ assertNotNull(getProblem(ValidationType.NO_CLASS));
- assertFalse(beansHelper.checkInterceptorInBeansXML(getProjectName(),
- nonExistingPackage, className));
- assertTrue(beansHelper.checkValidationErrorInBeansXML(getProjectName(),
- BeansXMLValidationErrors.NO_SUCH_CLASS));
+ beansHelper.createBeansXMLWithInterceptor(getProjectName(), getPackageName(),
someBean);
+ assertFalse(isBeanXMLValidationErrorEmpty());
+ assertNotNull(getProblem(ValidationType.SPECIFY_INTERCEPTOR));
-
- assertFalse(beansHelper.checkInterceptorInBeansXML(getProjectName(),
- getPackageName(), someBean));
- assertTrue(beansHelper.checkValidationErrorInBeansXML(getProjectName(),
- BeansXMLValidationErrors.INTERCEPTOR));
}
@Test
@@ -84,28 +81,23 @@
String className = "D1";
if (!projectExplorer.isFilePresent(getProjectName(),
- ("Java Resources/src/" + getPackageName() +
+ (CDIConstants.JAVA_RESOURCES_SRC_FOLDER + getPackageName() +
"/" + someBean + ".java").split("/"))) {
wizard.createCDIComponent(CDIWizardType.BEAN, someBean, getPackageName(), null);
}
- wizard.createCDIComponent(CDIWizardType.DECORATOR, className,
- getPackageName(), "java.util.Set");
+ wizard.createCDIComponent(CDIWizardType.DECORATOR, className, getPackageName(),
"java.util.Set");
- assertTrue(beansHelper.checkDecoratorInBeansXML(getProjectName(),
- getPackageName(), className));
+ beansHelper.createBeansXMLWithDecorator(getProjectName(), getPackageName(),
className);
+ assertTrue(isBeanXMLValidationErrorEmpty());
+ beansHelper.createBeansXMLWithDecorator(getProjectName(), nonExistingPackage,
className);
+ assertFalse(isBeanXMLValidationErrorEmpty());
+ assertNotNull(getProblem(ValidationType.NO_CLASS));
- assertFalse(beansHelper.checkDecoratorInBeansXML(getProjectName(),
- nonExistingPackage, className));
- assertTrue(beansHelper.checkValidationErrorInBeansXML(getProjectName(),
- BeansXMLValidationErrors.NO_SUCH_CLASS));
-
-
- assertFalse(beansHelper.checkDecoratorInBeansXML(getProjectName(),
- getPackageName(), someBean));
- assertTrue(beansHelper.checkValidationErrorInBeansXML(getProjectName(),
- BeansXMLValidationErrors.DECORATOR));
+ beansHelper.createBeansXMLWithDecorator(getProjectName(), getPackageName(), someBean);
+ assertFalse(isBeanXMLValidationErrorEmpty());
+ assertNotNull(getProblem(ValidationType.SPECIFY_DECORATOR));
}
@Test
@@ -114,29 +106,24 @@
String className = "A1";
if (!projectExplorer.isFilePresent(getProjectName(),
- ("Java Resources/src/" + getPackageName() +
+ (CDIConstants.JAVA_RESOURCES_SRC_FOLDER + getPackageName() +
"/" + someBean + ".java").split("/"))) {
wizard.createCDIComponent(CDIWizardType.BEAN, someBean, getPackageName(), null);
}
- wizard.createCDIComponent(CDIWizardType.BEAN, className,
- getPackageName(), "alternative");
+ wizard.createCDIComponent(CDIWizardType.BEAN, className, getPackageName(),
"alternative");
- assertTrue(beansHelper.checkAlternativeInBeansXML(getProjectName(),
- getPackageName(), className));
+ beansHelper.createBeansXMLWithAlternative(getProjectName(), getPackageName(),
className);
+ assertTrue(isBeanXMLValidationErrorEmpty());
+ beansHelper.createBeansXMLWithAlternative(getProjectName(), nonExistingPackage,
className);
+ assertFalse(isBeanXMLValidationErrorEmpty());
+ assertNotNull(getProblem(ValidationType.NO_CLASS));
- assertFalse(beansHelper.checkAlternativeInBeansXML(getProjectName(),
- nonExistingPackage, className));
- assertTrue(beansHelper.checkValidationErrorInBeansXML(getProjectName(),
- BeansXMLValidationErrors.NO_SUCH_CLASS));
+ beansHelper.createBeansXMLWithAlternative(getProjectName(), getPackageName(),
someBean);
+ assertFalse(isBeanXMLValidationErrorEmpty());
+ assertNotNull(getProblem(ValidationType.SPECIFY_ALTERNATIVE));
-
- assertFalse(beansHelper.checkAlternativeInBeansXML(getProjectName(),
- getPackageName(), someBean));
- assertTrue(beansHelper.checkValidationErrorInBeansXML(getProjectName(),
- BeansXMLValidationErrors.ALTERNATIVE));
-
}
}
\ No newline at end of file
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/decorator/DecoratorCreatingTest.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/decorator/DecoratorCreatingTest.java 2012-01-24
10:42:38 UTC (rev 38081)
+++
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/decorator/DecoratorCreatingTest.java 2012-01-24
10:47:26 UTC (rev 38082)
@@ -10,14 +10,7 @@
******************************************************************************/
package org.jboss.tools.cdi.bot.test.decorator;
-import org.jboss.tools.cdi.bot.test.CDIAllBotTests;
import org.jboss.tools.cdi.bot.test.CDITestBase;
-import org.jboss.tools.ui.bot.ext.RequirementAwareSuite;
-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.runner.RunWith;
-import org.junit.runners.Suite.SuiteClasses;
/**
* Test operates on creating new decorator
@@ -26,11 +19,6 @@
*
*/
-@Require(clearProjects = true, perspective = "Java EE",
- server = @Server(state = ServerState.NotRunning,
- version = "6.0", operator = ">="))
-(a)RunWith(RequirementAwareSuite.class)
-@SuiteClasses({ CDIAllBotTests.class })
public class DecoratorCreatingTest extends CDITestBase {
//https://issues.jboss.org/browse/JBIDE-3136
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 2012-01-24
10:42:38 UTC (rev 38081)
+++
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/editor/BeansEditorTest.java 2012-01-24
10:47:26 UTC (rev 38082)
@@ -23,6 +23,7 @@
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.CDIConstants;
import org.jboss.tools.cdi.bot.test.CDISmokeBotTests;
import org.jboss.tools.cdi.bot.test.CDITestBase;
import org.jboss.tools.cdi.bot.test.editor.BeansEditor.Item;
@@ -56,7 +57,7 @@
@SuiteClasses({ CDIAllBotTests.class, CDISmokeBotTests.class })
public class BeansEditorTest extends CDITestBase {
- private static final String descPath = "WebContent/WEB-INF/beans.xml";
+ private static final String descPath = CDIConstants.WEB_INF_BEANS_XML_PATH;
@BeforeClass
public static void setup() {
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/jsf/JSFTestBase.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/jsf/JSFTestBase.java 2012-01-24
10:42:38 UTC (rev 38081)
+++
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/jsf/JSFTestBase.java 2012-01-24
10:47:26 UTC (rev 38082)
@@ -16,6 +16,7 @@
import java.util.logging.Logger;
import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
+import org.jboss.tools.cdi.bot.test.CDIConstants;
import org.jboss.tools.cdi.bot.test.CDITestBase;
import org.jboss.tools.cdi.bot.test.annotations.JSFEnvironment;
import org.jboss.tools.cdi.bot.test.annotations.JSFTemplate;
@@ -59,8 +60,8 @@
*/
protected void createXHTMLPage(String pageName) {
XHTMLDialogWizard xhtmlWizard = new NewXHTMLFileWizard().run();
- xhtmlWizard.setDestination(getProjectName() + "/WebContent/" + WEB_FOLDER).
- setName(pageName).finish();
+ xhtmlWizard.setDestination(getProjectName() + "/" + CDIConstants.WEBCONTENT +
+ "/" + WEB_FOLDER).setName(pageName).finish();
bot.sleep(Timing.time3S());
util.waitForNonIgnoredJobs();
setEd(bot.activeEditor().toTextEditor());
@@ -105,7 +106,7 @@
try {
bot.editorByTitle(className + ".java");
} catch (WidgetNotFoundException exc) {
- projectExplorer.openFile(getProjectName(), "Java Resources",
"JavaSource",
+ projectExplorer.openFile(getProjectName(), CDIConstants.JAVA_RESOURCES,
CDIConstants.JAVA_SOURCE,
getPackageName(), className);
}
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/named/NamedComponentsSearchingTest.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/named/NamedComponentsSearchingTest.java 2012-01-24
10:42:38 UTC (rev 38081)
+++
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/named/NamedComponentsSearchingTest.java 2012-01-24
10:47:26 UTC (rev 38082)
@@ -15,6 +15,7 @@
import java.util.List;
import java.util.Map;
+import org.jboss.tools.cdi.bot.test.CDIConstants;
import org.jboss.tools.cdi.bot.test.CDITestBase;
import org.jboss.tools.cdi.bot.test.annotations.CDIWizardType;
import org.jboss.tools.cdi.bot.test.uiutils.wizards.CDIWizardBaseExt;
@@ -36,6 +37,8 @@
private final String beanName = "Bean1";
private final String stereotypeName = "Stereotype1";
private static SearchNamedDialogWizard namedDialog = null;
+ private final String BEAN_STEREOTYPE_PATH =
"/resources/named/BeanWithStereotype.java.cdi";
+ private final String BEAN_STEREOTYPE_NAMED_PATH =
"/resources/named/BeanWithStereotypeAndNamed.java.cdi";
@Override
public String getProjectName() {
@@ -164,7 +167,7 @@
false, false, false).finish();
wizard.createCDIComponentWithContent(CDIWizardType.BEAN, beanName, getPackageName(),
- null, "/resources/named/BeanWithStereotype.java.cdi");
+ null, BEAN_STEREOTYPE_PATH);
namedDialog = openSearchNamedDialog().setNamedPrefix(beanName);
assertTrue(namedDialog.matchingItems().size() == 1);
@@ -183,7 +186,7 @@
false, false, false).finish();
wizard.createCDIComponentWithContent(CDIWizardType.BEAN, beanName, getPackageName(),
- null, "/resources/named/BeanWithStereotypeAndNamed.java.cdi");
+ null, BEAN_STEREOTYPE_NAMED_PATH);
namedDialog = openSearchNamedDialog().setNamedPrefix(beanName);
assertTrue(namedDialog.matchingItems().size() == 0);
@@ -204,7 +207,7 @@
false, false, false).finish();
wizard.createCDIComponentWithContent(CDIWizardType.BEAN, beanName, getPackageName(),
- null, "/resources/named/BeanWithStereotypeAndNamed.java.cdi");
+ null, BEAN_STEREOTYPE_NAMED_PATH);
namedDialog = openSearchNamedDialog().setNamedPrefix(beanName);
assertTrue(namedDialog.matchingItems().size() == 0);
@@ -227,7 +230,7 @@
private SearchNamedDialogWizard openSearchNamedDialog() {
- bot.menu("Navigate").menu("Open CDI Named Bean").click();
+ bot.menu(CDIConstants.NAVIGATE).menu(CDIConstants.OPEN_CDI_NAMED_BEANS).click();
bot.sleep(Timing.time500MS());
return new SearchNamedDialogWizard();
}
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/named/NamedRefactoringTest.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/named/NamedRefactoringTest.java 2012-01-24
10:42:38 UTC (rev 38081)
+++
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/named/NamedRefactoringTest.java 2012-01-24
10:47:26 UTC (rev 38082)
@@ -29,12 +29,12 @@
public class NamedRefactoringTest extends JSFTestBase {
- private static final String MANAGED_BEAN_1 = "ManagedBean1";
- private static final String MANAGED_BEAN_2 = "ManagedBean2";
- private static final String INDEX_XHTML_1= "index1.xhtml";
- private static final String INDEX_XHTML_2= "index2.xhtml";
- private static final String INDEX_XHTML_3= "index3.xhtml";
- private static final String NEW_NAMED_PARAM = "bean2";
+ private final String MANAGED_BEAN_1 = "ManagedBean1";
+ private final String MANAGED_BEAN_2 = "ManagedBean2";
+ private final String INDEX_XHTML_1= "index1.xhtml";
+ private final String INDEX_XHTML_2= "index2.xhtml";
+ private final String INDEX_XHTML_3= "index3.xhtml";
+ private final String NEW_NAMED_PARAM = "bean2";
@Override
public String getProjectName() {
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/openon/OpenOnBase.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/openon/OpenOnBase.java 2012-01-24
10:42:38 UTC (rev 38081)
+++
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/openon/OpenOnBase.java 2012-01-24
10:47:26 UTC (rev 38082)
@@ -11,6 +11,7 @@
package org.jboss.tools.cdi.bot.test.openon;
+import org.jboss.tools.cdi.bot.test.CDIConstants;
import org.jboss.tools.cdi.bot.test.CDITestBase;
import org.jboss.tools.cdi.bot.test.annotations.CDIWizardType;
@@ -49,9 +50,9 @@
protected boolean checkBeanXMLDecoratorOpenOn(String packageName, String className) {
wizard.createCDIComponent(CDIWizardType.DECORATOR, className, packageName,
"java.util.Set");
- bot.editorByTitle("beans.xml").show();
+ bot.editorByTitle(CDIConstants.BEANS_XML).show();
bot.cTabItem("Source").activate();
- openOnUtil.openOnDirect(packageName + "." + className,
"beans.xml");
+ openOnUtil.openOnDirect(packageName + "." + className,
CDIConstants.BEANS_XML);
return getEd().getTitle().equals(className + ".java");
}
@@ -67,9 +68,9 @@
protected boolean checkBeanXMLInterceptorOpenOn(String packageName, String className) {
wizard.createCDIComponent(CDIWizardType.INTERCEPTOR, className, packageName,
null);
- bot.editorByTitle("beans.xml").show();
+ bot.editorByTitle(CDIConstants.BEANS_XML).show();
bot.cTabItem("Source").activate();
- openOnUtil.openOnDirect(packageName + "." + className,
"beans.xml");
+ openOnUtil.openOnDirect(packageName + "." + className,
CDIConstants.BEANS_XML);
return getEd().getTitle().equals(className + ".java");
}
@@ -84,9 +85,9 @@
protected boolean checkBeanXMLAlternativeOpenOn(String packageName, String className) {
wizard.createCDIComponent(CDIWizardType.BEAN, className, packageName,
"alternative+beansxml");
- bot.editorByTitle("beans.xml").show();
+ bot.editorByTitle(CDIConstants.BEANS_XML).show();
bot.cTabItem("Source").activate();
- openOnUtil.openOnDirect(packageName + "." + className,
"beans.xml");
+ openOnUtil.openOnDirect(packageName + "." + className,
CDIConstants.BEANS_XML);
return getEd().getTitle().equals(className + ".java");
}
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/openon/OpenOnTest.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/openon/OpenOnTest.java 2012-01-24
10:42:38 UTC (rev 38081)
+++
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/openon/OpenOnTest.java 2012-01-24
10:47:26 UTC (rev 38082)
@@ -12,6 +12,7 @@
package org.jboss.tools.cdi.bot.test.openon;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTable;
+import org.jboss.tools.cdi.bot.test.CDIConstants;
import org.jboss.tools.cdi.bot.test.annotations.CDIWizardType;
import org.jboss.tools.ui.bot.ext.Timing;
import org.junit.Test;
@@ -38,7 +39,7 @@
String injectOption = null;
for (int i = 1; i < 12; i++) {
String injectPoint = "myBean" + i;
- injectOption = "Show All Assignable Beans...";
+ injectOption = CDIConstants.SHOW_ALL_ASSIGNABLE;
if (i > 8) injectOption = "Open @Inject Bean";
checkInjectedPoint(injectPoint, injectOption);
}
@@ -49,7 +50,7 @@
@Test
public void testBeansXMLClassesOpenOn() {
- beansHelper.createClearBeansXML(getProjectName());
+ beansHelper.createEmptyBeansXML(getProjectName());
assertTrue(checkBeanXMLDecoratorOpenOn(getProjectName(), "D1"));
Deleted:
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/BeansXMLQuickFixTestBase.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/BeansXMLQuickFixTestBase.java 2012-01-24
10:42:38 UTC (rev 38081)
+++
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/BeansXMLQuickFixTestBase.java 2012-01-24
10:47:26 UTC (rev 38082)
@@ -1,169 +0,0 @@
-/*******************************************************************************
- * 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.tools.cdi.bot.test.quickfix;
-
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
-import org.jboss.tools.cdi.bot.test.annotations.CDIWizardType;
-import org.jboss.tools.cdi.bot.test.annotations.ValidationType;
-import org.jboss.tools.cdi.bot.test.quickfix.validators.BeansXmlValidationProvider;
-import org.jboss.tools.cdi.bot.test.quickfix.validators.IValidationProvider;
-import org.jboss.tools.cdi.bot.test.uiutils.wizards.CDIWizardBase;
-import org.jboss.tools.cdi.bot.test.uiutils.wizards.QuickFixDialogWizard;
-
-public class BeansXMLQuickFixTestBase extends QuickFixTestBase {
-
- private static IValidationProvider validationProvider = new
BeansXmlValidationProvider();
-
- public IValidationProvider validationProvider() {
- return validationProvider;
- }
-
- /**
- * Method firstly gets beans.xml validation problem. Then
- * it opens quick fix wizard, selects default value and
- * press finish button
- */
- private void openBeanXMLValidationProblem(ValidationType validationProblemType) {
-
- SWTBotTreeItem validationProblem = getProblem(validationProblemType);
- assertNotNull(validationProblem);
-
- quickFixHelper.openQuickFix(validationProblem);
- QuickFixDialogWizard qfWizard = new QuickFixDialogWizard();
- qfWizard.setFix(qfWizard.getAvailableFixes().get(0));
- qfWizard.setResource(qfWizard.getResources().get(0));
- qfWizard.finish();
- }
-
- /**
- * Method checks if there is no beans.xml validation error
- * @return
- */
- public boolean isBeanXMLValidationProblemsEmpty() {
- for (ValidationType validationType:
validationProvider().getAllValidationProblemsType()) {
- if (getProblem(validationType) != null) {
- return false;
- }
- }
- return true;
- }
-
- /**
- * Method resolves validation error where there is no such Alternative as
- * configured in beans.xml. It opens quick fix and through finish button
- * the Bean Wizard dialog is opened where both parameters are used to create
- * the new alternative bean
- * @param name
- * @param pkg
- */
- public void resolveAddNewAlternative(String name, String pkg) {
-
- openBeanXMLValidationProblem(ValidationType.NO_CLASS);
- CDIWizardBase cdiWizardBase = new CDIWizardBase(CDIWizardType.BEAN);
- if (cdiWizardBase.isAlternative() && cdiWizardBase.canFinish()) {
- cdiWizardBase.setName(name).setPackage(pkg).finish();
- }else {
- fail("Dialog can't be finished");
- }
-
- }
-
- /**
- * Method resolves validation error where there is no such Stereotype as
- * configured in beans.xml. It opens quick fix and through finish button
- * the Stereotype Wizard dialog is opened where both parameters are used to create
- * the new stereotype annotation
- * @param name
- * @param pkg
- */
- public void resolveAddNewStereotype(String name, String pkg) {
-
- openBeanXMLValidationProblem(ValidationType.NO_ANNOTATION);
- CDIWizardBase cdiWizardBase = new CDIWizardBase(CDIWizardType.STEREOTYPE);
- if (cdiWizardBase.isAlternative() && cdiWizardBase.canFinish()) {
- cdiWizardBase.setName(name).setPackage(pkg).finish();
- }else {
- fail("Dialog can't be finished");
- }
-
- }
-
- /**
- * Method resolves validation error where there is no such decorator as
- * configured in beans.xml. It opens quick fix and through finish button
- * the Decorator Wizard dialog is opened where both parameters are used to create
- * the new decorator. Interface "java.util.List" is automatically used.
- * @param name
- * @param pkg
- */
- public void resolveAddNewDecorator(String name, String pkg) {
-
- openBeanXMLValidationProblem(ValidationType.NO_CLASS);
- CDIWizardBase cdiWizardBase = new CDIWizardBase(CDIWizardType.DECORATOR);
- cdiWizardBase.addInterface("java.util.List");
- if (cdiWizardBase.canFinish()) {
- cdiWizardBase.setName(name).setPackage(pkg).finish();
- } else {
- fail("Dialog can't be finished");
- }
-
- }
-
- /**
- * Method resolves validation error where there is no such Interceptor as
- * configured in beans.xml. It opens quick fix and through finish button
- * the Interceptor Wizard dialog is opened where both parameters are used to create
- * the new Interceptor
- * @param name
- * @param pkg
- */
- public void resolveAddNewInterceptor(String name, String pkg) {
-
- openBeanXMLValidationProblem(ValidationType.NO_CLASS);
- CDIWizardBase cdiWizardBase = new CDIWizardBase(CDIWizardType.INTERCEPTOR);
- if (cdiWizardBase.canFinish()) {
- cdiWizardBase.setName(name).setPackage(pkg).finish();
- }else {
- fail("Dialog can't be finished");
- }
-
- }
-
- /**
- * Method corrects Bean which has no @Alternative annotation in it
- * by adding these parameter.
- * @param name
- * @param pkg
- */
- public void resolveAddAlternativeToBean(String name) {
-
- openBeanXMLValidationProblem(ValidationType.ALTERNATIVE_BEAN_XML);
- String content = bot.editorByTitle(name + ".java").toTextEditor().getText();
- assertTrue(content.contains("@Alternative"));
-
- }
-
- /**
- * Method corrects Stereotype which has no @Alternative annotation in it
- * by adding these parameter.
- * @param name
- * @param pkg
- */
- public void resolveAddAlternativeToStereotype(String name) {
-
- openBeanXMLValidationProblem(ValidationType.ALTERNATIVE_STEREOTYPE_BEAN_XML);
- String content = bot.editorByTitle(name + ".java").toTextEditor().getText();
- assertTrue(content.contains("@Alternative"));
-
- }
-
-}
Deleted:
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/EligibleInjectionQuickFixTestBase.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/EligibleInjectionQuickFixTestBase.java 2012-01-24
10:42:38 UTC (rev 38081)
+++
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/EligibleInjectionQuickFixTestBase.java 2012-01-24
10:47:26 UTC (rev 38082)
@@ -1,91 +0,0 @@
-/*******************************************************************************
- * 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.tools.cdi.bot.test.quickfix;
-
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
-import org.jboss.tools.cdi.bot.test.annotations.ValidationType;
-import org.jboss.tools.cdi.bot.test.quickfix.injection.QualifierOperation;
-import org.jboss.tools.cdi.bot.test.quickfix.validators.BeanValidationProvider;
-import org.jboss.tools.cdi.bot.test.quickfix.validators.IValidationProvider;
-import org.jboss.tools.cdi.bot.test.uiutils.wizards.QuickFixDialogWizard;
-import org.jboss.tools.cdi.bot.test.uiutils.wizards.SpecifyBeanDialogWizard;
-import org.jboss.tools.ui.bot.ext.Timing;
-
-public class EligibleInjectionQuickFixTestBase extends QuickFixTestBase{
-
- private static IValidationProvider validationProvider = new BeanValidationProvider();
-
- public IValidationProvider validationProvider() {
- return validationProvider;
- }
-
- /**
- * Method resolves multiple bean injection problem. By setting class which
- * should be more qualified and qualifier name it resolves this problem.
- * If qualifier doesn't exist, by using qualifier wizard it creates the new
- * one and uses it to resolve problem
- * @param classToQualify
- * @param qualifier
- */
- public void resolveMultipleBeans(ValidationType validationType, String classToQualify,
- String qualifier, QualifierOperation operation) {
-
- SWTBotTreeItem validationProblem = getProblem(validationType);
- assertNotNull(validationProblem);
-
- quickFixHelper.openQuickFix(validationProblem);
- QuickFixDialogWizard quickFixWizard = new QuickFixDialogWizard();
- for (String availableFix : quickFixWizard.getAvailableFixes()) {
- if (availableFix.contains(classToQualify)) {
- quickFixWizard.setFix(availableFix).
- setResource(quickFixWizard.getResources().get(0)).
- finish();
- }
- }
-
- SpecifyBeanDialogWizard spBeanDialogWizard = new SpecifyBeanDialogWizard();
- if (operation == QualifierOperation.ADD) {
- boolean qualifFound = false;
- for (String availQualifer : spBeanDialogWizard.getAvailableQualifiers()) {
- if (availQualifer.equals(qualifier + " - " + getPackageName())) {
- qualifFound = true;
- spBeanDialogWizard.addQualifier(availQualifer);
- }
- }
- // there was no such qualifer, it has to be created, after creation it
- // has to be added to in Bean qualifiers
- if (!qualifFound) {
- spBeanDialogWizard.createNewQualifier(qualifier, getPackageName()).
- setName(qualifier).finish();
- bot.sleep(Timing.time2S());
- for (String availQualifer : spBeanDialogWizard.getAvailableQualifiers()) {
- if (availQualifer.equals(qualifier + " - " + getPackageName())) {
- spBeanDialogWizard.addQualifier(availQualifer);
- }
- }
- }
-
- } else {
- for (String inBeanQualifer : spBeanDialogWizard.getInBeanQualifiers()) {
- if (inBeanQualifer.equals(qualifier + " - " + getPackageName())) {
- spBeanDialogWizard.removeQualifier(inBeanQualifer);
- }
- }
- }
-
- spBeanDialogWizard.finish();
-
- bot.sleep(Timing.time1S());
- util.waitForNonIgnoredJobs();
- }
-
-}
Deleted:
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/QuickFixTestBase.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/QuickFixTestBase.java 2012-01-24
10:42:38 UTC (rev 38081)
+++
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/QuickFixTestBase.java 2012-01-24
10:47:26 UTC (rev 38082)
@@ -1,104 +0,0 @@
-/*******************************************************************************
- * 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.tools.cdi.bot.test.quickfix;
-
-
-import java.util.List;
-
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
-import org.jboss.tools.cdi.bot.test.CDITestBase;
-import org.jboss.tools.cdi.bot.test.annotations.ProblemsType;
-import org.jboss.tools.cdi.bot.test.annotations.ValidationType;
-import org.jboss.tools.cdi.bot.test.quickfix.validators.IValidationProvider;
-import org.jboss.tools.cdi.bot.test.uiutils.wizards.QuickFixDialogWizard;
-import org.junit.BeforeClass;
-
-/**
- * Test base for all QuickFix-like tests
- *
- * @author Jaroslav Jankovic
- */
-
-public abstract class QuickFixTestBase extends CDITestBase {
-
- @BeforeClass
- public static void setup() {
- problems.show();
- }
-
- protected abstract IValidationProvider validationProvider();
-
- /**
- * checkQuickFix is the most important method in this class. It
- * gets validation error prior to component type and annotation type,
- * then it resolve validation error through quick fix
- * wizard and finally check if validation errors was fixed through
- * this wizard
- * @param validationType
- * @param compType
- */
- public void checkQuickFix(ValidationType validationType) {
- SWTBotTreeItem validationProblem = getProblem(validationType);
- assertNotNull(validationProblem);
- resolveQuickFix(validationProblem);
- validationProblem = getProblem(validationType);
- assertNull(validationProblem);
- }
-
- /**
- * Methods gets the particular validation problem located in Problems View by
- * using specific ValidationErrorsProvider
- * @param validationType
- * @param compType
- * @return
- */
- protected SWTBotTreeItem getProblem(ValidationType validationType) {
- IValidationProvider validationErrorsProvider = validationProvider();
- List<String> validationProblems = null;
- SWTBotTreeItem[] problemsInProblemsView = null;
- if (validationErrorsProvider.getAllWarningsAnnotation().contains(validationType)) {
- validationProblems =
validationErrorsProvider.getAllWarningForAnnotationType(validationType);
- problemsInProblemsView = quickFixHelper.getProblems(ProblemsType.WARNINGS,
getProjectName());
- } else {
- validationProblems =
validationErrorsProvider.getAllErrorsForAnnotationType(validationType);
- problemsInProblemsView = quickFixHelper.getProblems(ProblemsType.ERRORS,
getProjectName());
- }
- for (SWTBotTreeItem ti: problemsInProblemsView) {
- for (String validationProblem: validationProblems) {
- if (ti.getText().contains(validationProblem)) {
- return ti;
- }
- }
- }
- return null;
- }
-
- /**
- * Method resolves particular validation problem (parameter ti).
- * It simply open context menu for param "ti", open menu "Quick Fix"
and
- * chooses first option and confirms it (resolve it)
- * @param ti
- */
- private void resolveQuickFix(SWTBotTreeItem ti) {
- quickFixHelper.openQuickFix(ti);
-
- QuickFixDialogWizard qfWizard = new QuickFixDialogWizard();
-
- String firstFix = qfWizard.getAvailableFixes().get(0);
- String firstResource = qfWizard.getResources().get(0);
-
- qfWizard.setFix(firstFix).setResource(firstResource).finish();
-
- util.waitForNonIgnoredJobs();
- }
-
-}
Added:
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/base/BeansXMLQuickFixTestBase.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/base/BeansXMLQuickFixTestBase.java
(rev 0)
+++
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/base/BeansXMLQuickFixTestBase.java 2012-01-24
10:47:26 UTC (rev 38082)
@@ -0,0 +1,166 @@
+/*******************************************************************************
+ * 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.tools.cdi.bot.test.quickfix.base;
+
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
+import org.jboss.tools.cdi.bot.test.annotations.CDIWizardType;
+import org.jboss.tools.cdi.bot.test.annotations.ValidationType;
+import org.jboss.tools.cdi.bot.test.quickfix.validators.BeansXmlValidationProvider;
+import org.jboss.tools.cdi.bot.test.quickfix.validators.IValidationProvider;
+import org.jboss.tools.cdi.bot.test.uiutils.wizards.CDIWizardBase;
+import org.jboss.tools.cdi.bot.test.uiutils.wizards.QuickFixDialogWizard;
+import org.jboss.tools.ui.bot.ext.view.ProblemsView;
+
+public class BeansXMLQuickFixTestBase extends QuickFixTestBase {
+
+ private static IValidationProvider validationProvider = new
BeansXmlValidationProvider();
+
+ public IValidationProvider validationProvider() {
+ return validationProvider;
+ }
+
+ /**
+ * Method firstly gets beans.xml validation problem. Then
+ * it opens quick fix wizard, selects default value and
+ * press finish button
+ */
+ private void openBeanXMLValidationProblem(ValidationType validationProblemType) {
+
+ SWTBotTreeItem validationProblem = getProblem(validationProblemType);
+ assertNotNull(validationProblem);
+
+ quickFixHelper.openQuickFix(validationProblem);
+ QuickFixDialogWizard qfWizard = new QuickFixDialogWizard();
+ qfWizard.setFix(qfWizard.getAvailableFixes().get(0));
+ qfWizard.setResource(qfWizard.getResources().get(0));
+ qfWizard.finish();
+ }
+
+ /**
+ * Method checks if there is no beans.xml validation error
+ * @return
+ */
+ public boolean isBeanXMLValidationErrorEmpty() {
+ return ProblemsView.getFilteredErrorsTreeItems(bot, null, "/" +
getProjectName(),
+ "beans.xml", "CDI Problem").length == 0;
+ }
+
+ /**
+ * Method resolves validation error where there is no such Alternative as
+ * configured in beans.xml. It opens quick fix and through finish button
+ * the Bean Wizard dialog is opened where both parameters are used to create
+ * the new alternative bean
+ * @param name
+ * @param pkg
+ */
+ public void resolveAddNewAlternative(String name, String pkg) {
+
+ openBeanXMLValidationProblem(ValidationType.NO_CLASS);
+ CDIWizardBase cdiWizardBase = new CDIWizardBase(CDIWizardType.BEAN);
+ if (cdiWizardBase.isAlternative() && cdiWizardBase.canFinish()) {
+ cdiWizardBase.setName(name).setPackage(pkg).finish();
+ }else {
+ fail("Dialog can't be finished");
+ }
+
+ }
+
+ /**
+ * Method resolves validation error where there is no such Stereotype as
+ * configured in beans.xml. It opens quick fix and through finish button
+ * the Stereotype Wizard dialog is opened where both parameters are used to create
+ * the new stereotype annotation
+ * @param name
+ * @param pkg
+ */
+ public void resolveAddNewStereotype(String name, String pkg) {
+
+ openBeanXMLValidationProblem(ValidationType.NO_ANNOTATION);
+ CDIWizardBase cdiWizardBase = new CDIWizardBase(CDIWizardType.STEREOTYPE);
+ if (cdiWizardBase.isAlternative() && cdiWizardBase.canFinish()) {
+ cdiWizardBase.setName(name).setPackage(pkg).finish();
+ }else {
+ fail("Dialog can't be finished");
+ }
+
+ }
+
+ /**
+ * Method resolves validation error where there is no such decorator as
+ * configured in beans.xml. It opens quick fix and through finish button
+ * the Decorator Wizard dialog is opened where both parameters are used to create
+ * the new decorator. Interface "java.util.List" is automatically used.
+ * @param name
+ * @param pkg
+ */
+ public void resolveAddNewDecorator(String name, String pkg) {
+
+ openBeanXMLValidationProblem(ValidationType.NO_CLASS);
+ CDIWizardBase cdiWizardBase = new CDIWizardBase(CDIWizardType.DECORATOR);
+ cdiWizardBase.addInterface("java.util.List");
+ if (cdiWizardBase.canFinish()) {
+ cdiWizardBase.setName(name).setPackage(pkg).finish();
+ } else {
+ fail("Dialog can't be finished");
+ }
+
+ }
+
+ /**
+ * Method resolves validation error where there is no such Interceptor as
+ * configured in beans.xml. It opens quick fix and through finish button
+ * the Interceptor Wizard dialog is opened where both parameters are used to create
+ * the new Interceptor
+ * @param name
+ * @param pkg
+ */
+ public void resolveAddNewInterceptor(String name, String pkg) {
+
+ openBeanXMLValidationProblem(ValidationType.NO_CLASS);
+ CDIWizardBase cdiWizardBase = new CDIWizardBase(CDIWizardType.INTERCEPTOR);
+ if (cdiWizardBase.canFinish()) {
+ cdiWizardBase.setName(name).setPackage(pkg).finish();
+ }else {
+ fail("Dialog can't be finished");
+ }
+
+ }
+
+ /**
+ * Method corrects Bean which has no @Alternative annotation in it
+ * by adding these parameter.
+ * @param name
+ * @param pkg
+ */
+ public void resolveAddAlternativeToBean(String name) {
+
+ openBeanXMLValidationProblem(ValidationType.ALTERNATIVE_BEAN_XML);
+ String content = bot.editorByTitle(name + ".java").toTextEditor().getText();
+ assertTrue(content.contains("@Alternative"));
+
+ }
+
+ /**
+ * Method corrects Stereotype which has no @Alternative annotation in it
+ * by adding these parameter.
+ * @param name
+ * @param pkg
+ */
+ public void resolveAddAlternativeToStereotype(String name) {
+
+ openBeanXMLValidationProblem(ValidationType.ALTERNATIVE_STEREOTYPE_BEAN_XML);
+ String content = bot.editorByTitle(name + ".java").toTextEditor().getText();
+ assertTrue(content.contains("@Alternative"));
+
+ }
+
+}
Added:
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/base/EligibleInjectionQuickFixTestBase.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/base/EligibleInjectionQuickFixTestBase.java
(rev 0)
+++
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/base/EligibleInjectionQuickFixTestBase.java 2012-01-24
10:47:26 UTC (rev 38082)
@@ -0,0 +1,91 @@
+/*******************************************************************************
+ * 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.tools.cdi.bot.test.quickfix.base;
+
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
+import org.jboss.tools.cdi.bot.test.annotations.ValidationType;
+import org.jboss.tools.cdi.bot.test.quickfix.injection.QualifierOperation;
+import org.jboss.tools.cdi.bot.test.quickfix.validators.BeanValidationProvider;
+import org.jboss.tools.cdi.bot.test.quickfix.validators.IValidationProvider;
+import org.jboss.tools.cdi.bot.test.uiutils.wizards.QuickFixDialogWizard;
+import org.jboss.tools.cdi.bot.test.uiutils.wizards.SpecifyBeanDialogWizard;
+import org.jboss.tools.ui.bot.ext.Timing;
+
+public class EligibleInjectionQuickFixTestBase extends QuickFixTestBase{
+
+ private static IValidationProvider validationProvider = new BeanValidationProvider();
+
+ public IValidationProvider validationProvider() {
+ return validationProvider;
+ }
+
+ /**
+ * Method resolves multiple bean injection problem. By setting class which
+ * should be more qualified and qualifier name it resolves this problem.
+ * If qualifier doesn't exist, by using qualifier wizard it creates the new
+ * one and uses it to resolve problem
+ * @param classToQualify
+ * @param qualifier
+ */
+ public void resolveMultipleBeans(ValidationType validationType, String classToQualify,
+ String qualifier, QualifierOperation operation) {
+
+ SWTBotTreeItem validationProblem = getProblem(validationType);
+ assertNotNull(validationProblem);
+
+ quickFixHelper.openQuickFix(validationProblem);
+ QuickFixDialogWizard quickFixWizard = new QuickFixDialogWizard();
+ for (String availableFix : quickFixWizard.getAvailableFixes()) {
+ if (availableFix.contains(classToQualify)) {
+ quickFixWizard.setFix(availableFix).
+ setResource(quickFixWizard.getResources().get(0)).
+ finish();
+ }
+ }
+
+ SpecifyBeanDialogWizard spBeanDialogWizard = new SpecifyBeanDialogWizard();
+ if (operation == QualifierOperation.ADD) {
+ boolean qualifFound = false;
+ for (String availQualifer : spBeanDialogWizard.getAvailableQualifiers()) {
+ if (availQualifer.equals(qualifier + " - " + getPackageName())) {
+ qualifFound = true;
+ spBeanDialogWizard.addQualifier(availQualifer);
+ }
+ }
+ // there was no such qualifer, it has to be created, after creation it
+ // has to be added to in Bean qualifiers
+ if (!qualifFound) {
+ spBeanDialogWizard.createNewQualifier(qualifier, getPackageName()).
+ setName(qualifier).finish();
+ bot.sleep(Timing.time2S());
+ for (String availQualifer : spBeanDialogWizard.getAvailableQualifiers()) {
+ if (availQualifer.equals(qualifier + " - " + getPackageName())) {
+ spBeanDialogWizard.addQualifier(availQualifer);
+ }
+ }
+ }
+
+ } else {
+ for (String inBeanQualifer : spBeanDialogWizard.getInBeanQualifiers()) {
+ if (inBeanQualifer.equals(qualifier + " - " + getPackageName())) {
+ spBeanDialogWizard.removeQualifier(inBeanQualifer);
+ }
+ }
+ }
+
+ spBeanDialogWizard.finish();
+
+ bot.sleep(Timing.time1S());
+ util.waitForNonIgnoredJobs();
+ }
+
+}
Added:
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/base/QuickFixTestBase.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/base/QuickFixTestBase.java
(rev 0)
+++
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/base/QuickFixTestBase.java 2012-01-24
10:47:26 UTC (rev 38082)
@@ -0,0 +1,104 @@
+/*******************************************************************************
+ * 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.tools.cdi.bot.test.quickfix.base;
+
+
+import java.util.List;
+
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
+import org.jboss.tools.cdi.bot.test.CDITestBase;
+import org.jboss.tools.cdi.bot.test.annotations.ProblemsType;
+import org.jboss.tools.cdi.bot.test.annotations.ValidationType;
+import org.jboss.tools.cdi.bot.test.quickfix.validators.IValidationProvider;
+import org.jboss.tools.cdi.bot.test.uiutils.wizards.QuickFixDialogWizard;
+import org.junit.BeforeClass;
+
+/**
+ * Test base for all QuickFix-like tests
+ *
+ * @author Jaroslav Jankovic
+ */
+
+public abstract class QuickFixTestBase extends CDITestBase {
+
+ @BeforeClass
+ public static void setup() {
+ problems.show();
+ }
+
+ protected abstract IValidationProvider validationProvider();
+
+ /**
+ * checkQuickFix is the most important method in this class. It
+ * gets validation error prior to component type and annotation type,
+ * then it resolve validation error through quick fix
+ * wizard and finally check if validation errors was fixed through
+ * this wizard
+ * @param validationType
+ * @param compType
+ */
+ public void checkQuickFix(ValidationType validationType) {
+ SWTBotTreeItem validationProblem = getProblem(validationType);
+ assertNotNull(validationProblem);
+ resolveQuickFix(validationProblem);
+ validationProblem = getProblem(validationType);
+ assertNull(validationProblem);
+ }
+
+ /**
+ * Methods gets the particular validation problem located in Problems View by
+ * using specific ValidationErrorsProvider
+ * @param validationType
+ * @param compType
+ * @return
+ */
+ protected SWTBotTreeItem getProblem(ValidationType validationType) {
+ IValidationProvider validationErrorsProvider = validationProvider();
+ List<String> validationProblems = null;
+ SWTBotTreeItem[] problemsInProblemsView = null;
+ if (validationErrorsProvider.getAllWarningsAnnotation().contains(validationType)) {
+ validationProblems =
validationErrorsProvider.getAllWarningForAnnotationType(validationType);
+ problemsInProblemsView = quickFixHelper.getProblems(ProblemsType.WARNINGS,
getProjectName());
+ } else {
+ validationProblems =
validationErrorsProvider.getAllErrorsForAnnotationType(validationType);
+ problemsInProblemsView = quickFixHelper.getProblems(ProblemsType.ERRORS,
getProjectName());
+ }
+ for (SWTBotTreeItem ti: problemsInProblemsView) {
+ for (String validationProblem: validationProblems) {
+ if (ti.getText().contains(validationProblem)) {
+ return ti;
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Method resolves particular validation problem (parameter ti).
+ * It simply open context menu for param "ti", open menu "Quick Fix"
and
+ * chooses first option and confirms it (resolve it)
+ * @param ti
+ */
+ private void resolveQuickFix(SWTBotTreeItem ti) {
+ quickFixHelper.openQuickFix(ti);
+
+ QuickFixDialogWizard qfWizard = new QuickFixDialogWizard();
+
+ String firstFix = qfWizard.getAvailableFixes().get(0);
+ String firstResource = qfWizard.getResources().get(0);
+
+ qfWizard.setFix(firstFix).setResource(firstResource).finish();
+
+ util.waitForNonIgnoredJobs();
+ }
+
+}
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/injection/ProblemEligibleInjectionTest.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/injection/ProblemEligibleInjectionTest.java 2012-01-24
10:42:38 UTC (rev 38081)
+++
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/injection/ProblemEligibleInjectionTest.java 2012-01-24
10:47:26 UTC (rev 38082)
@@ -13,7 +13,7 @@
import org.jboss.tools.cdi.bot.test.annotations.CDIWizardType;
import org.jboss.tools.cdi.bot.test.annotations.ValidationType;
-import org.jboss.tools.cdi.bot.test.quickfix.EligibleInjectionQuickFixTestBase;
+import org.jboss.tools.cdi.bot.test.quickfix.base.EligibleInjectionQuickFixTestBase;
import org.junit.After;
import org.junit.Test;
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/test/BeanValidationQuickFixTest.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/test/BeanValidationQuickFixTest.java 2012-01-24
10:42:38 UTC (rev 38081)
+++
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/test/BeanValidationQuickFixTest.java 2012-01-24
10:47:26 UTC (rev 38082)
@@ -14,7 +14,7 @@
import org.jboss.tools.cdi.bot.test.annotations.CDIWizardType;
import org.jboss.tools.cdi.bot.test.annotations.ValidationType;
-import org.jboss.tools.cdi.bot.test.quickfix.QuickFixTestBase;
+import org.jboss.tools.cdi.bot.test.quickfix.base.QuickFixTestBase;
import org.jboss.tools.cdi.bot.test.quickfix.validators.BeanValidationProvider;
import org.jboss.tools.cdi.bot.test.quickfix.validators.IValidationProvider;
import org.junit.Test;
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/test/BeansXMLValidationQuickFixTest.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/test/BeansXMLValidationQuickFixTest.java 2012-01-24
10:42:38 UTC (rev 38081)
+++
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/test/BeansXMLValidationQuickFixTest.java 2012-01-24
10:47:26 UTC (rev 38082)
@@ -12,7 +12,7 @@
package org.jboss.tools.cdi.bot.test.quickfix.test;
import org.jboss.tools.cdi.bot.test.annotations.CDIWizardType;
-import org.jboss.tools.cdi.bot.test.quickfix.BeansXMLQuickFixTestBase;
+import org.jboss.tools.cdi.bot.test.quickfix.base.BeansXMLQuickFixTestBase;
import org.junit.Test;
/**
@@ -36,7 +36,7 @@
resolveAddNewAlternative(bean, getPackageName());
- assertTrue(isBeanXMLValidationProblemsEmpty());
+ assertTrue(isBeanXMLValidationErrorEmpty());
}
@Test
@@ -47,7 +47,7 @@
resolveAddNewStereotype(stereotype, getPackageName());
- assertTrue(isBeanXMLValidationProblemsEmpty());
+ assertTrue(isBeanXMLValidationErrorEmpty());
}
@@ -62,7 +62,7 @@
resolveAddAlternativeToBean(bean);
- assertTrue(isBeanXMLValidationProblemsEmpty());
+ assertTrue(isBeanXMLValidationErrorEmpty());
}
@@ -77,7 +77,7 @@
resolveAddAlternativeToStereotype(stereotype);
- assertTrue(isBeanXMLValidationProblemsEmpty());
+ assertTrue(isBeanXMLValidationErrorEmpty());
}
@@ -90,7 +90,7 @@
resolveAddNewInterceptor(interceptor, getPackageName());
- assertTrue(isBeanXMLValidationProblemsEmpty());
+ assertTrue(isBeanXMLValidationErrorEmpty());
}
@@ -102,7 +102,7 @@
resolveAddNewDecorator(decorator, getPackageName());
- assertTrue(isBeanXMLValidationProblemsEmpty());
+ assertTrue(isBeanXMLValidationErrorEmpty());
}
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/test/DecoratorValidationQuickFixTest.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/test/DecoratorValidationQuickFixTest.java 2012-01-24
10:42:38 UTC (rev 38081)
+++
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/test/DecoratorValidationQuickFixTest.java 2012-01-24
10:47:26 UTC (rev 38082)
@@ -14,7 +14,7 @@
import org.jboss.tools.cdi.bot.test.annotations.CDIWizardType;
import org.jboss.tools.cdi.bot.test.annotations.ValidationType;
-import org.jboss.tools.cdi.bot.test.quickfix.QuickFixTestBase;
+import org.jboss.tools.cdi.bot.test.quickfix.base.QuickFixTestBase;
import org.jboss.tools.cdi.bot.test.quickfix.validators.DecoratorValidationProvider;
import org.jboss.tools.cdi.bot.test.quickfix.validators.IValidationProvider;
import org.junit.Test;
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/test/IBindingValidationQuickFixTest.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/test/IBindingValidationQuickFixTest.java 2012-01-24
10:42:38 UTC (rev 38081)
+++
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/test/IBindingValidationQuickFixTest.java 2012-01-24
10:47:26 UTC (rev 38082)
@@ -14,7 +14,7 @@
import org.jboss.tools.cdi.bot.test.annotations.CDIWizardType;
import org.jboss.tools.cdi.bot.test.annotations.ValidationType;
-import org.jboss.tools.cdi.bot.test.quickfix.QuickFixTestBase;
+import org.jboss.tools.cdi.bot.test.quickfix.base.QuickFixTestBase;
import org.jboss.tools.cdi.bot.test.quickfix.validators.IValidationProvider;
import
org.jboss.tools.cdi.bot.test.quickfix.validators.InterceptorBindingValidationProvider;
import org.junit.Test;
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/test/InterceptorValidationQuickFixTest.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/test/InterceptorValidationQuickFixTest.java 2012-01-24
10:42:38 UTC (rev 38081)
+++
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/test/InterceptorValidationQuickFixTest.java 2012-01-24
10:47:26 UTC (rev 38082)
@@ -14,7 +14,7 @@
import org.jboss.tools.cdi.bot.test.annotations.CDIWizardType;
import org.jboss.tools.cdi.bot.test.annotations.ValidationType;
-import org.jboss.tools.cdi.bot.test.quickfix.QuickFixTestBase;
+import org.jboss.tools.cdi.bot.test.quickfix.base.QuickFixTestBase;
import org.jboss.tools.cdi.bot.test.quickfix.validators.IValidationProvider;
import org.jboss.tools.cdi.bot.test.quickfix.validators.InterceptorValidationProvider;
import org.junit.Test;
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/test/QualifierValidationQuickFixTest.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/test/QualifierValidationQuickFixTest.java 2012-01-24
10:42:38 UTC (rev 38081)
+++
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/test/QualifierValidationQuickFixTest.java 2012-01-24
10:47:26 UTC (rev 38082)
@@ -14,7 +14,7 @@
import org.jboss.tools.cdi.bot.test.annotations.CDIWizardType;
import org.jboss.tools.cdi.bot.test.annotations.ValidationType;
-import org.jboss.tools.cdi.bot.test.quickfix.QuickFixTestBase;
+import org.jboss.tools.cdi.bot.test.quickfix.base.QuickFixTestBase;
import org.jboss.tools.cdi.bot.test.quickfix.validators.QualifierValidationProvider;
import org.jboss.tools.cdi.bot.test.quickfix.validators.IValidationProvider;
import org.junit.Test;
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/test/ScopeValidationQuickFixTest.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/test/ScopeValidationQuickFixTest.java 2012-01-24
10:42:38 UTC (rev 38081)
+++
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/test/ScopeValidationQuickFixTest.java 2012-01-24
10:47:26 UTC (rev 38082)
@@ -14,7 +14,7 @@
import org.jboss.tools.cdi.bot.test.annotations.CDIWizardType;
import org.jboss.tools.cdi.bot.test.annotations.ValidationType;
-import org.jboss.tools.cdi.bot.test.quickfix.QuickFixTestBase;
+import org.jboss.tools.cdi.bot.test.quickfix.base.QuickFixTestBase;
import org.jboss.tools.cdi.bot.test.quickfix.validators.ScopeValidationProvider;
import org.jboss.tools.cdi.bot.test.quickfix.validators.IValidationProvider;
import org.junit.Test;
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/test/StereotypeValidationQuickFixTest.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/test/StereotypeValidationQuickFixTest.java 2012-01-24
10:42:38 UTC (rev 38081)
+++
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/test/StereotypeValidationQuickFixTest.java 2012-01-24
10:47:26 UTC (rev 38082)
@@ -14,7 +14,7 @@
import org.jboss.tools.cdi.bot.test.annotations.CDIWizardType;
import org.jboss.tools.cdi.bot.test.annotations.ValidationType;
-import org.jboss.tools.cdi.bot.test.quickfix.QuickFixTestBase;
+import org.jboss.tools.cdi.bot.test.quickfix.base.QuickFixTestBase;
import org.jboss.tools.cdi.bot.test.quickfix.validators.StereotypeValidationProvider;
import org.jboss.tools.cdi.bot.test.quickfix.validators.IValidationProvider;
import org.junit.Test;
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/validators/BeansXmlValidationProvider.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/validators/BeansXmlValidationProvider.java 2012-01-24
10:42:38 UTC (rev 38081)
+++
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/validators/BeansXmlValidationProvider.java 2012-01-24
10:47:26 UTC (rev 38082)
@@ -36,6 +36,15 @@
problems.add(new ValidationProblem(ProblemsType.ERRORS,
ValidationType.ALTERNATIVE_STEREOTYPE_BEAN_XML,
"<stereotype> element must specify the name of an @Alternative stereotype
annotation"));
+ problems.add(new ValidationProblem(ProblemsType.ERRORS,
ValidationType.SPECIFY_ALTERNATIVE,
+ "must specify the name of an alternative bean class"));
+
+ problems.add(new ValidationProblem(ProblemsType.ERRORS,
ValidationType.SPECIFY_DECORATOR,
+ "must specify the name of a decorator bean class"));
+
+ problems.add(new ValidationProblem(ProblemsType.ERRORS,
ValidationType.SPECIFY_INTERCEPTOR,
+ "must specify the name of an interceptor class"));
+
}
}
Added:
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/BeansXMLHelper.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/BeansXMLHelper.java
(rev 0)
+++
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/BeansXMLHelper.java 2012-01-24
10:47:26 UTC (rev 38082)
@@ -0,0 +1,194 @@
+/*******************************************************************************
+ * 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.tools.cdi.bot.test.uiutils;
+
+import org.jboss.tools.cdi.bot.test.CDIBase;
+import org.jboss.tools.cdi.bot.test.CDIConstants;
+import org.jboss.tools.cdi.bot.test.annotations.CDIWizardType;
+import org.jboss.tools.cdi.bot.test.openon.OpenOnTest;
+import org.jboss.tools.ui.bot.ext.Timing;
+
+/**
+ * Helper for beans.xml validation
+ *
+ * @author Jaroslav Jankovic
+ *
+ */
+
+public class BeansXMLHelper extends CDIBase {
+
+ private static final String CLEAR_BEANS_XML = "/resources/beansXML/" +
+ "beans.xml.cdi";
+ private static final String CLEAR_BEANS_XML_WITH_TAG = "/resources/beansXML/"
+
+ "beansXmlWithEmptyTag.xml.cdi";
+ private static final String BEANS_XML_WITH_INTERCEPTOR =
"/resources/beansXML/" +
+ "beansXmlWithInterceptor.xml.cdi";
+ private static final String BEANS_XML_WITH_DECORATOR = "/resources/beansXML/"
+
+ "beansXmlWithDecorator.xml.cdi";
+ private static final String BEANS_XML_WITH_STEREOTYPE = "/resources/beansXML/"
+
+ "beansXmlWithStereotype.xml.cdi";
+ private static final String BEANS_XML_WITH_ALTERNATIVE =
"/resources/beansXML/" +
+ "beansXmlWithAlternative.xml.cdi";
+
+ /**
+ * Methods creates beans.xml with no tags for entered project.
+ * @param projectName
+ */
+ public void createEmptyBeansXML(String projectName) {
+
+ createBeansXML(projectName);
+ replaceBeansXMLContent(projectName, CLEAR_BEANS_XML);
+
+ }
+
+ /**
+ * Methods creates beans.xml with empty tag <> for entered project.
+ * @param projectName
+ */
+ public void createBeansXMLWithEmptyTag(String projectName) {
+
+ createBeansXML(projectName);
+ replaceBeansXMLContent(projectName, CLEAR_BEANS_XML_WITH_TAG);
+ }
+
+ /**
+ * Methods creates beans.xml with interceptor tags in it for entered project.
+ * Package and interceptor component name which should be showed in tag is
+ * determined by parameters. If className is null, then Component text will be
+ * removed
+ * @param projectName
+ * @param packageName
+ * @param className
+ */
+ public void createBeansXMLWithInterceptor(String projectName, String packageName,
+ String className) {
+
+ createBeansXML(projectName);
+ replaceBeansXMLContent(projectName, BEANS_XML_WITH_INTERCEPTOR);
+ if (className == null || className.length() == 0) {
+ editResourceUtil.replaceInEditor("<class>Component</class>",
+ "<class></class>");
+ } else {
+ editResourceUtil.replaceInEditor("Component", packageName + "." +
className);
+ }
+
+ }
+
+ /**
+ * Methods creates beans.xml with decorator tags in it for entered project.
+ * Package and decorator component name which should be showed in tag is
+ * determined by parameters. If className is null, then Component text will be
+ * removed
+ * @param projectName
+ * @param packageName
+ * @param className
+ */
+ public void createBeansXMLWithDecorator(String projectName, String packageName,
+ String className) {
+
+ createBeansXML(projectName);
+ replaceBeansXMLContent(projectName, BEANS_XML_WITH_DECORATOR);
+ if (className == null || className.length() == 0) {
+ editResourceUtil.replaceInEditor("<class>Component</class>",
+ "<class></class>");
+ } else {
+ editResourceUtil.replaceInEditor("Component", packageName + "." +
className);
+ }
+
+ }
+
+ /**
+ * Methods creates beans.xml with stereotype tags in it for entered project.
+ * Package and stereotype component name which should be showed in tag is
+ * determined by parameters. If className is null, then Component text will be
+ * removed
+ * @param projectName
+ * @param packageName
+ * @param className
+ */
+ public void createBeansXMLWithStereotype(String projectName, String packageName,
+ String className) {
+
+ createBeansXML(projectName);
+ replaceBeansXMLContent(projectName, BEANS_XML_WITH_STEREOTYPE);
+ if (className == null || className.length() == 0) {
+ editResourceUtil.replaceInEditor("<stereotype>Component</stereotype>",
+ "<stereotype></stereotype>");
+ } else {
+ editResourceUtil.replaceInEditor("Component", packageName + "." +
className);
+ }
+
+ }
+
+ /**
+ * Methods creates beans.xml with alternative tags in it for entered project.
+ * Package and alternative bean component name which should be showed in tag is
+ * determined by parameters. If className is null, then Component text will be
+ * removed
+ * @param projectName
+ * @param packageName
+ * @param className
+ */
+ public void createBeansXMLWithAlternative(String projectName, String packageName,
+ String className) {
+
+ createBeansXML(projectName);
+ replaceBeansXMLContent(projectName, BEANS_XML_WITH_ALTERNATIVE);
+ if (className == null || className.length() == 0) {
+ editResourceUtil.replaceInEditor("<class>Component</class>",
+ "<class></class>");
+ } else {
+ editResourceUtil.replaceInEditor("Component", packageName + "." +
className);
+ }
+ }
+
+ /**
+ * If there is no beans.xml file in the project, then this method creates a new one
+ * @param projectName
+ */
+ private void createBeansXML(String projectName) {
+
+ if (!projectExplorer.isFilePresent(projectName,
+ CDIConstants.META_INF_BEANS_XML_PATH.split("/")) &&
+ !projectExplorer.isFilePresent(projectName,
+ CDIConstants.WEB_INF_BEANS_XML_PATH.split("/"))) {
+
+ wizard.createCDIComponent(CDIWizardType.BEANS_XML, null,
+ projectName + "/" + CDIConstants.WEBCONTENT + "/" +
+ CDIConstants.WEB_INF, null);
+ }
+ }
+
+ /**
+ * Methods create beans.xml for entered project with content of file
+ * determined by parameter path. If there is beans.xml in project, its
+ * content is simply replaced
+ * @param projectName
+ * @param path
+ */
+ private void replaceBeansXMLContent(String projectName, String path) {
+
+ if (projectExplorer.isFilePresent(projectName,
+ CDIConstants.WEB_INF_BEANS_XML_PATH.split("/"))) {
+ projectExplorer.openFile(projectName,
CDIConstants.WEB_INF_BEANS_XML_PATH.split("/"));
+ }else {
+ projectExplorer.openFile(projectName,
CDIConstants.META_INF_BEANS_XML_PATH.split("/"));
+ }
+ bot.cTabItem("Source").activate();
+ setEd(bot.activeEditor().toTextEditor());
+ editResourceUtil.replaceClassContentByResource(OpenOnTest.class
+ .getResourceAsStream(path),
+ false);
+ bot.sleep(Timing.time500MS());
+ }
+
+}
Deleted:
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/BeansXMLValidationHelper.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/BeansXMLValidationHelper.java 2012-01-24
10:42:38 UTC (rev 38081)
+++
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/BeansXMLValidationHelper.java 2012-01-24
10:47:26 UTC (rev 38082)
@@ -1,250 +0,0 @@
-/*******************************************************************************
- * 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.tools.cdi.bot.test.uiutils;
-
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
-import org.jboss.tools.cdi.bot.test.CDIBase;
-import org.jboss.tools.cdi.bot.test.annotations.BeansXMLValidationErrors;
-import org.jboss.tools.cdi.bot.test.annotations.CDIWizardType;
-import org.jboss.tools.cdi.bot.test.openon.OpenOnTest;
-import org.jboss.tools.ui.bot.ext.Timing;
-import org.jboss.tools.ui.bot.ext.view.ProblemsView;
-
-/**
- * Helper for beans.xml validation
- *
- * @author Jaroslav Jankovic
- *
- */
-
-public class BeansXMLValidationHelper extends CDIBase {
-
- private static final String CLEAR_BEANS_XML =
"/resources/beansXML/beans.xml.cdi";
- private static final String CLEAR_BEANS_XML_WITH_TAG = "/resources/beansXML/"
+
- "beansXmlWithEmptyTag.xml.cdi";
- private static final String BEANS_XML_WITH_INTERCEPTOR =
"/resources/beansXML/" +
- "beansXmlWithInterceptor.xml.cdi";
- private static final String BEANS_XML_WITH_DECORATOR = "/resources/beansXML/"
+
- "beansXmlWithDecorator.xml.cdi";
- private static final String BEANS_XML_WITH_STEREOTYPE = "/resources/beansXML/"
+
- "beansXmlWithStereotype.xml.cdi";
- private static final String BEANS_XML_WITH_ALTERNATIVE =
"/resources/beansXML/" +
- "beansXmlWithAlternative.xml.cdi";
-
- /**
- * Method checks if there is validation problem with text
- * specified by parameter validationErrors for entered project
- * @param validationError
- * @return
- */
- public boolean checkValidationErrorInBeansXML(String projectName,
- BeansXMLValidationErrors validationError) {
- SWTBotTreeItem[] validationErrors = getBeansXMLValidationErrors(projectName);
- return ((validationErrors.length == 1) &&
- (validationErrors[0].getText().contains(validationError.message())));
- }
-
- /**
- * Method checks if there is no validation problem when
- * creating interceptor component with entered className
- * packageName for project with name projectName and
- * insert tag containing this interceptor
- * @param projectName
- * @param packageName
- * @param className
- * @return
- */
- public boolean checkInterceptorInBeansXML(String projectName,
- String packageName, String className) {
- createBeansXMLWithInterceptor(projectName, packageName, className);
- return getBeansXMLValidationErrors(projectName).length == 0;
- }
-
- /**
- * Method checks if there is no validation problem when
- * creating decorator component with entered className
- * packageName for project with name projectName and
- * insert tag containing this decorator
- * @param projectName
- * @param packageName
- * @param className
- * @return
- */
- public boolean checkDecoratorInBeansXML(String projectName,
- String packageName, String className) {
- createBeansXMLWithDecorator(projectName, packageName, className);
- return getBeansXMLValidationErrors(projectName).length == 0;
- }
-
- /**
- * Method checks if there is no validation problem when
- * creating alternative bean component with entered className
- * packageName for project with name projectName and
- * insert tag containing this alternative
- * @param projectName
- * @param packageName
- * @param className
- * @return
- */
- public boolean checkAlternativeInBeansXML(String projectName,
- String packageName, String className) {
- createBeansXMLWithAlternative(projectName, packageName, className);
- return getBeansXMLValidationErrors(projectName).length == 0;
- }
-
- /**
- * Method gets all beans.xml validation errors showed in Problems View
- * for entered project
- * @return
- */
- public SWTBotTreeItem[] getBeansXMLValidationErrors(String projectName) {
- return ProblemsView.getFilteredErrorsTreeItems(bot, null, "/"
- + projectName, "beans.xml", "CDI Problem");
- }
-
- /**
- * Methods creates beans.xml with no tags for entered project.
- * @param projectName
- */
- public void createClearBeansXML(String projectName) {
-
- createBeansXMLWithContent(projectName, CLEAR_BEANS_XML);
-
- }
-
- /**
- * Methods creates beans.xml with empty tag <> for entered project.
- * @param projectName
- */
- public void createClearBeansXMLWithEmptyTag(String projectName) {
-
- createBeansXMLWithContent(projectName, CLEAR_BEANS_XML_WITH_TAG);
- }
-
- /**
- * Methods creates beans.xml with interceptor tags in it for entered project.
- * Package and interceptor component name which should be showed in tag is
- * determined by parameters. If className is null, then Component text will be
- * removed
- * @param projectName
- * @param packageName
- * @param className
- */
- public void createBeansXMLWithInterceptor(String projectName, String packageName,
- String className) {
-
- createBeansXMLWithContent(projectName, BEANS_XML_WITH_INTERCEPTOR);
- if (className == null || className.length() == 0) {
- editResourceUtil.replaceInEditor("<class>Component</class>",
- "<class></class>");
- } else {
- editResourceUtil.replaceInEditor("Component", packageName + "." +
className);
- }
-
- }
-
- /**
- * Methods creates beans.xml with decorator tags in it for entered project.
- * Package and decorator component name which should be showed in tag is
- * determined by parameters. If className is null, then Component text will be
- * removed
- * @param projectName
- * @param packageName
- * @param className
- */
- public void createBeansXMLWithDecorator(String projectName, String packageName,
- String className) {
-
- createBeansXMLWithContent(projectName, BEANS_XML_WITH_DECORATOR);
- if (className == null || className.length() == 0) {
- editResourceUtil.replaceInEditor("<class>Component</class>",
- "<class></class>");
- } else {
- editResourceUtil.replaceInEditor("Component", packageName + "." +
className);
- }
-
- }
-
- /**
- * Methods creates beans.xml with stereotype tags in it for entered project.
- * Package and stereotype component name which should be showed in tag is
- * determined by parameters. If className is null, then Component text will be
- * removed
- * @param projectName
- * @param packageName
- * @param className
- */
- public void createBeansXMLWithStereotype(String projectName, String packageName,
- String className) {
-
- createBeansXMLWithContent(projectName, BEANS_XML_WITH_STEREOTYPE);
- if (className == null || className.length() == 0) {
- editResourceUtil.replaceInEditor("<stereotype>Component</stereotype>",
- "<stereotype></stereotype>");
- } else {
- editResourceUtil.replaceInEditor("Component", packageName + "." +
className);
- }
-
- }
-
- /**
- * Methods creates beans.xml with alternative tags in it for entered project.
- * Package and alternative bean component name which should be showed in tag is
- * determined by parameters. If className is null, then Component text will be
- * removed
- * @param projectName
- * @param packageName
- * @param className
- */
- public void createBeansXMLWithAlternative(String projectName, String packageName,
- String className) {
-
- createBeansXMLWithContent(projectName, BEANS_XML_WITH_ALTERNATIVE);
- if (className == null || className.length() == 0) {
- editResourceUtil.replaceInEditor("<class>Component</class>",
- "<class></class>");
- } else {
- editResourceUtil.replaceInEditor("Component", packageName + "." +
className);
- }
- }
-
- /**
- * Methods create beans.xml for entered project with content of file
- * determined by parameter path. If there is beans.xml in project, its
- * content is simply replaced
- * @param projectName
- * @param path
- */
- private void createBeansXMLWithContent(String projectName, String path) {
-
- if (!projectExplorer.isFilePresent(projectName,
- "WebContent/META-INF/beans.xml".split("/")) &&
- !projectExplorer.isFilePresent(projectName,
- "WebContent/WEB-INF/beans.xml".split("/"))) {
- wizard.createCDIComponent(CDIWizardType.BEANS_XML, null,
- projectName + "/WebContent/WEB-INF", null);
- }
- if (!projectExplorer.isFilePresent(projectName,
- "WebContent/META-INF/beans.xml".split("/"))) {
- projectExplorer.openFile(projectName,
"WebContent/WEB-INF/beans.xml".split("/"));
- }else {
- projectExplorer.openFile(projectName,
"WebContent/META-INF/beans.xml".split("/"));
- }
- bot.cTabItem("Source").activate();
- setEd(bot.activeEditor().toTextEditor());
- editResourceUtil.replaceClassContentByResource(OpenOnTest.class
- .getResourceAsStream(path),
- false);
- bot.sleep(Timing.time500MS());
- }
-
-}
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/CDIProjectHelper.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/CDIProjectHelper.java 2012-01-24
10:42:38 UTC (rev 38081)
+++
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/CDIProjectHelper.java 2012-01-24
10:47:26 UTC (rev 38082)
@@ -16,6 +16,7 @@
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
import org.jboss.tools.cdi.bot.test.CDIBase;
+import org.jboss.tools.cdi.bot.test.CDIConstants;
import org.jboss.tools.cdi.bot.test.uiutils.actions.NewFileWizardAction;
import org.jboss.tools.cdi.bot.test.uiutils.wizards.DynamicWebProjectWizard;
import org.jboss.tools.ui.bot.ext.Timing;
@@ -23,16 +24,6 @@
public class CDIProjectHelper extends CDIBase{
- private final String CDI_WEB_PROJECT = "CDI Web Project";
- private final String CDI_GROUP = "CDI (Context and Dependency Injection)";
- private final String WEB_GROUP = "Web";
- private final String DYNAMIC_WEB_PROJECT = "Dynamic Web Project";
- private final String CONFIGURE = "Configure";
- private final String ADD_CDI_SUPPORT = "Add CDI (Context and Dependency Injection)
support...";
- private final String PROPERTIES = "Properties";
- private final String CDI_PROPERTIES_SETTINGS = "CDI (Context and Dependency
Injection) Settings";
-
-
/**
* Method creates new CDI Project with CDI Web Project wizard
* @param projectName
@@ -40,9 +31,11 @@
public void createCDIProjectWithCDIWizard(String projectName) {
new NewFileWizardAction().run()
- .selectTemplate(CDI_GROUP, CDI_WEB_PROJECT).next();
- new DynamicWebProjectWizard().setProjectName(projectName).finish();
- util.waitForNonIgnoredJobs();
+ .selectTemplate(CDIConstants.CDI_GROUP, CDIConstants.CDI_WEB_PROJECT).next();
+ new DynamicWebProjectWizard().setProjectName(projectName).finish();
+ bot.sleep(Timing.time5S());
+ util.waitForNonIgnoredJobs();
+ bot.sleep(Timing.time5S());
}
/**
@@ -61,7 +54,7 @@
*/
public void createDynamicWebProjectWithCDIPreset(String projectName) {
new NewFileWizardAction().run()
- .selectTemplate(WEB_GROUP, DYNAMIC_WEB_PROJECT).next();
+ .selectTemplate(CDIConstants.WEB_GROUP, CDIConstants.DYNAMIC_WEB_PROJECT).next();
new DynamicWebProjectWizard().setProjectName(projectName).setCDIPreset().finish();
util.waitForNonIgnoredJobs();
}
@@ -72,7 +65,7 @@
*/
public void createDynamicWebProjectWithCDIFacets(String projectName) {
new NewFileWizardAction().run()
- .selectTemplate(WEB_GROUP, DYNAMIC_WEB_PROJECT).next();
+ .selectTemplate(CDIConstants.WEB_GROUP, CDIConstants.DYNAMIC_WEB_PROJECT).next();
new DynamicWebProjectWizard().setProjectName(projectName).setCDIFacet().finish();
bot.sleep(Timing.time5S());
util.waitForNonIgnoredJobs();
@@ -100,7 +93,7 @@
*/
private void createDynamicWebProject(String projectName) {
new NewFileWizardAction().run()
- .selectTemplate(WEB_GROUP, DYNAMIC_WEB_PROJECT).next();
+ .selectTemplate(CDIConstants.WEB_GROUP, CDIConstants.DYNAMIC_WEB_PROJECT).next();
new DynamicWebProjectWizard().setProjectName(projectName).finish();
util.waitForNonIgnoredJobs();
}
@@ -114,7 +107,8 @@
SWTBotTree tree = projectExplorer.bot().tree();
SWTBotTreeItem item = tree.getTreeItem(projectName);
item.expand();
- NodeContextUtil.nodeContextMenu(tree, item, CONFIGURE, ADD_CDI_SUPPORT).click();
+ NodeContextUtil.nodeContextMenu(tree, item, CDIConstants.CONFIGURE,
+ CDIConstants.ADD_CDI_SUPPORT).click();
bot.activeShell().bot().button("OK").click();
bot.sleep(Timing.time2S());
util.waitForNonIgnoredJobs();
@@ -130,9 +124,9 @@
SWTBotTree tree = projectExplorer.bot().tree();
ContextMenuHelper.prepareTreeItemForContextMenu(tree);
- new SWTBotMenu(ContextMenuHelper.getContextMenu(tree,PROPERTIES,false)).click();
+ new
SWTBotMenu(ContextMenuHelper.getContextMenu(tree,CDIConstants.PROPERTIES,false)).click();
- bot.tree().expandNode(CDI_PROPERTIES_SETTINGS).select();
+ bot.tree().expandNode(CDIConstants.CDI_PROPERTIES_SETTINGS).select();
boolean isCDISupported = bot.checkBox().isChecked();
bot.button("Cancel").click();
return isCDISupported;
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/EditorResourceHelper.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/EditorResourceHelper.java 2012-01-24
10:42:38 UTC (rev 38081)
+++
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/EditorResourceHelper.java 2012-01-24
10:47:26 UTC (rev 38082)
@@ -185,7 +185,7 @@
SWTBotTreeItem item = projectExplorer.selectTreeItem(folderName, path);
NodeContextUtil.nodeContextMenu(tree, item, "Delete").click();
- bot.sleep(Timing.time1S());
+ bot.sleep(Timing.time3S());
bot.shell("Confirm Delete").bot().button("OK").click();
}
@@ -205,7 +205,7 @@
bot.button("OK").click();
- bot.sleep(Timing.time2S());
+ bot.sleep(Timing.time3S());
}
/**
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/LibraryHelper.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/LibraryHelper.java 2012-01-24
10:42:38 UTC (rev 38081)
+++
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/LibraryHelper.java 2012-01-24
10:47:26 UTC (rev 38082)
@@ -23,6 +23,7 @@
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
import org.jboss.tools.cdi.bot.test.CDIBase;
+import org.jboss.tools.cdi.bot.test.CDIConstants;
import org.jboss.tools.cdi.bot.test.PluginActivator;
import org.jboss.tools.ui.bot.ext.SWTUtilExt;
import org.jboss.tools.ui.bot.ext.Timing;
@@ -41,14 +42,14 @@
SWTBotTree tree = projectExplorer.bot().tree();
ContextMenuHelper.prepareTreeItemForContextMenu(tree);
- new
SWTBotMenu(ContextMenuHelper.getContextMenu(tree,"Refresh",false)).click();
+ new
SWTBotMenu(ContextMenuHelper.getContextMenu(tree,CDIConstants.REFRESH,false)).click();
ContextMenuHelper.prepareTreeItemForContextMenu(tree);
- new
SWTBotMenu(ContextMenuHelper.getContextMenu(tree,"Properties",false)).click();
+ new
SWTBotMenu(ContextMenuHelper.getContextMenu(tree,CDIConstants.PROPERTIES,false)).click();
- bot.tree().expandNode("Java Build Path").select();
- bot.tabItem("Libraries").activate();
- bot.button("Add JARs...").click();
+ bot.tree().expandNode(CDIConstants.JAVA_BUILD_PATH).select();
+ bot.tabItem(CDIConstants.LIBRARIES).activate();
+ bot.button(CDIConstants.ADD_JARS).click();
bot.sleep(Timing.time500MS());
String file = libraryName;
bot.tree().expandNode(projectName).expandNode(file).select();
@@ -97,14 +98,14 @@
SWTBotTree tree = projectExplorer.bot().tree();
ContextMenuHelper.prepareTreeItemForContextMenu(tree);
- new
SWTBotMenu(ContextMenuHelper.getContextMenu(tree,"Properties",false)).click();
+ new SWTBotMenu(ContextMenuHelper.getContextMenu(tree, CDIConstants.PROPERTIES,
false)).click();
SWTBotShell shell = bot.shell("Properties for " + projectName);
SWTBot bot = shell.bot();
- bot.tree().expandNode("Java Build Path").select();
+ bot.tree().expandNode(CDIConstants.JAVA_BUILD_PATH).select();
- bot.tabItem("Libraries").activate();
+ bot.tabItem(CDIConstants.LIBRARIES).activate();
boolean libraryInProject = false;
for (int i = 0; i < bot.tree(1).rowCount(); i++) {
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/OpenOnHelper.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/OpenOnHelper.java 2012-01-24
10:42:38 UTC (rev 38081)
+++
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/OpenOnHelper.java 2012-01-24
10:47:26 UTC (rev 38082)
@@ -16,6 +16,7 @@
import org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTable;
import org.jboss.tools.cdi.bot.test.CDIBase;
+import org.jboss.tools.cdi.bot.test.CDIConstants;
import org.jboss.tools.ui.bot.ext.SWTJBTExt;
import org.jboss.tools.ui.bot.ext.Timing;
@@ -32,9 +33,9 @@
*/
public void openOnByOption(String openOnString, String titleName, String chosenOption)
{
selectTextForOpenOn(openOnString, titleName);
- SWTBotMenu navigateMenu = bot.menu("Navigate");
+ SWTBotMenu navigateMenu = bot.menu(CDIConstants.NAVIGATE);
bot.sleep(Timing.time500MS());
- navigateMenu.menu("Open Hyperlink").click();
+ navigateMenu.menu(CDIConstants.OPEN_HYPERLINK).click();
bot.sleep(Timing.time500MS());
SWTBotTable table = bot.activeShell().bot().table(0);
for (int i = 0; i < table.rowCount(); i++) {
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/QuickFixHelper.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/QuickFixHelper.java 2012-01-24
10:42:38 UTC (rev 38081)
+++
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/QuickFixHelper.java 2012-01-24
10:47:26 UTC (rev 38082)
@@ -12,6 +12,7 @@
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
import org.jboss.tools.cdi.bot.test.CDIBase;
+import org.jboss.tools.cdi.bot.test.CDIConstants;
import org.jboss.tools.cdi.bot.test.annotations.ProblemsType;
import org.jboss.tools.ui.bot.ext.view.ProblemsView;
@@ -22,7 +23,7 @@
* @param item
*/
public void openQuickFix(SWTBotTreeItem item) {
- NodeContextUtil.nodeContextMenu(bot.tree(), item, "Quick Fix").click();
+ NodeContextUtil.nodeContextMenu(bot.tree(), item, CDIConstants.QUICK_FIX).click();
}
/**
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/SWTEclipseCDIExtUtil.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/SWTEclipseCDIExtUtil.java 2012-01-24
10:42:38 UTC (rev 38081)
+++
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/SWTEclipseCDIExtUtil.java 2012-01-24
10:47:26 UTC (rev 38082)
@@ -12,6 +12,7 @@
import org.eclipse.swtbot.swt.finder.widgets.SWTBotCheckBox;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
+import org.jboss.tools.cdi.bot.test.CDIConstants;
import org.jboss.tools.ui.bot.ext.SWTBotExt;
import org.jboss.tools.ui.bot.ext.SWTEclipseExt;
import org.jboss.tools.ui.bot.ext.SWTUtilExt;
@@ -43,8 +44,8 @@
private static void editFolding(SWTBotExt bot, SWTUtilExt util,
boolean select) {
- bot.menu("Window").menu("Preferences").click();
- bot.shell("Preferences").activate();
+ bot.menu(CDIConstants.WINDOW).menu(CDIConstants.PREFERENCES).click();
+ bot.shell(CDIConstants.PREFERENCES).activate();
SWTBotTreeItem item = bot.tree(0).expandNode("Java", "Editor");
item.select("Folding");
SWTBotCheckBox foldCheckBox = bot.checkBox("Enable folding");
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/actions/NewCDIFileWizard.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/actions/NewCDIFileWizard.java 2012-01-24
10:42:38 UTC (rev 38081)
+++
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/actions/NewCDIFileWizard.java 2012-01-24
10:47:26 UTC (rev 38082)
@@ -11,6 +11,7 @@
package org.jboss.tools.cdi.bot.test.uiutils.actions;
+import org.jboss.tools.cdi.bot.test.CDIConstants;
import org.jboss.tools.cdi.bot.test.annotations.CDIWizardType;
import org.jboss.tools.cdi.bot.test.uiutils.wizards.CDIWizardBase;
import org.jboss.tools.cdi.bot.test.uiutils.wizards.Wizard;
@@ -27,7 +28,7 @@
@Override
public CDIWizardBase run() {
Wizard w = super.run();
- w.selectTemplate("CDI (Context and Dependency Injection)",
type.getAnnotationType());
+ w.selectTemplate(CDIConstants.CDI_GROUP, type.getAnnotationType());
w.next();
return new CDIWizardBase(type);
}
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/wizards/DynamicWebProjectWizard.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/wizards/DynamicWebProjectWizard.java 2012-01-24
10:42:38 UTC (rev 38081)
+++
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/wizards/DynamicWebProjectWizard.java 2012-01-24
10:47:26 UTC (rev 38082)
@@ -16,16 +16,12 @@
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.CDIConstants;
import org.jboss.tools.ui.bot.ext.Timing;
public class DynamicWebProjectWizard extends Wizard {
private final String PROJECT_NAME = "Project name:";
- private final String CDI_PRESET = "Dynamic Web Project " +
- "with CDI (Context and Dependency Injection)";
- private final String CDI_FACET = "CDI (Contexts and Dependency Injection)";
- private final String CONFIGURATION = "Configuration";
- private final String PROJECT_FACETS = "Project Facets";
public DynamicWebProjectWizard() {
super(new SWTBot().activeShell().widget);
@@ -38,8 +34,8 @@
}
public DynamicWebProjectWizard setCDIPreset() {
- bot().comboBoxInGroup(CONFIGURATION, 0).
- setSelection(CDI_PRESET);
+ bot().comboBoxInGroup(CDIConstants.CONFIGURATION, 0).
+ setSelection(CDIConstants.CDI_PRESET);
return this;
}
@@ -51,11 +47,11 @@
}
private void setCDIFacetInFacets(SWTBot bot) {
- assertTrue(bot.activeShell().getText().equals(PROJECT_FACETS));
+ assertTrue(bot.activeShell().getText().equals(CDIConstants.PROJECT_FACETS));
SWTBot facetsBot = bot.activeShell().bot();
SWTBotTree tree= facetsBot.tree();
for (SWTBotTreeItem ti: tree.getAllItems()) {
- if (ti.cell(0).contains(CDI_FACET)) {
+ if (ti.cell(0).contains(CDIConstants.CDI_FACET)) {
ti.check();
break;
}
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/wizards/QuickFixDialogWizard.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/wizards/QuickFixDialogWizard.java 2012-01-24
10:42:38 UTC (rev 38081)
+++
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/wizards/QuickFixDialogWizard.java 2012-01-24
10:47:26 UTC (rev 38082)
@@ -15,10 +15,11 @@
import java.util.List;
import org.eclipse.swtbot.swt.finder.SWTBot;
+import org.jboss.tools.cdi.bot.test.CDIConstants;
public class QuickFixDialogWizard extends Wizard {
- private static final String QUICK_FIX_TITLE = "Quick Fix";
+ private static final String QUICK_FIX_TITLE = CDIConstants.QUICK_FIX;
private List<String> availableFixes = null;
private List<String> resources = null;
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/wizards/SearchNamedDialogWizard.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/wizards/SearchNamedDialogWizard.java 2012-01-24
10:42:38 UTC (rev 38081)
+++
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/wizards/SearchNamedDialogWizard.java 2012-01-24
10:47:26 UTC (rev 38082)
@@ -15,16 +15,16 @@
import java.util.List;
import org.eclipse.swtbot.swt.finder.SWTBot;
+import org.jboss.tools.cdi.bot.test.CDIConstants;
import org.jboss.tools.ui.bot.ext.Timing;
public class SearchNamedDialogWizard extends Wizard {
- private static final String NAMED_SEARCH_TITLE = "Open CDI Named Bean";
private List<String> matchingItems = null;
public SearchNamedDialogWizard() {
super(new SWTBot().activeShell().widget);
- assert (NAMED_SEARCH_TITLE).equals(getText());
+ assert (CDIConstants.OPEN_CDI_NAMED_BEANS).equals(getText());
matchingItems = new ArrayList<String>();
}
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/wizard/FacetTest.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/wizard/FacetTest.java 2012-01-24
10:42:38 UTC (rev 38081)
+++
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/wizard/FacetTest.java 2012-01-24
10:47:26 UTC (rev 38082)
@@ -12,6 +12,7 @@
package org.jboss.tools.cdi.bot.test.wizard;
import org.jboss.tools.cdi.bot.test.CDIAllBotTests;
+import org.jboss.tools.cdi.bot.test.CDIConstants;
import org.jboss.tools.cdi.bot.test.CDISmokeBotTests;
import org.jboss.tools.cdi.bot.test.CDITestBase;
import org.junit.Test;
@@ -43,7 +44,8 @@
if (projectHelper.projectExists(getProjectName())) {
LOGGER.info("Dynamic Web Project with CDI Facet created");
assertTrue("Error: beans.xml should be created when selecting CDI Facet",
- projectExplorer.isFilePresent(getProjectName(),
"WebContent/WEB-INF/beans.xml".split("/")));
+ projectExplorer.isFilePresent(getProjectName(),
+ CDIConstants.WEB_INF_BEANS_XML_PATH.split("/")));
} else {
fail("CDI project was not succesfully created with Dynamic Web Project wizard
with CDI facet");
}