Index: jmx-mc-int/src/test/java/org/jboss/test/system/metadata/test/support/JaxbServiceDeployment.java
===================================================================
--- jmx-mc-int/src/test/java/org/jboss/test/system/metadata/test/support/JaxbServiceDeployment.java (revision )
+++ jmx-mc-int/src/test/java/org/jboss/test/system/metadata/test/support/JaxbServiceDeployment.java (revision )
@@ -0,0 +1,67 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.system.metadata.test.support;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.system.metadata.ServiceMetaData;
+import org.jboss.system.metadata.ServiceMetaDataAdapter;
+
+/**
+ * Mock service deployment.
+ *
+ * @author Ales Justin
+ */
+@XmlAccessorType(XmlAccessType.NONE)
+@XmlRootElement
+public class JaxbServiceDeployment implements Serializable
+{
+ private static final long serialVersionUID = 1L;
+
+ @XmlElement(name="mbean")
+ @XmlJavaTypeAdapter(ServiceMetaDataAdapter.class)
+ private List services = new ArrayList();
+
+ public List getServices()
+ {
+ return services;
+ }
+
+ /**
+ * Set the services.
+ *
+ * @param services The services to set.
+ */
+ public void setServices(List services)
+ {
+ this.services = services;
+ }
+}
Index: jmx-mc-int/src/test/java/org/jboss/test/system/metadata/test/AbstractMetaDataTest.java
===================================================================
--- jmx-mc-int/src/test/java/org/jboss/test/system/metadata/test/AbstractMetaDataTest.java (revision 82920)
+++ jmx-mc-int/src/test/java/org/jboss/test/system/metadata/test/AbstractMetaDataTest.java (revision )
@@ -21,34 +21,21 @@
*/
package org.jboss.test.system.metadata.test;
+import javax.management.ObjectName;
+
import java.io.IOException;
import java.net.URL;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
-import javax.management.ObjectName;
-
-import junit.framework.AssertionFailedError;
-
import org.jboss.dependency.spi.ControllerState;
import org.jboss.mx.util.ObjectNameFactory;
-import org.jboss.system.metadata.ServiceAttributeMetaData;
-import org.jboss.system.metadata.ServiceConstructorMetaData;
-import org.jboss.system.metadata.ServiceDependencyListValueMetaData;
-import org.jboss.system.metadata.ServiceDependencyMetaData;
-import org.jboss.system.metadata.ServiceDependencyValueMetaData;
-import org.jboss.system.metadata.ServiceElementValueMetaData;
-import org.jboss.system.metadata.ServiceInjectionValueMetaData;
-import org.jboss.system.metadata.ServiceJBXBValueMetaData;
-import org.jboss.system.metadata.ServiceJavaBeanValueMetaData;
-import org.jboss.system.metadata.ServiceMetaData;
-import org.jboss.system.metadata.ServiceTextValueMetaData;
-import org.jboss.system.metadata.ServiceValueFactoryParameterMetaData;
-import org.jboss.system.metadata.ServiceValueFactoryValueMetaData;
-import org.jboss.system.metadata.ServiceValueMetaData;
+import org.jboss.system.metadata.*;
import org.jboss.test.AbstractSystemTest;
import org.jboss.test.AbstractTestDelegate;
+
+import junit.framework.AssertionFailedError;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
@@ -87,8 +74,8 @@
*/
public static AbstractTestDelegate getDelegate(Class> clazz) throws Exception
{
- MetaDataTestDelegate delegate = new MetaDataTestDelegate(clazz);
- delegate.enableSecurity = true;
+ JaxbMetaDataTestDelegate delegate = new JaxbMetaDataTestDelegate(clazz);
+ delegate.enableSecurity = false;
return delegate;
}
@@ -174,9 +161,9 @@
return url;
}
- protected MetaDataTestDelegate getMetaDataDelegate()
+ protected JaxbMetaDataTestDelegate getMetaDataDelegate()
{
- return (MetaDataTestDelegate) getDelegate();
+ return (JaxbMetaDataTestDelegate) getDelegate();
}
protected void assertDefaultConstructor(ServiceMetaData metaData) throws Exception
Index: jmx-mc-int/src/test/java/org/jboss/test/system/metadata/test/JaxbMetaDataTestDelegate.java
===================================================================
--- jmx-mc-int/src/test/java/org/jboss/test/system/metadata/test/JaxbMetaDataTestDelegate.java (revision )
+++ jmx-mc-int/src/test/java/org/jboss/test/system/metadata/test/JaxbMetaDataTestDelegate.java (revision )
@@ -0,0 +1,102 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.system.metadata.test;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.Unmarshaller;
+import javax.xml.transform.sax.SAXSource;
+
+import java.io.InputStream;
+import java.net.URL;
+import java.util.List;
+
+import org.jboss.system.metadata.ServiceMetaData;
+import org.jboss.test.AbstractTestDelegate;
+import org.jboss.test.system.metadata.test.support.JaxbServiceDeployment;
+import org.jboss.util.xml.JBossEntityResolver;
+
+import org.xml.sax.InputSource;
+import org.xml.sax.XMLReader;
+import org.xml.sax.helpers.XMLReaderFactory;
+
+/**
+ * JAXB MetaDataTestDelegate.
+ *
+ * @author Ales Justin
+ */
+public class JaxbMetaDataTestDelegate extends AbstractTestDelegate
+{
+ /** The context */
+ private JAXBContext context;
+
+ public JaxbMetaDataTestDelegate(Class> clazz)
+ {
+ super(clazz);
+ }
+
+ public void setUp() throws Exception
+ {
+ super.setUp();
+ context = JAXBContext.newInstance(JaxbServiceDeployment.class);
+ }
+
+ /**
+ * Unmarshal an object
+ *
+ * @param url the url
+ * @return the list of services
+ * @throws Exception for any error
+ */
+ public List unmarshal(URL url) throws Exception
+ {
+ long start = System.currentTimeMillis();
+
+ try
+ {
+ Unmarshaller um = context.createUnmarshaller();
+ InputStream is = url.openStream();
+
+ try
+ {
+ InputSource input = new InputSource(is);
+ input.setSystemId(url.toURI().toString());
+ XMLReader reader = XMLReaderFactory.createXMLReader();
+ reader.setEntityResolver(new JBossEntityResolver());
+ SAXSource source = new SAXSource(reader, input);
+ JAXBElement elem = um.unmarshal(source, JaxbServiceDeployment.class);
+ log.debug("Total parse for " + url + " took " + (System.currentTimeMillis() - start) + "ms");
+ return elem.getValue().getServices();
+ }
+ finally
+ {
+ if (is != null)
+ is.close();
+ }
+ }
+ catch (Exception e)
+ {
+ log.debug("Error during parsing: " + url + ": " + e);
+ throw e;
+ }
+ }
+}
Index: jmx-mc-int/src/test/resources/org/jboss/test/system/metadata/value/valuefactory/test/NullParameter.xml
===================================================================
--- jmx-mc-int/src/test/resources/org/jboss/test/system/metadata/value/valuefactory/test/NullParameter.xml (revision 110331)
+++ jmx-mc-int/src/test/resources/org/jboss/test/system/metadata/value/valuefactory/test/NullParameter.xml (revision )
@@ -1,5 +1,6 @@
+
@@ -9,4 +10,5 @@
2
-
\ No newline at end of file
+
+
\ No newline at end of file