You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@onami.apache.org by si...@apache.org on 2013/01/20 17:19:56 UTC

svn commit: r1435873 - in /incubator/onami/trunk/spi: pom.xml src/test/java/org/apache/onami/spi/FromSystemPropertiesTestCase.java

Author: simonetripodi
Date: Sun Jan 20 16:19:56 2013
New Revision: 1435873

URL: http://svn.apache.org/viewvc?rev=1435873&view=rev
Log:
Move test initialization from pom to code, in order to successfully run unit tests from IDE and CLI, and it will clearly indicate to the code reader the preconditions and the aim of the test - patch submitted by Eric Charles

Modified:
    incubator/onami/trunk/spi/pom.xml
    incubator/onami/trunk/spi/src/test/java/org/apache/onami/spi/FromSystemPropertiesTestCase.java

Modified: incubator/onami/trunk/spi/pom.xml
URL: http://svn.apache.org/viewvc/incubator/onami/trunk/spi/pom.xml?rev=1435873&r1=1435872&r2=1435873&view=diff
==============================================================================
--- incubator/onami/trunk/spi/pom.xml (original)
+++ incubator/onami/trunk/spi/pom.xml Sun Jan 20 16:19:56 2013
@@ -83,19 +83,6 @@
     <plugins>
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-surefire-plugin</artifactId>
-        <version>${surefire.version}</version>
-        <configuration>
-          <systemProperties>
-            <property>
-              <name>org.apache.onami.spi.FooService</name>
-              <value>org.apache.onami.spi.FooServiceImpl1,org.apache.onami.spi.FooServiceImpl2</value>
-            </property>
-          </systemProperties>
-        </configuration>
-      </plugin>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-site-plugin</artifactId>
         <configuration>
           <locales>en</locales>

Modified: incubator/onami/trunk/spi/src/test/java/org/apache/onami/spi/FromSystemPropertiesTestCase.java
URL: http://svn.apache.org/viewvc/incubator/onami/trunk/spi/src/test/java/org/apache/onami/spi/FromSystemPropertiesTestCase.java?rev=1435873&r1=1435872&r2=1435873&view=diff
==============================================================================
--- incubator/onami/trunk/spi/src/test/java/org/apache/onami/spi/FromSystemPropertiesTestCase.java (original)
+++ incubator/onami/trunk/spi/src/test/java/org/apache/onami/spi/FromSystemPropertiesTestCase.java Sun Jan 20 16:19:56 2013
@@ -32,6 +32,12 @@ public final class FromSystemPropertiesT
     @Before
     public void setUp()
     {
+        // This simulates the SPI specification via Java System Properties,
+        // equivalent to java -Dorg.apache.onami.spi.FooService=org.apac...
+        System.setProperty( "org.apache.onami.spi.FooService",
+                            "org.apache.onami.spi.FooServiceImpl1," +
+                            "org.apache.onami.spi.FooServiceImpl2");
+
         createInjector( new ServiceLoaderModule()
         {