[testng] 350/355: Remove old projects
Eugene Zhukov
eugene-guest at moszumanska.debian.org
Tue Aug 18 10:20:23 UTC 2015
This is an automated email from the git hooks/post-receive script.
eugene-guest pushed a commit to annotated tag OpenBSD
in repository testng.
commit 50f705422b30e9fe018f4973e64a084d544f0a5b
Author: Julien Herr <julien.herr at alcatel-lucent.com>
Date: Thu May 21 18:57:31 2015 +0200
Remove old projects
---
gigaspaces/.classpath | 12 -
gigaspaces/.project | 17 --
gigaspaces/3rdparty/JSpaces.jar | Bin 5446503 -> 0 bytes
.../3rdparty/common/backport-util-concurrent.jar | Bin 327810 -> 0 bytes
gigaspaces/3rdparty/jini/jsk-lib.jar | Bin 291877 -> 0 bytes
gigaspaces/3rdparty/jini/jsk-platform.jar | Bin 995179 -> 0 bytes
gigaspaces/build.xml | 101 -------
.../src/org/testng/gigaspaces/ResultEntry.java | 44 ---
.../org/testng/gigaspaces/SpaceMasterAdapter.java | 153 ----------
.../org/testng/gigaspaces/SpaceWorkerAdapter.java | 113 -------
.../src/org/testng/gigaspaces/SuiteEntry.java | 59 ----
.../test/src/test/gigaspaces/DistributedTest.java | 171 -----------
gigaspaces/test/src/test/gigaspaces/Test1.java | 15 -
gigaspaces/test/src/test/gigaspaces/Test2.java | 14 -
spring/.classpath | 15 -
spring/.cvsignore | 3 -
spring/.project | 17 --
spring/3rdparty/commons-logging-1.0.4.jar | Bin 38015 -> 0 bytes
spring/3rdparty/spring-mock.jar | Bin 99358 -> 0 bytes
spring/3rdparty/spring.jar | Bin 2593850 -> 0 bytes
spring/LICENSE.txt | 201 -------------
spring/README.TXT | 23 --
spring/build.xml | 94 ------
...tractDependencyInjectionSpringContextTests.java | 259 ----------------
.../spring/test/AbstractSpringContextTests.java | 140 ---------
...tTransactionalDataSourceSpringContextTests.java | 175 -----------
.../AbstractTransactionalSpringContextTests.java | 328 ---------------------
.../src/common/org/testng/spring/test/package.html | 14 -
.../test/AbstractSingleSpringContextTests.java | 192 ------------
.../AbstractAnnotationAwareTransactionalTests.java | 67 -----
.../test/AbstractSingleSpringContextTests.java | 194 ------------
31 files changed, 2421 deletions(-)
diff --git a/gigaspaces/.classpath b/gigaspaces/.classpath
deleted file mode 100644
index 40194be..0000000
--- a/gigaspaces/.classpath
+++ /dev/null
@@ -1,12 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="src" path="test/src"/>
- <classpathentry kind="lib" path="3rdparty/JSpaces.jar"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry combineaccessrules="false" kind="src" path="/TestNG"/>
- <classpathentry kind="lib" path="3rdparty/jini/jsk-lib.jar"/>
- <classpathentry kind="lib" path="3rdparty/jini/jsk-platform.jar"/>
- <classpathentry kind="lib" path="3rdparty/common/backport-util-concurrent.jar"/>
- <classpathentry kind="output" path="z_build"/>
-</classpath>
diff --git a/gigaspaces/.project b/gigaspaces/.project
deleted file mode 100644
index f89ddc5..0000000
--- a/gigaspaces/.project
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>testng-gigaspaces</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
diff --git a/gigaspaces/3rdparty/JSpaces.jar b/gigaspaces/3rdparty/JSpaces.jar
deleted file mode 100644
index 5f113fb..0000000
Binary files a/gigaspaces/3rdparty/JSpaces.jar and /dev/null differ
diff --git a/gigaspaces/3rdparty/common/backport-util-concurrent.jar b/gigaspaces/3rdparty/common/backport-util-concurrent.jar
deleted file mode 100644
index 99f9b9c..0000000
Binary files a/gigaspaces/3rdparty/common/backport-util-concurrent.jar and /dev/null differ
diff --git a/gigaspaces/3rdparty/jini/jsk-lib.jar b/gigaspaces/3rdparty/jini/jsk-lib.jar
deleted file mode 100644
index 7a65cae..0000000
Binary files a/gigaspaces/3rdparty/jini/jsk-lib.jar and /dev/null differ
diff --git a/gigaspaces/3rdparty/jini/jsk-platform.jar b/gigaspaces/3rdparty/jini/jsk-platform.jar
deleted file mode 100644
index 647658d..0000000
Binary files a/gigaspaces/3rdparty/jini/jsk-platform.jar and /dev/null differ
diff --git a/gigaspaces/build.xml b/gigaspaces/build.xml
deleted file mode 100644
index be3d929..0000000
--- a/gigaspaces/build.xml
+++ /dev/null
@@ -1,101 +0,0 @@
-<project name="testng-gigaspaces" default="both" basedir=".">
-
- <target name="init">
- <tstamp />
- <property file="../build.properties" />
- <property file="build.properties" />
- <!-- Settings -->
- <property name="jdk" value="jdk15" />
- <property name="optimize" value="false" />
- <property name="debug" value="true" />
-
- <!-- Directories -->
- <property name="src.dir" location="src" />
- <property name="topbuild.dir" location="build" />
- <property name="build.dir" location="${topbuild.dir}/${jdk}" />
- <property name="classes.dir" location="${build.dir}/classes" />
- <property name="dependencies.dir" location="3rdparty" />
- <property name="topjavadocs.dir" location="javadocs" />
- <property name="javadocs.dir" location="${topjavadocs.dir}/${jdk}" />
-
- <property name="testng.gigaspaces.jar" location="testng-gigaspaces-${jdk}.jar" />
-
- <condition property="source.version" value="1.4">
- <equals arg1="${jdk}" arg2="jdk14"/>
- </condition>
- <condition property="source.version" value="1.5">
- <equals arg1="${jdk}" arg2="jdk15"/>
- </condition>
- </target>
-
- <target name="paths" depends="init">
- <path id="src.path">
- <pathelement path="${src.dir}" />
- </path>
- <path id="compile.path">
- <fileset dir="${dependencies.dir}">
- <include name="*.jar" />
- </fileset>
- <pathelement path="../testng-${testng.version}-${jdk}.jar" />
- </path>
- </target>
-
- <target name="compile" depends="paths" description="compile sources">
- <echo message=" -- Compiling ${jdk} sources --" />
- <mkdir dir="${classes.dir}"/>
- <javac target="jsr14"
- debug="${debug}" optimize="${optimize}"
- destdir="${classes.dir}">
- <src refid="src.path" />
- <classpath refid="compile.path" />
- </javac>
- </target>
-
- <target name="jar" depends="compile">
- <echo message=" -- Creating ${jdk} jar --" />
- <jar destfile="${testng.gigaspaces.jar}">
- <fileset dir="${classes.dir}" />
- </jar>
- </target>
-
- <target name="javadoc" depends="paths" description="generate api documentation">
- <echo message=" -- Generating javadocs for ${jdk} --" />
- <mkdir dir="${javadocs.dir}" />
- <javadoc destdir="${javadocs.dir}" source="${source.version}" windowtitle="TestNG GigaSpaces Support" classpathref="compile.path">
- <fileset dir="${src.dir}/common" defaultexcludes="yes" includes="**/*.java" />
- <fileset dir="${src.dir}/${jdk}" defaultexcludes="yes" includes="**/*.java" />
- </javadoc>
- </target>
-
- <target name="both">
- <property name="target" value="jar"/>
- <antcall target="${target}">
- <param name="jdk" value="jdk14"/>
- </antcall>
- <antcall target="${target}">
- <param name="jdk" value="jdk15"/>
- </antcall>
- </target>
-
- <target name="dist" description="builds both jdk14 and jdk15 variants">
- <antcall target="both">
- <param name="target" value="jar"/>
- </antcall>
- </target>
-
- <target name="javadocs" description="builds both jdk14 and jdk15 javadocs">
- <antcall target="both">
- <param name="target" value="javadoc"/>
- </antcall>
- </target>
-
- <target name="all" depends="dist,javadocs" description="build jar files and javadocs" />
-
- <target name="clean" depends="paths" description="cleans all">
- <delete dir="${topbuild.dir}" />
- <delete dir="${topjavadocs.dir}" />
- <delete file="testng-gigaspaces-jdk14.jar" />
- <delete file="testng-gigaspaces-jdk15.jar" />
- </target>
-
-</project>
diff --git a/gigaspaces/src/org/testng/gigaspaces/ResultEntry.java b/gigaspaces/src/org/testng/gigaspaces/ResultEntry.java
deleted file mode 100644
index 8e75638..0000000
--- a/gigaspaces/src/org/testng/gigaspaces/ResultEntry.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package org.testng.gigaspaces;
-
-import java.util.UUID;
-
-import org.testng.ISuite;
-
-/**
- * @author Guy Korland
- *
- * @date April 20, 2007
- */
-public class ResultEntry
-{
- private ISuite _suite;
- private UUID m_testID;
-
- public ResultEntry() {}
-
- public ResultEntry( ISuite suite, UUID testID)
- {
- _suite = suite;
- m_testID = testID;
- }
-
- public ISuite getSuite()
- {
- return _suite;
- }
-
- public void setSuite( ISuite suite)
- {
- _suite = suite;
- }
-
- public UUID getTestID()
- {
- return m_testID;
- }
-
- public void setTestID(UUID testid)
- {
- m_testID = testid;
- }
-}
\ No newline at end of file
diff --git a/gigaspaces/src/org/testng/gigaspaces/SpaceMasterAdapter.java b/gigaspaces/src/org/testng/gigaspaces/SpaceMasterAdapter.java
deleted file mode 100644
index 93183c9..0000000
--- a/gigaspaces/src/org/testng/gigaspaces/SpaceMasterAdapter.java
+++ /dev/null
@@ -1,153 +0,0 @@
-package org.testng.gigaspaces;
-
-import java.io.IOException;
-import java.util.Properties;
-import java.util.UUID;
-
-import net.jini.core.lease.Lease;
-
-import org.testng.remote.adapter.IMasterAdapter;
-import org.testng.remote.adapter.RemoteResultListener;
-import org.testng.xml.XmlSuite;
-
-import com.j_spaces.core.IJSpace;
-import com.j_spaces.core.client.SpaceFinder;
-
-import edu.emory.mathcs.backport.java.util.concurrent.ConcurrentHashMap;
-import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicInteger;
-
-/**
- * Provides a Master adapter based on Gigaspaces space implementation.
- *
- * @author Guy Korland
- *
- * @date April 20, 2007
- */
-public class SpaceMasterAdapter implements IMasterAdapter
-{
- public static final String SPACE_URL = "gigaspaces.url";
-
- private IJSpace m_space;
-
- final private ConcurrentHashMap m_listeners = new ConcurrentHashMap();
-
- final private SuitesCounter m_counter = new SuitesCounter();
- private ResultCollector m_collector;
-
- /*
- * @see org.testng.remote.adapter.IWorkerApadter#init(java.util.Properties)
- */
- public void init(Properties prop) throws Exception
- {
- String url = prop.getProperty(SPACE_URL, "/./TestNGSpace?groups=TestNG");
- m_space = (IJSpace) SpaceFinder.find(url);
- m_collector = new ResultCollector();
- m_collector.start();
- }
-
- /*
- * @see org.testng.remote.adapter.IMasterAdapter#awaitTermination(long)
- */
- public void awaitTermination(long timeout) throws InterruptedException
- {
- try
- {
- m_counter.waitFor( timeout);
- }
- finally
- {
- m_collector.shutDown();
- }
- }
-
- /*
- * @see org.testng.remote.adapter.IMasterAdapter#runSuitesRemotely(org.testng.xml.XmlSuite, org.testng.remote.adapter.RemoteResultListener)
- */
- public void runSuitesRemotely(XmlSuite suite, RemoteResultListener listener)
- throws IOException
- {
- UUID testID = UUID.randomUUID();
- SuiteEntry suiteEntry = new SuiteEntry( suite, testID);
- try
- {
- m_listeners.putIfAbsent(testID, listener);
- m_space.write(suiteEntry, null, Lease.FOREVER);
- m_counter.inc();
- }
- catch (Exception e)
- {
- m_listeners.remove( testID);
- e.printStackTrace();
- }
- }
-
- private class ResultCollector extends Thread
- {
- final private ResultEntry resultTemplate = new ResultEntry();
- volatile private boolean m_shutdown = false;
-
- public ResultCollector()
- {
- this.setDaemon(true);
- this.setName("ResultCollector");
- }
-
- public void run()
- {
- while( !m_shutdown)
- {
- try
- {
- ResultEntry rs = (ResultEntry) m_space.take(resultTemplate, null,
- Long.MAX_VALUE);
- RemoteResultListener listener = (RemoteResultListener)m_listeners.remove(rs.getTestID());
- listener.onResult(rs.getSuite());
- m_counter.dec();
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- }
- }
-
- public void shutDown()
- {
- m_shutdown = true;
- this.interrupt();
- }
- }
-
-
- private static class SuitesCounter
- {
- private AtomicInteger m_count = new AtomicInteger(1);
-
- public void dec()
- {
- int c = m_count.decrementAndGet();
- if( c == 0)
- {
- synchronized (this)
- {
- notifyAll();
- }
- }
- }
-
- public void inc()
- {
- m_count.incrementAndGet();
- }
-
- public void waitFor( long timeout) throws InterruptedException
- {
- m_count.decrementAndGet();
- synchronized (this)
- {
- wait( timeout);
- }
-
- }
- }
-}
diff --git a/gigaspaces/src/org/testng/gigaspaces/SpaceWorkerAdapter.java b/gigaspaces/src/org/testng/gigaspaces/SpaceWorkerAdapter.java
deleted file mode 100644
index 647c992..0000000
--- a/gigaspaces/src/org/testng/gigaspaces/SpaceWorkerAdapter.java
+++ /dev/null
@@ -1,113 +0,0 @@
-package org.testng.gigaspaces;
-
-import java.io.IOException;
-import java.util.Properties;
-
-import net.jini.core.entry.UnusableEntryException;
-import net.jini.core.lease.Lease;
-import net.jini.core.lease.LeaseException;
-import net.jini.core.transaction.Transaction;
-import net.jini.core.transaction.TransactionException;
-import net.jini.core.transaction.TransactionFactory;
-import net.jini.core.transaction.Transaction.Created;
-import net.jini.core.transaction.server.TransactionManager;
-
-import org.testng.ISuite;
-import org.testng.internal.Utils;
-import org.testng.remote.adapter.IWorkerApadter;
-import org.testng.xml.XmlSuite;
-
-import com.j_spaces.core.IJSpace;
-import com.j_spaces.core.client.LocalTransactionManager;
-import com.j_spaces.core.client.SpaceFinder;
-
-
-/**
- * Provides a Worker adapter based on Gigaspaces space implementation.
- *
- * @author Guy Korland
- *
- * @date April 20, 2007
- */
-public class SpaceWorkerAdapter implements IWorkerApadter
-{
- public static final String SPACE_URL = "gigaspaces.url";
- public static final String SLAVE_TIMEOUT = "gigaspaces.slave.timeout";
-
- final private SuiteEntry _suiteTemplate = new SuiteEntry();
-
- private long m_transactionTimeout;
- private TransactionManager m_tm;
- private IJSpace m_space;
- private Transaction m_currentTransaction;
- private SuiteEntry m_currentSuite;
-
- public SpaceWorkerAdapter()
- {
- }
-
- /*
- * @see org.testng.remote.adapter.IWorkerApadter#init(java.util.Properties)
- */
- public void init(Properties prop) throws Exception
- {
- String url = prop.getProperty(SPACE_URL, "jini://*/*/TestNGSpace?groups=TestNG");
- m_space = (IJSpace) SpaceFinder.find(url);
- m_tm = LocalTransactionManager.getInstance(m_space);
- //default 5 min
- m_transactionTimeout = Integer.parseInt( prop.getProperty(SLAVE_TIMEOUT, "300000"));
- }
-
- /*
- * @see org.testng.remote.adapter.IWorkerApadter#getSuite(long)
- */
- public XmlSuite getSuite(long timeout) throws InterruptedException,
- IOException
- {
- try
- {
- Created created = TransactionFactory.create(m_tm, m_transactionTimeout);
- m_currentTransaction = created.transaction;
-
- m_currentSuite = (SuiteEntry) m_space.take( _suiteTemplate, m_currentTransaction, m_transactionTimeout);
- created.lease.renew(m_transactionTimeout);
- return m_currentSuite.getSuite();
- }
- catch (TransactionException e)
- {
- Utils.log( "Transaction error", 1, e.toString());
- }
- catch (LeaseException e)
- {
- Utils.log( "Lease error", 1, e.toString());
- }
- catch (UnusableEntryException e)
- {
- IOException ex = new IOException();
- ex.initCause(e);
- throw ex;
- }
- return null;
- }
-
- /*
- * @see org.testng.remote.adapter.IWorkerApadter#returnResult(org.testng.ISuite)
- */
- public void returnResult(ISuite result) throws IOException
- {
- try
- {
- m_space.write(new ResultEntry(result, m_currentSuite.getTestID()), m_currentTransaction, Lease.FOREVER);
- m_currentTransaction.commit();
- }
- catch (TransactionException e)
- {
- Utils.log( "Transaction error", 0, e.toString());
- }
- finally
- {
- m_currentTransaction = null;
- m_currentSuite = null;
- }
- }
-}
diff --git a/gigaspaces/src/org/testng/gigaspaces/SuiteEntry.java b/gigaspaces/src/org/testng/gigaspaces/SuiteEntry.java
deleted file mode 100644
index b9fc373..0000000
--- a/gigaspaces/src/org/testng/gigaspaces/SuiteEntry.java
+++ /dev/null
@@ -1,59 +0,0 @@
-package org.testng.gigaspaces;
-
-import java.util.UUID;
-
-import org.testng.xml.XmlSuite;
-
-/**
- * @author Guy Korland
- *
- * @date April 20, 2007
- */
-public class SuiteEntry
-{
- private XmlSuite m_suite;
- private UUID m_testID;
-
- public SuiteEntry() {}
-
- public SuiteEntry( XmlSuite suite, UUID testID)
- {
- m_suite = suite;
- m_testID = testID;
- }
-
- public XmlSuite getSuite()
- {
- return m_suite;
- }
-
- public void setSuite( XmlSuite suite)
- {
- m_suite = suite;
- }
-
- public String getSuiteName()
- {
- return m_suite.getName();
- }
-
- public String getTestName()
- {
- return m_suite.getTest();
- }
-
- public boolean isJUnit()
- {
- return m_suite.isJUnit();
- }
-
- public UUID getTestID()
- {
- return m_testID;
- }
-
- public void setTestID(UUID testid)
- {
- m_testID = testid;
- }
-}
diff --git a/gigaspaces/test/src/test/gigaspaces/DistributedTest.java b/gigaspaces/test/src/test/gigaspaces/DistributedTest.java
deleted file mode 100644
index 3bbb060..0000000
--- a/gigaspaces/test/src/test/gigaspaces/DistributedTest.java
+++ /dev/null
@@ -1,171 +0,0 @@
-package test.gigaspaces;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Random;
-
-import org.testng.Assert;
-import org.testng.ITestResult;
-import org.testng.TestListenerAdapter;
-import org.testng.TestNG;
-import org.testng.annotations.Configuration;
-import org.testng.annotations.Test;
-import org.testng.remote.SuiteDispatcher;
-import org.testng.xml.XmlClass;
-import org.testng.xml.XmlSuite;
-import org.testng.xml.XmlTest;
-
-import test.BaseDistributedTest;
-
-import testhelper.OutputDirectoryPatch;
-
-public class DistributedTest extends BaseDistributedTest {
-
- private List<Thread> m_hostThreads = new ArrayList<Thread>();
-
- protected Thread startSlave(final String filename) {
- Thread result = new Thread(new Runnable() {
- public void run() {
- TestNG.main(new String[] { "-slave", filename, "-d", OutputDirectoryPatch.getOutputDirectory() });
- }
- });
- result.setName("Slave-" + filename);
- result.start();
- m_hostThreads.add(result);
- return result;
- }
-
- private File createMasterProperties(String strategy)
- throws IOException
- {
- String fileName = "remote";
-
- File result = File.createTempFile(fileName, ".properties");
- result.deleteOnExit();
- Properties p = new Properties();
- p.setProperty("testng.master.strategy", strategy);
- p.setProperty("testng.verbose", "0");
- p.setProperty("testng.master.adpter", "org.testng.gigaspaces.SpaceMasterAdapter");
- p.setProperty("gigaspaces.url", "/./TestNGSpace?groups=TestNG");
- FileOutputStream fos = new FileOutputStream(result);
- p.store(fos, "Automatically generated by tests");
- fos.close();
-
- return result;
- }
-
- private File createSlaveProperties()
- throws IOException
- {
- String fileName = "remote";
-
- File result = File.createTempFile(fileName, ".properties");
- result.deleteOnExit();
- Properties p = new Properties();
- p.setProperty("testng.verbose", "0");
- p.setProperty("testng.slave.adpter", "org.testng.gigaspaces.SpaceWorkerAdapter");
- p.setProperty("gigaspaces.url", "jini://*/*/TestNGSpace?groups=TestNG&timeout=10000");
- FileOutputStream fos = new FileOutputStream(result);
- p.store(fos, "Automatically generated by tests");
- fos.close();
-
- return result;
- }
-
- private XmlSuite createSuite(String name, Class[] classes) {
- XmlSuite result = new XmlSuite();
- result.setName(name);
-
- for (Class c : classes) {
- XmlTest test1 = new XmlTest(result);
- test1.setName(c.getName());
- XmlClass class1 = new XmlClass(c);
- test1.getXmlClasses().add(class1);
- }
-
- return result;
- }
-
-// @ Configuration(beforeTestClass = true)
- private void startSlaves() throws IOException{
- int port = new Random().nextInt(50000) + 2000;
- m_ports = new String[] { Integer.toString(port), Integer.toString(port+1)};
-
- File slaveFile = createSlaveProperties();
- startSlave( slaveFile.getCanonicalPath());
-
- slaveFile = createSlaveProperties();
- startSlave( slaveFile.getCanonicalPath());
- }
-
- private String[] m_ports = new String[2];
-
- public TestListenerAdapter twoHosts(String strategy) throws IOException {
- TestNG tng = new TestNG();
- tng.setOutputDirectory(OutputDirectoryPatch.getOutputDirectory());
-
- File masterFile = createMasterProperties(strategy);
- tng.setMaster(masterFile.getAbsolutePath());
-
- XmlSuite suite = createSuite("DistributedSuite1", new Class[] { Test1.class, Test2.class });
- tng.setXmlSuites(Arrays.asList(new XmlSuite[] { suite }));
-
- TestListenerAdapter result = new TestListenerAdapter();
- tng.addListener(result);
- tng.run();
-
- String[] passed = {
- "f1", "f2"
- };
- String[] failed = {};
- String[] skipped = {};
-
- verifyTests("Passed", passed, toMap(result.getPassedTests()));
- verifyTests("Failed", failed, toMap(result.getFailedTests()));
- verifyTests("Skipped", skipped, toMap(result.getSkippedTests()));
-
- return result;
- }
-
- @Test
- public void twoHostsWithTestStrategy() throws IOException {
- startSlaves();
- TestListenerAdapter listener = twoHosts(SuiteDispatcher.STRATEGY_TEST);
-
- boolean found1 = false;
- boolean found2 = false;
- for (ITestResult tr : listener.getPassedTests()) {
- String host = tr.getHost();
- if (! found1) found1 = host.contains(m_ports[0]);
- if (! found2) found2 = host.contains(m_ports[1]);
- }
- Assert.assertTrue(found1, "No tests ran on port " + m_ports[0]);
- Assert.assertTrue(found2, "No tests ran on port " + m_ports[1]);
- }
-
- @Test
- public void twoHostsWithSuiteStrategy() throws IOException {
- startSlaves();
- TestListenerAdapter listener = twoHosts( SuiteDispatcher.STRATEGY_SUITE);
- }
-
- private Map<String, ITestResult> toMap(List<ITestResult> results) {
- Map<String, ITestResult> result = new HashMap<String, ITestResult>();
- for (ITestResult tr : results) {
- result.put(tr.getName(), tr);
- }
-
- return result;
- }
- private void ppp(String string) {
- System.out.println("[DistributedTest] " + string);
- }
-}
-
diff --git a/gigaspaces/test/src/test/gigaspaces/Test1.java b/gigaspaces/test/src/test/gigaspaces/Test1.java
deleted file mode 100644
index cf320f0..0000000
--- a/gigaspaces/test/src/test/gigaspaces/Test1.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package test.gigaspaces;
-
-import org.testng.annotations.Test;
-
-public class Test1 {
- @Test
- public void f1() {
-// ppp("f1");
- }
-
- private void ppp(String s) {
- System.out.println("[Test1] " + s);
- }
-}
-
diff --git a/gigaspaces/test/src/test/gigaspaces/Test2.java b/gigaspaces/test/src/test/gigaspaces/Test2.java
deleted file mode 100644
index 83bd3eb..0000000
--- a/gigaspaces/test/src/test/gigaspaces/Test2.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package test.gigaspaces;
-
-import org.testng.annotations.Test;
-
-public class Test2 {
- @Test
- public void f2() {
-// ppp("f2");
- }
-
- private void ppp(String s) {
- System.out.println("[Test2] " + s);
- }
-}
diff --git a/spring/.classpath b/spring/.classpath
deleted file mode 100644
index d401428..0000000
--- a/spring/.classpath
+++ /dev/null
@@ -1,15 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src/common"/>
- <classpathentry kind="src" path="src/jdk15"/>
- <classpathentry kind="src" path="sandbox/src"/>
- <classpathentry kind="lib" path="3rdparty/commons-logging-1.0.4.jar"/>
- <classpathentry kind="lib" path="3rdparty/spring-beans-1.2.3.jar"/>
- <classpathentry kind="lib" path="3rdparty/spring-context-1.2.3.jar"/>
- <classpathentry kind="lib" path="3rdparty/spring-core-1.2.3.jar"/>
- <classpathentry kind="lib" path="3rdparty/spring-dao-1.2.3.jar"/>
- <classpathentry kind="lib" path="3rdparty/spring-jdbc-1.2.3.jar"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry combineaccessrules="false" kind="src" path="/TestNG"/>
- <classpathentry kind="output" path="z_build"/>
-</classpath>
diff --git a/spring/.cvsignore b/spring/.cvsignore
deleted file mode 100644
index 05344d4..0000000
--- a/spring/.cvsignore
+++ /dev/null
@@ -1,3 +0,0 @@
-build
-javadocs
-testng-spring-jdk*
diff --git a/spring/.project b/spring/.project
deleted file mode 100644
index 3b43e1b..0000000
--- a/spring/.project
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>testng-spring</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
diff --git a/spring/3rdparty/commons-logging-1.0.4.jar b/spring/3rdparty/commons-logging-1.0.4.jar
deleted file mode 100644
index b73a80f..0000000
Binary files a/spring/3rdparty/commons-logging-1.0.4.jar and /dev/null differ
diff --git a/spring/3rdparty/spring-mock.jar b/spring/3rdparty/spring-mock.jar
deleted file mode 100644
index 66ffd93..0000000
Binary files a/spring/3rdparty/spring-mock.jar and /dev/null differ
diff --git a/spring/3rdparty/spring.jar b/spring/3rdparty/spring.jar
deleted file mode 100644
index 3ebefd8..0000000
Binary files a/spring/3rdparty/spring.jar and /dev/null differ
diff --git a/spring/LICENSE.txt b/spring/LICENSE.txt
deleted file mode 100644
index 261eeb9..0000000
--- a/spring/LICENSE.txt
+++ /dev/null
@@ -1,201 +0,0 @@
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
diff --git a/spring/README.TXT b/spring/README.TXT
deleted file mode 100644
index 7fd4e05..0000000
--- a/spring/README.TXT
+++ /dev/null
@@ -1,23 +0,0 @@
-This area provides spring support classes for testng.
-
-They provide the following services:
- - Context caching
- - Dependency Injection for test classes
- - Inherited instance variables useful for testing.
- - Transaction management appropriate to tests.
-
-Please refer to http://static.springframework.org/spring/docs/1.2.x/reference/testing.html for more details.
-
-The code here is based on spring's test support classes found in the org.springframework.test package.
-
-Here is a list of the modifications that were performed:
-
- 1- Renamed package name from org.springframework.test to org.testng.spring.test to avoid conflicts.
- 2- Removed dependency on JUnit from AbstractSpringContextTests class
- Removed import org.junit stuff
- Removed extends TestCase
- 3- Added javadoc tags in setup and teardown methods of AbstractDependencyInjectionSpringContextTests (jdk14 src tree)
- to make it compatible with testng.
- 4- Added annotations in setup and teardown methods of AbstractDependencyInjectionSpringContextTests (jdk15 src tree)
- to make it compatible with testng.
-
diff --git a/spring/build.xml b/spring/build.xml
deleted file mode 100644
index 366892e..0000000
--- a/spring/build.xml
+++ /dev/null
@@ -1,94 +0,0 @@
-<project name="testng-spring" default="both" basedir=".">
-
- <target name="init">
- <tstamp />
- <property file="../build.properties" />
- <property file="build.properties" />
- <!-- Settings -->
- <property name="jdk" value="jdk14" />
- <property name="optimize" value="false" />
- <property name="debug" value="true" />
-
- <!-- Directories -->
- <property name="src.dir" location="src" />
- <property name="topbuild.dir" location="build" />
- <property name="build.dir" location="${topbuild.dir}/${jdk}" />
- <property name="classes.dir" location="${build.dir}/classes" />
- <property name="dependencies.dir" location="lib" />
- <property name="topjavadocs.dir" location="javadocs" />
- <property name="javadocs.dir" location="${topjavadocs.dir}/${jdk}" />
-
- <property name="testng.spring.jar" location="testng-spring-${jdk}.jar" />
-
- <condition property="source.version" value="1.4"><equals arg1="${jdk}" arg2="jdk14"/></condition>
- <condition property="source.version" value="1.5"><equals arg1="${jdk}" arg2="jdk15"/></condition>
- </target>
-
- <target name="paths" depends="init">
- <path id="src.path">
- <pathelement path="${src.dir}/common" />
- <pathelement path="${src.dir}/${jdk}" />
- </path>
- <path id="compile.path">
- <fileset dir="${dependencies.dir}">
- <include name="*.jar" />
- </fileset>
- <pathelement path="../testng-${testng.version}-${jdk}.jar" />
- </path>
- </target>
-
- <target name="compile" depends="paths" description="compile sources">
- <echo message=" -- Compiling ${jdk} sources --" />
- <mkdir dir="${classes.dir}"/>
- <javac source="${source.version}" target="${source.version}"
- debug="${debug}" optimize="${optimize}"
- destdir="${classes.dir}">
- <src refid="src.path" />
- <classpath refid="compile.path" />
- </javac>
- </target>
-
- <target name="jar" depends="compile">
- <echo message=" -- Creating ${jdk} jar --" />
- <jar destfile="${testng.spring.jar}">
- <fileset dir="${classes.dir}" />
- </jar>
- </target>
-
- <target name="javadoc" depends="paths" description="generate api documentation">
- <echo message=" -- Generating javadocs for ${jdk} --" />
- <mkdir dir="${javadocs.dir}" />
- <javadoc destdir="${javadocs.dir}" source="${source.version}" windowtitle="TestNG Spring Support" classpathref="compile.path">
- <fileset dir="${src.dir}/common" defaultexcludes="yes" includes="**/*.java" />
- <fileset dir="${src.dir}/${jdk}" defaultexcludes="yes" includes="**/*.java" />
- </javadoc>
- </target>
-
- <target name="both">
- <property name="target" value="jar"/>
- <antcall target="${target}">
- <param name="jdk" value="jdk14"/>
- </antcall>
- <antcall target="${target}">
- <param name="jdk" value="jdk15"/>
- </antcall>
- </target>
-
- <target name="dist" description="builds both jdk14 and jdk15 variants">
- <antcall target="both"><param name="target" value="jar"/></antcall>
- </target>
-
- <target name="javadocs" description="builds both jdk14 and jdk15 javadocs">
- <antcall target="both"><param name="target" value="javadoc"/></antcall>
- </target>
-
- <target name="all" depends="dist,javadocs" description="build jar files and javadocs" />
-
- <target name="clean" depends="paths" description="cleans all">
- <delete dir="${topbuild.dir}" />
- <delete dir="${topjavadocs.dir}" />
- <delete file="testng-spring-jdk14.jar" />
- <delete file="testng-spring-jdk15.jar" />
- </target>
-
-</project>
diff --git a/spring/src/common/org/testng/spring/test/AbstractDependencyInjectionSpringContextTests.java b/spring/src/common/org/testng/spring/test/AbstractDependencyInjectionSpringContextTests.java
deleted file mode 100644
index dc006e3..0000000
--- a/spring/src/common/org/testng/spring/test/AbstractDependencyInjectionSpringContextTests.java
+++ /dev/null
@@ -1,259 +0,0 @@
-/*
- * Copyright 2002-2007 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.testng.spring.test;
-
-import java.lang.reflect.Field;
-import java.lang.reflect.Modifier;
-import java.util.LinkedList;
-
-import org.springframework.beans.factory.NoSuchBeanDefinitionException;
-import org.springframework.beans.factory.config.AutowireCapableBeanFactory;
-
-/**
- * Convenient superclass for tests depending on a Spring context.
- * The test instance itself is populated by Dependency Injection.
- *
- * <p>Really for integration testing, not unit testing.
- * You should <i>not</i> normally use the Spring container
- * for unit tests: simply populate your POJOs in plain JUnit tests!
- *
- * <p>This supports two modes of populating the test:
- * <ul>
- * <li>Via Setter Dependency Injection. Simply express dependencies on objects
- * in the test fixture, and they will be satisfied by autowiring by type.
- * <li>Via Field Injection. Declare protected variables of the required type
- * which match named beans in the context. This is autowire by name,
- * rather than type. This approach is based on an approach originated by
- * Ara Abrahmian. Setter Dependency Injection is the default: set the
- * "populateProtectedVariables" property to true in the constructor to switch
- * on Field Injection.
- * </ul>
- *
- * @author Rod Johnson
- * @author Rob Harrop
- * @author Rick Evans
- * @since 1.1.1
- * @see #setDirty
- * @see #contextKey
- * @see #getContext
- * @see #getConfigLocations
- */
-public abstract class AbstractDependencyInjectionSpringContextTests extends AbstractSingleSpringContextTests {
-
- /**
- * Constant that indicates no autowiring at all.
- * @see #setAutowireMode
- */
- public static final int AUTOWIRE_NO = 0;
-
- /**
- * Constant that indicates autowiring bean properties by name.
- * @see #setAutowireMode
- */
- public static final int AUTOWIRE_BY_NAME = AutowireCapableBeanFactory.AUTOWIRE_BY_NAME;
-
- /**
- * Constant that indicates autowiring bean properties by type.
- * @see #setAutowireMode
- */
- public static final int AUTOWIRE_BY_TYPE = AutowireCapableBeanFactory.AUTOWIRE_BY_TYPE;
-
-
- private boolean populateProtectedVariables = false;
-
- private int autowireMode = AUTOWIRE_BY_TYPE;
-
- private boolean dependencyCheck = true;
-
- private String[] managedVariableNames;
-
-
- /**
- * Default constructor for AbstractDependencyInjectionSpringContextTests.
- */
- public AbstractDependencyInjectionSpringContextTests() {
- }
-
- /**
- * Set whether to populate protected variables of this test case.
- * Default is "false".
- */
- public final void setPopulateProtectedVariables(boolean populateFields) {
- this.populateProtectedVariables = populateFields;
- }
-
- /**
- * Return whether to populate protected variables of this test case.
- */
- public final boolean isPopulateProtectedVariables() {
- return populateProtectedVariables;
- }
-
- /**
- * Set the autowire mode for test properties set by Dependency Injection.
- * <p>The default is "AUTOWIRE_BY_TYPE". Can be set to "AUTOWIRE_BY_NAME"
- * or "AUTOWIRE_NO" instead.
- * @see #AUTOWIRE_BY_TYPE
- * @see #AUTOWIRE_BY_NAME
- * @see #AUTOWIRE_NO
- */
- public final void setAutowireMode(int autowireMode) {
- this.autowireMode = autowireMode;
- }
-
- /**
- * Return the autowire mode for test properties set by Dependency Injection.
- */
- public final int getAutowireMode() {
- return autowireMode;
- }
-
- /**
- * Set whether or not dependency checking should be performed
- * for test properties set by Dependency Injection.
- * <p>The default is "true", meaning that tests cannot be run
- * unless all properties are populated.
- */
- public final void setDependencyCheck(boolean dependencyCheck) {
- this.dependencyCheck = dependencyCheck;
- }
-
- /**
- * Return whether or not dependency checking should be performed
- * for test properties set by Dependency Injection.
- */
- public final boolean isDependencyCheck() {
- return dependencyCheck;
- }
-
-
- /**
- * Prepare this test instance, injecting dependencies into its
- * protected fields and its bean properties.
- */
- protected void prepareTestInstance() throws Exception {
- injectDependencies();
- }
-
- /**
- * Inject dependencies into 'this' instance (that is, this test instance).
- * <p>The default implementation populates protected variables if the
- * {@link #populateProtectedVariables() appropriate flag is set}, else
- * uses autowiring if autowiring is switched on (which it is by default).
- * <p>You can certainly override this method if you want to totally control
- * how dependencies are injected into 'this' instance.
- * @throws Exception in the case of any errors
- * @see #populateProtectedVariables()
- */
- private void injectDependencies() throws Exception {
- if (isPopulateProtectedVariables()) {
- if (this.managedVariableNames == null) {
- initManagedVariableNames();
- }
- populateProtectedVariables();
- }
- else if (getAutowireMode() != AUTOWIRE_NO) {
- getApplicationContext().getBeanFactory().autowireBeanProperties(
- this, getAutowireMode(), isDependencyCheck());
- }
- }
-
- private void initManagedVariableNames() throws IllegalAccessException {
- LinkedList managedVarNames = new LinkedList();
- Class clazz = getClass();
-
- do {
- Field[] fields = clazz.getDeclaredFields();
- if (logger.isDebugEnabled()) {
- logger.debug("Found " + fields.length + " fields on " + clazz);
- }
-
- for (int i = 0; i < fields.length; i++) {
- Field field = fields[i];
- field.setAccessible(true);
- if (logger.isDebugEnabled()) {
- logger.debug("Candidate field: " + field);
- }
- if (isProtectedInstanceField(field)) {
- Object oldValue = field.get(this);
- if (oldValue == null) {
- managedVarNames.add(field.getName());
- if (logger.isDebugEnabled()) {
- logger.debug("Added managed variable '" + field.getName() + "'");
- }
- }
- else {
- if (logger.isDebugEnabled()) {
- logger.debug("Rejected managed variable '" + field.getName() + "'");
- }
- }
- }
- }
- clazz = clazz.getSuperclass();
- }
- while (!clazz.equals(AbstractDependencyInjectionSpringContextTests.class));
-
- this.managedVariableNames = (String[]) managedVarNames.toArray(new String[managedVarNames.size()]);
- }
-
- private boolean isProtectedInstanceField(Field field) {
- int modifiers = field.getModifiers();
- return !Modifier.isStatic(modifiers) && Modifier.isProtected(modifiers);
- }
-
- private void populateProtectedVariables() throws IllegalAccessException {
- for (int i = 0; i < this.managedVariableNames.length; i++) {
- String varName = this.managedVariableNames[i];
- Object bean = null;
- try {
- Field field = findField(getClass(), varName);
- bean = getApplicationContext().getBean(varName, field.getType());
- field.setAccessible(true);
- field.set(this, bean);
- if (logger.isDebugEnabled()) {
- logger.debug("Populated field: " + field);
- }
- }
- catch (NoSuchFieldException ex) {
- if (logger.isWarnEnabled()) {
- logger.warn("No field with name '" + varName + "'");
- }
- }
- catch (NoSuchBeanDefinitionException ex) {
- if (logger.isWarnEnabled()) {
- logger.warn("No bean with name '" + varName + "'");
- }
- }
- }
- }
-
- private Field findField(Class clazz, String name) throws NoSuchFieldException {
- try {
- return clazz.getDeclaredField(name);
- }
- catch (NoSuchFieldException ex) {
- Class superclass = clazz.getSuperclass();
- if (superclass != AbstractSpringContextTests.class) {
- return findField(superclass, name);
- }
- else {
- throw ex;
- }
- }
- }
-
-}
diff --git a/spring/src/common/org/testng/spring/test/AbstractSpringContextTests.java b/spring/src/common/org/testng/spring/test/AbstractSpringContextTests.java
deleted file mode 100644
index b46a964..0000000
--- a/spring/src/common/org/testng/spring/test/AbstractSpringContextTests.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * Copyright 2002-2006 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.testng.spring.test;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.springframework.context.ConfigurableApplicationContext;
-import org.springframework.util.ObjectUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- * Superclass for TestNG test cases using a Spring context.
- *
- * <p>Maintains a static cache of contexts by key. This has significant performance
- * benefit if initializing the context would take time. While initializing a
- * Spring context itself is very quick, some beans in a context, such as
- * a LocalSessionFactoryBean for working with Hibernate, may take some time
- * to initialize. Hence it often makes sense to do that initializing once.
- *
- * <p>Any ApplicationContext created by this class will be asked to register a JVM
- * shutdown hook for itself. Unless the context gets closed early, all context
- * instances will be automatically closed on JVM shutdown. This allows for freeing
- * external resources held by beans within the context, e.g. temporary files.
- *
- * <p>Normally you won't extend this class directly but rather extend one of
- * its subclasses.
- *
- * @author Rod Johnson
- * @author Juergen Hoeller
- * @since 1.1.1
- * @see AbstractDependencyInjectionSpringContextTests
- * @see AbstractTransactionalSpringContextTests
- * @see AbstractTransactionalDataSourceSpringContextTests
- */
-public abstract class AbstractSpringContextTests {
-
- /** Logger available to subclasses */
- protected final Log logger = LogFactory.getLog(getClass());
-
- /**
- * Map of context keys returned by subclasses of this class, to
- * Spring contexts. This needs to be static, as JUnit tests are
- * destroyed and recreated between running individual test methods.
- */
- private static Map contextKeyToContextMap = new HashMap();
-
-
- /**
- * Default constructor for AbstractSpringContextTests.
- */
- public AbstractSpringContextTests() {
- }
-
- /**
- * Explicitly add an ApplicationContext instance under a given key.
- * <p>This is not meant to be used by subclasses. It is rather exposed
- * for special test suite environments.
- * @param key the context key
- * @param context the ApplicationContext instance
- */
- public final void addContext(Object key, ConfigurableApplicationContext context) {
- assert context != null : "ApplicationContext must not be null";
- contextKeyToContextMap.put(contextKeyString(key), context);
- }
-
- /**
- * Return whether there is a cached context for the given key.
- * @param contextKey the context key
- */
- protected final boolean hasCachedContext(Object contextKey) {
- return contextKeyToContextMap.containsKey(contextKey);
- }
-
- /**
- * Obtain an ApplicationContext for the given key, potentially cached.
- * @param key the context key
- * @return the corresponding ApplicationContext instance (potentially cached)
- */
- protected final ConfigurableApplicationContext getContext(Object key) throws Exception {
- String keyString = contextKeyString(key);
- ConfigurableApplicationContext ctx =
- (ConfigurableApplicationContext) contextKeyToContextMap.get(keyString);
- if (ctx == null) {
- ctx = loadContext(key);
- ctx.registerShutdownHook();
- contextKeyToContextMap.put(keyString, ctx);
- }
- return ctx;
- }
-
- /**
- * Mark the context with the given key as dirty. This will cause the
- * cached context to be reloaded before the next test case is executed.
- * <p>Call this method only if you change the state of a singleton
- * bean, potentially affecting future tests.
- */
- protected final void setDirty(Object contextKey) {
- String keyString = contextKeyString(contextKey);
- ConfigurableApplicationContext ctx =
- (ConfigurableApplicationContext) contextKeyToContextMap.remove(keyString);
- if (ctx != null) {
- ctx.close();
- }
- }
-
-
- /**
- * Subclasses can override this to return a String representation of
- * their context key for use in logging.
- * @param contextKey the context key
- */
- protected String contextKeyString(Object contextKey) {
- return ObjectUtils.nullSafeToString(contextKey);
- }
-
- /**
- * Load a new ApplicationContext for the given key.
- * <p>To be implemented by subclasses.
- * @param key the context key
- * @return the corresponding ApplicationContext instance (new)
- */
- protected abstract ConfigurableApplicationContext loadContext(Object key) throws Exception;
-
-}
diff --git a/spring/src/common/org/testng/spring/test/AbstractTransactionalDataSourceSpringContextTests.java b/spring/src/common/org/testng/spring/test/AbstractTransactionalDataSourceSpringContextTests.java
deleted file mode 100644
index e48614b..0000000
--- a/spring/src/common/org/testng/spring/test/AbstractTransactionalDataSourceSpringContextTests.java
+++ /dev/null
@@ -1,175 +0,0 @@
-/*
- * Copyright 2002-2007 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.testng.spring.test;
-
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.io.LineNumberReader;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-
-import javax.sql.DataSource;
-
-import org.springframework.core.io.Resource;
-import org.springframework.dao.DataAccessException;
-import org.springframework.dao.DataAccessResourceFailureException;
-import org.springframework.jdbc.core.JdbcTemplate;
-import org.springframework.util.StringUtils;
-
-/**
- * Subclass of AbstractTransactionalSpringContextTests that adds some convenience
- * functionality for JDBC access. Expects a {@link javax.sql.DataSource} bean
- * to be defined in the Spring application context.
- *
- * <p>This class exposes a {@link org.springframework.jdbc.core.JdbcTemplate}
- * and provides an easy way to delete from the database in a new transaction.
- *
- * @author Rod Johnson
- * @author Juergen Hoeller
- * @since 1.1.1
- * @see #setDataSource(javax.sql.DataSource)
- * @see #getJdbcTemplate()
- */
-public abstract class AbstractTransactionalDataSourceSpringContextTests
- extends AbstractTransactionalSpringContextTests {
-
- protected JdbcTemplate jdbcTemplate;
-
- /**
- * Did this test delete any tables? If so, we forbid transaction completion,
- * and only allow rollback.
- */
- private boolean zappedTables;
-
-
- /**
- * Default constructor for AbstractTransactionalDataSourceSpringContextTests.
- */
- public AbstractTransactionalDataSourceSpringContextTests() {
- }
-
- /**
- * Setter: DataSource is provided by Dependency Injection.
- */
- public void setDataSource(DataSource dataSource) {
- this.jdbcTemplate = new JdbcTemplate(dataSource);
- }
-
- /**
- * Return the JdbcTemplate that this base class manages.
- */
- public final JdbcTemplate getJdbcTemplate() {
- return this.jdbcTemplate;
- }
-
-
- /**
- * Convenient method to delete all rows from these tables.
- * Calling this method will make avoidance of rollback by calling
- * <code>setComplete()</code> impossible.
- * @see #setComplete
- */
- protected void deleteFromTables(String[] names) {
- for (int i = 0; i < names.length; i++) {
- int rowCount = this.jdbcTemplate.update("DELETE FROM " + names[i]);
- if (logger.isInfoEnabled()) {
- logger.info("Deleted " + rowCount + " rows from table " + names[i]);
- }
- }
- this.zappedTables = true;
- }
-
- /**
- * Overridden to prevent the transaction committing if a number of tables have been
- * cleared, as a defensive measure against accidental <i>permanent</i> wiping of a database.
- * @see org.springframework.test.AbstractTransactionalSpringContextTests#setComplete()
- */
- protected final void setComplete() {
- if (this.zappedTables) {
- throw new IllegalStateException("Cannot set complete after deleting tables");
- }
- super.setComplete();
- }
-
- /**
- * Count the rows in the given table
- * @param tableName table name to count rows in
- * @return the number of rows in the table
- */
- protected int countRowsInTable(String tableName) {
- return this.jdbcTemplate.queryForInt("SELECT COUNT(0) FROM " + tableName);
- }
-
-
- /**
- * Execute the given SQL script. Will be rolled back by default,
- * according to the fate of the current transaction.
- * @param sqlResourcePath Spring resource path for the SQL script.
- * Should normally be loaded by classpath. There should be one statement
- * per line. Any semicolons will be removed.
- * <b>Do not use this method to execute DDL if you expect rollback.</b>
- * @param continueOnError whether or not to continue without throwing
- * an exception in the event of an error
- * @throws DataAccessException if there is an error executing a statement
- * and continueOnError was false
- */
- protected void executeSqlScript(String sqlResourcePath, boolean continueOnError) throws DataAccessException {
- if (logger.isInfoEnabled()) {
- logger.info("Executing SQL script '" + sqlResourcePath + "'");
- }
-
- long startTime = System.currentTimeMillis();
- List statements = new LinkedList();
- Resource res = getApplicationContext().getResource(sqlResourcePath);
- try {
- LineNumberReader lnr = new LineNumberReader(new InputStreamReader(res.getInputStream()));
- String currentStatement = lnr.readLine();
- while (currentStatement != null) {
- currentStatement = StringUtils.replace(currentStatement, ";", "");
- statements.add(currentStatement);
- currentStatement = lnr.readLine();
- }
-
- for (Iterator itr = statements.iterator(); itr.hasNext(); ) {
- String statement = (String) itr.next();
- try {
- int rowsAffected = this.jdbcTemplate.update(statement);
- if (logger.isDebugEnabled()) {
- logger.debug(rowsAffected + " rows affected by SQL: " + statement);
- }
- }
- catch (DataAccessException ex) {
- if (continueOnError) {
- if (logger.isWarnEnabled()) {
- logger.warn("SQL: " + statement + " failed", ex);
- }
- }
- else {
- throw ex;
- }
- }
- }
- long elapsedTime = System.currentTimeMillis() - startTime;
- logger.info("Done executing SQL script '" + sqlResourcePath + "' in " + elapsedTime + " ms");
- }
- catch (IOException ex) {
- throw new DataAccessResourceFailureException("Failed to open SQL script '" + sqlResourcePath + "'", ex);
- }
- }
-
-}
diff --git a/spring/src/common/org/testng/spring/test/AbstractTransactionalSpringContextTests.java b/spring/src/common/org/testng/spring/test/AbstractTransactionalSpringContextTests.java
deleted file mode 100644
index 1331e77..0000000
--- a/spring/src/common/org/testng/spring/test/AbstractTransactionalSpringContextTests.java
+++ /dev/null
@@ -1,328 +0,0 @@
-/*
- * Copyright 2002-2006 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.testng.spring.test;
-
-import org.springframework.transaction.PlatformTransactionManager;
-import org.springframework.transaction.TransactionDefinition;
-import org.springframework.transaction.TransactionException;
-import org.springframework.transaction.TransactionStatus;
-import org.springframework.transaction.support.DefaultTransactionDefinition;
-
-/**
- * Convenient superclass for tests that should occur in a transaction, but normally
- * will roll the transaction back on the completion of each test.
- *
- * <p>This is useful in a range of circumstances, allowing the following benefits:
- * <ul>
- * <li>Ability to delete or insert any data in the database, without affecting other tests
- * <li>Providing a transactional context for any code requiring a transaction
- * <li>Ability to write anything to the database without any need to clean up.
- * </ul>
- *
- * <p>This class is typically very fast, compared to traditional setup/teardown scripts.
- *
- * <p>If data should be left in the database, call the <code>setComplete()</code>
- * method in each test. The "defaultRollback" property, which defaults to "true",
- * determines whether transactions will complete by default.
- *
- * <p>It is even possible to end the transaction early; for example, to verify lazy
- * loading behavior of an O/R mapping tool. (This is a valuable away to avoid
- * unexpected errors when testing a web UI, for example.) Simply call the
- * <code>endTransaction()</code> method. Execution will then occur without a
- * transactional context.
- *
- * <p>The <code>startNewTransaction()</code> method may be called after a call to
- * <code>endTransaction()</code> if you wish to create a new transaction, quite
- * independent of the old transaction. The new transaction's default fate will be to
- * roll back, unless <code>setComplete()</code> is called again during the scope of the
- * new transaction. Any number of transactions may be created and ended in this way.
- * The final transaction will automatically be rolled back when the test case is
- * torn down.
- *
- * <p>Transactional behavior requires a single bean in the context implementing the
- * PlatformTransactionManager interface. This will be set by the superclass's
- * Dependency Injection mechanism. If using the superclass's Field Injection mechanism,
- * the implementation should be named "transactionManager". This mechanism allows the
- * use of this superclass even when there's more than one transaction manager in the context.
- *
- * <p><i>This superclass can also be used without transaction management, if no
- * PlatformTransactionManager bean is found in the context provided. Be careful about
- * using this mode, as it allows the potential to permanently modify data.
- * This mode is available only if dependency checking is turned off in
- * the AbstractDependencyInjectionSpringContextTests superclass. The non-transactional
- * capability is provided to enable use of the same subclass in different environments.</i>
- *
- * @author Rod Johnson
- * @author Juergen Hoeller
- * @since 1.1.1
- */
-public abstract class AbstractTransactionalSpringContextTests extends AbstractDependencyInjectionSpringContextTests {
-
- /** The transaction manager to use */
- protected PlatformTransactionManager transactionManager;
-
- /** Should we roll back by default? */
- private boolean defaultRollback = true;
-
- /** Should we commit the current transaction? */
- private boolean complete = false;
-
- /** Number of transactions started */
- private int transactionsStarted = 0;
-
- /**
- * Default transaction definition is used.
- * Subclasses can change this to cause different behaviour.
- */
- private TransactionDefinition transactionDefinition = new DefaultTransactionDefinition();
-
- /**
- * TransactionStatus for this test. Typical subclasses won't need to use it.
- */
- protected TransactionStatus transactionStatus;
-
-
- /**
- * Default constructor for AbstractTransactionalSpringContextTests.
- */
- public AbstractTransactionalSpringContextTests() {
- }
-
- /**
- * Specify the transaction manager to use. No transaction management will be available
- * if this is not set. (This mode works only if dependency checking is turned off in
- * the AbstractDependencyInjectionSpringContextTests superclass.)
- * <p>Populated through dependency injection by the superclass.
- */
- public void setTransactionManager(PlatformTransactionManager ptm) {
- this.transactionManager = ptm;
- }
-
- /**
- * Subclasses can set this value in their constructor to change
- * default, which is always to roll the transaction back.
- */
- public void setDefaultRollback(boolean defaultRollback) {
- this.defaultRollback = defaultRollback;
- }
-
-
- /**
- * Call in an overridden <code>runBare()</code> method to prevent transactional execution.
- */
- protected void preventTransaction() {
- this.transactionDefinition = null;
- }
-
- /**
- * Override the transaction attributes that will be used.
- * Call in an overridden <code>runBare()</code> method so that
- * <code>setUp()</code> and <code>tearDown()</code> behavior is modified.
- * @param customDefinition custom definition to override with
- */
- protected void setTransactionDefinition(TransactionDefinition customDefinition) {
- this.transactionDefinition = customDefinition;
- }
-
-
- /**
- * This implementation creates a transaction before test execution.
- * Override <code>onSetUpBeforeTransaction()</code> and/or
- * <code>onSetUpInTransaction()</code> to add custom set-up behavior.
- * @see #onSetUpBeforeTransaction()
- * @see #onSetUpInTransaction()
- */
- protected final void onSetUp() throws Exception {
- this.complete = !this.defaultRollback;
-
- if (this.transactionManager == null) {
- logger.info("No transaction manager set: test will NOT run within a transaction");
- }
- else if (this.transactionDefinition == null) {
- logger.info("No transaction definition set: test will NOT run within a transaction");
- }
- else {
- onSetUpBeforeTransaction();
- startNewTransaction();
- try {
- onSetUpInTransaction();
- }
- catch (Exception ex) {
- endTransaction();
- throw ex;
- }
- }
- }
-
- /**
- * Subclasses can override this method to perform any setup operations,
- * such as populating a database table, <i>before</i> the transaction
- * created by this class. Only invoked if there <i>is</i> a transaction:
- * that is, if <code>preventTransaction()</code> has not been invoked in
- * an overridden <code>runTest()</code> method.
- * @throws Exception simply let any exception propagate
- * @see #preventTransaction()
- */
- protected void onSetUpBeforeTransaction() throws Exception {
- }
-
- /**
- * Subclasses can override this method to perform any setup operations,
- * such as populating a database table, <i>within</i> the transaction
- * created by this class.
- * <p><b>NB:</b> Not called if there is no transaction management, due to no
- * transaction manager being provided in the context.
- * <p>If any {@link Throwable} is thrown, the transaction that has been started
- * prior to the execution of this method will be {@link #endTransaction() ended}
- * (or rather an attempt will be made to {@link #endTransaction() end it gracefully});
- * The offending {@link Throwable} will then be rethrown.
- * @throws Exception simply let any exception propagate
- */
- protected void onSetUpInTransaction() throws Exception {
- }
-
-
- /**
- * This implementation ends the transaction after test execution.
- * Override <code>onTearDownInTransaction()</code> and/or
- * <code>onTearDownAfterTransaction()</code> to add custom tear-down behavior.
- * <p>Note that <code>onTearDownInTransaction()</code> will only be called
- * if a transaction is still active at the time of the test shutdown.
- * In particular, it will <code>not</code> be called if the transaction has
- * been completed with an explicit <code>endTransaction()</code> call before.
- * @throws Exception simply let any exception propagate
- * @see #onTearDownInTransaction()
- * @see #onTearDownAfterTransaction()
- * @see #endTransaction()
- */
- protected final void onTearDown() throws Exception {
- // Call onTearDownInTransaction and end transaction if the transaction is still active.
- if (this.transactionStatus != null && !this.transactionStatus.isCompleted()) {
- try {
- onTearDownInTransaction();
- }
- finally {
- endTransaction();
- }
- }
- // Call onTearDownAfterTransaction if there was at least one transaction,
- // even if it has been completed early through an endTransaction() call.
- if (this.transactionsStarted > 0) {
- onTearDownAfterTransaction();
- }
- }
-
- /**
- * Subclasses can override this method to run invariant tests here.
- * The transaction is <i>still active</i> at this point, so any changes
- * made in the transaction will still be visible. However, there is no need
- * to clean up the database, as a rollback will follow automatically.
- * <p><b>NB:</b> Not called if there is no actual transaction, for example
- * due to no transaction manager being provided in the application context.
- * @throws Exception simply let any exception propagate
- */
- protected void onTearDownInTransaction() throws Exception {
- }
-
- /**
- * Subclasses can override this method to perform cleanup after a transaction
- * here. At this point, the transaction is <i>not active anymore</i>.
- * @throws Exception simply let any exception propagate
- */
- protected void onTearDownAfterTransaction() throws Exception {
- }
-
-
- /**
- * Cause the transaction to commit for this test method,
- * even if default is set to rollback.
- * @throws IllegalStateException if the operation cannot be set to
- * complete as no transaction manager was provided
- */
- protected void setComplete() throws UnsupportedOperationException {
- if (this.transactionManager == null) {
- throw new IllegalStateException("No transaction manager set");
- }
- this.complete = true;
- }
-
- /**
- * Cause the transaction to rollback for this test method,
- * even if default is set to complete.
- * @throws IllegalStateException if the operation cannot be set to
- * complete as no transaction manager was provided
- */
- protected void setRollback() throws UnsupportedOperationException {
- if (this.transactionManager == null) {
- throw new IllegalStateException("No transaction manager set");
- }
- this.complete = false;
- }
-
- /**
- * Immediately force a commit or rollback of the transaction,
- * according to the complete flag.
- * <p>Can be used to explicitly let the transaction end early,
- * for example to check whether lazy associations of persistent objects
- * work outside of a transaction (that is, have been initialized properly).
- * @see #setComplete()
- */
- protected void endTransaction() {
- if (this.transactionStatus != null) {
- try {
- if (!this.complete) {
- this.transactionManager.rollback(this.transactionStatus);
- logger.info("Rolled back transaction after test execution");
- }
- else {
- this.transactionManager.commit(this.transactionStatus);
- logger.info("Committed transaction after test execution");
- }
- }
- finally {
- this.transactionStatus = null;
- }
- }
- }
-
- /**
- * Start a new transaction. Only call this method if <code>endTransaction()</code>
- * has been called. <code>setComplete()</code> can be used again in the new transaction.
- * The fate of the new transaction, by default, will be the usual rollback.
- * @see #endTransaction()
- * @see #setComplete()
- */
- protected void startNewTransaction() throws TransactionException {
- if (this.transactionStatus != null) {
- throw new IllegalStateException("Cannot start new transaction without ending existing transaction: " +
- "Invoke endTransaction() before startNewTransaction()");
- }
- if (this.transactionManager == null) {
- throw new IllegalStateException("No transaction manager set");
- }
-
- this.transactionStatus = this.transactionManager.getTransaction(this.transactionDefinition);
- ++this.transactionsStarted;
- this.complete = !this.defaultRollback;
-
- if (logger.isInfoEnabled()) {
- logger.info("Began transaction (" + this.transactionsStarted + "): transaction manager [" +
- this.transactionManager + "]; default rollback = " + this.defaultRollback);
- }
- }
-
-}
diff --git a/spring/src/common/org/testng/spring/test/package.html b/spring/src/common/org/testng/spring/test/package.html
deleted file mode 100644
index 3958135..0000000
--- a/spring/src/common/org/testng/spring/test/package.html
+++ /dev/null
@@ -1,14 +0,0 @@
-<html>
-<body>
-
-Superclasses for tests requiring Spring application contexts,
-including support for transactional execution of test cases,
-with automatic rollback on completion.
-Useful as base classes for application-specific tests.
-<br/>
-The superclasses in this package are ideal for integration testing.
-<i>Unit</i> testing should not normally involve the Spring container,
-but should test classes in isolation.
-
-</body>
-</html>
diff --git a/spring/src/jdk14/org/testng/spring/test/AbstractSingleSpringContextTests.java b/spring/src/jdk14/org/testng/spring/test/AbstractSingleSpringContextTests.java
deleted file mode 100644
index d79d16e..0000000
--- a/spring/src/jdk14/org/testng/spring/test/AbstractSingleSpringContextTests.java
+++ /dev/null
@@ -1,192 +0,0 @@
-/*
- * Copyright 2002-2007 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.testng.spring.test;
-
-import org.springframework.context.ConfigurableApplicationContext;
-import org.springframework.context.support.ClassPathXmlApplicationContext;
-import org.springframework.util.StringUtils;
-
-/**
- * Abstract JUnit test class that holds and exposes a single Spring
- * {@link org.springframework.context.ApplicationContext ApplicationContext}.
- *
- * <p>This class will cache contexts based on a <i>context key</i>: normally the
- * config locations String array describing the Spring resource descriptors making
- * up the context. Unless the {@link #setDirty()} method is called by a test, the
- * context will not be reloaded, even across different subclasses of this test.
- * This is particularly beneficial if your context is slow to construct, for example
- * if you are using Hibernate and the time taken to load the mappings is an issue.
- *
- * <p>For such standard usage, simply override the {@link #getConfigLocations()}
- * method and provide the desired config files.
- *
- * <p>If you don't want to load a standard context from an array of config locations,
- * you can override the {@link #contextKey()} method. In conjunction with this you
- * typically need to override the {@link #loadContext(Object)} method, which by
- * default loads the locations specified in the {@link #getConfigLocations()} method.
- *
- * <p><b>WARNING:</b> When doing integration tests from within Eclipse, only use
- * classpath resource URLs. Else, you may see misleading failures when changing
- * context locations.
- *
- * @author Juergen Hoeller
- * @author Rod Johnson
- * @since 2.0
- * @see #getConfigLocations()
- * @see #contextKey()
- * @see #loadContext(Object)
- * @see #getApplicationContext()
- */
-public abstract class AbstractSingleSpringContextTests extends AbstractSpringContextTests {
-
- /** Application context this test will run against */
- protected ConfigurableApplicationContext applicationContext;
-
- private int loadCount = 0;
-
-
- /**
- * Default constructor for AbstractDependencyInjectionSpringContextTests.
- */
- public AbstractSingleSpringContextTests() {
- }
-
- /**
- * @testng.configuration beforeTestMethod = "true"
- * This implementation is final.
- * Override <code>onSetUp</code> for custom behavior.
- * @see #onSetUp()
- */
- protected final void setUp() throws Exception {
- this.applicationContext = getContext(contextKey());
- prepareTestInstance();
- onSetUp();
- }
-
- /**
- * Prepare this test instance, for example populating its fields.
- * The context has already been loaded at the time of this callback.
- * <p>This implementation does nothing.
- */
- protected void prepareTestInstance() throws Exception {
- }
-
- /**
- * Subclasses can override this method in place of the
- * <code>setUp()</code> method, which is final in this class.
- * This implementation does nothing.
- * @throws Exception simply let any exception propagate
- */
- protected void onSetUp() throws Exception {
- }
-
- /**
- * Called to say that the "applicationContext" instance variable is dirty and
- * should be reloaded. We need to do this if a test has modified the context
- * (for example, by replacing a bean definition).
- */
- protected void setDirty() {
- setDirty(contextKey());
- }
-
- /**
- * This implementation is final.
- * Override <code>onTearDown</code> for custom behavior.
- * @see #onTearDown()
- * @testng.configuration beforeTestMethod = "true"
- */
- protected final void tearDown() throws Exception {
- onTearDown();
- }
-
- /**
- * Subclasses can override this to add custom behavior on teardown.
- * @throws Exception simply let any exception propagate
- */
- protected void onTearDown() throws Exception {
- }
-
-
- /**
- * Return a key for this context. Default is the config location array
- * as determined by {@link #getConfigLocations()}.
- * <p>If you override this method, you will typically have to override
- * {@link #loadContext(Object)} as well, being able to handle the key type
- * that this method returns.
- * @see #getConfigLocations()
- */
- protected Object contextKey() {
- return getConfigLocations();
- }
-
- /**
- * This implementation assumes a key of type String array and loads
- * a context from the given locations.
- * <p>If you override {@link #contextKey()}, you will typically have to
- * override this method as well, being able to handle the key type
- * that <code>contextKey()</code> returns.
- * @see #getConfigLocations()
- */
- protected ConfigurableApplicationContext loadContext(Object key) throws Exception {
- return loadContextLocations((String[]) key);
- }
-
- /**
- * Subclasses must implement this method to return the locations of their
- * config files, unless they override {@link #contextKey()} and
- * {@link #loadContext(Object)} instead.
- * <p>A plain path will be treated as class path location, e.g.:
- * "org/springframework/whatever/foo.xml". Note however that you may prefix path
- * locations with standard Spring resource prefixes. Therefore, a config location
- * path prefixed with "classpath:" with behave the same as a plain path, but a
- * config location such as "file:/some/path/path/location/appContext.xml" will
- * be treated as a filesystem location.
- * <p>The default implementation returns an empty array.
- * @return an array of config locations
- */
- protected String[] getConfigLocations() {
- return new String[0];
- }
-
- /**
- * Load an ApplicationContext from the given config locations.
- * @param locations the config locations
- * @return the corresponding ApplicationContext instance (potentially cached)
- */
- protected ConfigurableApplicationContext loadContextLocations(String[] locations) throws Exception {
- ++this.loadCount;
- if (logger.isInfoEnabled()) {
- logger.info("Loading context for: " + StringUtils.arrayToCommaDelimitedString(locations));
- }
- return new ClassPathXmlApplicationContext(locations);
- }
-
- /**
- * Return the ApplicationContext that this base class manages.
- */
- public final ConfigurableApplicationContext getApplicationContext() {
- return this.applicationContext;
- }
-
- /**
- * Return the current number of context load attempts.
- */
- public final int getLoadCount() {
- return this.loadCount;
- }
-
-}
diff --git a/spring/src/jdk15/org/testng/spring/test/AbstractAnnotationAwareTransactionalTests.java b/spring/src/jdk15/org/testng/spring/test/AbstractAnnotationAwareTransactionalTests.java
deleted file mode 100644
index ed4d407..0000000
--- a/spring/src/jdk15/org/testng/spring/test/AbstractAnnotationAwareTransactionalTests.java
+++ /dev/null
@@ -1,67 +0,0 @@
-package org.testng.spring.test;
-
-import java.util.Map;
-import java.lang.reflect.Method;
-import javax.sql.DataSource;
-
-import org.springframework.transaction.annotation.AnnotationTransactionAttributeSource;
-import org.springframework.transaction.interceptor.TransactionAttributeSource;
-import org.springframework.transaction.TransactionDefinition;
-import org.springframework.test.annotation.*;
-import org.springframework.jdbc.core.simple.SimpleJdbcTemplate;
-import org.springframework.context.ApplicationContext;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.BeforeMethod;
-
-/**
- * @author Hani Suleiman
- * Date: Jan 26, 2007
- * Time: 8:17:20 AM
- */
-public abstract class AbstractAnnotationAwareTransactionalTests
- extends AbstractTransactionalDataSourceSpringContextTests {
-
- protected SimpleJdbcTemplate simpleJdbcTemplate;
-
- private TransactionAttributeSource transactionAttributeSource = new AnnotationTransactionAttributeSource();
-
- protected ProfileValueSource profileValueSource = SystemProfileValueSource.getInstance();
-
-
- @Override
- public void setDataSource(DataSource dataSource) {
- super.setDataSource(dataSource);
- // JdbcTemplate will be identically configured
- this.simpleJdbcTemplate = new SimpleJdbcTemplate(this.jdbcTemplate);
- }
-
- // TODO code to try to load (and cache!) ProfileValueSource
- // from a given URL? It's easy enough to do, of course.
- protected void findUniqueProfileValueSourceFromContext(ApplicationContext ac) {
- Map beans = ac.getBeansOfType(ProfileValueSource.class);
- if (beans.size() == 1) {
- this.profileValueSource = (ProfileValueSource) beans.values().iterator().next();
- }
- }
-
- @BeforeMethod
- protected void checkTransaction(Method testMethod) throws Throwable {
- TransactionDefinition explicitTransactionDefinition =
- this.transactionAttributeSource.getTransactionAttribute(testMethod, getClass());
- if (explicitTransactionDefinition != null) {
- logger.info("Custom transaction definition [" + explicitTransactionDefinition + " for test method " + testMethod.getName());
- setTransactionDefinition(explicitTransactionDefinition);
- }
- else if (testMethod.isAnnotationPresent(NotTransactional.class)) {
- // Don't have any transaction...
- preventTransaction();
- }
- }
-
- @AfterMethod
- protected void checkDirtiesContext(Method testMethod) {
- if (testMethod.isAnnotationPresent(DirtiesContext.class)) {
- AbstractAnnotationAwareTransactionalTests.this.setDirty();
- }
- }
-}
diff --git a/spring/src/jdk15/org/testng/spring/test/AbstractSingleSpringContextTests.java b/spring/src/jdk15/org/testng/spring/test/AbstractSingleSpringContextTests.java
deleted file mode 100644
index 8b66352..0000000
--- a/spring/src/jdk15/org/testng/spring/test/AbstractSingleSpringContextTests.java
+++ /dev/null
@@ -1,194 +0,0 @@
-/*
- * Copyright 2002-2007 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.testng.spring.test;
-
-import org.springframework.context.ConfigurableApplicationContext;
-import org.springframework.context.support.ClassPathXmlApplicationContext;
-import org.springframework.util.StringUtils;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.AfterMethod;
-
-/**
- * Abstract JUnit test class that holds and exposes a single Spring
- * {@link org.springframework.context.ApplicationContext ApplicationContext}.
- *
- * <p>This class will cache contexts based on a <i>context key</i>: normally the
- * config locations String array describing the Spring resource descriptors making
- * up the context. Unless the {@link #setDirty()} method is called by a test, the
- * context will not be reloaded, even across different subclasses of this test.
- * This is particularly beneficial if your context is slow to construct, for example
- * if you are using Hibernate and the time taken to load the mappings is an issue.
- *
- * <p>For such standard usage, simply override the {@link #getConfigLocations()}
- * method and provide the desired config files.
- *
- * <p>If you don't want to load a standard context from an array of config locations,
- * you can override the {@link #contextKey()} method. In conjunction with this you
- * typically need to override the {@link #loadContext(Object)} method, which by
- * default loads the locations specified in the {@link #getConfigLocations()} method.
- *
- * <p><b>WARNING:</b> When doing integration tests from within Eclipse, only use
- * classpath resource URLs. Else, you may see misleading failures when changing
- * context locations.
- *
- * @author Juergen Hoeller
- * @author Rod Johnson
- * @since 2.0
- * @see #getConfigLocations()
- * @see #contextKey()
- * @see #loadContext(Object)
- * @see #getApplicationContext()
- */
-public abstract class AbstractSingleSpringContextTests extends AbstractSpringContextTests {
-
- /** Application context this test will run against */
- protected ConfigurableApplicationContext applicationContext;
-
- private int loadCount = 0;
-
-
- /**
- * Default constructor for AbstractDependencyInjectionSpringContextTests.
- */
- public AbstractSingleSpringContextTests() {
- }
-
- /**
- * This implementation is final.
- * Override <code>onSetUp</code> for custom behavior.
- * @see #onSetUp()
- */
- @BeforeMethod(groups="spring-init")
- protected final void setUp() throws Exception {
- this.applicationContext = getContext(contextKey());
- prepareTestInstance();
- onSetUp();
- }
-
- /**
- * Prepare this test instance, for example populating its fields.
- * The context has already been loaded at the time of this callback.
- * <p>This implementation does nothing.
- */
- protected void prepareTestInstance() throws Exception {
- }
-
- /**
- * Subclasses can override this method in place of the
- * <code>setUp()</code> method, which is final in this class.
- * This implementation does nothing.
- * @throws Exception simply let any exception propagate
- */
- protected void onSetUp() throws Exception {
- }
-
- /**
- * Called to say that the "applicationContext" instance variable is dirty and
- * should be reloaded. We need to do this if a test has modified the context
- * (for example, by replacing a bean definition).
- */
- protected void setDirty() {
- setDirty(contextKey());
- }
-
- /**
- * This implementation is final.
- * Override <code>onTearDown</code> for custom behavior.
- * @see #onTearDown()
- */
- @AfterMethod(groups="spring-init")
- protected final void tearDown() throws Exception {
- onTearDown();
- }
-
- /**
- * Subclasses can override this to add custom behavior on teardown.
- * @throws Exception simply let any exception propagate
- */
- protected void onTearDown() throws Exception {
- }
-
-
- /**
- * Return a key for this context. Default is the config location array
- * as determined by {@link #getConfigLocations()}.
- * <p>If you override this method, you will typically have to override
- * {@link #loadContext(Object)} as well, being able to handle the key type
- * that this method returns.
- * @see #getConfigLocations()
- */
- protected Object contextKey() {
- return getConfigLocations();
- }
-
- /**
- * This implementation assumes a key of type String array and loads
- * a context from the given locations.
- * <p>If you override {@link #contextKey()}, you will typically have to
- * override this method as well, being able to handle the key type
- * that <code>contextKey()</code> returns.
- * @see #getConfigLocations()
- */
- protected ConfigurableApplicationContext loadContext(Object key) throws Exception {
- return loadContextLocations((String[]) key);
- }
-
- /**
- * Subclasses must implement this method to return the locations of their
- * config files, unless they override {@link #contextKey()} and
- * {@link #loadContext(Object)} instead.
- * <p>A plain path will be treated as class path location, e.g.:
- * "org/springframework/whatever/foo.xml". Note however that you may prefix path
- * locations with standard Spring resource prefixes. Therefore, a config location
- * path prefixed with "classpath:" with behave the same as a plain path, but a
- * config location such as "file:/some/path/path/location/appContext.xml" will
- * be treated as a filesystem location.
- * <p>The default implementation returns an empty array.
- * @return an array of config locations
- */
- protected String[] getConfigLocations() {
- return new String[0];
- }
-
- /**
- * Load an ApplicationContext from the given config locations.
- * @param locations the config locations
- * @return the corresponding ApplicationContext instance (potentially cached)
- */
- protected ConfigurableApplicationContext loadContextLocations(String[] locations) throws Exception {
- ++this.loadCount;
- if (logger.isInfoEnabled()) {
- logger.info("Loading context for: " + StringUtils.arrayToCommaDelimitedString(locations));
- }
- return new ClassPathXmlApplicationContext(locations);
- }
-
- /**
- * Return the ApplicationContext that this base class manages.
- */
- public final ConfigurableApplicationContext getApplicationContext() {
- return this.applicationContext;
- }
-
- /**
- * Return the current number of context load attempts.
- */
- public final int getLoadCount() {
- return this.loadCount;
- }
-
-}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/testng.git
More information about the pkg-java-commits
mailing list