[jboss-svn-commits] JBoss Common SVN: r3598 - in shrinkwrap/trunk: impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/asset and 4 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Wed Oct 14 10:13:47 EDT 2009


Author: ALRubinger
Date: 2009-10-14 10:13:46 -0400 (Wed, 14 Oct 2009)
New Revision: 3598

Modified:
   shrinkwrap/trunk/api/src/main/java/org/jboss/shrinkwrap/api/Asset.java
   shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/asset/ArchiveAsset.java
   shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/asset/ByteArrayAsset.java
   shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/asset/ClassAsset.java
   shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/asset/ClassLoaderAsset.java
   shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/asset/FileAsset.java
   shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/asset/UrlAsset.java
   shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/export/ExplodedExporterDelegate.java
   shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/export/ZipExportDelegate.java
   shrinkwrap/trunk/impl-base/src/test/java/org/jboss/shrinkwrap/impl/base/asset/ByteArrayAssetTestCase.java
   shrinkwrap/trunk/impl-base/src/test/java/org/jboss/shrinkwrap/impl/base/asset/ClassAssetTestCase.java
   shrinkwrap/trunk/impl-base/src/test/java/org/jboss/shrinkwrap/impl/base/asset/ClassLoaderAssetTestCase.java
   shrinkwrap/trunk/impl-base/src/test/java/org/jboss/shrinkwrap/impl/base/asset/FileAssetTestCase.java
   shrinkwrap/trunk/impl-base/src/test/java/org/jboss/shrinkwrap/impl/base/asset/UrlAssetTestCase.java
   shrinkwrap/trunk/impl-base/src/test/java/org/jboss/shrinkwrap/impl/base/export/ExplodedExporterTestCase.java
   shrinkwrap/trunk/impl-base/src/test/java/org/jboss/shrinkwrap/impl/base/export/ZipExporterTestCase.java
   shrinkwrap/trunk/impl-base/src/test/java/org/jboss/shrinkwrap/impl/base/test/ArchiveTestBase.java
Log:
[SHRINKWRAP-55] Refactor Asset.getStream to Asset.openStream

Modified: shrinkwrap/trunk/api/src/main/java/org/jboss/shrinkwrap/api/Asset.java
===================================================================
--- shrinkwrap/trunk/api/src/main/java/org/jboss/shrinkwrap/api/Asset.java	2009-10-14 14:11:41 UTC (rev 3597)
+++ shrinkwrap/trunk/api/src/main/java/org/jboss/shrinkwrap/api/Asset.java	2009-10-14 14:13:46 UTC (rev 3598)
@@ -33,5 +33,5 @@
     * 
     * @return A new open inputstream for each call.
     */
-   InputStream getStream();
+   InputStream openStream();
 }

Modified: shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/asset/ArchiveAsset.java
===================================================================
--- shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/asset/ArchiveAsset.java	2009-10-14 14:11:41 UTC (rev 3597)
+++ shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/asset/ArchiveAsset.java	2009-10-14 14:13:46 UTC (rev 3598)
@@ -67,7 +67,7 @@
     * @see org.jboss.shrinkwrap.api.Asset#getStream()
     */
    @Override
