[jboss-cvs] JBossAS SVN: r63681 - in projects/microcontainer/trunk: deployers-core and 19 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Jun 27 11:57:02 EDT 2007
Author: adrian at jboss.org
Date: 2007-06-27 11:57:02 -0400 (Wed, 27 Jun 2007)
New Revision: 63681
Added:
projects/microcontainer/trunk/deployers-core/
projects/microcontainer/trunk/deployers-core/.classpath
projects/microcontainer/trunk/deployers-core/.project
projects/microcontainer/trunk/deployers-core/pom.xml
projects/microcontainer/trunk/deployers-core/src/
projects/microcontainer/trunk/deployers-core/src/main/
projects/microcontainer/trunk/deployers-core/src/main/org/
projects/microcontainer/trunk/deployers-core/src/main/org/jboss/
projects/microcontainer/trunk/deployers-core/src/main/org/jboss/deployers/
projects/microcontainer/trunk/deployers-core/src/main/org/jboss/deployers/plugins/
projects/microcontainer/trunk/deployers-core/src/main/org/jboss/deployers/plugins/attachments/
projects/microcontainer/trunk/deployers-core/src/main/org/jboss/deployers/plugins/attachments/AttachmentsImpl.java
projects/microcontainer/trunk/deployers-core/src/main/org/jboss/deployers/plugins/attachments/DefaultAttachmentsFactory.java
projects/microcontainer/trunk/deployers-core/src/main/org/jboss/deployers/plugins/helpers/
projects/microcontainer/trunk/deployers-core/src/main/org/jboss/deployers/plugins/helpers/OrderedImpl.java
projects/microcontainer/trunk/deployers-core/src/main/org/jboss/deployers/plugins/structure/
projects/microcontainer/trunk/deployers-core/src/main/org/jboss/deployers/plugins/structure/ClassPathEntryImpl.java
projects/microcontainer/trunk/deployers-core/src/main/org/jboss/deployers/plugins/structure/ContextInfoImpl.java
projects/microcontainer/trunk/deployers-core/src/main/org/jboss/deployers/plugins/structure/DefaultStructureMetaDataFactory.java
projects/microcontainer/trunk/deployers-core/src/main/org/jboss/deployers/plugins/structure/StructureMetaDataImpl.java
projects/microcontainer/trunk/deployers-core/src/resources/
projects/microcontainer/trunk/deployers-core/src/resources/tests/
projects/microcontainer/trunk/deployers-core/src/tests/
projects/microcontainer/trunk/deployers-core/src/tests/org/
projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/
projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/
projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/
projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/DeployersCoreTestSuite.java
projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/attachments/
projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/attachments/AttachmentsTestSuite.java
projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/attachments/test/
projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/attachments/test/AttachmentsFactoryUnitTestCase.java
projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/attachments/test/AttachmentsTest.java
projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/attachments/test/AttachmentsUnitTestCase.java
projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/attachments/test/ExpectedAttachments.java
projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/attachments/test/ManagedObjectsAttachmentsImplPredeterminedUnitTestCase.java
projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/attachments/test/ManagedObjectsAttachmentsImplTransientUnitTestCase.java
projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/attachments/test/ManagedObjectsWithTransientAttachmentsImplPredeterminedManagedObjectsUnitTestCase.java
projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/attachments/test/ManagedObjectsWithTransientAttachmentsImplTransientManagedObjectUnitTestCase.java
projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/attachments/test/ManagedObjectsWithTransientAttachmentsImplUnitTestCase.java
projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/attachments/test/PredeterminedManagedObjectsAttachmentsImplUnitTestCase.java
projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/structure/
projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/structure/AbstractClassPathEntryTest.java
projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/structure/AbstractContextInfoTest.java
projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/structure/AbstractStructureMetaDataTest.java
projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/structure/AbstractStructureTest.java
projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/structure/StructureMetaDataTestSuite.java
projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/structure/test/
projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/structure/test/ClassPathEntryImplUnitTestCase.java
projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/structure/test/ContextInfoImplUnitTestCase.java
projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/structure/test/StructureMetaDataFactoryClassPathEntryUnitTestCase.java
projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/structure/test/StructureMetaDataFactoryContextInfoUnitTestCase.java
projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/structure/test/StructureMetaDataFactoryStructureUnitTestCase.java
projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/structure/test/StructureMetaDataImplUnitTestCase.java
Log:
Import refactored deployers code
Added: projects/microcontainer/trunk/deployers-core/.classpath
===================================================================
--- projects/microcontainer/trunk/deployers-core/.classpath (rev 0)
+++ projects/microcontainer/trunk/deployers-core/.classpath 2007-06-27 15:57:02 UTC (rev 63681)
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src/main"/>
+ <classpathentry kind="src" path="src/tests"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="var" path="M2_REPO/jboss/jboss-common-core/2.0.4.GA/jboss-common-core-2.0.4.GA.jar" sourcepath="M2_REPO/jboss/jboss-common-core/2.0.4.GA/jboss-common-core-2.0.4.GA-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/jboss/jboss-common-logging-spi/2.0.4.GA/jboss-common-logging-spi-2.0.4.GA.jar"/>
+ <classpathentry kind="var" path="M2_REPO/jboss/jboss-logging-log4j/2.0.2.GA/jboss-logging-log4j-2.0.2.GA.jar" sourcepath="M2_REPO/jboss/jboss-logging-log4j/2.0.2.GA/jboss-logging-log4j-2.0.2.GA-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/log4j/log4j/1.2.14/log4j-1.2.14.jar" sourcepath="M2_REPO/log4j/log4j/1.2.14/log4j-1.2.14-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/junit/junit/3.8.1/junit-3.8.1.jar" sourcepath="M2_REPO/junit/junit/3.8.1/junit-3.8.1-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/jboss/jboss-test/1.0.4-SNAPSHOT/jboss-test-1.0.4-SNAPSHOT.jar" sourcepath="M2_REPO/jboss/jboss-test/1.0.4-SNAPSHOT/jboss-test-1.0.4-SNAPSHOT-sources.jar"/>
+ <classpathentry kind="src" path="/jboss-deployers-core-spi"/>
+ <classpathentry kind="output" path="target/eclipse-classes"/>
+</classpath>
Added: projects/microcontainer/trunk/deployers-core/.project
===================================================================
--- projects/microcontainer/trunk/deployers-core/.project (rev 0)
+++ projects/microcontainer/trunk/deployers-core/.project 2007-06-27 15:57:02 UTC (rev 63681)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>jboss-deployers-core</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Added: projects/microcontainer/trunk/deployers-core/pom.xml
===================================================================
--- projects/microcontainer/trunk/deployers-core/pom.xml (rev 0)
+++ projects/microcontainer/trunk/deployers-core/pom.xml 2007-06-27 15:57:02 UTC (rev 63681)
@@ -0,0 +1,54 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-microcontainer</artifactId>
+ <version>2.0.0-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>jboss-deployers-core</artifactId>
+ <packaging>jar</packaging>
+ <name>JBoss Deployers Core</name>
+ <url>http://www.jboss.com/products/jbossmc</url>
+ <description>JBoss Deployers Core</description>
+ <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>
+ <dependencies>
+ <!-- Global dependencies -->
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-deployers-core-spi</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-common-core</artifactId>
+ <version>2.0.4.GA</version>
+ </dependency>
+ <!-- Test dependencies -->
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-test</artifactId>
+ <version>1.0.4-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+</project>
Added: projects/microcontainer/trunk/deployers-core/src/main/org/jboss/deployers/plugins/attachments/AttachmentsImpl.java
===================================================================
--- projects/microcontainer/trunk/deployers-core/src/main/org/jboss/deployers/plugins/attachments/AttachmentsImpl.java (rev 0)
+++ projects/microcontainer/trunk/deployers-core/src/main/org/jboss/deployers/plugins/attachments/AttachmentsImpl.java 2007-06-27 15:57:02 UTC (rev 63681)
@@ -0,0 +1,148 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt 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.
+*
+* 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.
+*/
+package org.jboss.deployers.plugins.attachments;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.util.Collections;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import org.jboss.deployers.spi.attachments.helpers.AbstractMutableAttachments;
+
+/**
+ * Attachments implementation
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class AttachmentsImpl extends AbstractMutableAttachments
+{
+ /** The serialVersionUID */
+ private static final long serialVersionUID = 8078990023620470935L;
+
+ /** The attachments */
+ private Map<String, Object> attachments = new ConcurrentHashMap<String, Object>();
+
+ /** The number of changes since construction or clearing of the change count */
+ private AtomicInteger changeCount = new AtomicInteger();
+
+ public Map<String, Object> getAttachments()
+ {
+ return Collections.unmodifiableMap(attachments);
+ }
+
+ @Override
+ public void setAttachments(Map<String, Object> map)
+ {
+ if (map == null)
+ throw new IllegalArgumentException("Null map");
+
+ attachments.clear();
+ attachments.putAll(map);
+ changeCount.addAndGet(map.size());
+ }
+
+ public Object addAttachment(String name, Object attachment)
+ {
+ if (name == null)
+ throw new IllegalArgumentException("Null name");
+ if (attachment == null)
+ throw new IllegalArgumentException("Null attachment");
+ Object value = attachments.put(name, attachment);
+ changeCount.incrementAndGet();
+ return value;
+ }
+
+ public Object getAttachment(String name)
+ {
+ if (name == null)
+ throw new IllegalArgumentException("Null name");
+ return attachments.get(name);
+ }
+
+ public boolean isAttachmentPresent(String name)
+ {
+ if (name == null)
+ throw new IllegalArgumentException("Null name");
+ return attachments.containsKey(name);
+ }
+
+ public Object removeAttachment(String name)
+ {
+ if (name == null)
+ throw new IllegalArgumentException("Null name");
+ Object value = attachments.remove(name);
+ changeCount.incrementAndGet();
+ return value;
+ }
+
+ public void clear()
+ {
+ attachments.clear();
+ changeCount.incrementAndGet();
+ }
+
+ public boolean hasAttachments()
+ {
+ return attachments.isEmpty() == false;
+ }
+
+ public int getChangeCount()
+ {
+ return changeCount.intValue();
+ }
+
+ public void clearChangeCount()
+ {
+ changeCount.set(0);
+ }
+
+ @Override
+ public String toString()
+ {
+ return attachments.toString();
+ }
+
+ @SuppressWarnings("unchecked")
+ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
+ {
+ super.readExternal(in);
+ setAttachments((Map) in.readObject());
+ changeCount.set(in.read());
+ }
+
+ /**
+ * @serialData attachments from {@link #getAttachments()}
+ * @serialData changeCount from {@link #getChangeCount()}
+ * @param out the output
+ * @throws IOException for any error
+ */
+ public void writeExternal(ObjectOutput out) throws IOException
+ {
+ super.writeExternal(out);
+ out.writeObject(getAttachments());
+ out.write(changeCount.get());
+ }
+}
Added: projects/microcontainer/trunk/deployers-core/src/main/org/jboss/deployers/plugins/attachments/DefaultAttachmentsFactory.java
===================================================================
--- projects/microcontainer/trunk/deployers-core/src/main/org/jboss/deployers/plugins/attachments/DefaultAttachmentsFactory.java (rev 0)
+++ projects/microcontainer/trunk/deployers-core/src/main/org/jboss/deployers/plugins/attachments/DefaultAttachmentsFactory.java 2007-06-27 15:57:02 UTC (rev 63681)
@@ -0,0 +1,47 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2007, 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.
+ *
+ * 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.
+ */
+package org.jboss.deployers.plugins.attachments;
+
+import org.jboss.deployers.spi.attachments.Attachments;
+import org.jboss.deployers.spi.attachments.AttachmentsFactory;
+import org.jboss.deployers.spi.attachments.MutableAttachments;
+
+/**
+ * DefaultAttachmentsBuilder.
+ *
+ * @author <a href="adrian at jboss.org">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class DefaultAttachmentsFactory extends AttachmentsFactory
+{
+ @Override
+ public Attachments newAttachments()
+ {
+ return new AttachmentsImpl();
+ }
+
+ @Override
+ public MutableAttachments newMutableAttachments()
+ {
+ return new AttachmentsImpl();
+ }
+}
Added: projects/microcontainer/trunk/deployers-core/src/main/org/jboss/deployers/plugins/helpers/OrderedImpl.java
===================================================================
--- projects/microcontainer/trunk/deployers-core/src/main/org/jboss/deployers/plugins/helpers/OrderedImpl.java (rev 0)
+++ projects/microcontainer/trunk/deployers-core/src/main/org/jboss/deployers/plugins/helpers/OrderedImpl.java 2007-06-27 15:57:02 UTC (rev 63681)
@@ -0,0 +1,46 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2007, 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.
+ *
+ * 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.
+ */
+package org.jboss.deployers.plugins.helpers;
+
+import org.jboss.deployers.spi.Ordered;
+
+/**
+ * OrderedImpl.
+ *
+ * @author <a href="adrian at jboss.org">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class OrderedImpl implements Ordered
+{
+ /** The order */
+ private int order;
+
+ public int getRelativeOrder()
+ {
+ return order;
+ }
+
+ public void setRelativeOrder(int order)
+ {
+ this.order = order;
+ }
+}
Added: projects/microcontainer/trunk/deployers-core/src/main/org/jboss/deployers/plugins/structure/ClassPathEntryImpl.java
===================================================================
--- projects/microcontainer/trunk/deployers-core/src/main/org/jboss/deployers/plugins/structure/ClassPathEntryImpl.java (rev 0)
+++ projects/microcontainer/trunk/deployers-core/src/main/org/jboss/deployers/plugins/structure/ClassPathEntryImpl.java 2007-06-27 15:57:02 UTC (rev 63681)
@@ -0,0 +1,189 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2007, 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.
+ *
+ * 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.
+ */
+package org.jboss.deployers.plugins.structure;
+
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.util.Collections;
+import java.util.List;
+
+import org.jboss.deployers.spi.structure.ClassPathEntry;
+
+/**
+ * ClassPathEntry.
+ *
+ * @author <a href="adrian at jboss.org">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class ClassPathEntryImpl implements ClassPathEntry, Externalizable
+{
+ /** The serialVersionUID */
+ private static final long serialVersionUID = -6463413458528845538L;
+
+ /** The default classpath */
+ static final List<ClassPathEntry> DEFAULT = Collections.singletonList((ClassPathEntry) new ClassPathEntryImpl());
+
+ /** The path */
+ private String path;
+
+ /** The suffixes */
+ private String suffixes;
+
+ /**
+ * Create a new ClassPathEntryImpl.
+ */
+ public ClassPathEntryImpl()
+ {
+ setPath("");
+ }
+
+ /**
+ * Create a new ClassPathEntryImpl.
+ *
+ * @param path the path
+ * @throws IllegalArgumentException for a null path
+ */
+ public ClassPathEntryImpl(String path)
+ {
+ setPath(path);
+ }
+
+ /**
+ * Create a new ClassPathEntryImpl.
+ *
+ * @param path the path
+ * @param suffixes the suffixes
+ * @throws IllegalArgumentException for a null path
+ */
+ public ClassPathEntryImpl(String path, String suffixes)
+ {
+ setPath(path);
+ setSuffixes(suffixes);
+ }
+
+ public String getPath()
+ {
+ return path;
+ }
+
+ /**
+ * Set the path.
+ *
+ * @param path the path.
+ * @throws IllegalArgumentException for a null path
+ */
+ public void setPath(String path)
+ {
+ if (path == null)
+ throw new IllegalArgumentException("Null path");
+ this.path = path;
+ }
+
+ public String getSuffixes()
+ {
+ return suffixes;
+ }
+
+ /**
+ * Set the suffixes.
+ *
+ * @param suffixes the suffixes.
+ */
+ public void setSuffixes(String suffixes)
+ {
+ this.suffixes = suffixes;
+ }
+
+ @Override
+ public String toString()
+ {
+ StringBuilder builder = new StringBuilder();
+ builder.append(getClass().getSimpleName());
+ builder.append("{");
+ toString(builder);
+ builder.append("}");
+ return builder.toString();
+ }
+
+ /**
+ * For subclasses to override toString()
+ *
+ * @param builder the builder
+ */
+ protected void toString(StringBuilder builder)
+ {
+ builder.append("path=").append(getPath());
+ String suffixes = getSuffixes();
+ if (suffixes != null)
+ builder.append(" suffixes=").append(suffixes);
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (obj == this)
+ return true;
+ if (obj == null || obj instanceof ClassPathEntry == false)
+ return false;
+
+ ClassPathEntry other = (ClassPathEntry) obj;
+ if (getPath().equals(other.getPath()) == false)
+ return false;
+
+ String thisSuffixes = getSuffixes();
+ String otherSuffixes = other.getSuffixes();
+ if (thisSuffixes == null)
+ return otherSuffixes == null;
+ return thisSuffixes.equals(otherSuffixes);
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return getPath().hashCode();
+ }
+
+ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
+ {
+ setPath(in.readUTF());
+ boolean hasSuffixes = in.readBoolean();
+ if (hasSuffixes)
+ setSuffixes(in.readUTF());
+ }
+
+ /**
+ * @serialData path from {@link #getPath()}
+ * @serialData suffixes from {@link #getSuffixes()}
+ * @param out the output
+ * @throws IOException for any error
+ */
+ public void writeExternal(ObjectOutput out) throws IOException
+ {
+ out.writeUTF(getPath());
+ String suffixes = getSuffixes();
+ out.writeBoolean(suffixes != null);
+ if (suffixes != null)
+ out.writeUTF(suffixes);
+ }
+}
Added: projects/microcontainer/trunk/deployers-core/src/main/org/jboss/deployers/plugins/structure/ContextInfoImpl.java
===================================================================
--- projects/microcontainer/trunk/deployers-core/src/main/org/jboss/deployers/plugins/structure/ContextInfoImpl.java (rev 0)
+++ projects/microcontainer/trunk/deployers-core/src/main/org/jboss/deployers/plugins/structure/ContextInfoImpl.java 2007-06-27 15:57:02 UTC (rev 63681)
@@ -0,0 +1,251 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2007, 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.
+ *
+ * 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.
+ */
+package org.jboss.deployers.plugins.structure;
+
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.deployers.spi.attachments.helpers.PredeterminedManagedObjectAttachmentsImpl;
+import org.jboss.deployers.spi.structure.ClassPathEntry;
+import org.jboss.deployers.spi.structure.ContextInfo;
+
+/**
+ * ContextInfoImpl.
+ *
+ * @author <a href="adrian at jboss.org">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class ContextInfoImpl extends PredeterminedManagedObjectAttachmentsImpl implements ContextInfo, Externalizable
+{
+ /** The serialVersionUID */
+ private static final long serialVersionUID = -4384869824260284607L;
+
+ /** The logical path */
+ private String path;
+
+ /** The metadata path */
+ private String metaDataPath;
+
+ /** The class path entries */
+ private List<ClassPathEntry> classPath = ClassPathEntryImpl.DEFAULT;
+
+ public String getPath()
+ {
+ return path;
+ }
+
+ /**
+ * Create a new ContextInfoImpl.
+ */
+ public ContextInfoImpl()
+ {
+ setPath("");
+ }
+
+ /**
+ * Create a new ContextInfoImpl.
+ *
+ * @param path the path
+ * @throws IllegalArgumentException for a null path
+ */
+ public ContextInfoImpl(String path)
+ {
+ setPath(path);
+ }
+
+ /**
+ * Create a new ContextInfoImpl.
+ *
+ * @param path the path
+ * @param classPath the classpath
+ * @throws IllegalArgumentException for a null path
+ */
+ public ContextInfoImpl(String path, List<ClassPathEntry> classPath)
+ {
+ setPath(path);
+ setClassPath(classPath);
+ }
+
+ /**
+ * Create a new ContextInfoImpl.
+ *
+ * @param path the path
+ * @param metaDataPath the metadata path
+ * @param classPath the class path
+ * @throws IllegalArgumentException for a null path or metadata path
+ */
+ public ContextInfoImpl(String path, String metaDataPath, List<ClassPathEntry> classPath)
+ {
+ setPath(path);
+ setMetaDataPath(metaDataPath);
+ setClassPath(classPath);
+ }
+
+ /**
+ * Set the path.
+ *
+ * @param path the path.
+ * @throws IllegalArgumentException for a null path
+ */
+ public void setPath(String path)
+ {
+ if (path == null)
+ throw new IllegalArgumentException("Null path");
+ this.path = path;
+ }
+
+ public String getMetaDataPath()
+ {
+ return metaDataPath;
+ }
+
+ /**
+ * Set the metaDataPath.
+ *
+ * @param metaDataPath the metaDataPath.
+ * @throws IllegalArgumentException for a null path
+ */
+ public void setMetaDataPath(String metaDataPath)
+ {
+ if (metaDataPath == null)
+ throw new IllegalArgumentException("Null metaDataPath");
+ this.metaDataPath = metaDataPath;
+ }
+
+ public List<ClassPathEntry> getClassPath()
+ {
+ return classPath;
+ }
+
+ /**
+ * Set the classPath.
+ *
+ * @param classPath the classPath.
+ */
+ public void setClassPath(List<ClassPathEntry> classPath)
+ {
+ this.classPath = classPath;
+ }
+
+ public void addClassPathEntry(ClassPathEntry entry)
+ {
+ if (entry == null)
+ throw new IllegalArgumentException("Null entry");
+ if (classPath == null || classPath == ClassPathEntryImpl.DEFAULT)
+ {
+ List<ClassPathEntry> old = classPath;
+ classPath = new ArrayList<ClassPathEntry>();
+ if (old != null)
+ classPath.addAll(old);
+ }
+ classPath.add(entry);
+ }
+
+ @Override
+ public String toString()
+ {
+ StringBuilder builder = new StringBuilder();
+ builder.append(getClass().getSimpleName());
+ builder.append("{");
+ toString(builder);
+ builder.append("}");
+ return builder.toString();
+ }
+
+ /**
+ * For subclasses to override toString()
+ *
+ * @param builder the builder
+ */
+ protected void toString(StringBuilder builder)
+ {
+ builder.append("path=").append(getPath());
+ builder.append(" metaData=").append(getMetaDataPath());
+ builder.append(" classPath=").append(getClassPath());
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (obj == this)
+ return true;
+ if (obj == null || obj instanceof ContextInfo == false)
+ return false;
+
+ ContextInfo other = (ContextInfo) obj;
+ if (getPath().equals(other.getPath()) == false)
+ return false;
+
+ String thisMetaDataPath = getMetaDataPath();
+ String otherMetaDataPath = other.getMetaDataPath();
+ if (thisMetaDataPath == null)
+ return otherMetaDataPath == null;
+ if (thisMetaDataPath.equals(otherMetaDataPath) == false)
+ return false;
+
+ List<ClassPathEntry> thisClassPath = getClassPath();
+ List<ClassPathEntry> otherClassPath = other.getClassPath();
+ if (thisClassPath == null)
+ return otherClassPath == null;
+ return thisClassPath.equals(otherClassPath);
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return getPath().hashCode();
+ }
+
+ @SuppressWarnings("unchecked")
+ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
+ {
+ super.readExternal(in);
+ setPath(in.readUTF());
+ boolean isNullMetaDataPath = in.readBoolean();
+ if (isNullMetaDataPath == false)
+ setMetaDataPath(in.readUTF());
+ setClassPath((List) in.readObject());
+ }
+
+ /**
+ * @serialData path from {@link #getPath()}
+ * @serialData metaDataPath from {@link #getMetaDataPath()}
+ * @serialData classPath from {@link #getClassPath()}
+ * @param out the output
+ * @throws IOException for any error
+ */
+ public void writeExternal(ObjectOutput out) throws IOException
+ {
+ super.writeExternal(out);
+ out.writeUTF(getPath());
+ String metaDataPath = getMetaDataPath();
+ boolean isNullMetaDataPath = (metaDataPath == null);
+ out.writeBoolean(isNullMetaDataPath);
+ if (isNullMetaDataPath == false)
+ out.writeUTF(metaDataPath);
+ out.writeObject(getClassPath());
+ }
+}
Added: projects/microcontainer/trunk/deployers-core/src/main/org/jboss/deployers/plugins/structure/DefaultStructureMetaDataFactory.java
===================================================================
--- projects/microcontainer/trunk/deployers-core/src/main/org/jboss/deployers/plugins/structure/DefaultStructureMetaDataFactory.java (rev 0)
+++ projects/microcontainer/trunk/deployers-core/src/main/org/jboss/deployers/plugins/structure/DefaultStructureMetaDataFactory.java 2007-06-27 15:57:02 UTC (rev 63681)
@@ -0,0 +1,63 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2007, 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.
+ *
+ * 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.
+ */
+package org.jboss.deployers.plugins.structure;
+
+import java.util.List;
+
+import org.jboss.deployers.spi.structure.ClassPathEntry;
+import org.jboss.deployers.spi.structure.ContextInfo;
+import org.jboss.deployers.spi.structure.StructureMetaData;
+import org.jboss.deployers.spi.structure.StructureMetaDataFactory;
+
+/**
+ * DefaultStructureMetaDataFactory.
+ *
+ * @author <a href="adrian at jboss.org">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class DefaultStructureMetaDataFactory extends StructureMetaDataFactory
+{
+ protected StructureMetaData newStructureMetaData()
+ {
+ return new StructureMetaDataImpl();
+ }
+
+ protected ContextInfo newContextInfo(String path)
+ {
+ return new ContextInfoImpl(path);
+ }
+
+ protected ContextInfo newContextInfo(String path, List<ClassPathEntry> classPath)
+ {
+ return new ContextInfoImpl(path, classPath);
+ }
+
+ protected ContextInfo newContextInfo(String path, String metaDataPath, List<ClassPathEntry> classPath)
+ {
+ return new ContextInfoImpl(path, metaDataPath, classPath);
+ }
+
+ protected ClassPathEntry newClassPathEntry(String path, String suffixes)
+ {
+ return new ClassPathEntryImpl(path, suffixes);
+ }
+}
Added: projects/microcontainer/trunk/deployers-core/src/main/org/jboss/deployers/plugins/structure/StructureMetaDataImpl.java
===================================================================
--- projects/microcontainer/trunk/deployers-core/src/main/org/jboss/deployers/plugins/structure/StructureMetaDataImpl.java (rev 0)
+++ projects/microcontainer/trunk/deployers-core/src/main/org/jboss/deployers/plugins/structure/StructureMetaDataImpl.java 2007-06-27 15:57:02 UTC (rev 63681)
@@ -0,0 +1,162 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2007, 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.
+ *
+ * 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.
+ */
+package org.jboss.deployers.plugins.structure;
+
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.util.List;
+import java.util.concurrent.CopyOnWriteArrayList;
+
+import org.jboss.deployers.spi.structure.ContextInfo;
+import org.jboss.deployers.spi.structure.StructureMetaData;
+
+/**
+ * StructureMetaDataImpl.
+ *
+ * @author <a href="adrian at jboss.org">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class StructureMetaDataImpl implements StructureMetaData, Externalizable
+{
+ /** The serialVersionUID */
+ private static final long serialVersionUID = 2341637762171510800L;
+
+ /** The contexts */
+ private List<ContextInfo> contexts = new CopyOnWriteArrayList<ContextInfo>();
+
+ public void addContext(ContextInfo context)
+ {
+ if (context == null)
+ throw new IllegalArgumentException("Null context");
+ String path = context.getPath();
+ if (path == null)
+ throw new IllegalArgumentException("Context has no path");
+
+ for (ContextInfo other : contexts)
+ {
+ if (path.equals(other.getPath()))
+ throw new IllegalStateException("Context alread exists with path '" + path + "' contexts=" + getContexts());
+ }
+ contexts.add(context);
+ }
+
+ public ContextInfo getContext(String path)
+ {
+ if (path == null)
+ throw new IllegalArgumentException("Null path");
+ for (ContextInfo context : contexts)
+ {
+ if (path.equals(context.getPath()))
+ return context;
+ }
+ return null;
+ }
+
+ public void removeContext(ContextInfo context)
+ {
+ if (context == null)
+ throw new IllegalArgumentException("Null context");
+ contexts.remove(context);
+ }
+
+ public void removeContext(String path)
+ {
+ if (path == null)
+ throw new IllegalArgumentException("Null path");
+
+ for (ContextInfo context : contexts)
+ {
+ if (path.equals(context.getPath()))
+ contexts.remove(context);
+ }
+ }
+
+ public List<ContextInfo> getContexts()
+ {
+ return contexts;
+ }
+
+ @Override
+ public String toString()
+ {
+ StringBuilder builder = new StringBuilder();
+ builder.append(getClass().getSimpleName());
+ builder.append("{");
+ toString(builder);
+ builder.append("}");
+ return builder.toString();
+ }
+
+ /**
+ * For subclasses to override toString()
+ *
+ * @param builder the builder
+ */
+ protected void toString(StringBuilder builder)
+ {
+ builder.append("contexts=").append(contexts);
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (obj == this)
+ return true;
+ if (obj == null || obj instanceof StructureMetaData == false)
+ return false;
+
+ StructureMetaData other = (StructureMetaData) obj;
+
+ List<ContextInfo> thisContexts = getContexts();
+ List<ContextInfo> otherContexts = other.getContexts();
+ if (thisContexts == null)
+ return otherContexts == null;
+ return thisContexts.equals(otherContexts);
+ }
+
+ @Override
+ public int hashCode()
+ {
+ List<ContextInfo> contexts = getContexts();
+ if (contexts == null)
+ return 0;
+ return contexts.hashCode();
+ }
+
+ @SuppressWarnings("unchecked")
+ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
+ {
+ contexts = (List) in.readObject();
+ }
+
+ /**
+ * @serialData context from {@link #getContexts()}
+ * @param out the output
+ * @throws IOException for any error
+ */
+ public void writeExternal(ObjectOutput out) throws IOException
+ {
+ out.writeObject(getContexts());
+ }
+}
Added: projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/DeployersCoreTestSuite.java
===================================================================
--- projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/DeployersCoreTestSuite.java (rev 0)
+++ projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/DeployersCoreTestSuite.java 2007-06-27 15:57:02 UTC (rev 63681)
@@ -0,0 +1,53 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt 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.
+*
+* 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.
+*/
+package org.jboss.test.deployers;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import junit.textui.TestRunner;
+
+import org.jboss.test.deployers.attachments.AttachmentsTestSuite;
+import org.jboss.test.deployers.structure.StructureMetaDataTestSuite;
+
+/**
+ * Deployers Core Test Suite.
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 37459 $
+ */
+public class DeployersCoreTestSuite extends TestSuite
+{
+ public static void main(String[] args)
+ {
+ TestRunner.run(suite());
+ }
+
+ public static Test suite()
+ {
+ TestSuite suite = new TestSuite("Deployers Core Tests");
+
+ suite.addTest(AttachmentsTestSuite.suite());
+ suite.addTest(StructureMetaDataTestSuite.suite());
+
+ return suite;
+ }
+}
Added: projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/attachments/AttachmentsTestSuite.java
===================================================================
--- projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/attachments/AttachmentsTestSuite.java (rev 0)
+++ projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/attachments/AttachmentsTestSuite.java 2007-06-27 15:57:02 UTC (rev 63681)
@@ -0,0 +1,65 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt 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.
+*
+* 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.
+*/
+package org.jboss.test.deployers.attachments;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import junit.textui.TestRunner;
+
+import org.jboss.test.deployers.attachments.test.AttachmentsFactoryUnitTestCase;
+import org.jboss.test.deployers.attachments.test.AttachmentsUnitTestCase;
+import org.jboss.test.deployers.attachments.test.ManagedObjectsAttachmentsImplPredeterminedUnitTestCase;
+import org.jboss.test.deployers.attachments.test.ManagedObjectsAttachmentsImplTransientUnitTestCase;
+import org.jboss.test.deployers.attachments.test.ManagedObjectsWithTransientAttachmentsImplPredeterminedManagedObjectsUnitTestCase;
+import org.jboss.test.deployers.attachments.test.ManagedObjectsWithTransientAttachmentsImplTransientManagedObjectUnitTestCase;
+import org.jboss.test.deployers.attachments.test.ManagedObjectsWithTransientAttachmentsImplUnitTestCase;
+import org.jboss.test.deployers.attachments.test.PredeterminedManagedObjectsAttachmentsImplUnitTestCase;
+
+/**
+ * Attachments Test Suite.
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 37459 $
+ */
+public class AttachmentsTestSuite extends TestSuite
+{
+ public static void main(String[] args)
+ {
+ TestRunner.run(suite());
+ }
+
+ public static Test suite()
+ {
+ TestSuite suite = new TestSuite("Attachments Tests");
+
+ suite.addTest(AttachmentsUnitTestCase.suite());
+ suite.addTest(AttachmentsFactoryUnitTestCase.suite());
+ suite.addTest(PredeterminedManagedObjectsAttachmentsImplUnitTestCase.suite());
+ suite.addTest(ManagedObjectsAttachmentsImplPredeterminedUnitTestCase.suite());
+ suite.addTest(ManagedObjectsAttachmentsImplTransientUnitTestCase.suite());
+ suite.addTest(ManagedObjectsWithTransientAttachmentsImplPredeterminedManagedObjectsUnitTestCase.suite());
+ suite.addTest(ManagedObjectsWithTransientAttachmentsImplTransientManagedObjectUnitTestCase.suite());
+ suite.addTest(ManagedObjectsWithTransientAttachmentsImplUnitTestCase.suite());
+
+ return suite;
+ }
+}
Added: projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/attachments/test/AttachmentsFactoryUnitTestCase.java
===================================================================
--- projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/attachments/test/AttachmentsFactoryUnitTestCase.java (rev 0)
+++ projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/attachments/test/AttachmentsFactoryUnitTestCase.java 2007-06-27 15:57:02 UTC (rev 63681)
@@ -0,0 +1,58 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt 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.
+*
+* 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.
+*/
+package org.jboss.test.deployers.attachments.test;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.jboss.deployers.spi.attachments.Attachments;
+import org.jboss.deployers.spi.attachments.AttachmentsFactory;
+import org.jboss.deployers.spi.attachments.MutableAttachments;
+
+/**
+ * AttachmentsFactoryUnitTestCase.
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class AttachmentsFactoryUnitTestCase extends AttachmentsTest
+{
+ public static Test suite()
+ {
+ return new TestSuite(AttachmentsFactoryUnitTestCase.class);
+ }
+
+ public AttachmentsFactoryUnitTestCase(String name)
+ {
+ super(name);
+ }
+
+ protected Attachments getAttachments()
+ {
+ return AttachmentsFactory.createAttachments();
+ }
+
+ protected MutableAttachments getMutable()
+ {
+ return AttachmentsFactory.createMutableAttachments();
+ }
+}
Added: projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/attachments/test/AttachmentsTest.java
===================================================================
--- projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/attachments/test/AttachmentsTest.java (rev 0)
+++ projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/attachments/test/AttachmentsTest.java 2007-06-27 15:57:02 UTC (rev 63681)
@@ -0,0 +1,492 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt 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.
+*
+* 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.
+*/
+package org.jboss.test.deployers.attachments.test;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.jboss.deployers.spi.attachments.Attachments;
+import org.jboss.deployers.spi.attachments.MutableAttachments;
+import org.jboss.test.BaseTestCase;
+
+/**
+ * Attachments Test.
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public abstract class AttachmentsTest extends BaseTestCase
+{
+ public static Test suite()
+ {
+ return new TestSuite(AttachmentsTest.class);
+ }
+
+ public AttachmentsTest(String name)
+ {
+ super(name);
+ }
+
+ protected abstract Attachments getAttachments();
+
+ protected abstract MutableAttachments getMutable();
+
+ public void testAddAttachmentErrors() throws Exception
+ {
+ MutableAttachments mutable = getMutable();
+
+ try
+ {
+ mutable.addAttachment((String) null, "attachment");
+ fail("Should not be here!");
+ }
+ catch (Throwable t)
+ {
+ checkThrowable(IllegalArgumentException.class, t);
+ }
+
+ try
+ {
+ mutable.addAttachment("name", null);
+ fail("Should not be here!");
+ }
+ catch (Throwable t)
+ {
+ checkThrowable(IllegalArgumentException.class, t);
+ }
+
+ try
+ {
+ mutable.addAttachment(null, "attachment", String.class);
+ fail("Should not be here!");
+ }
+ catch (Throwable t)
+ {
+ checkThrowable(IllegalArgumentException.class, t);
+ }
+
+ try
+ {
+ mutable.addAttachment("name", null, String.class);
+ fail("Should not be here!");
+ }
+ catch (Throwable t)
+ {
+ checkThrowable(IllegalArgumentException.class, t);
+ }
+
+ try
+ {
+ mutable.addAttachment("name", "attachment", null);
+ fail("Should not be here!");
+ }
+ catch (Throwable t)
+ {
+ checkThrowable(IllegalArgumentException.class, t);
+ }
+
+ try
+ {
+ mutable.addAttachment((Class<String>) null, "attachment");
+ fail("Should not be here!");
+ }
+ catch (Throwable t)
+ {
+ checkThrowable(IllegalArgumentException.class, t);
+ }
+
+ try
+ {
+ mutable.addAttachment(String.class, null);
+ fail("Should not be here!");
+ }
+ catch (Throwable t)
+ {
+ checkThrowable(IllegalArgumentException.class, t);
+ }
+ }
+
+ public void testAddAttachmentByName() throws Exception
+ {
+ MutableAttachments mutable = getMutable();
+ ExpectedAttachments expected = new ExpectedAttachments();
+ assertAddFreshAttachmentByName(mutable, expected, "name1", "attachment1");
+ assertAddFreshAttachmentByName(mutable, expected, "name2", "attachment2");
+
+ assertAddReplaceAttachmentByName(mutable, expected, "name1", "different1", "attachment1");
+ }
+
+ protected void assertAddFreshAttachmentByName(MutableAttachments mutable, ExpectedAttachments expected, String name, Object attachment)
+ {
+ assertAddReplaceAttachmentByName(mutable, expected, name, attachment, null);
+ }
+
+ protected void assertAddReplaceAttachmentByName(MutableAttachments mutable, ExpectedAttachments expected, String name, Object attachment, Object replaced)
+ {
+ Object result = assertAddAttachmentByName(mutable, expected, name, attachment);
+ assertEquals(replaced, result);
+ }
+
+ protected Object assertAddAttachmentByName(MutableAttachments mutable, ExpectedAttachments expected, String name, Object attachment)
+ {
+ Object result = mutable.addAttachment(name, attachment);
+ checkAdd(mutable, expected, name, attachment, result);
+ return result;
+ }
+
+ protected Object checkAdd(Attachments attachments, ExpectedAttachments expected, String name, Object attachment, Object result)
+ {
+ assertEquals(attachment, attachments.getAttachment(name));
+ assertTrue(attachments.isAttachmentPresent(name));
+ Object expectedResult = assertExpectedAdd(attachments, expected, name, attachment);
+ assertEquals(expectedResult, result);
+ return result;
+ }
+
+ protected Object assertExpectedAdd(Attachments attachments, ExpectedAttachments expected, String name, Object attachment)
+ {
+ Object result = expected.add(name, attachment);
+ assertEquals(expected.expected, attachments.getAttachments());
+ return result;
+ }
+
+ public void testAddAttachmentByNameAndType() throws Exception
+ {
+ MutableAttachments mutable = getMutable();
+ ExpectedAttachments expected = new ExpectedAttachments();
+ assertAddFreshAttachmentByNameAndType(mutable, expected, "name1", "attachment1", String.class);
+ assertAddFreshAttachmentByNameAndType(mutable, expected, "name2", "attachment2", String.class);
+
+ assertAddReplaceAttachmentByNameAndType(mutable, expected, "name1", "different1", "attachment1", String.class);
+ }
+
+ protected <T> void assertAddFreshAttachmentByNameAndType(MutableAttachments mutable, ExpectedAttachments expected, String name, T attachment, Class<T> expectedType)
+ {
+ assertAddReplaceAttachmentByNameAndType(mutable, expected, name, attachment, null, expectedType);
+ }
+
+ protected <T> void assertAddReplaceAttachmentByNameAndType(MutableAttachments mutable, ExpectedAttachments expected, String name, T attachment, Object replaced, Class<T> expectedType)
+ {
+ Object result = assertAddAttachmentByNameAndType(mutable, expected, name, attachment, expectedType);
+ assertEquals(replaced, result);
+ }
+
+ protected <T> Object assertAddAttachmentByNameAndType(MutableAttachments mutable, ExpectedAttachments expected, String name, T attachment, Class<T> expectedType)
+ {
+ Object result = mutable.addAttachment(name, attachment, expectedType);
+ checkAdd(mutable, expected, name, attachment, result);
+ assertEquals(attachment, mutable.getAttachment(name, expectedType));
+ assertTrue(mutable.isAttachmentPresent(name, expectedType));
+ return result;
+ }
+
+ public void testAddAttachmentByType() throws Exception
+ {
+ MutableAttachments mutable = getMutable();
+ ExpectedAttachments expected = new ExpectedAttachments();
+ assertAddFreshAttachmentByType(mutable, expected, Integer.class, 1);
+ assertAddFreshAttachmentByType(mutable, expected, String.class, "attachment");
+
+ assertAddReplaceAttachmentByType(mutable, expected, String.class, "different", "attachment");
+ }
+
+ protected <T> void assertAddFreshAttachmentByType(MutableAttachments mutable, ExpectedAttachments expected, Class<T> type, T attachment)
+ {
+ assertAddReplaceAttachmentByType(mutable, expected, type, attachment, null);
+ }
+
+ protected <T> void assertAddReplaceAttachmentByType(MutableAttachments mutable, ExpectedAttachments expected, Class<T> type, T attachment, Object replaced)
+ {
+ Object result = assertAddAttachmentByType(mutable, expected, type, attachment);
+ assertEquals(replaced, result);
+ }
+
+ protected <T> Object assertAddAttachmentByType(MutableAttachments mutable, ExpectedAttachments expected, Class<T> type, T attachment)
+ {
+ Object result = mutable.addAttachment(type, attachment);
+ String name = type.getName();
+ checkAdd(mutable, expected, name, attachment, result);
+ assertEquals(attachment, mutable.getAttachment(type));
+ assertTrue(mutable.isAttachmentPresent(type));
+ assertEquals(attachment, mutable.getAttachment(name, type));
+ assertTrue(mutable.isAttachmentPresent(name, type));
+ return result;
+ }
+
+ public void testRemoveAttachmentErrors() throws Exception
+ {
+ MutableAttachments mutable = getMutable();
+
+ try
+ {
+ mutable.removeAttachment((String) null);
+ fail("Should not be here!");
+ }
+ catch (Throwable t)
+ {
+ checkThrowable(IllegalArgumentException.class, t);
+ }
+
+ try
+ {
+ mutable.removeAttachment(null, String.class);
+ fail("Should not be here!");
+ }
+ catch (Throwable t)
+ {
+ checkThrowable(IllegalArgumentException.class, t);
+ }
+
+ try
+ {
+ mutable.removeAttachment("name", null);
+ fail("Should nt be here!");
+ }
+ catch (Throwable t)
+ {
+ checkThrowable(IllegalArgumentException.class, t);
+ }
+
+ try
+ {
+ mutable.removeAttachment((Class<String>) null);
+ fail("Should not be here!");
+ }
+ catch (Throwable t)
+ {
+ checkThrowable(IllegalArgumentException.class, t);
+ }
+ }
+
+ public void testRemoveAttachmentByName() throws Exception
+ {
+ MutableAttachments mutable = getMutable();
+ ExpectedAttachments expected = new ExpectedAttachments();
+ assertRemoveNotPresentAttachmentByName(mutable, expected, "name1");
+
+ assertAddAttachmentByName(mutable, expected, "name1", "attachment1");
+ assertAddAttachmentByName(mutable, expected, "name2", "different2");
+ assertRemoveAttachmentByName(mutable, expected, "name1", "attachment1");
+ }
+
+ protected void assertRemoveNotPresentAttachmentByName(MutableAttachments mutable, ExpectedAttachments expected, String name)
+ {
+ assertRemoveAttachmentByName(mutable, expected, name, null);
+ }
+
+ protected void assertRemoveAttachmentByName(MutableAttachments mutable, ExpectedAttachments expected, String name, Object removed)
+ {
+ Object result = assertRemoveAttachmentByName(mutable, expected, name);
+ assertEquals(removed, result);
+ }
+
+ protected Object assertRemoveAttachmentByName(MutableAttachments mutable, ExpectedAttachments expected, String name)
+ {
+ Object result = mutable.removeAttachment(name);
+ checkRemove(mutable, expected, name, result);
+ return result;
+ }
+
+ protected Object checkRemove(Attachments attachments, ExpectedAttachments expected, String name, Object result)
+ {
+ assertNull(attachments.getAttachment(name));
+ assertFalse(attachments.isAttachmentPresent(name));
+ Object expectedResult = assertExpectedRemove(attachments, expected, name);
+ assertEquals(expectedResult, result);
+ return result;
+ }
+
+ protected Object assertExpectedRemove(Attachments attachments, ExpectedAttachments expected, String name)
+ {
+ Object result = expected.remove(name);
+ assertEquals(expected.expected, attachments.getAttachments());
+ return result;
+ }
+
+ public void testRemoveAttachmentByNameAndType() throws Exception
+ {
+ MutableAttachments mutable = getMutable();
+ ExpectedAttachments expected = new ExpectedAttachments();
+ assertRemoveNotPresentAttachmentByNameAndType(mutable, expected, "name1", String.class);
+
+ assertAddAttachmentByNameAndType(mutable, expected, "name1", "attachment1", String.class);
+ assertAddAttachmentByNameAndType(mutable, expected, "name2", "different2", String.class);
+ assertRemoveAttachmentByNameAndType(mutable, expected, "name1", "attachment1", String.class);
+ }
+
+ protected <T> void assertRemoveNotPresentAttachmentByNameAndType(MutableAttachments mutable, ExpectedAttachments expected, String name, Class<T> expectedType)
+ {
+ assertRemoveAttachmentByNameAndType(mutable, expected, name, null, expectedType);
+ }
+
+ protected <T> void assertRemoveAttachmentByNameAndType(MutableAttachments mutable, ExpectedAttachments expected, String name, Object removed, Class<T> expectedType)
+ {
+ Object result = assertRemoveAttachmentByNameAndType(mutable, expected, name, expectedType);
+ assertEquals(removed, result);
+ }
+
+ protected <T> Object assertRemoveAttachmentByNameAndType(MutableAttachments mutable, ExpectedAttachments expected, String name, Class<T> expectedType)
+ {
+ Object result = mutable.removeAttachment(name, expectedType);
+ checkRemove(mutable, expected, name, result);
+ assertNull(mutable.getAttachment(name, expectedType));
+ assertFalse(mutable.isAttachmentPresent(name, expectedType));
+ return result;
+ }
+
+ public void testRemoveAttachmentByType() throws Exception
+ {
+ MutableAttachments mutable = getMutable();
+ ExpectedAttachments expected = new ExpectedAttachments();
+ assertRemoveNotPresentAttachmentByType(mutable, expected, Integer.class);
+
+ assertAddAttachmentByType(mutable, expected, Integer.class, 1);
+ assertAddAttachmentByType(mutable, expected, String.class, "attachment");
+ assertRemoveAttachmentByType(mutable, expected, String.class, "attachment");
+ }
+
+ protected <T> void assertRemoveNotPresentAttachmentByType(MutableAttachments mutable, ExpectedAttachments expected, Class<T> type)
+ {
+ assertRemoveAttachmentByType(mutable, expected, type, null);
+ }
+
+ protected <T> void assertRemoveAttachmentByType(MutableAttachments mutable, ExpectedAttachments expected, Class<T> type, Object removed)
+ {
+ Object result = assertRemoveAttachmentByType(mutable, expected, type);
+ assertEquals(removed, result);
+ }
+
+ protected <T> Object assertRemoveAttachmentByType(MutableAttachments mutable, ExpectedAttachments expected, Class<T> type)
+ {
+ Object result = mutable.removeAttachment(type);
+ String name = type.getName();
+ checkRemove(mutable, expected, name, result);
+ assertNull(mutable.getAttachment(type));
+ assertFalse(mutable.isAttachmentPresent(type));
+ assertNull(mutable.getAttachment(name, type));
+ assertFalse(mutable.isAttachmentPresent(name, type));
+ return result;
+ }
+
+ public void testGetAttachmentErrors() throws Exception
+ {
+ Attachments attachments = getAttachments();
+
+ try
+ {
+ attachments.getAttachment((String) null);
+ fail("Should not be here!");
+ }
+ catch (Throwable t)
+ {
+ checkThrowable(IllegalArgumentException.class, t);
+ }
+
+ try
+ {
+ attachments.getAttachment(null, String.class);
+ fail("Should not be here!");
+ }
+ catch (Throwable t)
+ {
+ checkThrowable(IllegalArgumentException.class, t);
+ }
+
+ try
+ {
+ attachments.getAttachment("name", null);
+ fail("Should not be here!");
+ }
+ catch (Throwable t)
+ {
+ checkThrowable(IllegalArgumentException.class, t);
+ }
+
+ try
+ {
+ attachments.getAttachment((Class<String>) null);
+ fail("Should not be here!");
+ }
+ catch (Throwable t)
+ {
+ checkThrowable(IllegalArgumentException.class, t);
+ }
+ }
+
+ public void testIsAttachmentPresentErrors() throws Exception
+ {
+ Attachments attachments = getAttachments();
+
+ try
+ {
+ attachments.isAttachmentPresent((String) null);
+ fail("Should not be here!");
+ }
+ catch (Throwable t)
+ {
+ checkThrowable(IllegalArgumentException.class, t);
+ }
+
+ try
+ {
+ attachments.isAttachmentPresent(null, String.class);
+ fail("Should not be here!");
+ }
+ catch (Throwable t)
+ {
+ checkThrowable(IllegalArgumentException.class, t);
+ }
+
+ try
+ {
+ attachments.isAttachmentPresent("name", null);
+ fail("Should not be here!");
+ }
+ catch (Throwable t)
+ {
+ checkThrowable(IllegalArgumentException.class, t);
+ }
+
+ try
+ {
+ attachments.isAttachmentPresent((Class<String>) null);
+ fail("Should not be here!");
+ }
+ catch (Throwable t)
+ {
+ checkThrowable(IllegalArgumentException.class, t);
+ }
+ }
+
+ public void testSerialization() throws Exception
+ {
+ Attachments attachments = getAttachments();
+ serializeDeserialize(attachments, Attachments.class);
+
+ MutableAttachments mutable = getMutable();
+ serializeDeserialize(mutable, MutableAttachments.class);
+
+ mutable.addAttachment(String.class, "Hello");
+ mutable = serializeDeserialize(mutable, MutableAttachments.class);
+ assertEquals("Hello", mutable.getAttachment(String.class));
+ }
+}
Added: projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/attachments/test/AttachmentsUnitTestCase.java
===================================================================
--- projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/attachments/test/AttachmentsUnitTestCase.java (rev 0)
+++ projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/attachments/test/AttachmentsUnitTestCase.java 2007-06-27 15:57:02 UTC (rev 63681)
@@ -0,0 +1,60 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt 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.
+*
+* 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.
+*/
+package org.jboss.test.deployers.attachments.test;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.jboss.deployers.plugins.attachments.AttachmentsImpl;
+import org.jboss.deployers.spi.attachments.Attachments;
+import org.jboss.deployers.spi.attachments.MutableAttachments;
+
+/**
+ * AttachmentsUnitTestCase.
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class AttachmentsUnitTestCase extends AttachmentsTest
+{
+ public static Test suite()
+ {
+ return new TestSuite(AttachmentsUnitTestCase.class);
+ }
+
+ private MutableAttachments impl = new AttachmentsImpl();
+
+ public AttachmentsUnitTestCase(String name)
+ {
+ super(name);
+ }
+
+ protected Attachments getAttachments()
+ {
+ return impl;
+ }
+
+ protected MutableAttachments getMutable()
+ {
+ return impl;
+ }
+}
Added: projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/attachments/test/ExpectedAttachments.java
===================================================================
--- projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/attachments/test/ExpectedAttachments.java (rev 0)
+++ projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/attachments/test/ExpectedAttachments.java 2007-06-27 15:57:02 UTC (rev 63681)
@@ -0,0 +1,46 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt 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.
+*
+* 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.
+*/
+package org.jboss.test.deployers.attachments.test;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * ExpectedAttachments.
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class ExpectedAttachments
+{
+ public Map<String, Object> expected = new HashMap<String, Object>();
+
+ public Object add(String name, Object attachment)
+ {
+ return expected.put(name, attachment);
+ }
+
+ public Object remove(String name)
+ {
+ return expected.remove(name);
+ }
+}
Added: projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/attachments/test/ManagedObjectsAttachmentsImplPredeterminedUnitTestCase.java
===================================================================
--- projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/attachments/test/ManagedObjectsAttachmentsImplPredeterminedUnitTestCase.java (rev 0)
+++ projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/attachments/test/ManagedObjectsAttachmentsImplPredeterminedUnitTestCase.java 2007-06-27 15:57:02 UTC (rev 63681)
@@ -0,0 +1,60 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt 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.
+*
+* 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.
+*/
+package org.jboss.test.deployers.attachments.test;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.jboss.deployers.spi.attachments.Attachments;
+import org.jboss.deployers.spi.attachments.MutableAttachments;
+import org.jboss.deployers.spi.attachments.helpers.ManagedObjectAttachmentsImpl;
+
+/**
+ * ManagedObjectsAttachmentsImplPredeterminedUnitTestCase.
+ *
+ * @author <a href="adrian at jboss.org">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class ManagedObjectsAttachmentsImplPredeterminedUnitTestCase extends AttachmentsTest
+{
+ public static Test suite()
+ {
+ return new TestSuite(ManagedObjectsAttachmentsImplPredeterminedUnitTestCase.class);
+ }
+
+ public ManagedObjectsAttachmentsImplPredeterminedUnitTestCase(String name)
+ {
+ super(name);
+ }
+
+ protected Attachments getAttachments()
+ {
+ ManagedObjectAttachmentsImpl objects = new ManagedObjectAttachmentsImpl();
+ return objects.getPredeterminedManagedObjects();
+ }
+
+ protected MutableAttachments getMutable()
+ {
+ ManagedObjectAttachmentsImpl objects = new ManagedObjectAttachmentsImpl();
+ return (MutableAttachments) objects.getPredeterminedManagedObjects();
+ }
+}
Added: projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/attachments/test/ManagedObjectsAttachmentsImplTransientUnitTestCase.java
===================================================================
--- projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/attachments/test/ManagedObjectsAttachmentsImplTransientUnitTestCase.java (rev 0)
+++ projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/attachments/test/ManagedObjectsAttachmentsImplTransientUnitTestCase.java 2007-06-27 15:57:02 UTC (rev 63681)
@@ -0,0 +1,60 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt 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.
+*
+* 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.
+*/
+package org.jboss.test.deployers.attachments.test;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.jboss.deployers.spi.attachments.Attachments;
+import org.jboss.deployers.spi.attachments.MutableAttachments;
+import org.jboss.deployers.spi.attachments.helpers.ManagedObjectAttachmentsImpl;
+
+/**
+ * ManagedObjectsAttachmentsImplTransientUnitTestCase.
+ *
+ * @author <a href="adrian at jboss.org">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class ManagedObjectsAttachmentsImplTransientUnitTestCase extends AttachmentsTest
+{
+ public static Test suite()
+ {
+ return new TestSuite(ManagedObjectsAttachmentsImplTransientUnitTestCase.class);
+ }
+
+ public ManagedObjectsAttachmentsImplTransientUnitTestCase(String name)
+ {
+ super(name);
+ }
+
+ protected Attachments getAttachments()
+ {
+ ManagedObjectAttachmentsImpl objects = new ManagedObjectAttachmentsImpl();
+ return objects.getTransientManagedObjects();
+ }
+
+ protected MutableAttachments getMutable()
+ {
+ ManagedObjectAttachmentsImpl objects = new ManagedObjectAttachmentsImpl();
+ return objects.getTransientManagedObjects();
+ }
+}
Added: projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/attachments/test/ManagedObjectsWithTransientAttachmentsImplPredeterminedManagedObjectsUnitTestCase.java
===================================================================
--- projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/attachments/test/ManagedObjectsWithTransientAttachmentsImplPredeterminedManagedObjectsUnitTestCase.java (rev 0)
+++ projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/attachments/test/ManagedObjectsWithTransientAttachmentsImplPredeterminedManagedObjectsUnitTestCase.java 2007-06-27 15:57:02 UTC (rev 63681)
@@ -0,0 +1,61 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt 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.
+*
+* 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.
+*/
+package org.jboss.test.deployers.attachments.test;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.jboss.deployers.spi.attachments.Attachments;
+import org.jboss.deployers.spi.attachments.ManagedObjectsWithTransientAttachments;
+import org.jboss.deployers.spi.attachments.MutableAttachments;
+import org.jboss.deployers.spi.attachments.helpers.ManagedObjectsWithTransientAttachmentsImpl;
+
+/**
+ * ManagedObjectsWithTransientAttachmentsImplPredeterminedManagedObjectsUnitTestCase.
+ *
+ * @author <a href="adrian at jboss.org">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class ManagedObjectsWithTransientAttachmentsImplPredeterminedManagedObjectsUnitTestCase extends AttachmentsTest
+{
+ public static Test suite()
+ {
+ return new TestSuite(ManagedObjectsWithTransientAttachmentsImplPredeterminedManagedObjectsUnitTestCase.class);
+ }
+
+ public ManagedObjectsWithTransientAttachmentsImplPredeterminedManagedObjectsUnitTestCase(String name)
+ {
+ super(name);
+ }
+
+ protected Attachments getAttachments()
+ {
+ ManagedObjectsWithTransientAttachments objects = new ManagedObjectsWithTransientAttachmentsImpl();
+ return objects.getPredeterminedManagedObjects();
+ }
+
+ protected MutableAttachments getMutable()
+ {
+ ManagedObjectsWithTransientAttachments objects = new ManagedObjectsWithTransientAttachmentsImpl();
+ return (MutableAttachments) objects.getPredeterminedManagedObjects();
+ }
+}
Added: projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/attachments/test/ManagedObjectsWithTransientAttachmentsImplTransientManagedObjectUnitTestCase.java
===================================================================
--- projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/attachments/test/ManagedObjectsWithTransientAttachmentsImplTransientManagedObjectUnitTestCase.java (rev 0)
+++ projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/attachments/test/ManagedObjectsWithTransientAttachmentsImplTransientManagedObjectUnitTestCase.java 2007-06-27 15:57:02 UTC (rev 63681)
@@ -0,0 +1,61 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt 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.
+*
+* 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.
+*/
+package org.jboss.test.deployers.attachments.test;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.jboss.deployers.spi.attachments.Attachments;
+import org.jboss.deployers.spi.attachments.ManagedObjectsWithTransientAttachments;
+import org.jboss.deployers.spi.attachments.MutableAttachments;
+import org.jboss.deployers.spi.attachments.helpers.ManagedObjectsWithTransientAttachmentsImpl;
+
+/**
+ * ManagedObjectsWithTransientAttachmentsImplTransientManagedObjectUnitTestCase.
+ *
+ * @author <a href="adrian at jboss.org">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class ManagedObjectsWithTransientAttachmentsImplTransientManagedObjectUnitTestCase extends AttachmentsTest
+{
+ public static Test suite()
+ {
+ return new TestSuite(ManagedObjectsWithTransientAttachmentsImplTransientManagedObjectUnitTestCase.class);
+ }
+
+ public ManagedObjectsWithTransientAttachmentsImplTransientManagedObjectUnitTestCase(String name)
+ {
+ super(name);
+ }
+
+ protected Attachments getAttachments()
+ {
+ ManagedObjectsWithTransientAttachments objects = new ManagedObjectsWithTransientAttachmentsImpl();
+ return objects.getTransientManagedObjects();
+ }
+
+ protected MutableAttachments getMutable()
+ {
+ ManagedObjectsWithTransientAttachments objects = new ManagedObjectsWithTransientAttachmentsImpl();
+ return objects.getTransientManagedObjects();
+ }
+}
Added: projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/attachments/test/ManagedObjectsWithTransientAttachmentsImplUnitTestCase.java
===================================================================
--- projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/attachments/test/ManagedObjectsWithTransientAttachmentsImplUnitTestCase.java (rev 0)
+++ projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/attachments/test/ManagedObjectsWithTransientAttachmentsImplUnitTestCase.java 2007-06-27 15:57:02 UTC (rev 63681)
@@ -0,0 +1,61 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt 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.
+*
+* 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.
+*/
+package org.jboss.test.deployers.attachments.test;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.jboss.deployers.spi.attachments.Attachments;
+import org.jboss.deployers.spi.attachments.ManagedObjectsWithTransientAttachments;
+import org.jboss.deployers.spi.attachments.MutableAttachments;
+import org.jboss.deployers.spi.attachments.helpers.ManagedObjectsWithTransientAttachmentsImpl;
+
+/**
+ * ManagedObjectsWithTransientAttachmentsImplUnitTestCase.
+ *
+ * @author <a href="adrian at jboss.org">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class ManagedObjectsWithTransientAttachmentsImplUnitTestCase extends AttachmentsTest
+{
+ public static Test suite()
+ {
+ return new TestSuite(ManagedObjectsWithTransientAttachmentsImplUnitTestCase.class);
+ }
+
+ public ManagedObjectsWithTransientAttachmentsImplUnitTestCase(String name)
+ {
+ super(name);
+ }
+
+ protected Attachments getAttachments()
+ {
+ ManagedObjectsWithTransientAttachments objects = new ManagedObjectsWithTransientAttachmentsImpl();
+ return objects.getTransientAttachments();
+ }
+
+ protected MutableAttachments getMutable()
+ {
+ ManagedObjectsWithTransientAttachments objects = new ManagedObjectsWithTransientAttachmentsImpl();
+ return objects.getTransientAttachments();
+ }
+}
Added: projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/attachments/test/PredeterminedManagedObjectsAttachmentsImplUnitTestCase.java
===================================================================
--- projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/attachments/test/PredeterminedManagedObjectsAttachmentsImplUnitTestCase.java (rev 0)
+++ projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/attachments/test/PredeterminedManagedObjectsAttachmentsImplUnitTestCase.java 2007-06-27 15:57:02 UTC (rev 63681)
@@ -0,0 +1,60 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt 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.
+*
+* 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.
+*/
+package org.jboss.test.deployers.attachments.test;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.jboss.deployers.spi.attachments.Attachments;
+import org.jboss.deployers.spi.attachments.MutableAttachments;
+import org.jboss.deployers.spi.attachments.helpers.PredeterminedManagedObjectAttachmentsImpl;
+
+/**
+ * PredeterminedManagedObjectsAttachmentsImplUnitTestCase.
+ *
+ * @author <a href="adrian at jboss.org">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class PredeterminedManagedObjectsAttachmentsImplUnitTestCase extends AttachmentsTest
+{
+ public static Test suite()
+ {
+ return new TestSuite(PredeterminedManagedObjectsAttachmentsImplUnitTestCase.class);
+ }
+
+ public PredeterminedManagedObjectsAttachmentsImplUnitTestCase(String name)
+ {
+ super(name);
+ }
+
+ protected Attachments getAttachments()
+ {
+ PredeterminedManagedObjectAttachmentsImpl predetermined = new PredeterminedManagedObjectAttachmentsImpl();
+ return predetermined.getPredeterminedManagedObjects();
+ }
+
+ protected MutableAttachments getMutable()
+ {
+ PredeterminedManagedObjectAttachmentsImpl predetermined = new PredeterminedManagedObjectAttachmentsImpl();
+ return (MutableAttachments) predetermined.getPredeterminedManagedObjects();
+ }
+}
Added: projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/structure/AbstractClassPathEntryTest.java
===================================================================
--- projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/structure/AbstractClassPathEntryTest.java (rev 0)
+++ projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/structure/AbstractClassPathEntryTest.java 2007-06-27 15:57:02 UTC (rev 63681)
@@ -0,0 +1,153 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt 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.
+*
+* 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.
+*/
+package org.jboss.test.deployers.structure;
+
+import org.jboss.deployers.spi.structure.ClassPathEntry;
+import org.jboss.test.BaseTestCase;
+
+/**
+ * AbstractClassPathEntryTest.
+ *
+ * @author <a href="adrian at jboss.org">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public abstract class AbstractClassPathEntryTest extends BaseTestCase
+{
+ public AbstractClassPathEntryTest(String name)
+ {
+ super(name);
+ }
+
+ protected abstract ClassPathEntry createDefault();
+
+ public void testConstructorDefault()
+ {
+ ClassPathEntry entry = createDefault();
+ assertEquals("", entry.getPath());
+ assertNull(entry.getSuffixes());
+ }
+
+ protected abstract ClassPathEntry createPath(String path);
+
+ public void testConstructorPath()
+ {
+ ClassPathEntry entry = createPath("path");
+ assertEquals("path", entry.getPath());
+ assertNull(entry.getSuffixes());
+ }
+
+ public void testConstructorErrorsPath()
+ {
+ try
+ {
+ createPath(null);
+ fail("Should not be here");
+ }
+ catch (Exception e)
+ {
+ checkThrowable(IllegalArgumentException.class, e);
+ }
+ }
+
+ protected abstract ClassPathEntry createPathAndSuffixes(String path, String suffixes);
+
+ public void testConstructorPathAndSuffixes()
+ {
+ ClassPathEntry entry = createPathAndSuffixes("path", "suffixes");
+ assertEquals("path", entry.getPath());
+ assertEquals("suffixes", entry.getSuffixes());
+
+ entry = createPathAndSuffixes("path", null);
+ assertEquals("path", entry.getPath());
+ assertNull(entry.getSuffixes());
+ }
+
+ public void testConstructorErrorsPathAndSuffixes()
+ {
+ try
+ {
+ createPathAndSuffixes(null, "suffixes");
+ fail("Should not be here");
+ }
+ catch (Exception e)
+ {
+ checkThrowable(IllegalArgumentException.class, e);
+ }
+ }
+
+ public void testEqualsAndHashCode()
+ {
+ ClassPathEntry one = createDefault();
+ ClassPathEntry two = createDefault();
+ assertEquals(one, two);
+ assertEquals(two, one);
+ assertEquals(one.hashCode(), two.hashCode());
+
+ two = createPathAndSuffixes("", null);
+ assertEquals(one, two);
+ assertEquals(two, one);
+ assertEquals(one.hashCode(), two.hashCode());
+
+ one = createPathAndSuffixes("path", "suffixes");
+ two = createPathAndSuffixes("path", "suffixes");
+ assertEquals(one, two);
+ assertEquals(two, one);
+ assertEquals(one.hashCode(), two.hashCode());
+
+ one = createPathAndSuffixes("path", "suffixes");
+ two = createPathAndSuffixes("not-path", "suffixes");
+ assertNotSame(one, two);
+ assertNotSame(two, one);
+ assertNotSame(one.hashCode(), two.hashCode());
+
+ one = createPathAndSuffixes("path", "suffixes");
+ two = createPathAndSuffixes("Path", "not-suffixes");
+ assertNotSame(one, two);
+ assertNotSame(two, one);
+ assertNotSame(one.hashCode(), two.hashCode());
+
+ one = createPathAndSuffixes("path", "suffixes");
+ two = createPathAndSuffixes("Path", null);
+ assertNotSame(one, two);
+ assertNotSame(two, one);
+ assertNotSame(one.hashCode(), two.hashCode());
+ }
+
+ public void testSerialization() throws Exception
+ {
+ ClassPathEntry entry = createDefault();
+ assertEquals("", entry.getPath());
+ assertNull(entry.getSuffixes());
+
+ entry = serializeDeserialize(entry, ClassPathEntry.class);
+ assertEquals("", entry.getPath());
+ assertNull(entry.getSuffixes());
+
+ entry = createPathAndSuffixes("path", "suffixes");
+ assertEquals("path", entry.getPath());
+ assertEquals("suffixes", entry.getSuffixes());
+
+ entry = serializeDeserialize(entry, ClassPathEntry.class);
+ assertEquals("path", entry.getPath());
+ assertEquals("suffixes", entry.getSuffixes());
+ }
+}
Added: projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/structure/AbstractContextInfoTest.java
===================================================================
--- projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/structure/AbstractContextInfoTest.java (rev 0)
+++ projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/structure/AbstractContextInfoTest.java 2007-06-27 15:57:02 UTC (rev 63681)
@@ -0,0 +1,247 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt 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.
+*
+* 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.
+*/
+package org.jboss.test.deployers.structure;
+
+import java.util.List;
+
+import org.jboss.deployers.spi.structure.ClassPathEntry;
+import org.jboss.deployers.spi.structure.ContextInfo;
+
+/**
+ * AbstractContextInfoTest.
+ *
+ * @author <a href="adrian at jboss.org">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public abstract class AbstractContextInfoTest extends AbstractStructureTest
+{
+ public AbstractContextInfoTest(String name)
+ {
+ super(name);
+ }
+
+ protected abstract ContextInfo createDefault();
+
+ public void testConstructorDefault()
+ {
+ ContextInfo context = createDefault();
+ assertDefault(context);
+ }
+
+ protected abstract ContextInfo createPath(String path);
+
+ public void testConstructorPath()
+ {
+ ContextInfo context = createPath("path");
+ assertEquals("path", context.getPath());
+ assertDefaultNonPath(context);
+ }
+
+ public void testConstructorErrorsPath()
+ {
+ try
+ {
+ createPath(null);
+ fail("Should not be here");
+ }
+ catch (Exception e)
+ {
+ checkThrowable(IllegalArgumentException.class, e);
+ }
+ }
+
+ protected abstract ContextInfo createPathAndClassPath(String path, List<ClassPathEntry> classPath);
+
+ @Override
+ protected abstract ClassPathEntry createClassPathEntry(String path);
+
+ public void testConstructorPathAndClassPath()
+ {
+ List<ClassPathEntry> classPath = createClassPath("ClassPath");
+ ContextInfo context = createPathAndClassPath("path", classPath);
+ assertEquals("path", context.getPath());
+ assertDefaultMetaDataPath(context);
+ assertEquals(classPath, context.getClassPath());
+
+ classPath = null;
+ context = createPathAndClassPath("path", classPath);
+ assertEquals("path", context.getPath());
+ assertDefaultMetaDataPath(context);
+ assertNull(context.getClassPath());
+ }
+
+ public void testConstructorErrorsPathAndClassPath()
+ {
+ List<ClassPathEntry> classPath = createClassPath("ClassPath");
+ try
+ {
+ createPathAndClassPath(null, classPath);
+ fail("Should not be here");
+ }
+ catch (Exception e)
+ {
+ checkThrowable(IllegalArgumentException.class, e);
+ }
+ }
+
+ protected abstract ContextInfo createPathAndMetaDataAndClassPath(String path, String metaDataPath, List<ClassPathEntry> classPath);
+
+ public void testConstructorPathAndMetaDataAndClassPath()
+ {
+ List<ClassPathEntry> classPath = createClassPath("ClassPath");
+ ContextInfo context = createPathAndMetaDataAndClassPath("path", "metaDataPath", classPath);
+ assertEquals("path", context.getPath());
+ assertEquals("metaDataPath", context.getMetaDataPath());
+ assertEquals(classPath, context.getClassPath());
+
+ classPath = null;
+ context = createPathAndMetaDataAndClassPath("path", "metaDataPath", classPath);
+ assertEquals("path", context.getPath());
+ assertEquals("metaDataPath", context.getMetaDataPath());
+ assertNull(context.getClassPath());
+ }
+
+ public void testConstructorErrorsPathAndMetaDataPathAndAndClassPath()
+ {
+ List<ClassPathEntry> classPath = createClassPath("ClassPath");
+ try
+ {
+ createPathAndMetaDataAndClassPath(null, "metaData", classPath);
+ fail("Should not be here");
+ }
+ catch (Exception e)
+ {
+ checkThrowable(IllegalArgumentException.class, e);
+ }
+
+ try
+ {
+ createPathAndMetaDataAndClassPath("path", null, classPath);
+ fail("Should not be here");
+ }
+ catch (Exception e)
+ {
+ checkThrowable(IllegalArgumentException.class, e);
+ }
+ }
+
+ public void testAddClassPath()
+ {
+ ContextInfo context = createPathAndClassPath("", null);
+ assertDefaultPath(context);
+ assertDefaultMetaDataPath(context);
+ assertNull(context.getClassPath());
+
+ ClassPathEntry entry1 = createClassPathEntry("path1");
+ context.addClassPathEntry(entry1);
+ assertDefaultPath(context);
+ assertDefaultMetaDataPath(context);
+ assertClassPath(context, entry1);
+
+ ClassPathEntry entry2 = createClassPathEntry("path2");
+ context.addClassPathEntry(entry2);
+ assertDefaultPath(context);
+ assertDefaultMetaDataPath(context);
+ assertClassPath(context, entry1, entry2);
+ }
+
+ public void testEqualsAndHashCode()
+ {
+ ContextInfo one = createDefault();
+ ContextInfo two = createDefault();
+ assertEquals(one, two);
+ assertEquals(two, one);
+ assertEquals(one.hashCode(), two.hashCode());
+
+ List<ClassPathEntry> classPath1 = createClassPath("");
+ two = createPathAndClassPath("", classPath1);
+ assertEquals(one, two);
+ assertEquals(two, one);
+ assertEquals(one.hashCode(), two.hashCode());
+
+ classPath1 = createClassPath("classPath");
+ one = createPathAndMetaDataAndClassPath("path", "metaDataPath", classPath1);
+ two = createPathAndMetaDataAndClassPath("path", "metaDataPath", classPath1);
+ assertEquals(one, two);
+ assertEquals(two, one);
+ assertEquals(one.hashCode(), two.hashCode());
+
+ List<ClassPathEntry> classPath2 = createClassPath("classPath");
+ one = createPathAndMetaDataAndClassPath("path", "metaDataPath", classPath1);
+ two = createPathAndMetaDataAndClassPath("path", "metaDataPath", classPath2);
+ assertEquals(one, two);
+ assertEquals(two, one);
+ assertEquals(one.hashCode(), two.hashCode());
+
+ one = createPathAndMetaDataAndClassPath("path", "metaDataPath", classPath1);
+ two = createPathAndMetaDataAndClassPath("not-path", "metaDataPath", classPath1);
+ assertNotSame(one, two);
+ assertNotSame(two, one);
+ assertNotSame(one.hashCode(), two.hashCode());
+
+ one = createPathAndMetaDataAndClassPath("path", "metaDataPath", classPath1);
+ two = createPathAndMetaDataAndClassPath("path", "not-metaDataPath", classPath1);
+ assertNotSame(one, two);
+ assertNotSame(two, one);
+ assertNotSame(one.hashCode(), two.hashCode());
+
+ classPath2 = createClassPath("not-classPath");
+ one = createPathAndMetaDataAndClassPath("path", "metaDataPath", classPath1);
+ two = createPathAndMetaDataAndClassPath("Path", "metaDataPath", classPath2);
+ assertNotSame(one, two);
+ assertNotSame(two, one);
+ assertNotSame(one.hashCode(), two.hashCode());
+
+ one = createPathAndMetaDataAndClassPath("path", "metaDataPath", classPath1);
+ two = createPathAndMetaDataAndClassPath("Path", "metaDataPath", null);
+ assertNotSame(one, two);
+ assertNotSame(two, one);
+ assertNotSame(one.hashCode(), two.hashCode());
+
+ classPath2 = createClassPath("classPath", "notClassPath");
+ one = createPathAndMetaDataAndClassPath("path", "metaDataPath", classPath1);
+ two = createPathAndMetaDataAndClassPath("Path", "metaDataPath", classPath2);
+ assertNotSame(one, two);
+ assertNotSame(two, one);
+ assertNotSame(one.hashCode(), two.hashCode());
+ }
+
+ public void testSerialization() throws Exception
+ {
+ ContextInfo context = createDefault();
+ assertDefault(context);
+
+ context = serializeDeserialize(context, ContextInfo.class);
+ assertDefault(context);
+
+ List<ClassPathEntry> classPath = createClassPath("ClassPath");
+ context = createPathAndMetaDataAndClassPath("path", "metaDataPath", classPath);
+ assertEquals("path", context.getPath());
+ assertEquals("metaDataPath", context.getMetaDataPath());
+ assertEquals(classPath, context.getClassPath());
+
+ context = serializeDeserialize(context, ContextInfo.class);
+ assertEquals("path", context.getPath());
+ assertEquals("metaDataPath", context.getMetaDataPath());
+ assertEquals(classPath, context.getClassPath());
+ }
+}
Added: projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/structure/AbstractStructureMetaDataTest.java
===================================================================
--- projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/structure/AbstractStructureMetaDataTest.java (rev 0)
+++ projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/structure/AbstractStructureMetaDataTest.java 2007-06-27 15:57:02 UTC (rev 63681)
@@ -0,0 +1,390 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt 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.
+*
+* 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.
+*/
+package org.jboss.test.deployers.structure;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.deployers.spi.structure.ContextInfo;
+import org.jboss.deployers.spi.structure.StructureMetaData;
+
+/**
+ * AbstractStructureMetaDataTest.
+ *
+ * @author <a href="adrian at jboss.org">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public abstract class AbstractStructureMetaDataTest extends AbstractStructureTest
+{
+ public AbstractStructureMetaDataTest(String name)
+ {
+ super(name);
+ }
+
+ protected abstract StructureMetaData createDefault();
+
+ protected abstract ContextInfo createContext(String path);
+
+ protected List<ContextInfo> getExpected(ContextInfo... expected)
+ {
+ List<ContextInfo> result = new ArrayList<ContextInfo>();
+ if (expected != null)
+ {
+ for (ContextInfo context : expected)
+ result.add(context);
+ }
+ return result;
+ }
+
+ public void testConstructorDefault()
+ {
+ StructureMetaData structure = createDefault();
+ assertEmpty(structure.getContexts());
+ }
+
+ public void testAddContext()
+ {
+ StructureMetaData structure = createDefault();
+ assertEmpty(structure.getContexts());
+
+ ContextInfo one = createContext("one");
+ structure.addContext(one);
+ assertEquals(getExpected(one), structure.getContexts());
+ assertEquals(one, structure.getContext("one"));
+ }
+
+ public void testAddContexts()
+ {
+ StructureMetaData structure = createDefault();
+ assertEmpty(structure.getContexts());
+
+ ContextInfo one = createContext("one");
+ ContextInfo two = createContext("two");
+ ContextInfo three = createContext("three");
+ structure.addContext(one);
+ structure.addContext(two);
+ structure.addContext(three);
+ assertEquals(getExpected(one, two, three), structure.getContexts());
+ assertEquals(one, structure.getContext("one"));
+ assertEquals(two, structure.getContext("two"));
+ assertEquals(three, structure.getContext("three"));
+ }
+
+ public void testAddContextsErrors()
+ {
+ StructureMetaData structure = createDefault();
+ assertEmpty(structure.getContexts());
+
+ try
+ {
+ structure.addContext(null);
+ fail("Should not be here!");
+ }
+ catch (Exception e)
+ {
+ checkThrowable(IllegalArgumentException.class, e);
+ }
+
+ ContextInfo one = createContext("one");
+ structure.addContext(one);
+ try
+ {
+ structure.addContext(one);
+ fail("Should not be here");
+ }
+ catch (Exception e)
+ {
+ checkThrowable(IllegalStateException.class, e);
+ }
+
+ ContextInfo another = createContext("one");
+ try
+ {
+ structure.addContext(another);
+ fail("Should not be here");
+ }
+ catch (Exception e)
+ {
+ checkThrowable(IllegalStateException.class, e);
+ }
+ }
+
+ public void testRemoveContext()
+ {
+ StructureMetaData structure = createDefault();
+ assertEmpty(structure.getContexts());
+
+ ContextInfo one = createContext("one");
+ structure.addContext(one);
+ assertEquals(getExpected(one), structure.getContexts());
+ assertEquals(one, structure.getContext("one"));
+
+ structure.removeContext(one);
+ assertEquals(getExpected(), structure.getContexts());
+ assertNull(structure.getContext("one"));
+
+ structure.addContext(one);
+ assertEquals(getExpected(one), structure.getContexts());
+ assertEquals(one, structure.getContext("one"));
+ }
+
+ public void testRemoveContexts()
+ {
+ StructureMetaData structure = createDefault();
+ assertEmpty(structure.getContexts());
+
+ ContextInfo one = createContext("one");
+ ContextInfo two = createContext("two");
+ ContextInfo three = createContext("three");
+ structure.addContext(one);
+ structure.addContext(two);
+ structure.addContext(three);
+ assertEquals(getExpected(one, two, three), structure.getContexts());
+ assertEquals(one, structure.getContext("one"));
+ assertEquals(two, structure.getContext("two"));
+ assertEquals(three, structure.getContext("three"));
+
+ structure.removeContext(one);
+ assertEquals(getExpected(two, three), structure.getContexts());
+ assertNull(structure.getContext("one"));
+ assertEquals(two, structure.getContext("two"));
+ assertEquals(three, structure.getContext("three"));
+
+ structure.removeContext(two);
+ assertEquals(getExpected(three), structure.getContexts());
+ assertNull(structure.getContext("one"));
+ assertNull(structure.getContext("two"));
+ assertEquals(three, structure.getContext("three"));
+
+ structure.removeContext(three);
+ assertEquals(getExpected(), structure.getContexts());
+ assertNull(structure.getContext("one"));
+ assertNull(structure.getContext("two"));
+ assertNull(structure.getContext("three"));
+
+ structure.addContext(one);
+ assertEquals(getExpected(one), structure.getContexts());
+ assertEquals(one, structure.getContext("one"));
+
+ // Removing a context not present is ok
+ structure.removeContext(two);
+ }
+
+ public void testRemoveContextErrors()
+ {
+ StructureMetaData structure = createDefault();
+ assertEmpty(structure.getContexts());
+
+ try
+ {
+ ContextInfo context = null;
+ structure.removeContext(context);
+ fail("Should not be here!");
+ }
+ catch (Exception e)
+ {
+ checkThrowable(IllegalArgumentException.class, e);
+ }
+ }
+
+ public void testRemoveContextByName()
+ {
+ StructureMetaData structure = createDefault();
+ assertEmpty(structure.getContexts());
+
+ ContextInfo one = createContext("one");
+ structure.addContext(one);
+ assertEquals(getExpected(one), structure.getContexts());
+ assertEquals(one, structure.getContext("one"));
+
+ structure.removeContext("one");
+ assertEquals(getExpected(), structure.getContexts());
+ assertNull(structure.getContext("one"));
+
+ structure.addContext(one);
+ assertEquals(getExpected(one), structure.getContexts());
+ assertEquals(one, structure.getContext("one"));
+ }
+
+ public void testRemoveContextsByName()
+ {
+ StructureMetaData structure = createDefault();
+ assertEmpty(structure.getContexts());
+
+ ContextInfo one = createContext("one");
+ ContextInfo two = createContext("two");
+ ContextInfo three = createContext("three");
+ structure.addContext(one);
+ structure.addContext(two);
+ structure.addContext(three);
+ assertEquals(getExpected(one, two, three), structure.getContexts());
+ assertEquals(one, structure.getContext("one"));
+ assertEquals(two, structure.getContext("two"));
+ assertEquals(three, structure.getContext("three"));
+
+ structure.removeContext("one");
+ assertEquals(getExpected(two, three), structure.getContexts());
+ assertNull(structure.getContext("one"));
+ assertEquals(two, structure.getContext("two"));
+ assertEquals(three, structure.getContext("three"));
+
+ structure.removeContext("two");
+ assertEquals(getExpected(three), structure.getContexts());
+ assertNull(structure.getContext("one"));
+ assertNull(structure.getContext("two"));
+ assertEquals(three, structure.getContext("three"));
+
+ structure.removeContext("three");
+ assertEquals(getExpected(), structure.getContexts());
+ assertNull(structure.getContext("one"));
+ assertNull(structure.getContext("two"));
+ assertNull(structure.getContext("three"));
+
+ structure.addContext(one);
+ assertEquals(getExpected(one), structure.getContexts());
+ assertEquals(one, structure.getContext("one"));
+
+ // Removing a context not present is ok
+ structure.removeContext("two");
+ }
+
+ public void testRemoveContextByNameErrors()
+ {
+ StructureMetaData structure = createDefault();
+ assertEmpty(structure.getContexts());
+
+ try
+ {
+ String name = null;
+ structure.removeContext(name);
+ fail("Should not be here!");
+ }
+ catch (Exception e)
+ {
+ checkThrowable(IllegalArgumentException.class, e);
+ }
+ }
+
+ public void testGetContext()
+ {
+ StructureMetaData structure = createDefault();
+ assertEmpty(structure.getContexts());
+
+ assertNull(structure.getContext("one"));
+ assertNull(structure.getContext("two"));
+
+ ContextInfo one = createContext("one");
+ ContextInfo two = createContext("two");
+ structure.addContext(one);
+ structure.addContext(two);
+
+ assertEquals(one, structure.getContext("one"));
+ assertEquals(two, structure.getContext("two"));
+
+ structure.removeContext("one");
+ assertNull(structure.getContext("one"));
+ assertEquals(two, structure.getContext("two"));
+
+ structure.removeContext("two");
+ assertNull(structure.getContext("one"));
+ assertNull(structure.getContext("two"));
+
+ structure.addContext(one);
+ assertEquals(one, structure.getContext("one"));
+ assertNull(structure.getContext("two"));
+ }
+
+ public void testEqualsAndHashCode()
+ {
+ StructureMetaData one = createDefault();
+ StructureMetaData two = createDefault();
+ assertEquals(one, two);
+ assertEquals(two, one);
+ assertEquals(one.hashCode(), two.hashCode());
+
+ ContextInfo context1 = createContext("one");
+ ContextInfo context2 = createContext("two");
+
+ one.addContext(context1);
+ two.addContext(context1);
+ assertEquals(one, two);
+ assertEquals(two, one);
+ assertEquals(one.hashCode(), two.hashCode());
+
+ one.addContext(context2);
+ two.addContext(context2);
+ assertEquals(one, two);
+ assertEquals(two, one);
+ assertEquals(one.hashCode(), two.hashCode());
+ one.removeContext(context2);
+ two.removeContext(context2);
+
+ ContextInfo another1 = createContext("one");
+ two.removeContext(context1);
+ two.addContext(another1);
+ assertEquals(one, two);
+ assertEquals(two, one);
+ assertEquals(one.hashCode(), two.hashCode());
+
+ two.removeContext(context1);
+ assertNotSame(one, two);
+ assertNotSame(two, one);
+ assertNotSame(one.hashCode(), two.hashCode());
+
+ two.addContext(context2);
+ assertNotSame(one, two);
+ assertNotSame(two, one);
+ assertNotSame(one.hashCode(), two.hashCode());
+
+ one = createDefault();
+ two = createDefault();
+ one.addContext(context1);
+ one.addContext(context2);
+ two.addContext(context2);
+ two.addContext(context1);
+ assertNotSame(one, two);
+ assertNotSame(two, one);
+ assertNotSame(one.hashCode(), two.hashCode());
+ }
+
+ public void testSerialization() throws Exception
+ {
+ StructureMetaData structure = createDefault();
+ assertEmpty(structure.getContexts());
+
+ structure = serializeDeserialize(structure, StructureMetaData.class);
+ assertEmpty(structure.getContexts());
+
+ ContextInfo one = createContext("one");
+ ContextInfo two = createContext("two");
+ structure.addContext(one);
+ structure.addContext(two);
+ assertEquals(getExpected(one, two), structure.getContexts());
+ assertEquals(one, structure.getContext("one"));
+ assertEquals(two, structure.getContext("two"));
+
+ structure = serializeDeserialize(structure, StructureMetaData.class);
+ assertEquals(getExpected(one, two), structure.getContexts());
+ assertEquals(one, structure.getContext("one"));
+ assertEquals(two, structure.getContext("two"));
+ }
+}
Added: projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/structure/AbstractStructureTest.java
===================================================================
--- projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/structure/AbstractStructureTest.java (rev 0)
+++ projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/structure/AbstractStructureTest.java 2007-06-27 15:57:02 UTC (rev 63681)
@@ -0,0 +1,103 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt 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.
+*
+* 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.
+*/
+package org.jboss.test.deployers.structure;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.deployers.spi.structure.ClassPathEntry;
+import org.jboss.deployers.spi.structure.ContextInfo;
+import org.jboss.test.BaseTestCase;
+
+/**
+ * AbstractStructureTest.
+ *
+ * @author <a href="adrian at jboss.org">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public abstract class AbstractStructureTest extends BaseTestCase
+{
+ public AbstractStructureTest(String name)
+ {
+ super(name);
+ }
+
+ protected static void assertDefault(ContextInfo contextInfo)
+ {
+ assertDefaultPath(contextInfo);
+ assertDefaultMetaDataPath(contextInfo);
+ assertDefaultClassPath(contextInfo.getClassPath());
+ }
+
+ protected static void assertDefaultPath(ContextInfo contextInfo)
+ {
+ assertEquals("", contextInfo.getPath());
+ }
+
+ protected static void assertDefaultNonPath(ContextInfo contextInfo)
+ {
+ assertDefaultMetaDataPath(contextInfo);
+ assertDefaultClassPath(contextInfo.getClassPath());
+ }
+
+ protected static void assertDefaultMetaDataPath(ContextInfo contextInfo)
+ {
+ assertNull(contextInfo.getMetaDataPath());
+ }
+
+ protected static void assertDefaultClassPath(List<ClassPathEntry> classPath)
+ {
+ assertNotNull(classPath);
+ assertEquals(1, classPath.size());
+ ClassPathEntry entry = classPath.get(0);
+ assertNotNull(entry);
+ assertEquals("", entry.getPath());
+ assertNull(entry.getSuffixes());
+ }
+
+ protected static void assertClassPath(ContextInfo context, ClassPathEntry... paths)
+ {
+ List<ClassPathEntry> classPath = new ArrayList<ClassPathEntry>();
+ if (paths != null)
+ {
+ for (ClassPathEntry entry : paths)
+ classPath.add(entry);
+ }
+ assertEquals(classPath, context.getClassPath());
+ }
+
+ protected List<ClassPathEntry> createClassPath(String... paths)
+ {
+ List<ClassPathEntry> result = new ArrayList<ClassPathEntry>();
+ if (paths != null)
+ {
+ for (String path : paths)
+ result.add(createClassPathEntry(path));
+ }
+ return result;
+ }
+
+ protected ClassPathEntry createClassPathEntry(String path)
+ {
+ throw new UnsupportedOperationException();
+ }
+}
Added: projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/structure/StructureMetaDataTestSuite.java
===================================================================
--- projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/structure/StructureMetaDataTestSuite.java (rev 0)
+++ projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/structure/StructureMetaDataTestSuite.java 2007-06-27 15:57:02 UTC (rev 63681)
@@ -0,0 +1,61 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt 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.
+*
+* 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.
+*/
+package org.jboss.test.deployers.structure;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import junit.textui.TestRunner;
+
+import org.jboss.test.deployers.structure.test.ClassPathEntryImplUnitTestCase;
+import org.jboss.test.deployers.structure.test.ContextInfoImplUnitTestCase;
+import org.jboss.test.deployers.structure.test.StructureMetaDataFactoryClassPathEntryUnitTestCase;
+import org.jboss.test.deployers.structure.test.StructureMetaDataFactoryContextInfoUnitTestCase;
+import org.jboss.test.deployers.structure.test.StructureMetaDataFactoryStructureUnitTestCase;
+import org.jboss.test.deployers.structure.test.StructureMetaDataImplUnitTestCase;
+
+/**
+ * StructureMetaData Test Suite.
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 37459 $
+ */
+public class StructureMetaDataTestSuite extends TestSuite
+{
+ public static void main(String[] args)
+ {
+ TestRunner.run(suite());
+ }
+
+ public static Test suite()
+ {
+ TestSuite suite = new TestSuite("StructureMetaData Tests");
+
+ suite.addTest(ClassPathEntryImplUnitTestCase.suite());
+ suite.addTest(ContextInfoImplUnitTestCase.suite());
+ suite.addTest(StructureMetaDataImplUnitTestCase.suite());
+ suite.addTest(StructureMetaDataFactoryClassPathEntryUnitTestCase.suite());
+ suite.addTest(StructureMetaDataFactoryContextInfoUnitTestCase.suite());
+ suite.addTest(StructureMetaDataFactoryStructureUnitTestCase.suite());
+
+ return suite;
+ }
+}
Added: projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/structure/test/ClassPathEntryImplUnitTestCase.java
===================================================================
--- projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/structure/test/ClassPathEntryImplUnitTestCase.java (rev 0)
+++ projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/structure/test/ClassPathEntryImplUnitTestCase.java 2007-06-27 15:57:02 UTC (rev 63681)
@@ -0,0 +1,116 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt 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.
+*
+* 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.
+*/
+package org.jboss.test.deployers.structure.test;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.jboss.deployers.plugins.structure.ClassPathEntryImpl;
+import org.jboss.test.deployers.structure.AbstractClassPathEntryTest;
+
+/**
+ * ClassPathEntryImplUnitTestCase.
+ *
+ * @author <a href="adrian at jboss.org">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class ClassPathEntryImplUnitTestCase extends AbstractClassPathEntryTest
+{
+ public static Test suite()
+ {
+ return new TestSuite(ClassPathEntryImplUnitTestCase.class);
+ }
+
+ public ClassPathEntryImplUnitTestCase(String name)
+ {
+ super(name);
+ }
+
+ @Override
+ protected ClassPathEntryImpl createDefault()
+ {
+ return new ClassPathEntryImpl();
+ }
+
+ @Override
+ protected ClassPathEntryImpl createPath(String path)
+ {
+ return new ClassPathEntryImpl(path);
+ }
+
+ @Override
+ protected ClassPathEntryImpl createPathAndSuffixes(String path, String suffixes)
+ {
+ return new ClassPathEntryImpl(path, suffixes);
+ }
+
+ public void testSetPath()
+ {
+ ClassPathEntryImpl entry = createDefault();
+ assertEquals("", entry.getPath());
+ assertNull(entry.getSuffixes());
+
+ entry.setPath("path");
+ assertEquals("path", entry.getPath());
+ assertNull(entry.getSuffixes());
+
+ entry.setPath("changed");
+ assertEquals("changed", entry.getPath());
+ assertNull(entry.getSuffixes());
+ }
+
+ public void testSetPathErrors()
+ {
+ ClassPathEntryImpl entry = createDefault();
+ assertEquals("", entry.getPath());
+ assertNull(entry.getSuffixes());
+
+ try
+ {
+ entry.setPath(null);
+ fail("Should not be here!");
+ }
+ catch (Exception e)
+ {
+ checkThrowable(IllegalArgumentException.class, e);
+ }
+ }
+
+ public void testSetSuffixes()
+ {
+ ClassPathEntryImpl entry = createDefault();
+ assertEquals("", entry.getPath());
+ assertNull(entry.getSuffixes());
+
+ entry.setSuffixes("suffixes");
+ assertEquals("", entry.getPath());
+ assertEquals("suffixes", entry.getSuffixes());
+
+ entry.setSuffixes("changed");
+ assertEquals("", entry.getPath());
+ assertEquals("changed", entry.getSuffixes());
+
+ entry.setSuffixes(null);
+ assertEquals("", entry.getPath());
+ assertNull(entry.getSuffixes());
+ }
+}
Added: projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/structure/test/ContextInfoImplUnitTestCase.java
===================================================================
--- projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/structure/test/ContextInfoImplUnitTestCase.java (rev 0)
+++ projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/structure/test/ContextInfoImplUnitTestCase.java 2007-06-27 15:57:02 UTC (rev 63681)
@@ -0,0 +1,171 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt 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.
+*
+* 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.
+*/
+package org.jboss.test.deployers.structure.test;
+
+import java.util.List;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.jboss.deployers.plugins.structure.ClassPathEntryImpl;
+import org.jboss.deployers.plugins.structure.ContextInfoImpl;
+import org.jboss.deployers.spi.structure.ClassPathEntry;
+import org.jboss.deployers.spi.structure.ContextInfo;
+import org.jboss.test.deployers.structure.AbstractContextInfoTest;
+
+/**
+ * ContextInfoImplUnitTestCase.
+ *
+ * @author <a href="adrian at jboss.org">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class ContextInfoImplUnitTestCase extends AbstractContextInfoTest
+{
+ public static Test suite()
+ {
+ return new TestSuite(ContextInfoImplUnitTestCase.class);
+ }
+
+ public ContextInfoImplUnitTestCase(String name)
+ {
+ super(name);
+ }
+
+ @Override
+ protected ContextInfoImpl createDefault()
+ {
+ return new ContextInfoImpl();
+ }
+
+ @Override
+ protected ContextInfoImpl createPath(String path)
+ {
+ return new ContextInfoImpl(path);
+ }
+
+ @Override
+ protected ContextInfoImpl createPathAndClassPath(String path, List<ClassPathEntry> classPath)
+ {
+ return new ContextInfoImpl(path, classPath);
+ }
+
+ @Override
+ protected ContextInfo createPathAndMetaDataAndClassPath(String path, String metaDataPath, List<ClassPathEntry> classPath)
+ {
+ return new ContextInfoImpl(path, metaDataPath, classPath);
+ }
+
+ @Override
+ protected ClassPathEntry createClassPathEntry(String path)
+ {
+ return new ClassPathEntryImpl(path);
+ }
+
+ public void testSetPath()
+ {
+ ContextInfoImpl context = createDefault();
+ assertEquals("", context.getPath());
+ assertDefaultNonPath(context);
+
+ context.setPath("path");
+ assertEquals("path", context.getPath());
+ assertDefaultNonPath(context);
+
+ context.setPath("changed");
+ assertEquals("changed", context.getPath());
+ assertDefaultNonPath(context);
+ }
+
+ public void testSetPathErrors()
+ {
+ ContextInfoImpl context = createDefault();
+ assertEquals("", context.getPath());
+ assertDefaultNonPath(context);
+
+ try
+ {
+ context.setPath(null);
+ fail("Should not be here!");
+ }
+ catch (Exception e)
+ {
+ checkThrowable(IllegalArgumentException.class, e);
+ }
+ }
+
+ public void testSetMetaDataPath()
+ {
+ ContextInfoImpl context = createDefault();
+ assertEquals("", context.getPath());
+ assertDefaultNonPath(context);
+
+ context.setMetaDataPath("metaDataPath");
+ assertEquals("metaDataPath", context.getMetaDataPath());
+ assertDefaultClassPath(context.getClassPath());
+
+ context.setMetaDataPath("changed");
+ assertEquals("changed", context.getMetaDataPath());
+ assertDefaultClassPath(context.getClassPath());
+ }
+
+ public void testSetMetaDataPathErrors()
+ {
+ ContextInfoImpl context = createDefault();
+ assertEquals("", context.getPath());
+ assertDefaultNonPath(context);
+
+ try
+ {
+ context.setMetaDataPath(null);
+ fail("Should not be here!");
+ }
+ catch (Exception e)
+ {
+ checkThrowable(IllegalArgumentException.class, e);
+ }
+ }
+
+ public void testSetClassPath()
+ {
+ ContextInfoImpl context = createDefault();
+ assertEquals("", context.getPath());
+ assertDefaultNonPath(context);
+
+ List<ClassPathEntry> classPath = createClassPath("classPath");
+ context.setClassPath(classPath);
+ assertEquals("", context.getPath());
+ assertDefaultMetaDataPath(context);
+ assertEquals(classPath, context.getClassPath());
+
+ classPath = createClassPath("changed");
+ context.setClassPath(classPath);
+ assertEquals("", context.getPath());
+ assertDefaultMetaDataPath(context);
+ assertEquals(classPath, context.getClassPath());
+
+ classPath = null;
+ context.setClassPath(classPath);
+ assertEquals("", context.getPath());
+ assertDefaultMetaDataPath(context);
+ assertEquals(classPath, context.getClassPath());
+ }
+}
Added: projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/structure/test/StructureMetaDataFactoryClassPathEntryUnitTestCase.java
===================================================================
--- projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/structure/test/StructureMetaDataFactoryClassPathEntryUnitTestCase.java (rev 0)
+++ projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/structure/test/StructureMetaDataFactoryClassPathEntryUnitTestCase.java 2007-06-27 15:57:02 UTC (rev 63681)
@@ -0,0 +1,66 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt 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.
+*
+* 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.
+*/
+package org.jboss.test.deployers.structure.test;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.jboss.deployers.spi.structure.ClassPathEntry;
+import org.jboss.deployers.spi.structure.StructureMetaDataFactory;
+import org.jboss.test.deployers.structure.AbstractClassPathEntryTest;
+
+/**
+ * StructureMetaDataFactoryClassPathEntryUnitTestCase.
+ *
+ * @author <a href="adrian at jboss.org">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class StructureMetaDataFactoryClassPathEntryUnitTestCase extends AbstractClassPathEntryTest
+{
+ public static Test suite()
+ {
+ return new TestSuite(StructureMetaDataFactoryClassPathEntryUnitTestCase.class);
+ }
+
+ public StructureMetaDataFactoryClassPathEntryUnitTestCase(String name)
+ {
+ super(name);
+ }
+
+ @Override
+ protected ClassPathEntry createDefault()
+ {
+ return StructureMetaDataFactory.createClassPathEntry();
+ }
+
+ @Override
+ protected ClassPathEntry createPath(String path)
+ {
+ return StructureMetaDataFactory.createClassPathEntry(path);
+ }
+
+ @Override
+ protected ClassPathEntry createPathAndSuffixes(String path, String suffixes)
+ {
+ return StructureMetaDataFactory.createClassPathEntry(path, suffixes);
+ }
+}
Added: projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/structure/test/StructureMetaDataFactoryContextInfoUnitTestCase.java
===================================================================
--- projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/structure/test/StructureMetaDataFactoryContextInfoUnitTestCase.java (rev 0)
+++ projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/structure/test/StructureMetaDataFactoryContextInfoUnitTestCase.java 2007-06-27 15:57:02 UTC (rev 63681)
@@ -0,0 +1,81 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt 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.
+*
+* 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.
+*/
+package org.jboss.test.deployers.structure.test;
+
+import java.util.List;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.jboss.deployers.spi.structure.ClassPathEntry;
+import org.jboss.deployers.spi.structure.ContextInfo;
+import org.jboss.deployers.spi.structure.StructureMetaDataFactory;
+import org.jboss.test.deployers.structure.AbstractContextInfoTest;
+
+/**
+ * ContextInfoImplUnitTestCase.
+ *
+ * @author <a href="adrian at jboss.org">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class StructureMetaDataFactoryContextInfoUnitTestCase extends AbstractContextInfoTest
+{
+ public static Test suite()
+ {
+ return new TestSuite(StructureMetaDataFactoryContextInfoUnitTestCase.class);
+ }
+
+ public StructureMetaDataFactoryContextInfoUnitTestCase(String name)
+ {
+ super(name);
+ }
+
+ @Override
+ protected ContextInfo createDefault()
+ {
+ return StructureMetaDataFactory.createContextInfo();
+ }
+
+ @Override
+ protected ContextInfo createPath(String path)
+ {
+ return StructureMetaDataFactory.createContextInfo(path);
+ }
+
+ @Override
+ protected ContextInfo createPathAndClassPath(String path, List<ClassPathEntry> classPath)
+ {
+ return StructureMetaDataFactory.createContextInfo(path, classPath);
+ }
+
+ @Override
+ protected ContextInfo createPathAndMetaDataAndClassPath(String path, String metaDataPath, List<ClassPathEntry> classPath)
+ {
+ return StructureMetaDataFactory.createContextInfo(path, metaDataPath, classPath);
+ }
+
+ @Override
+ protected ClassPathEntry createClassPathEntry(String path)
+ {
+ return StructureMetaDataFactory.createClassPathEntry(path);
+ }
+}
Added: projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/structure/test/StructureMetaDataFactoryStructureUnitTestCase.java
===================================================================
--- projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/structure/test/StructureMetaDataFactoryStructureUnitTestCase.java (rev 0)
+++ projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/structure/test/StructureMetaDataFactoryStructureUnitTestCase.java 2007-06-27 15:57:02 UTC (rev 63681)
@@ -0,0 +1,61 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt 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.
+*
+* 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.
+*/
+package org.jboss.test.deployers.structure.test;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.jboss.deployers.spi.structure.ContextInfo;
+import org.jboss.deployers.spi.structure.StructureMetaData;
+import org.jboss.deployers.spi.structure.StructureMetaDataFactory;
+import org.jboss.test.deployers.structure.AbstractStructureMetaDataTest;
+
+/**
+ * StructureMetaDataImplUnitTestCase.
+ *
+ * @author <a href="adrian at jboss.org">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class StructureMetaDataFactoryStructureUnitTestCase extends AbstractStructureMetaDataTest
+{
+ public static Test suite()
+ {
+ return new TestSuite(StructureMetaDataFactoryStructureUnitTestCase.class);
+ }
+
+ public StructureMetaDataFactoryStructureUnitTestCase(String name)
+ {
+ super(name);
+ }
+
+ @Override
+ protected StructureMetaData createDefault()
+ {
+ return StructureMetaDataFactory.createStructureMetaData();
+ }
+
+ @Override
+ protected ContextInfo createContext(String path)
+ {
+ return StructureMetaDataFactory.createContextInfo(path);
+ }
+}
Added: projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/structure/test/StructureMetaDataImplUnitTestCase.java
===================================================================
--- projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/structure/test/StructureMetaDataImplUnitTestCase.java (rev 0)
+++ projects/microcontainer/trunk/deployers-core/src/tests/org/jboss/test/deployers/structure/test/StructureMetaDataImplUnitTestCase.java 2007-06-27 15:57:02 UTC (rev 63681)
@@ -0,0 +1,61 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt 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.
+*
+* 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.
+*/
+package org.jboss.test.deployers.structure.test;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.jboss.deployers.plugins.structure.ContextInfoImpl;
+import org.jboss.deployers.plugins.structure.StructureMetaDataImpl;
+import org.jboss.deployers.spi.structure.ContextInfo;
+import org.jboss.test.deployers.structure.AbstractStructureMetaDataTest;
+
+/**
+ * StructureMetaDataImplUnitTestCase.
+ *
+ * @author <a href="adrian at jboss.org">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class StructureMetaDataImplUnitTestCase extends AbstractStructureMetaDataTest
+{
+ public static Test suite()
+ {
+ return new TestSuite(StructureMetaDataImplUnitTestCase.class);
+ }
+
+ public StructureMetaDataImplUnitTestCase(String name)
+ {
+ super(name);
+ }
+
+ @Override
+ protected StructureMetaDataImpl createDefault()
+ {
+ return new StructureMetaDataImpl();
+ }
+
+ @Override
+ protected ContextInfo createContext(String path)
+ {
+ return new ContextInfoImpl(path);
+ }
+}
More information about the jboss-cvs-commits
mailing list