[jboss-osgi-commits] JBoss-OSGI SVN: r92741 - projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/testing.

jboss-osgi-commits at lists.jboss.org jboss-osgi-commits at lists.jboss.org
Mon Aug 24 09:31:16 EDT 2009


Author: thomas.diesler at jboss.com
Date: 2009-08-24 09:31:15 -0400 (Mon, 24 Aug 2009)
New Revision: 92741

Modified:
   projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/testing/OSGiTest.java
   projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/testing/OSGiTestHelper.java
Log:
Add getTestArchivePath()

Modified: projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/testing/OSGiTest.java
===================================================================
--- projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/testing/OSGiTest.java	2009-08-24 12:20:52 UTC (rev 92740)
+++ projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/testing/OSGiTest.java	2009-08-24 13:31:15 UTC (rev 92741)
@@ -153,6 +153,14 @@
    }
 
    /**
+    * Delegates to {@link OSGiTestHelper#getTestArchivePath(String)}
+    */
+   protected String getTestArchivePath(String archive)
+   {
+      return getTestHelper().getTestArchivePath(archive);
+   }
+
+   /**
     * Delegates to {@link OSGiTestHelper#getTestArchiveFile(String)}
     */
    protected File getTestArchiveFile(String archive)

Modified: projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/testing/OSGiTestHelper.java
===================================================================
--- projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/testing/OSGiTestHelper.java	2009-08-24 12:20:52 UTC (rev 92740)
+++ projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/testing/OSGiTestHelper.java	2009-08-24 13:31:15 UTC (rev 92741)
@@ -48,10 +48,10 @@
    // The OSGiBootstrapProvider is a lazy property of the helper
    private OSGiBootstrapProvider bootProvider;
    private boolean skipCreateBootstrapProvider;
-   
+
    private static String testResourcesDir;
    private static String testArchiveDir;
-   
+
    public OSGiTestHelper()
    {
       testResourcesDir = System.getProperty(SYSPROP_TEST_RESOURCES_DIRECTORY, "target/test-classes");
@@ -74,23 +74,23 @@
       }
       return bootProvider;
    }
-   
+
    public OSGiRuntime getDefaultRuntime()
    {
       OSGiRuntime runtime;
-      
+
       String target = System.getProperty("target.container");
       if (target == null)
       {
          runtime = getEmbeddedRuntime();
       }
-      else 
+      else
       {
          runtime = getRemoteRuntime();
       }
-      return runtime; 
+      return runtime;
    }
-   
+
    public OSGiRuntime getEmbeddedRuntime()
    {
       return new EmbeddedRuntime(this);
@@ -117,6 +117,20 @@
       return resURL;
    }
 
+   /** Try to discover the File for the test resource */
+   public File getResourceFile(String resource)
+   {
+      File file = new File(resource);
+      if (file.exists())
+         return file;
+
+      file = new File(testResourcesDir + "/" + resource);
+      if (file.exists())
+         return file;
+
+      throw new IllegalArgumentException("Cannot obtain '" + testResourcesDir + "/" + resource + "'");
+   }
+
    /** Try to discover the URL for the deployment archive */
    public URL getTestArchiveURL(String archive)
    {
@@ -130,18 +144,10 @@
       }
    }
 
-   /** Try to discover the File for the test resource */
-   public File getResourceFile(String resource)
+   /** Try to discover the absolute path for the deployment archive */
+   public String getTestArchivePath(String archive)
    {
-      File file = new File(resource);
-      if (file.exists())
-         return file;
-
-      file = new File(testResourcesDir + "/" + resource);
-      if (file.exists())
-         return file;
-
-      throw new IllegalArgumentException("Cannot obtain '" + testResourcesDir + "/" + resource + "'");
+      return getTestArchiveFile(archive).getAbsolutePath();
    }
 
    /** Try to discover the File for the deployment archive */
@@ -157,7 +163,7 @@
 
       throw new IllegalArgumentException("Cannot obtain '" + testArchiveDir + "/" + archive + "'.");
    }
-   
+
    @SuppressWarnings("unchecked")
    public InitialContext getInitialContext() throws NamingException
    {



More information about the jboss-osgi-commits mailing list