JBoss Tools SVN: r39609 - in trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test: src/org/jboss/tools/hibernate/ui/bot and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: jpeterka
Date: 2012-03-19 07:16:28 -0400 (Mon, 19 Mar 2012)
New Revision: 39609
Removed:
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/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/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/StaticTest.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/
Modified:
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/META-INF/MANIFEST.MF
Log:
Obsolete hb tests versions cleanup
Modified: trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/META-INF/MANIFEST.MF
===================================================================
--- trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/META-INF/MANIFEST.MF 2012-03-19 10:21:34 UTC (rev 39608)
+++ trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/META-INF/MANIFEST.MF 2012-03-19 11:16:28 UTC (rev 39609)
@@ -25,4 +25,3 @@
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Eclipse-RegisterBuddy: org.apache.log4j
Import-Package: org.eclipse.jdt.internal.ui
-Export-Package: org.jboss.tools.hibernate.ui.bot.testsuite
Deleted: 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 2012-03-19 10:21:34 UTC (rev 39608)
+++ trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testcase/CodeGenerationLauncherTest.java 2012-03-19 11:16:28 UTC (rev 39609)
@@ -1,189 +0,0 @@
- /*******************************************************************************
- * 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 org.eclipse.swt.widgets.Button;
-import org.eclipse.swtbot.eclipse.finder.matchers.WidgetMatcherFactory;
-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.test.util.DataHolder;
-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.Require;
-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;
-
-@Require( db=@DB, perspective="Hibernate")
-public class CodeGenerationLauncherTest extends HibernateTest {
-
- SWTBotShell mainShell = null;
- public static boolean generationDone = false;
-
- @BeforeClass
- /**
- * Setup prerequisites for this test
- */
- public static void setUpTest() {
-
- eclipse.maximizeActiveShell();
- eclipse.closeView(IDELabel.View.WELCOME);
-
- prepareProject();
- ConsoleTest consoleTest = new ConsoleTest();
- consoleTest.createConsole();
-
- util.waitForNonIgnoredJobs();
- }
-
- /**
- * Run code generation code
- */
- @Test
- public void generate() {
- if (generationDone) return;
-
- log.info("HB Code Generation STARTED");
- log.info("Active Shell: " + bot.activeShell().getText());
-
- eclipse.openPerspective(PerspectiveType.HIBERNATE);
-
- createNewHibernateCodeGenerationConfiguration();
-
- fillMainTab();
- fillExportersTab();
- fillRefreshTab();
- fillCommonTab();
-
- bot.button(IDELabel.Button.RUN).click();
- log.info("HB Code Generation FINISHED");
- util.waitForNonIgnoredJobs();
-
- log.info("Active Shell: " + bot.activeShell().getText());
-
- checkGeneratedFiles();
-
- generationDone = true;
- }
- /**
- * Checks existence generated files after code generation
- */
- private void checkGeneratedFiles() {
-
- log.info("Active Shell: " + bot.activeShell().getText());
- SWTBotShell[] shells = bot.shells();
- for (SWTBotShell shell : shells) {
- log.info("Possible shell: " + shell.getText());
- }
-
- open.viewOpen(ActionItem.View.JavaPackageExplorer.LABEL);
-
-
- for (String table : DataHolder.tables) {
- String className = table.substring(0,1).toUpperCase() + table.substring(1).toLowerCase();
- packageExplorer.openFile(Project.PROJECT_NAME,"gen","org","test", className + ".java");
- }
-
- log.info("Generated files check DONE");
- }
-
- /**
- *
- */
- private void createNewHibernateCodeGenerationConfiguration() {
- SWTBotMenu menu = null;
- menu = bot.menu("Run");
- menu = menu.menu(IDELabel.Menu.HIBERNATE_CODE_GENERATION);
- menu = menu.menu(IDELabel.Menu.HIBERNATE_CODE_GENERATION_CONF).click();
-
- mainShell = bot.activeShell();
- }
-
- /**
- * TC 09
- */
- public void fillMainTab() {
-
- bot.tree().expandNode("Hibernate Code Generation").select();
- bot.toolbarButtonWithTooltip("New launch configuration").click();
-
- eclipse.selectTreeLocation("Hibernate Code Generation","New_configuration");
- bot.textWithLabel("Name:").setText("HSQL Configuration");
-
- // Console Configuration
- bot.comboBoxWithLabel("Console configuration:").setSelection(Project.PROJECT_NAME);
-
- // Output directory
- bot.button("Browse...").click();
- bot.shell("Select output directory").activate();
- eclipse.selectTreeLocation(Project.PROJECT_NAME);
- bot.button("Create New Folder...").click();
- bot.shell("New Folder").activate();
- bot.textWithLabel("Folder name:").setText("gen");
- bot.button(IDELabel.Button.OK).click();
- eclipse.selectTreeLocation(Project.PROJECT_NAME,"gen");
- bot.button(IDELabel.Button.OK).click();
-
- // Create console configuration
- Matcher<Button> matcher = WidgetMatcherFactory.withText("Reverse engineer from JDBC Connection");
- Button button = bot.widget(matcher);
- SWTBotCheckBox cb = new SWTBotCheckBox(button);
-
- if (!cb.isChecked())
- cb.click();
-
- bot.textWithLabel("Package:").setText("org.test");
- log.info("HB Code Generation Main tab DONE");
- bot.sleep(TIME_1S);
- }
-
- /**
- * TC 10
- */
- public void fillExportersTab() {
- mainShell.activate();
- bot.cTabItem(IDELabel.HBLaunchConfigurationDialog.EXPORTERS_TAB).activate();
- bot.table().select("Domain code (.java)");
- bot.table().getTableItem(0).check();
- log.info("HB Code Generation Exporters tab DONE");
- bot.sleep(TIME_1S);
- }
-
- /**
- * TC 11
- */
- public void fillRefreshTab() {
- mainShell.activate();
- bot.cTabItem(IDELabel.HBLaunchConfigurationDialog.REFRESH_TAB).activate();
- log.info("HB Code Generation Refresh tab DONE");
- bot.sleep(TIME_1S);
- }
-
- /**
- * TC 12
- */
- public void fillCommonTab() {
- mainShell.activate();
- bot.cTabItem(IDELabel.HBLaunchConfigurationDialog.COMMON_TAB).activate();
- log.info("HB Code Generation Common tab DONE");
- bot.sleep(TIME_1S);
- }
-
- @AfterClass
- public static void clean() {
- }
-}
Deleted: 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 2012-03-19 10:21:34 UTC (rev 39608)
+++ trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testcase/ConfigurationFileTest.java 2012-03-19 11:16:28 UTC (rev 39609)
@@ -1,185 +0,0 @@
-/*******************************************************************************
- * 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;
-import java.util.List;
-
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.xpath.XPathExpressionException;
-
-import org.eclipse.swt.widgets.Button;
-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.widgets.SWTBotCheckBox;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
-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.Require;
-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.xml.sax.SAXException;
-
-@Require(clearProjects = false, perspective="Hibernate")
-public class ConfigurationFileTest extends HibernateTest {
-
- @BeforeClass
- public static void setUpTest() {
- HibernateTest.prepareProject();
- }
-
- @AfterClass
- 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);
- bot.button(IDELabel.Button.NEXT).click();
-
- // Create new configuration file
- 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);
-
- if (!cb.isChecked())
- cb.click();
-
- SWTBotShell shell = bot.activeShell();
- log.info("Active shell:" + shell.getText());
- bot.button(IDELabel.Button.FINISH).click();
- eclipse.waitForClosedShell(shell);
- log.info("Active Shell: " + bot.activeShell().getText());
- }
-
- /**
- * TC 13
- *
- * @throws ParserConfigurationException
- * @throws IOException
- * @throws SAXException
- * @throws XPathExpressionException
- */
- @Test
- /*
- * 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);
-
- // 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
- 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();
- 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());
- */
- // Search for security grant
-
- boolean found = false;
- 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);
- }
-
-}
Deleted: 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 2012-03-19 10:21:34 UTC (rev 39608)
+++ trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testcase/ConsolePerspectiveTest.java 2012-03-19 11:16:28 UTC (rev 39609)
@@ -1,39 +0,0 @@
- /*******************************************************************************
- * 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 org.jboss.tools.hibernate.ui.bot.testsuite.HibernateTest;
-import org.jboss.tools.ui.bot.ext.config.Annotations.Require;
-import org.jboss.tools.ui.bot.ext.gen.ActionItem;
-import org.jboss.tools.ui.bot.ext.types.IDELabel;
-import org.junit.Test;
-
-@Require(clearProjects = false, perspective="Hibernate")
-public class ConsolePerspectiveTest extends HibernateTest {
-
- /**
- * TC 17 - Check presence of basic hibernate views
- */
- @Test
- public void openPerspectiveElements() {
- eclipse.closeView(IDELabel.View.WELCOME);
-
- open.perspective(ActionItem.Perspective.HIBERNATE.LABEL);
- bot.sleep(TIME_1S);
-
- open.viewOpen(ActionItem.View.HibernateHibernateConfigurations.LABEL);
- bot.sleep(TIME_1S);
- open.viewOpen(ActionItem.View.HibernateHibernateDynamicSQLPreview.LABEL);
- bot.sleep(TIME_1S);
- open.viewOpen(ActionItem.View.HibernateHibernateQueryResult.LABEL);
- bot.sleep(TIME_1S);
- }
-}
Deleted: 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 2012-03-19 10:21:34 UTC (rev 39608)
+++ trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testcase/ConsoleTest.java 2012-03-19 11:16:28 UTC (rev 39609)
@@ -1,244 +0,0 @@
- /*******************************************************************************
- * 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 org.eclipse.swtbot.swt.finder.SWTBot;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
-import org.jboss.tools.hibernate.helper.ConsoleHelper;
-import org.jboss.tools.hibernate.ui.bot.test.util.DataHolder;
-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.Require;
-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;
-
-@Require( clearProjects = false, db=@DB, perspective="Hibernate")
-public class ConsoleTest extends HibernateTest {
-
- @BeforeClass
- public static void setUpTest() {
- HibernateTest.prepareProject();
- }
-
- @AfterClass
- public static void tearDownTest() {
- HibernateTest.clean();
- bot.sleep(TIME_5S);
- }
-
- private SWTBotShell mainShell;
- private static boolean consoleCreated = false;
-
- /**
- * Create console TestCases TC03 - TC16
- */
- @Test
- public void createConsole() {
- if (ConsoleHelper.consoleExists(Project.PROJECT_NAME)) return;
-
- log.info("HB Console creation STARTED");
-
- eclipse.showView(ViewType.PACKAGE_EXPLORER);
- packageExplorer.selectProject(Project.PROJECT_NAME);
- eclipse.createNew(EntityType.HIBERNATE_CONSOLE);
-
- createMainTab();
- mainShell.activate();
- createOptionTab();
- createClasspathTab();
- createMappingsTab();
- createCommonTab();
-
- bot.button(IDELabel.Button.FINISH).click();
- util.waitForNonIgnoredJobs();
-
- expandDatabaseInConsole();
-
- log.info("HB Console creation FINISHED");
-
- consoleCreated = true;
- }
-
- /**
- * TC 03
- */
- private void createMainTab() {
- bot.cTabItem(IDELabel.HBConsoleWizard.MAIN_TAB).activate();
- bot.textWithLabelInGroup("",IDELabel.HBConsoleWizard.PROJECT_GROUP ).setText(Project.PROJECT_NAME);
- mainShell = bot.activeShell();
-
- // Create new configuration file
- bot.buttonInGroup(IDELabel.HBConsoleWizard.SETUP_BUTTON,IDELabel.HBConsoleWizard.CONFIGURATION_FILE_GROUP).click();
- bot.button(IDELabel.HBConsoleWizard.CREATE_NEW_BUTTON).click();
- eclipse.selectTreeLocation(Project.PROJECT_NAME, "src");
- bot.button(IDELabel.Button.NEXT).click();
-
- // Dialect, driver, jdbc
- 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);
-
- // Username, password
- String username = TestConfigurator.currentConfig.getDB().username;
- bot.textWithLabel("Username:").setText(username);
- String password = TestConfigurator.currentConfig.getDB().password;
- bot.textWithLabel("Password:").setText(password);
-
- SWTBotShell shell = bot.activeShell();
- bot.button(IDELabel.Button.FINISH).click();
- eclipse.waitForClosedShell(shell);
-
- log.info("HB Console Main tab DONE");
- bot.sleep(TIME_1S);
- }
-
- /**
- * TC 04
- */
- private void createOptionTab() {
- mainShell.activate();
- bot.cTabItem(IDELabel.HBConsoleWizard.OPTIONS_TAB).activate();
-
- 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);
- }
-
- /**
- * TC 05
- */
- private void createClasspathTab() {
- mainShell.activate();
- bot.cTabItem(IDELabel.HBConsoleWizard.CLASSPATH_TAB).activate();
- log.info("HB Console ClassPath tab DONE");
- bot.sleep(TIME_1S);
- }
-
- /**
- * TC 06
- */
- private void createMappingsTab() {
- mainShell.activate();
- bot.cTabItem(IDELabel.HBConsoleWizard.MAPPINGS_TAB).activate();
- log.info("HB Console Mappings tab DONE");
- bot.sleep(TIME_1S);
- }
-
- /**
- * TC 07
- */
- private void createCommonTab() {
- mainShell.activate();
- bot.cTabItem(IDELabel.HBConsoleWizard.COMMON_TAB).activate();
- log.info("HB Console Common tab DONE");
- bot.sleep(TIME_1S);
- }
-
-
- private void expandDatabaseInConsole() {
- SWTBot viewBot = open.viewOpen(ActionItem.View.HibernateHibernateConfigurations.LABEL).bot();
- SWTBotTreeItem console = viewBot.tree().expandNode(Project.PROJECT_NAME);
- bot.sleep(TIME_1S);
- // Workaround cause node can't be expanded
- SWTBotTreeItem db = console.expandNode("Database").select();
- bot.sleep(TIME_1S);
- db.contextMenu("Refresh").click();
- bot.sleep(TIME_1S);
- db.expand();
-
- SWTBotTreeItem pub = db.getItems()[0];
- pub.select();
- bot.sleep(TIME_500MS);
-
- pub.doubleClick();
- bot.sleep(TIME_500MS);
- DataHolder.tables = pub.getNodes();
- }
-
- /**
- * TC 16 - open console, change several values, apply changes and check changes if they were store correctly
- */
- @Test
- public void editConsole() {
- // prereq
- createConsole();
-
- // open console
- openConsoleConfiguration();
- editConsoleValues();
- closeConsole();
-
- // open console again
- openConsoleConfiguration();
- checkConsoleValues();
- closeConsole();
- }
-
- private void closeConsole() {
- bot.clickButton(IDELabel.Button.OK);
- }
-
- private void editConsoleValues() {
- // perform change on
- // - Main page
- bot.cTabItem(IDELabel.HBConsoleWizard.MAIN_TAB).activate();
- bot.radioInGroup("Type:",1).click();
- bot.sleep(TIME_1S);
- // - Option
- bot.cTabItem(IDELabel.HBConsoleWizard.OPTIONS_TAB).activate();
- bot.comboBoxInGroup("Database dialect:").setSelection("MySQL");
- bot.sleep(TIME_1S);
- // - Classpath
- bot.cTabItem(IDELabel.HBConsoleWizard.CLASSPATH_TAB).activate();
- bot.sleep(TIME_1S);
- // - Mapping
- bot.cTabItem(IDELabel.HBConsoleWizard.MAPPINGS_TAB).activate();
- bot.sleep(TIME_1S);
- // - Common
- bot.cTabItem(IDELabel.HBConsoleWizard.COMMON_TAB).activate();
- bot.sleep(TIME_1S);
- // apply
- bot.clickButton(IDELabel.Button.APPLY);
- }
-
- private void checkConsoleValues() {
- // perform change on
- // - Main page
- bot.cTabItem(IDELabel.HBConsoleWizard.MAIN_TAB).activate();
- assertTrue(bot.radioInGroup("Type:",1).isSelected());
- // - Option
- bot.cTabItem(IDELabel.HBConsoleWizard.OPTIONS_TAB).activate();
- assertEquals("MySQL", bot.comboBoxInGroup("Database dialect:").getText());
- log.info("Changed console value checked");
- }
-
- private void openConsoleConfiguration() {
- SWTBot viewBot = open.viewOpen(ActionItem.View.HibernateHibernateConfigurations.LABEL).bot();
- SWTBotTreeItem item = SWTEclipseExt.selectTreeLocation(viewBot, Project.PROJECT_NAME);
- item.doubleClick();
- }
-
-
-}
Deleted: 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 2012-03-19 10:21:34 UTC (rev 39608)
+++ trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testcase/CriteriaEditorsTest.java 2012-03-19 11:16:28 UTC (rev 39609)
@@ -1,36 +0,0 @@
- /*******************************************************************************
- * 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 org.jboss.tools.hibernate.ui.bot.testsuite.HibernateTest;
-import org.jboss.tools.ui.bot.ext.config.Annotations.Require;
-import org.junit.Test;
-
-@Require(clearProjects = false, perspective="Hibernate")
-public class CriteriaEditorsTest extends HibernateTest {
-
- /**
- * TC 19
- */
- @Test
- public void checkHQLEditor() {
-
- }
-
- /**
- * TC 19
- */
- @Test
- public void checkCriteriaEditor() {
-
- }
-
-}
Deleted: 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 2012-03-19 10:21:34 UTC (rev 39608)
+++ trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testcase/DaliTest.java 2012-03-19 11:16:28 UTC (rev 39609)
@@ -1,213 +0,0 @@
-/*******************************************************************************
- * 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 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.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.Require;
-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;
-import org.jboss.tools.ui.bot.ext.view.ProjectExplorer;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.osgi.framework.Version;
-
-@Require( clearProjects = false, db=@DB, perspective="JPA" , server=@Server(state = ServerState.Present))
-public class DaliTest extends HibernateTest {
-
- private static boolean projectCreated = false;
-
- @BeforeClass
- public static void prepare() {
- eclipse.closeView(IDELabel.View.WELCOME);
- eclipse.openPerspective(PerspectiveType.JPA);
- util.waitForNonIgnoredJobs();
- }
-
- /**
- * TC 22 - Test creates JPA Project
- */
- @Test
- public void createJPAProject() {
- if (projectCreated)
- return;
-
- EntityType type = EntityType.JPA_PROJECT;
- eclipse.createNew(type);
-
- // JPA Project Page
- eclipse.waitForShell("New JPA Project");
- 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
- bot.button(IDELabel.Button.NEXT).click();
-
- // JPA Facet Page
- Version version = jbt.getJBTVersion();
- if ((version.getMajor() == 3) && (version.getMinor() == 1))
- bot.comboBoxInGroup("Platform").setSelection("Hibernate");
- else
- bot.comboBoxInGroup("Platform").setSelection("Hibernate (JPA 2.x)");
-
- 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();
- eclipse.waitForClosedShell(bot.shell("New JPA Project"));
- util.waitForNonIgnoredJobs();
-
- projectCreated = true;
- }
-
- /**
- * Test open persistence.xml of JPA project
- */
- @Test
- public void openPersitenceXML() {
- ProjectExplorer explorer = new ProjectExplorer();
- explorer.openFile(Project.JPA_PRJ_NAME, "JPA Content",
- "persistence.xml");
- }
-
- /**
- * TC 24 - Test generates DDL file
- */
- @Test
- public void generateDDL() {
- // Select project
- SWTBotView viewBot = bot.viewByTitle(IDELabel.View.PROJECT_EXPLORER);
- SWTBotTree tree = viewBot.bot().tree().select(Project.JPA_PRJ_NAME);
-
- // JPA Tools -> Generate Tables From Entities
- ContextMenuHelper.clickContextMenu(tree, "JPA Tools",
- "Generate Tables from Entities...");
-
- // DDL Generation Dialog
- String outputDir = Project.JPA_PRJ_NAME + "/" + Project.DDL_OUTPUT;
- bot.textWithLabel("Output directory:").setText(outputDir);
- bot.textWithLabel("File name").setText(Project.DDL_OUTPUT);
-
- bot.button(IDELabel.Button.FINISH).click();
- }
-
- /**
- * TC 24 - Test for generating Entities from Tables
- */
- @Test
- public void generateEntities() {
- // Select project
- SWTBotView viewBot = bot.viewByTitle(IDELabel.View.PROJECT_EXPLORER);
- SWTBotTree tree = viewBot.bot().tree().select(Project.JPA_PRJ_NAME);
-
- // JPA Tools -> Generate Tables From Entities
- ContextMenuHelper.clickContextMenu(tree, "JPA Tools",
- "Generate Entities from Tables...");
-
- // 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");
- }
-
- /**
- * TC 23 - Check JPA perspective views
- */
- @Test
- public void checkJPAPerspective() {
- bot.viewByTitle("JPA Structure").setFocus();
- bot.viewByTitle("JPA Details").setFocus();
- bot.viewByTitle("Data Source Explorer").setFocus();
- }
-
-
- /**
- * TC 25 - Checking coding configuration in persistence.xml editor on xml page
- */
- @Test
- 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 - Filling hibernate page on persistence.xml editor
- */
- @Test
- 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");
- }
-}
Deleted: 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 2012-03-19 10:21:34 UTC (rev 39608)
+++ trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testcase/MappingFileTest.java 2012-03-19 11:16:28 UTC (rev 39609)
@@ -1,139 +0,0 @@
- /*******************************************************************************
- * 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.util.List;
-
-import org.eclipse.swtbot.swt.finder.SWTBot;
-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.Require;
-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;
-import org.jboss.tools.ui.bot.ext.types.IDELabel;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-@Require( clearProjects = false, perspective="Hibernate")
-public class MappingFileTest extends HibernateTest {
-
- @BeforeClass
- public static void setUpTest() {
- prepareProject();
- prepareClasses();
- }
-
- @AfterClass
- public static void tearDownTest() {
- }
-
- /**
- * TC 01 - Create Hibernate Mapping file (when package is selected)
- * Create new .hbm.xml
- * ASSERT: No exception
- * Select Class to map
- * ASSERT: .hbm.xml must appears in JBoss Editor
- * Note: 2 Way check Created from package and classes
- */
- @Test
- public void createFile() {
- createFilesFromPackage();
-
- // Remove files generated in the first round
- eclipse.removeFile(Project.PROJECT_NAME,"src",Project.PACKAGE_NAME,Project.CLASS1 + ".hbm.xml");
- eclipse.removeFile(Project.PROJECT_NAME,"src",Project.PACKAGE_NAME,Project.CLASS2 + ".hbm.xml");
-
- createFilesFromClasses();
- }
-
- /**
- * Create Hibernate Mapping file from selected classes
- */
- private void createFilesFromClasses() {
- // Select Both classes
- SWTBot viewBot = bot.viewByTitle(IDELabel.View.PACKAGE_EXPLORER).bot();
- SWTBotTreeItem item = viewBot.tree().expandNode(Project.PROJECT_NAME).expandNode("src");
- item = item.expandNode(Project.PACKAGE_NAME).select();
- item.select(Project.CLASS1+".java",Project.CLASS2+".java");
-
- // Create mapping files
- eclipse.createNew(EntityType.HIBERNATE_MAPPING_FILE);
-
- bot.button(IDELabel.Button.NEXT).click();
- bot.button(IDELabel.Button.FINISH).click();
- util.waitForNonIgnoredJobs();
-
- // Check if new mapping files exists
- eclipse.openFile(Project.PROJECT_NAME,"src",Project.PACKAGE_NAME,Project.CLASS1 + ".hbm.xml" );
- eclipse.openFile(Project.PROJECT_NAME,"src",Project.PACKAGE_NAME,Project.CLASS2 + ".hbm.xml" );
- }
-
- /**
- * Create Hibernate mapping files from selected package
- */
- private void createFilesFromPackage() {
- // Select Package file
- SWTBot viewBot = bot.viewByTitle(IDELabel.View.PACKAGE_EXPLORER).bot();
- bot.viewByTitle(IDELabel.View.PACKAGE_EXPLORER).show();
- bot.viewByTitle(IDELabel.View.PACKAGE_EXPLORER).setFocus();
- SWTBotTreeItem item = viewBot.tree().expandNode(Project.PROJECT_NAME).expandNode("src");
- item = item.expandNode(Project.PACKAGE_NAME).select();
-
- // Create mapping files
- eclipse.createNew(EntityType.HIBERNATE_MAPPING_FILE);
- bot.button(IDELabel.Button.FINISH).click();
- util.waitForNonIgnoredJobs();
-
- // Check if new mapping files exists
- eclipse.openFile(Project.PROJECT_NAME,"src",Project.PACKAGE_NAME,Project.CLASS1 + ".hbm.xml" );
- eclipse.openFile(Project.PROJECT_NAME,"src",Project.PACKAGE_NAME,Project.CLASS2 + ".hbm.xml" );
-}
-
- /**
- * TC 14 - Editing Hibernate Mapping file
- */
- @Test
- public void editFile() {
- // Open Hibernate Mapping File (ObjectMultiPageEditor on source tab)
- eclipse.openFile(Project.PROJECT_NAME,"src",Project.PACKAGE_NAME,Project.CLASS1 + ".hbm.xml");
- ObjectMultiPageEditorBot pageBot = new ObjectMultiPageEditorBot(Project.CLASS1 + ".hbm.xml");
- pageBot.selectPage("Source");
-
- // Check code completion
- SWTBotEditorExt editor = bot.swtBotEditorExtByTitle(Project.CLASS1 + ".hbm.xml");
-
- String search = "</id>";
- List<String> lines = editor.getLines();
-
- int index = 0;
- for (String line : lines ) {
- index++;
- if (line.trim().equals(search)) break;
- }
-
- log.info("Line index: " + index);
-
- // Insert tag for cc check
- String newLine = "<property name=\"\"> ";
- int col = newLine.indexOf("\"\"");
- editor.selectRange(index, 0, 0);
- editor.insertText("\n");
- editor.insertText(newLine);
- editor.selectRange(index, col + 1, 0);
-
- // TODO autocomplete proposal check
-
- editor.save();
- }
-}
Deleted: 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 2012-03-19 10:21:34 UTC (rev 39608)
+++ trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testcase/MappingsDiagramTest.java 2012-03-19 11:16:28 UTC (rev 39609)
@@ -1,59 +0,0 @@
- /*******************************************************************************
- * 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 org.eclipse.swtbot.swt.finder.SWTBot;
-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.DB;
-import org.jboss.tools.ui.bot.ext.config.Annotations.Require;
-import org.jboss.tools.ui.bot.ext.gen.ActionItem;
-import org.jboss.tools.ui.bot.ext.types.IDELabel;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-@Require( db=@DB, perspective="Hibernate")
-public class MappingsDiagramTest extends HibernateTest {
-
- @BeforeClass
- /**
- * Setup prerequisites for this test
- */
- public static void setUpTest() {
-
- eclipse.maximizeActiveShell();
- eclipse.closeView(IDELabel.View.WELCOME);
-
- prepareProject();
- ConsoleTest test = new ConsoleTest();
- test.createConsole();
-
- util.waitForNonIgnoredJobs();
- }
-
- /**
- * Test mapping diagram
- */
- @Test
- public void testDiagram() {
-
- CodeGenerationLauncherTest test = new CodeGenerationLauncherTest();
- test.generate();
-
- SWTBot viewBot = open.viewOpen(ActionItem.View.HibernateHibernateConfigurations.LABEL).bot();
- SWTBotTreeItem console = viewBot.tree().expandNode(Project.PROJECT_NAME);
- bot.sleep(TIME_1S);
-
- console.contextMenu("Mapping Diagram").click();
- }
-
-}
Deleted: 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 2012-03-19 10:21:34 UTC (rev 39608)
+++ trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testcase/ReverseEngineerFileTest.java 2012-03-19 11:16:28 UTC (rev 39609)
@@ -1,56 +0,0 @@
- /*******************************************************************************
- * 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 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.Require;
-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;
-
-@Require(clearProjects = false, perspective="Hibernate")
-public class ReverseEngineerFileTest extends HibernateTest {
-
- @BeforeClass
- public static void prepare() {
- prepareProject();
- }
- /**
- * TC 08
- */
- @Test
- public void createFile() {
-
- bot.viewByTitle(IDELabel.View.PACKAGE_EXPLORER).setFocus();
- packageExplorer.selectProject(Project.PROJECT_NAME);
-
- // Create reveng file
- eclipse.createNew(EntityType.HIBERNATE_REVERSE_FILE);
- bot.clickButton(IDELabel.Button.NEXT);
- bot.clickButton("Include...");
- bot.clickButton(IDELabel.Button.FINISH);
- }
-
- /**
- * TC 15
- */
- @Test
- public void editFile() {
- // TBD
- }
-
- @AfterClass
- public static void finish() {
- }
-}
Deleted: trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testcase/StaticTest.java
===================================================================
--- trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testcase/StaticTest.java 2012-03-19 10:21:34 UTC (rev 39608)
+++ trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testcase/StaticTest.java 2012-03-19 11:16:28 UTC (rev 39609)
@@ -1,38 +0,0 @@
-package org.jboss.tools.hibernate.ui.bot.testcase;
-
-import java.io.File;
-
-import org.jboss.tools.ui.bot.ext.SWTTestExt;
-import org.jboss.tools.ui.bot.ext.config.Annotations.DB;
-import org.jboss.tools.ui.bot.ext.config.Annotations.Require;
-import org.jboss.tools.ui.bot.ext.helper.FileHelper;
-import org.jboss.tools.ui.bot.ext.helper.ImportHelper;
-import org.jboss.tools.ui.bot.ext.helper.ResourceHelper;
-import org.junit.Test;
-
-@Require(db=@DB, clearProjects = false, perspective="Hibernate")
-public class StaticTest extends SWTTestExt {
-
- @Test
- public void importHibernateProjects() {
- String rpath = ResourceHelper.getResourceAbsolutePath(
- Activator.PLUGIN_ID, "resources/prj");
- String wpath = ResourceHelper.getWorkspaceAbsolutePath();
-
- String[] projects = {"hibernate35.zip","hibernate36.zip","hibernate40.zip"};
- File outputDir = new File(wpath);
-
- for (int i = 0; i < projects.length; i++ ) {
- File archive = new File(rpath + File.separator + projects[i]);
- try {
- FileHelper.unzipArchive(archive, outputDir);
- } catch (Exception e) {
- fail("Unable to extract projects");
- }
- }
-
- ImportHelper.importAllProjects(wpath);
- }
-
-
-}
Deleted: 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 2012-03-19 10:21:34 UTC (rev 39608)
+++ trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testcase/ViewsTest.java 2012-03-19 11:16:28 UTC (rev 39609)
@@ -1,29 +0,0 @@
- /*******************************************************************************
- * 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 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.Require;
-import org.junit.Test;
-
-@Require( db=@DB, perspective="Hibernate")
-public class ViewsTest extends HibernateTest {
-
- /**
- * TC 20
- */
- @Test
- public void checkViews() {
-
- }
-
-}
12 years, 6 months
JBoss Tools SVN: r39608 - trunk/maven/plugins/org.jboss.tools.maven.project.examples/src/org/jboss/tools/maven/project/examples/wizard.
by jbosstools-commits@lists.jboss.org
Author: fbricon
Date: 2012-03-19 06:21:34 -0400 (Mon, 19 Mar 2012)
New Revision: 39608
Modified:
trunk/maven/plugins/org.jboss.tools.maven.project.examples/src/org/jboss/tools/maven/project/examples/wizard/ArchetypeExamplesWizardFirstPage.java
Log:
JBIDE-11234 : use default package for archetypes or fall back to previous package found in history, if no default package is defined
Modified: trunk/maven/plugins/org.jboss.tools.maven.project.examples/src/org/jboss/tools/maven/project/examples/wizard/ArchetypeExamplesWizardFirstPage.java
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.project.examples/src/org/jboss/tools/maven/project/examples/wizard/ArchetypeExamplesWizardFirstPage.java 2012-03-19 10:18:25 UTC (rev 39607)
+++ trunk/maven/plugins/org.jboss.tools.maven.project.examples/src/org/jboss/tools/maven/project/examples/wizard/ArchetypeExamplesWizardFirstPage.java 2012-03-19 10:21:34 UTC (rev 39608)
@@ -338,11 +338,9 @@
}
}
- String packageName = null;
- if (packageCombo.getItemCount() > 0) {
+ String packageName = projectDescription.getArchetypeModel().getJavaPackage();
+ if (StringUtils.isBlank(packageName) && packageCombo.getItemCount() > 0) {
packageName = packageCombo.getItem(0);
- } else {
- packageName = projectDescription.getArchetypeModel().getJavaPackage();
}
if (packageName != null) {
packageCombo.setText(packageName);
12 years, 6 months
JBoss Tools SVN: r39607 - in trunk/hibernatetools: plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/hqleditor and 7 other directories.
by jbosstools-commits@lists.jboss.org
Author: dgeraskov
Date: 2012-03-19 06:18:25 -0400 (Mon, 19 Mar 2012)
New Revision: 39607
Added:
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/src/org/hibernate/eclipse/jdt/ui/test/JavaHBMQueryTest.java
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/ext/ConsoleExtension.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/hqleditor/HQLCompletionProcessor.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/HQLJavaCompletionProposalComputer.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate3_5/src/org/jboss/tools/hibernate3_5/console/ConsoleExtension3_5.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate3_6/src/org/jboss/tools/hibernate3_6/console/ConsoleExtension3_6.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate4_0/src/org/jboss/tools/hibernate4_0/console/ConsoleExtension4_0.java
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/project/SimpleTestProjectWithMapping.java
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/META-INF/MANIFEST.MF
Log:
https://issues.jboss.org/browse/JBIDE-11342
Use code completion string start in java editor to do not brake it.
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/ext/ConsoleExtension.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/ext/ConsoleExtension.java 2012-03-19 08:19:21 UTC (rev 39606)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/ext/ConsoleExtension.java 2012-03-19 10:18:25 UTC (rev 39607)
@@ -25,7 +25,7 @@
*/
public interface ConsoleExtension {
- public CompletionProposalsResult hqlCodeComplete(String query, int position);
+ public CompletionProposalsResult hqlCodeComplete(String query, int startPosition, int position);
public void setHibernateException(HibernateExtension hibernateExtension);
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/hqleditor/HQLCompletionProcessor.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/hqleditor/HQLCompletionProcessor.java 2012-03-19 08:19:21 UTC (rev 39606)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/hqleditor/HQLCompletionProcessor.java 2012-03-19 10:18:25 UTC (rev 39607)
@@ -119,7 +119,7 @@
if(consoleConfiguration != null) {
ConsoleExtension consoleExtension = ConsoleExtensionManager.getConsoleExtension(consoleConfiguration.getHibernateExtension());
if (consoleExtension != null){
- CompletionProposalsResult codeCompletions = consoleExtension.hqlCodeComplete(doc.get(), currentOffset);
+ CompletionProposalsResult codeCompletions = consoleExtension.hqlCodeComplete(doc.get(), startOffset, currentOffset);
proposalList.addAll(codeCompletions.getCompletionProposals());
errorMessage = codeCompletions.getErrorMessage();//eclipseHQLCompletionCollector.getLastErrorMessage();
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/HQLJavaCompletionProposalComputer.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/HQLJavaCompletionProposalComputer.java 2012-03-19 08:19:21 UTC (rev 39606)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/HQLJavaCompletionProposalComputer.java 2012-03-19 10:18:25 UTC (rev 39607)
@@ -91,7 +91,7 @@
query = ctx.getDocument().get(stringStart, stringEnd-stringStart );
ConsoleExtension consoleExtension = ConsoleExtensionManager.getConsoleExtension(consoleConfiguration.getHibernateExtension());
if (consoleExtension != null){
- CompletionProposalsResult codeCompletions = consoleExtension.hqlCodeComplete(query, ctx.getInvocationOffset()-stringStart);
+ CompletionProposalsResult codeCompletions = consoleExtension.hqlCodeComplete(query, stringStart, ctx.getInvocationOffset() - stringStart);
errorMessage = codeCompletions.getErrorMessage();
proposals = codeCompletions.getCompletionProposals();
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate3_5/src/org/jboss/tools/hibernate3_5/console/ConsoleExtension3_5.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate3_5/src/org/jboss/tools/hibernate3_5/console/ConsoleExtension3_5.java 2012-03-19 08:19:21 UTC (rev 39606)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate3_5/src/org/jboss/tools/hibernate3_5/console/ConsoleExtension3_5.java 2012-03-19 10:18:25 UTC (rev 39607)
@@ -72,8 +72,8 @@
}
@Override
- public CompletionProposalsResult hqlCodeComplete(String query, int currentOffset) {
- EclipseHQLCompletionRequestor requestor = new EclipseHQLCompletionRequestor();
+ public CompletionProposalsResult hqlCodeComplete(String query, int startPosition, int currentOffset) {
+ EclipseHQLCompletionRequestor requestor = new EclipseHQLCompletionRequestor(startPosition);
if (!hibernateExtension.hasConfiguration()){
try {
hibernateExtension.build();
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate3_6/src/org/jboss/tools/hibernate3_6/console/ConsoleExtension3_6.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate3_6/src/org/jboss/tools/hibernate3_6/console/ConsoleExtension3_6.java 2012-03-19 08:19:21 UTC (rev 39606)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate3_6/src/org/jboss/tools/hibernate3_6/console/ConsoleExtension3_6.java 2012-03-19 10:18:25 UTC (rev 39607)
@@ -71,8 +71,8 @@
}
@Override
- public CompletionProposalsResult hqlCodeComplete(String query, int currentOffset) {
- EclipseHQLCompletionRequestor requestor = new EclipseHQLCompletionRequestor();
+ public CompletionProposalsResult hqlCodeComplete(String query, int startPosition , int currentOffset) {
+ EclipseHQLCompletionRequestor requestor = new EclipseHQLCompletionRequestor(startPosition);
if (!hibernateExtension.hasConfiguration()){
try {
hibernateExtension.build();
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate4_0/src/org/jboss/tools/hibernate4_0/console/ConsoleExtension4_0.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate4_0/src/org/jboss/tools/hibernate4_0/console/ConsoleExtension4_0.java 2012-03-19 08:19:21 UTC (rev 39606)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate4_0/src/org/jboss/tools/hibernate4_0/console/ConsoleExtension4_0.java 2012-03-19 10:18:25 UTC (rev 39607)
@@ -71,8 +71,8 @@
}
@Override
- public CompletionProposalsResult hqlCodeComplete(String query, int currentOffset) {
- EclipseHQLCompletionRequestor requestor = new EclipseHQLCompletionRequestor();
+ public CompletionProposalsResult hqlCodeComplete(String query, int startPosition, int currentOffset) {
+ EclipseHQLCompletionRequestor requestor = new EclipseHQLCompletionRequestor(startPosition);
if (!hibernateExtension.hasConfiguration()){
try {
hibernateExtension.build();
Modified: trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/project/SimpleTestProjectWithMapping.java
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/project/SimpleTestProjectWithMapping.java 2012-03-19 08:19:21 UTC (rev 39606)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/project/SimpleTestProjectWithMapping.java 2012-03-19 10:18:25 UTC (rev 39607)
@@ -14,9 +14,15 @@
import java.io.IOException;
import org.eclipse.core.resources.IncrementalProjectBuilder;
+import org.eclipse.core.resources.ProjectScope;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.preferences.IScopeContext;
import org.eclipse.jdt.core.JavaModelException;
+import org.hibernate.eclipse.console.properties.HibernatePropertiesConstants;
+import org.hibernate.eclipse.console.utils.ProjectUtils;
+import org.osgi.service.prefs.BackingStoreException;
+import org.osgi.service.prefs.Preferences;
public class SimpleTestProjectWithMapping extends SimpleTestProject {
@@ -48,5 +54,18 @@
getIProject().findMember(path);
getIProject().build(IncrementalProjectBuilder.FULL_BUILD, new NullProgressMonitor());
}
+
+ public void addHibernateNature() throws CoreException{
+ ProjectUtils.addProjectNature(getIProject(), HibernatePropertiesConstants.HIBERNATE_NATURE, new NullProgressMonitor() );
+ }
+ public void setDefaultConsoleConfiguration(String ccName) throws BackingStoreException, CoreException{
+ IScopeContext scope = new ProjectScope(getIProject() );
+ Preferences node = scope.getNode(HibernatePropertiesConstants.HIBERNATE_CONSOLE_NODE);
+
+ node.putBoolean(HibernatePropertiesConstants.HIBERNATE3_ENABLED, true );
+ node.put(HibernatePropertiesConstants.DEFAULT_CONFIGURATION, ccName ); //$NON-NLS-1$
+ node.flush();
+ addHibernateNature();
+ }
}
Modified: trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/META-INF/MANIFEST.MF
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/META-INF/MANIFEST.MF 2012-03-19 08:19:21 UTC (rev 39606)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/META-INF/MANIFEST.MF 2012-03-19 10:18:25 UTC (rev 39607)
@@ -13,7 +13,12 @@
org.eclipse.core.resources,
org.eclipse.jdt.core,
org.hibernate.eclipse.jdt.ui,
- org.eclipse.jdt.launching
+ org.eclipse.jdt.launching,
+ org.eclipse.jdt;bundle-version="3.7.0",
+ org.eclipse.jdt.ui;bundle-version="3.7.0",
+ org.eclipse.ui.editors;bundle-version="3.7.0",
+ org.eclipse.text;bundle-version="3.5.100",
+ org.eclipse.jface.text;bundle-version="3.7.0"
Bundle-ActivationPolicy: lazy
Export-Package: org.hibernate.eclipse.jdt.ui.test
Bundle-Activator: org.hibernate.eclipse.jdt.ui.test.HibernateJDTuiTestPlugin
Added: trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/src/org/hibernate/eclipse/jdt/ui/test/JavaHBMQueryTest.java
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/src/org/hibernate/eclipse/jdt/ui/test/JavaHBMQueryTest.java (rev 0)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/src/org/hibernate/eclipse/jdt/ui/test/JavaHBMQueryTest.java 2012-03-19 10:18:25 UTC (rev 39607)
@@ -0,0 +1,124 @@
+package org.hibernate.eclipse.jdt.ui.test;
+
+import java.io.File;
+import java.lang.reflect.Field;
+import java.util.ArrayList;
+import java.util.List;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.IPackageFragmentRoot;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.internal.ui.JavaPlugin;
+import org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor;
+import org.eclipse.jdt.internal.ui.javaeditor.EditorUtility;
+import org.eclipse.jdt.ui.text.java.ContentAssistInvocationContext;
+import org.eclipse.jdt.ui.text.java.JavaContentAssistInvocationContext;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.contentassist.ICompletionProposal;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IWorkbenchPage;
+import org.hibernate.console.ConsoleConfiguration;
+import org.hibernate.console.KnownConfigurations;
+import org.hibernate.eclipse.console.test.project.SimpleTestProject;
+import org.hibernate.eclipse.console.test.project.SimpleTestProjectWithMapping;
+import org.hibernate.eclipse.console.test.project.TestProject;
+import org.hibernate.eclipse.console.test.utils.ConsoleConfigUtils;
+import org.hibernate.eclipse.jdt.ui.internal.HQLJavaCompletionProposalComputer;
+
+/**
+ *
+ * @author Dmitry Geraskov (geraskov(a)gmail.com)
+ *
+ */
+public class JavaHBMQueryTest extends TestCase {
+
+ private static final String PROJ_NAME = "JavaHBMQueryTest"; //$NON-NLS-1$
+ private static final String CONSOLE_NAME = PROJ_NAME;
+
+ private SimpleTestProjectWithMapping project = null;
+ private ConsoleConfiguration cc;
+
+ protected void setUp() throws Exception {
+ project = new SimpleTestProjectWithMapping(PROJ_NAME);
+
+ IPackageFragmentRoot sourceFolder = project.createSourceFolder();
+ IPackageFragment pf = sourceFolder.createPackageFragment(
+ SimpleTestProject.PACKAGE_NAME, false, null);
+ ConsoleConfigUtils.customizeCfgXmlForPack(pf);
+ List<IPath> libs = new ArrayList<IPath>();
+ project.generateClassPath(libs, sourceFolder);
+ project.setDefaultConsoleConfiguration(CONSOLE_NAME);
+ project.fullBuild();
+
+ // setup console configuration
+ IPath cfgFilePath = new Path(project.getIProject().getName()
+ + File.separator + TestProject.SRC_FOLDER + File.separator
+ + ConsoleConfigUtils.CFG_FILE_NAME);
+ ConsoleConfigUtils.createConsoleConfig(PROJ_NAME, cfgFilePath,
+ CONSOLE_NAME);
+ ConsoleConfiguration cc = KnownConfigurations.getInstance().find(
+ CONSOLE_NAME);
+ assertNotNull("Console Configuration not found", cc); //$NON-NLS-1$
+ cc.build();
+ }
+
+ protected void tearDown() throws Exception {
+ cleanUpProject();
+ }
+
+ protected void cleanUpProject() {
+ if (project != null) {
+ project.deleteIProject();
+ project = null;
+ }
+ }
+
+ @SuppressWarnings("unused")
+ public void testJavaHQLQueryCodeCompletion() throws JavaModelException,
+ CoreException, NoSuchFieldException, IllegalAccessException {
+ IPackageFragment pack = project.getTestClassType().getPackageFragment();
+
+ String testCP = "TestCompletionProposals.java";
+ ICompilationUnit cu = pack
+ .createCompilationUnit(testCP, "", true, null); //$NON-NLS-1$
+
+ cu.createPackageDeclaration(pack.getElementName(), null);
+ IType type = cu.createType(
+ "public class " + testCP + " {}", null, false, null); //$NON-NLS-1$//$NON-NLS-2$
+ type.createMethod(
+ "public static void main(String[] args){String query = \"from \";}", null, false, null); //$NON-NLS-1$
+
+ IWorkbenchPage p = JavaPlugin.getActivePage();
+ IEditorPart part = EditorUtility.openInEditor(type, true);
+ if (part instanceof CompilationUnitEditor) {
+ CompilationUnitEditor editor = (CompilationUnitEditor) part;
+ IDocument doc = editor.getDocumentProvider().getDocument(
+ editor.getEditorInput());
+
+ HQLJavaCompletionProposalComputer proposalComputer = new HQLJavaCompletionProposalComputer();
+ ContentAssistInvocationContext context = new JavaContentAssistInvocationContext(editor.getViewer(), 125, editor);
+ List<ICompletionProposal> computeCompletionProposals = proposalComputer.computeCompletionProposals(context, null);
+ for (ICompletionProposal iCompletionProposal : computeCompletionProposals) {
+ Class<? extends ICompletionProposal> class1 = iCompletionProposal.getClass();
+ if (class1.getPackage().getName().indexOf("org.jboss.tools.hibernate") == 0){
+ //this is our completion proposal
+ Field declaredField = class1.getDeclaredField("documentOffset");
+ declaredField.setAccessible(true);
+ Integer offset = (Integer) declaredField.get(iCompletionProposal);
+ Assert.assertTrue(offset > 0);
+ }
+ }
+ } else {
+ fail("Can't open CompilationUnitEditor");
+ }
+ }
+
+}
12 years, 6 months
JBoss Tools SVN: r39606 - in trunk/maven/plugins/org.jboss.tools.maven.jsf/src/org/jboss/tools/maven/jsf: utils/xpl and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: fbricon
Date: 2012-03-19 04:19:21 -0400 (Mon, 19 Mar 2012)
New Revision: 39606
Modified:
trunk/maven/plugins/org.jboss.tools.maven.jsf/src/org/jboss/tools/maven/jsf/MavenJSFActivator.java
trunk/maven/plugins/org.jboss.tools.maven.jsf/src/org/jboss/tools/maven/jsf/utils/xpl/JSFAppConfigUtils.java
Log:
JBIDE-11078 : catch and log exceptions in JSFAppConfigUtils.getConfigFilesFromContextParam(...)
Modified: trunk/maven/plugins/org.jboss.tools.maven.jsf/src/org/jboss/tools/maven/jsf/MavenJSFActivator.java
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.jsf/src/org/jboss/tools/maven/jsf/MavenJSFActivator.java 2012-03-19 07:43:52 UTC (rev 39605)
+++ trunk/maven/plugins/org.jboss.tools.maven.jsf/src/org/jboss/tools/maven/jsf/MavenJSFActivator.java 2012-03-19 08:19:21 UTC (rev 39606)
@@ -67,8 +67,7 @@
}
public static void log(Throwable e) {
- IStatus status = new Status(IStatus.ERROR, PLUGIN_ID, e.getLocalizedMessage(), e);
- getDefault().getLog().log(status);
+ log(e.getLocalizedMessage(), e);
}
public static void log(String message) {
@@ -76,6 +75,11 @@
getDefault().getLog().log(status);
}
+ public static void log(String message, Throwable e) {
+ IStatus status = new Status(IStatus.ERROR, PLUGIN_ID, message, e);
+ getDefault().getLog().log(status);
+ }
+
public IDataModel createJSFDataModel(IFacetedProject fproj, IProjectFacetVersion facetVersion) {
IDataModel config = (IDataModel) new JSFFacetInstallDataModelProvider().create();
LibraryInstallDelegate libraryDelegate = new LibraryInstallDelegate(fproj, facetVersion);
Modified: trunk/maven/plugins/org.jboss.tools.maven.jsf/src/org/jboss/tools/maven/jsf/utils/xpl/JSFAppConfigUtils.java
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.jsf/src/org/jboss/tools/maven/jsf/utils/xpl/JSFAppConfigUtils.java 2012-03-19 07:43:52 UTC (rev 39605)
+++ trunk/maven/plugins/org.jboss.tools.maven.jsf/src/org/jboss/tools/maven/jsf/utils/xpl/JSFAppConfigUtils.java 2012-03-19 08:19:21 UTC (rev 39606)
@@ -73,15 +73,22 @@
public static List<String> getConfigFilesFromContextParam(IProject project) {
List<String> filesList = Collections.emptyList();
if (ModuleCoreNature.isFlexibleProject(project)) {
- IModelProvider provider = ModelProviderManager.getModelProvider(project);
- if (provider != null) {
- Object webAppObj = provider.getModelObject();
- if (webAppObj != null){
- if (webAppObj instanceof WebApp)
- filesList = getConfigFilesForJ2EEApp(project);
- else if (webAppObj instanceof org.eclipse.jst.javaee.web.WebApp)
- filesList = getConfigFilesForJEEApp((org.eclipse.jst.javaee.web.WebApp)webAppObj);
+ try {
+ IModelProvider provider = ModelProviderManager.getModelProvider(project);
+ if (provider != null) {
+ Object webAppObj = provider.getModelObject();
+ if (webAppObj != null){
+ if (webAppObj instanceof WebApp)
+ filesList = getConfigFilesForJ2EEApp(project);
+ else if (webAppObj instanceof org.eclipse.jst.javaee.web.WebApp)
+ filesList = getConfigFilesForJEEApp((org.eclipse.jst.javaee.web.WebApp)webAppObj);
+ }
}
+ } catch (Exception e) {
+ //Fix for JBIDE-11078 : in extremely rare cases,
+ //a NPE can be thrown if no IModelProvider is found for project
+ //At this point that error shouldn't block the user so we just log it
+ MavenJSFActivator.log("Could not read web.xml", e); //$NON-NLS-1$
}
}
return filesList;
12 years, 6 months
JBoss Tools SVN: r39605 - in trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test: src/org/jboss/tools/hb/ui/bot/suite and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: jpeterka
Date: 2012-03-19 03:43:52 -0400 (Mon, 19 Mar 2012)
New Revision: 39605
Added:
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/launcher/CodeGeneration.launch
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/suite/CodeGenerationSuite.java
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/test/generation/
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/test/generation/CreateCodeGenerationConfiguration.java
Log:
Isolated create code generation ui bot test added
Added: trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/launcher/CodeGeneration.launch
===================================================================
--- trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/launcher/CodeGeneration.launch (rev 0)
+++ trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/launcher/CodeGeneration.launch 2012-03-19 07:43:52 UTC (rev 39605)
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.swtbot.eclipse.ui.launcher.JunitLaunchConfig">
+<booleanAttribute key="append.args" value="true"/>
+<booleanAttribute key="askclear" value="false"/>
+<booleanAttribute key="automaticAdd" value="true"/>
+<booleanAttribute key="automaticValidate" value="false"/>
+<stringAttribute key="bootstrap" value=""/>
+<stringAttribute key="checked" value="[NONE]"/>
+<booleanAttribute key="clearConfig" value="true"/>
+<booleanAttribute key="clearws" value="true"/>
+<booleanAttribute key="clearwslog" value="false"/>
+<stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/pde-junit"/>
+<booleanAttribute key="default" value="true"/>
+<booleanAttribute key="includeOptional" value="true"/>
+<stringAttribute key="location" value="${workspace_loc}/../junit-workspace"/>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
+<listEntry value="/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/suite/CodeGenerationSuite.java"/>
+</listAttribute>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
+<listEntry value="1"/>
+</listAttribute>
+<mapAttribute key="org.eclipse.debug.core.environmentVariables">
+<mapEntry key="DISPLAY" value=":1"/>
+</mapAttribute>
+<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>
+<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
+<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
+<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
+<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.jboss.tools.hb.ui.bot.suite.CodeGenerationSuite"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -consoleLog"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.jboss.tools.hibernate.ui.bot.test"/>
+<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
+<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Dosgi.requiredJavaVersion=1.5 -XX:MaxPermSize=256m -Xms40m -Xmx512m -Xmx1024M -XX:PermSize=128M -XX:MaxPermSize=256M -Dusage_reporting_enabled=false -Dtest.configurations.dir=/home/jpeterka/etc/hb"/>
+<stringAttribute key="pde.version" value="3.3"/>
+<stringAttribute key="product" value="com.jboss.jbds.product.product"/>
+<booleanAttribute key="show_selected_only" value="false"/>
+<stringAttribute key="templateConfig" value="${target_home}/configuration/config.ini"/>
+<booleanAttribute key="tracing" value="false"/>
+<booleanAttribute key="useCustomFeatures" value="false"/>
+<booleanAttribute key="useDefaultConfig" value="true"/>
+<booleanAttribute key="useDefaultConfigArea" value="false"/>
+<booleanAttribute key="useProduct" value="true"/>
+</launchConfiguration>
Property changes on: trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/launcher/CodeGeneration.launch
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/suite/CodeGenerationSuite.java
===================================================================
--- trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/suite/CodeGenerationSuite.java (rev 0)
+++ trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/suite/CodeGenerationSuite.java 2012-03-19 07:43:52 UTC (rev 39605)
@@ -0,0 +1,12 @@
+package org.jboss.tools.hb.ui.bot.suite;
+
+import org.jboss.tools.hb.ui.bot.test.generation.CreateCodeGenerationConfiguration;
+import org.jboss.tools.ui.bot.ext.RequirementAwareSuite;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite.SuiteClasses;
+
+(a)RunWith(RequirementAwareSuite.class)
+(a)SuiteClasses({CreateCodeGenerationConfiguration.class})
+public class CodeGenerationSuite {
+
+}
Property changes on: trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/suite/CodeGenerationSuite.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/test/generation/CreateCodeGenerationConfiguration.java
===================================================================
--- trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/test/generation/CreateCodeGenerationConfiguration.java (rev 0)
+++ trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/test/generation/CreateCodeGenerationConfiguration.java 2012-03-19 07:43:52 UTC (rev 39605)
@@ -0,0 +1,111 @@
+package org.jboss.tools.hb.ui.bot.test.generation;
+
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swtbot.eclipse.finder.matchers.WidgetMatcherFactory;
+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.hb.ui.bot.test.HibernateBaseTest;
+import org.jboss.tools.ui.bot.ext.config.Annotations.DB;
+import org.jboss.tools.ui.bot.ext.config.Annotations.Require;
+import org.jboss.tools.ui.bot.ext.types.IDELabel;
+import org.junit.Test;
+
+/**
+ * Hibernate code generation configuration ui bot test
+ *
+ * @author jpeterka
+ *
+ */
+@Require(db = @DB, clearProjects = false, perspective = "Hibernate")
+public class CreateCodeGenerationConfiguration extends HibernateBaseTest {
+
+ final String prjName = "hibernate35";
+
+ @Test
+ public void hibernateCodeGeneration() {
+ importTestProject("/resources/prj/hibernate35");
+ SWTBotShell dlg = openCodeGenerationDlg();
+ fillMainTab();
+ fillExportersTab(dlg);
+ fillRefreshTab(dlg);
+ fillCommonTab(dlg);
+ runCodeGeneration();
+
+ }
+
+ private SWTBotShell openCodeGenerationDlg() {
+ SWTBotShell ret = null;
+ SWTBotMenu menu,menu1 = null;
+ menu = bot.menu("Run");
+ menu1 = menu.menu(IDELabel.Menu.HIBERNATE_CODE_GENERATION);
+ menu1.menu(IDELabel.Menu.HIBERNATE_CODE_GENERATION_CONF).click();
+ ret = bot.activeShell();
+ return ret;
+ }
+
+ private void runCodeGeneration() {
+ bot.button(IDELabel.Button.RUN).click();
+ }
+
+ private void fillMainTab() {
+
+ bot.tree().expandNode("Hibernate Code Generation").select();
+ bot.toolbarButtonWithTooltip("New launch configuration").click();
+
+ eclipse.selectTreeLocation("Hibernate Code Generation",
+ "New_configuration");
+ bot.textWithLabel("Name:").setText("HSQL Configuration");
+
+ // Console Configuration
+ bot.comboBoxWithLabel("Console configuration:").setSelection(
+ prjName);
+
+ // Output directory
+ bot.button("Browse...").click();
+ bot.shell("Select output directory").activate();
+ eclipse.selectTreeLocation(prjName);
+ bot.button("Create New Folder...").click();
+ bot.shell("New Folder").activate();
+ bot.textWithLabel("Folder name:").setText("gen");
+ bot.button(IDELabel.Button.OK).click();
+ eclipse.selectTreeLocation(prjName, "gen");
+ bot.button(IDELabel.Button.OK).click();
+
+ // Create console configuration
+ Matcher<Button> matcher = WidgetMatcherFactory
+ .withText("Reverse engineer from JDBC Connection");
+ Button button = bot.widget(matcher);
+ SWTBotCheckBox cb = new SWTBotCheckBox(button);
+
+ if (!cb.isChecked())
+ cb.click();
+
+ bot.textWithLabel("Package:").setText("org.test");
+ log.info("HB Code Generation Main tab DONE");
+ bot.sleep(TIME_1S);
+ }
+
+ private void fillExportersTab(SWTBotShell mainShell) {
+ mainShell.activate();
+ bot.cTabItem(IDELabel.HBLaunchConfigurationDialog.EXPORTERS_TAB)
+ .activate();
+ bot.table().select("Domain code (.java)");
+ bot.table().getTableItem(0).check();
+ log.info("HB Code Generation Exporters tab DONE");
+ bot.sleep(TIME_1S);
+ }
+
+ private void fillRefreshTab(SWTBotShell mainShell) {
+ mainShell.activate();
+ bot.cTabItem(IDELabel.HBLaunchConfigurationDialog.REFRESH_TAB)
+ .activate();
+ }
+
+ private void fillCommonTab(SWTBotShell mainShell) {
+ mainShell.activate();
+ bot.cTabItem(IDELabel.HBLaunchConfigurationDialog.COMMON_TAB)
+ .activate();
+ }
+}
Property changes on: trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/test/generation/CreateCodeGenerationConfiguration.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
12 years, 6 months
JBoss Tools SVN: r39604 - trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/test/configuration.
by jbosstools-commits@lists.jboss.org
Author: jpeterka
Date: 2012-03-19 03:29:27 -0400 (Mon, 19 Mar 2012)
New Revision: 39604
Modified:
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/test/configuration/CreateConfigurationFileTest.java
Log:
Create HB configuration file test modified to use common api
Modified: trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/test/configuration/CreateConfigurationFileTest.java
===================================================================
--- trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/test/configuration/CreateConfigurationFileTest.java 2012-03-19 07:26:04 UTC (rev 39603)
+++ trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/test/configuration/CreateConfigurationFileTest.java 2012-03-19 07:29:27 UTC (rev 39604)
@@ -1,22 +1,8 @@
package org.jboss.tools.hb.ui.bot.test.configuration;
-import static org.eclipse.swtbot.swt.finder.waits.Conditions.shellCloses;
-
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swtbot.eclipse.finder.matchers.WidgetMatcherFactory;
-import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotCheckBox;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
-import org.hamcrest.Matcher;
import org.jboss.tools.hb.ui.bot.common.ConfigurationFile;
-import org.jboss.tools.hb.ui.bot.common.Tree;
import org.jboss.tools.hb.ui.bot.test.HibernateBaseTest;
import org.jboss.tools.ui.bot.ext.config.Annotations.Require;
-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.junit.Test;
/**
@@ -38,42 +24,7 @@
}
private void createHBConfiguration() {
- SWTBotView pv = open
- .viewOpen(ActionItem.View.GeneralProjectExplorer.LABEL);
- Tree.select(pv.bot(), "hibernate35", "cfg");
-
- eclipse.createNew(EntityType.HIBERNATE_CONFIGURATION_FILE);
- bot.textWithLabel(IDELabel.HBConfigurationWizard.FILE_NAME).setText(
- "hibernate.cfg.xml");
- bot.button(IDELabel.Button.NEXT).click();
-
- // Create new configuration file
- 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);
-
- if (!cb.isChecked())
- cb.click();
-
- SWTBotShell shell = bot.activeShell();
- log.info("Active shell:" + shell.getText());
- bot.button(IDELabel.Button.FINISH).click();
-
- bot.waitUntil(shellCloses(shell));
+ ConfigurationFile.create(new String[]{"hibernate35", "cfg"}, "hibernate.cfg.xml");
}
private void openHBConfiguration() {
12 years, 6 months
JBoss Tools SVN: r39603 - trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/test/perspective.
by jbosstools-commits@lists.jboss.org
Author: jpeterka
Date: 2012-03-19 03:26:04 -0400 (Mon, 19 Mar 2012)
New Revision: 39603
Modified:
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/test/perspective/PerspectiveTest.java
Log:
HB PerspectiveTest import fix
Modified: trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/test/perspective/PerspectiveTest.java
===================================================================
--- trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/test/perspective/PerspectiveTest.java 2012-03-19 07:23:48 UTC (rev 39602)
+++ trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/test/perspective/PerspectiveTest.java 2012-03-19 07:26:04 UTC (rev 39603)
@@ -1,7 +1,6 @@
package org.jboss.tools.hb.ui.bot.test.perspective;
import org.jboss.tools.hb.ui.bot.test.HibernateBaseTest;
-import org.jboss.tools.hibernate.ui.bot.testsuite.HibernateTest;
import org.jboss.tools.ui.bot.ext.config.Annotations.Require;
import org.jboss.tools.ui.bot.ext.gen.ActionItem;
import org.jboss.tools.ui.bot.ext.types.IDELabel;
12 years, 6 months
JBoss Tools SVN: r39602 - trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/common.
by jbosstools-commits@lists.jboss.org
Author: jpeterka
Date: 2012-03-19 03:23:48 -0400 (Mon, 19 Mar 2012)
New Revision: 39602
Modified:
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/common/ConfigurationFile.java
Log:
Create method added into ConfigurationFile HB bot API
Modified: trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/common/ConfigurationFile.java
===================================================================
--- trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/common/ConfigurationFile.java 2012-03-19 07:22:03 UTC (rev 39601)
+++ trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/common/ConfigurationFile.java 2012-03-19 07:23:48 UTC (rev 39602)
@@ -1,13 +1,30 @@
package org.jboss.tools.hb.ui.bot.common;
+import static org.eclipse.swtbot.swt.finder.waits.Conditions.shellCloses;
+
+import org.eclipse.swt.widgets.Button;
import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
+import org.eclipse.swtbot.eclipse.finder.matchers.WidgetMatcherFactory;
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotCheckBox;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
+import org.hamcrest.Matcher;
import org.jboss.tools.ui.bot.ext.SWTBotExt;
+import org.jboss.tools.ui.bot.ext.SWTEclipseExt;
import org.jboss.tools.ui.bot.ext.SWTOpenExt;
+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;
+/**
+ * Hibernate Configuration ui bot routines
+ * @author jpeterka
+ *
+ */
public class ConfigurationFile {
-
+
public static void open(String... path) {
SWTOpenExt open = new SWTOpenExt(new SWTBotExt());
SWTBotView pv = open
@@ -17,4 +34,45 @@
SWTWorkbenchBot bot = new SWTWorkbenchBot();
bot.editorByTitle(path[path.length - 1]).show();
}
+
+ public static void create(String[] path, String cfgName) {
+ SWTBotExt bot = new SWTBotExt();
+ SWTEclipseExt eclipse = new SWTEclipseExt();
+ SWTOpenExt open = new SWTOpenExt(bot);
+
+ SWTBotView view = open.viewOpen(ActionItem.View.GeneralProjectExplorer.LABEL);
+ Tree.select(view.bot(), path);
+
+ eclipse.createNew(EntityType.HIBERNATE_CONFIGURATION_FILE);
+ bot.textWithLabel(IDELabel.HBConfigurationWizard.FILE_NAME).setText(
+ cfgName);
+ bot.button(IDELabel.Button.NEXT).click();
+
+ // Create new configuration file
+ 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);
+
+ if (!cb.isChecked())
+ cb.click();
+
+ SWTBotShell shell = bot.activeShell();
+ bot.button(IDELabel.Button.FINISH).click();
+
+ bot.waitUntil(shellCloses(shell));
+ }
}
12 years, 6 months
JBoss Tools SVN: r39601 - trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/common.
by jbosstools-commits@lists.jboss.org
Author: jpeterka
Date: 2012-03-19 03:22:03 -0400 (Mon, 19 Mar 2012)
New Revision: 39601
Modified:
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/common/Tree.java
Log:
getSubnodes routine added into Tree ui bot helper
Modified: trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/common/Tree.java
===================================================================
--- trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/common/Tree.java 2012-03-17 17:56:54 UTC (rev 39600)
+++ trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/common/Tree.java 2012-03-19 07:22:03 UTC (rev 39601)
@@ -2,6 +2,9 @@
import static org.junit.Assert.fail;
+import java.util.ArrayList;
+import java.util.List;
+
import org.apache.log4j.Logger;
import org.eclipse.swtbot.swt.finder.SWTBot;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
@@ -81,10 +84,12 @@
private static void expandNode(SWTBotTreeItem item) {
- item.expand();
if (!item.isExpanded()) {
- fail("Unable to expand " + item.getText());
+ item.expand();
}
+ if (!item.isExpanded()) {
+ log.error("Unable to expand:" + item.getText());
+ }
}
@@ -104,12 +109,51 @@
}
+ private static boolean hasSubnodes(SWTBotTreeItem item) {
+ return (item.getNodes().size() > 0);
+ }
+
private static void collapseNode(SWTBotTreeItem item) {
if (item.isExpanded()) {
item.collapse();
}
if (item.isExpanded()) {
- fail("Unable to collapse" + item.getText());
+ log.error("Unable to collapse:" + item.getText());
}
}
+
+ public static List<String> getSubNodes(SWTBot bot, SWTBotTreeItem item) {
+
+ List<String> ret = new ArrayList<String>();
+ expandNode(item);
+
+ final int limit = 5; // 5 cycles max
+ final int sleep = 1000; // 1s
+ int counter = 0;
+ // 1st round
+ while (counter < limit) {
+ if (!hasSubnodes(item)) {
+ log.info("no subnodes");
+ bot.sleep(sleep);
+ }
+ else {
+ ret = item.getNodes();
+ break;
+ }
+ }
+ // 2nd round
+ collapseNode(item);
+ expandNode(item);
+ while (counter < limit) {
+ if (!hasSubnodes(item)) {
+ log.info("no subnodes");
+ bot.sleep(sleep);
+ }
+ else {
+ ret = item.getNodes();
+ break;
+ }
+ }
+ return ret;
+ }
}
12 years, 6 months
JBoss Tools SVN: r39600 - trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors.
by jbosstools-commits@lists.jboss.org
Author: snjeza
Date: 2012-03-17 13:56:54 -0400 (Sat, 17 Mar 2012)
New Revision: 39600
Modified:
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/GettingStartedPage.java
Log:
JBIDE-11300 Refreshing the Project Examples section of JBoss Central (Getting Started tab) makes the whole left column wider
Modified: trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/GettingStartedPage.java
===================================================================
--- trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/GettingStartedPage.java 2012-03-17 17:50:17 UTC (rev 39599)
+++ trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/GettingStartedPage.java 2012-03-17 17:56:54 UTC (rev 39600)
@@ -21,6 +21,7 @@
import java.util.Set;
import org.apache.commons.lang.StringEscapeUtils;
+import org.eclipse.core.resources.WorkspaceJob;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IContributor;
@@ -160,7 +161,6 @@
private ToolBarManager newsToolBarManager;
private ToolBarManager blogsToolBarManager;
private Action blogsWarning;
- private boolean newProjectsInitialized;
public GettingStartedPage(FormEditor editor) {
super(editor, ID, "Getting Started");
@@ -782,7 +782,9 @@
setBusyIndicator(composite, true);
form.reflow(true);
form.redraw();
- recomputeScrollComposite(scrolledComposite, pageBook);
+ if (pageBook != tutorialPageBook) {
+ recomputeScrollComposite(scrolledComposite, pageBook);
+ }
}
});
return true;
12 years, 6 months