[jboss-cvs] JBossAS SVN: r57448 - in projects/microcontainer/trunk: container/src/main/org/jboss/virtual/plugins/context/jar deployers/src/main/org/jboss/deployers/plugins/structure/vfs/file deployers/src/main/org/jboss/deployers/plugins/structure/vfs/jar deployers/src/tests/org/jboss/test/deployers/structure/file/test deployers/src/tests/org/jboss/test/deployers/structure/jar/test
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Oct 5 10:53:43 EDT 2006
Author: kabir.khan at jboss.com
Date: 2006-10-05 10:53:26 -0400 (Thu, 05 Oct 2006)
New Revision: 57448
Modified:
projects/microcontainer/trunk/container/src/main/org/jboss/virtual/plugins/context/jar/JarUtils.java
projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/structure/vfs/file/FileStructure.java
projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/structure/vfs/jar/JARStructure.java
projects/microcontainer/trunk/deployers/src/tests/org/jboss/test/deployers/structure/file/test/ConfiguredSuffixFileStructureUnitTestCase.java
projects/microcontainer/trunk/deployers/src/tests/org/jboss/test/deployers/structure/jar/test/ConfiguredSuffixJARStructureUnitTestCase.java
Log:
Configure suffixes via the constructor for FileStructure and JARStructure instead of via setter for easier overwriting
Modified: projects/microcontainer/trunk/container/src/main/org/jboss/virtual/plugins/context/jar/JarUtils.java
===================================================================
--- projects/microcontainer/trunk/container/src/main/org/jboss/virtual/plugins/context/jar/JarUtils.java 2006-10-05 13:26:17 UTC (rev 57447)
+++ projects/microcontainer/trunk/container/src/main/org/jboss/virtual/plugins/context/jar/JarUtils.java 2006-10-05 14:53:26 UTC (rev 57448)
@@ -51,6 +51,20 @@
}
/**
+ * Sets the jar suffixes
+ *
+ * @param suffix the suffix
+ * @return true when added
+ * @throws IllegalArgumentException for a null suffix
+ */
+ public static void setJarSuffixes(Set<String> suffixes)
+ {
+ if (suffixes == null)
+ throw new IllegalArgumentException("Null suffix");
+ jarSuffixes = suffixes;
+ }
+
+ /**
* Add a jar suffix
*
* @param suffix the suffix
Modified: projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/structure/vfs/file/FileStructure.java
===================================================================
--- projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/structure/vfs/file/FileStructure.java 2006-10-05 13:26:17 UTC (rev 57447)
+++ projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/structure/vfs/file/FileStructure.java 2006-10-05 14:53:26 UTC (rev 57448)
@@ -47,23 +47,16 @@
fileSuffixes.add("-ds.xml");
}
- /**
- * Set the suffixes that are recognised as files
- *
- * @param suffixes A list of suffixes, e.g. {"-service.xml", "-ds.xml"}
- */
- public void setSuffixes(Set<String> suffixes)
+ public FileStructure()
{
- if (suffixes != null)
- {
- fileSuffixes.clear();
- for (String suffix : suffixes)
- {
- addFileSuffix(suffix);
- }
- }
+
}
+ public FileStructure(Set<String> suffixes)
+ {
+ this.fileSuffixes = suffixes;
+ }
+
/**
* Gets the list of suffixes recognised as files
*
Modified: projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/structure/vfs/jar/JARStructure.java
===================================================================
--- projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/structure/vfs/jar/JARStructure.java 2006-10-05 13:26:17 UTC (rev 57447)
+++ projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/structure/vfs/jar/JARStructure.java 2006-10-05 14:53:26 UTC (rev 57448)
@@ -40,22 +40,15 @@
*/
public class JARStructure extends AbstractStructureDeployer
{
- /**
- * Set the list of suffixes that are recognised as jars
- *
- * @param suffixes A list of suffixes, e.g. {".jar", ".ear"}
- */
- public void setSuffixes(Set<String> suffixes)
+ public JARStructure()
{
- if (suffixes != null)
- {
- JarUtils.clearSuffixes();
- for (String suffix : suffixes)
- {
- JarUtils.addJarSuffix(suffix);
- }
- }
+
}
+
+ public JARStructure(Set<String> suffixes)
+ {
+ JarUtils.setJarSuffixes(suffixes);
+ }
/**
* Gets the list of suffixes recognised as jars
Modified: projects/microcontainer/trunk/deployers/src/tests/org/jboss/test/deployers/structure/file/test/ConfiguredSuffixFileStructureUnitTestCase.java
===================================================================
--- projects/microcontainer/trunk/deployers/src/tests/org/jboss/test/deployers/structure/file/test/ConfiguredSuffixFileStructureUnitTestCase.java 2006-10-05 13:26:17 UTC (rev 57447)
+++ projects/microcontainer/trunk/deployers/src/tests/org/jboss/test/deployers/structure/file/test/ConfiguredSuffixFileStructureUnitTestCase.java 2006-10-05 14:53:26 UTC (rev 57448)
@@ -64,34 +64,31 @@
assertTrue("default suffixes size should be > 0", defaultSuffixes.size() > 0);
}
- public void testOverwriteDefaults() throws Exception
+ public void testNewUsingDefaults() throws Exception
{
FileStructure structure = new FileStructure();
Set<String> suffixes = structure.getSuffixes();
assertNotNull(suffixes);
assertEquals(defaultSuffixes.size(), suffixes.size());
-
+ for (String suff : defaultSuffixes)
+ {
+ suffixes.contains(suff);
+ }
+ }
+
+ public void testOverwriteDefaults() throws Exception
+ {
Set<String> newSuffixes = new HashSet<String>();
- structure.setSuffixes(newSuffixes);
- suffixes = structure.getSuffixes();
- assertNotNull(suffixes);
- assertTrue(suffixes.isEmpty());
newSuffixes = new HashSet<String>();
- newSuffixes.add(".txt");
- structure.setSuffixes(newSuffixes);
- suffixes = structure.getSuffixes();
- assertNotNull(suffixes);
- assertEquals(1, suffixes.size());
- assertTrue(suffixes.contains(".txt"));
-
- newSuffixes = new HashSet<String>();
newSuffixes.add("-ds.xml");
newSuffixes.add("-dd.xml");
newSuffixes.add("-service.xml");
- structure.setSuffixes(newSuffixes);
- suffixes = structure.getSuffixes();
+
+ FileStructure structure = new FileStructure(newSuffixes);
+
+ Set<String> suffixes = structure.getSuffixes();
assertNotNull(suffixes);
assertEquals(3, suffixes.size());
assertTrue(suffixes.contains("-ds.xml"));
Modified: projects/microcontainer/trunk/deployers/src/tests/org/jboss/test/deployers/structure/jar/test/ConfiguredSuffixJARStructureUnitTestCase.java
===================================================================
--- projects/microcontainer/trunk/deployers/src/tests/org/jboss/test/deployers/structure/jar/test/ConfiguredSuffixJARStructureUnitTestCase.java 2006-10-05 13:26:17 UTC (rev 57447)
+++ projects/microcontainer/trunk/deployers/src/tests/org/jboss/test/deployers/structure/jar/test/ConfiguredSuffixJARStructureUnitTestCase.java 2006-10-05 14:53:26 UTC (rev 57448)
@@ -57,34 +57,29 @@
assertTrue("default suffixes size should be > 0", defaultSuffixes.size() > 0);
}
- public void testOverwriteDefaults() throws Exception
+ public void testNewUsingDefaults() throws Exception
{
JARStructure structure = new JARStructure();
Set<String> suffixes = structure.getSuffixes();
assertNotNull(suffixes);
assertEquals(defaultSuffixes.size(), suffixes.size());
-
+ for (String suff : defaultSuffixes)
+ {
+ suffixes.contains(suff);
+ }
+ }
+
+ public void testOverwriteDefaults() throws Exception
+ {
+
Set<String> newSuffixes = new HashSet<String>();
- structure.setSuffixes(newSuffixes);
- suffixes = structure.getSuffixes();
- assertNotNull(suffixes);
- assertTrue(suffixes.isEmpty());
-
- newSuffixes = new HashSet<String>();
- newSuffixes.add(".jar");
- structure.setSuffixes(newSuffixes);
- suffixes = structure.getSuffixes();
- assertNotNull(suffixes);
- assertEquals(1, suffixes.size());
- assertTrue(suffixes.contains(".jar"));
-
- newSuffixes = new HashSet<String>();
newSuffixes.add(".bar");
newSuffixes.add(".tar");
newSuffixes.add(".far");
- structure.setSuffixes(newSuffixes);
- suffixes = structure.getSuffixes();
+
+ JARStructure structure = new JARStructure(newSuffixes);
+ Set<String> suffixes = structure.getSuffixes();
assertNotNull(suffixes);
assertEquals(3, suffixes.size());
assertTrue(suffixes.contains(".bar"));
More information about the jboss-cvs-commits
mailing list