Author: jpeterka
Date: 2010-03-23 12:23:45 -0400 (Tue, 23 Mar 2010)
New Revision: 20992
Added:
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/view/ProjectExplorer.java
Modified:
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testcase/DaliTest.java
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testsuite/Project.java
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTEclipseExt.java
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/parts/ObjectMultiPageEditorBot.java
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/EntityType.java
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/IDELabel.java
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/PerspectiveType.java
Log:
Dali JPA test initiated
BotExt requirements added
ObjectMultiPageEditor commented because of container bundle problem
Modified:
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testcase/DaliTest.java
===================================================================
---
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testcase/DaliTest.java 2010-03-23
16:12:44 UTC (rev 20991)
+++
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testcase/DaliTest.java 2010-03-23
16:23:45 UTC (rev 20992)
@@ -12,25 +12,70 @@
import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
import org.jboss.tools.hibernate.ui.bot.testsuite.HibernateTest;
+import org.jboss.tools.hibernate.ui.bot.testsuite.Project;
+import org.jboss.tools.ui.bot.ext.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.junit.runner.RunWith;
@RunWith(SWTBotJunit4ClassRunner.class)
public class DaliTest extends HibernateTest {
-
+
+ static boolean projectCreated = false;
+
+ @BeforeClass
+ public static void prepare() {
+ bot.viewByTitle("Welcome").close();
+ eclipse.openPerspective(PerspectiveType.JPA);
+ util.waitForNonIgnoredJobs();
+ }
+
/**
* TC 22
*/
@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.button(IDELabel.Button.NEXT).click();
+
+ // Java Page
+ bot.button(IDELabel.Button.NEXT).click();
+
+ // JPA Facet Page
+ bot.comboBoxInGroup("Platform").setSelection("Hibernate");
+ // Finish
+ bot.button(IDELabel.Button.FINISH).click();
+ eclipse.waitForClosedShell(bot.shell("New JPA Project"));
+ util.waitForNonIgnoredJobs();
+
+ projectCreated = true;
}
+
+ @Test
+ public void openPersitenceXML() {
+ ProjectExplorer explorer = new ProjectExplorer();
+ explorer.openFile(Project.JPA_PRJ_NAME, "JPA Content",
"persistence.xml");
+ }
+
/**
* TC 24
*/
@Test
public void generateDDL() {
+
}
@@ -65,5 +110,17 @@
public void checkCAInMappingEditor() {
}
+
+ public static boolean isPRojectCreated() {
+ if (projectCreated) {
+ log.info("JPA Project is already created");
+ }
+ return projectCreated;
+ }
+ @AfterClass
+ public static void cleanup() {
+
+ }
+
}
Modified:
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testsuite/Project.java
===================================================================
---
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testsuite/Project.java 2010-03-23
16:12:44 UTC (rev 20991)
+++
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testsuite/Project.java 2010-03-23
16:23:45 UTC (rev 20992)
@@ -27,4 +27,7 @@
public static final String CONF_FILE_NAME2 = "hibernate2.cfg.xml";
public static final String DB_FILE = "mydb";
public static final String DB_NAME = "xdb";
+
+ // JPA Project
+ public static final String JPA_PRJ_NAME = "jpatest1";
}
Modified:
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTEclipseExt.java
===================================================================
---
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTEclipseExt.java 2010-03-23
16:12:44 UTC (rev 20991)
+++
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTEclipseExt.java 2010-03-23
16:23:45 UTC (rev 20992)
@@ -125,6 +125,9 @@
case DB_DEVELOPMENT:
perspectiveLabel = IDELabel.SelectPerspectiveDialog.DB_DEVELOPMENT;
break;
+ case JPA:
+ perspectiveLabel = IDELabel.SelectPerspectiveDialog.JPA;
+ break;
default:
fail("Unknown perspective to open");
}
@@ -141,6 +144,7 @@
bot.button(IDELabel.Button.OK).click();
}
+
// ------------------------------------------------------------
// Create related methods
// ------------------------------------------------------------
Modified:
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/parts/ObjectMultiPageEditorBot.java
===================================================================
---
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/parts/ObjectMultiPageEditorBot.java 2010-03-23
16:12:44 UTC (rev 20991)
+++
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/parts/ObjectMultiPageEditorBot.java 2010-03-23
16:23:45 UTC (rev 20992)
@@ -11,7 +11,7 @@
import org.eclipse.ui.IEditorReference;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
-import org.jboss.tools.common.editor.ObjectMultiPageEditor;
+// import org.jboss.tools.common.editor.ObjectMultiPageEditor;
/**
*
@@ -55,6 +55,7 @@
}
public void selectPage(final String pageName) {
+ /*
//assertTrue(ref.getPart(true) instanceof Hibernate3CompoundEditor);
assertTrue(ref.getPart(true) instanceof ObjectMultiPageEditor);
@@ -67,7 +68,8 @@
public void run() {
editor.selectPageByName(pageName);
}
- });
+ });
+ */
}
}
Modified:
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/EntityType.java
===================================================================
---
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/EntityType.java 2010-03-23
16:12:44 UTC (rev 20991)
+++
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/EntityType.java 2010-03-23
16:23:45 UTC (rev 20992)
@@ -21,7 +21,7 @@
*/
public enum EntityType {
HIBERNATE_MAPPING_FILE, JAVA_PROJECT, JAVA_CLASS, HIBERNATE_REVERSE_FILE,
HIBERNATE_CONSOLE,
- HIBERNATE_CONFIGURATION_FILE, STRUTS_PROJECT;
+ HIBERNATE_CONFIGURATION_FILE, STRUTS_PROJECT, JPA_PROJECT;
public List<String> getGroupsLabels() {
List<String> groupLabel = new LinkedList<String>();
@@ -34,6 +34,7 @@
case HIBERNATE_CONFIGURATION_FILE: groupLabel.add(IDELabel.EntityGroup.HIBERNATE);
break;
case HIBERNATE_CONSOLE: groupLabel.add(IDELabel.EntityGroup.HIBERNATE); break;
case STRUTS_PROJECT: groupLabel.add(IDELabel.EntityGroup.JBOSS_TOOLS_WEB);
groupLabel.add(IDELabel.EntityGroup.STRUTS);break;
+ case JPA_PROJECT: groupLabel.add(IDELabel.EntityGroup.JPA);break;
default: fail("Unknown Entity Type");
}
@@ -55,6 +56,7 @@
case JAVA_PROJECT: entityLabel = IDELabel.EntityLabel.JAVA_PROJECT; break;
case JAVA_CLASS: entityLabel = IDELabel.EntityLabel.JAVA_CLASS; break;
case STRUTS_PROJECT: entityLabel = IDELabel.EntityLabel.STRUTS_PROJECT; break;
+ case JPA_PROJECT: entityLabel = IDELabel.EntityLabel.JPA_PROJECT; break;
default: fail("Unknown Entity Type");
}
Modified:
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/IDELabel.java
===================================================================
---
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/IDELabel.java 2010-03-23
16:12:44 UTC (rev 20991)
+++
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/IDELabel.java 2010-03-23
16:23:45 UTC (rev 20992)
@@ -113,6 +113,7 @@
public static final String SEAM = "Seam";
public static final String STRUTS = "Struts";
public static final String JBOSS_TOOLS_WEB = "JBoss Tools Web";
+ public static final String JPA = "JPA";
}
public class EntityLabel {
@@ -124,6 +125,7 @@
public static final String SEAM_PROJECT = "Seam Web Project";
public static final String HIBERNATE_CONFIGURATION_FILE = "Hibernate Configuration
File (cfg.xml)";
public static final String STRUTS_PROJECT = "Struts Project";
+ public static final String JPA_PROJECT = "JPA Project";
}
public class JavaProjectWizard {
@@ -164,6 +166,7 @@
public static final String SEAM = "Seam";
public static final String WEB_DEVELOPMENT = "Web Development";
public static final String DB_DEVELOPMENT = "Database Development";
+ public static final String JPA = "JPA";
}
/**
* Hibernate Console Wizard (ConsoleConfigurationCreationWizard) Labels (
Modified:
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/PerspectiveType.java
===================================================================
---
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/PerspectiveType.java 2010-03-23
16:12:44 UTC (rev 20991)
+++
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/PerspectiveType.java 2010-03-23
16:23:45 UTC (rev 20992)
@@ -16,6 +16,6 @@
*
*/
public enum PerspectiveType {
- SEAM, JAVA, WEB_DEVELOPMENT, HIBERNATE, DB_DEVELOPMENT;
+ SEAM, JAVA, WEB_DEVELOPMENT, HIBERNATE, DB_DEVELOPMENT, JPA;
}
Added:
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/view/ProjectExplorer.java
===================================================================
---
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/view/ProjectExplorer.java
(rev 0)
+++
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/view/ProjectExplorer.java 2010-03-23
16:23:45 UTC (rev 20992)
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * 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.ui.bot.ext.view;
+
+import org.apache.log4j.Logger;
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor;
+import org.eclipse.swtbot.swt.finder.SWTBot;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
+import org.jboss.tools.ui.bot.ext.SWTBotExt;
+import org.jboss.tools.ui.bot.ext.types.IDELabel;
+
+/**
+ * Eclipse project type enum
+ *
+ * @author jpeterka
+ *
+ */
+public class ProjectExplorer extends SWTBotExt {
+
+ Logger log = Logger.getLogger(ProjectExplorer.class);
+
+ public SWTBotEditor openFile(String projectName, String... path) {
+ SWTBot viewBot = viewByTitle(IDELabel.View.PROJECT_EXPLORER).bot();
+
+ viewByTitle(IDELabel.View.PROJECT_EXPLORER).show();
+ viewByTitle(IDELabel.View.PROJECT_EXPLORER).setFocus();
+ SWTBotTree tree = viewBot.tree();
+ SWTBotTreeItem item = tree.expandNode(projectName);
+ StringBuilder builder = new StringBuilder(projectName);
+
+ // Go through path
+ for (String nodeName : path) {
+ item = item.expandNode(nodeName);
+ builder.append("/" + nodeName);
+ }
+
+ item.select().doubleClick();
+ log.info("File Opened:" + builder.toString());
+
+ SWTBotEditor editor = activeEditor();
+ return editor;
+ }
+}
Property changes on:
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/view/ProjectExplorer.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain