[jboss-svn-commits] JBoss Common SVN: r3490 - in declarchive/trunk: impl-base/src/test/java/org/jboss/declarchive/impl/base and 4 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Wed Aug 26 06:36:16 EDT 2009


Author: aslak
Date: 2009-08-26 06:36:15 -0400 (Wed, 26 Aug 2009)
New Revision: 3490

Added:
   declarchive/trunk/impl-base/src/test/java/org/jboss/declarchive/impl/base/test/
   declarchive/trunk/impl-base/src/test/java/org/jboss/declarchive/impl/base/test/ArchiveTestBase.java
Modified:
   declarchive/trunk/impl-base/pom.xml
   declarchive/trunk/impl-base/src/test/java/org/jboss/declarchive/impl/base/unit/MemoryMapArchiveTestCase.java
   declarchive/trunk/impl-vfs/pom.xml
   declarchive/trunk/impl-vfs/src/test/java/org/jboss/declarchive/impl/vfs/VfsMemoryArchiveTestCase.java
Log:
TMPARCH-22 
- Extracted Tests from MemoryMapArchiveTestCase into new ArchiveTestBase class
- Added test-jar goal to impl-base pom
- Added dep to impl-base tests in test scope of impl-vfs
- Changed VfsMemoryArchiveTestCase and MemoryMapArchiveTestCase to use the new ArchiveTestBase
- Changed ArchiveTestBase to use byte[] equals testing instead of Asset instances to verify add/get operations.

Modified: declarchive/trunk/impl-base/pom.xml
===================================================================
--- declarchive/trunk/impl-base/pom.xml	2009-08-26 08:06:40 UTC (rev 3489)
+++ declarchive/trunk/impl-base/pom.xml	2009-08-26 10:36:15 UTC (rev 3490)
@@ -54,5 +54,20 @@
 
   </dependencies>
 
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-jar-plugin</artifactId>
+        <executions>
+          <execution>
+            <goals>
+              <goal>test-jar</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
 </project>
 

