[jboss-svn-commits] JBoss Common SVN: r3448 - in declarchive/trunk: impl-base/src/main/java/org/jboss/declarchive/impl/base/resource and 2 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Thu Aug 13 01:59:37 EDT 2009


Author: ALRubinger
Date: 2009-08-13 01:59:36 -0400 (Thu, 13 Aug 2009)
New Revision: 3448

Modified:
   declarchive/trunk/impl-base/src/main/java/org/jboss/declarchive/impl/base/jar/JavaArchiveImpl.java
   declarchive/trunk/impl-base/src/main/java/org/jboss/declarchive/impl/base/resource/ClassResource.java
   declarchive/trunk/impl-base/src/main/java/org/jboss/declarchive/impl/base/resource/ClassloaderResource.java
   declarchive/trunk/impl-base/src/main/java/org/jboss/declarchive/impl/base/resource/FileResource.java
   declarchive/trunk/impl-base/src/main/java/org/jboss/declarchive/impl/base/resource/URLResource.java
   declarchive/trunk/impl-base/src/test/java/org/jboss/declarchive/impl/base/resource/ClassResourceTestCase.java
   declarchive/trunk/impl-base/src/test/java/org/jboss/declarchive/impl/base/resource/ClassloaderResourceTestCase.java
   declarchive/trunk/impl-base/src/test/java/org/jboss/declarchive/impl/base/resource/FileResourceTestCase.java
   declarchive/trunk/impl-base/src/test/java/org/jboss/declarchive/impl/base/resource/TestUtils.java
   declarchive/trunk/impl-base/src/test/java/org/jboss/declarchive/impl/base/resource/URLResourceTestCase.java
   declarchive/trunk/spi/src/main/java/org/jboss/declarchive/spi/Resource.java
Log:
[TPMARCH-5] Add APL header and format using JBoss code template

Modified: declarchive/trunk/impl-base/src/main/java/org/jboss/declarchive/impl/base/jar/JavaArchiveImpl.java
===================================================================
--- declarchive/trunk/impl-base/src/main/java/org/jboss/declarchive/impl/base/jar/JavaArchiveImpl.java	2009-08-13 05:55:30 UTC (rev 3447)
+++ declarchive/trunk/impl-base/src/main/java/org/jboss/declarchive/impl/base/jar/JavaArchiveImpl.java	2009-08-13 05:59:36 UTC (rev 3448)
@@ -1,23 +1,18 @@
 /*
- * JBoss, Home of Professional Open Source.
+ * JBoss, Home of Professional Open Source
  * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
-  *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
  *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ * 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.jar;
 

Modified: declarchive/trunk/impl-base/src/main/java/org/jboss/declarchive/impl/base/resource/ClassResource.java
===================================================================
--- declarchive/trunk/impl-base/src/main/java/org/jboss/declarchive/impl/base/resource/ClassResource.java	2009-08-13 05:55:30 UTC (rev 3447)
+++ declarchive/trunk/impl-base/src/main/java/org/jboss/declarchive/impl/base/resource/ClassResource.java	2009-08-13 05:59:36 UTC (rev 3448)
@@ -1,3 +1,19 @@
+/*
+ * 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.resource;
 
 import java.io.InputStream;
@@ -28,14 +44,14 @@
    private static final String EXTENSION_CLASS = ".class";
 
    private Class<?> clazz;
-   
+
    /**
     * Load any class as a resource.
     * 
     * @param clazz The class to load
     * @throws IllegalArgumentException Class can not be null
     */
-   public ClassResource(Class<?> clazz) 
+   public ClassResource(Class<?> clazz)
    {
       // Precondition check
       if (clazz == null)
@@ -44,7 +60,7 @@
       }
       this.clazz = clazz;
    }
-   
+
    /**
     * Get the default name using Class.getSimpleName().
     */
@@ -53,7 +69,7 @@
    {
       return getResourceNameOfClass(clazz);
    }
