[jboss-cvs] JBossAS SVN: r77474 - in projects/microcontainer/trunk/kernel/src: resources/tests/org/jboss/test/kernel/deployment/test and 2 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Aug 26 04:49:12 EDT 2008
Author: alesj
Date: 2008-08-26 04:49:12 -0400 (Tue, 26 Aug 2008)
New Revision: 77474
Added:
projects/microcontainer/trunk/kernel/src/resources/tests/org/jboss/test/kernel/deployment/test/AnnotationUsageTestCase_Bad.xml
projects/microcontainer/trunk/kernel/src/resources/tests/org/jboss/test/kernel/deployment/test/PropertyUsageTestCase_Empty.xml
projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/EmptyPropTester.java
projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/AnnotationUsageTestCase.java
projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/PropertyUsageTestCase.java
Modified:
projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/AbstractAnnotationMetaData.java
projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/DeploymentTestSuite.java
Log:
[JBMICROCONT-331]; better null annotation string info.
[JBMICROCONT-336]; exposing empty string failure.
Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/AbstractAnnotationMetaData.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/AbstractAnnotationMetaData.java 2008-08-26 07:19:35 UTC (rev 77473)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/AbstractAnnotationMetaData.java 2008-08-26 08:49:12 UTC (rev 77474)
@@ -42,13 +42,12 @@
/**
* Metadata for an annotation.
*
+ * @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$
*/
@XmlType(name="annotationType", propOrder={"annotation"})
-public class AbstractAnnotationMetaData extends JBossObject
- implements CachingAnnotationMetaData, Serializable
+public class AbstractAnnotationMetaData extends JBossObject implements CachingAnnotationMetaData, Serializable
{
private static final long serialVersionUID = 2L;
@@ -71,6 +70,9 @@
public String getAnnotation()
{
+ if (annotation == null)
+ throw new IllegalArgumentException("Null string annotation value, illegal xml form?");
+
return annotation;
}
@@ -102,9 +104,10 @@
{
if (ann != null)
return ann;
+
+ String annString = getAnnotation();
try
{
- String annString = annotation;
if (replace)
{
annString = StringPropertyReplacer.replaceProperties(annString);
@@ -173,7 +176,7 @@
protected int getHashCode()
{
- return annotation.hashCode();
+ return getAnnotation().hashCode();
}
public boolean equals(Object object)
@@ -183,7 +186,7 @@
AbstractAnnotationMetaData amd = (AbstractAnnotationMetaData)object;
// this is what we probably want? - never saw duplicate annotation on a bean/prop/...
- return (replace == amd.replace) && annotation.equals(amd.annotation);
+ return (replace == amd.replace) && getAnnotation().equals(amd.getAnnotation());
}
public AbstractAnnotationMetaData clone()
Copied: projects/microcontainer/trunk/kernel/src/resources/tests/org/jboss/test/kernel/deployment/test/AnnotationUsageTestCase_Bad.xml (from rev 77473, projects/microcontainer/trunk/kernel/src/resources/tests/org/jboss/test/kernel/deployment/test/MutableMetaDataTestCase_NotAutomatic.xml)
===================================================================
--- projects/microcontainer/trunk/kernel/src/resources/tests/org/jboss/test/kernel/deployment/test/AnnotationUsageTestCase_Bad.xml (rev 0)
+++ projects/microcontainer/trunk/kernel/src/resources/tests/org/jboss/test/kernel/deployment/test/AnnotationUsageTestCase_Bad.xml 2008-08-26 08:49:12 UTC (rev 77474)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+ <annotation name="org.jboss.test.kernel.deployment.support.TestAnnotation1"/>
+
+</deployment>
Added: projects/microcontainer/trunk/kernel/src/resources/tests/org/jboss/test/kernel/deployment/test/PropertyUsageTestCase_Empty.xml
===================================================================
--- projects/microcontainer/trunk/kernel/src/resources/tests/org/jboss/test/kernel/deployment/test/PropertyUsageTestCase_Empty.xml (rev 0)
+++ projects/microcontainer/trunk/kernel/src/resources/tests/org/jboss/test/kernel/deployment/test/PropertyUsageTestCase_Empty.xml 2008-08-26 08:49:12 UTC (rev 77474)
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+ <bean name="prop_tester" class="org.jboss.test.kernel.deployment.support.EmptyPropTester">
+ <property name="string1"></property>
+ <property name="string2"><annotation>@org.jboss.test.kernel.deployment.support.TestAnnotation1</annotation></property>
+ </bean>
+
+</deployment>
Copied: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/EmptyPropTester.java (from rev 77473, projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/StaticHolder.java)
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/EmptyPropTester.java (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/EmptyPropTester.java 2008-08-26 08:49:12 UTC (rev 77474)
@@ -0,0 +1,51 @@
+/*
+* 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.support;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class EmptyPropTester
+{
+ private String string1;
+ private String string2;
+
+ public String getString1()
+ {
+ return string1;
+ }
+
+ public void setString1(String string1)
+ {
+ this.string1 = string1;
+ }
+
+ public String getString2()
+ {
+ return string2;
+ }
+
+ public void setString2(String string2)
+ {
+ this.string2 = string2;
+ }
+}
\ No newline at end of file
Copied: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/AnnotationUsageTestCase.java (from rev 77473, projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/MutableMetaDataTestCase.java)
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/AnnotationUsageTestCase.java (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/AnnotationUsageTestCase.java 2008-08-26 08:49:12 UTC (rev 77474)
@@ -0,0 +1,56 @@
+/*
+* 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.test.kernel.deployment.test;
+
+import junit.framework.Test;
+
+/**
+ * AnnotationUsageTestCase.
+ *
+ * @author <a href="ales.justin at jboss.com">Ales Justin</a>
+ */
+public class AnnotationUsageTestCase extends AbstractDeploymentTest
+{
+ public static Test suite()
+ {
+ return suite(AnnotationUsageTestCase.class);
+ }
+
+ public AnnotationUsageTestCase(String name) throws Throwable
+ {
+ super(name);
+ }
+
+ public void testBadAnnotationXml() throws Exception
+ {
+ try
+ {
+ deploy("AnnotationUsageTestCase_Bad.xml");
+ }
+ catch (Throwable t)
+ {
+ while (t.getCause() != null)
+ t = t.getCause();
+ assertInstanceOf(t, IllegalArgumentException.class);
+ }
+ }
+}
\ No newline at end of file
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 2008-08-26 07:19:35 UTC (rev 77473)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/DeploymentTestSuite.java 2008-08-26 08:49:12 UTC (rev 77474)
@@ -68,6 +68,8 @@
suite.addTest(MutableMetaDataTestCase.suite());
suite.addTest(AnnotationRedeployTestCase.suite());
suite.addTest(MockServiceBindingTestCase.suite());
+ suite.addTest(AnnotationUsageTestCase.suite());
+ suite.addTest(PropertyUsageTestCase.suite());
// bean container tests
suite.addTest(BeanContainerUsageTestCase.suite());
suite.addTest(BeanContainerUsageMDTestCase.suite());
Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/PropertyUsageTestCase.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/PropertyUsageTestCase.java (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/PropertyUsageTestCase.java 2008-08-26 08:49:12 UTC (rev 77474)
@@ -0,0 +1,57 @@
+/*
+* 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.test.kernel.deployment.test;
+
+import junit.framework.Test;
+import org.jboss.kernel.spi.deployment.KernelDeployment;
+
+/**
+ * PropertyUsageTestCase.
+ *
+ * @author <a href="ales.justin at jboss.com">Ales Justin</a>
+ */
+public class PropertyUsageTestCase extends AbstractDeploymentTest
+{
+ public static Test suite()
+ {
+ return suite(PropertyUsageTestCase.class);
+ }
+
+ public PropertyUsageTestCase(String name) throws Throwable
+ {
+ super(name);
+ }
+
+ public void testEmptyProperty() throws Exception
+ {
+ KernelDeployment deployment = deploy("PropertyUsageTestCase_Empty.xml");
+ try
+ {
+ System.out.println("deployment = " + deployment);
+ // TODO - validate();
+ }
+ finally
+ {
+ undeploy(deployment);
+ }
+ }
+}
\ No newline at end of file
More information about the jboss-cvs-commits
mailing list