[jboss-cvs] JBossAS SVN: r106397 - in trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers: test and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Jul 2 08:58:10 EDT 2010
Author: kabir.khan at jboss.com
Date: 2010-07-02 08:58:09 -0400 (Fri, 02 Jul 2010)
New Revision: 106397
Added:
trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/test/AbstractDeploymentTest.java
trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/test/FlatDeploymentTestCase.java
Removed:
trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/AbstractDeploymentTest.java
trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/FlatDeploymentTestCase.java
Modified:
trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/VFSTestSuite.java
Log:
Fix FlatDeploymentTestCase. The test and the xml were in different packages
Deleted: trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/AbstractDeploymentTest.java
===================================================================
--- trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/AbstractDeploymentTest.java 2010-07-02 10:16:17 UTC (rev 106396)
+++ trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/AbstractDeploymentTest.java 2010-07-02 12:58:09 UTC (rev 106397)
@@ -1,163 +0,0 @@
-/*
- * 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.deployers;
-
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
-import org.jboss.test.deployers.support.MockEmptyEjbServices;
-import org.jboss.test.deployers.support.crm.CrmWebBean;
-import org.jboss.test.deployers.support.ejb.BusinessInterface;
-import org.jboss.test.deployers.support.ejb.MySLSBean;
-import org.jboss.test.deployers.support.ext.ExternalWebBean;
-import org.jboss.test.deployers.support.jar.PlainJavaBean;
-import org.jboss.test.deployers.support.ui.UIWebBean;
-import org.jboss.test.deployers.support.web.ServletWebBean;
-import org.jboss.test.deployers.test.AbstractWeldTest;
-import org.jboss.vfs.VirtualFile;
-import org.jboss.weld.bootstrap.spi.BeanDeploymentArchive;
-import org.jboss.weld.bootstrap.spi.Deployment;
-import org.jboss.weld.integration.deployer.DeployersUtils;
-
-/**
- * Abstract Deployment test case.
- *
- * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
- */
-public abstract class AbstractDeploymentTest extends AbstractWeldTest
-{
- protected AbstractDeploymentTest(String name)
- {
- super(name);
- }
-
- protected void getArchives(List<BeanDeploymentArchive> result, Collection<BeanDeploymentArchive> archives)
- {
- for (BeanDeploymentArchive bda : archives)
- {
- result.add(bda);
- getArchives(result, bda.getBeanDeploymentArchives());
- }
- }
-
- protected abstract int getExpectedArchives();
-
- public void testSimpleUsage() throws Exception
- {
- VirtualFile ear = createBasicEar(MockEmptyEjbServices.class);
- VFSDeploymentUnit topUnit = assertDeploy(ear);
- try
- {
- assertBean(DeployersUtils.getBootstrapBeanName(topUnit), null, Object.class);
-
- Object bean = getBean(Deployment.class);
- Deployment deployment = assertInstanceOf(bean, Deployment.class, false);
-
- List<BeanDeploymentArchive> archives = new ArrayList<BeanDeploymentArchive>();
- getArchives(archives, deployment.getBeanDeploymentArchives());
- assertEquals(getExpectedArchives(), archives.size());
-
- List<URL> urls = new ArrayList<URL>();
- List<Class<?>> classes = new ArrayList<Class<?>>();
- for (BeanDeploymentArchive bad : archives)
- {
- for (URL url : bad.getBeansXml())
- urls.add(url);
- for (Class<?> clazz : bad.getBeanClasses())
- classes.add(clazz);
- }
-
- Set<String> expected = new HashSet<String>();
- addExpectedResource(expected, "ejbs.jar");
- addExpectedResource(expected, "ext.jar");
- addExpectedResource(expected, "simple.jar");
- addExpectedResource(expected, "ui.jar");
- addExpectedResource(expected, "crm.jar");
- addExpectedResource(expected, "simple.war", "/WEB-INF/beans.xml");
-
- assertEquals("Illegal size or urls.", urls.size(), expected.size());
-
- for (URL url : urls)
- {
- boolean found = false;
- Iterator<String> iter = expected.iterator();
- while (iter.hasNext())
- {
- String expectedURL = iter.next();
- if (url.toExternalForm().contains(expectedURL))
- {
- iter.remove();
- found = true;
- break;
- }
- }
- assertTrue("Unexpected wb url: " + url, found);
- }
-
- addExpectedClass(expected, BusinessInterface.class);
- addExpectedClass(expected, MySLSBean.class);
- addExpectedClass(expected, ExternalWebBean.class);
- addExpectedClass(expected, PlainJavaBean.class);
- addExpectedClass(expected, UIWebBean.class);
- addExpectedClass(expected, ServletWebBean.class);
- addExpectedClass(expected, CrmWebBean.class);
-
- assertEquals("Illegal size or classes.", classes.size(), expected.size());
-
- for (Class<?> clazz : classes)
- assertTrue(expected.remove(clazz.getName()));
-
- assertEmpty("Should be emtpy, missing " + expected, expected);
-
- Class<?> newBeanClass = topUnit.getClassLoader().loadClass("org.jboss.test.deployers.support.MockTransactionServices");
- BeanDeploymentArchive newBDA = deployment.loadBeanDeploymentArchive(newBeanClass);
- assertNewBeanDeploymentArchive(archives, newBDA);
- }
- finally
- {
- undeploy(topUnit);
- }
- }
-
- protected abstract void assertNewBeanDeploymentArchive(List<BeanDeploymentArchive> archives, BeanDeploymentArchive newBDA);
-
- private static void addExpectedResource(Set<String> expected, String unit)
- {
- addExpectedResource(expected, unit, "/META-INF/beans.xml");
- }
-
- private static void addExpectedResource(Set<String> expected, String unit, String suffix)
- {
- expected.add(unit + suffix);
- }
-
- private static void addExpectedClass(Set<String> expected, Class<?> clazz)
- {
- expected.add(clazz.getName());
- }
-}
\ No newline at end of file
Deleted: trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/FlatDeploymentTestCase.java
===================================================================
--- trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/FlatDeploymentTestCase.java 2010-07-02 10:16:17 UTC (rev 106396)
+++ trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/FlatDeploymentTestCase.java 2010-07-02 12:58:09 UTC (rev 106397)
@@ -1,56 +0,0 @@
-/*
- * 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.deployers;
-
-import java.util.List;
-
-import junit.framework.Test;
-import org.jboss.weld.bootstrap.spi.BeanDeploymentArchive;
-
-/**
- * Flat Deployment test case.
- *
- * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
- */
-public class FlatDeploymentTestCase extends AbstractDeploymentTest
-{
- public FlatDeploymentTestCase(String name)
- {
- super(name);
- }
-
- public static Test suite()
- {
- return suite(FlatDeploymentTestCase.class);
- }
-
-
- protected int getExpectedArchives()
- {
- return 1; // flat only
- }
-
- protected void assertNewBeanDeploymentArchive(List<BeanDeploymentArchive> archives, BeanDeploymentArchive newBDA)
- {
- assertSame(newBDA, archives.iterator().next());
- }
-}
\ No newline at end of file
Modified: trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/VFSTestSuite.java
===================================================================
--- trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/VFSTestSuite.java 2010-07-02 10:16:17 UTC (rev 106396)
+++ trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/VFSTestSuite.java 2010-07-02 12:58:09 UTC (rev 106397)
@@ -26,6 +26,7 @@
import junit.textui.TestRunner;
import org.jboss.test.deployers.test.BootDeployerTestCase;
import org.jboss.test.deployers.test.CLIsolationTestCase;
+import org.jboss.test.deployers.test.FlatDeploymentTestCase;
import org.jboss.test.deployers.test.PostDeployersTestCase;
import org.jboss.test.deployers.test.SmokeTestCase;
import org.jboss.test.deployers.test.WeldDiscoveryEnvTestCase;
Copied: trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/test/AbstractDeploymentTest.java (from rev 106360, trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/AbstractDeploymentTest.java)
===================================================================
--- trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/test/AbstractDeploymentTest.java (rev 0)
+++ trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/test/AbstractDeploymentTest.java 2010-07-02 12:58:09 UTC (rev 106397)
@@ -0,0 +1,163 @@
+/*
+ * 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.deployers.test;
+
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+import org.jboss.test.deployers.support.MockEmptyEjbServices;
+import org.jboss.test.deployers.support.crm.CrmWebBean;
+import org.jboss.test.deployers.support.ejb.BusinessInterface;
+import org.jboss.test.deployers.support.ejb.MySLSBean;
+import org.jboss.test.deployers.support.ext.ExternalWebBean;
+import org.jboss.test.deployers.support.jar.PlainJavaBean;
+import org.jboss.test.deployers.support.ui.UIWebBean;
+import org.jboss.test.deployers.support.web.ServletWebBean;
+import org.jboss.test.deployers.test.AbstractWeldTest;
+import org.jboss.vfs.VirtualFile;
+import org.jboss.weld.bootstrap.spi.BeanDeploymentArchive;
+import org.jboss.weld.bootstrap.spi.Deployment;
+import org.jboss.weld.integration.deployer.DeployersUtils;
+
+/**
+ * Abstract Deployment test case.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public abstract class AbstractDeploymentTest extends AbstractWeldTest
+{
+ protected AbstractDeploymentTest(String name)
+ {
+ super(name);
+ }
+
+ protected void getArchives(List<BeanDeploymentArchive> result, Collection<BeanDeploymentArchive> archives)
+ {
+ for (BeanDeploymentArchive bda : archives)
+ {
+ result.add(bda);
+ getArchives(result, bda.getBeanDeploymentArchives());
+ }
+ }
+
+ protected abstract int getExpectedArchives();
+
+ public void testSimpleUsage() throws Exception
+ {
+ VirtualFile ear = createBasicEar(MockEmptyEjbServices.class);
+ VFSDeploymentUnit topUnit = assertDeploy(ear);
+ try
+ {
+ assertBean(DeployersUtils.getBootstrapBeanName(topUnit), null, Object.class);
+
+ Object bean = getBean(Deployment.class);
+ Deployment deployment = assertInstanceOf(bean, Deployment.class, false);
+
+ List<BeanDeploymentArchive> archives = new ArrayList<BeanDeploymentArchive>();
+ getArchives(archives, deployment.getBeanDeploymentArchives());
+ assertEquals(getExpectedArchives(), archives.size());
+
+ List<URL> urls = new ArrayList<URL>();
+ List<Class<?>> classes = new ArrayList<Class<?>>();
+ for (BeanDeploymentArchive bad : archives)
+ {
+ for (URL url : bad.getBeansXml())
+ urls.add(url);
+ for (Class<?> clazz : bad.getBeanClasses())
+ classes.add(clazz);
+ }
+
+ Set<String> expected = new HashSet<String>();
+ addExpectedResource(expected, "ejbs.jar");
+ addExpectedResource(expected, "ext.jar");
+ addExpectedResource(expected, "simple.jar");
+ addExpectedResource(expected, "ui.jar");
+ addExpectedResource(expected, "crm.jar");
+ addExpectedResource(expected, "simple.war", "/WEB-INF/beans.xml");
+
+ assertEquals("Illegal size or urls.", urls.size(), expected.size());
+
+ for (URL url : urls)
+ {
+ boolean found = false;
+ Iterator<String> iter = expected.iterator();
+ while (iter.hasNext())
+ {
+ String expectedURL = iter.next();
+ if (url.toExternalForm().contains(expectedURL))
+ {
+ iter.remove();
+ found = true;
+ break;
+ }
+ }
+ assertTrue("Unexpected wb url: " + url, found);
+ }
+
+ addExpectedClass(expected, BusinessInterface.class);
+ addExpectedClass(expected, MySLSBean.class);
+ addExpectedClass(expected, ExternalWebBean.class);
+ addExpectedClass(expected, PlainJavaBean.class);
+ addExpectedClass(expected, UIWebBean.class);
+ addExpectedClass(expected, ServletWebBean.class);
+ addExpectedClass(expected, CrmWebBean.class);
+
+ assertEquals("Illegal size or classes.", classes.size(), expected.size());
+
+ for (Class<?> clazz : classes)
+ assertTrue(expected.remove(clazz.getName()));
+
+ assertEmpty("Should be emtpy, missing " + expected, expected);
+
+ Class<?> newBeanClass = topUnit.getClassLoader().loadClass("org.jboss.test.deployers.support.MockTransactionServices");
+ BeanDeploymentArchive newBDA = deployment.loadBeanDeploymentArchive(newBeanClass);
+ assertNewBeanDeploymentArchive(archives, newBDA);
+ }
+ finally
+ {
+ undeploy(topUnit);
+ }
+ }
+
+ protected abstract void assertNewBeanDeploymentArchive(List<BeanDeploymentArchive> archives, BeanDeploymentArchive newBDA);
+
+ private static void addExpectedResource(Set<String> expected, String unit)
+ {
+ addExpectedResource(expected, unit, "/META-INF/beans.xml");
+ }
+
+ private static void addExpectedResource(Set<String> expected, String unit, String suffix)
+ {
+ expected.add(unit + suffix);
+ }
+
+ private static void addExpectedClass(Set<String> expected, Class<?> clazz)
+ {
+ expected.add(clazz.getName());
+ }
+}
\ No newline at end of file
Copied: trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/test/FlatDeploymentTestCase.java (from rev 106360, trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/FlatDeploymentTestCase.java)
===================================================================
--- trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/test/FlatDeploymentTestCase.java (rev 0)
+++ trunk/weld-int/deployer/src/test/java/org/jboss/test/deployers/test/FlatDeploymentTestCase.java 2010-07-02 12:58:09 UTC (rev 106397)
@@ -0,0 +1,56 @@
+/*
+ * 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.deployers.test;
+
+import java.util.List;
+
+import junit.framework.Test;
+import org.jboss.weld.bootstrap.spi.BeanDeploymentArchive;
+
+/**
+ * Flat Deployment test case.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class FlatDeploymentTestCase extends AbstractDeploymentTest
+{
+ public FlatDeploymentTestCase(String name)
+ {
+ super(name);
+ }
+
+ public static Test suite()
+ {
+ return suite(FlatDeploymentTestCase.class);
+ }
+
+
+ protected int getExpectedArchives()
+ {
+ return 1; // flat only
+ }
+
+ protected void assertNewBeanDeploymentArchive(List<BeanDeploymentArchive> archives, BeanDeploymentArchive newBDA)
+ {
+ assertSame(newBDA, archives.iterator().next());
+ }
+}
\ No newline at end of file
More information about the jboss-cvs-commits
mailing list