Author: jjankovi
Date: 2011-12-07 11:30:48 -0500 (Wed, 07 Dec 2011)
New Revision: 37064
Added:
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/decorator/
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/named/
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
Removed:
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/jsf/NamedRefactoringTest.java
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/beansxml/BeansXMLValidationTest.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/editor/BeansEditorTest.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/injection/ProblemEligibleInjectionTest.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/NodeContextUtil.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/WizardTest.java
Log:
NamedComponentSearchingTest added
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/CDIAllBotTests.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/CDIAllBotTests.java 2011-12-07
15:46:43 UTC (rev 37063)
+++
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/CDIAllBotTests.java 2011-12-07
16:30:48 UTC (rev 37064)
@@ -13,7 +13,8 @@
import org.jboss.tools.cdi.bot.test.beansxml.BeansXMLCompletionTest;
import org.jboss.tools.cdi.bot.test.beansxml.BeansXMLValidationTest;
import org.jboss.tools.cdi.bot.test.editor.BeansEditorTest;
-import org.jboss.tools.cdi.bot.test.jsf.NamedRefactoringTest;
+import org.jboss.tools.cdi.bot.test.named.NamedComponentsSearchingTest;
+import org.jboss.tools.cdi.bot.test.named.NamedRefactoringTest;
import org.jboss.tools.cdi.bot.test.openon.FindObserverForEventTest;
import org.jboss.tools.cdi.bot.test.openon.OpenOnTest;
import org.jboss.tools.cdi.bot.test.quickfix.injection.ProblemEligibleInjectionTest;
@@ -64,7 +65,8 @@
FacetTest.class,
WizardTest.class,
BeansEditorTest.class,
- NamedRefactoringTest.class,
+ NamedRefactoringTest.class,
+ NamedComponentsSearchingTest.class,
BeansXMLValidationTest.class,
BeansXMLCompletionTest.class,
ProblemEligibleInjectionTest.class,
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 2011-12-07
15:46:43 UTC (rev 37063)
+++
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/beansxml/BeansXMLValidationTest.java 2011-12-07
16:30:48 UTC (rev 37064)
@@ -25,8 +25,7 @@
import org.junit.runners.Suite.SuiteClasses;
/**
- * Test operates on beans validation in config file
- * beans.xml
+ * Test operates on beans validation in beans.xml
*
* @author Jaroslav Jankovic
*
Added:
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
(rev 0)
+++
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/decorator/DecoratorCreatingTest.java 2011-12-07
16:30:48 UTC (rev 37064)
@@ -0,0 +1,35 @@
+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
+ *
+ * @author Jaroslav Jankovic
+ *
+ */
+
+@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
+
+ @Override
+ public String getProjectName() {
+ return "CDIDecoratorCreating";
+ }
+
+
+
+}
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/editor/BeansEditorTest.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/editor/BeansEditorTest.java 2011-12-07
15:46:43 UTC (rev 37063)
+++
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/editor/BeansEditorTest.java 2011-12-07
16:30:48 UTC (rev 37064)
@@ -42,6 +42,7 @@
import org.xml.sax.SAXException;
/**
+ * Test checks if Bean Editor works properly
* prerequisite - CDIAtWizardTest!!!
*
*
Deleted:
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/jsf/NamedRefactoringTest.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/jsf/NamedRefactoringTest.java 2011-12-07
15:46:43 UTC (rev 37063)
+++
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/jsf/NamedRefactoringTest.java 2011-12-07
16:30:48 UTC (rev 37064)
@@ -1,164 +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.jsf;
-
-import java.util.Arrays;
-import java.util.Collection;
-
-import org.jboss.tools.cdi.bot.test.CDIAllBotTests;
-import org.jboss.tools.cdi.bot.test.annotations.CDIWizardType;
-import org.jboss.tools.cdi.bot.test.uiutils.CollectionsUtil;
-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.After;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite.SuiteClasses;
-
-/**
- * Test operates on @Named refactoring
- *
- * @author Jaroslav Jankovic
- *
- */
-@Require(clearProjects = true, perspective = "Java EE",
- server = @Server(state = ServerState.NotRunning,
- version = "6.0", operator = ">="))
-(a)RunWith(RequirementAwareSuite.class)
-@SuiteClasses({ CDIAllBotTests.class })
-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";
-
- @Override
- public String getProjectName() {
- return "CDIRefactoring";
- }
-
- @After
- public void waitForJobs() {
- editResourceUtil.deletePackage(getProjectName(), getPackageName());
- editResourceUtil.deleteWebFolder(getProjectName(), WEB_FOLDER);
- util.waitForNonIgnoredJobs();
- }
-
- @Test
- public void testNamedAnnotationWithParamRefactor() {
-
- wizard.createCDIComponentWithContent(CDIWizardType.BEAN, MANAGED_BEAN_1,
- getPackageName(), null,
"/resources/jsf/ManagedBeanParamNamed.java.cdi");
-
- createXHTMLPageWithContent(INDEX_XHTML_1,
"/resources/jsf/index1.xhtml.cdi");
- createXHTMLPageWithContent(INDEX_XHTML_3,
"/resources/jsf/index3.xhtml.cdi");
-
- bot.editorByTitle(MANAGED_BEAN_1 + ".java").show();
- setEd(bot.activeEditor().toTextEditor());
-
- Collection<String> affectedFiles = changeNamedAnnotation(MANAGED_BEAN_1,
- NEW_NAMED_PARAM);
- Collection<String> expectedAffectedFiles = Arrays.asList(
- MANAGED_BEAN_1 + ".java", INDEX_XHTML_1, INDEX_XHTML_3);
-
- for (String affectedFile : affectedFiles) {
- bot.editorByTitle(affectedFile).save();
- }
-
- assertEquals(expectedAffectedFiles.size(), affectedFiles.size());
- assertTrue(CollectionsUtil.compareTwoCollectionsEquality(
- expectedAffectedFiles, affectedFiles));
-
- assertTrue(bot.editorByTitle(MANAGED_BEAN_1 +
".java").toTextEditor().getText().
- contains("@Named(\"" + NEW_NAMED_PARAM + "\""));
-
- assertTrue(bot.editorByTitle(INDEX_XHTML_1).toTextEditor().getText().
- contains("#{" + NEW_NAMED_PARAM));
-
- assertTrue(bot.editorByTitle(INDEX_XHTML_3).toTextEditor().getText().
- contains("#{" + NEW_NAMED_PARAM));
-
- }
-
- @Test
- public void testNamedAnnotationWithoutParamRefactor() {
-
- wizard.createCDIComponentWithContent(CDIWizardType.BEAN, MANAGED_BEAN_2,
- getPackageName(), null,
"/resources/jsf/ManagedBeanNoParamNamed.java.cdi");
-
- createXHTMLPageWithContent(INDEX_XHTML_2,
"/resources/jsf/index2.xhtml.cdi");
- createXHTMLPageWithContent(INDEX_XHTML_3,
"/resources/jsf/index3.xhtml.cdi");
-
- bot.editorByTitle(MANAGED_BEAN_2 + ".java").show();
- setEd(bot.activeEditor().toTextEditor());
-
- Collection<String> affectedFiles = changeNamedAnnotation(MANAGED_BEAN_2,
NEW_NAMED_PARAM);
- Collection<String> expectedAffectedFiles = Arrays.asList(
- MANAGED_BEAN_2 + ".java", INDEX_XHTML_2, INDEX_XHTML_3);
-
- for (String affectedFile : affectedFiles) {
- bot.editorByTitle(affectedFile).save();
- }
-
- assertEquals(expectedAffectedFiles.size(), affectedFiles.size());
- assertTrue(CollectionsUtil.compareTwoCollectionsEquality(
- expectedAffectedFiles, affectedFiles));
-
- assertTrue(bot.editorByTitle(MANAGED_BEAN_2 +
".java").toTextEditor().getText().
- contains("@Named(\"" + NEW_NAMED_PARAM + "\""));
-
- assertTrue(bot.editorByTitle(INDEX_XHTML_2).toTextEditor().getText().
- contains("#{" + NEW_NAMED_PARAM));
-
- assertTrue(bot.editorByTitle(INDEX_XHTML_3).toTextEditor().getText().
- contains("#{" + NEW_NAMED_PARAM));
-
- }
-
- @Test
- public void testNamedAnnotationWithoutELRefactoring() {
-
- wizard.createCDIComponentWithContent(CDIWizardType.BEAN, MANAGED_BEAN_2,
- getPackageName(), null,
"/resources/jsf/ManagedBeanNoParamNamed.java.cdi");
-
- createXHTMLPageWithContent(INDEX_XHTML_2,
"/resources/jsf/index1.xhtml.cdi");
-
- bot.editorByTitle(MANAGED_BEAN_2 + ".java").show();
- setEd(bot.activeEditor().toTextEditor());
-
- Collection<String> affectedFiles = changeNamedAnnotation(MANAGED_BEAN_2,
NEW_NAMED_PARAM);
- Collection<String> expectedAffectedFiles = Arrays.asList(MANAGED_BEAN_2 +
".java");
-
- for (String affectedFile : affectedFiles) {
- bot.editorByTitle(affectedFile).save();
- }
-
- assertEquals(expectedAffectedFiles.size(), affectedFiles.size());
- assertTrue(CollectionsUtil.compareTwoCollectionsEquality(
- expectedAffectedFiles, affectedFiles));
-
- assertTrue(bot.editorByTitle(MANAGED_BEAN_2 +
".java").toTextEditor().getText().
- contains("@Named(\"" + NEW_NAMED_PARAM + "\""));
-
- assertTrue(!bot.editorByTitle(INDEX_XHTML_2).toTextEditor().getText().
- contains("#{" + NEW_NAMED_PARAM));
-
- }
-
-
-
-}
Added:
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
(rev 0)
+++
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/named/NamedComponentsSearchingTest.java 2011-12-07
16:30:48 UTC (rev 37064)
@@ -0,0 +1,245 @@
+/*******************************************************************************
+ * 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.named;
+
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.jboss.tools.cdi.bot.test.CDIAllBotTests;
+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;
+import org.jboss.tools.cdi.bot.test.uiutils.wizards.SearchNamedDialogWizard;
+import org.jboss.tools.ui.bot.ext.RequirementAwareSuite;
+import org.jboss.tools.ui.bot.ext.Timing;
+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.After;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite.SuiteClasses;
+
+/**
+ * Test operates on @Named searching
+ *
+ * @author Jaroslav Jankovic
+ *
+ */
+@Require(clearProjects = true, perspective = "Java EE",
+ server = @Server(state = ServerState.NotRunning,
+ version = "6.0", operator = ">="))
+(a)RunWith(RequirementAwareSuite.class)
+@SuiteClasses({ CDIAllBotTests.class })
+public class NamedComponentsSearchingTest extends CDITestBase {
+
+ private final CDIWizardBaseExt wizardExt = new CDIWizardBaseExt();
+ private final String beanName = "Bean1";
+ private final String stereotypeName = "Stereotype1";
+ private static SearchNamedDialogWizard namedDialog = null;
+
+ @Override
+ public String getProjectName() {
+ return "CDINamedSearching";
+ }
+
+ @After
+ public void waitForJobs() {
+ editResourceUtil.deletePackage(getProjectName(), getPackageName());
+ util.waitForNonIgnoredJobs();
+ }
+
+ @Test
+ public void testSearchDefaultNamedBean() {
+
+ wizardExt.bean(getPackageName(), beanName, true, false, false,
+ false, false, false, "", null, null, null).finish();
+
+ namedDialog = openSearchNamedDialog().setNamedPrefix(beanName);
+ assertTrue(namedDialog.matchingItems().size() == 1);
+ namedDialog.ok();
+ assertTrue(bot.activeEditor().getTitle().equals(beanName + ".java"));
+ assertTrue(bot.activeEditor().toTextEditor().getSelection().equals(beanName));
+
+ }
+
+ @Test
+ public void testSearchNamedParameterBean() {
+
+ String namedParam = "someBean";
+
+ wizardExt.bean(getPackageName(), beanName, true, false, false,
+ false, false, false, namedParam, null, null, null).finish();
+
+ namedDialog = openSearchNamedDialog().setNamedPrefix(namedParam);
+ assertTrue(namedDialog.matchingItems().size() == 1);
+ namedDialog.ok();
+ assertTrue(bot.activeEditor().getTitle().equals(beanName + ".java"));
+ assertTrue(bot.activeEditor().toTextEditor().getSelection().equals(beanName));
+
+ }
+
+ @Test
+ public void testSearchNamedParameterChangeBean() {
+
+ String namedParam = "someBean";
+ String changedNamedParam = "someOtherBean";
+
+ wizardExt.bean(getPackageName(), beanName, true, false, false,
+ false, false, false, namedParam, null, null, null).finish();
+ setEd(bot.activeEditor().toTextEditor());
+
+ namedDialog = openSearchNamedDialog().setNamedPrefix(namedParam);
+ assertTrue(namedDialog.matchingItems().size() == 1);
+ namedDialog.ok();
+ assertTrue(bot.activeEditor().getTitle().equals(beanName + ".java"));
+ assertTrue(bot.activeEditor().toTextEditor().getSelection().equals(beanName));
+
+ editResourceUtil.replaceInEditor(namedParam, changedNamedParam);
+
+ namedDialog = openSearchNamedDialog().setNamedPrefix(namedParam);
+ assertTrue(namedDialog.matchingItems().size() == 0);
+ namedDialog = namedDialog.setNamedPrefix(changedNamedParam);
+ assertTrue(namedDialog.matchingItems().size() == 1);
+ namedDialog.ok();
+ assertTrue(bot.activeEditor().getTitle().equals(beanName + ".java"));
+ assertTrue(bot.activeEditor().toTextEditor().getSelection().equals(beanName));
+
+ }
+
+ @Test
+ public void testSearchTwoSameNamedBean() {
+
+ String beanName2 = "Bean2";
+ String namedParam = "someBean";
+
+ wizardExt.bean(getPackageName(), beanName, true, false, false,
+ false, false, false, namedParam, null, null, null).finish();
+ wizardExt.bean(getPackageName(), beanName2, true, false, false,
+ false, false, false, namedParam, null, null, null).finish();
+
+ namedDialog = openSearchNamedDialog().setNamedPrefix(namedParam);
+ List<String> matchingItems = namedDialog.matchingItems();
+ assertTrue(matchingItems.size() == 2);
+ for (String matchingItem : matchingItems) {
+ if (matchingItem.contains(beanName)) {
+ namedDialog.setMatchingItems(matchingItem);
+ break;
+ }
+ }
+ namedDialog.ok();
+ assertTrue(bot.activeEditor().getTitle().equals(beanName + ".java"));
+ assertTrue(bot.activeEditor().toTextEditor().getSelection().equals(beanName));
+
+ }
+
+ @Test
+ public void testSearchBeansWithSamePrefixNamedParam() {
+
+ String[] beansNames = {"SomeBean", "SomeBean1",
"SomeBean2", "SomeBean22", "SomeOtherBean"};
+
+ Map<String, Integer> prefixesWithCount = new LinkedHashMap<String,
Integer>();
+ prefixesWithCount.put(beansNames[0], 4);
+ prefixesWithCount.put(beansNames[1], 1);
+ prefixesWithCount.put(beansNames[2], 2);
+ prefixesWithCount.put(beansNames[3], 1);
+ prefixesWithCount.put("Some", 5);
+
+ for (String beanName : beansNames) {
+ wizardExt.bean(getPackageName(), beanName, true, false, false,
+ false, false, false, "", null, null, null).finish();
+ }
+
+ for (String prefix : prefixesWithCount.keySet()) {
+ namedDialog = openSearchNamedDialog().setNamedPrefix(prefix);
+ assertTrue(namedDialog.matchingItems().size() == prefixesWithCount.get(prefix));
+ namedDialog.cancel();
+ }
+
+ }
+
+ @Test
+ public void testSearchBeanWithStereotype() {
+
+ wizardExt.stereotype(getPackageName(), stereotypeName, null, null, false, true,
+ false, false, false).finish();
+
+ wizard.createCDIComponentWithContent(CDIWizardType.BEAN, beanName, getPackageName(),
+ null, "/resources/named/BeanWithStereotype.java.cdi");
+
+ namedDialog = openSearchNamedDialog().setNamedPrefix(beanName);
+ assertTrue(namedDialog.matchingItems().size() == 1);
+ namedDialog.ok();
+ assertTrue(bot.activeEditor().getTitle().equals(beanName + ".java"));
+ assertTrue(bot.activeEditor().toTextEditor().getSelection().equals(beanName));
+
+ }
+
+ @Test
+ public void testSearchBeanWithStereotypeAndNamedParam() {
+
+ String namedParam = "someBean";
+
+ wizardExt.stereotype(getPackageName(), stereotypeName, null, null, false, true,
+ false, false, false).finish();
+
+ wizard.createCDIComponentWithContent(CDIWizardType.BEAN, beanName, getPackageName(),
+ null, "/resources/named/BeanWithStereotypeAndNamed.java.cdi");
+
+ namedDialog = openSearchNamedDialog().setNamedPrefix(beanName);
+ assertTrue(namedDialog.matchingItems().size() == 0);
+ namedDialog = namedDialog.setNamedPrefix(namedParam);
+ assertTrue(namedDialog.matchingItems().size() == 1);
+ namedDialog.ok();
+ assertTrue(bot.activeEditor().getTitle().equals(beanName + ".java"));
+ assertTrue(bot.activeEditor().toTextEditor().getSelection().equals(beanName));
+ }
+
+ @Test
+ public void testSearchBeanWithStereotypeWithNamedParamChange() {
+
+ String namedParam = "someBean";
+ String changedNamedParam = "someOtherBean";
+
+ wizardExt.stereotype(getPackageName(), stereotypeName, null, null, false, true,
+ false, false, false).finish();
+
+ wizard.createCDIComponentWithContent(CDIWizardType.BEAN, beanName, getPackageName(),
+ null, "/resources/named/BeanWithStereotypeAndNamed.java.cdi");
+
+ namedDialog = openSearchNamedDialog().setNamedPrefix(beanName);
+ assertTrue(namedDialog.matchingItems().size() == 0);
+ namedDialog = namedDialog.setNamedPrefix(namedParam);
+ assertTrue(namedDialog.matchingItems().size() == 1);
+ namedDialog.ok();
+ assertTrue(bot.activeEditor().getTitle().equals(beanName + ".java"));
+ assertTrue(bot.activeEditor().toTextEditor().getSelection().equals(beanName));
+
+ editResourceUtil.replaceInEditor(namedParam, changedNamedParam);
+
+ namedDialog = openSearchNamedDialog().setNamedPrefix(namedParam);
+ assertTrue(namedDialog.matchingItems().size() == 0);
+ namedDialog = namedDialog.setNamedPrefix(changedNamedParam);
+ assertTrue(namedDialog.matchingItems().size() == 1);
+ namedDialog.ok();
+ assertTrue(bot.activeEditor().getTitle().equals(beanName + ".java"));
+ assertTrue(bot.activeEditor().toTextEditor().getSelection().equals(beanName));
+ }
+
+ private SearchNamedDialogWizard openSearchNamedDialog() {
+ bot.menu("Navigate").menu("Open CDI Named Bean").click();
+ bot.sleep(Timing.time500MS());
+ return new SearchNamedDialogWizard();
+ }
+
+}
Added:
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
(rev 0)
+++
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/named/NamedRefactoringTest.java 2011-12-07
16:30:48 UTC (rev 37064)
@@ -0,0 +1,165 @@
+/*******************************************************************************
+ * 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.named;
+
+import java.util.Arrays;
+import java.util.Collection;
+
+import org.jboss.tools.cdi.bot.test.CDIAllBotTests;
+import org.jboss.tools.cdi.bot.test.annotations.CDIWizardType;
+import org.jboss.tools.cdi.bot.test.jsf.JSFTestBase;
+import org.jboss.tools.cdi.bot.test.uiutils.CollectionsUtil;
+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.After;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite.SuiteClasses;
+
+/**
+ * Test operates on @Named refactoring
+ *
+ * @author Jaroslav Jankovic
+ *
+ */
+@Require(clearProjects = true, perspective = "Java EE",
+ server = @Server(state = ServerState.NotRunning,
+ version = "6.0", operator = ">="))
+(a)RunWith(RequirementAwareSuite.class)
+@SuiteClasses({ CDIAllBotTests.class })
+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";
+
+ @Override
+ public String getProjectName() {
+ return "CDIRefactoring";
+ }
+
+ @After
+ public void waitForJobs() {
+ editResourceUtil.deletePackage(getProjectName(), getPackageName());
+ editResourceUtil.deleteWebFolder(getProjectName(), WEB_FOLDER);
+ util.waitForNonIgnoredJobs();
+ }
+
+ @Test
+ public void testNamedAnnotationWithParamRefactor() {
+
+ wizard.createCDIComponentWithContent(CDIWizardType.BEAN, MANAGED_BEAN_1,
+ getPackageName(), null,
"/resources/jsf/ManagedBeanParamNamed.java.cdi");
+
+ createXHTMLPageWithContent(INDEX_XHTML_1,
"/resources/jsf/index1.xhtml.cdi");
+ createXHTMLPageWithContent(INDEX_XHTML_3,
"/resources/jsf/index3.xhtml.cdi");
+
+ bot.editorByTitle(MANAGED_BEAN_1 + ".java").show();
+ setEd(bot.activeEditor().toTextEditor());
+
+ Collection<String> affectedFiles = changeNamedAnnotation(MANAGED_BEAN_1,
+ NEW_NAMED_PARAM);
+ Collection<String> expectedAffectedFiles = Arrays.asList(
+ MANAGED_BEAN_1 + ".java", INDEX_XHTML_1, INDEX_XHTML_3);
+
+ for (String affectedFile : affectedFiles) {
+ bot.editorByTitle(affectedFile).save();
+ }
+
+ assertEquals(expectedAffectedFiles.size(), affectedFiles.size());
+ assertTrue(CollectionsUtil.compareTwoCollectionsEquality(
+ expectedAffectedFiles, affectedFiles));
+
+ assertTrue(bot.editorByTitle(MANAGED_BEAN_1 +
".java").toTextEditor().getText().
+ contains("@Named(\"" + NEW_NAMED_PARAM + "\""));
+
+ assertTrue(bot.editorByTitle(INDEX_XHTML_1).toTextEditor().getText().
+ contains("#{" + NEW_NAMED_PARAM));
+
+ assertTrue(bot.editorByTitle(INDEX_XHTML_3).toTextEditor().getText().
+ contains("#{" + NEW_NAMED_PARAM));
+
+ }
+
+ @Test
+ public void testNamedAnnotationWithoutParamRefactor() {
+
+ wizard.createCDIComponentWithContent(CDIWizardType.BEAN, MANAGED_BEAN_2,
+ getPackageName(), null,
"/resources/jsf/ManagedBeanNoParamNamed.java.cdi");
+
+ createXHTMLPageWithContent(INDEX_XHTML_2,
"/resources/jsf/index2.xhtml.cdi");
+ createXHTMLPageWithContent(INDEX_XHTML_3,
"/resources/jsf/index3.xhtml.cdi");
+
+ bot.editorByTitle(MANAGED_BEAN_2 + ".java").show();
+ setEd(bot.activeEditor().toTextEditor());
+
+ Collection<String> affectedFiles = changeNamedAnnotation(MANAGED_BEAN_2,
NEW_NAMED_PARAM);
+ Collection<String> expectedAffectedFiles = Arrays.asList(
+ MANAGED_BEAN_2 + ".java", INDEX_XHTML_2, INDEX_XHTML_3);
+
+ for (String affectedFile : affectedFiles) {
+ bot.editorByTitle(affectedFile).save();
+ }
+
+ assertEquals(expectedAffectedFiles.size(), affectedFiles.size());
+ assertTrue(CollectionsUtil.compareTwoCollectionsEquality(
+ expectedAffectedFiles, affectedFiles));
+
+ assertTrue(bot.editorByTitle(MANAGED_BEAN_2 +
".java").toTextEditor().getText().
+ contains("@Named(\"" + NEW_NAMED_PARAM + "\""));
+
+ assertTrue(bot.editorByTitle(INDEX_XHTML_2).toTextEditor().getText().
+ contains("#{" + NEW_NAMED_PARAM));
+
+ assertTrue(bot.editorByTitle(INDEX_XHTML_3).toTextEditor().getText().
+ contains("#{" + NEW_NAMED_PARAM));
+
+ }
+
+ @Test
+ public void testNamedAnnotationWithoutELRefactoring() {
+
+ wizard.createCDIComponentWithContent(CDIWizardType.BEAN, MANAGED_BEAN_2,
+ getPackageName(), null,
"/resources/jsf/ManagedBeanNoParamNamed.java.cdi");
+
+ createXHTMLPageWithContent(INDEX_XHTML_2,
"/resources/jsf/index1.xhtml.cdi");
+
+ bot.editorByTitle(MANAGED_BEAN_2 + ".java").show();
+ setEd(bot.activeEditor().toTextEditor());
+
+ Collection<String> affectedFiles = changeNamedAnnotation(MANAGED_BEAN_2,
NEW_NAMED_PARAM);
+ Collection<String> expectedAffectedFiles = Arrays.asList(MANAGED_BEAN_2 +
".java");
+
+ for (String affectedFile : affectedFiles) {
+ bot.editorByTitle(affectedFile).save();
+ }
+
+ assertEquals(expectedAffectedFiles.size(), affectedFiles.size());
+ assertTrue(CollectionsUtil.compareTwoCollectionsEquality(
+ expectedAffectedFiles, affectedFiles));
+
+ assertTrue(bot.editorByTitle(MANAGED_BEAN_2 +
".java").toTextEditor().getText().
+ contains("@Named(\"" + NEW_NAMED_PARAM + "\""));
+
+ assertTrue(!bot.editorByTitle(INDEX_XHTML_2).toTextEditor().getText().
+ contains("#{" + NEW_NAMED_PARAM));
+
+ }
+
+
+
+}
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 2011-12-07
15:46:43 UTC (rev 37063)
+++
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/injection/ProblemEligibleInjectionTest.java 2011-12-07
16:30:48 UTC (rev 37064)
@@ -23,6 +23,13 @@
import org.junit.runner.RunWith;
import org.junit.runners.Suite.SuiteClasses;
+/**
+ * Test checks if Quick Fix provides useful operations when
+ * ambiguous injection points
+ * @author jjankovi
+ *
+ */
+
@Require(clearProjects = true, perspective = "Java EE",
server = @Server(state = ServerState.NotRunning,
version = "6.0", operator = ">="))
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/NodeContextUtil.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/NodeContextUtil.java 2011-12-07
15:46:43 UTC (rev 37063)
+++
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/NodeContextUtil.java 2011-12-07
16:30:48 UTC (rev 37064)
@@ -39,6 +39,6 @@
return m;
}
});
- }
+ }
}
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 2011-12-07
15:46:43 UTC (rev 37063)
+++
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/wizards/SearchNamedDialogWizard.java 2011-12-07
16:30:48 UTC (rev 37064)
@@ -47,7 +47,9 @@
public List<String> matchingItems() {
int tableItemsCount = bot().table(0).rowCount();
for (int i = 0; i < tableItemsCount; i++) {
- matchingItems.add(bot().table(0).getTableItem(i).getText());
+ String itemInTable = bot().table(0).getTableItem(i).getText();
+ if (itemInTable.contains("Workspace matches")) continue;
+ matchingItems.add(itemInTable);
}
return matchingItems;
}
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/wizard/WizardTest.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/wizard/WizardTest.java 2011-12-07
15:46:43 UTC (rev 37063)
+++
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/wizard/WizardTest.java 2011-12-07
16:30:48 UTC (rev 37064)
@@ -32,6 +32,8 @@
import org.junit.runners.Suite.SuiteClasses;
/**
+ * Test checks all CDI components Wizards
+ *
* @author Lukas Jungmann
* @author jjankovi
*/