-   public InputStream getStream()
+   public InputStream openStream()
    {
       // Get the input stream from the ArchiveInputStreamFactory
       return ArchiveInputStreamFactory.getInputStream(getArchive());

Modified: shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/asset/ByteArrayAsset.java
===================================================================
--- shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/asset/ByteArrayAsset.java	2009-10-14 14:11:41 UTC (rev 3597)
+++ shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/asset/ByteArrayAsset.java	2009-10-14 14:13:46 UTC (rev 3598)
@@ -101,10 +101,10 @@
    //-------------------------------------------------------------------------------------||
 
    /**
-    * @see org.jboss.shrinkwrap.api.Asset#getStream()
+    * @see org.jboss.shrinkwrap.api.Asset#openStream()
     */
    @Override
-   public InputStream getStream()
+   public InputStream openStream()
    {
       return new ByteArrayInputStream(this.content);
    }

Modified: shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/asset/ClassAsset.java
===================================================================
--- shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/asset/ClassAsset.java	2009-10-14 14:11:41 UTC (rev 3597)
+++ shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/asset/ClassAsset.java	2009-10-14 14:13:46 UTC (rev 3598)
@@ -66,7 +66,7 @@
     * ClassloaderResource for loading the Class.
     */
    @Override
-   public InputStream getStream()
+   public InputStream openStream()
    {
       /*
        * https://jira.jboss.org/jira/browse/TMPARCH-19
@@ -77,7 +77,7 @@
       if(classLoader == null) {
          classLoader = Thread.currentThread().getContextClassLoader();
       }
-      return new ClassLoaderAsset(getResourceNameOfClass(clazz), classLoader).getStream();
+      return new ClassLoaderAsset(getResourceNameOfClass(clazz), classLoader).openStream();
    }
 
    /**

Modified: shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/asset/ClassLoaderAsset.java
===================================================================
--- shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/asset/ClassLoaderAsset.java	2009-10-14 14:11:41 UTC (rev 3597)
+++ shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/asset/ClassLoaderAsset.java	2009-10-14 14:13:46 UTC (rev 3598)
@@ -72,7 +72,7 @@
     * 
     */
    @Override
-   public InputStream getStream()
+   public InputStream openStream()
    {
       return classLoader.getResourceAsStream(resourceName);
    }

Modified: shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/asset/FileAsset.java
===================================================================
--- shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/asset/FileAsset.java	2009-10-14 14:11:41 UTC (rev 3597)
+++ shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/asset/FileAsset.java	2009-10-14 14:13:46 UTC (rev 3598)
@@ -62,7 +62,7 @@
     * @throws RuntimeException If the file is not found.
     */
    @Override
-   public InputStream getStream()
+   public InputStream openStream()
    {
       try
       {

Modified: shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/asset/UrlAsset.java
===================================================================
--- shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/asset/UrlAsset.java	2009-10-14 14:11:41 UTC (rev 3597)
+++ shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/asset/UrlAsset.java	2009-10-14 14:13:46 UTC (rev 3598)
@@ -55,7 +55,7 @@
     * @return A open stream with the content of the URL
     */
    @Override
-   public InputStream getStream()
+   public InputStream openStream()
    {
       try
       {

Modified: shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/export/ExplodedExporterDelegate.java
===================================================================
--- shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/export/ExplodedExporterDelegate.java	2009-10-14 14:11:41 UTC (rev 3597)
+++ shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/export/ExplodedExporterDelegate.java	2009-10-14 14:13:46 UTC (rev 3598)
@@ -113,7 +113,7 @@
             log.fine("Writing asset " + path.get() + " to " + assetFile.getAbsolutePath());
          }
          // Get the asset streams
-         final InputStream assetInputStream = asset.getStream();
+         final InputStream assetInputStream = asset.openStream();
          final FileOutputStream assetFileOutputStream = new FileOutputStream(assetFile);
 
          // Write contents

Modified: shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/export/ZipExportDelegate.java
===================================================================
--- shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/export/ZipExportDelegate.java	2009-10-14 14:11:41 UTC (rev 3597)
+++ shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/export/ZipExportDelegate.java	2009-10-14 14:13:46 UTC (rev 3598)
@@ -116,7 +116,7 @@
       final ZipEntry entry = new ZipEntry(pathName);
 
       // Get Asset InputStream
-      final InputStream assetStream = asset.getStream();
+      final InputStream assetStream = asset.openStream();
 
       IOUtil.closeOnComplete(assetStream, new StreamTask<InputStream>()
       {

Modified: shrinkwrap/trunk/impl-base/src/test/java/org/jboss/shrinkwrap/impl/base/asset/ByteArrayAssetTestCase.java
===================================================================
--- shrinkwrap/trunk/impl-base/src/test/java/org/jboss/shrinkwrap/impl/base/asset/ByteArrayAssetTestCase.java	2009-10-14 14:11:41 UTC (rev 3597)
+++ shrinkwrap/trunk/impl-base/src/test/java/org/jboss/shrinkwrap/impl/base/asset/ByteArrayAssetTestCase.java	2009-10-14 14:13:46 UTC (rev 3598)
@@ -80,7 +80,7 @@
       log.info("Contents after change: " + Arrays.toString(contents));
 
       // Get the contents back out of the asset
-      final InputStream stream = asset.getStream();
+      final InputStream stream = asset.openStream();
       final ByteArrayOutputStream out = new ByteArrayOutputStream(length);
       int read;
       while ((read = stream.read()) != -1)

Modified: shrinkwrap/trunk/impl-base/src/test/java/org/jboss/shrinkwrap/impl/base/asset/ClassAssetTestCase.java
===================================================================
--- shrinkwrap/trunk/impl-base/src/test/java/org/jboss/shrinkwrap/impl/base/asset/ClassAssetTestCase.java	2009-10-14 14:11:41 UTC (rev 3597)
+++ shrinkwrap/trunk/impl-base/src/test/java/org/jboss/shrinkwrap/impl/base/asset/ClassAssetTestCase.java	2009-10-14 14:13:46 UTC (rev 3598)
@@ -38,7 +38,7 @@
    {
       Class<?> clazz = ClassAssetTestCase.class;
       Asset asset = new ClassAsset(clazz);
-      InputStream io = asset.getStream();
+      InputStream io = asset.openStream();
 
       Assert.assertNotNull(io);
       Assert.assertEquals(
@@ -60,7 +60,7 @@
    {
       Class<?> bootstrapClass = Class.class;
       Asset asset = new ClassAsset(bootstrapClass);
-      InputStream io = asset.getStream();
+      InputStream io = asset.openStream();
 
       Assert.assertNotNull(io);
       Assert.assertEquals(

Modified: shrinkwrap/trunk/impl-base/src/test/java/org/jboss/shrinkwrap/impl/base/asset/ClassLoaderAssetTestCase.java
===================================================================
--- shrinkwrap/trunk/impl-base/src/test/java/org/jboss/shrinkwrap/impl/base/asset/ClassLoaderAssetTestCase.java	2009-10-14 14:11:41 UTC (rev 3597)
+++ shrinkwrap/trunk/impl-base/src/test/java/org/jboss/shrinkwrap/impl/base/asset/ClassLoaderAssetTestCase.java	2009-10-14 14:13:46 UTC (rev 3598)
@@ -41,7 +41,7 @@
    public void shouldBeAbleToReadResource() throws Exception
    {
       Asset asset = new ClassLoaderAsset(EXISTING_RESOURCE);
-      InputStream io = asset.getStream();
+      InputStream io = asset.openStream();
 
       Assert.assertNotNull(io);
       Assert.assertEquals("Should be able to read the content of the resource", "shrinkwrap=true", TestUtils

Modified: shrinkwrap/trunk/impl-base/src/test/java/org/jboss/shrinkwrap/impl/base/asset/FileAssetTestCase.java
===================================================================
--- shrinkwrap/trunk/impl-base/src/test/java/org/jboss/shrinkwrap/impl/base/asset/FileAssetTestCase.java	2009-10-14 14:11:41 UTC (rev 3597)
+++ shrinkwrap/trunk/impl-base/src/test/java/org/jboss/shrinkwrap/impl/base/asset/FileAssetTestCase.java	2009-10-14 14:13:46 UTC (rev 3598)
@@ -44,7 +44,7 @@
    public void shouldBeAbleToReadFile() throws Exception
    {
       Asset asset = new FileAsset(new File(EXISTING_FILE));
-      InputStream io = asset.getStream();
+      InputStream io = asset.openStream();
 
       Assert.assertNotNull(io);
       Assert.assertEquals("Should be able to read the content of the resource", "shrinkwrap=true", TestUtils

Modified: shrinkwrap/trunk/impl-base/src/test/java/org/jboss/shrinkwrap/impl/base/asset/UrlAssetTestCase.java
===================================================================
--- shrinkwrap/trunk/impl-base/src/test/java/org/jboss/shrinkwrap/impl/base/asset/UrlAssetTestCase.java	2009-10-14 14:11:41 UTC (rev 3597)
+++ shrinkwrap/trunk/impl-base/src/test/java/org/jboss/shrinkwrap/impl/base/asset/UrlAssetTestCase.java	2009-10-14 14:13:46 UTC (rev 3598)
@@ -40,7 +40,7 @@
    {
       Asset asset = new UrlAsset(Thread.currentThread().getContextClassLoader().getResource(EXISTING_RESOURCE));
 
-      InputStream io = asset.getStream();
+      InputStream io = asset.openStream();
 
       Assert.assertNotNull(io);
       Assert.assertEquals("Should be able to read the content of the resource", "shrinkwrap=true", TestUtils

Modified: shrinkwrap/trunk/impl-base/src/test/java/org/jboss/shrinkwrap/impl/base/export/ExplodedExporterTestCase.java
===================================================================
--- shrinkwrap/trunk/impl-base/src/test/java/org/jboss/shrinkwrap/impl/base/export/ExplodedExporterTestCase.java	2009-10-14 14:11:41 UTC (rev 3597)
+++ shrinkwrap/trunk/impl-base/src/test/java/org/jboss/shrinkwrap/impl/base/export/ExplodedExporterTestCase.java	2009-10-14 14:13:46 UTC (rev 3598)
@@ -263,7 +263,7 @@
          {
 
             @Override
-            public InputStream getStream()
+            public InputStream openStream()
             {
                throw new RuntimeException("Mock Esception getting Stream");
             }
@@ -309,7 +309,7 @@
       File assetFile = new File(explodedDirectory, path.get());
       Assert.assertNotNull(assetFile);
       Assert.assertTrue(assetFile.exists());
-      byte[] expectedContents = IOUtil.asByteArray(asset.getStream());
+      byte[] expectedContents = IOUtil.asByteArray(asset.openStream());
 
       InputStream inputStream = new FileInputStream(assetFile);
 

Modified: shrinkwrap/trunk/impl-base/src/test/java/org/jboss/shrinkwrap/impl/base/export/ZipExporterTestCase.java
===================================================================
--- shrinkwrap/trunk/impl-base/src/test/java/org/jboss/shrinkwrap/impl/base/export/ZipExporterTestCase.java	2009-10-14 14:11:41 UTC (rev 3597)
+++ shrinkwrap/trunk/impl-base/src/test/java/org/jboss/shrinkwrap/impl/base/export/ZipExporterTestCase.java	2009-10-14 14:13:46 UTC (rev 3598)
@@ -179,7 +179,7 @@
          {
 
             @Override
-            public InputStream getStream()
+            public InputStream openStream()
             {
                throw new RuntimeException("Mock Exception from an Asset write");
             }
@@ -227,7 +227,7 @@
       String entryPath = ZipExporterUtil.toZipEntryPath(path);
       ZipEntry entry = expectedZip.getEntry(entryPath);
       Assert.assertNotNull(entry);
-      byte[] expectedContents = IOUtil.asByteArray(asset.getStream());
+      byte[] expectedContents = IOUtil.asByteArray(asset.openStream());
       byte[] actualContents = IOUtil.asByteArray(expectedZip.getInputStream(entry));
       Assert.assertArrayEquals(expectedContents, actualContents);
    }

Modified: shrinkwrap/trunk/impl-base/src/test/java/org/jboss/shrinkwrap/impl/base/test/ArchiveTestBase.java
===================================================================
--- shrinkwrap/trunk/impl-base/src/test/java/org/jboss/shrinkwrap/impl/base/test/ArchiveTestBase.java	2009-10-14 14:11:41 UTC (rev 3597)
+++ shrinkwrap/trunk/impl-base/src/test/java/org/jboss/shrinkwrap/impl/base/test/ArchiveTestBase.java	2009-10-14 14:13:46 UTC (rev 3598)
@@ -667,8 +667,8 @@
       Validate.notNull(one, "Asset one must be specified");
       Validate.notNull(two, "Asset two must be specified");
 
-      byte[] oneData = IOUtil.asByteArray(one.getStream());
-      byte[] twoData = IOUtil.asByteArray(two.getStream());
+      byte[] oneData = IOUtil.asByteArray(one.openStream());
+      byte[] twoData = IOUtil.asByteArray(two.openStream());
 
       return Arrays.equals(oneData, twoData);
    }



More information about the jboss-svn-commits mailing list