Index: api/src/main/java/org/jboss/shrinkwrap/api/Archive.java
===================================================================
--- api/src/main/java/org/jboss/shrinkwrap/api/Archive.java (revision 3971)
+++ api/src/main/java/org/jboss/shrinkwrap/api/Archive.java (working copy)
@@ -76,8 +76,44 @@
* @throws IllegalArgumentException If either the target or asset is not specified
*/
T add(Asset asset, String target) throws IllegalArgumentException;
+
+ /**
+ * Adds the specified directory.
+ *
+ * @param path The path to add
+ * @return This archive
+ * @throws IllegalArgumentException If no path was specified
+ */
+ T addDirectory(String path) throws IllegalArgumentException;
/**
+ * Adds the specified directory.
+ *
+ * @param paths The paths to add
+ * @return This archive
+ * @throws IllegalArgumentException If no paths were specified
+ */
+ T addDirectories(String... paths) throws IllegalArgumentException;
+
+ /**
+ * Adds the specified directory.
+ *
+ * @param path The path to add
+ * @return This archive
+ * @throws IllegalArgumentException If no path was specified
+ */
+ T addDirectory(ArchivePath path) throws IllegalArgumentException;
+
+ /**
+ * Adds the specified directory.
+ *
+ * @param paths The paths to add
+ * @return This archive
+ * @throws IllegalArgumentException If no paths were specified
+ */
+ T addDirectories(ArchivePath... paths) throws IllegalArgumentException;
+
+ /**
* Obtains the asset located at the specified path
*
* @param path
Index: api/src/main/java/org/jboss/shrinkwrap/api/container/DirectoryContainer.java
===================================================================
--- api/src/main/java/org/jboss/shrinkwrap/api/container/DirectoryContainer.java (revision 3971)
+++ api/src/main/java/org/jboss/shrinkwrap/api/container/DirectoryContainer.java (working copy)
@@ -1,71 +0,0 @@
-/*
- * 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.shrinkwrap.api.container;
-
-import org.jboss.shrinkwrap.api.Archive;
-import org.jboss.shrinkwrap.api.ArchivePath;
-
-/**
- * Defines the contract for a component capable of storing
- * empty directories.
- *
- * @author Aslak Knutsen
- * @version $Revision: $
- */
-public interface DirectoryContainer>
-{
- //-------------------------------------------------------------------------------------||
- // Contracts --------------------------------------------------------------------------||
- //-------------------------------------------------------------------------------------||
-
- /**
- * Adds the specified directory to the {@link Archive}.
- *
- * @param path The path to add
- * @return This archive
- * @throws IllegalArgumentException If no path was specified
- */
- T addDirectory(String path) throws IllegalArgumentException;
-
- /**
- * Adds the specified directory to the {@link Archive}.
- *
- * @param paths The paths to add
- * @return This archive
- * @throws IllegalArgumentException If no paths were specified
- */
- T addDirectories(String... paths) throws IllegalArgumentException;
-
- /**
- * Adds the specified directory to the {@link Archive}.
- *
- * @param path The path to add
- * @return This archive
- * @throws IllegalArgumentException If no path was specified
- */
- T addDirectory(ArchivePath path) throws IllegalArgumentException;
-
- /**
- * Adds the specified directory to the {@link Archive}.
- *
- * @param paths The paths to add
- * @return This archive
- * @throws IllegalArgumentException If no paths were specified
- */
- T addDirectories(ArchivePath... paths) throws IllegalArgumentException;
-
-}
Index: api/src/main/java/org/jboss/shrinkwrap/api/spec/EnterpriseArchive.java
===================================================================
--- api/src/main/java/org/jboss/shrinkwrap/api/spec/EnterpriseArchive.java (revision 3971)
+++ api/src/main/java/org/jboss/shrinkwrap/api/spec/EnterpriseArchive.java (working copy)
@@ -17,7 +17,6 @@
package org.jboss.shrinkwrap.api.spec;
import org.jboss.shrinkwrap.api.Archive;
-import org.jboss.shrinkwrap.api.container.DirectoryContainer;
import org.jboss.shrinkwrap.api.container.EnterpriseContainer;
import org.jboss.shrinkwrap.api.container.LibraryContainer;
import org.jboss.shrinkwrap.api.container.ManifestContainer;
@@ -39,8 +38,7 @@
ResourceContainer,
ManifestContainer,
LibraryContainer,
- EnterpriseContainer,
- DirectoryContainer
+ EnterpriseContainer
{
}
Index: api/src/main/java/org/jboss/shrinkwrap/api/spec/JavaArchive.java
===================================================================
--- api/src/main/java/org/jboss/shrinkwrap/api/spec/JavaArchive.java (revision 3971)
+++ api/src/main/java/org/jboss/shrinkwrap/api/spec/JavaArchive.java (working copy)
@@ -18,7 +18,6 @@
import org.jboss.shrinkwrap.api.Archive;
import org.jboss.shrinkwrap.api.container.ClassContainer;
-import org.jboss.shrinkwrap.api.container.DirectoryContainer;
import org.jboss.shrinkwrap.api.container.ManifestContainer;
import org.jboss.shrinkwrap.api.container.ResourceContainer;
@@ -38,7 +37,6 @@
Archive,
ResourceContainer,
ManifestContainer,
- ClassContainer,
- DirectoryContainer
+ ClassContainer
{
}
Index: api/src/main/java/org/jboss/shrinkwrap/api/spec/ResourceAdapterArchive.java
===================================================================
--- api/src/main/java/org/jboss/shrinkwrap/api/spec/ResourceAdapterArchive.java (revision 3971)
+++ api/src/main/java/org/jboss/shrinkwrap/api/spec/ResourceAdapterArchive.java (working copy)
@@ -17,7 +17,6 @@
package org.jboss.shrinkwrap.api.spec;
import org.jboss.shrinkwrap.api.Archive;
-import org.jboss.shrinkwrap.api.container.DirectoryContainer;
import org.jboss.shrinkwrap.api.container.LibraryContainer;
import org.jboss.shrinkwrap.api.container.ManifestContainer;
import org.jboss.shrinkwrap.api.container.ResourceAdapterContainer;
@@ -38,7 +37,6 @@
ManifestContainer,
LibraryContainer,
ResourceContainer,
- ResourceAdapterContainer,
- DirectoryContainer
+ ResourceAdapterContainer
{
}
Index: api/src/main/java/org/jboss/shrinkwrap/api/spec/WebArchive.java
===================================================================
--- api/src/main/java/org/jboss/shrinkwrap/api/spec/WebArchive.java (revision 3971)
+++ api/src/main/java/org/jboss/shrinkwrap/api/spec/WebArchive.java (working copy)
@@ -18,7 +18,6 @@
import org.jboss.shrinkwrap.api.Archive;
import org.jboss.shrinkwrap.api.container.ClassContainer;
-import org.jboss.shrinkwrap.api.container.DirectoryContainer;
import org.jboss.shrinkwrap.api.container.LibraryContainer;
import org.jboss.shrinkwrap.api.container.ManifestContainer;
import org.jboss.shrinkwrap.api.container.ResourceContainer;
@@ -41,7 +40,6 @@
ClassContainer,
LibraryContainer,
ResourceContainer,
- WebContainer,
- DirectoryContainer
+ WebContainer
{
}
Index: impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/ArchiveBase.java
===================================================================
--- impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/ArchiveBase.java (revision 3971)
+++ impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/ArchiveBase.java (working copy)
@@ -16,12 +16,15 @@
*/
package org.jboss.shrinkwrap.impl.base;
+import java.util.ArrayList;
+import java.util.Collection;
import java.util.Map;
import java.util.Map.Entry;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.ArchivePaths;
import org.jboss.shrinkwrap.api.Asset;
import org.jboss.shrinkwrap.api.Assignable;
import org.jboss.shrinkwrap.api.ExtensionLoader;
@@ -31,6 +34,7 @@
import org.jboss.shrinkwrap.api.formatter.Formatter;
import org.jboss.shrinkwrap.api.formatter.Formatters;
import org.jboss.shrinkwrap.impl.base.asset.ArchiveAsset;
+import org.jboss.shrinkwrap.impl.base.asset.DirectoryAsset;
import org.jboss.shrinkwrap.impl.base.path.BasicPath;
/**
@@ -174,9 +178,78 @@
// Delegate
return add(archiveAsset, contentPath);
}
+
+ /**
+ * {@inheritDoc}
+ * @see org.jboss.shrinkwrap.api.Archive#addDirectory(org.jboss.shrinkwrap.api.ArchivePath)
+ */
+ @Override
+ public T addDirectory(final ArchivePath path) throws IllegalArgumentException
+ {
+ // Precondition check
+ Validate.notNull(path, "path must be specified");
+
+ // Delegate and return
+ return this.addDirectories(path);
+ }
/**
* {@inheritDoc}
+ * @see org.jboss.shrinkwrap.api.Archive#addDirectory(java.lang.String)
+ */
+ @Override
+ public T addDirectory(final String path) throws IllegalArgumentException
+ {
+ // Precondition check
+ Validate.notNullOrEmpty(path, "path must be specified");
+
+ // Delegate and return
+ return this.addDirectory(ArchivePaths.create(path));
+ }
+
+ /**
+ * {@inheritDoc}
+ * @see org.jboss.shrinkwrap.api.Archive#addDirectories(org.jboss.shrinkwrap.api.ArchivePath[])
+ */
+ @Override
+ public T addDirectories(final ArchivePath... paths) throws IllegalArgumentException
+ {
+ // Precondition check
+ Validate.notNull(paths, "paths must be specified");
+
+ // Add
+ for (final ArchivePath path : paths)
+ {
+ this.add(DirectoryAsset.INSTANCE, path);
+ }
+
+ // Return
+ return covariantReturn();
+ }
+
+ /**
+ * {@inheritDoc}
+ * @see org.jboss.shrinkwrap.api.Archive#addDirectories(java.lang.String[])
+ */
+ @Override
+ public T addDirectories(final String... paths) throws IllegalArgumentException
+ {
+ // Precondition check
+ Validate.notNull(paths, "paths must be specified");
+
+ // Represent as array of Paths
+ final Collection pathsCollection = new ArrayList(paths.length);
+ for (final String path : paths)
+ {
+ pathsCollection.add(ArchivePaths.create(path));
+ }
+
+ // Delegate and return
+ return this.addDirectories(pathsCollection.toArray(new ArchivePath[]{}));
+ }
+
+ /**
+ * {@inheritDoc}
* @see org.jboss.shrinkwrap.api.Archive#getName()
*/
public final String getName()
Index: impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/container/ContainerBase.java
===================================================================
--- impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/container/ContainerBase.java (revision 3971)
+++ impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/container/ContainerBase.java (working copy)
@@ -20,19 +20,15 @@
import java.net.URL;
import java.security.AccessController;
import java.security.PrivilegedAction;
-import java.util.ArrayList;
-import java.util.Collection;
import java.util.Map;
import java.util.Set;
import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.ArchivePath;
import org.jboss.shrinkwrap.api.Asset;
import org.jboss.shrinkwrap.api.Filter;
import org.jboss.shrinkwrap.api.Filters;
-import org.jboss.shrinkwrap.api.ArchivePath;
-import org.jboss.shrinkwrap.api.ArchivePaths;
import org.jboss.shrinkwrap.api.container.ClassContainer;
-import org.jboss.shrinkwrap.api.container.DirectoryContainer;
import org.jboss.shrinkwrap.api.container.LibraryContainer;
import org.jboss.shrinkwrap.api.container.ManifestContainer;
import org.jboss.shrinkwrap.api.container.ResourceContainer;
@@ -43,7 +39,6 @@
import org.jboss.shrinkwrap.impl.base.asset.AssetUtil;
import org.jboss.shrinkwrap.impl.base.asset.ClassAsset;
import org.jboss.shrinkwrap.impl.base.asset.ClassLoaderAsset;
-import org.jboss.shrinkwrap.impl.base.asset.DirectoryAsset;
import org.jboss.shrinkwrap.impl.base.asset.FileAsset;
import org.jboss.shrinkwrap.impl.base.asset.ServiceProviderAsset;
import org.jboss.shrinkwrap.impl.base.asset.UrlAsset;
@@ -60,7 +55,7 @@
* @param
*/
public abstract class ContainerBase> extends AssignableBase implements
- Archive, ManifestContainer, ResourceContainer, ClassContainer, LibraryContainer, DirectoryContainer
+ Archive, ManifestContainer, ResourceContainer, ClassContainer, LibraryContainer
{
//-------------------------------------------------------------------------------------||
// Class Members ----------------------------------------------------------------------||
@@ -144,6 +139,46 @@
}
/* (non-Javadoc)
+ * @see org.jboss.shrinkwrap.api.Archive#addDirectories(org.jboss.shrinkwrap.api.ArchivePath[])
+ */
+ @Override
+ public T addDirectories(ArchivePath... paths) throws IllegalArgumentException
+ {
+ archive.addDirectories(paths);
+ return covarientReturn();
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.shrinkwrap.api.Archive#addDirectories(java.lang.String[])
+ */
+ @Override
+ public T addDirectories(String... paths) throws IllegalArgumentException
+ {
+ archive.addDirectories(paths);
+ return covarientReturn();
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.shrinkwrap.api.Archive#addDirectory(org.jboss.shrinkwrap.api.ArchivePath)
+ */
+ @Override
+ public T addDirectory(ArchivePath path) throws IllegalArgumentException
+ {
+ archive.addDirectory(path);
+ return covarientReturn();
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.shrinkwrap.api.Archive#addDirectory(java.lang.String)
+ */
+ @Override
+ public T addDirectory(String path) throws IllegalArgumentException
+ {
+ archive.addDirectory(path);
+ return covarientReturn();
+ }
+
+ /* (non-Javadoc)
* @see org.jboss.shrinkwrap.api.Archive#merge(org.jboss.shrinkwrap.api.Archive)
*/
@Override
@@ -942,79 +977,6 @@
}
//-------------------------------------------------------------------------------------||
- // Required Implementations - DirectoryContainer --------------------------------------||
- //-------------------------------------------------------------------------------------||
-
- /**
- * {@inheritDoc}
- * @see org.jboss.shrinkwrap.api.container.DirectoryContainer#addDirectory(org.jboss.shrinkwrap.api.ArchivePath)
- */
- @Override
- public T addDirectory(final ArchivePath path) throws IllegalArgumentException
- {
- // Precondition check
- Validate.notNull(path, "path must be specified");
-
- // Delegate and return
- return this.addDirectories(path);
- }
-
- /**
- * {@inheritDoc}
- * @see org.jboss.shrinkwrap.api.container.DirectoryContainer#addDirectory(java.lang.String)
- */
- @Override
- public T addDirectory(final String path) throws IllegalArgumentException
- {
- // Precondition check
- Validate.notNullOrEmpty(path, "path must be specified");
-
- // Delegate and return
- return this.addDirectory(ArchivePaths.create(path));
- }
-
- /**
- * {@inheritDoc}
- * @see org.jboss.shrinkwrap.api.container.DirectoryContainer#addDirectories(org.jboss.shrinkwrap.api.ArchivePath[])
- */
- @Override
- public T addDirectories(final ArchivePath... paths) throws IllegalArgumentException
- {
- // Precondition check
- Validate.notNull(paths, "paths must be specified");
-
- // Add
- for (final ArchivePath path : paths)
- {
- this.add(DirectoryAsset.INSTANCE, path);
- }
-
- // Return
- return covarientReturn();
- }
-
- /**
- * {@inheritDoc}
- * @see org.jboss.shrinkwrap.api.container.DirectoryContainer#addDirectories(java.lang.String[])
- */
- @Override
- public T addDirectories(final String... paths) throws IllegalArgumentException
- {
- // Precondition check
- Validate.notNull(paths, "paths must be specified");
-
- // Represent as array of Paths
- final Collection pathsCollection = new ArrayList(paths.length);
- for (final String path : paths)
- {
- pathsCollection.add(ArchivePaths.create(path));
- }
-
- // Delegate and return
- return this.addDirectories(pathsCollection.toArray(new ArchivePath[]{}));
- }
-
- //-------------------------------------------------------------------------------------||
// Internal Helper Methods ------------------------------------------------------------||
//-------------------------------------------------------------------------------------||
Index: impl-base/src/test/java/org/jboss/shrinkwrap/impl/base/spec/EnterpriseArchiveImplTestCase.java
===================================================================
--- impl-base/src/test/java/org/jboss/shrinkwrap/impl/base/spec/EnterpriseArchiveImplTestCase.java (revision 3971)
+++ impl-base/src/test/java/org/jboss/shrinkwrap/impl/base/spec/EnterpriseArchiveImplTestCase.java (working copy)
@@ -18,10 +18,9 @@
import java.util.UUID;
-import org.jboss.shrinkwrap.api.Archives;
import org.jboss.shrinkwrap.api.ArchivePath;
+import org.jboss.shrinkwrap.api.Archives;
import org.jboss.shrinkwrap.api.container.ClassContainer;
-import org.jboss.shrinkwrap.api.container.DirectoryContainer;
import org.jboss.shrinkwrap.api.container.EnterpriseContainer;
import org.jboss.shrinkwrap.api.container.LibraryContainer;
import org.jboss.shrinkwrap.api.container.ManifestContainer;
@@ -121,17 +120,7 @@
return archive;
}
- /**
- * {@inheritDoc}
- * @see org.jboss.shrinkwrap.impl.base.test.DynamicContainerTestBase#getDirectoryContainer()
- */
@Override
- protected DirectoryContainer getDirectoryContainer()
- {
- return archive;
- }
-
- @Override
protected ArchivePath getManifestPath()
{
return PATH_APPLICATION;
Index: impl-base/src/test/java/org/jboss/shrinkwrap/impl/base/spec/JavaArchiveImplTestCase.java
===================================================================
--- impl-base/src/test/java/org/jboss/shrinkwrap/impl/base/spec/JavaArchiveImplTestCase.java (revision 3971)
+++ impl-base/src/test/java/org/jboss/shrinkwrap/impl/base/spec/JavaArchiveImplTestCase.java (working copy)
@@ -18,10 +18,9 @@
import java.util.UUID;
-import org.jboss.shrinkwrap.api.Archives;
import org.jboss.shrinkwrap.api.ArchivePath;
+import org.jboss.shrinkwrap.api.Archives;
import org.jboss.shrinkwrap.api.container.ClassContainer;
-import org.jboss.shrinkwrap.api.container.DirectoryContainer;
import org.jboss.shrinkwrap.api.container.LibraryContainer;
import org.jboss.shrinkwrap.api.container.ManifestContainer;
import org.jboss.shrinkwrap.api.container.ResourceContainer;
@@ -123,17 +122,7 @@
throw new UnsupportedOperationException("JavaArchive does not support libraries");
}
- /**
- * {@inheritDoc}
- * @see org.jboss.shrinkwrap.impl.base.test.DynamicContainerTestBase#getDirectoryContainer()
- */
@Override
- protected DirectoryContainer getDirectoryContainer()
- {
- return archive;
- }
-
- @Override
protected ArchivePath getManifestPath()
{
return PATH_MANIFEST;
Index: impl-base/src/test/java/org/jboss/shrinkwrap/impl/base/spec/ResourceAdapterArchiveImplTestCase.java
===================================================================
--- impl-base/src/test/java/org/jboss/shrinkwrap/impl/base/spec/ResourceAdapterArchiveImplTestCase.java (revision 3971)
+++ impl-base/src/test/java/org/jboss/shrinkwrap/impl/base/spec/ResourceAdapterArchiveImplTestCase.java (working copy)
@@ -18,10 +18,9 @@
import java.util.UUID;
-import org.jboss.shrinkwrap.api.Archives;
import org.jboss.shrinkwrap.api.ArchivePath;
+import org.jboss.shrinkwrap.api.Archives;
import org.jboss.shrinkwrap.api.container.ClassContainer;
-import org.jboss.shrinkwrap.api.container.DirectoryContainer;
import org.jboss.shrinkwrap.api.container.LibraryContainer;
import org.jboss.shrinkwrap.api.container.ManifestContainer;
import org.jboss.shrinkwrap.api.container.ResourceAdapterContainer;
@@ -121,16 +120,6 @@
{
return archive;
}
-
- /**
- * {@inheritDoc}
- * @see org.jboss.shrinkwrap.impl.base.test.DynamicContainerTestBase#getDirectoryContainer()
- */
- @Override
- protected DirectoryContainer getDirectoryContainer()
- {
- return archive;
- }
@Override
protected ArchivePath getManifestPath()
Index: impl-base/src/test/java/org/jboss/shrinkwrap/impl/base/spec/WebArchiveImplTestCase.java
===================================================================
--- impl-base/src/test/java/org/jboss/shrinkwrap/impl/base/spec/WebArchiveImplTestCase.java (revision 3971)
+++ impl-base/src/test/java/org/jboss/shrinkwrap/impl/base/spec/WebArchiveImplTestCase.java (working copy)
@@ -18,10 +18,9 @@
import java.util.UUID;
-import org.jboss.shrinkwrap.api.Archives;
import org.jboss.shrinkwrap.api.ArchivePath;
+import org.jboss.shrinkwrap.api.Archives;
import org.jboss.shrinkwrap.api.container.ClassContainer;
-import org.jboss.shrinkwrap.api.container.DirectoryContainer;
import org.jboss.shrinkwrap.api.container.LibraryContainer;
import org.jboss.shrinkwrap.api.container.ManifestContainer;
import org.jboss.shrinkwrap.api.container.ResourceContainer;
@@ -128,16 +127,6 @@
{
return archive;
}
-
- /**
- * {@inheritDoc}
- * @see org.jboss.shrinkwrap.impl.base.test.DynamicContainerTestBase#getDirectoryContainer()
- */
- @Override
- protected DirectoryContainer getDirectoryContainer()
- {
- return archive;
- }
@Override
protected ArchivePath getManifestPath()
Index: impl-base/src/test/java/org/jboss/shrinkwrap/impl/base/test/ArchiveTestBase.java
===================================================================
--- impl-base/src/test/java/org/jboss/shrinkwrap/impl/base/test/ArchiveTestBase.java (revision 3971)
+++ impl-base/src/test/java/org/jboss/shrinkwrap/impl/base/test/ArchiveTestBase.java (working copy)
@@ -20,8 +20,10 @@
import java.util.Map;
import junit.framework.Assert;
+import junit.framework.TestCase;
import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.ArchivePaths;
import org.jboss.shrinkwrap.api.Archives;
import org.jboss.shrinkwrap.api.Asset;
import org.jboss.shrinkwrap.api.Filters;
@@ -284,6 +286,30 @@
}
/**
+ * Tests that empty directories may be added to the archive
+ * @throws Exception
+ */
+ @Test
+ public void testAddEmptyDirectories() throws Exception
+ {
+ Archive archive = getArchive();
+
+ // Get Paths to add
+ final ArchivePath path1 = ArchivePaths.create("path/to/dir");
+ final ArchivePath path2 = ArchivePaths.create("path/to/dir2");
+ final ArchivePath path3 = ArchivePaths.create("path/to");
+
+ // Add
+ archive.addDirectories(path1, path2, path3);
+
+ // Test
+ final String message = "Should be able to add directory: ";
+ TestCase.assertTrue(message + path1, archive.contains(path1));
+ TestCase.assertTrue(message + path2, archive.contains(path2));
+ TestCase.assertTrue(message + path3, archive.contains(path3));
+ }
+
+ /**
* Ensure deleting an asset successfully removes asset from storage
* @throws Exception
*/
Index: impl-base/src/test/java/org/jboss/shrinkwrap/impl/base/test/DynamicContainerTestBase.java
===================================================================
--- impl-base/src/test/java/org/jboss/shrinkwrap/impl/base/test/DynamicContainerTestBase.java (revision 3971)
+++ impl-base/src/test/java/org/jboss/shrinkwrap/impl/base/test/DynamicContainerTestBase.java (working copy)
@@ -18,18 +18,14 @@
import java.io.File;
import java.net.URL;
-import java.util.logging.Logger;
import junit.framework.Assert;
-import junit.framework.TestCase;
import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.ArchivePath;
import org.jboss.shrinkwrap.api.Asset;
import org.jboss.shrinkwrap.api.Filter;
-import org.jboss.shrinkwrap.api.ArchivePath;
-import org.jboss.shrinkwrap.api.ArchivePaths;
import org.jboss.shrinkwrap.api.container.ClassContainer;
-import org.jboss.shrinkwrap.api.container.DirectoryContainer;
import org.jboss.shrinkwrap.api.container.LibraryContainer;
import org.jboss.shrinkwrap.api.container.ManifestContainer;
import org.jboss.shrinkwrap.api.container.ResourceContainer;
@@ -38,8 +34,8 @@
import org.jboss.shrinkwrap.impl.base.path.BasicPath;
import org.jboss.shrinkwrap.impl.base.spec.donotchange.DummyClassA;
import org.jboss.shrinkwrap.impl.base.spec.donotchange.DummyClassParent;
-import org.jboss.shrinkwrap.impl.base.test.dummy.DummyInterfaceForTest;
import org.jboss.shrinkwrap.impl.base.test.dummy.DummyClassForTest;
+import org.jboss.shrinkwrap.impl.base.test.dummy.DummyInterfaceForTest;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -58,11 +54,6 @@
// Class Members ----------------------------------------------------------------------||
//-------------------------------------------------------------------------------------||
- /**
- * Logger
- */
- private static final Logger log = Logger.getLogger(DynamicContainerTestBase.class.getName());
-
//-------------------------------------------------------------------------------------||
// Contracts ----------------------------------------------------------------------||
//-------------------------------------------------------------------------------------||
@@ -75,7 +66,6 @@
protected abstract ManifestContainer getManifestContainer();
protected abstract ArchivePath getLibraryPath();
protected abstract LibraryContainer getLibraryContainer();
- protected abstract DirectoryContainer getDirectoryContainer();
protected URL getURLForClassResource(String name) {
return SecurityActions.getThreadContextClassLoader().getResource(name);
@@ -759,37 +749,4 @@
getArchive().contains(testPath2));
}
- /**
- * Tests that empty directories may be added to the archive
- * @throws Exception
- */
- @Test
- @ArchiveType(DirectoryContainer.class)
- public void testAddEmptyDirectories() throws Exception
- {
-
- // Get the container
- final DirectoryContainer container = getDirectoryContainer();
-
- // Get Paths to add
- final ArchivePath path1 = ArchivePaths.create("path/to/dir");
- final ArchivePath path2 = ArchivePaths.create("path/to/dir2");
- final ArchivePath path3 = ArchivePaths.create("path/to");
-
- // Add
- container.addDirectories(path1, path2, path3);
-
- // Obtain as archive view
- final Archive archive = this.getArchive();
-
- // Test
- final String message = "Should be able to add directory: ";
- TestCase.assertTrue(message + path1, archive.contains(path1));
- TestCase.assertTrue(message + path2, archive.contains(path2));
- TestCase.assertTrue(message + path3, archive.contains(path3));
-
- // Log out
- log.info("testAddEmptyDirectories:\n" + archive.toString(true));
- }
-
}