[jboss-cvs] JBossAS SVN: r64398 - in projects/microcontainer/trunk: container/src/main/org/jboss/reflect/spi and 5 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Aug 1 09:05:21 EDT 2007
Author: alesj
Date: 2007-08-01 09:05:20 -0400 (Wed, 01 Aug 2007)
New Revision: 64398
Added:
projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/config/support/AnnotatedLDAPFactory.java
projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/config/support/AnnotatedPropHolder.java
projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/config/support/MyElementAnnotated.java
projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/config/support/ProgressionSimpleBean.java
projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/config/support/Tester.java
projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/config/test/ElementAnnotationTestCase.java
projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/config/test/ProgressionAnnotationTestCase.java
projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/config/test/PropertyReplaceAnnotationTestCase.java
projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/config/test/ValueFactoryAnnotationTestCase.java
Modified:
projects/microcontainer/trunk/container/src/main/org/jboss/reflect/plugins/SimpleProgressionConvertor.java
projects/microcontainer/trunk/container/src/main/org/jboss/reflect/spi/NumberInfo.java
projects/microcontainer/trunk/container/src/main/org/jboss/reflect/spi/PrimitiveInfo.java
projects/microcontainer/trunk/dependency/src/main/org/jboss/dependency/plugins/AbstractDependencyInfo.java
projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/annotations/Aliases.java
projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/annotations/StringValue.java
projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/AliasesAnnotationPlugin.java
projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/StringValueAnnotationPlugin.java
projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/config/test/ConfigTestSuite.java
Log:
Progression, property replace, element, value factory annotation tests.
Modified: projects/microcontainer/trunk/container/src/main/org/jboss/reflect/plugins/SimpleProgressionConvertor.java
===================================================================
--- projects/microcontainer/trunk/container/src/main/org/jboss/reflect/plugins/SimpleProgressionConvertor.java 2007-08-01 10:20:23 UTC (rev 64397)
+++ projects/microcontainer/trunk/container/src/main/org/jboss/reflect/plugins/SimpleProgressionConvertor.java 2007-08-01 13:05:20 UTC (rev 64398)
@@ -45,9 +45,11 @@
return false;
}
// ipnbX = is primitive non boolean X
- boolean ipnbt = target.isPrimitive() && target != Boolean.TYPE;
- boolean ipnbs = source.isPrimitive() && source != Boolean.TYPE;
- return (ipnbt || Number.class.isAssignableFrom(target)) && (ipnbs || Number.class.isAssignableFrom(source));
+ boolean ipnbt = target.isPrimitive() && target != Boolean.TYPE && target != Character.TYPE;
+ boolean ipnbs = source.isPrimitive() && source != Boolean.TYPE && source != Character.TYPE;
+ boolean targetIsNumber = Number.class.isAssignableFrom(target);
+ boolean sourceIsNumber = Number.class.isAssignableFrom(source);
+ return (ipnbt || targetIsNumber) && (ipnbs || sourceIsNumber);
}
public Object doProgression(Class<? extends Object> target, Object value) throws Throwable
Modified: projects/microcontainer/trunk/container/src/main/org/jboss/reflect/spi/NumberInfo.java
===================================================================
--- projects/microcontainer/trunk/container/src/main/org/jboss/reflect/spi/NumberInfo.java 2007-08-01 10:20:23 UTC (rev 64397)
+++ projects/microcontainer/trunk/container/src/main/org/jboss/reflect/spi/NumberInfo.java 2007-08-01 13:05:20 UTC (rev 64398)
@@ -157,25 +157,6 @@
return values[ordinal];
}
- @SuppressWarnings("unchecked")
- @Override
- public boolean isAssignableFrom(TypeInfo info)
- {
- if (super.isAssignableFrom(info))
- {
- return true;
- }
- try
- {
- ProgressionConvertor pc = ProgressionConvertorFactory.getInstance().getConvertor();
- return pc.canProgress(getType(), info.getType());
- }
- catch (Throwable throwable)
- {
- return false;
- }
- }
-
// --- delegate
public ConstructorInfo getDeclaredConstructor(TypeInfo[] parameters)
Modified: projects/microcontainer/trunk/container/src/main/org/jboss/reflect/spi/PrimitiveInfo.java
===================================================================
--- projects/microcontainer/trunk/container/src/main/org/jboss/reflect/spi/PrimitiveInfo.java 2007-08-01 10:20:23 UTC (rev 64397)
+++ projects/microcontainer/trunk/container/src/main/org/jboss/reflect/spi/PrimitiveInfo.java 2007-08-01 13:05:20 UTC (rev 64398)
@@ -186,9 +186,21 @@
throw new UnsupportedOperationException("Not an array " + name);
}
+ @SuppressWarnings("unchecked")
public boolean isAssignableFrom(TypeInfo info)
{
- return (info == this);
+ if (info == this)
+ return true;
+
+ try
+ {
+ ProgressionConvertor pc = ProgressionConvertorFactory.getInstance().getConvertor();
+ return pc.canProgress(getType(), info.getType());
+ }
+ catch (Throwable throwable)
+ {
+ return false;
+ }
}
public TypeInfoFactory getTypeInfoFactory()
Modified: projects/microcontainer/trunk/dependency/src/main/org/jboss/dependency/plugins/AbstractDependencyInfo.java
===================================================================
--- projects/microcontainer/trunk/dependency/src/main/org/jboss/dependency/plugins/AbstractDependencyInfo.java 2007-08-01 10:20:23 UTC (rev 64397)
+++ projects/microcontainer/trunk/dependency/src/main/org/jboss/dependency/plugins/AbstractDependencyInfo.java 2007-08-01 13:05:20 UTC (rev 64398)
@@ -45,16 +45,16 @@
public class AbstractDependencyInfo extends JBossObject implements DependencyInfo
{
/** My dependencies */
- private Set<DependencyItem> iDependOn = new CopyOnWriteArraySet<DependencyItem>();;
+ private Set<DependencyItem> iDependOn = new CopyOnWriteArraySet<DependencyItem>();
/** Dependencies referencing me */
- private Set<DependencyItem> dependsOnMe = new CopyOnWriteArraySet<DependencyItem>();;
+ private Set<DependencyItem> dependsOnMe = new CopyOnWriteArraySet<DependencyItem>();
/** Unresolved dependencies */
- private Set<DependencyItem> unresolved = new CopyOnWriteArraySet<DependencyItem>();;
+ private Set<DependencyItem> unresolved = new CopyOnWriteArraySet<DependencyItem>();
/** Install callbacks */
- private Set<CallbackItem> installCallbacks = new CopyOnWriteArraySet<CallbackItem>();;
+ private Set<CallbackItem> installCallbacks = new CopyOnWriteArraySet<CallbackItem>();
/** Uninstall callbacks */
private Set<CallbackItem> uninstallCallbacks = new CopyOnWriteArraySet<CallbackItem>();
Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/annotations/Aliases.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/annotations/Aliases.java 2007-08-01 10:20:23 UTC (rev 64397)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/annotations/Aliases.java 2007-08-01 13:05:20 UTC (rev 64398)
@@ -34,4 +34,6 @@
public @interface Aliases
{
String[] value();
+
+ boolean replace() default true;
}
Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/annotations/StringValue.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/annotations/StringValue.java 2007-08-01 10:20:23 UTC (rev 64397)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/annotations/StringValue.java 2007-08-01 13:05:20 UTC (rev 64398)
@@ -36,4 +36,6 @@
String value();
String type() default "";
+
+ boolean replace() default true;
}
Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/AliasesAnnotationPlugin.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/AliasesAnnotationPlugin.java 2007-08-01 10:20:23 UTC (rev 64397)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/AliasesAnnotationPlugin.java 2007-08-01 13:05:20 UTC (rev 64398)
@@ -28,6 +28,7 @@
import org.jboss.reflect.spi.ClassInfo;
import org.jboss.kernel.spi.dependency.KernelControllerContext;
import org.jboss.dependency.spi.Controller;
+import org.jboss.util.StringPropertyReplacer;
/**
* @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
@@ -46,6 +47,10 @@
Controller controller = context.getController();
for(String alias : annotation.value())
{
+ // check for ${property}
+ if (annotation.replace())
+ alias = StringPropertyReplacer.replaceProperties(alias);
+
if (aliases == null || aliases.contains(alias) == false)
{
// alias will get removed when original will be undeployed
Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/StringValueAnnotationPlugin.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/StringValueAnnotationPlugin.java 2007-08-01 10:20:23 UTC (rev 64397)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/StringValueAnnotationPlugin.java 2007-08-01 13:05:20 UTC (rev 64398)
@@ -42,6 +42,7 @@
StringValueMetaData value = new StringValueMetaData(annotation.value());
if (isAttributePresent(annotation.type()))
value.setType(annotation.type());
+ value.setReplace(annotation.replace());
return value;
}
}
Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/config/support/AnnotatedLDAPFactory.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/config/support/AnnotatedLDAPFactory.java (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/config/support/AnnotatedLDAPFactory.java 2007-08-01 13:05:20 UTC (rev 64398)
@@ -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.kernel.config.support;
+
+import java.util.Map;
+
+import org.jboss.beans.metadata.plugins.annotations.Constructor;
+import org.jboss.beans.metadata.plugins.annotations.EntryValue;
+import org.jboss.beans.metadata.plugins.annotations.MapValue;
+import org.jboss.beans.metadata.plugins.annotations.StringValue;
+import org.jboss.beans.metadata.plugins.annotations.Value;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class AnnotatedLDAPFactory extends LDAPFactory
+{
+ @Constructor
+ public AnnotatedLDAPFactory(
+ @MapValue(
+ keyClass = "java.lang.String",
+ valueClass = "java.lang.String",
+ value = {
+ @EntryValue(
+ key = @Value(string = @StringValue("foo.bar.key")),
+ value = @Value(string = @StringValue("QWERT"))
+ ),
+ @EntryValue(
+ key = @Value(string = @StringValue("xyz.key")),
+ value = @Value(string = @StringValue(" QWERT "))
+ )
+ }
+ )
+ Map<String, String> map
+ )
+ {
+ super(map);
+ }
+}
Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/config/support/AnnotatedPropHolder.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/config/support/AnnotatedPropHolder.java (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/config/support/AnnotatedPropHolder.java 2007-08-01 13:05:20 UTC (rev 64398)
@@ -0,0 +1,66 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.kernel.config.support;
+
+import java.util.List;
+
+import org.jboss.beans.metadata.plugins.annotations.Constructor;
+import org.jboss.beans.metadata.plugins.annotations.Inject;
+import org.jboss.beans.metadata.plugins.annotations.ListValue;
+import org.jboss.beans.metadata.plugins.annotations.Parameter;
+import org.jboss.beans.metadata.plugins.annotations.StringValue;
+import org.jboss.beans.metadata.plugins.annotations.Value;
+import org.jboss.beans.metadata.plugins.annotations.ValueFactory;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class AnnotatedPropHolder extends PropHolder
+{
+ @Constructor
+ public AnnotatedPropHolder(
+ @ValueFactory(bean = "ldap", method = "getValue", parameter = "foo.bar.key") String constructor
+ )
+ {
+ super(constructor);
+ }
+
+ @ValueFactory(bean = "ldap", method = "getValue", parameter = "foo.bar.key")
+ public void setValue(String value)
+ {
+ super.setValue(value);
+ }
+
+ @ListValue(
+ elementClass = "java.lang.String",
+ value = {
+ @Value(valueFactory = @ValueFactory(bean = "ldap", method = "getValue", parameter = "foo.bar.key")),
+ @Value(valueFactory = @ValueFactory(bean = "ldap", method = "getValue", parameters = {@Parameter(string = @StringValue("foo.bar.key")), @Parameter(string = @StringValue("qaz"))})),
+ @Value(valueFactory = @ValueFactory(bean = "ldap", method = "getValue", parameters = {@Parameter(string = @StringValue("xyz.key")), @Parameter(string = @StringValue("xyz")), @Parameter(inject = @Inject(bean = "t"))})),
+ @Value(valueFactory = @ValueFactory(bean = "ldap", method = "getValue", defaultValue = "QWERT", parameters = {@Parameter(string = @StringValue("no.such.key"))}))
+ }
+ )
+ public void setList(List<String> list)
+ {
+ super.setList(list);
+ }
+}
Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/config/support/MyElementAnnotated.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/config/support/MyElementAnnotated.java (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/config/support/MyElementAnnotated.java 2007-08-01 13:05:20 UTC (rev 64398)
@@ -0,0 +1,39 @@
+/*
+* 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.config.support;
+
+import org.w3c.dom.Element;
+import org.jboss.beans.metadata.plugins.annotations.StringValue;
+
+/**
+ * Element holder bean.
+ *
+ * @author <a href="ales.justin at jboss.com">Ales Justin</a>
+ */
+public class MyElementAnnotated extends MyElement
+{
+ @StringValue("<someelement attrib=\"someattribute\"/>")
+ public void setMyElement(Element myElement)
+ {
+ super.setMyElement(myElement);
+ }
+}
Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/config/support/ProgressionSimpleBean.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/config/support/ProgressionSimpleBean.java (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/config/support/ProgressionSimpleBean.java 2007-08-01 13:05:20 UTC (rev 64398)
@@ -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.kernel.config.support;
+
+import org.jboss.beans.metadata.plugins.annotations.StringValue;
+
+/**
+ * A simple bean
+ *
+ * @author <a href="ales.justin at jboss.com">Ales Justin</a>
+ */
+public class ProgressionSimpleBean extends SimpleBean
+{
+ @StringValue(value = "123.456", type="java.lang.Double")
+ public void setAnint(int anint)
+ {
+ super.setAnint(anint);
+ }
+
+ @StringValue(value = "314159")
+ public void setAFloat(Float float1)
+ {
+ super.setAFloat(float1);
+ }
+
+ @StringValue(value = "987.6543", type="java.lang.Float")
+ public void setAShort(Short short1)
+ {
+ super.setAShort(short1);
+ }
+}
Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/config/support/Tester.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/config/support/Tester.java (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/config/support/Tester.java 2007-08-01 13:05:20 UTC (rev 64398)
@@ -0,0 +1,43 @@
+/*
+* 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.config.support;
+
+import org.jboss.beans.metadata.plugins.annotations.StringValue;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class Tester
+{
+ private String value;
+
+ public String getValue()
+ {
+ return value;
+ }
+
+ @StringValue(value = "${test.property.value}", replace = false)
+ public void setValue(String value)
+ {
+ this.value = value;
+ }
+}
Modified: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/config/test/ConfigTestSuite.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/config/test/ConfigTestSuite.java 2007-08-01 10:20:23 UTC (rev 64397)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/config/test/ConfigTestSuite.java 2007-08-01 13:05:20 UTC (rev 64398)
@@ -71,13 +71,17 @@
suite.addTest(MapAnnotationTestCase.suite());
suite.addTest(ProgressionTestCase.suite());
suite.addTest(ProgressionXMLTestCase.suite());
+ suite.addTest(ProgressionAnnotationTestCase.suite());
suite.addTest(BeanMetaDataBuilderTestCase.suite());
suite.addTest(PropertyReplaceTestCase.suite());
suite.addTest(PropertyReplaceXMLTestCase.suite());
+ suite.addTest(PropertyReplaceAnnotationTestCase.suite());
suite.addTest(ElementTestCase.suite());
suite.addTest(ElementXMLTestCase.suite());
+ suite.addTest(ElementAnnotationTestCase.suite());
suite.addTest(ValueFactoryTestCase.suite());
suite.addTest(ValueFactoryXMLTestCase.suite());
+ suite.addTest(ValueFactoryAnnotationTestCase.suite());
return suite;
}
Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/config/test/ElementAnnotationTestCase.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/config/test/ElementAnnotationTestCase.java (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/config/test/ElementAnnotationTestCase.java 2007-08-01 13:05:20 UTC (rev 64398)
@@ -0,0 +1,60 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.kernel.config.test;
+
+import junit.framework.Test;
+import org.jboss.beans.metadata.plugins.builder.BeanMetaDataBuilderFactory;
+import org.jboss.beans.metadata.spi.builder.BeanMetaDataBuilder;
+import org.jboss.test.kernel.config.support.MyElementAnnotated;
+import org.jboss.test.kernel.config.support.MyElement;
+import org.w3c.dom.Element;
+
+/**
+ * Test org.w3c.dom.Element usage in MC xml.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class ElementAnnotationTestCase extends ElementTestCase
+{
+ public ElementAnnotationTestCase(String name)
+ {
+ super(name);
+ }
+
+ public ElementAnnotationTestCase(String name, boolean xmltest)
+ {
+ super(name, xmltest);
+ }
+
+ public static Test suite()
+ {
+ return suite(ElementAnnotationTestCase.class);
+ }
+
+ protected Element instantiateElement() throws Throwable
+ {
+ BeanMetaDataBuilder builder = BeanMetaDataBuilderFactory.createBuilder("MyElement", MyElementAnnotated.class.getName());
+ MyElement holder = (MyElement)instantiate(builder.getBeanMetaData());
+ return holder.getMyElement();
+ }
+
+}
Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/config/test/ProgressionAnnotationTestCase.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/config/test/ProgressionAnnotationTestCase.java (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/config/test/ProgressionAnnotationTestCase.java 2007-08-01 13:05:20 UTC (rev 64398)
@@ -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.config.test;
+
+import junit.framework.Test;
+import org.jboss.beans.metadata.plugins.builder.BeanMetaDataBuilderFactory;
+import org.jboss.beans.metadata.spi.builder.BeanMetaDataBuilder;
+import org.jboss.test.kernel.config.support.ProgressionSimpleBean;
+import org.jboss.test.kernel.config.support.SimpleBean;
+
+/**
+ * Progression @annotation Test Case.
+ *
+ * @author <a href="ales.justin at jboss.com">Ales Justin</a>
+ */
+public class ProgressionAnnotationTestCase extends ProgressionTestCase
+{
+ public static Test suite()
+ {
+ return suite(ProgressionAnnotationTestCase.class);
+ }
+
+ public ProgressionAnnotationTestCase(String name)
+ {
+ super(name);
+ }
+
+ protected SimpleBean instantiateProgressionBeans() throws Throwable
+ {
+ BeanMetaDataBuilder builder = BeanMetaDataBuilderFactory.createBuilder("SimpleBean", ProgressionSimpleBean.class.getName());
+ return (SimpleBean)instantiate(builder.getBeanMetaData());
+ }
+
+}
Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/config/test/PropertyReplaceAnnotationTestCase.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/config/test/PropertyReplaceAnnotationTestCase.java (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/config/test/PropertyReplaceAnnotationTestCase.java 2007-08-01 13:05:20 UTC (rev 64398)
@@ -0,0 +1,67 @@
+/*
+* 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.config.test;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import junit.framework.Test;
+import org.jboss.beans.metadata.plugins.builder.BeanMetaDataBuilderFactory;
+import org.jboss.beans.metadata.spi.builder.BeanMetaDataBuilder;
+import org.jboss.test.kernel.config.support.Tester;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class PropertyReplaceAnnotationTestCase extends PropertyReplaceTestCase
+{
+ public PropertyReplaceAnnotationTestCase(String name)
+ {
+ super(name);
+ }
+
+ public static Test suite()
+ {
+ return suite(PropertyReplaceAnnotationTestCase.class);
+ }
+
+ protected List<ObjectCreator> createCreators()
+ {
+ List<ObjectCreator> result = new ArrayList<ObjectCreator>();
+ ObjectCreator singleton = new ObjectCreator()
+ {
+ public Object createObject() throws Throwable
+ {
+ BeanMetaDataBuilder builder = BeanMetaDataBuilderFactory.createBuilder("test", Tester.class.getName());
+ Tester tester = (Tester)instantiate(builder.getBeanMetaData());
+ return tester.getValue();
+ }
+ };
+ result.add(singleton);
+ return result;
+ }
+
+ public void testAnnotationPropertyReplace() throws Throwable
+ {
+ // No annotation equivalent.
+ }
+}
Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/config/test/ValueFactoryAnnotationTestCase.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/config/test/ValueFactoryAnnotationTestCase.java (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/config/test/ValueFactoryAnnotationTestCase.java 2007-08-01 13:05:20 UTC (rev 64398)
@@ -0,0 +1,70 @@
+/*
+* 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.config.test;
+
+import junit.framework.Test;
+import org.jboss.beans.metadata.plugins.builder.BeanMetaDataBuilderFactory;
+import org.jboss.beans.metadata.spi.builder.BeanMetaDataBuilder;
+import org.jboss.kernel.spi.dependency.KernelController;
+import org.jboss.test.kernel.config.support.AnnotatedLDAPFactory;
+import org.jboss.test.kernel.config.support.AnnotatedPropHolder;
+import org.jboss.test.kernel.config.support.LDAPFactory;
+import org.jboss.test.kernel.config.support.PropHolder;
+import org.jboss.test.kernel.config.support.TrimTransformer;
+
+/**
+ * Test org.w3c.dom.Element usage in MC xml.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class ValueFactoryAnnotationTestCase extends ValueFactoryTestCase
+{
+ public ValueFactoryAnnotationTestCase(String name)
+ {
+ super(name);
+ }
+
+ public ValueFactoryAnnotationTestCase(String name, boolean xmltest)
+ {
+ super(name, xmltest);
+ }
+
+ public static Test suite()
+ {
+ return suite(ValueFactoryAnnotationTestCase.class);
+ }
+
+ protected PropHolder instantiateHolder(KernelController controller) throws Throwable
+ {
+ // ldap
+ BeanMetaDataBuilder ldap = BeanMetaDataBuilderFactory.createBuilder("ldap", AnnotatedLDAPFactory.class.getName());
+ LDAPFactory lf = (LDAPFactory)instantiate(controller, ldap.getBeanMetaData());
+ assertNotNull(lf);
+
+ BeanMetaDataBuilder t = BeanMetaDataBuilderFactory.createBuilder("t", TrimTransformer.class.getName());
+ instantiate(controller, t.getBeanMetaData());
+
+ BeanMetaDataBuilder builder = BeanMetaDataBuilderFactory.createBuilder("PropHolder", AnnotatedPropHolder.class.getName());
+ return (PropHolder)instantiate(controller, builder.getBeanMetaData());
+ }
+
+}
More information about the jboss-cvs-commits
mailing list