-   
+
    /**
     * Converts the Class name into a Resource URL and uses the 
     * ClassloaderResource for loading the Class.
@@ -61,12 +77,8 @@
    @Override
    public InputStream getStream()
    {
-      return new ClassloaderResource(
-            getResourceNameOfClass(clazz), 
-            clazz.getClassLoader()
-         ).getStream();
+      return new ClassloaderResource(getResourceNameOfClass(clazz), clazz.getClassLoader()).getStream();
    }
-   
 
    /**
     * Returns the name of the class such that it may be accessed via ClassLoader.getResource()

Modified: declarchive/trunk/impl-base/src/main/java/org/jboss/declarchive/impl/base/resource/ClassloaderResource.java
===================================================================
--- declarchive/trunk/impl-base/src/main/java/org/jboss/declarchive/impl/base/resource/ClassloaderResource.java	2009-08-13 05:55:30 UTC (rev 3447)
+++ declarchive/trunk/impl-base/src/main/java/org/jboss/declarchive/impl/base/resource/ClassloaderResource.java	2009-08-13 05:59:36 UTC (rev 3448)
@@ -1,3 +1,19 @@
+/*
+ * 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.resource;
 
 import java.io.InputStream;
@@ -14,8 +30,9 @@
 public class ClassloaderResource implements Resource
 {
    private String resourceName;
+
    private ClassLoader classLoader;
-   
+
    /**
     * Load a named resource using the current threads context classloader.
     * 
@@ -23,7 +40,7 @@
     * @throws IllegalArgumentException resourceName can not be null
     * @throws IllegalArgumentException resourceName must be found in given classloader
     */
-   public ClassloaderResource(String resourceName) 
+   public ClassloaderResource(String resourceName)
    {
       this(resourceName, SecurityActions.getThreadContextClassLoader());
    }
@@ -37,24 +54,24 @@
     * @throws IllegalArgumentException classloader can not be null
     * @throws IllegalArgumentException resourceName must be found in given classloader
     */
-   public ClassloaderResource(String resourceName, ClassLoader classLoader) 
+   public ClassloaderResource(String resourceName, ClassLoader classLoader)
    {
-      if(resourceName == null) 
+      if (resourceName == null)
       {
          throw new IllegalArgumentException("ResourceName must be specified");
       }
-      if(classLoader == null) 
+      if (classLoader == null)
       {
          throw new IllegalArgumentException("ClassLoader must be specified");
       }
-      if(classLoader.getResource(resourceName) == null) 
+      if (classLoader.getResource(resourceName) == null)
       {
          throw new IllegalArgumentException(resourceName + " not found in classloader " + classLoader);
       }
       this.resourceName = resourceName;
       this.classLoader = classLoader;
    }
-   
+
    /**
     * Get the default name using Resource URL.getFile().
     * 
@@ -63,8 +80,7 @@
    @Override
    public String getDefaultName()
    {
-      return extractFileName(
-            classLoader.getResource(resourceName));
+      return extractFileName(classLoader.getResource(resourceName));
    }
 
    /**
@@ -76,19 +92,17 @@
    {
       return classLoader.getResourceAsStream(resourceName);
    }
-   
+
    /*
     * Extract the file name part of a URL excluding the directory structure.
     * ie: /user/test/file.properties = file.properties
     */
-   private String extractFileName(URL url) 
+   private String extractFileName(URL url)
    {
       String fileName = url.getFile();
-      if(fileName.indexOf('/') != -1) 
+      if (fileName.indexOf('/') != -1)
       {
-         return fileName.substring(
-               fileName.lastIndexOf('/') +1, 
-               fileName.length()); 
+         return fileName.substring(fileName.lastIndexOf('/') + 1, fileName.length());
       }
       return fileName;
    }

Modified: declarchive/trunk/impl-base/src/main/java/org/jboss/declarchive/impl/base/resource/FileResource.java
===================================================================
--- declarchive/trunk/impl-base/src/main/java/org/jboss/declarchive/impl/base/resource/FileResource.java	2009-08-13 05:55:30 UTC (rev 3447)
+++ declarchive/trunk/impl-base/src/main/java/org/jboss/declarchive/impl/base/resource/FileResource.java	2009-08-13 05:59:36 UTC (rev 3448)
@@ -1,3 +1,19 @@
+/*
+ * 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.resource;
 
 import java.io.File;
@@ -16,7 +32,7 @@
 public class FileResource implements Resource
 {
    private File file;
-   
+
    /**
     * Load the specified File. 
     * 
@@ -24,16 +40,16 @@
     * @throws IllegalArgumentException File can not be null
     * @throws IllegalArgumentException File must exist
     */
