[jboss-cvs] JBossAS SVN: r76312 - in projects/microcontainer/trunk/kernel/src: main/org/jboss/beans/metadata/spi and 4 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Jul 28 12:59:04 EDT 2008
Author: alesj
Date: 2008-07-28 12:59:03 -0400 (Mon, 28 Jul 2008)
New Revision: 76312
Added:
projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/AbstractRelatedClassMetaData.java
projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/spi/RelatedClassMetaData.java
projects/microcontainer/trunk/kernel/src/resources/tests/org/jboss/test/kernel/deployment/xml/test/RelatedWithEnabled.xml
projects/microcontainer/trunk/kernel/src/resources/tests/org/jboss/test/kernel/deployment/xml/test/RelatedWithEnableds.xml
projects/microcontainer/trunk/kernel/src/resources/tests/org/jboss/test/kernel/deployment/xml/test/RelatedWithName.xml
projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/RelatedClassCloneTestCase.java
projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/RelatedClassJaxbTestCase.java
projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/RelatedClassTestCase.java
Modified:
projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/AbstractBeanMetaData.java
projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/spi/BeanMetaData.java
projects/microcontainer/trunk/kernel/src/resources/main/schema/bean-deployer_2_0.xsd
projects/microcontainer/trunk/kernel/src/resources/main/schema/jboss-beans-common_2_0.xsd
projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/container/plugin/GenericComponentFactory.java
projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/XMLTestSuite.java
Log:
Related class metadata.
Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/AbstractBeanMetaData.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/AbstractBeanMetaData.java 2008-07-28 16:36:00 UTC (rev 76311)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/AbstractBeanMetaData.java 2008-07-28 16:59:03 UTC (rev 76312)
@@ -50,6 +50,7 @@
import org.jboss.beans.metadata.spi.MetaDataVisitorNode;
import org.jboss.beans.metadata.spi.PropertyMetaData;
import org.jboss.beans.metadata.spi.SupplyMetaData;
+import org.jboss.beans.metadata.spi.RelatedClassMetaData;
import org.jboss.dependency.plugins.AbstractDependencyItem;
import org.jboss.dependency.spi.Controller;
import org.jboss.dependency.spi.ControllerContext;
@@ -68,13 +69,13 @@
/**
* Metadata for a bean.
*
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
* @author <a href="ales.justin at jboss.com">Ales Justin</a>
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
* @version $Revision$
*/
@ManagementObject(properties = ManagementProperties.EXPLICIT) // TODO - explicitly add props we want to manage
@XmlRootElement(name="bean")
- at XmlType(name="beanType", propOrder={"aliasMetaData", "annotations", "classLoader", "constructor", "properties", "create", "start", "stop", "destroy", "depends", "demands", "supplies", "installs", "uninstalls", "installCallbacks", "uninstallCallbacks"})
+ at XmlType(name="beanType", propOrder={"aliasMetaData", "related", "annotations", "classLoader", "constructor", "properties", "create", "start", "stop", "destroy", "depends", "demands", "supplies", "installs", "uninstalls", "installCallbacks", "uninstallCallbacks"})
public class AbstractBeanMetaData extends AbstractFeatureMetaData
implements BeanMetaData, BeanMetaDataFactory, MutableLifecycleHolder, Serializable
{
@@ -86,6 +87,9 @@
/** The name of this instance */
protected String name;
+ /** The related */
+ protected Set<RelatedClassMetaData> related;
+
/** The aliases */
protected Set<Object> aliases;
@@ -349,6 +353,17 @@
flushJBossObjectCache();
}
+ public Set<RelatedClassMetaData> getRelated()
+ {
+ return related;
+ }
+
+ @XmlElement(name="related-class", type=AbstractRelatedClassMetaData.class)
+ public void setRelated(Set<RelatedClassMetaData> related)
+ {
+ this.related = related;
+ }
+
public Set<Object> getAliases()
{
return aliases;
Copied: projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/AbstractRelatedClassMetaData.java (from rev 76244, projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/AbstractBeanMetaData.java)
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/AbstractRelatedClassMetaData.java (rev 0)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/AbstractRelatedClassMetaData.java 2008-07-28 16:59:03 UTC (rev 76312)
@@ -0,0 +1,119 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, 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.beans.metadata.plugins;
+
+import java.io.Serializable;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+import javax.xml.bind.annotation.XmlAnyElement;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.XmlValue;
+
+import org.jboss.beans.metadata.spi.RelatedClassMetaData;
+import org.jboss.util.JBossObject;
+import org.jboss.util.JBossStringBuilder;
+
+/**
+ * Metadata for a related classes.
+ *
+ * @author <a href="ales.justin at jboss.com">Ales Justin</a>
+ */
+ at XmlType(name="relatedClassType", propOrder={"enabled"})
+public class AbstractRelatedClassMetaData extends JBossObject implements RelatedClassMetaData, Serializable
+{
+ private static final long serialVersionUID = 1L;
+
+ private String className;
+ private Set<Object> enabled;
+
+ public String getClassName()
+ {
+ return className;
+ }
+
+ @XmlAttribute(name = "name")
+ public void setClassName(String className)
+ {
+ this.className = className;
+ }
+
+ public Set<Object> getEnabled()
+ {
+ return enabled;
+ }
+
+ @XmlAnyElement
+ public void setEnabled(Set<Object> enabled)
+ {
+ this.enabled = enabled;
+ }
+
+ @XmlValue
+ public void setEnabledValue(Object value)
+ {
+ this.enabled = Collections.singleton(value);
+ }
+
+ public <T> T getEnabled(Class<T> type)
+ {
+ if (type == null)
+ throw new IllegalArgumentException("Null type");
+
+ if (enabled == null || enabled.isEmpty())
+ return null;
+
+ for (Object element : enabled)
+ {
+ if (type.isInstance(element))
+ return type.cast(element);
+ }
+
+ return null;
+ }
+
+ protected void toString(JBossStringBuilder buffer)
+ {
+ buffer.append("name=").append(className);
+ buffer.append(", enabled=").append(enabled);
+ }
+
+ public void toShortString(JBossStringBuilder buffer)
+ {
+ buffer.append(className);
+ }
+
+ public AbstractRelatedClassMetaData clone()
+ {
+ AbstractRelatedClassMetaData clone = (AbstractRelatedClassMetaData)super.clone();
+ doClone(clone);
+ return clone;
+ }
+
+ @SuppressWarnings("unchecked")
+ protected void doClone(AbstractRelatedClassMetaData clone)
+ {
+ if (enabled != null)
+ clone.setEnabled(new HashSet<Object>(enabled));
+ }
+}
\ No newline at end of file
Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/spi/BeanMetaData.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/spi/BeanMetaData.java 2008-07-28 16:36:00 UTC (rev 76311)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/spi/BeanMetaData.java 2008-07-28 16:59:03 UTC (rev 76312)
@@ -33,6 +33,7 @@
* Metadata about a bean.
*
* @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @author <a href="ales.justin at jboss.com">Ales Justin</a>
* @version $Revision$
*/
public interface BeanMetaData extends FeatureMetaData, ValueMetaData
@@ -50,8 +51,15 @@
* @return the name
*/
String getName();
-
+
/**
+ * Get the related classes.
+ *
+ * @return the related classes
+ */
+ Set<RelatedClassMetaData> getRelated();
+
+ /**
* Set the name
*
* @param name the name
Copied: projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/spi/RelatedClassMetaData.java (from rev 76244, projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/spi/BeanMetaData.java)
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/spi/RelatedClassMetaData.java (rev 0)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/spi/RelatedClassMetaData.java 2008-07-28 16:59:03 UTC (rev 76312)
@@ -0,0 +1,55 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, 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.beans.metadata.spi;
+
+import java.util.Set;
+
+/**
+ * Metadata about a related class.
+ *
+ * @author <a href="ales.justin at jboss.com">Ales Justin</a>
+ */
+public interface RelatedClassMetaData
+{
+ /**
+ * Get the class name.
+ *
+ * @return the class name.
+ */
+ String getClassName();
+
+ /**
+ * Get the explictily enabled processing options.
+ *
+ * @return the enabled processing options
+ */
+ Set<Object> getEnabled();
+
+ /**
+ * Get the exact enabled processing option.
+ *
+ * @param <T> exact type
+ * @param type the type we are looking for
+ * @return exact type instance or null if no such match
+ */
+ <T> T getEnabled(Class<T> type);
+}
\ No newline at end of file
Modified: projects/microcontainer/trunk/kernel/src/resources/main/schema/bean-deployer_2_0.xsd
===================================================================
--- projects/microcontainer/trunk/kernel/src/resources/main/schema/bean-deployer_2_0.xsd 2008-07-28 16:36:00 UTC (rev 76311)
+++ projects/microcontainer/trunk/kernel/src/resources/main/schema/bean-deployer_2_0.xsd 2008-07-28 16:59:03 UTC (rev 76312)
@@ -113,6 +113,11 @@
<xsd:extension base="propertyType"/>
</xsd:complexContent>
</xsd:complexType>
+ <xsd:complexType name="relatedClassType">
+ <xsd:complexContent>
+ <xsd:extension base="relatedClassType"/>
+ </xsd:complexContent>
+ </xsd:complexType>
<xsd:complexType name="annotationType">
<xsd:complexContent>
<xsd:extension base="annotationType"/>
Modified: projects/microcontainer/trunk/kernel/src/resources/main/schema/jboss-beans-common_2_0.xsd
===================================================================
--- projects/microcontainer/trunk/kernel/src/resources/main/schema/jboss-beans-common_2_0.xsd 2008-07-28 16:36:00 UTC (rev 76311)
+++ projects/microcontainer/trunk/kernel/src/resources/main/schema/jboss-beans-common_2_0.xsd 2008-07-28 16:59:03 UTC (rev 76312)
@@ -28,6 +28,7 @@
<xsd:sequence>
<xsd:element name="annotation" type="annotationType" minOccurs="0" maxOccurs="unbounded"/>
<xsd:element name="alias" type="aliasType" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="related-class" type="relatedClassType" minOccurs="0" maxOccurs="unbounded"/>
<xsd:element name="classloader" type="classloaderType" minOccurs="0"/>
<xsd:element name="constructor" type="constructorType" minOccurs="0"/>
<xsd:element name="property" type="propertyType" minOccurs="0" maxOccurs="unbounded"/>
@@ -83,6 +84,7 @@
</xsd:annotation>
<xsd:sequence>
<xsd:element name="alias" type="aliasType" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="related-class" type="relatedClassType" minOccurs="0" maxOccurs="unbounded"/>
<xsd:element name="classloader" type="classloaderType" minOccurs="0"/>
<xsd:element name="constructor" type="constructorType" minOccurs="0"/>
<xsd:element name="property" type="propertyType" minOccurs="0" maxOccurs="unbounded"/>
@@ -526,6 +528,20 @@
</xsd:complexContent>
</xsd:complexType>
+ <xsd:complexType name="relatedClassType" mixed="true">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+ Related classes.
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:choice minOccurs="0" maxOccurs="unbounded">
+ <xsd:any namespace="##other" processContents="strict"/>
+ </xsd:choice>
+ <xsd:attribute name="name" type="xsd:string" use="required"/>
+ </xsd:complexType>
+
<xsd:complexType name="parameterType" mixed="true">
<xsd:annotation>
<xsd:documentation>
Added: projects/microcontainer/trunk/kernel/src/resources/tests/org/jboss/test/kernel/deployment/xml/test/RelatedWithEnabled.xml
===================================================================
--- projects/microcontainer/trunk/kernel/src/resources/tests/org/jboss/test/kernel/deployment/xml/test/RelatedWithEnabled.xml (rev 0)
+++ projects/microcontainer/trunk/kernel/src/resources/tests/org/jboss/test/kernel/deployment/xml/test/RelatedWithEnabled.xml 2008-07-28 16:59:03 UTC (rev 76312)
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<bean xmlns="urn:jboss:bean-deployer:2.0" class="Dummy">
+ <related-class name="java.lang.Object">aop</related-class>
+</bean>
Added: projects/microcontainer/trunk/kernel/src/resources/tests/org/jboss/test/kernel/deployment/xml/test/RelatedWithEnableds.xml
===================================================================
--- projects/microcontainer/trunk/kernel/src/resources/tests/org/jboss/test/kernel/deployment/xml/test/RelatedWithEnableds.xml (rev 0)
+++ projects/microcontainer/trunk/kernel/src/resources/tests/org/jboss/test/kernel/deployment/xml/test/RelatedWithEnableds.xml 2008-07-28 16:59:03 UTC (rev 76312)
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<bean xmlns="urn:jboss:bean-deployer:2.0" class="Dummy">
+ <related-class name="java.lang.Object">
+ <javabean xmlns="urn:jboss:javabean:1.0" class="java.util.Date"/>
+ <javabean xmlns="urn:jboss:javabean:1.0" class="java.lang.String"/>
+ </related-class>
+</bean>
Copied: projects/microcontainer/trunk/kernel/src/resources/tests/org/jboss/test/kernel/deployment/xml/test/RelatedWithName.xml (from rev 76244, projects/microcontainer/trunk/kernel/src/resources/tests/org/jboss/test/kernel/deployment/xml/test/Property.xml)
===================================================================
--- projects/microcontainer/trunk/kernel/src/resources/tests/org/jboss/test/kernel/deployment/xml/test/RelatedWithName.xml (rev 0)
+++ projects/microcontainer/trunk/kernel/src/resources/tests/org/jboss/test/kernel/deployment/xml/test/RelatedWithName.xml 2008-07-28 16:59:03 UTC (rev 76312)
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<bean xmlns="urn:jboss:bean-deployer:2.0" class="Dummy">
+ <related-class name="java.lang.Object"/>
+</bean>
Modified: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/container/plugin/GenericComponentFactory.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/container/plugin/GenericComponentFactory.java 2008-07-28 16:36:00 UTC (rev 76311)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/container/plugin/GenericComponentFactory.java 2008-07-28 16:59:03 UTC (rev 76312)
@@ -21,6 +21,7 @@
import org.jboss.beans.metadata.spi.MetaDataVisitorNode;
import org.jboss.beans.metadata.spi.PropertyMetaData;
import org.jboss.beans.metadata.spi.SupplyMetaData;
+import org.jboss.beans.metadata.spi.RelatedClassMetaData;
import org.jboss.dependency.spi.ControllerContext;
import org.jboss.dependency.spi.ControllerMode;
import org.jboss.dependency.spi.ErrorHandlingMode;
@@ -131,6 +132,10 @@
this.name = name;
this.bmd = bmd;
}
+ public Set<RelatedClassMetaData> getRelated()
+ {
+ return bmd.getRelated();
+ }
public Object clone()
{
return bmd.clone();
Copied: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/RelatedClassCloneTestCase.java (from rev 76304, projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/PropertyCloneTestCase.java)
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/RelatedClassCloneTestCase.java (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/RelatedClassCloneTestCase.java 2008-07-28 16:59:03 UTC (rev 76312)
@@ -0,0 +1,42 @@
+/*
+* 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.kernel.deployment.xml.test;
+
+import junit.framework.Test;
+
+/**
+ * PropertyCloneTestCase.
+ *
+ * @author <a href="ales.justin at jboss.com">Ales Justin</a>
+ */
+public class RelatedClassCloneTestCase extends RelatedClassTestCase
+{
+ public static Test suite()
+ {
+ return suite(RelatedClassCloneTestCase.class);
+ }
+
+ public RelatedClassCloneTestCase(String name)
+ {
+ super(name, true);
+ }
+}
\ No newline at end of file
Copied: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/RelatedClassJaxbTestCase.java (from rev 76304, projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/PropertyJaxbTestCase.java)
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/RelatedClassJaxbTestCase.java (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/RelatedClassJaxbTestCase.java 2008-07-28 16:59:03 UTC (rev 76312)
@@ -0,0 +1,82 @@
+/*
+* 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.kernel.deployment.xml.test;
+
+import java.util.Set;
+
+import org.jboss.beans.metadata.spi.RelatedClassMetaData;
+import org.jboss.beans.metadata.plugins.AbstractBeanMetaData;
+import junit.framework.Test;
+
+/**
+ * RelatedClassJaxbTestCase.
+ *
+ * @author <a href="ales.justin at jboss.com">Ales Justin</a>
+ */
+public class RelatedClassJaxbTestCase extends AbstractMCTest
+{
+ protected RelatedClassMetaData getRelated() throws Exception
+ {
+ AbstractBeanMetaData bean = unmarshalBean();
+ Set<RelatedClassMetaData> related = bean.getRelated();
+ assertNotNull(related);
+ assertEquals(1, related.size());
+ RelatedClassMetaData rcmd = related.iterator().next();
+ assertNotNull(rcmd);
+ return rcmd;
+ }
+
+ public void testRelatedWithName() throws Exception
+ {
+ RelatedClassMetaData related = getRelated();
+ assertEquals("java.lang.Object", related.getClassName());
+ }
+
+ public void testRelatedWithEnabled() throws Exception
+ {
+ RelatedClassMetaData related = getRelated();
+ assertEquals("java.lang.Object", related.getClassName());
+ Set<Object> enabled = related.getEnabled();
+ assertNotNull(enabled);
+ assertEquals(1, enabled.size());
+ assertEquals("aop", enabled.iterator().next());
+ }
+
+ public void testRelatedWithEnableds() throws Exception
+ {
+ RelatedClassMetaData related = getRelated();
+ assertEquals("java.lang.Object", related.getClassName());
+ Set<Object> enabled = related.getEnabled();
+ assertNotNull(enabled);
+ assertEquals(2, enabled.size());
+ }
+
+ public static Test suite()
+ {
+ return suite(RelatedClassJaxbTestCase.class);
+ }
+
+ public RelatedClassJaxbTestCase(String name)
+ {
+ super(name);
+ }
+}
\ No newline at end of file
Copied: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/RelatedClassTestCase.java (from rev 76244, projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/PropertyTestCase.java)
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/RelatedClassTestCase.java (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/RelatedClassTestCase.java 2008-07-28 16:59:03 UTC (rev 76312)
@@ -0,0 +1,87 @@
+/*
+* 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.kernel.deployment.xml.test;
+
+import java.util.Set;
+
+import junit.framework.Test;
+import org.jboss.beans.metadata.plugins.AbstractBeanMetaData;
+import org.jboss.beans.metadata.spi.RelatedClassMetaData;
+
+/**
+ * RelatedTestCase.
+ *
+ * @author <a href="ales.justin at jboss.com">Ales Justin</a>
+ */
+public class RelatedClassTestCase extends AbstractXMLTest
+{
+ protected RelatedClassMetaData getRelated(String name) throws Exception
+ {
+ AbstractBeanMetaData bean = unmarshalBean(name);
+ Set<RelatedClassMetaData> related = bean.getRelated();
+ assertNotNull(related);
+ assertEquals(1, related.size());
+ RelatedClassMetaData rcmd = related.iterator().next();
+ assertNotNull(rcmd);
+ return rcmd;
+ }
+
+ public void testRelatedWithName() throws Exception
+ {
+ RelatedClassMetaData related = getRelated("RelatedWithName.xml");
+ assertEquals("java.lang.Object", related.getClassName());
+ }
+
+ public void testRelatedWithEnabled() throws Exception
+ {
+ RelatedClassMetaData related = getRelated("RelatedWithEnabled.xml");
+ assertEquals("java.lang.Object", related.getClassName());
+ Set<Object> enabled = related.getEnabled();
+ assertNotNull(enabled);
+ assertEquals(1, enabled.size());
+ assertEquals("aop", enabled.iterator().next());
+ }
+
+ public void testRelatedWithEnableds() throws Exception
+ {
+ RelatedClassMetaData related = getRelated("RelatedWithEnableds.xml");
+ assertEquals("java.lang.Object", related.getClassName());
+ Set<Object> enabled = related.getEnabled();
+ assertNotNull(enabled);
+ assertEquals(2, enabled.size());
+ }
+
+ public static Test suite()
+ {
+ return suite(RelatedClassTestCase.class);
+ }
+
+ public RelatedClassTestCase(String name)
+ {
+ super(name);
+ }
+
+ protected RelatedClassTestCase(String name, boolean useClone)
+ {
+ super(name, useClone);
+ }
+}
\ No newline at end of file
Modified: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/XMLTestSuite.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/XMLTestSuite.java 2008-07-28 16:36:00 UTC (rev 76311)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/XMLTestSuite.java 2008-07-28 16:59:03 UTC (rev 76312)
@@ -50,6 +50,7 @@
suite.addTest(FactoryTestCase.suite());
suite.addTest(ParameterTestCase.suite());
suite.addTest(PropertyTestCase.suite());
+ suite.addTest(RelatedClassTestCase.suite());
suite.addTest(LifecycleTestCase.suite());
suite.addTest(DependencyTestCase.suite());
suite.addTest(DemandTestCase.suite());
@@ -80,6 +81,7 @@
suite.addTest(FactoryJaxbTestCase.suite());
suite.addTest(ParameterJaxbTestCase.suite());
suite.addTest(PropertyJaxbTestCase.suite());
+ suite.addTest(RelatedClassJaxbTestCase.suite());
suite.addTest(LifecycleJaxbTestCase.suite());
suite.addTest(DependencyJaxbTestCase.suite());
suite.addTest(DemandJaxbTestCase.suite());
@@ -103,6 +105,7 @@
suite.addTest(FactoryCloneTestCase.suite());
suite.addTest(ParameterCloneTestCase.suite());
suite.addTest(PropertyCloneTestCase.suite());
+ suite.addTest(RelatedClassCloneTestCase.suite());
suite.addTest(LifecycleCloneTestCase.suite());
suite.addTest(DependencyCloneTestCase.suite());
suite.addTest(DemandCloneTestCase.suite());
More information about the jboss-cvs-commits
mailing list