JBoss Tools SVN: r27629 - trunk/vpe/tests/org.jboss.tools.vpe.docbook.test/resources/DocbookTest/WebContent/pages/components/programlisting.
by jbosstools-commits@lists.jboss.org
Author: dvinnichek
Date: 2010-12-21 04:52:59 -0500 (Tue, 21 Dec 2010)
New Revision: 27629
Modified:
trunk/vpe/tests/org.jboss.tools.vpe.docbook.test/resources/DocbookTest/WebContent/pages/components/programlisting/programlisting.xml
trunk/vpe/tests/org.jboss.tools.vpe.docbook.test/resources/DocbookTest/WebContent/pages/components/programlisting/programlisting.xml.xml
Log:
fixed testProgramlisting() in DocbookAllTests
Modified: trunk/vpe/tests/org.jboss.tools.vpe.docbook.test/resources/DocbookTest/WebContent/pages/components/programlisting/programlisting.xml
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.docbook.test/resources/DocbookTest/WebContent/pages/components/programlisting/programlisting.xml 2010-12-21 09:30:55 UTC (rev 27628)
+++ trunk/vpe/tests/org.jboss.tools.vpe.docbook.test/resources/DocbookTest/WebContent/pages/components/programlisting/programlisting.xml 2010-12-21 09:52:59 UTC (rev 27629)
@@ -14,7 +14,12 @@
</programlisting>
<programlisting id="programlisting02">
- <![CDATA[
-<emphasis>tags</emphasis> &entities; "]".
- ]]>
+<![CDATA[
+This is a programlisting so white space and line
+breaks are significant. But it is also a CDATA
+section so <emphasis>tags</emphasis> and &entities;
+are not recognized. The only markup that is recognized
+is the end-of-section marker, which is two
+"]"'s in a row followed by a >.
+]]>
</programlisting>
Modified: trunk/vpe/tests/org.jboss.tools.vpe.docbook.test/resources/DocbookTest/WebContent/pages/components/programlisting/programlisting.xml.xml
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.docbook.test/resources/DocbookTest/WebContent/pages/components/programlisting/programlisting.xml.xml 2010-12-21 09:30:55 UTC (rev 27628)
+++ trunk/vpe/tests/org.jboss.tools.vpe.docbook.test/resources/DocbookTest/WebContent/pages/components/programlisting/programlisting.xml.xml 2010-12-21 09:52:59 UTC (rev 27629)
@@ -1,8 +1,8 @@
<tests>
<test id="programlisting01">
<PRE>
+ <SPAN/>
<SPAN>
- <SPAN>
(define (node-list-filter-by-gi nodelist gilist)
;; Returns the node-list that contains every element of the original
;; nodelist whose gi is in gilist
@@ -13,15 +13,20 @@
(loop (node-list result (node-list-first nl))
(node-list-rest nl))
(loop result (node-list-rest nl))))))
- </SPAN>
</SPAN>
</PRE>
</test>
<test id="programlisting02">
<PRE>
<SPAN/>
-<emphasis>tags</emphasis> &entities; "]".
+This is a programlisting so white space and line
+breaks are significant. But it is also a CDATA
+section so <emphasis>tags</emphasis> and &entities;
+are not recognized. The only markup that is recognized
+is the end-of-section marker, which is two
+"]"'s in a row followed by a >.
<SPAN/>
- </PRE>
+ <BR/>
+ </PRE>
</test>
</tests>
\ No newline at end of file
14 years
JBoss Tools SVN: r27628 - in trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot: testsuite and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: jpeterka
Date: 2010-12-21 04:30:55 -0500 (Tue, 21 Dec 2010)
New Revision: 27628
Modified:
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testcase/CodeGenerationLauncherTest.java
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testcase/ConfigurationContextTest.java
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testcase/ConfigurationFileTest.java
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testcase/ConsolePerspectiveTest.java
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testcase/ConsoleTest.java
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testcase/CriteriaEditorsTest.java
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testcase/DaliTest.java
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testcase/JIRATest.java
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testcase/MappingFileTest.java
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testcase/MappingsDiagramTest.java
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testcase/ReverseEngineerFileTest.java
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testcase/ViewsTest.java
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testsuite/HibernateAllTests.java
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testsuite/HibernateTest.java
Log:
Hibernate bot tests transfered to multi-db configurations
Modified: trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testcase/CodeGenerationLauncherTest.java
===================================================================
--- trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testcase/CodeGenerationLauncherTest.java 2010-12-21 09:19:27 UTC (rev 27627)
+++ trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testcase/CodeGenerationLauncherTest.java 2010-12-21 09:30:55 UTC (rev 27628)
@@ -12,22 +12,22 @@
import org.eclipse.swt.widgets.Button;
import org.eclipse.swtbot.eclipse.finder.matchers.WidgetMatcherFactory;
-import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotCheckBox;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
import org.hamcrest.Matcher;
import org.jboss.tools.hibernate.ui.bot.testsuite.HibernateTest;
import org.jboss.tools.hibernate.ui.bot.testsuite.Project;
+import org.jboss.tools.ui.bot.ext.config.Annotations.DB;
+import org.jboss.tools.ui.bot.ext.config.Annotations.SWTBotTestRequires;
import org.jboss.tools.ui.bot.ext.gen.ActionItem;
import org.jboss.tools.ui.bot.ext.types.IDELabel;
import org.jboss.tools.ui.bot.ext.types.PerspectiveType;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
-import org.junit.runner.RunWith;
-(a)RunWith(SWTBotJunit4ClassRunner.class)
+@SWTBotTestRequires( db=@DB, perspective="Hibernate")
public class CodeGenerationLauncherTest extends HibernateTest {
SWTBotShell mainShell = null;
@@ -44,7 +44,6 @@
prepareProject();
prepareConsole();
- prepareDatabase();
util.waitForNonIgnoredJobs();
}
Modified: trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testcase/ConfigurationContextTest.java
===================================================================
--- trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testcase/ConfigurationContextTest.java 2010-12-21 09:19:27 UTC (rev 27627)
+++ trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testcase/ConfigurationContextTest.java 2010-12-21 09:30:55 UTC (rev 27628)
@@ -10,12 +10,11 @@
******************************************************************************/
package org.jboss.tools.hibernate.ui.bot.testcase;
-import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
import org.jboss.tools.hibernate.ui.bot.testsuite.HibernateTest;
+import org.jboss.tools.ui.bot.ext.config.Annotations.SWTBotTestRequires;
import org.junit.Test;
-import org.junit.runner.RunWith;
-(a)RunWith(SWTBotJunit4ClassRunner.class)
+@SWTBotTestRequires( clearProjects = false, perspective="Hibernate")
public class ConfigurationContextTest extends HibernateTest {
/**
Modified: trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testcase/ConfigurationFileTest.java
===================================================================
--- trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testcase/ConfigurationFileTest.java 2010-12-21 09:19:27 UTC (rev 27627)
+++ trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testcase/ConfigurationFileTest.java 2010-12-21 09:30:55 UTC (rev 27628)
@@ -1,13 +1,13 @@
- /*******************************************************************************
- * Copyright (c) 2007-2009 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
- *
- * Contributor:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
+/*******************************************************************************
+ * Copyright (c) 2007-2009 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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
package org.jboss.tools.hibernate.ui.bot.testcase;
import java.io.IOException;
@@ -20,7 +20,6 @@
import org.eclipse.swtbot.eclipse.finder.matchers.WidgetMatcherFactory;
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor;
import org.eclipse.swtbot.swt.finder.SWTBot;
-import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotCheckBox;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
@@ -28,54 +27,61 @@
import org.hamcrest.Matcher;
import org.jboss.tools.hibernate.ui.bot.testsuite.HibernateTest;
import org.jboss.tools.hibernate.ui.bot.testsuite.Project;
+import org.jboss.tools.ui.bot.ext.config.Annotations.SWTBotTestRequires;
+import org.jboss.tools.ui.bot.ext.config.TestConfigurator;
import org.jboss.tools.ui.bot.ext.helper.ContextMenuHelper;
+import org.jboss.tools.ui.bot.ext.helper.DatabaseHelper;
import org.jboss.tools.ui.bot.ext.parts.ObjectMultiPageEditorBot;
import org.jboss.tools.ui.bot.ext.types.EntityType;
import org.jboss.tools.ui.bot.ext.types.IDELabel;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
-import org.junit.runner.RunWith;
import org.xml.sax.SAXException;
-(a)RunWith(SWTBotJunit4ClassRunner.class)
+@SWTBotTestRequires(clearProjects = false, perspective="Hibernate")
public class ConfigurationFileTest extends HibernateTest {
@BeforeClass
public static void setUpTest() {
HibernateTest.prepareProject();
}
-
+
@AfterClass
- public static void tearDownTest() {
+ public static void tearDownTest() {
HibernateTest.clean();
- }
-
+ }
+
/**
* TC 02 - Create Hibernate Configuration file with predefined variables
*/
@Test
public void createFile() {
eclipse.createNew(EntityType.HIBERNATE_CONFIGURATION_FILE);
-
- eclipse.selectTreeLocation(Project.PROJECT_NAME,"src");
- bot.textWithLabel(IDELabel.HBConfigurationWizard.FILE_NAME).setText(Project.CONF_FILE_NAME2);
+
+ eclipse.selectTreeLocation(Project.PROJECT_NAME, "src");
+ bot.textWithLabel(IDELabel.HBConfigurationWizard.FILE_NAME).setText(
+ Project.CONF_FILE_NAME2);
bot.button(IDELabel.Button.NEXT).click();
// Create new configuration file
- bot.comboBoxWithLabel(IDELabel.HBConsoleWizard.DATABASE_DIALECT).setSelection(Project.DB_DIALECT);
- bot.comboBoxWithLabel(IDELabel.HBConsoleWizard.DRIVER_CLASS).setSelection(Project.DRIVER_CLASS);
- bot.comboBoxWithLabel(IDELabel.HBConsoleWizard.CONNECTION_URL).setText(Project.JDBC_STRING);
+ String dialect = DatabaseHelper.getDialect(TestConfigurator.currentConfig.getDB().dbType);
+ bot.comboBoxWithLabel(IDELabel.HBConsoleWizard.DATABASE_DIALECT).setSelection(dialect);
+ String drvClass = DatabaseHelper.getDriverClass(TestConfigurator.currentConfig.getDB().dbType);
+ bot.comboBoxWithLabel(IDELabel.HBConsoleWizard.DRIVER_CLASS).setSelection(drvClass);
+ String jdbc = TestConfigurator.currentConfig.getDB().jdbcString;
+ bot.comboBoxWithLabel(IDELabel.HBConsoleWizard.CONNECTION_URL).setText(jdbc);
// Create console configuration
- Matcher<Button> matcher = WidgetMatcherFactory.withText(IDELabel.HBConsoleWizard.CREATE_CONSOLE_CONFIGURATION);
- Button button = bot.widget(matcher);
- SWTBotCheckBox cb = new SWTBotCheckBox(button);
-
+ Matcher<Button> matcher = WidgetMatcherFactory
+ .withText(IDELabel.HBConsoleWizard.CREATE_CONSOLE_CONFIGURATION);
+ Button button = bot.widget(matcher);
+ SWTBotCheckBox cb = new SWTBotCheckBox(button);
+
if (!cb.isChecked())
cb.click();
-
- SWTBotShell shell = bot.activeShell();
+
+ SWTBotShell shell = bot.activeShell();
log.info("Active shell:" + shell.getText());
bot.button(IDELabel.Button.FINISH).click();
eclipse.waitForClosedShell(shell);
@@ -84,97 +90,96 @@
/**
* TC 13
- * @throws ParserConfigurationException
- * @throws IOException
- * @throws SAXException
- * @throws XPathExpressionException
+ *
+ * @throws ParserConfigurationException
+ * @throws IOException
+ * @throws SAXException
+ * @throws XPathExpressionException
*/
@Test
/*
- * Edit Configuration file testcase. It checks: 1. Configuration file editor tabs availability,...
+ * Edit Configuration file testcase. It checks: 1. Configuration file editor
+ * tabs availability,...
*/
- public void editFile() throws ParserConfigurationException, SAXException, IOException, XPathExpressionException {
-
- SWTBotEditor editor = eclipse.openFile(Project.PROJECT_NAME, "src", Project.CONF_FILE_NAME2);
- ObjectMultiPageEditorBot multiBot = new ObjectMultiPageEditorBot(Project.CONF_FILE_NAME2);
+ public void editFile() throws ParserConfigurationException, SAXException,
+ IOException, XPathExpressionException {
- // 1. Tabs availability
- String[] pages = {"Session Factory","Security","Source"};
- for ( String page : pages ) {
+ SWTBotEditor editor = eclipse.openFile(Project.PROJECT_NAME, "src",
+ Project.CONF_FILE_NAME2);
+ ObjectMultiPageEditorBot multiBot = new ObjectMultiPageEditorBot(
+ Project.CONF_FILE_NAME2);
+
+ // 1. Tabs availability
+ String[] pages = { "Session Factory", "Security", "Source" };
+ for (String page : pages) {
multiBot.selectPage(page);
bot.sleep(TIME_500MS);
}
-
+
// 2. Test creating elements and properties
// TODO creating element impl.
-
- // 3. Create new security element
+
+ // 3. Create new security element
SWTBot localBot = editor.bot();
multiBot.selectPage(pages[1]);
SWTBotTree secTree = localBot.tree().select("Security");
ContextMenuHelper.clickContextMenu(secTree, "New", "Grant...");
-
+
// Fillin Role, Entity-Name and Check action All *
String roleName = "role1";
String entityName = "entity1";
-
+
bot.textWithLabel("Role:*").setText("role1");
bot.textWithLabel("Entity-Name:*").setText("entity1");
SWTBotShell shell = bot.shell("Add Grant");
-
+
assertNotNull(shell);
SWTBot shellBot = new SWTBot(shell.widget);
-
- SWTBotTree tree = shellBot.tree();
+
+ SWTBotTree tree = shellBot.tree();
SWTBotTreeItem[] items = tree.getAllItems();
items[0].check();
-
+
shellBot.button(IDELabel.Button.FINISH).click();
-
+
// Click on Source tab for check
multiBot.selectPage(pages[2]);
List<String> lines = editor.toTextEditor().getLines();
-
+
// XMLPath
/*
- // Convert editor text into InputStreamReader
- StringBuilder builder = new StringBuilder();
- for (String line : lines ) {
- builder.append(line);
- builder.append("\n");
- }
- ByteArrayInputStream bs = new ByteArrayInputStream(builder.toString().getBytes());
-
- DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
- dbf.setNamespaceAware(true);
- DocumentBuilder db;
- db = dbf.newDocumentBuilder();
- Document doc = db.parse(bs);
- XPath xpath = XPathFactory.newInstance().newXPath();
- XPathExpression expr = xpath.compile("/person/security/grant");
- Object result = expr.evaluate(doc, XPathConstants.NODESET);
- NodeList nodes = (NodeList) result;
- for ( int i = 0; i < nodes.getLength(); i++ )
- System.out.println(nodes.item(i).getNodeValue());
+ * // Convert editor text into InputStreamReader StringBuilder builder =
+ * new StringBuilder(); for (String line : lines ) {
+ * builder.append(line); builder.append("\n"); } ByteArrayInputStream bs
+ * = new ByteArrayInputStream(builder.toString().getBytes());
+ *
+ * DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ * dbf.setNamespaceAware(true); DocumentBuilder db; db =
+ * dbf.newDocumentBuilder(); Document doc = db.parse(bs); XPath xpath =
+ * XPathFactory.newInstance().newXPath(); XPathExpression expr =
+ * xpath.compile("/person/security/grant"); Object result =
+ * expr.evaluate(doc, XPathConstants.NODESET); NodeList nodes =
+ * (NodeList) result; for ( int i = 0; i < nodes.getLength(); i++ )
+ * System.out.println(nodes.item(i).getNodeValue());
+ */
+ // Search for security grant
- */
- // Search for security grant
-
boolean found = false;
- String wanted = "<grant actions=\"*\" entity-name=\"" + entityName + "\" role=\"" + roleName + "\"/>";
+ String wanted = "<grant actions=\"*\" entity-name=\"" + entityName
+ + "\" role=\"" + roleName + "\"/>";
System.out.println("Looking for:" + wanted);
-
+
for (String line : lines) {
System.out.println(line);
if (line.trim().equals(wanted)) {
found = true;
System.out.println("Found");
- }
- }
-
- editor.saveAndClose();
- assertTrue("Security element not found in xml", found);
+ }
+ }
+
+ editor.saveAndClose();
+ assertTrue("Security element not found in xml", found);
}
}
Modified: trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testcase/ConsolePerspectiveTest.java
===================================================================
--- trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testcase/ConsolePerspectiveTest.java 2010-12-21 09:19:27 UTC (rev 27627)
+++ trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testcase/ConsolePerspectiveTest.java 2010-12-21 09:30:55 UTC (rev 27628)
@@ -10,14 +10,13 @@
******************************************************************************/
package org.jboss.tools.hibernate.ui.bot.testcase;
-import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
import org.jboss.tools.hibernate.ui.bot.testsuite.HibernateTest;
+import org.jboss.tools.ui.bot.ext.config.Annotations.SWTBotTestRequires;
import org.jboss.tools.ui.bot.ext.gen.ActionItem;
import org.jboss.tools.ui.bot.ext.types.IDELabel;
import org.junit.Test;
-import org.junit.runner.RunWith;
-(a)RunWith(SWTBotJunit4ClassRunner.class)
+@SWTBotTestRequires(clearProjects = false, perspective="Hibernate")
public class ConsolePerspectiveTest extends HibernateTest {
/**
Modified: trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testcase/ConsoleTest.java
===================================================================
--- trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testcase/ConsoleTest.java 2010-12-21 09:19:27 UTC (rev 27627)
+++ trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testcase/ConsoleTest.java 2010-12-21 09:30:55 UTC (rev 27628)
@@ -11,22 +11,24 @@
package org.jboss.tools.hibernate.ui.bot.testcase;
import org.eclipse.swtbot.swt.finder.SWTBot;
-import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
import org.jboss.tools.hibernate.ui.bot.testsuite.HibernateTest;
import org.jboss.tools.hibernate.ui.bot.testsuite.Project;
import org.jboss.tools.ui.bot.ext.SWTEclipseExt;
+import org.jboss.tools.ui.bot.ext.config.Annotations.DB;
+import org.jboss.tools.ui.bot.ext.config.Annotations.SWTBotTestRequires;
+import org.jboss.tools.ui.bot.ext.config.TestConfigurator;
import org.jboss.tools.ui.bot.ext.gen.ActionItem;
+import org.jboss.tools.ui.bot.ext.helper.DatabaseHelper;
import org.jboss.tools.ui.bot.ext.types.EntityType;
import org.jboss.tools.ui.bot.ext.types.IDELabel;
import org.jboss.tools.ui.bot.ext.types.ViewType;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
-import org.junit.runner.RunWith;
-(a)RunWith(SWTBotJunit4ClassRunner.class)
+@SWTBotTestRequires( clearProjects = false, db=@DB, perspective="Hibernate")
public class ConsoleTest extends HibernateTest {
@BeforeClass
@@ -83,10 +85,14 @@
bot.button(IDELabel.HBConsoleWizard.CREATE_NEW_BUTTON).click();
eclipse.selectTreeLocation(Project.PROJECT_NAME, "src");
bot.button(IDELabel.Button.NEXT).click();
- bot.comboBoxWithLabel(IDELabel.HBConsoleWizard.DATABASE_DIALECT).setSelection(Project.DB_DIALECT);
- bot.comboBoxWithLabel(IDELabel.HBConsoleWizard.DRIVER_CLASS).setSelection(Project.DRIVER_CLASS);
- bot.comboBoxWithLabel(IDELabel.HBConsoleWizard.CONNECTION_URL).setText(Project.JDBC_STRING);
+ String dialect = DatabaseHelper.getDialect(TestConfigurator.currentConfig.getDB().dbType);
+ bot.comboBoxWithLabel(IDELabel.HBConsoleWizard.DATABASE_DIALECT).setSelection(dialect);
+ String drvClass = DatabaseHelper.getDriverClass(TestConfigurator.currentConfig.getDB().dbType);
+ bot.comboBoxWithLabel(IDELabel.HBConsoleWizard.DRIVER_CLASS).setSelection(drvClass);
+ String jdbc = TestConfigurator.currentConfig.getDB().jdbcString;
+ bot.comboBoxWithLabel(IDELabel.HBConsoleWizard.CONNECTION_URL).setText(jdbc);
+
SWTBotShell shell = bot.activeShell();
bot.button(IDELabel.Button.FINISH).click();
eclipse.waitForClosedShell(shell);
@@ -102,8 +108,8 @@
mainShell.activate();
bot.cTabItem(IDELabel.HBConsoleWizard.OPTIONS_TAB).activate();
-
- bot.comboBoxWithLabelInGroup("", IDELabel.HBConsoleWizard.DATABASE_DIALECT).setSelection(Project.DB_DIALECT);
+ String dialect = DatabaseHelper.getDialect(TestConfigurator.currentConfig.getDB().dbType);
+ bot.comboBoxWithLabelInGroup("", IDELabel.HBConsoleWizard.DATABASE_DIALECT).setSelection(dialect);
log.info("HB Console Option tab DONE");
bot.sleep(TIME_1S);
}
Modified: trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testcase/CriteriaEditorsTest.java
===================================================================
--- trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testcase/CriteriaEditorsTest.java 2010-12-21 09:19:27 UTC (rev 27627)
+++ trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testcase/CriteriaEditorsTest.java 2010-12-21 09:30:55 UTC (rev 27628)
@@ -10,12 +10,11 @@
******************************************************************************/
package org.jboss.tools.hibernate.ui.bot.testcase;
-import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
import org.jboss.tools.hibernate.ui.bot.testsuite.HibernateTest;
+import org.jboss.tools.ui.bot.ext.config.Annotations.SWTBotTestRequires;
import org.junit.Test;
-import org.junit.runner.RunWith;
-(a)RunWith(SWTBotJunit4ClassRunner.class)
+@SWTBotTestRequires(clearProjects = false, perspective="Hibernate")
public class CriteriaEditorsTest extends HibernateTest {
/**
Modified: trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testcase/DaliTest.java
===================================================================
--- trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testcase/DaliTest.java 2010-12-21 09:19:27 UTC (rev 27627)
+++ trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testcase/DaliTest.java 2010-12-21 09:30:55 UTC (rev 27628)
@@ -10,12 +10,23 @@
******************************************************************************/
package org.jboss.tools.hibernate.ui.bot.testcase;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor;
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotMultiPageEditor;
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
-import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
import org.jboss.tools.hibernate.ui.bot.testsuite.HibernateTest;
import org.jboss.tools.hibernate.ui.bot.testsuite.Project;
+import org.jboss.tools.ui.bot.ext.config.Annotations.DB;
+import org.jboss.tools.ui.bot.ext.config.Annotations.SWTBotTestRequires;
+import org.jboss.tools.ui.bot.ext.config.Annotations.Server;
+import org.jboss.tools.ui.bot.ext.config.Annotations.ServerState;
+import org.jboss.tools.ui.bot.ext.config.TestConfigurator;
import org.jboss.tools.ui.bot.ext.helper.ContextMenuHelper;
+import org.jboss.tools.ui.bot.ext.helper.DatabaseHelper;
+import org.jboss.tools.ui.bot.ext.helper.StringHelper;
+import org.jboss.tools.ui.bot.ext.parts.ContentAssistBot;
+import org.jboss.tools.ui.bot.ext.parts.SWTBotEditorExt;
import org.jboss.tools.ui.bot.ext.types.EntityType;
import org.jboss.tools.ui.bot.ext.types.IDELabel;
import org.jboss.tools.ui.bot.ext.types.PerspectiveType;
@@ -23,10 +34,9 @@
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
-import org.junit.runner.RunWith;
import org.osgi.framework.Version;
-(a)RunWith(SWTBotJunit4ClassRunner.class)
+@SWTBotTestRequires( clearProjects = false, db=@DB, perspective="JPA" , server=@Server(state = ServerState.Present))
public class DaliTest extends HibernateTest {
private static boolean projectCreated = false;
@@ -37,7 +47,7 @@
eclipse.openPerspective(PerspectiveType.JPA);
util.waitForNonIgnoredJobs();
}
-
+
/**
* TC 22 - Test creates JPA Project
*/
@@ -51,7 +61,10 @@
// JPA Project Page
eclipse.waitForShell("New JPA Project");
- bot.textWithLabel("Project name:").setText(Project.JPA_PRJ_NAME);
+ bot.textWithLabel("Project name:").setText(Project.JPA_PRJ_NAME);
+ bot.comboBoxInGroup("Target runtime").setSelection(TestConfigurator.currentConfig.getServer().getName());
+
+
bot.button(IDELabel.Button.NEXT).click();
// Java Page
@@ -64,7 +77,8 @@
else
bot.comboBoxInGroup("Platform").setSelection("Hibernate (JPA 2.x)");
- bot.comboBoxInGroup("JPA implementation").setSelection("Disable Library Configuration");
+ bot.comboBoxInGroup("JPA implementation").setSelection("Library Provided by Target Runtime");
+ bot.comboBoxInGroup("Connection").setSelection(TestConfigurator.currentConfig.getDB().name);
// Finish
bot.button(IDELabel.Button.FINISH).click();
@@ -103,10 +117,6 @@
bot.textWithLabel("File name").setText(Project.DDL_OUTPUT);
bot.button(IDELabel.Button.FINISH).click();
-
- // TODO
- // Check file
- // packageExplorer.openFile(Project.JPA_PRJ_NAME, Project.DDL_OUTPUT, Project.DDL_FILENAME);
}
/**
@@ -125,6 +135,10 @@
// Generation Entities dialog
bot.textWithLabel("Package:").setText(Project.ENTITIES_PACKAGE);
bot.button(IDELabel.Button.FINISH).click();
+ util.waitForNonIgnoredJobs();
+
+ // Check generated entities
+ packageExplorer.openFile(Project.JPA_PRJ_NAME, "src", Project.ENTITIES_PACKAGE, "Customers.java");
}
/**
@@ -137,28 +151,63 @@
bot.viewByTitle("Data Source Explorer").setFocus();
}
+
/**
- * TC 25
+ * TC 25 - Checking coding configuration in persistence.xml editor on xml page
*/
@Test
- public void checkCAInConfigurationEditor() {
- bot.editorByTitle("persistence.xml").show();
-
- // TODO - Multipage editor bot support needed first
+ public void checkCAInConfigurationEditorXML() {
+ SWTBotEditor editor = bot.editorByTitle("persistence.xml");
+ editor.show();
+ SWTBotMultiPageEditor mpe = new SWTBotMultiPageEditor(editor.getReference(), bot);
+ mpe.activatePage("Source");
+
+ // Code completion
+ String text = mpe.toTextEditor().getText();
+ StringHelper helper = new StringHelper(text);
+ Point p = helper.getPositionBefore("</persistence-unit>");
+ editor.toTextEditor().selectRange(p.y, p.x, 0);
+ editor.save();
+ SWTBotEditorExt editorExt = new SWTBotEditorExt(editor.getReference(), bot);
+ ContentAssistBot ca = new ContentAssistBot(editorExt);
+ ca.useProposal("class");
}
+
/**
- * TC 25
+ * TC 25 - Filling hibernate page on persistence.xml editor
*/
@Test
- public void checkCAInMappingEditor() {
- // TODO - Multipage editor bot support needed first
+ public void fillHibernatePage() {
+ SWTBotEditor editor = bot.editorByTitle("persistence.xml");
+ editor.show();
+ SWTBotMultiPageEditor mpe = new SWTBotMultiPageEditor(editor.getReference(), bot);
+ mpe.activatePage("Hibernate");
+ // Fill in
+ String dialect = DatabaseHelper.getDialect(TestConfigurator.currentConfig.getDB().dbType);
+ bot.comboBoxWithLabel(IDELabel.HBConsoleWizard.DATABASE_DIALECT).setSelection(dialect);
+ String drvClass = DatabaseHelper.getDriverClass(TestConfigurator.currentConfig.getDB().dbType);
+ bot.comboBoxWithLabel(IDELabel.HBConsoleWizard.DRIVER_CLASS).setSelection(drvClass);
+ String jdbc = TestConfigurator.currentConfig.getDB().jdbcString;
+ bot.comboBoxWithLabel(IDELabel.HBConsoleWizard.CONNECTION_URL).setText(jdbc);
+ bot.textWithLabel("Username:").setText("sa");
+
+ editor.save();
+ mpe.activatePage("Source");
+
+ // Check xml content
+ String text = mpe.toTextEditor().getText();
+ StringHelper helper = new StringHelper(text);
+ String str = "<property name=\"hibernate.dialect\" value=\"org.hibernate.dialect.HSQLDialect\"/>";
+ helper.getPositionBefore(str);
+ str = "<property name=\"hibernate.connection.driver_class\" value=\"org.hsqldb.jdbcDriver\"/>";
+ helper.getPositionBefore(str);
+ bot.sleep(TIME_10S);
}
-
+
@AfterClass
public static void cleanup() {
log.info("JPA DaliTest cleanup");
- bot.sleep(TIME_5S);
}
}
Modified: trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testcase/JIRATest.java
===================================================================
--- trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testcase/JIRATest.java 2010-12-21 09:19:27 UTC (rev 27627)
+++ trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testcase/JIRATest.java 2010-12-21 09:30:55 UTC (rev 27628)
@@ -10,12 +10,12 @@
******************************************************************************/
package org.jboss.tools.hibernate.ui.bot.testcase;
-import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
import org.jboss.tools.hibernate.ui.bot.testsuite.HibernateTest;
+import org.jboss.tools.ui.bot.ext.config.Annotations.DB;
+import org.jboss.tools.ui.bot.ext.config.Annotations.SWTBotTestRequires;
import org.junit.Test;
-import org.junit.runner.RunWith;
-(a)RunWith(SWTBotJunit4ClassRunner.class)
+@SWTBotTestRequires( clearProjects = false, db=@DB, perspective="Hibernate")
public class JIRATest extends HibernateTest {
/**
Modified: trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testcase/MappingFileTest.java
===================================================================
--- trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testcase/MappingFileTest.java 2010-12-21 09:19:27 UTC (rev 27627)
+++ trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testcase/MappingFileTest.java 2010-12-21 09:30:55 UTC (rev 27628)
@@ -13,10 +13,10 @@
import java.util.List;
import org.eclipse.swtbot.swt.finder.SWTBot;
-import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
import org.jboss.tools.hibernate.ui.bot.testsuite.HibernateTest;
import org.jboss.tools.hibernate.ui.bot.testsuite.Project;
+import org.jboss.tools.ui.bot.ext.config.Annotations.SWTBotTestRequires;
import org.jboss.tools.ui.bot.ext.parts.ObjectMultiPageEditorBot;
import org.jboss.tools.ui.bot.ext.parts.SWTBotEditorExt;
import org.jboss.tools.ui.bot.ext.types.EntityType;
@@ -24,9 +24,8 @@
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
-import org.junit.runner.RunWith;
-(a)RunWith(SWTBotJunit4ClassRunner.class)
+@SWTBotTestRequires( clearProjects = false, perspective="Hibernate")
public class MappingFileTest extends HibernateTest {
@BeforeClass
Modified: trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testcase/MappingsDiagramTest.java
===================================================================
--- trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testcase/MappingsDiagramTest.java 2010-12-21 09:19:27 UTC (rev 27627)
+++ trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testcase/MappingsDiagramTest.java 2010-12-21 09:30:55 UTC (rev 27628)
@@ -10,12 +10,11 @@
******************************************************************************/
package org.jboss.tools.hibernate.ui.bot.testcase;
-import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
import org.jboss.tools.hibernate.ui.bot.testsuite.HibernateTest;
+import org.jboss.tools.ui.bot.ext.config.Annotations.SWTBotTestRequires;
import org.junit.Test;
-import org.junit.runner.RunWith;
-(a)RunWith(SWTBotJunit4ClassRunner.class)
+@SWTBotTestRequires(clearProjects = false, perspective="Hibernate")
public class MappingsDiagramTest extends HibernateTest {
/**
Modified: trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testcase/ReverseEngineerFileTest.java
===================================================================
--- trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testcase/ReverseEngineerFileTest.java 2010-12-21 09:19:27 UTC (rev 27627)
+++ trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testcase/ReverseEngineerFileTest.java 2010-12-21 09:30:55 UTC (rev 27628)
@@ -10,17 +10,16 @@
******************************************************************************/
package org.jboss.tools.hibernate.ui.bot.testcase;
-import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
import org.jboss.tools.hibernate.ui.bot.testsuite.HibernateTest;
import org.jboss.tools.hibernate.ui.bot.testsuite.Project;
+import org.jboss.tools.ui.bot.ext.config.Annotations.SWTBotTestRequires;
import org.jboss.tools.ui.bot.ext.types.EntityType;
import org.jboss.tools.ui.bot.ext.types.IDELabel;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
-import org.junit.runner.RunWith;
-(a)RunWith(SWTBotJunit4ClassRunner.class)
+@SWTBotTestRequires(clearProjects = false, perspective="Hibernate")
public class ReverseEngineerFileTest extends HibernateTest {
@BeforeClass
Modified: trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testcase/ViewsTest.java
===================================================================
--- trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testcase/ViewsTest.java 2010-12-21 09:19:27 UTC (rev 27627)
+++ trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testcase/ViewsTest.java 2010-12-21 09:30:55 UTC (rev 27628)
@@ -10,12 +10,12 @@
******************************************************************************/
package org.jboss.tools.hibernate.ui.bot.testcase;
-import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
import org.jboss.tools.hibernate.ui.bot.testsuite.HibernateTest;
+import org.jboss.tools.ui.bot.ext.config.Annotations.DB;
+import org.jboss.tools.ui.bot.ext.config.Annotations.SWTBotTestRequires;
import org.junit.Test;
-import org.junit.runner.RunWith;
-(a)RunWith(SWTBotJunit4ClassRunner.class)
+@SWTBotTestRequires( db=@DB, perspective="Hibernate")
public class ViewsTest extends HibernateTest {
/**
Modified: trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testsuite/HibernateAllTests.java
===================================================================
--- trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testsuite/HibernateAllTests.java 2010-12-21 09:19:27 UTC (rev 27627)
+++ trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testsuite/HibernateAllTests.java 2010-12-21 09:30:55 UTC (rev 27628)
@@ -1,13 +1,13 @@
- /*******************************************************************************
- * Copyright (c) 2007-2009 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
- *
- * Contributor:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
+/*******************************************************************************
+ * Copyright (c) 2007-2009 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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
package org.jboss.tools.hibernate.ui.bot.testsuite;
import org.jboss.tools.hibernate.ui.bot.testcase.CodeGenerationLauncherTest;
@@ -22,26 +22,20 @@
import org.jboss.tools.hibernate.ui.bot.testcase.MappingsDiagramTest;
import org.jboss.tools.hibernate.ui.bot.testcase.ReverseEngineerFileTest;
import org.jboss.tools.hibernate.ui.bot.testcase.ViewsTest;
+import org.jboss.tools.ui.bot.ext.RequirementAwareSuite;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
import org.junit.runners.Suite.SuiteClasses;
-(a)RunWith(Suite.class)
+(a)RunWith(RequirementAwareSuite.class)
+@SuiteClasses({ CodeGenerationLauncherTest.class,
+ ConfigurationContextTest.class, ConfigurationFileTest.class,
+ ConsolePerspectiveTest.class, ConsoleTest.class,
+ CriteriaEditorsTest.class, DaliTest.class, JIRATest.class,
+ MappingFileTest.class, MappingsDiagramTest.class,
+ ReverseEngineerFileTest.class, ViewsTest.class })
-@SuiteClasses( { CodeGenerationLauncherTest.class,
- ConfigurationContextTest.class,
- ConfigurationFileTest.class,
- ConsolePerspectiveTest.class,
- ConsoleTest.class,
- CriteriaEditorsTest.class,
- DaliTest.class,
- JIRATest.class,
- MappingFileTest.class,
- MappingsDiagramTest.class,
- ReverseEngineerFileTest.class,
- ViewsTest.class})
public class HibernateAllTests extends HibernateTest {
Modified: trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testsuite/HibernateTest.java
===================================================================
--- trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testsuite/HibernateTest.java 2010-12-21 09:19:27 UTC (rev 27627)
+++ trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testsuite/HibernateTest.java 2010-12-21 09:30:55 UTC (rev 27628)
@@ -10,40 +10,26 @@
******************************************************************************/
package org.jboss.tools.hibernate.ui.bot.testsuite;
-import static org.eclipse.swtbot.eclipse.finder.matchers.WithPartName.withPartName;
-
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.channels.FileChannel;
-import java.sql.Connection;
-import java.sql.DriverManager;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Statement;
import org.eclipse.core.runtime.Platform;
-import org.eclipse.datatools.connectivity.ConnectionProfileException;
-import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor;
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
import org.eclipse.swtbot.swt.finder.SWTBot;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
-import org.eclipse.ui.IViewReference;
-import org.hamcrest.Matcher;
-import org.hsqldb.Server;
import org.jboss.tools.hibernate.ui.bot.testcase.Activator;
import org.jboss.tools.hibernate.ui.bot.testcase.ConsoleTest;
import org.jboss.tools.ui.bot.ext.SWTEclipseExt;
import org.jboss.tools.ui.bot.ext.SWTTestExt;
+import org.jboss.tools.ui.bot.ext.config.TestConfigurator;
import org.jboss.tools.ui.bot.ext.entity.JavaClassEntity;
import org.jboss.tools.ui.bot.ext.entity.JavaProjectEntity;
import org.jboss.tools.ui.bot.ext.helper.ContextMenuHelper;
-import org.jboss.tools.ui.bot.ext.helper.DatabaseHelper;
-import org.jboss.tools.ui.bot.ext.types.DriverEntity;
import org.jboss.tools.ui.bot.ext.types.IDELabel;
import org.jboss.tools.ui.bot.ext.types.PerspectiveType;
import org.jboss.tools.ui.bot.ext.types.ViewType;
@@ -53,13 +39,7 @@
private static boolean classesCreated = false;
private static boolean projectCreated = false;
- private static boolean databasePrepared = false;
- private static boolean dbRunning = false;
- private static Thread hsqlThread = null;
-
- //private static Properties properties;
-
/**
* Prepare project and classes
*/
@@ -67,6 +47,7 @@
public static void prepare() {
log.info("Hibernate All Test Started");
jbt.closeReportUsageWindowIfOpened(true);
+ util.waitForNonIgnoredJobs();
}
/**
@@ -76,7 +57,6 @@
if (classesCreated) return;
-
// Package Explorer
SWTBot viewBot = eclipse.showView(ViewType.PACKAGE_EXPLORER);
SWTEclipseExt.selectTreeLocation(viewBot, Project.PROJECT_NAME,"src");
@@ -111,7 +91,6 @@
System.out.println("View Activated");
// Show perspective and view
- //open.viewClose(view)
eclipse.closeView(IDELabel.View.WELCOME);
eclipse.openPerspective(PerspectiveType.JAVA);
@@ -165,12 +144,18 @@
bot.tabItem("Libraries").activate();
bot.button("Add JARs...").click();
bot.sleep(TIME_500MS);
- bot.tree().expandNode(Project.PROJECT_NAME).expandNode("hsqldb.jar").select();
+ String file = getDriverFileName(TestConfigurator.currentConfig.getDB().driverPath);
+ bot.tree().expandNode(Project.PROJECT_NAME).expandNode(file).select();
bot.button(IDELabel.Button.OK).click();
bot.sleep(TIME_1S);
bot.button(IDELabel.Button.OK).click();
bot.sleep(TIME_1S);
+ }
+
+ public static String getDriverFileName(String filePath) {
+ String[] fragments = filePath.split(File.separator);
+ return fragments[fragments.length - 1];
}
/**
@@ -179,7 +164,14 @@
* @throws IOException
*/
public static void addDriverIntoProject() throws FileNotFoundException, IOException {
- File in = util.getResourceFile(Activator.PLUGIN_ID, "drv","hsqldb.jar");
+ File in = null;
+ if (TestConfigurator.currentConfig.getDB().internal) {
+ in = util.getResourceFile(Activator.PLUGIN_ID, "drv","hsqldb.jar");
+ }
+ else {
+ in = util.getResourceFile(TestConfigurator.currentConfig.getDB().driverPath);
+ }
+
File out = new File(Platform.getLocation() + File.separator + Project.PROJECT_NAME + File.separator + "hsqldb.jar");
FileChannel inChannel = null;
@@ -192,7 +184,7 @@
if (inChannel != null) inChannel.close();
if (outChannel != null) outChannel.close();
- log.info("Driver hsqldb.jar copied");
+ log.info("JDBC Driver copied");
}
/**
@@ -209,114 +201,4 @@
ConsoleTest consoleTest = new ConsoleTest();
consoleTest.createConsole();
}
-
- /**
- * Prepares database and insert test data by using connection profile and sql scrapbook
- */
- public static void prepareDatabase() {
- if (databasePrepared) return;
-
- runHSQLDBServer(Project.DB_FILE,Project.DB_NAME);
-
- StringBuilder stringBuilder = new StringBuilder();
- stringBuilder.append(Platform.getLocation());
- stringBuilder.append(File.separator);
- stringBuilder.append(Project.PROJECT_NAME);
- stringBuilder.append(File.separator);
- stringBuilder.append("hsqldb.jar");
-
- try {
- DriverEntity entity = new DriverEntity();
- entity.setDrvPath(stringBuilder.toString());
- entity.setJdbcString("jdbc:hsqldb:hsql://localhost/xdb");
- DatabaseHelper.createDriver(entity);
- } catch (ConnectionProfileException e) {
- log.error("Unable to create HSQL Driver" + e);
- fail();
- }
-
- eclipse.openPerspective(PerspectiveType.DB_DEVELOPMENT);
- eclipse.showView(ViewType.DATA_SOURCE_EXPLORER);
-
- bot.sleep(TIME_1S);
-
- //bot.activetree().expandNode("Database Connections").select();
-
- Matcher<IViewReference> matcher = withPartName("Data Source Explorer");
- SWTBotView view = bot.view(matcher);
-
- bot.sleep(TIME_1S);
- SWTBotTree tree = view.bot().tree();
-
- // Open SQL Scrapbook
- SWTBotTreeItem item = tree.expandNode("Database Connections").expandNode("DefaultDS");
- item.contextMenu("Connect").click();
- item.contextMenu("Open SQL Scrapbook").click();
-
- // Set SQL Scrapbook
- SWTBotEditor editor = bot.editorByTitle("SQL Scrapbook 0");
- editor.setFocus();
- bot.comboBoxWithLabelInGroup("Type:","Connection profile").setSelection("HSQLDB_1.8");
- bot.comboBoxWithLabelInGroup("Name:","Connection profile").setSelection("DefaultDS");
- bot.comboBoxWithLabelInGroup("Database:","Connection profile").setSelection("Default");
-
- // Insert SQL script into editor
- eclipse.setClassContentFromResource(false, Activator.PLUGIN_ID, "sql", "SQL Scrapbook 0");
-
- // Execute Script and close
- bot.editorByTitle("SQL Scrapbook 0").toTextEditor().contextMenu("Execute All").click();
- editor.close();
-
- bot.sleep(TIME_5S);
- }
-
- /**
- * Run HSQLDB database in server mode
- * @param file
- * @param dbname
- */
- public static void runHSQLDBServer(final String file, final String dbname) {
- if (dbRunning) return;
-
- log.info("Starting HSQLDB");
- Runnable runable = new Runnable() {
-
- public void run() {
- Server.main(new String[] {"-database.0","file:" + file,"-dbname.0",dbname });
- }
- };
-
- hsqlThread = new Thread(runable);
- hsqlThread.start();
- log.info("HSQLDB started");
- dbRunning = true;
- }
-
- /**
- * Stop HSQL Database by sending SHUTDOWN command
- */
- public static void stopHSQLDBServer() {
-
- try {
- Class.forName("org.hsqldb.jdbcDriver");
-
- Connection connection = DriverManager.getConnection("jdbc:hsqldb:hsql://localhost/xdb");
-
- Statement statement = connection.createStatement();
- ResultSet resultset = statement.executeQuery("SHUTDOWN");
-
- resultset.close();
- statement.close();
- connection.close();
-
-
- } catch (SQLException e) {
-
- }
- catch (ClassNotFoundException e) {
- log.error("Unable to stop HSQLDB " + e);
- }
-
-
- }
}
\ No newline at end of file
14 years
JBoss Tools SVN: r27627 - trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/gef.
by jbosstools-commits@lists.jboss.org
Author: jpeterka
Date: 2010-12-21 04:19:27 -0500 (Tue, 21 Dec 2010)
New Revision: 27627
Added:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/gef/SWTArranger.java
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/gef/SWTBotGefEditorExt.java
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/gef/SWTBotGefViewerExt.java
Modified:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/gef/SWTBotGefFigure.java
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/gef/SWTBotGefFinder.java
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/gef/SWTBotGefMouse.java
Log:
SWTBotGef extensions added/updated:
Added SWTArranger for rectangular objects
GefEditorExt added
SWTBotGeffigure redesigned to have less dependencies
SWTBotGefMouse updated
SWTBotGefViewerExt added
Added: trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/gef/SWTArranger.java
===================================================================
--- trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/gef/SWTArranger.java (rev 0)
+++ trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/gef/SWTArranger.java 2010-12-21 09:19:27 UTC (rev 27627)
@@ -0,0 +1,271 @@
+/*******************************************************************************
+ * Copyright (c) 2007-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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.ui.bot.ext.gef;
+
+import static org.junit.Assert.assertTrue;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.PaintEvent;
+import org.eclipse.swt.events.PaintListener;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Canvas;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+
+
+/**
+ * Arranger can help to arrange rectangular shapes on the given area
+ * @author jpeterka
+ *
+ */
+public class SWTArranger {
+
+ private List<Block> blocks = new ArrayList<Block>();
+
+ private void addDifferent(List<Block> nb) {
+ for (Block n : nb ) {
+ boolean found = false;
+ for (Block b : blocks) {
+ if (b.x == n.x && b.y == n.y && b.width == n.width && b.height == n.height) {
+ found = true;
+ System.out.println(String.format("ignored: %d,%d,%d,%d", b.x, b.y,b.width, b.height));
+ break;
+ }
+ }
+ if (!found)
+ blocks.add(n);
+ System.out.println(String.format("added: %d,%d,%d,%d", n.x, n.y,n.width, n.height));
+ }
+ }
+
+ /**
+ * Set origin canvas size
+ * @param x
+ * @param y
+ * @param width
+ * @param height
+ */
+ public void setOrigin(Rectangle rect) {
+ setOrigin(rect.x, rect.y, rect.width, rect.height);
+ }
+
+ public void setOrigin(int x, int y, int width, int height) {
+ blocks.clear();
+ blocks.add(new Block(x,y,width, height));
+ }
+
+ /**
+ * Put rectangle with border
+ * @param width
+ * @param height
+ */
+ public void put(int width, int height) {
+ put(width, height, 0);
+ }
+
+ /**
+ * Put rectangle on empty space
+ * @param width
+ * @param height
+ * @param border
+ */
+ public void put(int width, int height, int border) {
+ boolean found = false;
+ for (Block b : blocks) {
+ if ((b.width >= width) && (b.height >= height)) {
+ addRect(b.x + border, b.y + border, width, height);
+ System.out.println(width + "," + height + " yep, i can arrange " + b.x + "," + b.y);
+ found = true;
+ break;
+ }
+ }
+ if (!found) System.out.println("there is no free location, sorry");
+ }
+
+ /**
+ * Add rectangle manually (be sure not to overlapp another)
+ * @param x
+ * @param y
+ * @param width
+ * @param height
+ */
+ public void addRect(int x, int y, int width, int height) {
+ Point p1 = new Point();
+ Point p2 = new Point();
+
+ List<Block> nb = new ArrayList<Block>();
+
+ for (int i = 0; i < blocks.size(); i++) {
+ Block r = blocks.get(i);
+ System.out.println(String.format("Trying to add: %d,%d,%d,%d", r.x, r.y,r.width, r.height));
+
+ // full cover
+ if (x <= r.x && y <= r.y && (x + width) >= (r.x + r.width) && (y + height) >= (r.y + r.height)) {
+ r.invalid = true;
+ System.out.println(String.format("full invalid: %d,%d,%d,%d", r.x, r.y,r.x + r.width, r.y - r.height));
+ }
+ // upper
+ if (((y > r.y) && (y < (r.y + r.height))) && penetrateCheck(x, x+width, r.x, r.x + r.width))
+ {
+ p1.x = r.x;
+ p1.y = r.y;
+ p2.x = r.x + r.width;
+ p2.y = y;
+ nb.add(new Block(p1.x, p1.y,p2.x - p1.x, p2.y - p1.y));
+ r.invalid = true;
+ System.out.println(String.format("upper: %d,%d,%d,%d", p1.x, p1.y,p2.x - p1.x, p2.y - p1.y));
+ assertTrue(p1.x != p2.x );
+ }
+ // lower
+ if ((((y + height) < (r.y + r.height)) && ((y + height) > r.y )) && penetrateCheck(x, x+width, r.x, r.x + r.width)) {
+ p1.x = r.x;
+ p1.y = y + height;
+ p2.x = r.x + r.width;
+ p2.y = r.y + r.height;
+ nb.add(new Block(p1.x, p1.y,p2.x - p1.x, p2.y - p1.y));
+ r.invalid = true;
+ System.out.println(String.format("lower: %d,%d,%d,%d", p1.x, p1.y,p2.x - p1.x, p2.y - p1.y));
+ assertTrue(p1.x != p2.x );
+ }
+ // left
+ if ((((x < (r.x + r.width)) && (x > r.x)) && penetrateCheck(y, y+height, r.y, r.y + r.height))){
+ p1.x = r.x;
+ p1.y = r.y;
+ p2.x = x;
+ p2.y = r.y + r.height;
+ nb.add(new Block(p1.x, p1.y,p2.x - p1.x, p2.y - p1.y));
+ r.invalid = true;
+ System.out.println(String.format("left: %d,%d,%d,%d", p1.x, p1.y,p2.x - p1.x, p2.y - p1.y));
+ assertTrue(p1.x != p2.x );
+ }
+ // right
+ if ((((x + width) < (r.x + r.width)) && ((x + width) > r.x)) && penetrateCheck(y, y+height, r.y, r.y + r.height)) {
+ p1.x = x + width;
+ p1.y = r.y;
+ p2.x = r.x + r.width;
+ p2.y = r.y + r.height;
+ nb.add(new Block(p1.x, p1.y,p2.x - p1.x, p2.y - p1.y));
+ r.invalid = true;
+ System.out.println(String.format("right: %d,%d,%d,%d", p1.x, p1.y,p2.x - p1.x, p2.y - p1.y));
+ assertTrue(p1.x != p2.x );
+ }
+ }
+
+ for (int i = blocks.size() - 1; i >= 0; i--) {
+ if (blocks.get(i).invalid) blocks.remove(i);
+ }
+ addDifferent(nb);
+ nb.clear();
+ }
+
+ private boolean penetrateCheck(int min, int max, int min2, int max2 ) {
+ if (min < max2 && (max > min2)) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * For debug purposes
+ */
+ public void printBlocks() {
+ System.out.println("Details");
+ for (Block r: blocks) {
+ System.out.println(String.format("P: %d,%d,%d,%d", r.x,r.y,r.x + r.width,r.y + r.height));
+ }
+ }
+
+ /**
+ * Debug only
+ */
+ public static void main(String[] args) {
+
+ final SWTArranger a = new SWTArranger();
+ a.setOrigin(0,0,200,200);
+ for (int i = 0; i < 10; i++)
+ a.addRect(i*10, i*10, 10, 10);
+ a.addRect(40,40,40,40);
+ a.addRect(50,50,40,40);
+ a.put(40, 60);
+ a.put(100, 100);
+ System.out.println("Done");
+
+ drawModel(a);
+
+ System.out.println("Done-SWT");
+ }
+
+ /**
+ * Debug only
+ */
+ private static void drawModel(final SWTArranger a) {
+ final Display d = new Display();
+ Shell s = new Shell(d);
+ s.setSize(500,500);
+
+ s.setLayout(new FillLayout());
+
+ Canvas canvas = new Canvas(s, SWT.NONE);
+ canvas.setSize(500,500);
+ canvas.setLocation(20,20);
+ canvas.addPaintListener(new PaintListener() {
+
+ @Override
+ public void paintControl(PaintEvent e) {
+ Color c = new Color(d,0x00, 0x00, 0x00);
+ GC gc = e.gc;
+ gc.setBackground(c);
+ int i = 0;
+ for (Block r : a.blocks) {
+ i += 10;
+ gc.fillRectangle(r.x, r.y, r.width, r.height);
+ }
+ c.dispose();
+ gc.dispose();
+ }
+ });
+ s.pack();
+ s.open();
+
+ while (!s.isDisposed()) {
+ if (!d.readAndDispatch()) {
+ d.sleep();
+ }
+ }
+ d.dispose();
+ }
+
+ /**
+ * Block, just a simple rectangle
+ * @author jpeterka
+ *
+ */
+ class Block {
+ public boolean invalid = false;
+
+ public int x,y,width,height;
+
+ public Block(int x, int y, int width, int height) {
+ this.x = x;
+ this.y = y;
+ this.width = width;
+ this.height = height;
+ }
+ }
+}
Property changes on: trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/gef/SWTArranger.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/gef/SWTBotGefEditorExt.java
===================================================================
--- trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/gef/SWTBotGefEditorExt.java (rev 0)
+++ trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/gef/SWTBotGefEditorExt.java 2010-12-21 09:19:27 UTC (rev 27627)
@@ -0,0 +1,106 @@
+/*******************************************************************************
+ * Copyright (c) 2007-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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.ui.bot.ext.gef;
+
+import org.eclipse.draw2d.FigureCanvas;
+import org.eclipse.gef.GraphicalViewer;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swtbot.eclipse.gef.finder.SWTGefBot;
+import org.eclipse.swtbot.eclipse.gef.finder.widgets.SWTBotGefEditor;
+import org.eclipse.swtbot.eclipse.gef.finder.widgets.SWTBotGefFigureCanvas;
+import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable;
+import org.eclipse.swtbot.swt.finder.results.Result;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotText;
+
+/**
+ * Extended version of gef editor, it wraps SWTBotGefEditor and provides api
+ * needed for gef tests which are hardly reached from standard gef editor
+ * @author jpeterka
+ *
+ */
+public class SWTBotGefEditorExt {
+ SWTGefBot bot;
+ SWTBotGefEditor editor;
+ SWTBotGefMouse mouse;
+
+ /**
+ * Default constructor
+ */
+ public SWTBotGefEditorExt(String title) {
+ this.bot = new SWTGefBot();
+ this.editor = bot.gefEditor(title);
+ this.mouse = new SWTBotGefMouse(editor.bot(),
+ SWTBotGefFinder.findCanvas(editor));
+ }
+
+
+ /**
+ * Insert entity from tool bar on given position
+ */
+ public void insertEntity(String title, int x, int y) {
+ editor.activateTool(title);
+ editor.click(x, y);
+ }
+
+ /**
+ * get label figure
+ */
+ public SWTBotGefFigure labelFigure(String label) {
+ SWTBotGefFigure rf = getRootFigure();
+ SWTBotGefFigure lf = rf.labelFigure(label);
+ return lf;
+ }
+
+ /**
+ * set text to label figure
+ */
+ public void setLabelText(SWTBotGefFigure figure, String str) {
+ editor.select(figure.getText());
+ mouse.moveAndClick(figure);
+ SWTBotGefFigureCanvas canvas = SWTBotGefFinder.findCanvas(editor);
+ SWTBotText text = bot.text(0);
+ canvas.typeText(text.widget, str);
+ }
+
+ /**
+ * return root figure
+ */
+ public SWTBotGefFigure getRootFigure() {
+ SWTBotGefViewerExt viewer = new SWTBotGefViewerExt(editor);
+ SWTBotGefFigure rf = viewer.getRootFigure();
+ return rf;
+ }
+
+ /**
+ * returns canvas bounds
+ */
+ public Rectangle getCanvasBounds() {
+ Rectangle ret = UIThreadRunnable.syncExec(new Result<Rectangle>() {
+ @Override
+ public Rectangle run() {
+ GraphicalViewer viewer = SWTBotGefFinder.getViewer(editor);
+ FigureCanvas fc = (FigureCanvas) viewer.getControl();
+ Rectangle r = fc.getBounds();
+ return r;
+ }
+ });
+ return ret;
+ }
+
+ // ---- Wrappers
+ /**
+ * saves editor
+ */
+ public void save() {
+ editor.save();
+ }
+}
Property changes on: trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/gef/SWTBotGefEditorExt.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/gef/SWTBotGefFigure.java
===================================================================
--- trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/gef/SWTBotGefFigure.java 2010-12-21 09:12:49 UTC (rev 27626)
+++ trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/gef/SWTBotGefFigure.java 2010-12-21 09:19:27 UTC (rev 27627)
@@ -18,13 +18,7 @@
import org.eclipse.draw2d.Label;
import org.eclipse.draw2d.geometry.Point;
import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.gef.GraphicalEditPart;
-import org.eclipse.swtbot.eclipse.gef.finder.widgets.SWTBotGefEditPart;
-import org.eclipse.swtbot.eclipse.gef.finder.widgets.SWTBotGefEditor;
-import org.eclipse.swtbot.eclipse.gef.finder.widgets.SWTBotGefFigureCanvas;
-import org.eclipse.swtbot.swt.finder.SWTBot;
import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotText;
/**
* Gef figure bot controler. It performs actions which are missing or works
@@ -37,31 +31,12 @@
private IFigure figure;
private Logger log = Logger.getLogger(SWTBotGefFigure.class);
- private SWTBotGefEditor editor;
- private SWTBot bot;
- private SWTBotGefFigureCanvas canvas;
- private SWTBotGefEditPart part;
- private SWTBotGefFigure(SWTBotGefEditor editor, SWTBotGefEditPart part,
- IFigure figure) {
- this.editor = editor;
- this.bot = editor.bot();
- this.canvas = SWTBotGefFinder.findCanvas(editor);
- this.part = part;
+ public SWTBotGefFigure(IFigure figure) {
this.figure = figure;
}
/**
- * Default Constructor, requires gef editor and gef part
- *
- * @param editor
- * @param part
- */
- public SWTBotGefFigure(SWTBotGefEditor editor, SWTBotGefEditPart part) {
- this(editor, part, ((GraphicalEditPart) part.part()).getFigure());
- }
-
- /**
* Return figures bounds
*/
public Rectangle getBounds() {
@@ -135,7 +110,7 @@
Label label = (Label) figure;
log.info(label.getText());
if (label.getText().equalsIgnoreCase(string))
- return new SWTBotGefFigure(editor, part, label);
+ return new SWTBotGefFigure(figure);
}
}
throw new WidgetNotFoundException("No Label with " + string + " found");
@@ -153,18 +128,6 @@
throw new WidgetNotFoundException("Widget is not Label type");
}
- /**
- * Performs setText action for Label figure in GEF editor
- *
- * @param str
- */
- public void setText(String str) {
- part.select();
- SWTBotGefMouse mouse = new SWTBotGefMouse(bot, canvas);
- mouse.moveAndClick(this);
- SWTBotText text = bot.text(0);
- canvas.typeText(text.widget, str);
- }
private void getSubFigures(IFigure figure, List<IFigure> figures) {
@SuppressWarnings("unchecked")
Modified: trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/gef/SWTBotGefFinder.java
===================================================================
--- trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/gef/SWTBotGefFinder.java 2010-12-21 09:12:49 UTC (rev 27626)
+++ trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/gef/SWTBotGefFinder.java 2010-12-21 09:19:27 UTC (rev 27627)
@@ -19,6 +19,7 @@
import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable;
import org.eclipse.swtbot.swt.finder.results.Result;
import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IEditorReference;
/**
* SWTBotGefProvider provides some often conversion tasks for getting
@@ -57,5 +58,21 @@
}
return canvas;
}
+
+ /**
+ * Returns graphical viewer from editor
+ */
+ public static GraphicalViewer getViewer(final SWTBotGefEditor editor)
+ {
+ GraphicalViewer graphicalViewer = UIThreadRunnable.syncExec(new Result<GraphicalViewer>() {
+ public GraphicalViewer run() {
+ IEditorReference partReference = editor.getReference();
+ final IEditorPart editor = partReference.getEditor(true);
+ return (GraphicalViewer) editor.getAdapter(GraphicalViewer.class);
+ }
+ });
+
+ return graphicalViewer;
+ }
}
Modified: trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/gef/SWTBotGefMouse.java
===================================================================
--- trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/gef/SWTBotGefMouse.java 2010-12-21 09:12:49 UTC (rev 27626)
+++ trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/gef/SWTBotGefMouse.java 2010-12-21 09:19:27 UTC (rev 27627)
@@ -61,6 +61,7 @@
canvas().getDisplay().post(event);
}
});
+ bot.sleep(SLEEP);
}
/**
@@ -83,8 +84,16 @@
move(figure);
click();
}
-
+
/**
+ * Moves and left mouse click on given position
+ */
+ public void moveAndClick(int x, int y) {
+ move(x,y);
+ click();
+ }
+
+ /**
* Calculates element position to display, call it from UI thread
*/
private void getDisplayPosition(final Point point,
@@ -104,6 +113,24 @@
}
/**
+ * Moves on position related to canvas position
+ */
+ public void moveCanvas(int x, int y) {
+
+ final Point p = new Point();
+ UIThreadRunnable.syncExec(new VoidResult() {
+ public void run() {
+ p.x = canvas().toDisplay(0,0).x;
+ p.y = canvas().toDisplay(0,0).y;
+
+ log.info("Canvas position on display is :" + p.x + "," + p.y);
+ }
+ });
+
+ move(p.x + x, p.y + y);
+ }
+
+ /**
* Left click on give position
*/
public void click() {
Added: trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/gef/SWTBotGefViewerExt.java
===================================================================
--- trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/gef/SWTBotGefViewerExt.java (rev 0)
+++ trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/gef/SWTBotGefViewerExt.java 2010-12-21 09:19:27 UTC (rev 27627)
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * Copyright (c) 2007-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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.ui.bot.ext.gef;
+
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.GraphicalViewer;
+import org.eclipse.gef.RootEditPart;
+import org.eclipse.swtbot.eclipse.gef.finder.widgets.SWTBotGefEditor;
+import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
+import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable;
+import org.eclipse.swtbot.swt.finder.results.Result;
+
+/**
+ * Provides SWTBot Gef support related to Gef Viewer
+ * @author jpeterka
+ *
+ */
+public class SWTBotGefViewerExt {
+
+ GraphicalViewer graphicalViewer;
+
+ public SWTBotGefViewerExt(SWTBotGefEditor editor) {
+ graphicalViewer = SWTBotGefFinder.getViewer(editor);
+ }
+
+ /**
+ * Returns root figure
+ * @return
+ */
+ public SWTBotGefFigure getRootFigure() {
+ SWTBotGefFigure ret = UIThreadRunnable.syncExec(new Result<SWTBotGefFigure>() {
+
+ @Override
+ public SWTBotGefFigure run() {
+ RootEditPart root = graphicalViewer.getRootEditPart().getRoot();
+ if (root instanceof GraphicalEditPart) {
+ GraphicalEditPart gep = (GraphicalEditPart)root;
+ SWTBotGefFigure figure = new SWTBotGefFigure(gep.getFigure());
+ return figure;
+ }
+ else {
+ throw new WidgetNotFoundException("Can't get root figure");
+ }
+ }
+ });
+ return ret;
+ }
+
+}
Property changes on: trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/gef/SWTBotGefViewerExt.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
14 years
JBoss Tools SVN: r27626 - trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper.
by jbosstools-commits@lists.jboss.org
Author: jpeterka
Date: 2010-12-21 04:12:49 -0500 (Tue, 21 Dec 2010)
New Revision: 27626
Added:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/StringHelper.java
Log:
Added support for searching string position in text editor for bot tests
Added: trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/StringHelper.java
===================================================================
--- trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/StringHelper.java (rev 0)
+++ trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/StringHelper.java 2010-12-21 09:12:49 UTC (rev 27626)
@@ -0,0 +1,112 @@
+/*******************************************************************************
+ * Copyright (c) 2007-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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.ui.bot.ext.helper;
+
+import static org.junit.Assert.fail;
+import org.eclipse.swt.graphics.Point;
+
+/**
+ * Class provides api for search position in text editor, designed for usage with swtbot
+ *
+ * @author jpeterka
+ *
+ */
+public class StringHelper {
+ String text;
+
+ /**
+ * Default constructor
+ *
+ * @param text
+ * - given tex editor text
+ */
+ public StringHelper(String text) {
+ this.text = text;
+ }
+
+ /**
+ * Returns position before string fragment in the text
+ *
+ * @param fragment
+ * text fragment
+ * @return position
+ */
+ public Point getPositionBefore(String fragment) {
+ return getPosition(fragment);
+ }
+
+ /**
+ * Returns position after string fragment in the text
+ *
+ * @param fragment
+ * text fragment
+ * @return position
+ */
+ public Point getPositionAfter(String fragment) {
+ Point p = getPosition(fragment);
+ return new Point(p.x + fragment.length() - 1, p.y);
+ }
+
+ private Point getPosition(String fragment) {
+ Point p = new Point(0, 0);
+
+ int index = text.indexOf(fragment);
+ if (index != -1) {
+ p = getRowCount(index);
+ } else
+ fail("Can't find required fragment: " + fragment);
+
+ return p;
+ }
+
+ private Point getRowCount(int lastIndex) {
+ int rowCount = 0;
+ boolean finished = false;
+ int colIndex = 0;
+ int prevLinePos = 0;
+ int newLinePos = 0;
+
+ while (!finished) {
+
+ newLinePos = text.indexOf('\n', newLinePos);
+ if ((newLinePos != -1) && (newLinePos < lastIndex)) {
+ rowCount++;
+ prevLinePos = newLinePos;
+ newLinePos = newLinePos + 1;
+ } else {
+ if (newLinePos == -1) {
+ colIndex = text.length() - lastIndex;
+ } else {
+ colIndex = lastIndex - prevLinePos - 1;
+ }
+ finished = true;
+ }
+ }
+
+ return new Point(colIndex, rowCount);
+ }
+
+ /** Debug only **/
+ public static void main(String[] args) {
+ String s = "<html>\n <body>\nHello World\n </body>\n</html>";
+ StringHelper helper = new StringHelper(s);
+ String search = "<body>";
+ Point p = helper.getPositionAfter(search);
+ System.out.println(s);
+ System.out.println("Searching for..." + search);
+ System.out.println(p.toString());
+ search = "boasdfdy>";
+ System.out.println("Searching for..." + search);
+ p = helper.getPositionAfter(search);
+ System.out.println(p.toString());
+ }
+}
Property changes on: trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/StringHelper.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
14 years
JBoss Tools SVN: r27625 - trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper.
by jbosstools-commits@lists.jboss.org
Author: jpeterka
Date: 2010-12-21 04:06:23 -0500 (Tue, 21 Dec 2010)
New Revision: 27625
Modified:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/DatabaseHelper.java
Log:
Added methods for db dialect and drivername resolution for bot tests
Modified: trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/DatabaseHelper.java
===================================================================
--- trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/DatabaseHelper.java 2010-12-21 09:03:39 UTC (rev 27624)
+++ trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/DatabaseHelper.java 2010-12-21 09:06:23 UTC (rev 27625)
@@ -291,6 +291,59 @@
}
/**
+ * Resolves db type for eclipse usage in SQL editor
+ *
+ * @param type
+ * @return
+ */
+ public static String getDialect(DBType type) {
+ // TODO verify values
+ String ret = "";
+ switch (type) {
+ case hsqldb18:
+ ret = "HSQL";
+ break;
+ case db2_97:
+ ret = "DB2 UDB_V9.1";
+ break;
+ case mssql2005:
+ ret = "SQL Server_2005";
+ break;
+ case mssql2008:
+ ret = "SQL Server_2008";
+ break;
+ case mysql50:
+ ret = "MySQL_5.0";
+ break;
+ case mysql51:
+ ret = "MySQL 5";
+ break;
+ case oracle10g:
+ ret = "Oracle_10";
+ break;
+ case oracle11gR1: // Intentionally empty
+ case oracle11gR1RAC: // Intentionally empty
+ case oracle11gR2: // Intentionally empty
+ case oracle11gR2RAC:
+ ret = "Oracle_11";
+ break;
+ case postgresql82: // Intentionally empty
+ case postgresql83: // Intentionally empty
+ case postgresql84:
+ ret = "PostgreSQL";
+ break;
+ case sybase15:
+ ret = "Sybase_ASE_15.x";
+ break;
+ default:
+ fail("Unknown db type");
+ break;
+ }
+ return ret;
+ }
+
+
+ /**
* Run HSQLDB database in server mode
* @param file
* @param dbname
@@ -375,4 +428,50 @@
if (outChannel != null) outChannel.close();
log.info("Driver hsqldb.jar copied");
}
+
+ public static String getDriverClass(DBType type) {
+ // TODO verify values
+ String ret = "";
+ switch (type) {
+ case hsqldb18:
+ ret = "org.hsqldb.jdbcDriver";
+ break;
+ case db2_97:
+ ret = "DB2 UDB_V9.1";
+ break;
+ case mssql2005:
+ ret = "SQL Server_2005";
+ break;
+ case mssql2008:
+ ret = "SQL Server_2008";
+ break;
+ case mysql50:
+ ret = "com.mysql.jdbc.Driver";
+ break;
+ case mysql51:
+ ret = "com.mysql.jdbc.Driver";
+ break;
+ case oracle10g:
+ ret = "Oracle_10";
+ break;
+ case oracle11gR1: // Intentionally empty
+ case oracle11gR1RAC: // Intentionally empty
+ case oracle11gR2: // Intentionally empty
+ case oracle11gR2RAC:
+ ret = "Oracle_11";
+ break;
+ case postgresql82: // Intentionally empty
+ case postgresql83: // Intentionally empty
+ case postgresql84:
+ ret = "org.postgresql.Driver";
+ break;
+ case sybase15:
+ ret = "Sybase_ASE_15.x";
+ break;
+ default:
+ fail("Unknown db type");
+ break;
+ }
+ return ret;
+ }
}
14 years
JBoss Tools SVN: r27624 - trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config.
by jbosstools-commits@lists.jboss.org
Author: jpeterka
Date: 2010-12-21 04:03:39 -0500 (Tue, 21 Dec 2010)
New Revision: 27624
Modified:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/ServerBean.java
Log:
Added method returning Runtime name into ServerBean
Modified: trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/ServerBean.java
===================================================================
--- trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/ServerBean.java 2010-12-21 08:55:38 UTC (rev 27623)
+++ trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/ServerBean.java 2010-12-21 09:03:39 UTC (rev 27624)
@@ -40,4 +40,12 @@
return String.format("Server type=%s,version=%s,home=%s,withJava=%s", this.type,this.version,this.runtimeHome,this.withJavaVersion);
}
+ /**
+ * Returns server runtime name ([type]-[version])
+ * @return server runtime name
+ */
+ public String getName() {
+ return type + "-" + version;
+ }
+
}
14 years
JBoss Tools SVN: r27623 - trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands.
by jbosstools-commits@lists.jboss.org
Author: Grid.Qian
Date: 2010-12-21 03:55:38 -0500 (Tue, 21 Dec 2010)
New Revision: 27623
Modified:
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/ClientSampleCreationCommand.java
Log:
JBIDE-7925: handle the primary type for web service client
Modified: trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/ClientSampleCreationCommand.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/ClientSampleCreationCommand.java 2010-12-20 23:29:02 UTC (rev 27622)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/ClientSampleCreationCommand.java 2010-12-21 08:55:38 UTC (rev 27623)
@@ -32,6 +32,8 @@
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jdt.core.dom.MethodDeclaration;
import org.eclipse.jdt.core.dom.NormalAnnotation;
+import org.eclipse.jdt.core.dom.PrimitiveType;
+import org.eclipse.jdt.core.dom.PrimitiveType.Code;
import org.eclipse.jdt.core.dom.SingleVariableDeclaration;
import org.eclipse.jdt.core.dom.TypeDeclaration;
import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation;
@@ -64,6 +66,7 @@
@Override
public IStatus execute(IProgressMonitor monitor, IAdaptable info)
throws ExecutionException {
+ argsNum = 0;
IStatus status = Status.OK_STATUS;
IJavaProject project = null;
try {
@@ -93,19 +96,19 @@
return status;
}
- List<String> packageList = new LinkedList<String>();
- for (ICompilationUnit unit : clientUnits) {
- if (!packageList.contains(unit.getParent().getElementName())) {
- packageList.add(unit.getParent().getElementName());
- }
+ List<String> packageList = new LinkedList<String>();
+ for (ICompilationUnit unit : clientUnits) {
+ if (!packageList.contains(unit.getParent().getElementName())) {
+ packageList.add(unit.getParent().getElementName());
}
- for (int j = 0; j < packageList.size(); j++) {
- status = createImplClass(packageList.get(j), project,
- clientUnits, serviceUnits);
- if (!status.isOK()) {
- break;
- }
+ }
+ for (int j = 0; j < packageList.size(); j++) {
+ status = createImplClass(packageList.get(j), project, clientUnits,
+ serviceUnits);
+ if (!status.isOK()) {
+ break;
}
+ }
return status;
}
@@ -141,7 +144,7 @@
sb.append(LINE_SEPARATOR);
sb.append(" System.out.println(\"***********************\");"); //$NON-NLS-1$
sb.append(LINE_SEPARATOR);
- createWebServiceClient(clientUnits, serviceUnits, sb,packageName);
+ createWebServiceClient(clientUnits, serviceUnits, sb, packageName);
sb.append(" System.out.println(\"***********************\");"); //$NON-NLS-1$
sb.append(LINE_SEPARATOR);
sb.append(" System.out.println(\"").append( //$NON-NLS-1$
@@ -157,10 +160,117 @@
return StatusUtils
.errorStatus(JBossWSCreationCoreMessages.Error_Create_Client_Sample);
}
+ System.out.println(sb.toString());
return Status.OK_STATUS;
}
/**
+ * create a java class
+ *
+ * @param packageName
+ * @param className
+ * @param isInterface
+ * @param interfaceName
+ * @param javaProject
+ * @return
+ */
+ public ICompilationUnit createJavaClass(String packageName,
+ String className, boolean isInterface, String interfaceName,
+ IJavaProject javaProject) {
+ try {
+ IPath srcPath = new Path(
+ JBossWSCreationUtils.getJavaProjectSrcLocation(javaProject
+ .getProject()));
+ srcPath = javaProject.getPath().append(
+ srcPath.makeRelativeTo(javaProject.getProject()
+ .getLocation()));
+ IPackageFragmentRoot root = javaProject
+ .findPackageFragmentRoot(srcPath);
+ if (packageName == null) {
+ packageName = ""; //$NON-NLS-1$
+ }
+ IPackageFragment pkg = root.createPackageFragment(packageName,
+ false, null);
+ ICompilationUnit wrapperCls = pkg.createCompilationUnit(className
+ + ".java", "", true, null); //$NON-NLS-1$//$NON-NLS-2$
+ if (!packageName.equals("")) { //$NON-NLS-1$
+ wrapperCls.createPackageDeclaration(packageName, null);
+ }
+
+ String clsContent = ""; //$NON-NLS-1$
+ if (isInterface) {
+ clsContent = "public interface " + className + " {" //$NON-NLS-1$ //$NON-NLS-2$
+ + LINE_SEPARATOR;
+ clsContent += "}" + LINE_SEPARATOR; //$NON-NLS-1$
+ } else {
+ clsContent = "public class " + className; //$NON-NLS-1$
+ if (interfaceName != null) {
+ clsContent += " implements " + interfaceName; //$NON-NLS-1$
+ }
+ clsContent += " {" + LINE_SEPARATOR; //$NON-NLS-1$
+ clsContent += "}" + LINE_SEPARATOR; //$NON-NLS-1$
+ }
+ wrapperCls.createType(clsContent, null, true, null);
+
+ wrapperCls.save(null, true);
+ return wrapperCls;
+ } catch (Exception e) {
+ JBossWSCreationCorePlugin.getDefault().logError(e);
+ return null;
+ }
+ }
+
+ /**
+ * create a code block used to new a web service client
+ *
+ * @param clientUnits
+ * @param serviceUnits
+ * @param sb
+ */
+ private void createWebServiceClient(List<ICompilationUnit> clientUnits,
+ List<ICompilationUnit> serviceUnits, StringBuffer sb,
+ String packageName) {
+ sb.append(" System.out.println(\"" //$NON-NLS-1$
+ + "Create Web Service Client...\");"); //$NON-NLS-1$
+ sb.append(LINE_SEPARATOR);
+ for (ICompilationUnit unit : clientUnits) {
+ // parse the unit
+ if (!packageName.equals(unit.getParent().getElementName())) {
+ continue;
+ }
+ ASTParser parser = ASTParser.newParser(AST.JLS3);
+ parser.setSource(unit);
+ parser.setResolveBindings(false);
+ parser.setFocalPosition(0);
+ CompilationUnit result = (CompilationUnit) parser.createAST(null);
+ @SuppressWarnings("rawtypes")
+ List types = result.types();
+ TypeDeclaration typeDec = (TypeDeclaration) types.get(0);
+ sb.append(" " + typeDec.getName()); //$NON-NLS-1$
+ sb.append(" service").append(serviceNum).append(" = new "); //$NON-NLS-1$ //$NON-NLS-2$
+ sb.append(typeDec.getName());
+ sb.append("();"); //$NON-NLS-1$
+ sb.append(LINE_SEPARATOR);
+
+ MethodDeclaration methodDec[] = typeDec.getMethods();
+
+ // create web service from web serivce client methods
+ for (MethodDeclaration method : methodDec) {
+ if (method.modifiers().get(0) instanceof NormalAnnotation) {
+ NormalAnnotation anno = (NormalAnnotation) method
+ .modifiers().get(0);
+ if (anno.getTypeName().getFullyQualifiedName()
+ .equals(JBossWSCreationCoreMessages.WebEndpoint)) {
+ createWebService(serviceUnits, method, sb);
+ portNum += 1;
+ }
+ }
+ }
+ serviceNum += 1;
+ }
+ }
+
+ /**
* create a code block used to new a web service from a method of web
* service client
*
@@ -247,132 +357,61 @@
* @param sb
* @param j
*/
+ @SuppressWarnings("static-access")
private boolean createWebServiceOperationParameters(
@SuppressWarnings("rawtypes") List list, StringBuffer sb, int j) {
SingleVariableDeclaration para = (SingleVariableDeclaration) list
.get(j);
-
- if ("String".equals(para.getType().toString())) { //$NON-NLS-1$
- sb.append("args[").append(argsNum).append("]"); //$NON-NLS-1$ //$NON-NLS-2$
- if (j != list.size() - 1) {
- sb.append(","); //$NON-NLS-1$
+ if (para.getType().isPrimitiveType()) {
+ PrimitiveType type = (PrimitiveType) para.getType();
+ Code code = type.getPrimitiveTypeCode();
+ if (type.INT.equals(code)) {
+ sb.append("Integer.parseInt(args["); //$NON-NLS-1$
+ } else if (type.BOOLEAN.equals(code)) {
+ sb.append("Boolean.parseBoolean(args["); //$NON-NLS-1$
+ } else if (type.BYTE.equals(code)) {
+ sb.append("Byte.parseByte(args["); //$NON-NLS-1$
+ } else if (type.SHORT.equals(code)) {
+ sb.append("Short.parseShort((args["); //$NON-NLS-1$
+ } else if (type.LONG.equals(code)) {
+ sb.append("Long.parseLong(args["); //$NON-NLS-1$
+ } else if (type.FLOAT.equals(code)) {
+ sb.append("Float.parseFloat(args["); //$NON-NLS-1$
+ } else if (type.DOUBLE.equals(code)) {
+ sb.append("Double.parseDouble(args["); //$NON-NLS-1$
+ } else {
+ if (type.CHAR.equals(code)) {
+ sb.append("args[").append(argsNum).append("]"); //$NON-NLS-1$ //$NON-NLS-2$
+ countArgs(j, sb, list);
+ argsNum += 1;
+ }
+ return true;
}
+ sb.append(argsNum).append("])"); //$NON-NLS-1$
+ countArgs(j, sb, list);
argsNum += 1;
+ System.out.println(argsNum);
return true;
+ } else if ("String".equals(para.getType().toString())) { //$NON-NLS-1$
+ sb.append("args[").append(argsNum).append("]"); //$NON-NLS-1$ //$NON-NLS-2$
+ countArgs(j, sb, list);
+ argsNum += 1;
+ System.out.println(argsNum);
+ return true;
}
-
if (list.get(j) instanceof Object) {
sb.append("null"); //$NON-NLS-1$
- if (j != list.size() - 1) {
- sb.append(","); //$NON-NLS-1$
- }
+ countArgs(j, sb, list);
return false;
}
return true;
-
}
- /**
- * create a code block used to new a web service client
- *
- * @param clientUnits
- * @param serviceUnits
- * @param sb
- */
- private void createWebServiceClient(List<ICompilationUnit> clientUnits,List<ICompilationUnit> serviceUnits, StringBuffer sb,String packageName) {
- sb.append(" System.out.println(\"" //$NON-NLS-1$
- + "Create Web Service Client...\");"); //$NON-NLS-1$
- sb.append(LINE_SEPARATOR);
- for (ICompilationUnit unit : clientUnits) {
- // parse the unit
- if(!packageName.equals(unit.getParent().getElementName())){
- continue;
- }
- ASTParser parser = ASTParser.newParser(AST.JLS3);
- parser.setSource(unit);
- parser.setResolveBindings(false);
- parser.setFocalPosition(0);
- CompilationUnit result = (CompilationUnit) parser.createAST(null);
- @SuppressWarnings("rawtypes")
- List types = result.types();
- TypeDeclaration typeDec = (TypeDeclaration) types.get(0);
- sb.append(" " + typeDec.getName()); //$NON-NLS-1$
- sb.append(" service").append(serviceNum).append(" = new "); //$NON-NLS-1$ //$NON-NLS-2$
- sb.append(typeDec.getName());
- sb.append("();"); //$NON-NLS-1$
- sb.append(LINE_SEPARATOR);
-
- MethodDeclaration methodDec[] = typeDec.getMethods();
-
- // create web service from web serivce client methods
- for (MethodDeclaration method : methodDec) {
- if (method.modifiers().get(0) instanceof NormalAnnotation) {
- NormalAnnotation anno = (NormalAnnotation) method
- .modifiers().get(0);
- if (anno.getTypeName().getFullyQualifiedName()
- .equals(JBossWSCreationCoreMessages.WebEndpoint)) {
- createWebService(serviceUnits, method, sb);
- portNum += 1;
- }
- }
- }
- serviceNum += 1;
+ private void countArgs(int j, StringBuffer sb,
+ @SuppressWarnings("rawtypes") List list) {
+ if (j != list.size() - 1) {
+ sb.append(","); //$NON-NLS-1$
}
}
- /**
- * create a java class
- *
- * @param packageName
- * @param className
- * @param isInterface
- * @param interfaceName
- * @param javaProject
- * @return
- */
- public ICompilationUnit createJavaClass(String packageName,
- String className, boolean isInterface, String interfaceName,
- IJavaProject javaProject) {
- try {
- IPath srcPath = new Path(
- JBossWSCreationUtils.getJavaProjectSrcLocation(javaProject
- .getProject()));
- srcPath = javaProject.getPath().append(
- srcPath.makeRelativeTo(javaProject.getProject()
- .getLocation()));
- IPackageFragmentRoot root = javaProject
- .findPackageFragmentRoot(srcPath);
- if (packageName == null) {
- packageName = ""; //$NON-NLS-1$
- }
- IPackageFragment pkg = root.createPackageFragment(packageName,
- false, null);
- ICompilationUnit wrapperCls = pkg.createCompilationUnit(className
- + ".java", "", true, null); //$NON-NLS-1$//$NON-NLS-2$
- if (!packageName.equals("")) { //$NON-NLS-1$
- wrapperCls.createPackageDeclaration(packageName, null);
- }
-
- String clsContent = ""; //$NON-NLS-1$
- if (isInterface) {
- clsContent = "public interface " + className + " {" //$NON-NLS-1$ //$NON-NLS-2$
- + LINE_SEPARATOR;
- clsContent += "}" + LINE_SEPARATOR; //$NON-NLS-1$
- } else {
- clsContent = "public class " + className; //$NON-NLS-1$
- if (interfaceName != null) {
- clsContent += " implements " + interfaceName; //$NON-NLS-1$
- }
- clsContent += " {" + LINE_SEPARATOR; //$NON-NLS-1$
- clsContent += "}" + LINE_SEPARATOR; //$NON-NLS-1$
- }
- wrapperCls.createType(clsContent, null, true, null);
-
- wrapperCls.save(null, true);
- return wrapperCls;
- } catch (Exception e) {
- JBossWSCreationCorePlugin.getDefault().logError(e);
- return null;
- }
- }
}
14 years
JBoss Tools SVN: r27622 - trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/actions.
by jbosstools-commits@lists.jboss.org
Author: snjeza
Date: 2010-12-20 18:29:02 -0500 (Mon, 20 Dec 2010)
New Revision: 27622
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/actions/ExploreUtils.java
Log:
JBIDE-7831 Explore action doesn't work when server deployment directory contains space character
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/actions/ExploreUtils.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/actions/ExploreUtils.java 2010-12-20 19:38:03 UTC (rev 27621)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/actions/ExploreUtils.java 2010-12-20 23:29:02 UTC (rev 27622)
@@ -20,10 +20,8 @@
import org.eclipse.core.runtime.Status;
import org.eclipse.wst.server.core.IModule;
import org.eclipse.wst.server.core.IServer;
-import org.eclipse.wst.server.core.IServerWorkingCopy;
import org.jboss.ide.eclipse.as.core.publishers.PublishUtil;
import org.jboss.ide.eclipse.as.core.server.IDeployableServer;
-import org.jboss.ide.eclipse.as.core.server.internal.ServerAttributeHelper;
import org.jboss.ide.eclipse.as.core.util.ServerConverter;
import org.jboss.ide.eclipse.as.ui.JBossServerUIPlugin;
import org.jboss.ide.eclipse.as.ui.Messages;
@@ -40,6 +38,7 @@
public final static String EXPLORE_DESCRIPTION = Messages.ExploreUtils_Description;
private static String exploreFolderCommand;
private static String[] exploreFolderCommandArray;
+ private static String[] exploreFileCommandArray;
private static String exploreFileCommand;
public static String getExploreCommand() {
@@ -62,11 +61,24 @@
private static void setExploreCommands() {
if (Platform.OS_MACOSX.equals(Platform.getOS())) {
exploreFolderCommandArray = new String[] {"/usr/bin/open", "-a", "/System/Library/CoreServices/Finder.app", ""}; //$NON-NLS-1$ //$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$
- exploreFolderCommand = "";
+ exploreFolderCommand = ""; //$NON-NLS-1$
} else if (Platform.OS_WIN32.equals(Platform.getOS())) {
- exploreFolderCommand = "cmd /C start explorer /root,/e,\"" //$NON-NLS-1$
+ exploreFolderCommandArray = new String[5];
+ exploreFolderCommandArray[0]= "cmd"; //$NON-NLS-1$
+ exploreFolderCommandArray[1]= "/C"; //$NON-NLS-1$
+ exploreFolderCommandArray[2]= "start"; //$NON-NLS-1$
+ exploreFolderCommandArray[3]= "explorer"; //$NON-NLS-1$
+
+ exploreFileCommandArray = new String[6];
+ exploreFileCommandArray[0]= "cmd"; //$NON-NLS-1$
+ exploreFileCommandArray[1]= "/C"; //$NON-NLS-1$
+ exploreFileCommandArray[2]= "start"; //$NON-NLS-1$
+ exploreFileCommandArray[3]= "explorer"; //$NON-NLS-1$
+ exploreFileCommandArray[4]= "/select,"; //$NON-NLS-1$
+
+ exploreFolderCommand = "cmd /C start explorer \"" //$NON-NLS-1$
+ PATH + "\""; //$NON-NLS-1$
- exploreFileCommand = "cmd /C start explorer /select,/e,\"" //$NON-NLS-1$
+ exploreFileCommand = "cmd /C start explorer /select,\"" //$NON-NLS-1$
+ PATH + "\""; //$NON-NLS-1$
} else if (Platform.OS_LINUX.equals(Platform.getOS())) {
@@ -89,7 +101,7 @@
if (server != null && deployableServer != null) {
return deployableServer.getDeployFolder();
}
- return server.getAttribute(IDeployableServer.DEPLOY_DIRECTORY, "").trim();
+ return server.getAttribute(IDeployableServer.DEPLOY_DIRECTORY, "").trim(); //$NON-NLS-1$
}
public static boolean canExplore(IServer server) {
@@ -122,7 +134,6 @@
if (Platform.getOS().equals(Platform.OS_WIN32)) {
name = name.replace('/', '\\');
}
-
try {
if (Platform.OS_LINUX.equals(Platform.getOS()) || Platform.OS_MACOSX.equals(Platform.getOS())) {
int len = exploreFolderCommandArray.length;
@@ -130,8 +141,15 @@
exploreFolderCommandArray[len-1] = name2;
Runtime.getRuntime().exec(exploreFolderCommandArray);
} else if (Platform.getOS().equals(Platform.OS_WIN32)) {
- command = command.replace(ExploreUtils.PATH, name);
- Runtime.getRuntime().exec(command);
+ if (file.isDirectory()) {
+ int len = exploreFolderCommandArray.length;
+ exploreFolderCommandArray[len-1] = "\"" + name + "\""; //$NON-NLS-1$ //$NON-NLS-2$
+ Runtime.getRuntime().exec(exploreFolderCommandArray);
+ } else {
+ int len = exploreFileCommandArray.length;
+ exploreFileCommandArray[len-1] = "\"" + name + "\""; //$NON-NLS-1$ //$NON-NLS-2$
+ Runtime.getRuntime().exec(exploreFileCommandArray);
+ }
} else {
command = command.replace(ExploreUtils.PATH, name);
if (JBossServerUIPlugin.getDefault().isDebugging()) {
@@ -148,6 +166,9 @@
public static IPath getDeployPath(IDeployableServer server,IModule[] moduleTree) {
IPath fullPath = PublishUtil.getDeployPath(moduleTree, server);
+ if (Platform.getOS().equals(Platform.OS_WIN32)) {
+ return fullPath;
+ }
if( !PublishUtil.isBinaryObject(moduleTree)) {
return fullPath;
}
14 years
JBoss Tools SVN: r27621 - trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/properties.
by jbosstools-commits@lists.jboss.org
Author: bbrodt
Date: 2010-12-20 14:38:03 -0500 (Mon, 20 Dec 2010)
New Revision: 27621
Modified:
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/properties/InvokeImplSection.java
Log:
https://issues.jboss.org/browse/JBIDE-7861
Modified: trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/properties/InvokeImplSection.java
===================================================================
--- trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/properties/InvokeImplSection.java 2010-12-20 18:08:30 UTC (rev 27620)
+++ trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/properties/InvokeImplSection.java 2010-12-20 19:38:03 UTC (rev 27621)
@@ -52,6 +52,9 @@
import org.eclipse.bpel.ui.details.providers.PartnerRoleFilter;
import org.eclipse.bpel.ui.details.providers.WSDLFaultContentProvider;
import org.eclipse.bpel.ui.details.tree.ITreeNode;
+import org.eclipse.bpel.ui.details.tree.OperationTreeNode;
+import org.eclipse.bpel.ui.details.tree.PartnerLinkTreeNode;
+import org.eclipse.bpel.ui.details.tree.TreeNode;
import org.eclipse.bpel.ui.dialogs.PartnerLinkRoleSelectorDialog;
import org.eclipse.bpel.ui.dialogs.PartnerLinkTypeSelectorDialog;
import org.eclipse.bpel.ui.proposal.providers.ModelContentProposalProvider;
@@ -89,6 +92,7 @@
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Text;
import org.eclipse.swt.widgets.Tree;
+import org.eclipse.swt.widgets.TreeItem;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.forms.events.HyperlinkAdapter;
import org.eclipse.ui.forms.events.HyperlinkEvent;
@@ -132,6 +136,8 @@
private Composite faultComposite;
private Label faultLabel;
private Text faultText;
+ // https://issues.jboss.org/browse/JBIDE-7861
+ private boolean ignoreQuickPickSelection = false;
private IControlContentAdapter fTextContentAdapter = new TextContentAdapter() {
@Override
@@ -1154,7 +1160,12 @@
quickPickTreeViewer.addSelectionChangedListener( new ISelectionChangedListener () {
public void selectionChanged(SelectionChangedEvent event) {
- quickPickSelectionChanged ( event.getSelection() );
+ // https://issues.jboss.org/browse/JBIDE-7861
+ // ignore if the selection event came from updateQuickPickSelection()
+ if (ignoreQuickPickSelection)
+ ignoreQuickPickSelection = false;
+ else
+ quickPickSelectionChanged ( event.getSelection() );
}
@@ -1189,7 +1200,9 @@
partnerName.setText(EMPTY_STRING);
} else {
ILabeledElement labeledElement = BPELUtil.adapt(partnerLink, ILabeledElement.class);
- partnerName.setText(labeledElement.getLabel(partnerLink));
+ // https://issues.jboss.org/browse/JBIDE-7861
+ partnerName.setText(labeledElement.getLabel(partnerLink));
+ updateQuickPickSelection(partnerLink);
}
}
@@ -1268,7 +1281,42 @@
}
}
+ // https://issues.jboss.org/browse/JBIDE-7861
+ // update the Quick Pick tree with currently selected model object
+ private void updateQuickPickSelection(Object model) {
+
+ ignoreQuickPickSelection = true;
+
+ TreeItem[] items = quickPickTree.getItems();
+ for (int i=0; i<items.length; ++i) {
+ if ( updateQuickPickSelection(model, items[i]))
+ break;
+ }
+ }
+ private boolean updateQuickPickSelection(Object model, TreeItem item)
+ {
+ Object data = item.getData();
+ if ( data instanceof TreeNode ) {
+ Object obj = ((TreeNode)data).getModelObject();
+ if (obj instanceof PartnerLink) {
+ PartnerLink partnerLink = ModelHelper.getPartnerLink(getInput());
+ if (obj!=partnerLink)
+ return false;
+ }
+ if (model==obj) {
+ quickPickTree.setSelection(item);
+ return true;
+ }
+ TreeItem[] items = item.getItems();
+ for (int i=0; i<items.length; ++i) {
+ if ( updateQuickPickSelection(model, items[i]))
+ return true;;
+ }
+ }
+ return false;
+ }
+
private void updatePortTypeWidgets() {
if (interfaceName == null) {
return ;
@@ -1291,6 +1339,8 @@
Operation operation = ModelHelper.getOperation(getInput());
if (operation != null) {
operationText.setText( operation.getName() );
+ // https://issues.jboss.org/browse/JBIDE-7861
+ updateQuickPickSelection(operation);
} else {
operationText.setText ( EMPTY_STRING );
}
@@ -1370,10 +1420,11 @@
PortType portType = ModelHelper.getPortType( model );
List<Command> cmdList = basicCommandList( model , IGNORE_PARTNER_LINK, null );
+ Operation op = null;
if (text.length() > 0) {
- Operation op = (Operation) ModelHelper.findElementByName(
+ op = (Operation) ModelHelper.findElementByName(
portType ,
text,
Operation.class);
@@ -1386,12 +1437,23 @@
}
});
cmd.setNewValue(op);
+ // https://issues.jboss.org/browse/JBIDE-7861
+ // set new operation in the command list
+ for (int i=0; i<cmdList.size(); ++i) {
+ if ( cmdList.get(i) instanceof SetOperationCommand) {
+ cmdList.set(i, cmd);
+ break;
+ }
+ }
}
}
CompoundCommand cmd = new CompoundCommand();
cmd.getCommands().addAll( cmdList );
getCommandFramework().execute ( cmd );
+
+ if (op!=null)
+ updateQuickPickSelection(op);
}
// void findAndSetOrCreateVariable (String text, int direction) {
@@ -1485,19 +1547,24 @@
pl = (PartnerLink) ModelHelper.findElementByName(ModelHelper.getContainingScope(model),
name, PartnerLink.class);
// does not exist
- if (pl == null) {
- createPartnerLink ( ModelHelper.getContainingScope(model), name );
+ if (pl == null) {
+ // https://issues.jboss.org/browse/JBIDE-7861
+ pl = createPartnerLink ( ModelHelper.getContainingScope(model), name );
+ if (pl!=null)
+ updateQuickPickSelection(pl);
return ;
}
}
CompoundCommand cmd = new CompoundCommand();
cmd.getCommands().addAll( basicCommandList(model, pl, null));
- getCommandFramework().execute ( cmd );
+ getCommandFramework().execute ( cmd );
+ if (pl!=null)
+ updateQuickPickSelection(pl);
}
- private void createPartnerLink ( EObject ref , String name ) {
+ private PartnerLink createPartnerLink ( EObject ref , String name ) {
PartnerLink pl = BPELFactory.eINSTANCE.createPartnerLink();
if (name == null) {
@@ -1513,14 +1580,14 @@
BPELUtil.getNCNameValidator());
if (nameDialog.open() == Window.CANCEL) {
- return ;
+ return null;
}
PartnerLinkTypeSelectorDialog dialog = new PartnerLinkTypeSelectorDialog(
partnerName.getShell(),
getInput());
if (dialog.open() == Window.CANCEL) {
- return ;
+ return null;
}
Object result = dialog.getFirstResult();
PartnerLinkType plt = null;
@@ -1539,7 +1606,7 @@
roleDialog.setTitle(Messages.PartnerRoleSelectorDialog_Title_MyRole);
}
if (roleDialog.open() == Window.CANCEL){
- return;
+ return null;
}
if (isInvoke){
pl.setPartnerRole(list.get(roleDialog.getSelectedRole()));
@@ -1569,6 +1636,8 @@
// TODO: Is there any way to refresh quick pick without this hack?
quickPickTreeViewer.setInput ( null );
updateQuickPickWidgets();
+
+ return pl;
}
/**
@@ -1614,6 +1683,10 @@
// org.eclipse.bpel.ui.details.tree.XSDElementDeclarationTreeNode@1e96ffd
//
+ // https://issues.jboss.org/browse/JBIDE-7861
+ if (ignoreQuickPickSelection)
+ return;
+
EObject input = getInput();
List cmdList = basicCommandList( input , null, null);
14 years
JBoss Tools SVN: r27620 - in trunk/cdi: tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/resolution and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2010-12-20 13:08:30 -0500 (Mon, 20 Dec 2010)
New Revision: 27620
Added:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/resolution/InjectionInstance.java
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/messages.properties
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/validation/DeploymentProblemsValidationTests.java
Log:
https://issues.jboss.org/browse/JBIDE-7949
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/messages.properties
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/messages.properties 2010-12-20 17:56:58 UTC (rev 27619)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/messages.properties 2010-12-20 18:08:30 UTC (rev 27620)
@@ -6,8 +6,8 @@
DUPLCICATE_EL_NAME=A few beans ({0}) have the same EL name and the name is not resolvable [JSR-299 �5.3.1]
UNRESOLVABLE_EL_NAME=The EL name "{0}" is of the form x.y, where y ("{1}") is a valid bean EL name, and x ("{2}") is the EL name of the other bean {3} [JSR-299 �5.3.1]
-UNSATISFIED_INJECTION_POINTS=No bean is eligible for injection to the injection point
-AMBIGUOUS_INJECTION_POINTS=Multiple beans are eligible for injection to the injection point
+UNSATISFIED_INJECTION_POINTS=No bean is eligible for injection to the injection point [JSR-299 �5.2.1]
+AMBIGUOUS_INJECTION_POINTS=Multiple beans are eligible for injection to the injection point [JSR-299 �5.2.1]
UNPROXYABLE_BEAN_ARRAY_TYPE=Injection point declares an array type {0} that cannot be proxied by the container resolves to a bean {1} with a normal scope [JSR-299 �5.4.1]
UNPROXYABLE_BEAN_PRIMITIVE_TYPE=Injection point declares a primitive type {0} that cannot be proxied by the container resolves to a bean {1} with a normal scope [JSR-299 �5.4.1]
UNPROXYABLE_BEAN_TYPE_WITH_NPC=Injection point declares a class {0} with a non-private constructor with no parameters (such a class cannot be proxied by the container) resolves to a bean {1} with a normal scope [JSR-299 �5.4.1]
Added: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/resolution/InjectionInstance.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/resolution/InjectionInstance.java (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/resolution/InjectionInstance.java 2010-12-20 18:08:30 UTC (rev 27620)
@@ -0,0 +1,13 @@
+package org.jboss.jsr299.tck.tests.jbt.resolution;
+
+import javax.enterprise.inject.Instance;
+import javax.inject.Inject;
+
+public class InjectionInstance {
+
+ @Inject Instance<String> multipleOk;
+ @Inject Instance<String> emptyOk;
+
+ @Inject String multipleBroken;
+ @Inject StringBuffer emptyBroken;
+}
\ No newline at end of file
Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/resolution/InjectionInstance.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/validation/DeploymentProblemsValidationTests.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/validation/DeploymentProblemsValidationTests.java 2010-12-20 17:56:58 UTC (rev 27619)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/validation/DeploymentProblemsValidationTests.java 2010-12-20 18:08:30 UTC (rev 27620)
@@ -62,6 +62,30 @@
}
/**
+ * CDI validator should not complain if there ambiguous dependencies for @Inject Instance<[type]>
+ * See https://issues.jboss.org/browse/JBIDE-7949
+ *
+ * @throws Exception
+ */
+ public void testAmbiguousDependencyForInstance() throws Exception {
+ IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/resolution/InjectionInstance.java");
+ assertMarkerIsNotCreated(file, CDIValidationMessages.AMBIGUOUS_INJECTION_POINTS, 8);
+ assertMarkerIsCreated(file, CDIValidationMessages.AMBIGUOUS_INJECTION_POINTS, 11);
+ }
+
+ /**
+ * CDI validator should not complain if there unsatisfied dependencies for @Inject Instance<[type]>
+ * See https://issues.jboss.org/browse/JBIDE-7949
+ *
+ * @throws Exception
+ */
+ public void testUnsatisfiedDependencyForInstance() throws Exception {
+ IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/resolution/InjectionInstance.java");
+ assertMarkerIsNotCreated(file, CDIValidationMessages.UNSATISFIED_INJECTION_POINTS, 9);
+ assertMarkerIsCreated(file, CDIValidationMessages.UNSATISFIED_INJECTION_POINTS, 12);
+ }
+
+ /**
* 5.2.4. Primitive types and null values
* - injection point of primitive type resolves to a bean that may have null values, such as a producer method with a non-primitive return type or a producer field with a non-primitive type
*
14 years