Added: declarchive/trunk/impl-base/src/test/java/org/jboss/declarchive/impl/base/test/ArchiveTestBase.java
===================================================================
--- declarchive/trunk/impl-base/src/test/java/org/jboss/declarchive/impl/base/test/ArchiveTestBase.java	                        (rev 0)
+++ declarchive/trunk/impl-base/src/test/java/org/jboss/declarchive/impl/base/test/ArchiveTestBase.java	2009-08-26 10:36:15 UTC (rev 3490)
@@ -0,0 +1,344 @@
+/*
+ * JBoss, Home of Professional Open Source  
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * 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.jboss.declarchive.impl.base.test;
+
+import java.util.Arrays;
+import java.util.Map;
+
+import junit.framework.Assert;
+
+import org.jboss.declarchive.api.Archive;
+import org.jboss.declarchive.api.Asset;
+import org.jboss.declarchive.api.Path;
+import org.jboss.declarchive.impl.base.MemoryMapArchiveImpl;
+import org.jboss.declarchive.impl.base.asset.ClassLoaderAsset;
+import org.jboss.declarchive.impl.base.io.IOUtil;
+import org.jboss.declarchive.impl.base.path.BasicPath;
+import org.junit.After;
+import org.junit.Test;
+
+/**
+ * ArchiveTestBase
+ * 
+ * Base test for all Archive service providers to help 
+ *
+ * @author <a href="mailto:aslak at conduct.no">Aslak Knutsen</a>
+ * @version $Revision: $
+ */
+public abstract class ArchiveTestBase<T extends Archive<T>>
+{
+
+   protected abstract Archive<T> getArchive();
+
+   
+   @After
+   public void ls()
+   {
+      Archive<T> archive = getArchive();
+      System.out.println("test at jboss:/$ ls -l " + archive.getName());
+      System.out.println(archive.toString(true));
+   }
+
+   /**
+    * Ensure adding an asset to the path results in successful storage.
+    * @throws Exception
+    */
+   @Test
+   public void testAddAssetToPath() throws Exception
+   {
+      Archive<T> archive = getArchive();
+      Asset asset = new ClassLoaderAsset("org/jboss/declarchive/impl/base/asset/Test.properties");
+      Path location = new BasicPath("/", "test.properties");
+
+      archive.add(location, asset);
+
+      Assert.assertTrue("Asset should be placed on " + location.get(), archive.contains(location));
+   }
+
+   /**
+    * Ensure adding an asset to the path requires path.
+    * @throws Exception
+    */
+   @Test
+   public void testAddRequiresPath() throws Exception
+   {
+      Archive<T> archive = getArchive();
+      Asset asset = new ClassLoaderAsset("org/jboss/declarchive/impl/base/asset/Test.properties");
+
+      try
+      {
+         archive.add((Path) null, asset);
+         Assert.fail("Should have throw an IllegalArgumentException");
+      }
+      catch (IllegalArgumentException expectedException)
+      {
+      }
+   }
+
+   /**
+    * Ensure adding an asset to the path requires an asset.
+    * @throws Exception
+    */
+   @Test
+   public void testAddRequiresAssets() throws Exception
+   {
+      Archive<T> archive = getArchive();
+      try
+      {
+         archive.add(new BasicPath("/", "Test.properties"), (Asset) null);
+         Assert.fail("Should have throw an IllegalArgumentException");
+      }
+      catch (IllegalArgumentException expectedException)
+      {
+      }
+   }
+
+   /** 
+    * Ensure adding an asset with a name results in successful storage
+    * @throws Exception
+    */
+   @Test
+   public void testAddAssetWithName() throws Exception
+   {
+      Archive<T> archive = getArchive();
+      final String name = "test.properties";
+      final Asset asset = new ClassLoaderAsset("org/jboss/declarchive/impl/base/asset/Test.properties");
+      Path location = new BasicPath("/");
+
+      archive.add(location, name, asset);
+
+      Path expectedPath = new BasicPath("/", "test.properties");
+
+      Assert.assertTrue("Asset should be placed on " + expectedPath.get(), archive.contains(expectedPath));
+   }
+
+   /**
+    * Ensure adding an asset with name requires the path attribute
+    * @throws Exception
+    */
+   @Test
+   public void testAddAssetWithNameRequiresPath() throws Exception
+   {
+      Archive<T> archive = getArchive();
+      final String name = "test.properties";
+      final Asset asset = new ClassLoaderAsset("org/jboss/declarchive/impl/base/asset/Test.properties");
+      try
+      {
+         archive.add(null, name, asset);
+         Assert.fail("Should have throw an IllegalArgumentException");
+      }
+      catch (IllegalArgumentException expectedException)
+      {
+      }
+   }
+
+   /**
+    * Ensure adding an asset with name requires the name attribute
+    * @throws Exception
+    */
+   @Test
+   public void testAddAssetWithNameRequiresName() throws Exception
+   {
+      Archive<T> archive = getArchive();
+      final Path path = new BasicPath("/", "Test.properties");
+      final String resource = "org/jboss/declarchive/impl/base/asset/Test.properties";
+      try
+      {
+         archive.add(path, null, new ClassLoaderAsset(resource));
+         Assert.fail("Should have throw an IllegalArgumentException");
+      }
+      catch (IllegalArgumentException expectedException)
+      {
+      }
+   }
+
+   /**
+    * Ensure adding an asset with name requires the asset attribute
+    * @throws Exception
+    */
+   @Test
+   public void testAddAssetWithNameRequiresAsset() throws Exception
+   {
+      Archive<T> archive = getArchive();
+      final String name = "test.properties";
+      final Path path = new BasicPath("/", "Test.properties");
+      try
+      {
+         archive.add(path, name, null);
+         Assert.fail("Should have throw an IllegalArgumentException");
+      }
+      catch (IllegalArgumentException expectedException)
+      {
+      }
+   }
+
+   /**
+    * Ensure deleting an asset successfully removes asset from storage
+    * @throws Exception
+    */
+   @Test
+   public void testDeleteAsset() throws Exception
+   {
+      Archive<T> archive = getArchive();
+      String resource = "org/jboss/declarchive/impl/base/asset/Test.properties";
+      Path location = new BasicPath("/", "test.properties");
+      archive.add(location, new ClassLoaderAsset(resource));
+      Assert.assertTrue(archive.contains(location)); // Sanity check
+
+      Assert.assertTrue("Successfully deleting an Asset should ruturn true", archive.delete(location));
+
+      Assert.assertFalse("There should no longer be an asset at: " + location.get() + " after deleted", archive
+            .contains(location));
+   }
+
+   /**
+    * Ensure deleting a missing asset returns correct status
+    * @throws Exception
+    */
+   @Test
+   public void testDeleteMissingAsset() throws Exception
+   {
+      Archive<T> archive = getArchive();
+      Path location = new BasicPath("/", "test.properties");
+
+      Assert.assertFalse("Deleting a non-existent Asset should ruturn false", archive.delete(location));
+   }
+
+   /**
+    * Ensure deleting an asset requires a path
+    * @throws Exception
+    */
+   @Test
+   public void testDeleteAssetRequiresPath() throws Exception
+   {
+      Archive<T> archive = getArchive();
+      try
+      {
+         archive.delete(null);
+         Assert.fail("Should have throw an IllegalArgumentException");
+      }
+      catch (IllegalArgumentException expectedException)
+      {
+      }
+   }
+
+   /**
+    * Ensure an asset can be retrieved by its path
+    * @throws Exception
+    */
+   @Test
+   public void testGetAsset() throws Exception
+   {
+      Archive<T> archive = getArchive();
+      Path location = new BasicPath("/", "test.properties");
+      Asset asset = new ClassLoaderAsset("org/jboss/declarchive/impl/base/asset/Test.properties");
+      archive.add(location, asset);
+
+      byte[] addedData = IOUtil.asByteArray(asset.getStream());
+      byte[] fetchedData = IOUtil.asByteArray(archive.get(location).getStream());
+      
+      Assert.assertTrue(
+            "Asset should be returned from path: " + location.get(), 
+            Arrays.equals(addedData, fetchedData));
+   }
+
+   /**
+    * Ensure get asset requires a path
+    * @throws Exception
+    */
+   @Test
+   public void testGetAssetRequiresPath() throws Exception
+   {
+      Archive<T> archive = getArchive();
+      try
+      {
+         archive.get((Path) null);
+         Assert.fail("Should have throw an IllegalArgumentException");
+      }
+      catch (IllegalArgumentException expectedException)
+      {
+      }
+   }
+
+   /**
+    * Ensure get content returns the correct map of content
+    * @throws Exception
+    */
+   @Test
+   public void testToGetContent() throws Exception
+   {
+      Archive<T> archive = getArchive();
+      Path location = new BasicPath("/", "test.properties");
+      Path locationTwo = new BasicPath("/", "test2.properties");
+
+      Asset asset = new ClassLoaderAsset("org/jboss/declarchive/impl/base/asset/Test.properties");
+      Asset assetTwo = new ClassLoaderAsset("org/jboss/declarchive/impl/base/asset/Test2.properties");
+      archive.add(location, asset).add(locationTwo, assetTwo);
+
+      Map<Path, Asset> content = archive.getContent();
+      
+      byte[] addedData = IOUtil.asByteArray(asset.getStream());
+      byte[] addedDataTwo = IOUtil.asByteArray(assetTwo.getStream());
+      byte[] fetchedData = IOUtil.asByteArray(content.get(location).getStream());
+      byte[] fetchedDataTwo = IOUtil.asByteArray(content.get(locationTwo).getStream());
+      
+      Assert.assertTrue(
+            "Asset should existing in content with key: " + location.get(), 
+            Arrays.equals(addedData, fetchedData));
+      
+      Assert.assertTrue(
+            "Asset should existing in content with key: " + locationTwo.get(), 
+            Arrays.equals(addedDataTwo, fetchedDataTwo));
+   }
+   
+   /**
+    * Ensure adding an archive to a path requires a path
+    * @throws Exception
+    */
+   @Test
+   public void testAddArchiveToPathRequirePath() throws Exception
+   {
+      Archive<T> archive = getArchive();
+      try
+      {
+         archive.add(null, new MemoryMapArchiveImpl());
+         Assert.fail("Should have throw an IllegalArgumentException");
+      }
+      catch (IllegalArgumentException expectedException)
+      {
+      }
+   }
+
+   /**
+    * Ensure adding an archive to a path requires an archive
+    * @throws Exception
+    */
+   @Test
+   public void testAddArchiveToPathRequireArchive() throws Exception
+   {
+      Archive<T> archive = getArchive();
+      try
+      {
+         archive.add(new BasicPath("/"), (Archive<?>) null);
+         Assert.fail("Should have throw an IllegalArgumentException");
+      }
+      catch (IllegalArgumentException expectedException)
+      {
+      }
+   }
+
+}

