Author: jpeterka
Date: 2011-04-06 06:45:48 -0400 (Wed, 06 Apr 2011)
New Revision: 30364
Added:
trunk/bpmn/tests/org.jboss.tools.bpmn.ui.bot.test/src/
trunk/bpmn/tests/org.jboss.tools.bpmn.ui.bot.test/src/org/
trunk/bpmn/tests/org.jboss.tools.bpmn.ui.bot.test/src/org/jboss/
trunk/bpmn/tests/org.jboss.tools.bpmn.ui.bot.test/src/org/jboss/tools/
trunk/bpmn/tests/org.jboss.tools.bpmn.ui.bot.test/src/org/jboss/tools/bpmn/
trunk/bpmn/tests/org.jboss.tools.bpmn.ui.bot.test/src/org/jboss/tools/bpmn/testcase/
trunk/bpmn/tests/org.jboss.tools.bpmn.ui.bot.test/src/org/jboss/tools/bpmn/testcase/AllTests.java
trunk/bpmn/tests/org.jboss.tools.bpmn.ui.bot.test/src/org/jboss/tools/bpmn/testcase/BPMNConvertCase.java
trunk/bpmn/tests/org.jboss.tools.bpmn.ui.bot.test/src/org/jboss/tools/bpmn/ui/
trunk/bpmn/tests/org.jboss.tools.bpmn.ui.bot.test/src/org/jboss/tools/bpmn/ui/bot/
trunk/bpmn/tests/org.jboss.tools.bpmn.ui.bot.test/src/org/jboss/tools/bpmn/ui/bot/test/
trunk/bpmn/tests/org.jboss.tools.bpmn.ui.bot.test/src/org/jboss/tools/bpmn/ui/bot/test/Activator.java
Log:
[bmpntest] Initial BPMN convert test commit
Added:
trunk/bpmn/tests/org.jboss.tools.bpmn.ui.bot.test/src/org/jboss/tools/bpmn/testcase/AllTests.java
===================================================================
---
trunk/bpmn/tests/org.jboss.tools.bpmn.ui.bot.test/src/org/jboss/tools/bpmn/testcase/AllTests.java
(rev 0)
+++
trunk/bpmn/tests/org.jboss.tools.bpmn.ui.bot.test/src/org/jboss/tools/bpmn/testcase/AllTests.java 2011-04-06
10:45:48 UTC (rev 30364)
@@ -0,0 +1,11 @@
+package org.jboss.tools.bpmn.testcase;
+
+import org.jboss.tools.ui.bot.ext.RequirementAwareSuite;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite.SuiteClasses;
+
+@SuiteClasses({ BPMNConvertCase.class })
+(a)RunWith(RequirementAwareSuite.class)
+public class AllTests {
+
+}
Property changes on:
trunk/bpmn/tests/org.jboss.tools.bpmn.ui.bot.test/src/org/jboss/tools/bpmn/testcase/AllTests.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added:
trunk/bpmn/tests/org.jboss.tools.bpmn.ui.bot.test/src/org/jboss/tools/bpmn/testcase/BPMNConvertCase.java
===================================================================
---
trunk/bpmn/tests/org.jboss.tools.bpmn.ui.bot.test/src/org/jboss/tools/bpmn/testcase/BPMNConvertCase.java
(rev 0)
+++
trunk/bpmn/tests/org.jboss.tools.bpmn.ui.bot.test/src/org/jboss/tools/bpmn/testcase/BPMNConvertCase.java 2011-04-06
10:45:48 UTC (rev 30364)
@@ -0,0 +1,121 @@
+package org.jboss.tools.bpmn.testcase;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.nio.channels.FileChannel;
+
+import org.eclipse.core.runtime.Platform;
+import org.jboss.tools.bpmn.ui.bot.test.Activator;
+import org.jboss.tools.ui.bot.ext.SWTTestExt;
+import org.jboss.tools.ui.bot.ext.SWTUtilExt;
+import org.jboss.tools.ui.bot.ext.config.Annotations.SWTBotTestRequires;
+import org.jboss.tools.ui.bot.ext.entity.JavaProjectEntity;
+import org.jboss.tools.ui.bot.ext.gen.ActionItem;
+import org.jboss.tools.ui.bot.ext.types.IDELabel;
+import org.junit.Test;
+
+@SWTBotTestRequires(clearProjects = true, perspective = "Java")
+public class BPMNConvertCase extends SWTTestExt {
+
+ private String projectName = "BPMNConvertProject";
+ private String originalFolder = "original";
+ private String targetFolder = "target";
+ private String file1 = "PolicyPricingProcess.bpmn";
+ private String file2 = "PolicyPricingProcess.bpmn_diagram";
+
+ @Test
+ public void createProject() {
+ // Create Java Project
+ JavaProjectEntity project = new JavaProjectEntity();
+ project.setProjectName(projectName);
+ eclipse.createJavaProject(project);
+
+ // create original folder
+ packageExplorer.selectProject(projectName);
+ bot.menu("File").menu("New").menu("Folder").click();
+ bot.textWithLabel("Folder name:").setText(originalFolder);
+ open.finish(bot);
+
+ // create target folder
+ packageExplorer.selectProject(projectName);
+ bot.menu("File").menu("New").menu("Folder").click();
+ bot.textWithLabel("Folder name:").setText(targetFolder);
+ open.finish(bot);
+
+ }
+
+ @Test
+ public void importFiles() {
+ // file1
+ File in = SWTUtilExt.getResourceFile(Activator.PLUGIN_ID, "original",
+ file1);
+ File out = new File(Platform.getLocation() + File.separator
+ + projectName + File.separator + originalFolder
+ + File.separator + file1);
+ copyFile(in, out);
+
+ // file2
+ in = SWTUtilExt.getResourceFile(Activator.PLUGIN_ID, "original", file2);
+ out = new File(Platform.getLocation() + File.separator + projectName
+ + File.separator + originalFolder + File.separator + file2);
+ copyFile(in, out);
+
+ // refresh
+ packageExplorer.selectProject(projectName);
+ bot.menu("File").menu("Refresh").click();
+
+ util.waitForNonIgnoredJobs();
+
+ eclipse.openFile(projectName, originalFolder, file1);
+ eclipse.openFile(projectName, originalFolder, file2);
+
+ bot.closeAllEditors();
+ }
+
+ @Test
+ public void convertProcess() {
+ eclipse.selectTreeLocation(projectName, originalFolder, file1);
+ open.newExport(ActionItem.Export.BPMNBPMNtojPDL.LABEL);
+ bot.clickButton(IDELabel.Button.NEXT);
+ bot.clickButton(IDELabel.Button.NEXT);
+ bot.clickButton(IDELabel.Button.NEXT);
+
+ bot.tree().expandNode(projectName).select(targetFolder);
+ open.finish(bot);
+
+ // refresh target folder
+ packageExplorer.selectProject(projectName);
+ bot.menu("File").menu("Refresh").click();
+
+ // open converted jbpm file
+ eclipse.openFile(projectName, targetFolder, "jpdl", file1,
+ "Policy Pricing", "processdefinition.xml");
+
+ bot.sleep(TIME_10S);
+ }
+
+ private void copyFile(File in, File out) {
+ try {
+
+ FileChannel inChannel = null;
+ FileChannel outChannel = null;
+
+ inChannel = new FileInputStream(in).getChannel();
+ outChannel = new FileOutputStream(out).getChannel();
+
+ inChannel.transferTo(0, inChannel.size(), outChannel);
+
+ if (inChannel != null)
+ inChannel.close();
+ if (outChannel != null)
+ outChannel.close();
+ log.info("File " + in.getAbsolutePath() + " copied");
+ } catch (Exception e) {
+ log.error(e.getMessage());
+ fail("Error during copying files " + in.getAbsolutePath() + " - "
+ + e.getMessage());
+ }
+ }
+
+}
Property changes on:
trunk/bpmn/tests/org.jboss.tools.bpmn.ui.bot.test/src/org/jboss/tools/bpmn/testcase/BPMNConvertCase.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added:
trunk/bpmn/tests/org.jboss.tools.bpmn.ui.bot.test/src/org/jboss/tools/bpmn/ui/bot/test/Activator.java
===================================================================
---
trunk/bpmn/tests/org.jboss.tools.bpmn.ui.bot.test/src/org/jboss/tools/bpmn/ui/bot/test/Activator.java
(rev 0)
+++
trunk/bpmn/tests/org.jboss.tools.bpmn.ui.bot.test/src/org/jboss/tools/bpmn/ui/bot/test/Activator.java 2011-04-06
10:45:48 UTC (rev 30364)
@@ -0,0 +1,50 @@
+package org.jboss.tools.bpmn.ui.bot.test;
+
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.jboss.tools.bpmn.ui.bot.test";
//$NON-NLS-1$
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+}
Property changes on:
trunk/bpmn/tests/org.jboss.tools.bpmn.ui.bot.test/src/org/jboss/tools/bpmn/ui/bot/test/Activator.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain