Thanks Scott, the start/stop methods worked just fine.
I'm facing a problem with the security deployment now. I've written a test case to
test the metadata factory and it is failing when the deployment annotations are
processed.
Relevant code snippets:
1- ApplicationPolicyFactoryTestCase:
| public class ApplicationPolicyFactoryTestCase extends MicrocontainerTest
| {
|
| /**
| *
| * @param name
| */
| public ApplicationPolicyFactoryTestCase(String name)
| {
| super(name);
| }
|
| @Override
| protected void setUp() throws Exception
| {
| SingletonSchemaResolverFactory.getInstance().addJaxbSchema(
| "urn:jboss:security-beans:1.0",
"org.jboss.security.microcontainer.beans.metadata.SecurityDeployment");
| super.setUp();
| }
| ....
| }
|
It calls the addJaxbSchema before deploying the test configuration file (later when I get
this working I'll add the namespace directly in the SingletonSchemaResolverFactory).
2-ApplicationPolicyFactoryTestCase.xml
| ?xml version="1.0" encoding="UTF-8"?>
|
| <deployment xmlns="urn:jboss:bean-deployer:2.0">
|
| <application-policy xmlns="urn:jboss:security-beans:1.0"
name="TestPolicy">
| <authentication>
| <login-module
code="org.jboss.security.auth.spi.UsersRolesLoginModule"
flag="required"/>
| </authentication>
| </application-policy>
| </deployment>
|
3- The SecurityDeployment (Similar to the AOPDeployment):
| @JBossXmlSchema(namespace = "urn:jboss:security-beans:1.0",
elementFormDefault = XmlNsForm.QUALIFIED)
| @XmlRootElement(name = "policy")
| @XmlType(propOrder = {"annotations", "classLoader",
"beanFactories", "create", "start", "stop",
"destroy", "aliases"})
| public class SecurityDeployment extends AbstractKernelDeployment
| {
|
| private static final long serialVersionUID = 1L;
|
| @Override
| @XmlAnyElement
| @XmlElements({@XmlElement(name = "application-policy", type =
ApplicationPolicyBeanMetaDataFactory.class)})
| public void setBeanFactories(List<BeanMetaDataFactory> beanFactories)
| {
| super.setBeanFactories(beanFactories);
| }
| }
|
When I try to run the ApplicationPolicyFactoryTestCase, the setup() method fails when
deploying the ApplicationPolicyFactoryTestCase.xml with the following error:
| org.jboss.xb.binding.JBossXBException: Failed to parse source:
file:/opt/workspace/Security-JBossSX/security-mc-int/target/test-classes/org/jboss/test/security/microcontainer/beans/ApplicationPolicyFactoryTestCase.xml@5,79
| at
org.jboss.xb.binding.parser.sax.SaxJBossXBParser.parse(SaxJBossXBParser.java:177)
| at org.jboss.xb.binding.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:139)
| at
org.jboss.kernel.plugins.deployment.xml.BasicXMLDeployer.deploy(BasicXMLDeployer.java:147)
| at
org.jboss.test.kernel.junit.MicrocontainerTestDelegate.deploy(MicrocontainerTestDelegate.java:294)
| at
org.jboss.test.kernel.junit.MicrocontainerTestDelegate.deploy(MicrocontainerTestDelegate.java:438)
| at
org.jboss.test.kernel.junit.MicrocontainerTestDelegate.setUp(MicrocontainerTestDelegate.java:83)
| at org.jboss.test.AbstractTestSetup.setUp(AbstractTestSetup.java:63)
| at
org.jboss.test.AbstractTestCaseWithSetup.setUp(AbstractTestCaseWithSetup.java:103)
| at
org.jboss.test.kernel.junit.MicrocontainerTest.setUp(MicrocontainerTest.java:82)
| at
org.jboss.test.security.microcontainer.beans.ApplicationPolicyBeansTestCase.setUp(ApplicationPolicyBeansTestCase.java:59)
| at junit.framework.TestCase.runBare(TestCase.java:125)
| at junit.framework.TestResult$1.protect(TestResult.java:106)
| at junit.framework.TestResult.runProtected(TestResult.java:124)
| at junit.framework.TestResult.run(TestResult.java:109)
| .....
| Caused by: java.lang.RuntimeException: The type of the attribute whenRequired must be
simple or complex with a value adapter:
org.jboss.xb.binding.sunday.unmarshalling.TypeBinding@19113f8[null]
| at org.jboss.beans.metadata.plugins.AbstractDependencyValueMetaData.whenRequiredState
| at org.jboss.beans.metadata.plugins.AbstractConstructorMetaData.factory
| at org.jboss.beans.metadata.plugins.AbstractBeanMetaData.constructor
| at org.jboss.beans.metadata.plugins.AbstractClassLoaderMetaData.classLoader
| at org.jboss.security.microcontainer.beans.metadata.SecurityDeployment.classLoader
| at org.jboss.security.microcontainer.beans.metadata.SecurityDeployment
|
This happens during the @XmlType annotation processing and I really don't know what I
should do to avoid this problem. Any thoughts/ideas?
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4148212#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...