Modified: declarchive/trunk/impl-base/src/test/java/org/jboss/declarchive/impl/base/unit/MemoryMapArchiveTestCase.java
===================================================================
--- declarchive/trunk/impl-base/src/test/java/org/jboss/declarchive/impl/base/unit/MemoryMapArchiveTestCase.java	2009-08-26 08:06:40 UTC (rev 3489)
+++ declarchive/trunk/impl-base/src/test/java/org/jboss/declarchive/impl/base/unit/MemoryMapArchiveTestCase.java	2009-08-26 10:36:15 UTC (rev 3490)
@@ -16,8 +16,6 @@
  */
 package org.jboss.declarchive.impl.base.unit;
 
-import java.util.Map;
-
 import junit.framework.Assert;
 
 import org.jboss.declarchive.api.Archive;
@@ -26,8 +24,8 @@
 import org.jboss.declarchive.impl.base.MemoryMapArchiveImpl;
 import org.jboss.declarchive.impl.base.asset.ClassLoaderAsset;
 import org.jboss.declarchive.impl.base.path.BasicPath;
+import org.jboss.declarchive.impl.base.test.ArchiveTestBase;
 import org.jboss.declarchive.spi.MemoryMapArchive;
-import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 
@@ -40,21 +38,20 @@
  *  * @author <a href="mailto:aslak at conduct.no">Aslak Knutsen</a>
  * @version $Revision: $
  */
