[jboss-cvs] JBossAS SVN: r69154 - in projects/microcontainer/trunk/deployers-structure-spi/src: main/org/jboss/deployers/structure/spi/classloading/helpers and 4 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Sun Jan 20 20:54:53 EST 2008
Author: alesj
Date: 2008-01-20 20:54:52 -0500 (Sun, 20 Jan 2008)
New Revision: 69154
Added:
projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/classloading/VersionComparator.java
projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/classloading/VersionComparatorRegistry.java
projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/classloading/helpers/VersionImplComparator.java
projects/microcontainer/trunk/deployers-structure-spi/src/tests/org/jboss/test/deployers/structure/version/
projects/microcontainer/trunk/deployers-structure-spi/src/tests/org/jboss/test/deployers/structure/version/support/
projects/microcontainer/trunk/deployers-structure-spi/src/tests/org/jboss/test/deployers/structure/version/test/
projects/microcontainer/trunk/deployers-structure-spi/src/tests/org/jboss/test/deployers/structure/version/test/VersionComparatorRegistryTestCase.java
projects/microcontainer/trunk/deployers-structure-spi/src/tests/org/jboss/test/deployers/structure/version/test/VersionComparatorTestCase.java
projects/microcontainer/trunk/deployers-structure-spi/src/tests/org/jboss/test/deployers/structure/version/test/VersionImplTestCase.java
projects/microcontainer/trunk/deployers-structure-spi/src/tests/org/jboss/test/deployers/structure/version/test/VersionTestSuite.java
Modified:
projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/classloading/Version.java
projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/classloading/VersionRange.java
projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/classloading/helpers/VersionImpl.java
projects/microcontainer/trunk/deployers-structure-spi/src/tests/org/jboss/test/deployers/DeployersStructureTestSuite.java
Log:
OSGi dependency removal in Version impls.
Changing the way Version class compares with different impls.
Still TODO on tests.
Modified: projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/classloading/Version.java
===================================================================
--- projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/classloading/Version.java 2008-01-21 01:00:19 UTC (rev 69153)
+++ projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/classloading/Version.java 2008-01-21 01:54:52 UTC (rev 69154)
@@ -26,11 +26,18 @@
/**
* Version.
*
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
* @author <a href="adrian at jboss.org">Adrian Brock</a>
* @version $Revision: 1.1 $
*/
-public interface Version extends Comparable<Version>
+public abstract class Version implements Comparable<Version>
{
/** The default version */
- public static final Version DEFAULT_VERSION = new VersionImpl(null);
+ public static final Version DEFAULT_VERSION = VersionImpl.parseVersion(null);
+
+ public int compareTo(Version v)
+ {
+ VersionComparatorRegistry registry = VersionComparatorRegistry.getInstance();
+ return registry.compare(this, v);
+ }
}
Added: projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/classloading/VersionComparator.java
===================================================================
--- projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/classloading/VersionComparator.java (rev 0)
+++ projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/classloading/VersionComparator.java 2008-01-21 01:54:52 UTC (rev 69154)
@@ -0,0 +1,41 @@
+/*
+* 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.structure.spi.classloading;
+
+/**
+ * The Version impl comparator.
+ *
+ * @param <T> exact version type
+ * @param <U> exact version type
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public interface VersionComparator<T extends Version, U extends Version>
+{
+ /**
+ * Compare the two version impls.
+ *
+ * @param t T version impl
+ * @param u U version impl
+ * @return compare the two version impls
+ */
+ int compare(T t, U u);
+}
Added: projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/classloading/VersionComparatorRegistry.java
===================================================================
--- projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/classloading/VersionComparatorRegistry.java (rev 0)
+++ projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/classloading/VersionComparatorRegistry.java 2008-01-21 01:54:52 UTC (rev 69154)
@@ -0,0 +1,182 @@
+/*
+* 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.structure.spi.classloading;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.jboss.deployers.structure.spi.classloading.helpers.VersionImpl;
+import org.jboss.deployers.structure.spi.classloading.helpers.VersionImplComparator;
+
+/**
+ * Version comparator registry.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class VersionComparatorRegistry
+{
+ private static VersionComparatorRegistry registry = new VersionComparatorRegistry();
+
+ private Map<Class<? extends Version>, Map<Class<? extends Version>, VersionComparator>> comparatorMap = new ConcurrentHashMap<Class<? extends Version>, Map<Class<? extends Version>, VersionComparator>>();
+
+ private VersionComparatorRegistry()
+ {
+ // register all our known impls
+ registerVersionComparator(VersionImpl.class, new VersionImplComparator());
+ }
+
+ public static VersionComparatorRegistry getInstance()
+ {
+ return registry;
+ }
+
+ /**
+ * Remove the version comparator.
+ *
+ * @param t first version impl
+ * @param u second version impl
+ */
+ public <T extends Version, U extends Version> void removeVersionComparator(Class<T> t, Class<U> u)
+ {
+ registerVersionComparator(t, u, null);
+ }
+
+ /**
+ * Remove the version comparator.
+ *
+ * @param t version impl
+ */
+ public <T extends Version> void removeVersionComparator(Class<T> t)
+ {
+ registerVersionComparator(t, null);
+ }
+
+ /**
+ * Register version comparator.
+ * If comparator parameter is null, it's actually a removal.
+ *
+ * @param t version impl
+ * @param comparator the version comparator
+ */
+ public <T extends Version> void registerVersionComparator(Class<T> t, VersionComparator<T, T> comparator)
+ {
+ registerVersionComparator(t, t, comparator);
+ }
+
+ /**
+ * Register version comparator.
+ * If comparator parameter is null, it's actually a removal.
+ *
+ * @param t first version impl
+ * @param u second version impl
+ * @param comparator the version comparator
+ */
+ public <T extends Version, U extends Version> void registerVersionComparator(Class<T> t, Class<U> u, VersionComparator<T, U> comparator)
+ {
+ if (t == null || u == null)
+ throw new IllegalArgumentException("Null version class");
+
+ if (comparator == null)
+ {
+ Map<Class<? extends Version>, VersionComparator> tKeyMap = comparatorMap.get(t);
+ if (tKeyMap != null)
+ tKeyMap.remove(u);
+
+ // different impls
+ if (t.equals(u) == false)
+ {
+ Map<Class<? extends Version>, VersionComparator> uKeyMap = comparatorMap.get(u);
+ if (uKeyMap != null)
+ uKeyMap.remove(t);
+ }
+ }
+ else
+ {
+ Map<Class<? extends Version>, VersionComparator> tKeyMap = comparatorMap.get(t);
+ if (tKeyMap == null)
+ {
+ tKeyMap = new HashMap<Class<? extends Version>, VersionComparator>();
+ comparatorMap.put(t, tKeyMap);
+ }
+ tKeyMap.put(u, comparator);
+
+ // different impls
+ if (t.equals(u) == false)
+ {
+ Map<Class<? extends Version>, VersionComparator> uKeyMap = comparatorMap.get(u);
+ if (uKeyMap == null)
+ {
+ uKeyMap = new HashMap<Class<? extends Version>, VersionComparator>();
+ comparatorMap.put(u, uKeyMap);
+ }
+ uKeyMap.put(t, comparator);
+ }
+ }
+ }
+
+ /**
+ * Get the comparator.
+ *
+ * @param t first version impl
+ * @param u second version impl
+ * @return the matching comparator
+ */
+ @SuppressWarnings("unchecked")
+ protected <T extends Version, U extends Version> VersionComparator<T, U> getComparator(T t, U u)
+ {
+ return getComparator(t.getClass(), u.getClass());
+ }
+
+ /**
+ * Get the comparator.
+ *
+ * @param t first version impl class
+ * @param u second version impl class
+ * @return the matching comparator
+ */
+ @SuppressWarnings("unchecked")
+ protected VersionComparator getComparator(Class<? extends Version> t, Class<? extends Version> u)
+ {
+ Map<Class<? extends Version>, VersionComparator> map = comparatorMap.get(t);
+ if (map == null)
+ return null;
+ else
+ return map.get(u);
+ }
+
+ /**
+ * Compare two version impls.
+ *
+ * @param t T version impl
+ * @param u U version impl
+ * @return the compare result
+ */
+ public <T extends Version, U extends Version> int compare(T t, U u)
+ {
+ VersionComparator<T, U> comparator = getComparator(t, u);
+ if (comparator == null)
+ throw new IllegalArgumentException("Missing version comparator for Version impl pair: (" + t.getClass().getName() + "," + u.getClass().getName() + ")");
+
+ return comparator.compare(t, u);
+ }
+}
Modified: projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/classloading/VersionRange.java
===================================================================
--- projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/classloading/VersionRange.java 2008-01-21 01:00:19 UTC (rev 69153)
+++ projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/classloading/VersionRange.java 2008-01-21 01:54:52 UTC (rev 69154)
@@ -128,7 +128,7 @@
* @return true when the version is in range
* @throws IllegalArgumentException for a null version
*/
- public boolean isInRange(Version version)
+ public boolean isInRange(Version version)
{
if (version == null)
throw new IllegalArgumentException("Null version");
Modified: projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/classloading/helpers/VersionImpl.java
===================================================================
--- projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/classloading/helpers/VersionImpl.java 2008-01-21 01:00:19 UTC (rev 69153)
+++ projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/classloading/helpers/VersionImpl.java 2008-01-21 01:54:52 UTC (rev 69154)
@@ -21,60 +21,230 @@
*/
package org.jboss.deployers.structure.spi.classloading.helpers;
+import java.util.NoSuchElementException;
+import java.util.StringTokenizer;
+import java.util.regex.Pattern;
+
import org.jboss.deployers.structure.spi.classloading.Version;
/**
* VersionImpl.
- *
+ * OSGi kind of version impl.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
* @author <a href="adrian at jboss.com">Adrian Brock</a>
* @version $Revision: 1.1 $
*/
-public class VersionImpl implements Version
+public class VersionImpl extends Version
{
- /** The delegate */
- private org.osgi.framework.Version delegate;
-
+ private static final String SEPARATOR = ".";
+ private static Pattern QUALIFIER_PATTERN = Pattern.compile("[a-zA-Z0-9_-]*");
+
/**
- * Create a new VersionImpl.
- *
- * @param version the version - pass null for the default version
- * @throws IllegalArgumentException if the string does not conform to an OSGi version
+ * The empty version.
*/
+ private static final VersionImpl emptyVersion = new VersionImpl(0, 0, 0);
+
+ private int major;
+ private int minor;
+ private int micro;
+ private String qualifier;
+
+ public VersionImpl(int major, int minor, int micro)
+ {
+ this(major, minor, micro, null);
+ }
+
+ public VersionImpl(int major, int minor, int micro, String qualifier)
+ {
+ this.major = major;
+ this.minor = minor;
+ this.micro = micro;
+ if (qualifier == null)
+ qualifier = "";
+ this.qualifier = qualifier;
+ validate();
+ }
+
public VersionImpl(String version)
{
- delegate = org.osgi.framework.Version.parseVersion(version);
+ if (version == null)
+ throw new IllegalArgumentException("Null version");
+
+ int major = 0;
+ int minor = 0;
+ int micro = 0;
+ String qualifier = "";
+
+ try
+ {
+ StringTokenizer st = new StringTokenizer(version, SEPARATOR, true);
+ major = Integer.parseInt(st.nextToken());
+
+ if (st.hasMoreTokens())
+ {
+ st.nextToken();
+ minor = Integer.parseInt(st.nextToken());
+
+ if (st.hasMoreTokens())
+ {
+ st.nextToken();
+ micro = Integer.parseInt(st.nextToken());
+
+ if (st.hasMoreTokens())
+ {
+ st.nextToken();
+ qualifier = st.nextToken();
+
+ if (st.hasMoreTokens())
+ {
+ throw new IllegalArgumentException("invalid format");
+ }
+ }
+ }
+ }
+ }
+ catch (NoSuchElementException e)
+ {
+ throw new IllegalArgumentException("invalid format");
+ }
+
+ this.major = major;
+ this.minor = minor;
+ this.micro = micro;
+ this.qualifier = qualifier;
+ validate();
}
-
- public int compareTo(Version o)
+
+ /**
+ * Validate arguments.
+ */
+ protected void validate()
{
- if (o == this)
- return 0;
- if (o == null || o instanceof VersionImpl == false)
- throw new IllegalArgumentException("Not a version impl: " + o);
- VersionImpl other = (VersionImpl) o;
- return delegate.compareTo(other.delegate);
+ if (major < 0)
+ throw new IllegalArgumentException("negative major: " + major);
+ if (minor < 0)
+ throw new IllegalArgumentException("negative minor: " + minor);
+ if (micro < 0)
+ throw new IllegalArgumentException("negative micro: " + micro);
+ if (QUALIFIER_PATTERN.matcher(qualifier).matches() == false)
+ throw new IllegalArgumentException("invalid qualifier: " + qualifier);
}
-
- @Override
- public boolean equals(Object obj)
+
+ /**
+ * Parses a version identifier from the specified string.
+ * See <code>Version(String)</code> for the format of the version string.
+ *
+ * @param version String representation of the version identifier. Leading
+ * and trailing whitespace will be ignored.
+ * @return A <code>Version</code> object representing the version
+ * identifier. If <code>version</code> is <code>null</code> or
+ * the empty string then <code>emptyVersion</code> will be
+ * returned.
+ * @throws IllegalArgumentException If <code>version</code> is improperly
+ * formatted.
+ */
+ public static VersionImpl parseVersion(String version)
{
- if (obj == this)
- return true;
- if (obj == null || obj instanceof VersionImpl == false)
- return false;
- VersionImpl other = (VersionImpl) obj;
- return delegate.equals(other.delegate);
+ if (version == null)
+ return emptyVersion;
+
+ version = version.trim();
+ if (version.length() == 0)
+ return emptyVersion;
+
+ return new VersionImpl(version);
}
-
- @Override
- public int hashCode()
+
+ /**
+ * Returns the major component of this version identifier.
+ *
+ * @return The major component.
+ */
+ public int getMajor()
{
- return delegate.hashCode();
+ return major;
}
-
- @Override
+
+ /**
+ * Returns the minor component of this version identifier.
+ *
+ * @return The minor component.
+ */
+ public int getMinor()
+ {
+ return minor;
+ }
+
+ /**
+ * Returns the micro component of this version identifier.
+ *
+ * @return The micro component.
+ */
+ public int getMicro()
+ {
+ return micro;
+ }
+
+ /**
+ * Returns the qualifier component of this version identifier.
+ *
+ * @return The qualifier component.
+ */
+ public String getQualifier()
+ {
+ return qualifier;
+ }
+
public String toString()
{
- return delegate.toString();
+ StringBuilder builder = new StringBuilder();
+ builder.append(major).append(SEPARATOR).append(minor).append(SEPARATOR).append(micro);
+ if (qualifier.length() > 0)
+ builder.append(SEPARATOR).append(qualifier);
+ return builder.toString();
}
+
+ public int hashCode()
+ {
+ return (major << 24) + (minor << 16) + (micro << 8) + qualifier.hashCode();
+ }
+
+ public boolean equals(Object object)
+ {
+ if (object == this)
+ return true;
+
+ if (object instanceof VersionImpl == false)
+ return false;
+
+ VersionImpl other = (VersionImpl)object;
+ return (major == other.major) && (minor == other.minor) && (micro == other.micro) && qualifier.equals(other.qualifier);
+ }
+
+ /**
+ * Compare two VersionImpls.
+ *
+ * @param version the other version impl
+ * @return compare result
+ */
+ int compareTo(VersionImpl version)
+ {
+ if (version == this)
+ return 0;
+
+ int result = major - version.major;
+ if (result != 0)
+ return result;
+
+ result = minor - version.minor;
+ if (result != 0)
+ return result;
+
+ result = micro - version.micro;
+ if (result != 0)
+ return result;
+
+ return qualifier.compareTo(version.qualifier);
+ }
}
Added: projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/classloading/helpers/VersionImplComparator.java
===================================================================
--- projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/classloading/helpers/VersionImplComparator.java (rev 0)
+++ projects/microcontainer/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/classloading/helpers/VersionImplComparator.java 2008-01-21 01:54:52 UTC (rev 69154)
@@ -0,0 +1,37 @@
+/*
+* 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.structure.spi.classloading.helpers;
+
+import org.jboss.deployers.structure.spi.classloading.VersionComparator;
+
+/**
+ * VersionImpl comparator.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class VersionImplComparator implements VersionComparator<VersionImpl, VersionImpl>
+{
+ public int compare(VersionImpl v1, VersionImpl v2)
+ {
+ return v1.compareTo(v2);
+ }
+}
Modified: projects/microcontainer/trunk/deployers-structure-spi/src/tests/org/jboss/test/deployers/DeployersStructureTestSuite.java
===================================================================
--- projects/microcontainer/trunk/deployers-structure-spi/src/tests/org/jboss/test/deployers/DeployersStructureTestSuite.java 2008-01-21 01:00:19 UTC (rev 69153)
+++ projects/microcontainer/trunk/deployers-structure-spi/src/tests/org/jboss/test/deployers/DeployersStructureTestSuite.java 2008-01-21 01:54:52 UTC (rev 69154)
@@ -24,9 +24,9 @@
import junit.framework.Test;
import junit.framework.TestSuite;
import junit.textui.TestRunner;
-
import org.jboss.test.deployers.structure.attachments.StructureAttachmentsTestSuite;
import org.jboss.test.deployers.structure.structurebuilder.StructureBuilderTestSuite;
+import org.jboss.test.deployers.structure.version.test.VersionTestSuite;
/**
* Deployers Structure Test Suite.
@@ -47,6 +47,7 @@
suite.addTest(StructureAttachmentsTestSuite.suite());
suite.addTest(StructureBuilderTestSuite.suite());
+ suite.addTest(VersionTestSuite.suite());
return suite;
}
Added: projects/microcontainer/trunk/deployers-structure-spi/src/tests/org/jboss/test/deployers/structure/version/test/VersionComparatorRegistryTestCase.java
===================================================================
--- projects/microcontainer/trunk/deployers-structure-spi/src/tests/org/jboss/test/deployers/structure/version/test/VersionComparatorRegistryTestCase.java (rev 0)
+++ projects/microcontainer/trunk/deployers-structure-spi/src/tests/org/jboss/test/deployers/structure/version/test/VersionComparatorRegistryTestCase.java 2008-01-21 01:54:52 UTC (rev 69154)
@@ -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.structure.version.test;
+
+import junit.framework.Test;
+import org.jboss.test.BaseTestCase;
+
+/**
+ * Version comparator registry tests.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class VersionComparatorRegistryTestCase extends BaseTestCase
+{
+ public VersionComparatorRegistryTestCase(String name)
+ {
+ super(name);
+ }
+
+ public static Test suite()
+ {
+ return suite(VersionComparatorRegistryTestCase.class);
+ }
+
+ public void testRegisterComparator() throws Exception
+ {
+ // todo
+ }
+
+ public void testRemoveComparator() throws Exception
+ {
+ // todo
+ }
+
+ public void testGetComparator() throws Exception
+ {
+ // todo
+ }
+}
Added: projects/microcontainer/trunk/deployers-structure-spi/src/tests/org/jboss/test/deployers/structure/version/test/VersionComparatorTestCase.java
===================================================================
--- projects/microcontainer/trunk/deployers-structure-spi/src/tests/org/jboss/test/deployers/structure/version/test/VersionComparatorTestCase.java (rev 0)
+++ projects/microcontainer/trunk/deployers-structure-spi/src/tests/org/jboss/test/deployers/structure/version/test/VersionComparatorTestCase.java 2008-01-21 01:54:52 UTC (rev 69154)
@@ -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.structure.version.test;
+
+import junit.framework.Test;
+import org.jboss.test.BaseTestCase;
+
+/**
+ * Version comparator tests.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class VersionComparatorTestCase extends BaseTestCase
+{
+ public VersionComparatorTestCase(String name)
+ {
+ super(name);
+ }
+
+ public static Test suite()
+ {
+ return suite(VersionComparatorTestCase.class);
+ }
+
+ public void testSameImpl() throws Exception
+ {
+ // todo
+ }
+
+ public void testDifferentImpl() throws Exception
+ {
+ // todo
+ }
+}
Added: projects/microcontainer/trunk/deployers-structure-spi/src/tests/org/jboss/test/deployers/structure/version/test/VersionImplTestCase.java
===================================================================
--- projects/microcontainer/trunk/deployers-structure-spi/src/tests/org/jboss/test/deployers/structure/version/test/VersionImplTestCase.java (rev 0)
+++ projects/microcontainer/trunk/deployers-structure-spi/src/tests/org/jboss/test/deployers/structure/version/test/VersionImplTestCase.java 2008-01-21 01:54:52 UTC (rev 69154)
@@ -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.structure.version.test;
+
+import junit.framework.Test;
+import org.jboss.test.BaseTestCase;
+
+/**
+ * Version impl tests.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class VersionImplTestCase extends BaseTestCase
+{
+ public VersionImplTestCase(String name)
+ {
+ super(name);
+ }
+
+ public static Test suite()
+ {
+ return suite(VersionImplTestCase.class);
+ }
+
+ public void testSimpleVersion() throws Exception
+ {
+ // todo
+ }
+
+ public void testIllegalVersion() throws Exception
+ {
+ // todo
+ }
+
+ public void testCompareVersion() throws Exception
+ {
+ // todo
+ }
+}
Added: projects/microcontainer/trunk/deployers-structure-spi/src/tests/org/jboss/test/deployers/structure/version/test/VersionTestSuite.java
===================================================================
--- projects/microcontainer/trunk/deployers-structure-spi/src/tests/org/jboss/test/deployers/structure/version/test/VersionTestSuite.java (rev 0)
+++ projects/microcontainer/trunk/deployers-structure-spi/src/tests/org/jboss/test/deployers/structure/version/test/VersionTestSuite.java 2008-01-21 01:54:52 UTC (rev 69154)
@@ -0,0 +1,50 @@
+/*
+* 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.version.test;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import junit.textui.TestRunner;
+
+/**
+ * Version test suite.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class VersionTestSuite extends TestSuite
+{
+ public static void main(String[] args)
+ {
+ TestRunner.run(suite());
+ }
+
+ public static Test suite()
+ {
+ TestSuite suite = new TestSuite("Version Impl Tests");
+
+ suite.addTest(VersionImplTestCase.suite());
+ suite.addTest(VersionComparatorTestCase.suite());
+ suite.addTest(VersionComparatorRegistryTestCase.suite());
+
+ return suite;
+ }
+}
\ No newline at end of file
More information about the jboss-cvs-commits
mailing list