-   public FileResource(File file) 
+   public FileResource(File file)
    {
       // Precondition check
       if (file == null)
       {
          throw new IllegalArgumentException("File must be specified");
       }
-      if(!file.exists()) 
+      if (!file.exists())
       {
-         throw new IllegalArgumentException("File must exist");
+         throw new IllegalArgumentException("File must exist: " + file.getAbsolutePath());
       }
       this.file = file;
    }
@@ -46,7 +62,7 @@
    {
       return file.getName();
    }
-   
+
    /**
     * Opens a new FileInputStream for the given File.
     * 
@@ -58,11 +74,11 @@
    @Override
    public InputStream getStream()
    {
-      try 
+      try
       {
          return new FileInputStream(file);
       }
-      catch (FileNotFoundException e)   
+      catch (FileNotFoundException e)
       {
          throw new RuntimeException("Could not open file " + file, e);
       }

Modified: declarchive/trunk/impl-base/src/main/java/org/jboss/declarchive/impl/base/resource/URLResource.java
===================================================================
--- declarchive/trunk/impl-base/src/main/java/org/jboss/declarchive/impl/base/resource/URLResource.java	2009-08-13 05:55:30 UTC (rev 3447)
+++ declarchive/trunk/impl-base/src/main/java/org/jboss/declarchive/impl/base/resource/URLResource.java	2009-08-13 05:59:36 UTC (rev 3448)
@@ -1,3 +1,19 @@
+/*
+ * 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.resource;
 
 import java.io.InputStream;
@@ -14,14 +30,14 @@
 public class URLResource implements Resource
 {
    private URL url;
-   
+
    /**
     * Create a new resource with a URL source.
     * 
     * @param url A valid URL
     * @throws IllegalArgumentException URL can not be null
     */
-   public URLResource(URL url) 
+   public URLResource(URL url)
    {
       // Precondition check
       if (url == null)
@@ -30,7 +46,7 @@
       }
       this.url = url;
    }
-   
+
    /**
     * Get the default name using URL.getFile().
     */
@@ -51,25 +67,23 @@
       try
       {
          return url.openStream();
-      } 
-      catch (Exception e) 
+      }
+      catch (Exception e)
       {
          throw new RuntimeException("Could not open stream for url " + url.toExternalForm(), e);
       }
    }
-   
+
    /*
     * Extract the file name part of a URL excluding the directory structure.
     * ie: /user/test/file.properties = file.properties
     */
-   private String extractFileName(URL url) 
+   private String extractFileName(URL url)
    {
       String fileName = url.getFile();
-      if(fileName.indexOf('/') != -1) 
+      if (fileName.indexOf('/') != -1)
       {
-         return fileName.substring(
-               fileName.lastIndexOf('/') +1, 
-               fileName.length()); 
+         return fileName.substring(fileName.lastIndexOf('/') + 1, fileName.length());
       }
       return fileName;
    }