-public class MemoryMapArchiveTestCase
+public class MemoryMapArchiveTestCase extends ArchiveTestBase<MemoryMapArchive>
 {
    private MemoryMapArchive archive;
 
    @Before
-   public void createMemoryArchive() throws Exception
+   public void createArchive() throws Exception  
    {
       archive = new MemoryMapArchiveImpl();
    }
-
-   @After
-   public void ls()
+   
+   @Override
+   protected Archive<MemoryMapArchive> getArchive()
    {
-      System.out.println("test at jboss:/$ ls -l " + archive.getName());
-      System.out.println(archive.toString(true));
+      return archive;
    }
 
    /**
@@ -86,231 +83,8 @@
       }
    }
 
-   /**
-    * Ensure adding an asset to the path results in successful storage.
-    * @throws Exception
-    */
-   @Test
-   public void testAddAssetToPath() throws Exception
-   {
-      Asset asset = new ClassLoaderAsset("org/jboss/declarchive/impl/base/asset/Test.properties");
-      Path location = new BasicPath("/", "test.properties");
 
-      archive.add(location, asset);
-
-      Assert.assertTrue("Asset should be placed on " + location.get(), archive.contains(location));
-   }
-
    /**
-    * Ensure adding an asset to the path requires path.
-    * @throws Exception
-    */
-   @Test
-   public void testAddRequiresPath() throws Exception
-   {
-      Asset asset = new ClassLoaderAsset("org/jboss/declarchive/impl/base/asset/Test.properties");
-
-      try
-      {
-         archive.add((Path) null, asset);
-         Assert.fail("Should have throw an IllegalArgumentException");
-      }
-      catch (IllegalArgumentException expectedException)
-      {
-      }
-   }
-
-   /**
-    * Ensure adding an asset to the path requires an asset.
-    * @throws Exception
-    */
-   @Test
-   public void testAddRequiresAssets() throws Exception
-   {
-      try
-      {
-         archive.add(new BasicPath("/", "Test.properties"), (Asset) null);
-         Assert.fail("Should have throw an IllegalArgumentException");
-      }
-      catch (IllegalArgumentException expectedException)
-      {
-      }
-   }
-
-   /** 
-    * Ensure adding an asset with a name results in successful storage
-    * @throws Exception
-    */
-   @Test
-   public void testAddAssetWithName() throws Exception
-   {
-      final String name = "test.properties";
-      final Asset asset = new ClassLoaderAsset("org/jboss/declarchive/impl/base/asset/Test.properties");
-      Path location = new BasicPath("/");
-
-      archive.add(location, name, asset);
-
-      Path expectedPath = new BasicPath("/", "test.properties");
-
-      Assert.assertTrue("Asset should be placed on " + expectedPath.get(), archive.contains(expectedPath));
-   }
-
-   /**
-    * Ensure adding an asset with name requires the path attribute
-    * @throws Exception
-    */
-   @Test
-   public void testAddAssetWithNameRequiresPath() throws Exception
-   {
-      final String name = "test.properties";
-      final Asset asset = new ClassLoaderAsset("org/jboss/declarchive/impl/base/asset/Test.properties");
-      try
-      {
-         archive.add(null, name, asset);
-         Assert.fail("Should have throw an IllegalArgumentException");
-      }
-      catch (IllegalArgumentException expectedException)
-      {
-      }
-   }
-
-   /**
-    * Ensure adding an asset with name requires the name attribute
-    * @throws Exception
-    */
-   @Test
-   public void testAddAssetWithNameRequiresName() throws Exception
-   {
-      final Path path = new BasicPath("/", "Test.properties");
-      final String resource = "org/jboss/declarchive/impl/base/asset/Test.properties";
-      try
-      {
-         archive.add(path, null, new ClassLoaderAsset(resource));
-         Assert.fail("Should have throw an IllegalArgumentException");
-      }
-      catch (IllegalArgumentException expectedException)
-      {
-      }
-   }
-
-   /**
-    * Ensure adding an asset with name requires the asset attribute
-    * @throws Exception
-    */
-   @Test
-   public void testAddAssetWithNameRequiresAsset() throws Exception
-   {
-      final String name = "test.properties";
-      final Path path = new BasicPath("/", "Test.properties");
-      try
-      {
-         archive.add(path, name, null);
-         Assert.fail("Should have throw an IllegalArgumentException");
-      }
-      catch (IllegalArgumentException expectedException)
-      {
-      }
-   }
-
-   /**
-    * Ensure deleting an asset successfully removes asset from storage
-    * @throws Exception
-    */
-   @Test
-   public void testDeleteAsset() throws Exception
-   {
-      String resource = "org/jboss/declarchive/impl/base/asset/Test.properties";
-      Path location = new BasicPath("/", "test.properties");
-      archive.add(location, new ClassLoaderAsset(resource));
-      Assert.assertTrue(archive.contains(location)); // Sanity check
-
-      Assert.assertTrue("Successfully deleting an Asset should ruturn true", archive.delete(location));
-
-      Assert.assertFalse("There should no longer be an asset at: " + location.get() + " after deleted", archive
-            .contains(location));
-   }
-
-   /**
-    * Ensure deleting a missing asset returns correct status
-    * @throws Exception
-    */
-   @Test
-   public void testDeleteMissingAsset() throws Exception
-   {
-      Path location = new BasicPath("/", "test.properties");
-
-      Assert.assertFalse("Deleting a non-existent Asset should ruturn false", archive.delete(location));
-   }
-
-   /**
-    * Ensure deleting an asset requires a path
-    * @throws Exception
-    */
-   @Test
-   public void testDeleteAssetRequiresPath() throws Exception
-   {
-      try
-      {
-         archive.delete(null);
-         Assert.fail("Should have throw an IllegalArgumentException");
-      }
-      catch (IllegalArgumentException expectedException)
-      {
-      }
-   }
-
-   /**
-    * Ensure an asset can be retrieved by its path
-    * @throws Exception
-    */
-   @Test
-   public void testGetAsset() throws Exception
-   {
-      Path location = new BasicPath("/", "test.properties");
-      Asset asset = new ClassLoaderAsset("org/jboss/declarchive/impl/base/asset/Test.properties");
-      archive.add(location, asset);
-
-      Assert.assertEquals("Asset should be returned from path: " + location.get(), asset, archive.get(location));
-   }
-
-   /**
-    * Ensure get asset requires a path
-    * @throws Exception
-    */
-   @Test
-   public void testGetAssetRequiresPath() throws Exception
-   {
-      try
-      {
-         archive.get((Path) null);
-         Assert.fail("Should have throw an IllegalArgumentException");
-      }
-      catch (IllegalArgumentException expectedException)
-      {
-      }
-   }
-
-   /**
-    * Ensure get content returns the correct map of content
-    * @throws Exception
-    */
-   @Test
-   public void testToGetContent() throws Exception
-   {
-      Path location = new BasicPath("/", "test.properties");
-      Path locationTwo = new BasicPath("/", "test2.properties");
-
-      Asset asset = new ClassLoaderAsset("org/jboss/declarchive/impl/base/asset/Test.properties");
-      Asset assetTwo = new ClassLoaderAsset("org/jboss/declarchive/impl/base/asset/Test2.properties");
-      archive.add(location, asset).add(locationTwo, assetTwo);
-
-      Map<Path, Asset> content = archive.getContent();
-      Assert.assertEquals("Asset should existing in content with key: " + location.get(), content.get(location), asset);
-      Assert.assertEquals("Asset should existing in content with key: " + locationTwo.get(), content.get(locationTwo),
-            assetTwo);
-   }
-
-   /**
     * Ensure adding content from another archive successfully stores all assets
     * @throws Exception
     */
@@ -417,38 +191,4 @@
             assetTwo);
    }
 
