Permalink
Browse files

Merge pull request #1 from cgorshing/master

Dusting off the project to meet my needs
  • Loading branch information...
2 parents be039cd + ec1cc28 commit 438808f71c480a6ae2ee429b55a492190af36638 Robert C. Martin committed Jan 18, 2012
View
153 pom.xml
@@ -1,71 +1,84 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <groupId>info.fitnesse</groupId>
- <artifactId>transactionalrunner</artifactId>
- <version>1.0.2</version>
- <dependencies>
- <dependency>
- <groupId>org.fitnesse</groupId>
- <artifactId>fitnesse</artifactId>
- <version>20090112</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring</artifactId>
- <version>2.5.5</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.4</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>mysql</groupId>
- <artifactId>mysql-connector-java</artifactId>
- <version>5.1.6</version>
- <scope>test</scope>
- </dependency>
-
- </dependencies>
- <repositories>
- <repository>
- <id>maven-central</id>
- <url>http://repo1.maven.org/maven2/</url>
- <snapshots>
- <enabled>true</enabled>
- </snapshots>
- <releases>
- <enabled>true</enabled>
- </releases>
- </repository>
- </repositories>
- <pluginRepositories>
- <pluginRepository>
- <id>maven-central</id>
- <url>http://repo1.maven.org/maven2/</url>
- <snapshots>
- <enabled>true</enabled>
- </snapshots>
- <releases>
- <enabled>true</enabled>
- </releases>
- </pluginRepository>
- </pluginRepositories>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <version>2.0.2</version>
- <configuration>
- <source>1.5</source>
- <target>1.5</target>
- </configuration>
- </plugin>
- </plugins>
- </build>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>info.fitnesse</groupId>
+ <artifactId>transactionalrunner</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ <dependencies>
+ <dependency>
+ <groupId>org.fitnesse</groupId>
+ <artifactId>fitnesse</artifactId>
+ <version>20110104</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-context</artifactId>
+ <version>3.0.5.RELEASE</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-jdbc</artifactId>
+ <version>3.0.5.RELEASE</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-tx</artifactId>
+ <version>3.0.5.RELEASE</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.4</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>mysql</groupId>
+ <artifactId>mysql-connector-java</artifactId>
+ <version>5.1.6</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+ <repositories>
+ <repository>
+ <id>maven-central</id>
+ <url>http://repo1.maven.org/maven2/</url>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ </repository>
+ </repositories>
+ <pluginRepositories>
+ <pluginRepository>
+ <id>maven-central</id>
+ <url>http://repo1.maven.org/maven2/</url>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ </pluginRepository>
+ </pluginRepositories>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>2.0.2</version>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
</project>
@@ -1,27 +1,39 @@
-package info.fitnesse;
-
-import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
-import org.springframework.context.ApplicationContext;
-import org.springframework.context.support.GenericApplicationContext;
-import org.springframework.core.io.ClassPathResource;
-
-public class FitnesseSpringContext {
- private static ApplicationContext instance;
- public static ApplicationContext getInstance(){
- if (instance!=null) return instance;
- if (System.getProperty("spring.context")==null){
- throw new Error("spring.context environment variable is not defined. please set it to your spring context path");
- }
- GenericApplicationContext ctx = new GenericApplicationContext();
- XmlBeanDefinitionReader xmlReader = new XmlBeanDefinitionReader(ctx);
- xmlReader.loadBeanDefinitions(System.getProperty("spring.context"));
- xmlReader = new XmlBeanDefinitionReader(ctx);
- xmlReader.loadBeanDefinitions(new ClassPathResource("embedded-rollback.xml"));
- ctx.refresh();
- instance=ctx;
- return instance;
- }
- public static RollbackIntf getRollbackBean() {
- return (RollbackIntf) getInstance().getBean("rollbackBean");
- }
-}
+package info.fitnesse;
+
+import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.support.AbstractApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+import org.springframework.context.support.GenericApplicationContext;
+import org.springframework.core.io.ClassPathResource;
+
+public class FitnesseSpringContext {
+ private static AbstractApplicationContext instance;
+
+ public static AbstractApplicationContext getInstance() {
+ if (instance != null) return instance;
+ if (System.getProperty("spring.context") == null) {
+ throw new Error("spring.context environment variable is not defined. please set it to your spring context path");
+ }
+
+ GenericApplicationContext ctx = new GenericApplicationContext();
+ XmlBeanDefinitionReader xmlReader = new XmlBeanDefinitionReader(ctx);
+ xmlReader.loadBeanDefinitions(System.getProperty("spring.context"));
+ xmlReader = new XmlBeanDefinitionReader(ctx);
+ xmlReader.loadBeanDefinitions(new ClassPathResource("embedded-rollback.xml"));
+ ctx.refresh();
+ ctx.registerShutdownHook();
+
+ instance = ctx;
+
+ return instance;
+ }
+
+ public static RollbackIntf getRollbackBean() {
+ return (RollbackIntf) getInstance().getBean("rollbackBean");
+ }
+
+ public static void shutdown() {
+ getInstance().close();
+ }
+}
@@ -1,11 +1,11 @@
-package info.fitnesse;
-import org.springframework.transaction.annotation.Transactional;
-
-
-public class RollbackBean implements RollbackIntf {
- @Transactional(rollbackFor=RollbackNow.class)
- public void process(Runnable r) {
- r.run();
- throw new RollbackNow();
- }
-}
+package info.fitnesse;
+
+import org.springframework.transaction.annotation.Transactional;
+
+public class RollbackBean implements RollbackIntf {
+ @Transactional(rollbackFor = RollbackNow.class)
+ public void process(Runnable r) {
+ r.run();
+ throw new RollbackNow();
+ }
+}
@@ -1,5 +1,5 @@
-package info.fitnesse;
-
-public interface RollbackIntf {
- public void process(Runnable r);
-}
+package info.fitnesse;
+
+public interface RollbackIntf {
+ void process(Runnable r);
+}
@@ -1,5 +1,5 @@
-package info.fitnesse;
-
-public class RollbackNow extends RuntimeException {
-
-}
+package info.fitnesse;
+
+public class RollbackNow extends RuntimeException {
+
+}
Oops, something went wrong.

0 comments on commit 438808f

Please sign in to comment.