[jboss-cvs] JBossAS SVN: r60117 - in projects/microcontainer/trunk/kernel/src: tests/org/jboss/test/kernel/config/support and 1 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Jan 30 09:10:54 EST 2007
Author: alesj
Date: 2007-01-30 09:10:54 -0500 (Tue, 30 Jan 2007)
New Revision: 60117
Added:
projects/microcontainer/trunk/kernel/src/resources/xml-test/org/jboss/test/kernel/config/test/testElement.xml
projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/config/support/MyElement.java
projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/config/test/ElementTestCase.java
projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/config/test/ElementXMLTestCase.java
Modified:
projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/config/test/ConfigTestSuite.java
Log:
Testing org.w3c.dom.Element in MC xml.
Added: projects/microcontainer/trunk/kernel/src/resources/xml-test/org/jboss/test/kernel/config/test/testElement.xml
===================================================================
--- projects/microcontainer/trunk/kernel/src/resources/xml-test/org/jboss/test/kernel/config/test/testElement.xml (rev 0)
+++ projects/microcontainer/trunk/kernel/src/resources/xml-test/org/jboss/test/kernel/config/test/testElement.xml 2007-01-30 14:10:54 UTC (rev 60117)
@@ -0,0 +1,12 @@
+<?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="MyElementBean" class="org.jboss.test.kernel.config.support.MyElement">
+ <property name="myElement"><![CDATA[<someelement attrib="someattribute"/>]]></property>
+ </bean>
+
+</deployment>
+
Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/config/support/MyElement.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/config/support/MyElement.java (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/config/support/MyElement.java 2007-01-30 14:10:54 UTC (rev 60117)
@@ -0,0 +1,44 @@
+/*
+* 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;
+
+/**
+ * Element holder bean.
+ *
+ * @author <a href="ales.justin at jboss.com">Ales Justin</a>
+ */
+public class MyElement
+{
+ private Element myElement;
+
+ public Element getMyElement()
+ {
+ return myElement;
+ }
+
+ public void setMyElement(Element myElement)
+ {
+ this.myElement = myElement;
+ }
+}
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-01-30 13:52:27 UTC (rev 60116)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/config/test/ConfigTestSuite.java 2007-01-30 14:10:54 UTC (rev 60117)
@@ -67,6 +67,8 @@
suite.addTest(BeanMetaDataBuilderTestCase.suite());
suite.addTest(PropertyReplaceTestCase.suite());
suite.addTest(PropertyReplaceXMLTestCase.suite());
+ suite.addTest(ElementTestCase.suite());
+ suite.addTest(ElementXMLTestCase.suite());
return suite;
}
Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/config/test/ElementTestCase.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/config/test/ElementTestCase.java (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/config/test/ElementTestCase.java 2007-01-30 14:10:54 UTC (rev 60117)
@@ -0,0 +1,73 @@
+/*
+* 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.AbstractPropertyMetaData;
+import org.jboss.beans.metadata.plugins.StringValueMetaData;
+import org.jboss.beans.metadata.spi.PropertyMetaData;
+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 ElementTestCase extends AbstractKernelConfigTest
+{
+ public ElementTestCase(String name)
+ {
+ super(name);
+ }
+
+ public ElementTestCase(String name, boolean xmltest)
+ {
+ super(name, xmltest);
+ }
+
+ public static Test suite()
+ {
+ return suite(ElementTestCase.class);
+ }
+
+ public void testElement() throws Throwable
+ {
+ Element element = instantiateElement();
+ assertNotNull(element);
+ assertEquals("someelement", element.getTagName());
+ assertTrue(element.hasAttribute("attrib"));
+ assertEquals("someattribute", element.getAttribute("attrib"));
+ }
+
+ protected Element instantiateElement() throws Throwable
+ {
+ PropertyMetaData pmd = new AbstractPropertyMetaData(
+ "element",
+ "<someelement attrib=\"someattribute\"/>",
+ Element.class.getName()
+ );
+ StringValueMetaData svmd = assertInstanceOf(pmd.getValue(), StringValueMetaData.class, false);
+ svmd.setConfigurator(bootstrap().getConfigurator());
+ return (Element)svmd.getValue(null, Thread.currentThread().getContextClassLoader());
+ }
+
+}
Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/config/test/ElementXMLTestCase.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/config/test/ElementXMLTestCase.java (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/config/test/ElementXMLTestCase.java 2007-01-30 14:10:54 UTC (rev 60117)
@@ -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.test;
+
+import junit.framework.Test;
+import org.jboss.test.kernel.config.support.MyElement;
+import org.jboss.test.kernel.config.support.XMLUtil;
+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 ElementXMLTestCase extends ElementTestCase
+{
+ public ElementXMLTestCase(String name)
+ {
+ super(name);
+ }
+
+ public ElementXMLTestCase(String name, boolean xmltest)
+ {
+ super(name, xmltest);
+ }
+
+ public static Test suite()
+ {
+ return suite(ElementXMLTestCase.class);
+ }
+
+ protected Element instantiateElement() throws Throwable
+ {
+ XMLUtil util = bootstrapXML(true);
+ MyElement mybean = (MyElement)util.getBean("MyElementBean");
+ return mybean.getMyElement();
+ }
+
+}
More information about the jboss-cvs-commits
mailing list