-   /**
-    * Ensure adding an archive to a path requires a path
-    * @throws Exception
-    */
-   @Test
-   public void testAddArchiveToPathRequirePath() throws Exception
-   {
-      try
-      {
-         archive.add(null, new MemoryMapArchiveImpl());
-         Assert.fail("Should have throw an IllegalArgumentException");
-      }
-      catch (IllegalArgumentException expectedException)
-      {
-      }
-   }
-
-   /**
-    * Ensure adding an archive to a path requires an archive
-    * @throws Exception
-    */
-   @Test
-   public void testAddArchiveToPathRequireArchive() throws Exception
-   {
-      try
-      {
-         archive.add(new BasicPath("/"), (Archive<?>) null);
-         Assert.fail("Should have throw an IllegalArgumentException");
-      }
-      catch (IllegalArgumentException expectedException)
-      {
-      }
-   }
-
 }

Modified: declarchive/trunk/impl-vfs/pom.xml
===================================================================
--- declarchive/trunk/impl-vfs/pom.xml	2009-08-26 08:06:40 UTC (rev 3489)
+++ declarchive/trunk/impl-vfs/pom.xml	2009-08-26 10:36:15 UTC (rev 3490)
@@ -45,6 +45,13 @@
     </dependency>
     <dependency>
       <groupId>org.jboss.declarchive</groupId>
