[jboss-cvs] JBossAS SVN: r64517 - in projects/microcontainer/trunk: kernel/src/main/org/jboss/beans/metadata/plugins and 11 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Aug 9 03:30:17 EDT 2007
Author: alesj
Date: 2007-08-09 03:30:17 -0400 (Thu, 09 Aug 2007)
New Revision: 64517
Added:
projects/microcontainer/trunk/kernel/src/resources/tests/org/jboss/test/kernel/deployment/test/IgnoredFactoryLifecycleTestCase.xml
projects/microcontainer/trunk/kernel/src/resources/tests/xml-test/org/jboss/test/kernel/dependency/test/testCallbackCorrectOrderCollection0.xml
projects/microcontainer/trunk/kernel/src/resources/tests/xml-test/org/jboss/test/kernel/dependency/test/testCallbackReinstallCollection0.xml
projects/microcontainer/trunk/kernel/src/resources/tests/xml-test/org/jboss/test/kernel/dependency/test/testCallbackWrongOrderCollection0.xml
projects/microcontainer/trunk/kernel/src/resources/tests/xml-test/org/jboss/test/kernel/dependency/test/testCardinalityCallbackCorrectOrderCollection0.xml
projects/microcontainer/trunk/kernel/src/resources/tests/xml-test/org/jboss/test/kernel/dependency/test/testCardinalityCallbackReinstallCollection0.xml
projects/microcontainer/trunk/kernel/src/resources/tests/xml-test/org/jboss/test/kernel/dependency/test/testCardinalityCallbackWrongOrderCollection0.xml
projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/support/CallbackCollectionCardinalitySimpleBeanRepository.java
projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/support/CallbackCollectionSimpleBeanRepository.java
projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/test/CallbackCollectionAnnotationTestCase.java
projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/test/CallbackCollectionTestCase.java
projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/test/CallbackCollectionXMLTestCase.java
projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/IgnoredFactoryLifecycleTestCase.java
Modified:
projects/microcontainer/trunk/container/src/main/org/jboss/beans/info/plugins/AbstractBeanInfoFactory.java
projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/CallbackCreatorUtil.java
projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/factory/GenericBeanFactory.java
projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/BasicBeanAnnotationAdapter.java
projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/dependency/CollectionCallbackItem.java
projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/deployment/xml/BeanSchemaBindingHelper.java
projects/microcontainer/trunk/kernel/src/resources/main/schema/bean-deployer_2_0.xsd
projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/support/SimpleBeanRepository.java
projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/test/CallbackTestCase.java
projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/test/DependencyTestSuite.java
projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/test/OldAbstractKernelDependencyTest.java
projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/DeploymentTestSuite.java
projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/IgnoredLifecycleTestCase.java
projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/BeanFactoryTestCase.java
Log:
Added CallbackCollection tests.
Applied isIgnored to BeanFactory lifecycles.
Removed BeanFactory callbacks - since they don't make sense on GenericBeanFactory.
Removed duplicated method lookup in BasicBeanAnnotationAdapter.
Added TODO on PropertyInfo type choice in AbstractBeanInfoFactory.
Modified: projects/microcontainer/trunk/container/src/main/org/jboss/beans/info/plugins/AbstractBeanInfoFactory.java
===================================================================
--- projects/microcontainer/trunk/container/src/main/org/jboss/beans/info/plugins/AbstractBeanInfoFactory.java 2007-08-08 23:00:30 UTC (rev 64516)
+++ projects/microcontainer/trunk/container/src/main/org/jboss/beans/info/plugins/AbstractBeanInfoFactory.java 2007-08-09 07:30:17 UTC (rev 64517)
@@ -290,8 +290,8 @@
merged.add(annotation);
annotations = merged.toArray(new AnnotationValue[merged.size()]);
}
-
- properties.add(new AbstractPropertyInfo(lowerName, name, getter.getReturnType(), getter, setter, annotations));
+ TypeInfo type = getPropertyType(getter, setter);
+ properties.add(new AbstractPropertyInfo(lowerName, name, type, getter, setter, annotations));
}
}
if (setters.isEmpty() == false)
@@ -312,8 +312,25 @@
}
return properties;
}
-
+
/**
+ * Determine the type of PropertyInfo.
+ *
+ * @param getter the getter
+ * @param setter the setter
+ * @return property type
+ */
+ protected TypeInfo getPropertyType(MethodInfo getter, MethodInfo setter)
+ {
+ if (getter == null)
+ throw new IllegalArgumentException("Getter should not be null!");
+ if (setter == null)
+ return getter.getReturnType();
+ // TODO - determine more restrictive type among getter and setter
+ return getter.getReturnType();
+ }
+
+ /**
* Get the properties for an annotation
*
* @param methods the methods
Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/CallbackCreatorUtil.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/CallbackCreatorUtil.java 2007-08-08 23:00:30 UTC (rev 64516)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/CallbackCreatorUtil.java 2007-08-09 07:30:17 UTC (rev 64517)
@@ -80,13 +80,15 @@
ControllerState dependentState,
Cardinality cardinality)
{
- if (info instanceof ClassInfo && ((ClassInfo)info).getActualTypeArguments() != null)
+ if (info instanceof ClassInfo)
{
ClassInfo ci = (ClassInfo)info;
- TypeInfo[] typeInfos = ci.getActualTypeArguments();
- if (typeInfos.length != 1)
- throw new IllegalArgumentException("Illegal size of actual type arguments: " + info);
- Class clazz = typeInfos[0].getType();
+ TypeInfo componentType = ci.getComponentType();
+ if (componentType == null)
+ throw new IllegalArgumentException("Null component type: " + info);
+ Class clazz = componentType.getType();
+ if (Object.class.equals(clazz))
+ throw new IllegalArgumentException("Component type too general - equals Object: " + info);
return getCollectionFactory().createCollectionCallbackItem(info.getType(), clazz, whenRequired, dependentState, cardinality, context, attribute);
}
else
@@ -119,10 +121,7 @@
else if (ai.isProperty())
return new ClassAttributeCallbackItem(info.getType(), whenRequired, dependentState, cardinality, context, ai.getName());
else
- {
- Class clazz = info.getType();
- return new ClassSingleCallbackItem(clazz, whenRequired, dependentState, cardinality, context, ai.getName(), clazz.getName());
- }
+ return new ClassSingleCallbackItem(info.getType(), whenRequired, dependentState, cardinality, context, ai.getName(), info.getName());
}
/**
Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/factory/GenericBeanFactory.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/factory/GenericBeanFactory.java 2007-08-08 23:00:30 UTC (rev 64516)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/factory/GenericBeanFactory.java 2007-08-09 07:30:17 UTC (rev 64517)
@@ -244,23 +244,26 @@
*/
protected void invokeLifecycle(String methodName, LifecycleMetaData lifecycle, BeanInfo info, ClassLoader cl, Object target) throws Throwable
{
- String method = methodName;
- if (lifecycle != null && lifecycle.getMethodName() != null)
- method = lifecycle.getMethodName();
- List<ParameterMetaData> parameters = null;
- if (lifecycle != null)
- parameters = lifecycle.getParameters();
- MethodJoinpoint joinpoint;
- try
+ if (lifecycle == null || lifecycle.isIgnored() == false)
{
- joinpoint = configurator.getMethodJoinPoint(info, cl, method, parameters, false, true);
+ String method = methodName;
+ if (lifecycle != null && lifecycle.getMethodName() != null)
+ method = lifecycle.getMethodName();
+ List<ParameterMetaData> parameters = null;
+ if (lifecycle != null)
+ parameters = lifecycle.getParameters();
+ MethodJoinpoint joinpoint;
+ try
+ {
+ joinpoint = configurator.getMethodJoinPoint(info, cl, method, parameters, false, true);
+ }
+ catch (JoinpointException ignored)
+ {
+ return;
+ }
+ joinpoint.setTarget(target);
+ joinpoint.dispatch();
}
- catch (JoinpointException ignored)
- {
- return;
- }
- joinpoint.setTarget(target);
- joinpoint.dispatch();
}
}
\ No newline at end of file
Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/BasicBeanAnnotationAdapter.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/BasicBeanAnnotationAdapter.java 2007-08-08 23:00:30 UTC (rev 64516)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/BasicBeanAnnotationAdapter.java 2007-08-09 07:30:17 UTC (rev 64517)
@@ -186,6 +186,7 @@
}
// properties
+ Set<MethodInfo> visitedMethods = new HashSet<MethodInfo>();
Set<PropertyInfo> properties = info.getProperties();
if (properties != null && properties.isEmpty() == false)
{
@@ -194,6 +195,7 @@
MethodInfo setter = pi.getSetter();
if (setter != null)
{
+ visitedMethods.add(setter);
Signature sis = new MethodSignature(setter.getName(), Configurator.getParameterTypes(trace, setter.getParameterTypes()));
MetaDataRetrieval cmdr = retrieval.getComponentMetaDataRetrieval(sis);
if (cmdr != null)
@@ -211,12 +213,15 @@
{
for(MethodInfo mi : methods)
{
- Signature mis = new MethodSignature(mi.getName(), Configurator.getParameterTypes(trace, mi.getParameterTypes()));
- MetaDataRetrieval cmdr = retrieval.getComponentMetaDataRetrieval(mis);
- if (cmdr != null)
+ if (visitedMethods.contains(mi) == false)
{
- for(AnnotationPlugin plugin : methodAnnotationPlugins)
- plugin.applyAnnotation(mi, cmdr, visitor);
+ Signature mis = new MethodSignature(mi.getName(), Configurator.getParameterTypes(trace, mi.getParameterTypes()));
+ MetaDataRetrieval cmdr = retrieval.getComponentMetaDataRetrieval(mis);
+ if (cmdr != null)
+ {
+ for(AnnotationPlugin plugin : methodAnnotationPlugins)
+ plugin.applyAnnotation(mi, cmdr, visitor);
+ }
}
}
}
Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/dependency/CollectionCallbackItem.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/dependency/CollectionCallbackItem.java 2007-08-08 23:00:30 UTC (rev 64516)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/dependency/CollectionCallbackItem.java 2007-08-09 07:30:17 UTC (rev 64517)
@@ -112,7 +112,9 @@
public void ownerCallback(Controller controller, boolean isInstallPhase) throws Throwable
{
- execute(fillHolder(controller));
+ // fill or just push in empty
+ T holder = isInstallPhase ? fillHolder(controller) : getCollectionParameterHolder();
+ execute(holder);
}
public void changeCallback(Controller controller, ControllerContext context, boolean isInstallPhase) throws Throwable
Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/deployment/xml/BeanSchemaBindingHelper.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/deployment/xml/BeanSchemaBindingHelper.java 2007-08-08 23:00:30 UTC (rev 64516)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/deployment/xml/BeanSchemaBindingHelper.java 2007-08-09 07:30:17 UTC (rev 64517)
@@ -166,11 +166,13 @@
// bean factory has uninstalls
beanFactoryType.pushInterceptor(BeanSchemaBinding20.uninstallQName, BeanUninstallInterceptor.INTERCEPTOR);
+/*
// bean has installs
beanFactoryType.pushInterceptor(BeanSchemaBinding20.installCallbackQName, BeanInstallCallbackInterceptor.INTERCEPTOR);
// bean has uninstalls
beanFactoryType.pushInterceptor(BeanSchemaBinding20.uninstallCallbackQName, BeanUninstallCallbackInterceptor.INTERCEPTOR);
+*/
// bean factory has depends
beanFactoryType.pushInterceptor(BeanSchemaBinding20.dependsQName, BeanDependsInterceptor.INTERCEPTOR);
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 2007-08-08 23:00:30 UTC (rev 64516)
+++ projects/microcontainer/trunk/kernel/src/resources/main/schema/bean-deployer_2_0.xsd 2007-08-09 07:30:17 UTC (rev 64517)
@@ -174,8 +174,10 @@
<xsd:element name="supply" type="supplyType" minOccurs="0" maxOccurs="unbounded"/>
<xsd:element name="install" type="installType" minOccurs="0" maxOccurs="unbounded"/>
<xsd:element name="uninstall" type="installType" minOccurs="0" maxOccurs="unbounded"/>
+<!--
<xsd:element name="incallback" type="callbackType" minOccurs="0" maxOccurs="unbounded"/>
<xsd:element name="uncallback" type="callbackType" minOccurs="0" maxOccurs="unbounded"/>
+-->
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="optional"/>
<xsd:attribute name="class" type="xsd:token" use="required"/>
Added: projects/microcontainer/trunk/kernel/src/resources/tests/org/jboss/test/kernel/deployment/test/IgnoredFactoryLifecycleTestCase.xml
===================================================================
--- projects/microcontainer/trunk/kernel/src/resources/tests/org/jboss/test/kernel/deployment/test/IgnoredFactoryLifecycleTestCase.xml (rev 0)
+++ projects/microcontainer/trunk/kernel/src/resources/tests/org/jboss/test/kernel/deployment/test/IgnoredFactoryLifecycleTestCase.xml 2007-08-09 07:30:17 UTC (rev 64517)
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+ <beanfactory name="LifecycleBean1" class="org.jboss.test.kernel.deployment.support.IgnoredLifecycleBean">
+ <create ignored="true"/>
+ <start ignored="true"/>
+ </beanfactory>
+
+ <beanfactory name="LifecycleBean2" class="org.jboss.test.kernel.deployment.support.IgnoredLifecycleBean">
+ <create ignored="true"/>
+ </beanfactory>
+
+ <beanfactory name="LifecycleBean3" class="org.jboss.test.kernel.deployment.support.IgnoredLifecycleBean">
+ <start ignored="true"/>
+ </beanfactory>
+
+ <beanfactory name="LifecycleBean4" class="org.jboss.test.kernel.deployment.support.IgnoredLifecycleBean" />
+
+</deployment>
Added: projects/microcontainer/trunk/kernel/src/resources/tests/xml-test/org/jboss/test/kernel/dependency/test/testCallbackCorrectOrderCollection0.xml
===================================================================
--- projects/microcontainer/trunk/kernel/src/resources/tests/xml-test/org/jboss/test/kernel/dependency/test/testCallbackCorrectOrderCollection0.xml (rev 0)
+++ projects/microcontainer/trunk/kernel/src/resources/tests/xml-test/org/jboss/test/kernel/dependency/test/testCallbackCorrectOrderCollection0.xml 2007-08-09 07:30:17 UTC (rev 64517)
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<deployment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="urn:jboss:bean-deployer:2.0 bean-deployer_2_0.xsd"
+ xmlns="urn:jboss:bean-deployer:2.0">
+ <bean name="Name1" class="org.jboss.test.kernel.dependency.support.SimpleBeanRepository">
+ <incallback method="setBeans"/>
+ <uncallback method="setBeans"/>
+ </bean>
+</deployment>
Added: projects/microcontainer/trunk/kernel/src/resources/tests/xml-test/org/jboss/test/kernel/dependency/test/testCallbackReinstallCollection0.xml
===================================================================
--- projects/microcontainer/trunk/kernel/src/resources/tests/xml-test/org/jboss/test/kernel/dependency/test/testCallbackReinstallCollection0.xml (rev 0)
+++ projects/microcontainer/trunk/kernel/src/resources/tests/xml-test/org/jboss/test/kernel/dependency/test/testCallbackReinstallCollection0.xml 2007-08-09 07:30:17 UTC (rev 64517)
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<deployment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="urn:jboss:bean-deployer:2.0 bean-deployer_2_0.xsd"
+ xmlns="urn:jboss:bean-deployer:2.0">
+ <bean name="Name1" class="org.jboss.test.kernel.dependency.support.SimpleBeanRepository">
+ <incallback method="setBeans"/>
+ <uncallback method="setBeans"/>
+ </bean>
+</deployment>
Added: projects/microcontainer/trunk/kernel/src/resources/tests/xml-test/org/jboss/test/kernel/dependency/test/testCallbackWrongOrderCollection0.xml
===================================================================
--- projects/microcontainer/trunk/kernel/src/resources/tests/xml-test/org/jboss/test/kernel/dependency/test/testCallbackWrongOrderCollection0.xml (rev 0)
+++ projects/microcontainer/trunk/kernel/src/resources/tests/xml-test/org/jboss/test/kernel/dependency/test/testCallbackWrongOrderCollection0.xml 2007-08-09 07:30:17 UTC (rev 64517)
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<deployment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="urn:jboss:bean-deployer:2.0 bean-deployer_2_0.xsd"
+ xmlns="urn:jboss:bean-deployer:2.0">
+ <bean name="Name1" class="org.jboss.test.kernel.dependency.support.SimpleBeanRepository">
+ <incallback method="setBeans"/>
+ <uncallback method="setBeans"/>
+ </bean>
+</deployment>
Added: projects/microcontainer/trunk/kernel/src/resources/tests/xml-test/org/jboss/test/kernel/dependency/test/testCardinalityCallbackCorrectOrderCollection0.xml
===================================================================
--- projects/microcontainer/trunk/kernel/src/resources/tests/xml-test/org/jboss/test/kernel/dependency/test/testCardinalityCallbackCorrectOrderCollection0.xml (rev 0)
+++ projects/microcontainer/trunk/kernel/src/resources/tests/xml-test/org/jboss/test/kernel/dependency/test/testCardinalityCallbackCorrectOrderCollection0.xml 2007-08-09 07:30:17 UTC (rev 64517)
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<deployment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="urn:jboss:bean-deployer:2.0 bean-deployer_1_0.xsd"
+ xmlns="urn:jboss:bean-deployer:2.0">
+ <bean name="Name1" class="org.jboss.test.kernel.dependency.support.SimpleBeanRepository">
+ <incallback method="setBeans" cardinality="2..n"/>
+ <uncallback method="setBeans"/>
+ </bean>
+</deployment>
Added: projects/microcontainer/trunk/kernel/src/resources/tests/xml-test/org/jboss/test/kernel/dependency/test/testCardinalityCallbackReinstallCollection0.xml
===================================================================
--- projects/microcontainer/trunk/kernel/src/resources/tests/xml-test/org/jboss/test/kernel/dependency/test/testCardinalityCallbackReinstallCollection0.xml (rev 0)
+++ projects/microcontainer/trunk/kernel/src/resources/tests/xml-test/org/jboss/test/kernel/dependency/test/testCardinalityCallbackReinstallCollection0.xml 2007-08-09 07:30:17 UTC (rev 64517)
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<deployment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="urn:jboss:bean-deployer:2.0 bean-deployer_1_0.xsd"
+ xmlns="urn:jboss:bean-deployer:2.0">
+ <bean name="Name1" class="org.jboss.test.kernel.dependency.support.SimpleBeanRepository">
+ <incallback method="setBeans" cardinality="2..n"/>
+ <uncallback method="setBeans"/>
+ </bean>
+</deployment>
Added: projects/microcontainer/trunk/kernel/src/resources/tests/xml-test/org/jboss/test/kernel/dependency/test/testCardinalityCallbackWrongOrderCollection0.xml
===================================================================
--- projects/microcontainer/trunk/kernel/src/resources/tests/xml-test/org/jboss/test/kernel/dependency/test/testCardinalityCallbackWrongOrderCollection0.xml (rev 0)
+++ projects/microcontainer/trunk/kernel/src/resources/tests/xml-test/org/jboss/test/kernel/dependency/test/testCardinalityCallbackWrongOrderCollection0.xml 2007-08-09 07:30:17 UTC (rev 64517)
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<deployment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="urn:jboss:bean-deployer:2.0 bean-deployer_1_0.xsd"
+ xmlns="urn:jboss:bean-deployer:2.0">
+ <bean name="Name1" class="org.jboss.test.kernel.dependency.support.SimpleBeanRepository">
+ <incallback method="setBeans" cardinality="2..n"/>
+ <uncallback method="setBeans"/>
+ </bean>
+</deployment>
Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/support/CallbackCollectionCardinalitySimpleBeanRepository.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/support/CallbackCollectionCardinalitySimpleBeanRepository.java (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/support/CallbackCollectionCardinalitySimpleBeanRepository.java 2007-08-09 07:30:17 UTC (rev 64517)
@@ -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.test.kernel.dependency.support;
+
+import java.util.List;
+
+import org.jboss.beans.metadata.plugins.annotations.Install;
+import org.jboss.beans.metadata.plugins.annotations.Uninstall;
+
+public class CallbackCollectionCardinalitySimpleBeanRepository extends SimpleBeanRepository
+{
+ @Install(cardinality = "2..n")
+ @Uninstall
+ public void setBeans(List<SimpleBean> beans)
+ {
+ super.setBeans(beans);
+ }
+}
Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/support/CallbackCollectionSimpleBeanRepository.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/support/CallbackCollectionSimpleBeanRepository.java (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/support/CallbackCollectionSimpleBeanRepository.java 2007-08-09 07:30:17 UTC (rev 64517)
@@ -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.test.kernel.dependency.support;
+
+import java.util.List;
+
+import org.jboss.beans.metadata.plugins.annotations.Install;
+import org.jboss.beans.metadata.plugins.annotations.Uninstall;
+
+public class CallbackCollectionSimpleBeanRepository extends SimpleBeanRepository
+{
+ @Install
+ @Uninstall
+ public void setBeans(List<SimpleBean> beans)
+ {
+ super.setBeans(beans);
+ }
+}
Modified: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/support/SimpleBeanRepository.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/support/SimpleBeanRepository.java 2007-08-08 23:00:30 UTC (rev 64516)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/support/SimpleBeanRepository.java 2007-08-09 07:30:17 UTC (rev 64517)
@@ -28,11 +28,16 @@
{
List<SimpleBean> beans = new ArrayList<SimpleBean>();
- public List getBeans()
+ public List<SimpleBean> getBeans()
{
return beans;
}
-
+
+ public void setBeans(List<SimpleBean> beans)
+ {
+ this.beans = beans;
+ }
+
public void addSimpleBean(SimpleBean bean)
{
beans.add(bean);
Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/test/CallbackCollectionAnnotationTestCase.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/test/CallbackCollectionAnnotationTestCase.java (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/test/CallbackCollectionAnnotationTestCase.java 2007-08-09 07:30:17 UTC (rev 64517)
@@ -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.kernel.dependency.test;
+
+import junit.framework.Test;
+import org.jboss.beans.metadata.plugins.AbstractBeanMetaData;
+import org.jboss.dependency.spi.Cardinality;
+import org.jboss.test.kernel.dependency.support.CallbackCollectionCardinalitySimpleBeanRepository;
+import org.jboss.test.kernel.dependency.support.CallbackCollectionSimpleBeanRepository;
+
+/**
+ * Callback tests.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class CallbackCollectionAnnotationTestCase extends CallbackTestCase
+{
+ public CallbackCollectionAnnotationTestCase(String name)
+ throws Throwable
+ {
+ super(name);
+ }
+
+ public static Test suite()
+ {
+ return suite(CallbackCollectionAnnotationTestCase.class);
+ }
+
+ protected AbstractBeanMetaData buildRepository(Cardinality cardinality)
+ {
+ Class clazz = cardinality != null ? CallbackCollectionCardinalitySimpleBeanRepository.class : CallbackCollectionSimpleBeanRepository.class;
+ return new AbstractBeanMetaData("Name1", clazz.getName());
+ }
+}
Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/test/CallbackCollectionTestCase.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/test/CallbackCollectionTestCase.java (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/test/CallbackCollectionTestCase.java 2007-08-09 07:30:17 UTC (rev 64517)
@@ -0,0 +1,76 @@
+/*
+* 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.dependency.test;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import junit.framework.Test;
+import org.jboss.beans.metadata.plugins.AbstractBeanMetaData;
+import org.jboss.beans.metadata.plugins.InstallCallbackMetaData;
+import org.jboss.beans.metadata.plugins.UninstallCallbackMetaData;
+import org.jboss.beans.metadata.spi.CallbackMetaData;
+import org.jboss.dependency.spi.Cardinality;
+import org.jboss.test.kernel.dependency.support.SimpleBeanRepository;
+
+/**
+ * Callback collection tests.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class CallbackCollectionTestCase extends CallbackTestCase
+{
+ public CallbackCollectionTestCase(String name)
+ throws Throwable
+ {
+ super(name);
+ }
+
+ public CallbackCollectionTestCase(String name, boolean xmltest)
+ throws Throwable
+ {
+ super(name, xmltest);
+ }
+
+ public static Test suite()
+ {
+ return suite(CallbackCollectionTestCase.class);
+ }
+
+ protected AbstractBeanMetaData buildRepository(Cardinality cardinality)
+ {
+ AbstractBeanMetaData repository = new AbstractBeanMetaData("Name1", SimpleBeanRepository.class.getName());
+ List<CallbackMetaData> installs = new ArrayList<CallbackMetaData>();
+ repository.setInstallCallbacks(installs);
+ InstallCallbackMetaData install = new InstallCallbackMetaData();
+ install.setMethodName("setBeans");
+ if (cardinality != null)
+ install.setCardinality(cardinality);
+ installs.add(install);
+ List<CallbackMetaData> unstalls = new ArrayList<CallbackMetaData>();
+ repository.setUninstallCallbacks(unstalls);
+ UninstallCallbackMetaData uninstall = new UninstallCallbackMetaData();
+ uninstall.setMethodName("setBeans");
+ unstalls.add(uninstall);
+ return repository;
+ }
+}
Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/test/CallbackCollectionXMLTestCase.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/test/CallbackCollectionXMLTestCase.java (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/test/CallbackCollectionXMLTestCase.java 2007-08-09 07:30:17 UTC (rev 64517)
@@ -0,0 +1,52 @@
+/*
+* 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.dependency.test;
+
+import junit.framework.Test;
+
+/**
+ * Callback tests.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class CallbackCollectionXMLTestCase extends CallbackTestCase
+{
+ public CallbackCollectionXMLTestCase(String name)
+ throws Throwable
+ {
+ super(name, true);
+ }
+
+ public static Test suite()
+ {
+ return suite(CallbackCollectionXMLTestCase.class);
+ }
+
+ protected String createName(int number)
+ {
+ String name = super.createName(number);
+ if (number != 0)
+ return name;
+
+ return name.replaceFirst("0.xml", "Collection0.xml");
+ }
+}
Modified: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/test/CallbackTestCase.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/test/CallbackTestCase.java 2007-08-08 23:00:30 UTC (rev 64516)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/test/CallbackTestCase.java 2007-08-09 07:30:17 UTC (rev 64517)
@@ -68,16 +68,15 @@
ControllerContext context1 = assertInstall(0, "Name1");
SimpleBeanRepository repository = (SimpleBeanRepository)context1.getTarget();
assertNotNull(repository);
- List beans = repository.getBeans();
- assertEmpty(beans);
+ assertEmpty(repository.getBeans());
ControllerContext context2 = assertInstall(1, "Name2");
SimpleBean bean = (SimpleBean)context2.getTarget();
assertNotNull(bean);
- assertFalse(beans.isEmpty());
- assertEquals(1, beans.size());
- assertTrue(bean == beans.get(0));
+ assertFalse(repository.getBeans().isEmpty());
+ assertEquals(1, repository.getBeans().size());
+ assertTrue(bean == repository.getBeans().get(0));
}
protected void callbackCorrectOrder() throws Throwable
@@ -114,32 +113,30 @@
ControllerContext context1 = assertInstall(0, "Name1");
SimpleBeanRepository repository = (SimpleBeanRepository)context1.getTarget();
assertNotNull(repository);
- List beans = repository.getBeans();
- assertEmpty(beans);
+ assertEmpty(repository.getBeans());
ControllerContext context2 = assertInstall(1, "Name2");
SimpleBean bean = (SimpleBean)context2.getTarget();
assertNotNull(bean);
- assertFalse(beans.isEmpty());
- assertEquals(1, beans.size());
- assertTrue(bean == beans.get(0));
+ assertFalse(repository.getBeans().isEmpty());
+ assertEquals(1, repository.getBeans().size());
+ assertTrue(bean == repository.getBeans().get(0));
assertUninstall("Name1");
assertEquals(ControllerState.ERROR, context1.getState());
- assertEmpty(beans);
+ assertEmpty(repository.getBeans());
context1 = assertInstall(0, "Name1");
repository = (SimpleBeanRepository)context1.getTarget();
assertNotNull(repository);
- beans = repository.getBeans();
- assertFalse(beans.isEmpty());
- assertEquals(1, beans.size());
- assertTrue(bean == beans.get(0));
+ assertFalse(repository.getBeans().isEmpty());
+ assertEquals(1, repository.getBeans().size());
+ assertTrue(bean == repository.getBeans().get(0));
assertUninstall("Name2");
assertEquals(ControllerState.ERROR, context2.getState());
- assertEmpty(beans);
+ assertEmpty(repository.getBeans());
}
protected void callbackReinstall() throws Throwable
@@ -154,26 +151,25 @@
ControllerContext context1 = assertInstall(0, "Name1", ControllerState.INSTANTIATED);
SimpleBeanRepository repository = (SimpleBeanRepository)context1.getTarget();
assertNotNull(repository);
- List beans = repository.getBeans();
- assertEmpty(beans);
+ assertEmpty(repository.getBeans());
ControllerContext context2 = assertInstall(1, "Name2");
SimpleBean bean1 = (SimpleBean)context2.getTarget();
assertNotNull(bean1);
- assertEmpty(beans);
+ assertEmpty(repository.getBeans());
ControllerContext context3 = assertInstall(2, "Name3");
SimpleBean bean2 = (SimpleBean)context3.getTarget();
assertNotNull(bean2);
assertEquals(ControllerState.INSTALLED, context1.getState());
- assertFalse(beans.isEmpty());
- assertEquals(2, beans.size());
- boolean first = bean1 == beans.get(0);
+ assertFalse(repository.getBeans().isEmpty());
+ assertEquals(2, repository.getBeans().size());
+ boolean first = bean1 == repository.getBeans().get(0);
if (first)
- assertTrue(bean2 == beans.get(1));
+ assertTrue(bean2 == repository.getBeans().get(1));
else
- assertTrue(bean2 == beans.get(0));
+ assertTrue(bean2 == repository.getBeans().get(0));
}
protected void callbackCardinalityCorrectOrder() throws Throwable
@@ -196,15 +192,14 @@
ControllerContext context1 = assertInstall(0, "Name1");
SimpleBeanRepository repository = (SimpleBeanRepository)context1.getTarget();
assertNotNull(repository);
- List beans = repository.getBeans();
- assertFalse(beans.isEmpty());
- assertEquals(2, beans.size());
- boolean first = bean1 == beans.get(0);
+ assertFalse(repository.getBeans().isEmpty());
+ assertEquals(2, repository.getBeans().size());
+ boolean first = bean1 == repository.getBeans().get(0);
if (first)
- assertTrue(bean2 == beans.get(1));
+ assertTrue(bean2 == repository.getBeans().get(1));
else
- assertTrue(bean2 == beans.get(0));
+ assertTrue(bean2 == repository.getBeans().get(0));
}
protected void callbackCardinalityWrongOrder() throws Throwable
@@ -220,45 +215,43 @@
ControllerContext context1 = assertInstall(0, "Name1", ControllerState.INSTANTIATED);
SimpleBeanRepository repository = (SimpleBeanRepository)context1.getTarget();
assertNotNull(repository);
- List beans = repository.getBeans();
- assertEmpty(beans);
+ assertEmpty(repository.getBeans());
ControllerContext context2 = assertInstall(1, "Name2");
SimpleBean bean1 = (SimpleBean)context2.getTarget();
assertNotNull(bean1);
- assertEmpty(beans);
+ assertEmpty(repository.getBeans());
ControllerContext context3 = assertInstall(2, "Name3");
SimpleBean bean2 = (SimpleBean)context3.getTarget();
assertNotNull(bean2);
assertEquals(ControllerState.INSTALLED, context1.getState());
- assertFalse(beans.isEmpty());
- assertEquals(2, beans.size());
+ assertFalse(repository.getBeans().isEmpty());
+ assertEquals(2, repository.getBeans().size());
assertUninstall("Name1");
assertEquals(ControllerState.ERROR, context1.getState());
- assertEmpty(beans);
+ assertEmpty(repository.getBeans());
context1 = assertInstall(0, "Name1");
repository = (SimpleBeanRepository)context1.getTarget();
assertNotNull(repository);
- beans = repository.getBeans();
- assertFalse(beans.isEmpty());
- assertEquals(2, beans.size());
+ assertFalse(repository.getBeans().isEmpty());
+ assertEquals(2, repository.getBeans().size());
assertUninstall("Name2");
assertEquals(ControllerState.ERROR, context2.getState());
assertEquals(ControllerState.INSTANTIATED, context1.getState());
- assertEmpty(beans);
+ assertEmpty(repository.getBeans());
assertInstall(1, "Name2");
assertEquals(ControllerState.INSTALLED, context1.getState());
- assertEquals(2, beans.size());
+ assertEquals(2, repository.getBeans().size());
assertUninstall("Name3");
assertEquals(ControllerState.ERROR, context3.getState());
assertEquals(ControllerState.INSTANTIATED, context1.getState());
- assertEmpty(beans);
+ assertEmpty(repository.getBeans());
}
protected void callbackCardinalityReinstall() throws Throwable
Modified: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/test/DependencyTestSuite.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/test/DependencyTestSuite.java 2007-08-08 23:00:30 UTC (rev 64516)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/test/DependencyTestSuite.java 2007-08-09 07:30:17 UTC (rev 64517)
@@ -94,6 +94,9 @@
suite.addTest(CallbackTestCase.suite());
suite.addTest(CallbackXMLTestCase.suite());
suite.addTest(CallbackAnnotationTestCase.suite());
+ suite.addTest(CallbackCollectionTestCase.suite());
+ suite.addTest(CallbackCollectionXMLTestCase.suite());
+ suite.addTest(CallbackCollectionAnnotationTestCase.suite());
return suite;
}
}
Modified: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/test/OldAbstractKernelDependencyTest.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/test/OldAbstractKernelDependencyTest.java 2007-08-08 23:00:30 UTC (rev 64516)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/test/OldAbstractKernelDependencyTest.java 2007-08-09 07:30:17 UTC (rev 64517)
@@ -151,11 +151,16 @@
this.beanMetaDatas = beanMetaDatas;
}
- protected void deploy(int number) throws Throwable
+ protected String createName(int number)
{
String packageName = Classes.getPackageName(getClass());
packageName = packageName.replace('.', '/');
- String name = "/xml-test/" + packageName + '/' + getName() + number + ".xml";
+ return "/xml-test/" + packageName + '/' + getName() + number + ".xml";
+ }
+
+ protected void deploy(int number) throws Throwable
+ {
+ String name = createName(number);
getLog().debug("Using " + name);
URL url = getResource(name);
if (url == null)
@@ -164,7 +169,7 @@
util.deploy(url);
}
-
+
protected void configureLoggingAfterBootstrap()
{
//enableTrace("org.jboss.beans");
Modified: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/DeploymentTestSuite.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/DeploymentTestSuite.java 2007-08-08 23:00:30 UTC (rev 64516)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/DeploymentTestSuite.java 2007-08-09 07:30:17 UTC (rev 64517)
@@ -51,6 +51,7 @@
suite.addTest(AnnotatedLifecycleTestCase.suite());
suite.addTest(IgnoredAnnotatedLifecycleTestCase.suite());
suite.addTest(IgnoredLifecycleTestCase.suite());
+ suite.addTest(IgnoredFactoryLifecycleTestCase.suite());
suite.addTest(MixedLifecycleTestCase.suite());
suite.addTest(FineGrainedActionTestCase.suite());
suite.addTest(ScopingTestCase.suite());
Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/IgnoredFactoryLifecycleTestCase.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/IgnoredFactoryLifecycleTestCase.java (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/IgnoredFactoryLifecycleTestCase.java 2007-08-09 07:30:17 UTC (rev 64517)
@@ -0,0 +1,62 @@
+/*
+* 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.test;
+
+import junit.framework.Test;
+import org.jboss.beans.metadata.spi.factory.BeanFactory;
+import org.jboss.test.kernel.deployment.support.SimpleLifecycleBean;
+
+/**
+ * Test ignore lifecycle.
+ *
+ * @author <a href="mailto:ales.justin at gmail.com">Ales Justin</a>
+ */
+public class IgnoredFactoryLifecycleTestCase extends AbstractDeploymentTest
+{
+ public IgnoredFactoryLifecycleTestCase(String name) throws Throwable
+ {
+ super(name);
+ }
+
+ public static Test suite()
+ {
+ return suite(IgnoredFactoryLifecycleTestCase.class);
+ }
+
+ public void testIgnoredLifecycle() throws Throwable
+ {
+ checkLifecycleBean("LifecycleBean1", false, false);
+ checkLifecycleBean("LifecycleBean2", false, true);
+ checkLifecycleBean("LifecycleBean3", true, false);
+ checkLifecycleBean("LifecycleBean4", true, true);
+ }
+
+ protected void checkLifecycleBean(String name, boolean create, boolean start) throws Throwable
+ {
+ BeanFactory factory = (BeanFactory)getBean(name);
+ assertNotNull(factory);
+ SimpleLifecycleBean lifecycle = (SimpleLifecycleBean)factory.createBean();
+ assertNotNull(lifecycle);
+ assertEquals(create, lifecycle.isCreate());
+ assertEquals(start, lifecycle.isStart());
+ }
+}
Modified: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/IgnoredLifecycleTestCase.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/IgnoredLifecycleTestCase.java 2007-08-08 23:00:30 UTC (rev 64516)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/IgnoredLifecycleTestCase.java 2007-08-09 07:30:17 UTC (rev 64517)
@@ -46,7 +46,7 @@
return suite(IgnoredLifecycleTestCase.class);
}
- public void testAnnotatedLifecycle() throws Throwable
+ public void testIgnoredLifecycle() throws Throwable
{
SimpleLifecycleBean target;
Modified: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/BeanFactoryTestCase.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/BeanFactoryTestCase.java 2007-08-08 23:00:30 UTC (rev 64516)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/BeanFactoryTestCase.java 2007-08-09 07:30:17 UTC (rev 64517)
@@ -583,6 +583,7 @@
assertNull(factory.getUninstallCallbacks());
}
+/*
public void testBeanFactoryWithInstallCallback() throws Exception
{
GenericBeanFactoryMetaData factory = unmarshalBeanFactory("BeanFactoryWithInstallCallback.xml");
@@ -702,6 +703,7 @@
expected.add("Uninstall3");
assertCallbacks(expected, factory.getUninstallCallbacks());
}
+*/
public void testBeanFactoryBadNoClassOrConstructor() throws Exception
{
More information about the jboss-cvs-commits
mailing list