Author: dazarov
Date: 2008-02-19 07:02:07 -0500 (Tue, 19 Feb 2008)
New Revision: 6416
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/OpenSeamComponentDialog.java
trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/SeamUiAllTests.java
trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/wizard/OpenSeamComponentDialogTest.java
Log:
http://jira.jboss.com/jira/browse/JBIDE-518
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/OpenSeamComponentDialog.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/OpenSeamComponentDialog.java 2008-02-19
11:12:48 UTC (rev 6415)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/OpenSeamComponentDialog.java 2008-02-19
12:02:07 UTC (rev 6416)
@@ -63,6 +63,18 @@
if (memento != null)
getSelectionHistory().load(memento);
}
+
+ public void beginTest(){
+ create();
+ applyFilter();
+ }
+
+ public void endTest(){
+ refresh();
+ computeResult();
+ setResult(getSelectedItems().toList());
+ okPressed();
+ }
protected Control createExtendedContentArea(Composite parent) {
return null;
@@ -75,7 +87,7 @@
protected void fillContentProvider(AbstractContentProvider contentProvider,
ItemsFilter itemsFilter, IProgressMonitor progressMonitor)
throws CoreException {
-
+
IProject[] projects = ResourcesPlugin.getWorkspace().getRoot()
.getProjects();
Modified:
trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/SeamUiAllTests.java
===================================================================
---
trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/SeamUiAllTests.java 2008-02-19
11:12:48 UTC (rev 6415)
+++
trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/SeamUiAllTests.java 2008-02-19
12:02:07 UTC (rev 6416)
@@ -14,14 +14,13 @@
import junit.framework.Test;
import junit.framework.TestSuite;
-import org.jboss.tools.seam.ui.test.preferences.SeamPreferencesPageTest;
import org.jboss.tools.seam.ui.test.ca.SeamELContentAssistJbide1645Test;
import org.jboss.tools.seam.ui.test.ca.SeamELContentAssistJbide1676Test;
import org.jboss.tools.seam.ui.test.ca.SeamELContentAssistTest;
import org.jboss.tools.seam.ui.test.hyperlink.SeamViewHyperlinkPartitionerTest;
+import org.jboss.tools.seam.ui.test.preferences.SeamPreferencesPageTest;
import org.jboss.tools.seam.ui.test.view.SeamComponentsViewAllTests;
-import org.jboss.tools.seam.ui.test.view.SeamComponentsViewTest;
-import org.jboss.tools.seam.ui.test.view.SeamComponentsViewTestSetup;
+import org.jboss.tools.seam.ui.test.wizard.OpenSeamComponentDialogTest;
import org.jboss.tools.seam.ui.test.wizard.SeamFormNewWizardTest;
import org.jboss.tools.seam.ui.test.wizard.SeamProjectNewWizardTest;
@@ -33,6 +32,7 @@
public static Test suite() {
TestSuite suite = new TestSuite("Seam UI tests");
+ suite.addTestSuite(OpenSeamComponentDialogTest.class);
suite.addTest(SeamComponentsViewAllTests.suite());
suite.addTestSuite(SeamProjectNewWizardTest.class);
suite.addTestSuite(SeamFormNewWizardTest.class);
Modified:
trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/wizard/OpenSeamComponentDialogTest.java
===================================================================
---
trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/wizard/OpenSeamComponentDialogTest.java 2008-02-19
11:12:48 UTC (rev 6415)
+++
trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/wizard/OpenSeamComponentDialogTest.java 2008-02-19
12:02:07 UTC (rev 6416)
@@ -2,18 +2,71 @@
import junit.framework.TestCase;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IncrementalProjectBuilder;
+import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.ui.PlatformUI;
import org.jboss.tools.seam.ui.wizard.OpenSeamComponentDialog;
+import org.jboss.tools.seam.ui.wizard.OpenSeamComponentDialog.SeamComponentWrapper;
+import org.jboss.tools.test.util.ProjectImportTestSetup;
+import org.jboss.tools.test.util.xpl.EditorTestHelper;
/**
* @author Daniel Azarov
*
*/
public class OpenSeamComponentDialogTest extends TestCase{
+ private IProject project;
- public void testOpenSeamComponentDialogIsCreated() {
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ project =
(IProject)ResourcesPlugin.getWorkspace().getRoot().findMember("TestComponentView");
+ if(project == null) {
+ ProjectImportTestSetup setup = new ProjectImportTestSetup(
+ this,
+ "org.jboss.tools.seam.ui.test",
+ "projects/TestComponentView",
+ "TestComponentView");
+ project = setup.importProject();
+ }
+ this.project = project.getProject();
+ this.project.build(IncrementalProjectBuilder.FULL_BUILD, null);
+
+ EditorTestHelper.joinBackgroundActivities();
+ }
+
+ public void testOpenSeamComponentDialogSearch() {
+
+ find("m","mockSecureEntity");
+ find("o","org.jboss.seam.captcha.captcha");
+ find("p","package1.package2.package3.package4.myComponent");
+
+ }
+
+ private void find(String pattern, String componentName){
OpenSeamComponentDialog dialog = new OpenSeamComponentDialog(
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell());
- dialog.open();
+
+ dialog.setInitialPattern(pattern);
+ dialog.beginTest();
+ try{
+ Thread.sleep(30000);
+ }catch(Exception ex){
+ ex.printStackTrace();
+ }
+ dialog.endTest();
+ Object[] objects = dialog.getResult();
+
+
+ assertNotNull("Component "+componentName+"not found", objects);
+
+ assertTrue("Component "+componentName+"not found", objects.length
!= 0);
+
+ SeamComponentWrapper wrapper = (SeamComponentWrapper)objects[0];
+
+ assertTrue("Component "+componentName+"not found",
wrapper.getComponentName().equals(componentName));
}
+
}