[jboss-cvs] JBossAS SVN: r87726 - in projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs: deployer/bean/test and 2 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Apr 23 09:08:10 EDT 2009
Author: alesj
Date: 2009-04-23 09:08:10 -0400 (Thu, 23 Apr 2009)
New Revision: 87726
Added:
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/deployer/bean/test/VFSRedeployTestCase.java
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/modified/test/MetaDataStructureModificationTreeCacheTestCase.java
Modified:
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/deployer/bean/BeanDeployerTestSuite.java
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/VFSStructureTestSuite.java
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/modified/test/MetaDataStructureModificationTestCase.java
Log:
Merge with trunk, VFSRedeploy fails until we update VFS.
Modified: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/deployer/bean/BeanDeployerTestSuite.java
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/deployer/bean/BeanDeployerTestSuite.java 2009-04-23 13:06:57 UTC (rev 87725)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/deployer/bean/BeanDeployerTestSuite.java 2009-04-23 13:08:10 UTC (rev 87726)
@@ -35,10 +35,11 @@
import org.jboss.test.deployers.vfs.deployer.bean.test.KernelDeployerUnitTestCase;
import org.jboss.test.deployers.vfs.deployer.bean.test.KernelScopeUnitTestCase;
import org.jboss.test.deployers.vfs.deployer.bean.test.AutowireAnnotationBeansTestCase;
+import org.jboss.test.deployers.vfs.deployer.bean.test.VFSRedeployTestCase;
/**
* BeanDeployerTestSuite.
- *
+ *
* @author <a href="adrian at jboss.org">Adrian Brock</a>
* @author <a href="ales.justin at jboss.org">Ales Justin</a>
* @version $Revision: 1.1 $
@@ -65,6 +66,7 @@
suite.addTest(AnnotatedBeansUnitTestCase.suite());
suite.addTest(BuilderBeansUnitTestCase.suite());
suite.addTest(AutowireAnnotationBeansTestCase.suite());
+ suite.addTest(VFSRedeployTestCase.suite());
return suite;
}
Copied: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/deployer/bean/test/VFSRedeployTestCase.java (from rev 87723, projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/deployer/bean/test/VFSRedeployTestCase.java)
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/deployer/bean/test/VFSRedeployTestCase.java (rev 0)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/deployer/bean/test/VFSRedeployTestCase.java 2009-04-23 13:08:10 UTC (rev 87726)
@@ -0,0 +1,140 @@
+/*
+* 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.bean.test;
+
+import java.lang.reflect.Method;
+
+import junit.framework.Test;
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.vfs.deployer.kernel.BeanDeployer;
+import org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataDeployer;
+import org.jboss.deployers.vfs.deployer.kernel.KernelDeploymentDeployer;
+import org.jboss.deployers.vfs.spi.client.VFSDeployment;
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+import org.jboss.kernel.Kernel;
+import org.jboss.test.deployers.support.TCCLClassLoaderDeployer;
+import org.jboss.test.deployers.vfs.deployer.AbstractDeployerUnitTest;
+import org.jboss.virtual.VFS;
+import org.jboss.virtual.VirtualFile;
+import org.jboss.virtual.plugins.cache.LRUVFSCache;
+import org.jboss.virtual.spi.VirtualFileHandler;
+import org.jboss.virtual.spi.cache.VFSCacheFactory;
+
+/**
+ * Tests that a deployer sees the same underlying child during redeployment.
+ *
+ * See JBAS-6715
+ *
+ * @author Jason T. Greene
+ */
+public class VFSRedeployTestCase extends AbstractDeployerUnitTest
+{
+ public VFSRedeployTestCase(String name) throws Throwable
+ {
+ super(name);
+ }
+
+ public static Test suite()
+ {
+ return suite(VFSRedeployTestCase.class);
+ }
+
+ public void setUp() throws Exception
+ {
+ LRUVFSCache cache = new LRUVFSCache(50, 100);
+ cache.start();
+ VFSCacheFactory.setInstance(cache);
+
+ super.setUp();
+ }
+
+ public void tearDown() throws Exception
+ {
+ VFSCacheFactory.setInstance(null);
+ }
+
+ @SuppressWarnings("deprecation")
+ public static class VerifyVirtualFileDeployer extends org.jboss.deployers.vfs.spi.deployer.AbstractVFSRealDeployer
+ {
+ public void deploy(VFSDeploymentUnit unit) throws DeploymentException
+ {
+ VirtualFile deploymentRoot = unit.getRoot();
+ VirtualFile registryRoot;
+ try
+ {
+ registryRoot = VFS.getRoot(deploymentRoot.toURL());
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+
+ VirtualFileHandler deploymentHandler = getHandler(deploymentRoot);
+ VirtualFileHandler registryHandler = getHandler(registryRoot);
+ assertSame(deploymentHandler, registryHandler);
+ }
+
+ public VirtualFileHandler getHandler(VirtualFile file)
+ {
+ try
+ {
+ Method method = VirtualFile.class.getDeclaredMethod("getHandler");
+ method.setAccessible(true);
+ return (VirtualFileHandler)method.invoke(file);
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+
+ }
+ }
+
+ protected void addDeployers(Kernel kernel)
+ {
+ BeanDeployer beanDeployer = new BeanDeployer();
+ KernelDeploymentDeployer kernelDeploymentDeployer = new KernelDeploymentDeployer();
+ BeanMetaDataDeployer beanMetaDataDeployer = new BeanMetaDataDeployer(kernel.getController());
+ addDeployer(main, new TCCLClassLoaderDeployer());
+ addDeployer(main, beanDeployer);
+ addDeployer(main, kernelDeploymentDeployer);
+ addDeployer(main, beanMetaDataDeployer);
+ addDeployer(main, new VerifyVirtualFileDeployer());
+ }
+
+ public void testDeploy() throws Exception
+ {
+ VFSDeployment context = createDeployment("/bean", "/toplevel/test.jar");
+
+ assertDeploy(context);
+ assertUndeploy(context);
+ }
+
+ public void testRedeploy() throws Exception
+ {
+ VFSDeployment context = createDeployment("/bean", "/toplevel/test.jar");
+
+ assertDeploy(context);
+ assertDeploy(context);
+ assertUndeploy(context);
+ }
+}
Modified: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/VFSStructureTestSuite.java
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/VFSStructureTestSuite.java 2009-04-23 13:06:57 UTC (rev 87725)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/VFSStructureTestSuite.java 2009-04-23 13:08:10 UTC (rev 87726)
@@ -38,13 +38,14 @@
import org.jboss.test.deployers.vfs.structure.jar.test.CombinedJARStructureUnitTestCase;
import org.jboss.test.deployers.vfs.structure.jar.test.ConfiguredSuffixJARStructureUnitTestCase;
import org.jboss.test.deployers.vfs.structure.jar.test.JARStructureUnitTestCase;
+import org.jboss.test.deployers.vfs.structure.modified.test.MetaDataStructureModificationTestCase;
+import org.jboss.test.deployers.vfs.structure.modified.test.MetaDataStructureModificationTreeCacheTestCase;
+import org.jboss.test.deployers.vfs.structure.modified.test.SynchModificationTestCase;
import org.jboss.test.deployers.vfs.structure.test.StructureDeployerContextClassLoaderTestCase;
import org.jboss.test.deployers.vfs.structure.test.TerminateStructureTestCase;
import org.jboss.test.deployers.vfs.structure.war.test.CombinedWARStructureUnitTestCase;
import org.jboss.test.deployers.vfs.structure.war.test.WARStructureUnitTestCase;
import org.jboss.test.deployers.vfs.structure.war.test.WARUnpackUnitTestCase;
-import org.jboss.test.deployers.vfs.structure.modified.test.MetaDataStructureModificationTestCase;
-import org.jboss.test.deployers.vfs.structure.modified.test.SynchModificationTestCase;
/**
* VFSStructureTestSuite.
@@ -84,6 +85,7 @@
suite.addTest(DirStructureUnitTestCase.suite());
suite.addTest(RealDirStructureUnitTestCase.suite());
suite.addTest(MetaDataStructureModificationTestCase.suite());
+ suite.addTest(MetaDataStructureModificationTreeCacheTestCase.suite());
suite.addTest(SynchModificationTestCase.suite());
return suite;
Modified: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/modified/test/MetaDataStructureModificationTestCase.java
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/modified/test/MetaDataStructureModificationTestCase.java 2009-04-23 13:06:57 UTC (rev 87725)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/modified/test/MetaDataStructureModificationTestCase.java 2009-04-23 13:08:10 UTC (rev 87726)
@@ -28,6 +28,7 @@
import org.jboss.deployers.structure.spi.main.MainDeployerStructure;
import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
import org.jboss.deployers.vfs.spi.structure.modified.MetaDataStructureModificationChecker;
+import org.jboss.deployers.vfs.spi.structure.modified.StructureCache;
import org.jboss.deployers.vfs.spi.structure.modified.StructureModificationChecker;
import org.jboss.test.deployers.vfs.structure.modified.support.XmlIncludeVirtualFileFilter;
import org.jboss.virtual.AssembledDirectory;
@@ -55,10 +56,16 @@
protected StructureModificationChecker createStructureModificationChecker(MainDeployerStructure mainDeployerStructure, VirtualFileFilter filter)
{
MetaDataStructureModificationChecker structureModificationChecker = new MetaDataStructureModificationChecker(mainDeployerStructure);
+ structureModificationChecker.setCache(createStructureCache());
structureModificationChecker.setFilter(filter);
return structureModificationChecker;
}
+ protected StructureCache<Long> createStructureCache()
+ {
+ return null; // use default
+ }
+
protected VirtualFileFilter createFilter()
{
return new XmlIncludeVirtualFileFilter();
Copied: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/modified/test/MetaDataStructureModificationTreeCacheTestCase.java (from rev 87723, projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/modified/test/MetaDataStructureModificationTreeCacheTestCase.java)
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/modified/test/MetaDataStructureModificationTreeCacheTestCase.java (rev 0)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/modified/test/MetaDataStructureModificationTreeCacheTestCase.java 2009-04-23 13:08:10 UTC (rev 87726)
@@ -0,0 +1,49 @@
+/*
+ * 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.vfs.structure.modified.test;
+
+import junit.framework.Test;
+import org.jboss.deployers.vfs.spi.structure.modified.StructureCache;
+import org.jboss.deployers.vfs.spi.structure.modified.TreeStructureCache;
+
+/**
+ * Test StructureModificationChecker.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class MetaDataStructureModificationTreeCacheTestCase extends MetaDataStructureModificationTestCase
+{
+ public MetaDataStructureModificationTreeCacheTestCase(String name)
+ {
+ super(name);
+ }
+
+ public static Test suite()
+ {
+ return suite(MetaDataStructureModificationTreeCacheTestCase.class);
+ }
+
+ protected StructureCache<Long> createStructureCache()
+ {
+ return new TreeStructureCache<Long>();
+ }
+}
\ No newline at end of file
More information about the jboss-cvs-commits
mailing list