Author: dgolovin
Date: 2009-04-23 14:32:23 -0400 (Thu, 23 Apr 2009)
New Revision: 14877
Added:
workspace/dgolovin/org.jboss.tools.testng.app/.classpath
workspace/dgolovin/org.jboss.tools.testng.app/.project
workspace/dgolovin/org.jboss.tools.testng.app/.settings/
workspace/dgolovin/org.jboss.tools.testng.app/.settings/org.eclipse.jdt.core.prefs
workspace/dgolovin/org.jboss.tools.testng.app/META-INF/
workspace/dgolovin/org.jboss.tools.testng.app/META-INF/MANIFEST.MF
workspace/dgolovin/org.jboss.tools.testng.app/build.properties
workspace/dgolovin/org.jboss.tools.testng.app/plugin.xml
workspace/dgolovin/org.jboss.tools.testng.app/src/
workspace/dgolovin/org.jboss.tools.testng.app/src/com/
workspace/dgolovin/org.jboss.tools.testng.app/src/com/exadel/
workspace/dgolovin/org.jboss.tools.testng.app/src/com/exadel/testng/
workspace/dgolovin/org.jboss.tools.testng.app/src/com/exadel/testng/TestRunner.java
workspace/dgolovin/org.jboss.tools.testng.app/src/org/
workspace/dgolovin/org.jboss.tools.testng.app/src/org/jboss/
workspace/dgolovin/org.jboss.tools.testng.app/src/org/jboss/test/
workspace/dgolovin/org.jboss.tools.testng.app/src/org/jboss/test/Test1.java
workspace/dgolovin/org.jboss.tools.testng.app/testng-5.8-jdk15.jar
workspace/dgolovin/org.jboss.tools.testng.app/tests.xml
Log:
Added: workspace/dgolovin/org.jboss.tools.testng.app/.classpath
===================================================================
--- workspace/dgolovin/org.jboss.tools.testng.app/.classpath (rev
0)
+++ workspace/dgolovin/org.jboss.tools.testng.app/.classpath 2009-04-23 18:32:23 UTC (rev
14877)
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry exported="true" kind="lib"
path="testng-5.8-jdk15.jar"/>
+ <classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con"
path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="lib"
path="/home/eskimo/java/testng-5.8/testng-5.8-jdk15.jar"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Property changes on: workspace/dgolovin/org.jboss.tools.testng.app/.classpath
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: workspace/dgolovin/org.jboss.tools.testng.app/.project
===================================================================
--- workspace/dgolovin/org.jboss.tools.testng.app/.project (rev
0)
+++ workspace/dgolovin/org.jboss.tools.testng.app/.project 2009-04-23 18:32:23 UTC (rev
14877)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.jboss.tools.testng.app</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Property changes on: workspace/dgolovin/org.jboss.tools.testng.app/.project
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: workspace/dgolovin/org.jboss.tools.testng.app/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- workspace/dgolovin/org.jboss.tools.testng.app/.settings/org.eclipse.jdt.core.prefs
(rev 0)
+++
workspace/dgolovin/org.jboss.tools.testng.app/.settings/org.eclipse.jdt.core.prefs 2009-04-23
18:32:23 UTC (rev 14877)
@@ -0,0 +1,7 @@
+#Wed Feb 18 16:10:51 PST 2009
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
Property changes on:
workspace/dgolovin/org.jboss.tools.testng.app/.settings/org.eclipse.jdt.core.prefs
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: workspace/dgolovin/org.jboss.tools.testng.app/META-INF/MANIFEST.MF
===================================================================
--- workspace/dgolovin/org.jboss.tools.testng.app/META-INF/MANIFEST.MF
(rev 0)
+++ workspace/dgolovin/org.jboss.tools.testng.app/META-INF/MANIFEST.MF 2009-04-23 18:32:23
UTC (rev 14877)
@@ -0,0 +1,14 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Testng Plug-in
+Bundle-SymbolicName: com.exadel.testng;singleton:=true
+Bundle-Version: 1.0.0
+Bundle-Vendor: EXADEL
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Require-Bundle: org.eclipse.ui.ide.application;bundle-version="1.0.1",
+ org.eclipse.equinox.app;bundle-version="1.1.0",
+ org.eclipse.core.resources;bundle-version="3.4.2",
+ org.eclipse.core.runtime;bundle-version="3.4.0",
+ org.eclipse.ui.workbench;bundle-version="3.4.2"
+Bundle-ClassPath: testng-5.8-jdk15.jar,
+ .
Property changes on: workspace/dgolovin/org.jboss.tools.testng.app/META-INF/MANIFEST.MF
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: workspace/dgolovin/org.jboss.tools.testng.app/build.properties
===================================================================
--- workspace/dgolovin/org.jboss.tools.testng.app/build.properties
(rev 0)
+++ workspace/dgolovin/org.jboss.tools.testng.app/build.properties 2009-04-23 18:32:23 UTC
(rev 14877)
@@ -0,0 +1,6 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ testng-5.8-jdk15.jar
Property changes on: workspace/dgolovin/org.jboss.tools.testng.app/build.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: workspace/dgolovin/org.jboss.tools.testng.app/plugin.xml
===================================================================
--- workspace/dgolovin/org.jboss.tools.testng.app/plugin.xml (rev
0)
+++ workspace/dgolovin/org.jboss.tools.testng.app/plugin.xml 2009-04-23 18:32:23 UTC (rev
14877)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension
+ id="id1"
+ point="org.eclipse.core.runtime.applications">
+ <application
+ cardinality="singleton-global"
+ thread="main"
+ visible="true">
+ <run
+ class="com.exadel.testng.TestRunner">
+ </run>
+ </application>
+ </extension>
+
+</plugin>
Property changes on: workspace/dgolovin/org.jboss.tools.testng.app/plugin.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
workspace/dgolovin/org.jboss.tools.testng.app/src/com/exadel/testng/TestRunner.java
===================================================================
--- workspace/dgolovin/org.jboss.tools.testng.app/src/com/exadel/testng/TestRunner.java
(rev 0)
+++
workspace/dgolovin/org.jboss.tools.testng.app/src/com/exadel/testng/TestRunner.java 2009-04-23
18:32:23 UTC (rev 14877)
@@ -0,0 +1,145 @@
+/**
+ *
+ */
+package com.exadel.testng;
+
+import java.io.IOException;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtension;
+import org.eclipse.core.runtime.IPlatformRunnable;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.equinox.app.IApplication;
+import org.eclipse.equinox.app.IApplicationContext;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.testing.ITestHarness;
+import org.eclipse.ui.testing.TestableObject;
+import org.osgi.framework.Bundle;
+import org.testng.TestNG;
+
+/**
+ * @author eskimo
+ *
+ */
+public class TestRunner implements IApplication,IPlatformRunnable, ITestHarness {
+ private static final String DEFAULT_APP_3_0 = "org.eclipse.ui.ide.workbench";
//$NON-NLS-1$
+ private IApplicationContext appContext;
+ private String fTestRunnerResult;
+ private TestableObject fTestableObject;
+
+ /* (non-Javadoc)
+ * @see
org.eclipse.equinox.app.IApplication#start(org.eclipse.equinox.app.IApplicationContext)
+ */
+ public Object start(IApplicationContext context) throws Exception {
+ this.appContext = context;
+ String[] args = (String[])
appContext.getArguments().get("application.args");
+ if (args == null)
+ args = new String[0];
+ return run(args);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.equinox.app.IApplication#stop()
+ */
+ public void stop() {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.boot.IPlatformRunnable
+ */
+ public Object run(final Object args) throws Exception {
+ // Get the application to test
+ Object application = getApplication(new String[]
{"org.eclipse.ui.ide.workbench"});
+
+ Object result;
+
+ result = runApplication(application, args);
+ if (!IPlatformRunnable.EXIT_OK.equals(result)) {
+ System.err.println("UITestRunner: Unexpected result from running application
" + application + ": " + result);
+ }
+ return new Integer(fTestRunnerResult);
+ }
+
+
+ /*
+ * return the application to run, or null if not even the default application
+ * is found.
+ */
+ private Object getApplication(String[] args) throws CoreException {
+ // Assume we are in 3.0 mode.
+ // Find the name of the application as specified by the PDE JUnit launcher.
+ // If no application is specified, the 3.0 default workbench application
+ // is returned.
+ IExtension extension =
+ Platform.getExtensionRegistry().getExtension(
+ Platform.PI_RUNTIME,
+ Platform.PT_APPLICATIONS,
+ getApplicationToRun(args));
+
+
+
+ // If the extension does not have the correct grammar, return null.
+ // Otherwise, return the application object.
+ IConfigurationElement[] elements = extension.getConfigurationElements();
+ if (elements.length > 0) {
+ IConfigurationElement[] runs = elements[0].getChildren("run");
//$NON-NLS-1$
+ if (runs.length > 0) {
+ Object runnable = runs[0].createExecutableExtension("class");
//$NON-NLS-1$
+ if (runnable instanceof IPlatformRunnable)
+ return (IPlatformRunnable) runnable;
+ if (runnable instanceof IApplication)
+ return (IApplication) runnable;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * The -testApplication argument specifies the application to be run.
+ * If the PDE JUnit launcher did not set this argument, then return
+ * the name of the default application.
+ * In 3.0, the default is the "org.eclipse.ui.ide.worbench" application.
+ *
+ */
+ private String getApplicationToRun(String[] args) {
+ for (int i = 0; i < args.length; i++) {
+ if (args[i].equals("-testApplication") && i < args.length -1)
//$NON-NLS-1$
+ return args[i+1];
+ }
+ return DEFAULT_APP_3_0;
+ }
+
+ /**
+ * In 3.0 mode
+ *
+ */
+ private Object runApplication(Object application, Object args) throws Exception {
+ fTestableObject = PlatformUI.getTestableObject();
+ fTestableObject.setTestHarness(this);
+ if (application instanceof IPlatformRunnable) {
+ return ((IPlatformRunnable) application).run(args);
+ }
+ return ((IApplication) application).start(appContext);
+
+ }
+
+ public void runTests() {
+ Bundle bundle = Platform.getBundle("com.exadel.testng");
+ String tplPrjLcStr = null;
+
+ try {
+ tplPrjLcStr = FileLocator.resolve(bundle.getEntry("/tests.xml")).getFile();
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ TestNG.main(new String[]{tplPrjLcStr, "-d /home/eskimo/temp/test-ng"});
+
+ }
+
+}
Property changes on:
workspace/dgolovin/org.jboss.tools.testng.app/src/com/exadel/testng/TestRunner.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: workspace/dgolovin/org.jboss.tools.testng.app/src/org/jboss/test/Test1.java
===================================================================
--- workspace/dgolovin/org.jboss.tools.testng.app/src/org/jboss/test/Test1.java
(rev 0)
+++ workspace/dgolovin/org.jboss.tools.testng.app/src/org/jboss/test/Test1.java 2009-04-23
18:32:23 UTC (rev 14877)
@@ -0,0 +1,11 @@
+package org.jboss.test;
+
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.testng.annotations.Test;
+
+public class Test1 {
+ @Test
+ public void testRosyScenario() {
+ System.out.println(ResourcesPlugin.getWorkspace().getRoot().getLocation());
+ }
+}
Property changes on:
workspace/dgolovin/org.jboss.tools.testng.app/src/org/jboss/test/Test1.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: workspace/dgolovin/org.jboss.tools.testng.app/testng-5.8-jdk15.jar
===================================================================
(Binary files differ)
Property changes on: workspace/dgolovin/org.jboss.tools.testng.app/testng-5.8-jdk15.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: workspace/dgolovin/org.jboss.tools.testng.app/tests.xml
===================================================================
--- workspace/dgolovin/org.jboss.tools.testng.app/tests.xml (rev
0)
+++ workspace/dgolovin/org.jboss.tools.testng.app/tests.xml 2009-04-23 18:32:23 UTC (rev
14877)
@@ -0,0 +1,15 @@
+<!DOCTYPE suite SYSTEM "http://beust.com/testng/testng-1.0.dtd" >
+
+<suite name="My test suite">
+
+ <test name="First test">
+
+ <classes>
+
+ <class name="org.jboss.test.Test1" />
+
+ </classes>
+
+ </test>
+
+</suite>
\ No newline at end of file
Property changes on: workspace/dgolovin/org.jboss.tools.testng.app/tests.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Show replies by date