+      <artifactId>declarchive-impl-base</artifactId>
+      <version>${version.org.jboss.declarchive_declarchive.impl.base}</version>
+      <classifier>tests</classifier>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.declarchive</groupId>
       <artifactId>declarchive-spi-vfs</artifactId>
       <version>${version.org.jboss.declarchive_declarchive.spi.vfs}</version>
     </dependency>

Modified: declarchive/trunk/impl-vfs/src/test/java/org/jboss/declarchive/impl/vfs/VfsMemoryArchiveTestCase.java
===================================================================
--- declarchive/trunk/impl-vfs/src/test/java/org/jboss/declarchive/impl/vfs/VfsMemoryArchiveTestCase.java	2009-08-26 08:06:40 UTC (rev 3489)
+++ declarchive/trunk/impl-vfs/src/test/java/org/jboss/declarchive/impl/vfs/VfsMemoryArchiveTestCase.java	2009-08-26 10:36:15 UTC (rev 3490)
@@ -21,16 +21,19 @@
  */
 package org.jboss.declarchive.impl.vfs;
 
+import java.util.UUID;
 import java.util.logging.Logger;
 
+import org.jboss.declarchive.api.Archive;
 import org.jboss.declarchive.api.Asset;
 import org.jboss.declarchive.api.Path;
 import org.jboss.declarchive.impl.base.asset.ClassAsset;
 import org.jboss.declarchive.impl.base.path.BasicPath;
