You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@aries.apache.org by li...@apache.org on 2010/04/08 05:22:24 UTC

svn commit: r931766 - in /incubator/aries/trunk/subsystem: pom.xml subsystem-itests/pom.xml subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/SubsystemAdminTest.java

Author: linsun
Date: Thu Apr  8 03:22:23 2010
New Revision: 931766

URL: http://svn.apache.org/viewvc?rev=931766&view=rev
Log:
ARIES-277 generate test eba on the fly

Modified:
    incubator/aries/trunk/subsystem/pom.xml
    incubator/aries/trunk/subsystem/subsystem-itests/pom.xml
    incubator/aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/SubsystemAdminTest.java

Modified: incubator/aries/trunk/subsystem/pom.xml
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/subsystem/pom.xml?rev=931766&r1=931765&r2=931766&view=diff
==============================================================================
--- incubator/aries/trunk/subsystem/pom.xml (original)
+++ incubator/aries/trunk/subsystem/pom.xml Thu Apr  8 03:22:23 2010
@@ -56,6 +56,11 @@
                 <version>${version}</version>
             </dependency>
             <dependency>
+                <groupId>org.apache.aries.testsupport</groupId>
+                <artifactId>org.apache.aries.testsupport.unit</artifactId>
+                <version>${version}</version>
+            </dependency>
+            <dependency>
                 <groupId>org.osgi</groupId>
                 <artifactId>org.osgi.core</artifactId>
                 <version>4.2.0</version>

Modified: incubator/aries/trunk/subsystem/subsystem-itests/pom.xml
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/subsystem/subsystem-itests/pom.xml?rev=931766&r1=931765&r2=931766&view=diff
==============================================================================
--- incubator/aries/trunk/subsystem/subsystem-itests/pom.xml (original)
+++ incubator/aries/trunk/subsystem/subsystem-itests/pom.xml Thu Apr  8 03:22:23 2010
@@ -67,6 +67,11 @@
             <scope>test</scope>
         </dependency>
         <dependency>
+            <groupId>org.apache.aries.testsupport</groupId>
+            <artifactId>org.apache.aries.testsupport.unit</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
             <groupId>org.ops4j.pax.exam</groupId>
             <artifactId>pax-exam</artifactId>
             <scope>test</scope>

Modified: incubator/aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/SubsystemAdminTest.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/SubsystemAdminTest.java?rev=931766&r1=931765&r2=931766&view=diff
==============================================================================
--- incubator/aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/SubsystemAdminTest.java (original)
+++ incubator/aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/SubsystemAdminTest.java Thu Apr  8 03:22:23 2010
@@ -29,6 +29,7 @@ import static org.ops4j.pax.exam.CoreOpt
 import static org.ops4j.pax.exam.CoreOptions.systemProperty;
 
 import java.io.File;
+import java.io.FileOutputStream;
 import java.net.URL;
 import java.text.SimpleDateFormat;
 import java.util.Currency;
@@ -37,11 +38,14 @@ import java.util.HashMap;
 import java.util.Map;
 
 
+import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
 import org.apache.aries.subsystem.Subsystem;
 import org.apache.aries.subsystem.SubsystemAdmin;
+import org.apache.aries.unittest.fixture.ArchiveFixture;
+import org.apache.aries.unittest.fixture.ArchiveFixture.ZipFixture;
 
 import org.ops4j.pax.exam.Option;
 import org.ops4j.pax.exam.junit.JUnit4TestRunner;
@@ -55,6 +59,26 @@ import org.osgi.service.composite.Compos
 @RunWith(JUnit4TestRunner.class)
 public class SubsystemAdminTest extends AbstractIntegrationTest {
 
+    /* Use @Before not @BeforeClass so as to ensure that these resources
+     * are created in the paxweb temp directory, and not in the svn tree 
+     */
+    static boolean createdApplications = false;
+    @Before
+    public static void createApplications() throws Exception {
+      if (createdApplications) { 
+        return;
+      }
+
+      ZipFixture testEba = ArchiveFixture.newZip();
+      
+      testEba = testEba.binary("META-INF/MANIFEST.MF", 
+              SubsystemAdminTest.class.getClassLoader().getResourceAsStream("subsystem1/META-INF/MANIFEST.MF"))
+          .end();
+      FileOutputStream fout = new FileOutputStream("test.eba");
+      testEba.writeOut(fout);
+      fout.close();
+      createdApplications = true;
+    }
     
     @Test
     public void test() throws Exception {
@@ -68,8 +92,7 @@ public class SubsystemAdminTest extends 
         assertNotNull("subsystem admin should not be null", sa);
         System.out.println("able to get subsytem admin service");
         
-        // TODO need to provide some test project that provides test.eba and remove the hard code source dir
-        File f = new File("/Users/linsun/ariesN/trunk/subsystem/subsystem-itests/src/test/resources/subsystem1/subsystem1.eba");
+        File f = new File("test.eba");
         Subsystem subsystem = sa.install(f.toURL().toExternalForm());
         assertNotNull("subsystem should not be null", subsystem);
         
@@ -97,6 +120,7 @@ public class SubsystemAdminTest extends 
             mavenBundle("org.apache.aries.subsystem", "org.apache.aries.subsystem.api"),
             mavenBundle("org.apache.aries.subsystem", "org.apache.aries.subsystem.core"),
             mavenBundle("org.osgi", "org.osgi.compendium"),
+            mavenBundle("org.apache.aries.testsupport", "org.apache.aries.testsupport.unit"),
             //org.ops4j.pax.exam.container.def.PaxRunnerOptions.vmOption("-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005"),
 
             equinox().version("3.6.0")