Modified: declarchive/trunk/impl-base/src/test/java/org/jboss/declarchive/impl/base/resource/ClassResourceTestCase.java
===================================================================
--- declarchive/trunk/impl-base/src/test/java/org/jboss/declarchive/impl/base/resource/ClassResourceTestCase.java	2009-08-13 05:55:30 UTC (rev 3447)
+++ declarchive/trunk/impl-base/src/test/java/org/jboss/declarchive/impl/base/resource/ClassResourceTestCase.java	2009-08-13 05:59:36 UTC (rev 3448)
@@ -1,3 +1,19 @@
+/*
+ * 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.resource;
 
 import java.io.InputStream;
@@ -16,40 +32,37 @@
  */
 public class ClassResourceTestCase
 {
-   
+
    @Test
-   public void shouldBeAbleToReadThisClass() throws Exception 
+   public void shouldBeAbleToReadThisClass() throws Exception
    {
       Resource resource = new ClassResource(ClassResourceTestCase.class);
       InputStream io = resource.getStream();
 
-      Assert.assertNotNull(io);      
+      Assert.assertNotNull(io);
    }
-   
+
    // TODO: add test to byte compare expected result?
-   
+
    @Test
-   public void shouldBeAbleToReadDefaultName() throws Exception 
+   public void shouldBeAbleToReadDefaultName() throws Exception
    {
       Resource resource = new ClassResource(ClassResourceTestCase.class);
-      Assert.assertEquals(
-            "A Class resource should use class name + '.class' as default name",
-            "org/jboss/declarchive/impl/base/resource/ClassResourceTestCase.class", 
-            resource.getDefaultName());
+      Assert.assertEquals("A Class resource should use class name + '.class' as default name",
+            "org/jboss/declarchive/impl/base/resource/ClassResourceTestCase.class", resource.getDefaultName());
    }
 
    @Test
-   public void shouldThrowExceptionOnNullClass() throws Exception 
+   public void shouldThrowExceptionOnNullClass() throws Exception
    {
-      try 
+      try
       {
          new ClassResource(null);
          Assert.fail("Should have thrown IllegalArgumentException");
-      } 
-      catch (Exception e) 
+      }
+      catch (Exception e)
       {
-         Assert.assertEquals(
-               "A null clazz argument should result in a IllegalArgumentException",
+         Assert.assertEquals("A null clazz argument should result in a IllegalArgumentException",
                IllegalArgumentException.class, e.getClass());
       }
    }

Modified: declarchive/trunk/impl-base/src/test/java/org/jboss/declarchive/impl/base/resource/ClassloaderResourceTestCase.java
===================================================================
--- declarchive/trunk/impl-base/src/test/java/org/jboss/declarchive/impl/base/resource/ClassloaderResourceTestCase.java	2009-08-13 05:55:30 UTC (rev 3447)
+++ declarchive/trunk/impl-base/src/test/java/org/jboss/declarchive/impl/base/resource/ClassloaderResourceTestCase.java	2009-08-13 05:59:36 UTC (rev 3448)
@@ -1,3 +1,19 @@
+/*
+ * 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.resource;
 
 import java.io.InputStream;
@@ -18,69 +34,66 @@
 public class ClassloaderResourceTestCase
 {
    private static final String EXISTING_RESOURCE = "org/jboss/declarchive/impl/base/resource/Test.properties";
+
    private static final String NON_EXISTING_RESOURCE = "org/jboss/declarchive/impl/base/resource/NoFileShouldBePlacedHere.properties";
-   
+
    @Test
-   public void shouldBeAbleToReadResource() throws Exception 
+   public void shouldBeAbleToReadResource() throws Exception
    {
       Resource resource = new ClassloaderResource(EXISTING_RESOURCE);
       InputStream io = resource.getStream();
 
       Assert.assertNotNull(io);
-      Assert.assertEquals(
-            "Should be able to read the content of the resource",
-            "declarch=true", TestUtils.convertToString(io));
+      Assert.assertEquals("Should be able to read the content of the resource", "declarch=true", TestUtils
+            .convertToString(io));
    }
 
    @Test
-   public void shouldBeAbleToReadDefaultName() throws Exception 
+   public void shouldBeAbleToReadDefaultName() throws Exception
    {
       Resource resource = new ClassloaderResource(EXISTING_RESOURCE);
-      Assert.assertEquals(
-            "A Classloader resource should use file name as default name, not absolute path", 
+      Assert.assertEquals("A Classloader resource should use file name as default name, not absolute path",
             "Test.properties", resource.getDefaultName());
    }
 
    @Test
-   public void shouldThrowExceptionOnNullName() 
+   public void shouldThrowExceptionOnNullName()
    {
       try
       {
          new ClassloaderResource(null);
          Assert.fail("Should have thrown IllegalArgumentException");
-      } 
+      }
       catch (Exception e)
       {
-         Assert.assertEquals(
-               "A null resourceName argument should result in a IllegalArgumentException", 
+         Assert.assertEquals("A null resourceName argument should result in a IllegalArgumentException",
                IllegalArgumentException.class, e.getClass());
       }
    }
 
    @Test
-   public void shouldThrowExceptionOnNullClassloader() 
+   public void shouldThrowExceptionOnNullClassloader()
    {
       try
       {
          new ClassloaderResource(EXISTING_RESOURCE, null);
          Assert.fail("Should have thrown IllegalArgumentException");
-      } 
+      }
       catch (Exception e)
       {
-         Assert.assertEquals(
-               "A null classLoader argument should result in a IllegalArgumentException",
+         Assert.assertEquals("A null classLoader argument should result in a IllegalArgumentException",
                IllegalArgumentException.class, e.getClass());
       }
    }
 
    @Test
-   public void shouldThrowExceptionOnMissingResource() 
+   public void shouldThrowExceptionOnMissingResource()
    {
       try
       {
          new ClassloaderResource(NON_EXISTING_RESOURCE);
          Assert.fail("Should have thrown IllegalArgumentException");
-      } 
+      }
       catch (Exception e)
       {
          Assert.assertEquals(

Modified: declarchive/trunk/impl-base/src/test/java/org/jboss/declarchive/impl/base/resource/FileResourceTestCase.java
===================================================================
--- declarchive/trunk/impl-base/src/test/java/org/jboss/declarchive/impl/base/resource/FileResourceTestCase.java	2009-08-13 05:55:30 UTC (rev 3447)
+++ declarchive/trunk/impl-base/src/test/java/org/jboss/declarchive/impl/base/resource/FileResourceTestCase.java	2009-08-13 05:59:36 UTC (rev 3448)
@@ -1,3 +1,19 @@
+/*
+ * 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.resource;
 
 import java.io.File;
@@ -19,58 +35,56 @@
 public class FileResourceTestCase
 {
    private static final String BASE_PATH = "src/test/resources/org/jboss/declarchive/impl/base/resource/";
+
    private static final String EXISTING_FILE = BASE_PATH + "Test.properties";
+
    private static final String NON_EXISTING_FILE = BASE_PATH + "NoFileShouldBePlacedHere.properties";
-   
+
    @Test
-   public void shouldBeAbleToReadFile() throws Exception 
+   public void shouldBeAbleToReadFile() throws Exception
    {
       Resource resource = new FileResource(new File(EXISTING_FILE));
       InputStream io = resource.getStream();
-      
+
       Assert.assertNotNull(io);
-      Assert.assertEquals(
-            "Should be able to read the content of the resource",
-            "declarch=true", TestUtils.convertToString(io));
+      Assert.assertEquals("Should be able to read the content of the resource", "declarch=true", TestUtils
+            .convertToString(io));
    }
-   
+
    @Test
-   public void shouldBeAbleToReadDefaultName() throws Exception 
+   public void shouldBeAbleToReadDefaultName() throws Exception
    {
       Resource resource = new FileResource(new File(EXISTING_FILE));
-      Assert.assertEquals(
-            "A File resource should use the file name as default name, not absolute path",
+      Assert.assertEquals("A File resource should use the file name as default name, not absolute path",
             "Test.properties", resource.getDefaultName());
    }
-   
+
    @Test
-   public void shouldThrowExceptionOnNullFile() throws Exception 
+   public void shouldThrowExceptionOnNullFile() throws Exception
    {
-      try 
+      try
       {
          new FileResource(null);
          Assert.fail("Should have thrown IllegalArgumentException");
-      } 
-      catch (Exception e) 
+      }
+      catch (Exception e)
       {
-         Assert.assertEquals(
-               "A null file argument should result in a IllegalArgumentException",
+         Assert.assertEquals("A null file argument should result in a IllegalArgumentException",
                IllegalArgumentException.class, e.getClass());
       }
    }
 
    @Test
-   public void shouldThrowExceptionOnMissingFile() throws Exception 
+   public void shouldThrowExceptionOnMissingFile() throws Exception
    {
-      try 
+      try
       {
          new FileResource(new File(NON_EXISTING_FILE));
          Assert.fail("Should have thrown IllegalArgumentException");
-      } 
-      catch (Exception e) 
+      }
+      catch (Exception e)
       {
-         Assert.assertEquals(
-               "A non existing file should result in a IllegalArgumentException",
+         Assert.assertEquals("A non existing file should result in a IllegalArgumentException",
                IllegalArgumentException.class, e.getClass());
       }
    }

Modified: declarchive/trunk/impl-base/src/test/java/org/jboss/declarchive/impl/base/resource/TestUtils.java
===================================================================
--- declarchive/trunk/impl-base/src/test/java/org/jboss/declarchive/impl/base/resource/TestUtils.java	2009-08-13 05:55:30 UTC (rev 3447)
+++ declarchive/trunk/impl-base/src/test/java/org/jboss/declarchive/impl/base/resource/TestUtils.java	2009-08-13 05:59:36 UTC (rev 3448)
@@ -1,3 +1,19 @@
+/*
+ * 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.resource;
 
 import java.io.ByteArrayOutputStream;
@@ -9,7 +25,9 @@
  */
 class TestUtils
 {
-   private TestUtils() {}
+   private TestUtils()
+   {
+   }
 
    /**
     * Convert a inputstream to a UTF-8 string. 

Modified: declarchive/trunk/impl-base/src/test/java/org/jboss/declarchive/impl/base/resource/URLResourceTestCase.java
===================================================================
--- declarchive/trunk/impl-base/src/test/java/org/jboss/declarchive/impl/base/resource/URLResourceTestCase.java	2009-08-13 05:55:30 UTC (rev 3447)
+++ declarchive/trunk/impl-base/src/test/java/org/jboss/declarchive/impl/base/resource/URLResourceTestCase.java	2009-08-13 05:59:36 UTC (rev 3448)
@@ -1,3 +1,19 @@
+/*
+ * 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.resource;
 
 import java.io.InputStream;
@@ -22,30 +38,24 @@
    @Test
    public void shouldBeAbleToReadURL() throws Exception
    {
-      Resource resource = new URLResource(
-            Thread.currentThread()
-               .getContextClassLoader().getResource(EXISTING_RESOURCE));
+      Resource resource = new URLResource(Thread.currentThread().getContextClassLoader().getResource(EXISTING_RESOURCE));
 
       InputStream io = resource.getStream();
 
       Assert.assertNotNull(io);
-      Assert.assertEquals(
-            "Should be able to read the content of the resource",
-            "declarch=true", TestUtils.convertToString(io));
+      Assert.assertEquals("Should be able to read the content of the resource", "declarch=true", TestUtils
+            .convertToString(io));
    }
 
    @Test
-   public void shouldBeAbleToReadDefaultName() throws Exception 
+   public void shouldBeAbleToReadDefaultName() throws Exception
    {
-      Resource resource = new URLResource(
-            Thread.currentThread().getContextClassLoader()
-            .getResource(EXISTING_RESOURCE));
-      
-      Assert.assertEquals(
-            "A URL resource should use the file name as default name, not absolute path",
+      Resource resource = new URLResource(Thread.currentThread().getContextClassLoader().getResource(EXISTING_RESOURCE));
+
+      Assert.assertEquals("A URL resource should use the file name as default name, not absolute path",
             "Test.properties", resource.getDefaultName());
    }
-   
+
    @Test
    public void shouldThrowExceptionOnNullURL() throws Exception
    {
@@ -53,11 +63,10 @@
       {
          new URLResource(null);
          Assert.fail("Should have thrown IllegalArgumentException");
-      } 
+      }
       catch (Exception e)
       {
-         Assert.assertEquals(
-               "A null url argument should result in a IllegalArgumentException",
+         Assert.assertEquals("A null url argument should result in a IllegalArgumentException",
                IllegalArgumentException.class, e.getClass());
       }
    }

Modified: declarchive/trunk/spi/src/main/java/org/jboss/declarchive/spi/Resource.java
===================================================================
--- declarchive/trunk/spi/src/main/java/org/jboss/declarchive/spi/Resource.java	2009-08-13 05:55:30 UTC (rev 3447)
+++ declarchive/trunk/spi/src/main/java/org/jboss/declarchive/spi/Resource.java	2009-08-13 05:59:36 UTC (rev 3448)
@@ -1,3 +1,19 @@
+/*
+ * 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.spi;
 
 import java.io.InputStream;
@@ -19,7 +35,7 @@
     * @return A name for this Resource
     */
    String getDefaultName();
-   
+
    /**
     * Get a open stream for the resource content.
     * The caller is responsible for closing the stream. 



More information about the jboss-svn-commits mailing list