+import org.jboss.declarchive.impl.base.test.ArchiveTestBase;
 import org.jboss.declarchive.spi.vfs.VfsArchive;
 import org.jboss.virtual.VFS;
+import org.junit.Before;
 import org.junit.BeforeClass;
-import org.junit.Test;
 
 /**
  * VfsMemoryArchiveTestCase
@@ -43,7 +46,7 @@
  */
 //TODO Build upon a common test base just as the MemoryMap impl uses,
 // and swap in a method to get the VFS Memory Archive impl
-public class VfsMemoryArchiveTestCase
+public class VfsMemoryArchiveTestCase extends ArchiveTestBase<VfsArchive>
 {
 
    //-------------------------------------------------------------------------------------||
@@ -56,6 +59,12 @@
    private static final Logger log = Logger.getLogger(VfsMemoryArchiveTestCase.class.getName());
 
    //-------------------------------------------------------------------------------------||
+   // Instance Members -------------------------------------------------------------------||
+   //-------------------------------------------------------------------------------------||
+   
+   private VfsArchive archive;
+   
+   //-------------------------------------------------------------------------------------||
    // Lifecycle --------------------------------------------------------------------------||
    //-------------------------------------------------------------------------------------||
 
@@ -68,14 +77,30 @@
       VFS.init();
    }
 
+   @Before
+   public void createArchive() throws Exception  
+   {
+      archive = new VfsMemoryArchiveImpl("test-" + UUID.randomUUID().toString() + ".jar");
+   }
+   
    //-------------------------------------------------------------------------------------||
+   // Required Implementations -----------------------------------------------------------||
+   //-------------------------------------------------------------------------------------||
+
+   @Override
+   protected Archive<VfsArchive> getArchive()
+   {
+      return archive;
+   }
+
+   //-------------------------------------------------------------------------------------||
    // Tests ------------------------------------------------------------------------------||
    //-------------------------------------------------------------------------------------||
 
    /**
     * Used in building the impl, not a true test yet
     */
-   @Test
+   //@Test
    //TODO Implement this test
    public void testMuckingAroundPrototypesNotARealTestYet() throws Exception
    {



More information about the jboss-svn-commits mailing list