[jboss-cvs] JBossAS SVN: r73651 - in projects/jboss-deployers/trunk/deployers-vfs/src: resources/tests/bean/multiple/allrar.jar and 4 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Sat May 24 05:51:20 EDT 2008
Author: alesj
Date: 2008-05-24 05:51:19 -0400 (Sat, 24 May 2008)
New Revision: 73651
Added:
projects/jboss-deployers/trunk/deployers-vfs/src/resources/tests/bean/multiple/allrar.jar/
projects/jboss-deployers/trunk/deployers-vfs/src/resources/tests/bean/multiple/allrar.jar/META-INF/
projects/jboss-deployers/trunk/deployers-vfs/src/resources/tests/bean/multiple/allrar.jar/META-INF/jboss-rar.xml
projects/jboss-deployers/trunk/deployers-vfs/src/resources/tests/bean/multiple/allrar.jar/META-INF/rar.xml
projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/deployer/merge/support/JBossRarMetaData.java
projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/deployer/merge/support/MockRarDeployer.java
projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/deployer/merge/support/RarDeploymentDeployer.java
projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/deployer/merge/support/RarDeploymentMetaData.java
projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/deployer/merge/support/RarMetaData.java
projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/deployer/merge/test/MockRarUnitTestCase.java
Modified:
projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/deployer/merge/MergeDeployerTestSuite.java
Log:
Mock RAR tests.
Added: projects/jboss-deployers/trunk/deployers-vfs/src/resources/tests/bean/multiple/allrar.jar/META-INF/jboss-rar.xml
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/resources/tests/bean/multiple/allrar.jar/META-INF/jboss-rar.xml (rev 0)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/resources/tests/bean/multiple/allrar.jar/META-INF/jboss-rar.xml 2008-05-24 09:51:19 UTC (rev 73651)
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jboss-rar xmlns="urn:jboss:rar:1.0">
+ <elt>java.lang.Object</elt>
+</jboss-rar>
\ No newline at end of file
Added: projects/jboss-deployers/trunk/deployers-vfs/src/resources/tests/bean/multiple/allrar.jar/META-INF/rar.xml
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/resources/tests/bean/multiple/allrar.jar/META-INF/rar.xml (rev 0)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/resources/tests/bean/multiple/allrar.jar/META-INF/rar.xml 2008-05-24 09:51:19 UTC (rev 73651)
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<rar xmlns="urn:spec:rar:1.0" attrib="Test" />
\ No newline at end of file
Modified: projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/deployer/merge/MergeDeployerTestSuite.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/deployer/merge/MergeDeployerTestSuite.java 2008-05-24 08:36:43 UTC (rev 73650)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/deployer/merge/MergeDeployerTestSuite.java 2008-05-24 09:51:19 UTC (rev 73651)
@@ -25,6 +25,7 @@
import junit.framework.TestSuite;
import junit.textui.TestRunner;
import org.jboss.test.deployers.vfs.deployer.merge.test.BeanMergeUnitTestCase;
+import org.jboss.test.deployers.vfs.deployer.merge.test.MockRarUnitTestCase;
/**
* Merge deployers tests.
@@ -43,6 +44,7 @@
TestSuite suite = new TestSuite("VFS Merge Deployer Tests");
suite.addTest(BeanMergeUnitTestCase.suite());
+ suite.addTest(MockRarUnitTestCase.suite());
return suite;
}
Added: projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/deployer/merge/support/JBossRarMetaData.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/deployer/merge/support/JBossRarMetaData.java (rev 0)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/deployer/merge/support/JBossRarMetaData.java 2008-05-24 09:51:19 UTC (rev 73651)
@@ -0,0 +1,65 @@
+/*
+* 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.deployers.vfs.deployer.merge.support;
+
+import java.io.Serializable;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlNsForm;
+import javax.xml.bind.annotation.XmlRootElement;
+
+import org.jboss.xb.annotations.JBossXmlSchema;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+ at JBossXmlSchema(namespace="urn:jboss:rar:1.0", elementFormDefault=XmlNsForm.QUALIFIED)
+ at XmlRootElement(name="jboss-rar")
+public class JBossRarMetaData implements Serializable
+{
+ public static final long serialUIDVersion = 1l;
+
+ private String attribute;
+ private String element;
+
+ public String getAttribute()
+ {
+ return attribute;
+ }
+
+ @XmlAttribute(name = "attrib")
+ public void setAttribute(String attribute)
+ {
+ this.attribute = attribute;
+ }
+
+ public String getElement()
+ {
+ return element;
+ }
+
+ @XmlElement(name = "elt")
+ public void setElement(String element)
+ {
+ this.element = element;
+ }
+}
\ No newline at end of file
Copied: projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/deployer/merge/support/MockRarDeployer.java (from rev 73648, projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/deployer/merge/support/TestBeanMergeDeployer.java)
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/deployer/merge/support/MockRarDeployer.java (rev 0)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/deployer/merge/support/MockRarDeployer.java 2008-05-24 09:51:19 UTC (rev 73651)
@@ -0,0 +1,54 @@
+/*
+* 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.deployers.vfs.deployer.merge.support;
+
+import org.jboss.deployers.vfs.spi.deployer.JBossExtensionDeployer;
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class MockRarDeployer extends JBossExtensionDeployer<RarMetaData, JBossRarMetaData, RarDeploymentMetaData>
+{
+ public MockRarDeployer()
+ {
+ super(RarDeploymentMetaData.class, "rar.xml", RarMetaData.class, "jboss-rar.xml", JBossRarMetaData.class);
+ }
+
+ protected RarDeploymentMetaData mergeMetaData(VFSDeploymentUnit unit, RarMetaData spec, JBossRarMetaData jboss) throws Exception
+ {
+ RarDeploymentMetaData deployment = new RarDeploymentMetaData();
+ if (spec != null)
+ {
+ deployment.setAttribute(spec.getAttribute());
+ deployment.setElement(spec.getElement());
+ }
+ if (jboss != null)
+ {
+ if (jboss.getAttribute() != null)
+ deployment.setAttribute(jboss.getAttribute());
+ if (jboss.getElement() != null)
+ deployment.setElement(jboss.getElement());
+ }
+ return deployment;
+ }
+}
\ No newline at end of file
Added: projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/deployer/merge/support/RarDeploymentDeployer.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/deployer/merge/support/RarDeploymentDeployer.java (rev 0)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/deployer/merge/support/RarDeploymentDeployer.java 2008-05-24 09:51:19 UTC (rev 73651)
@@ -0,0 +1,45 @@
+/*
+* 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.deployers.vfs.deployer.merge.support;
+
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.beans.metadata.spi.BeanMetaData;
+import org.jboss.beans.metadata.plugins.AbstractBeanMetaData;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class RarDeploymentDeployer extends AbstractSimpleRealDeployer<RarDeploymentMetaData>
+{
+ public RarDeploymentDeployer()
+ {
+ super(RarDeploymentMetaData.class);
+ setOutput(BeanMetaData.class);
+ }
+
+ public void deploy(DeploymentUnit unit, RarDeploymentMetaData deployment) throws DeploymentException
+ {
+ unit.addAttachment(BeanMetaData.class, new AbstractBeanMetaData(deployment.getAttribute(), deployment.getElement()));
+ }
+}
\ No newline at end of file
Added: projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/deployer/merge/support/RarDeploymentMetaData.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/deployer/merge/support/RarDeploymentMetaData.java (rev 0)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/deployer/merge/support/RarDeploymentMetaData.java 2008-05-24 09:51:19 UTC (rev 73651)
@@ -0,0 +1,55 @@
+/*
+* 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.deployers.vfs.deployer.merge.support;
+
+import java.io.Serializable;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class RarDeploymentMetaData implements Serializable
+{
+ public static final long serialUIDVersion = 1l;
+
+ private String attribute;
+ private String element;
+
+ public String getAttribute()
+ {
+ return attribute;
+ }
+
+ public void setAttribute(String attribute)
+ {
+ this.attribute = attribute;
+ }
+
+ public String getElement()
+ {
+ return element;
+ }
+
+ public void setElement(String element)
+ {
+ this.element = element;
+ }
+}
\ No newline at end of file
Added: projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/deployer/merge/support/RarMetaData.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/deployer/merge/support/RarMetaData.java (rev 0)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/deployer/merge/support/RarMetaData.java 2008-05-24 09:51:19 UTC (rev 73651)
@@ -0,0 +1,65 @@
+/*
+* 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.deployers.vfs.deployer.merge.support;
+
+import java.io.Serializable;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlNsForm;
+import javax.xml.bind.annotation.XmlRootElement;
+
+import org.jboss.xb.annotations.JBossXmlSchema;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+ at JBossXmlSchema(namespace="urn:spec:rar:1.0", elementFormDefault=XmlNsForm.QUALIFIED)
+ at XmlRootElement(name="rar")
+public class RarMetaData implements Serializable
+{
+ public static final long serialUIDVersion = 1l;
+
+ private String attribute;
+ private String element;
+
+ public String getAttribute()
+ {
+ return attribute;
+ }
+
+ @XmlAttribute(name = "attrib")
+ public void setAttribute(String attribute)
+ {
+ this.attribute = attribute;
+ }
+
+ public String getElement()
+ {
+ return element;
+ }
+
+ @XmlElement(name = "elt")
+ public void setElement(String element)
+ {
+ this.element = element;
+ }
+}
Added: projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/deployer/merge/test/MockRarUnitTestCase.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/deployer/merge/test/MockRarUnitTestCase.java (rev 0)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/deployer/merge/test/MockRarUnitTestCase.java 2008-05-24 09:51:19 UTC (rev 73651)
@@ -0,0 +1,80 @@
+/*
+* 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.deployers.vfs.deployer.merge.test;
+
+import junit.framework.Test;
+import org.jboss.test.deployers.vfs.deployer.AbstractDeployerUnitTest;
+import org.jboss.test.deployers.vfs.deployer.merge.support.MockRarDeployer;
+import org.jboss.test.deployers.vfs.deployer.merge.support.RarDeploymentDeployer;
+import org.jboss.kernel.Kernel;
+import org.jboss.deployers.vfs.deployer.kernel.KernelDeploymentDeployer;
+import org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataDeployer;
+import org.jboss.deployers.vfs.spi.client.VFSDeployment;
+import org.jboss.beans.metadata.plugins.AbstractBeanMetaData;
+import org.jboss.dependency.spi.ControllerContext;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class MockRarUnitTestCase extends AbstractDeployerUnitTest
+{
+ public MockRarUnitTestCase(String name) throws Throwable
+ {
+ super(name);
+ }
+
+ public static Test suite()
+ {
+ return suite(MockRarUnitTestCase.class);
+ }
+
+ protected void addDeployers(Kernel kernel)
+ {
+ MockRarDeployer rard = new MockRarDeployer();
+ try
+ {
+ controller.install(new AbstractBeanMetaData("rard", MockRarDeployer.class.getName()), rard);
+ }
+ catch (Throwable t)
+ {
+ throw new RuntimeException(t);
+ }
+ addDeployer(main, rard);
+ addDeployer(main, new RarDeploymentDeployer());
+ addDeployer(main, new KernelDeploymentDeployer());
+ addDeployer(main, new BeanMetaDataDeployer(kernel));
+ }
+
+ public void testRarMerge() throws Exception
+ {
+ VFSDeployment deployment = createDeployment("/bean", "multiple/allrar.jar");
+ assertDeploy(deployment);
+ ControllerContext context = controller.getInstalledContext("Test");
+ assertNotNull(context);
+ Object target = context.getTarget();
+ assertNotNull(target);
+ assertEquals(Object.class, target.getClass());
+
+ assertUndeploy(deployment);
+ assertNull(controller.getContext("Test", null));
+ }
+}
More information about the jboss-cvs-commits
mailing list