[jboss-cvs] JBossAS SVN: r104114 - in projects/scanning/trunk: testsuite/src/test/java/org/jboss/test/scanning and 4 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Apr 21 08:32:11 EDT 2010
Author: alesj
Date: 2010-04-21 08:32:09 -0400 (Wed, 21 Apr 2010)
New Revision: 104114
Added:
projects/scanning/trunk/testsuite/src/test/java/org/jboss/test/scanning/smoke/support/
projects/scanning/trunk/testsuite/src/test/java/org/jboss/test/scanning/smoke/support/TIFScanningPlugin.java
projects/scanning/trunk/testsuite/src/test/java/org/jboss/test/scanning/smoke/support/TIFScanningPluginFactory.java
projects/scanning/trunk/testsuite/src/test/resources/org/jboss/test/scanning/smoke/test/DeploymentSmokeTestCase#testJavassistTypeInfo.xml
projects/scanning/trunk/testsuite/src/test/resources/org/jboss/test/scanning/smoke/test/DeploymentSmokeTestCase#testSubSub.xml
Removed:
projects/scanning/trunk/testsuite/src/test/resources/org/jboss/test/scanning/smoke/test/DeploymentSmokeTestCase.xml
Modified:
projects/scanning/trunk/pom.xml
projects/scanning/trunk/testsuite/src/test/java/org/jboss/test/scanning/ScanningDeployersTest.java
projects/scanning/trunk/testsuite/src/test/java/org/jboss/test/scanning/ScanningDeployersTestDelegate.java
projects/scanning/trunk/testsuite/src/test/java/org/jboss/test/scanning/smoke/test/DeploymentSmokeTestCase.java
Log:
Test JavassistTIF cache.
Modified: projects/scanning/trunk/pom.xml
===================================================================
--- projects/scanning/trunk/pom.xml 2010-04-21 12:31:26 UTC (rev 104113)
+++ projects/scanning/trunk/pom.xml 2010-04-21 12:32:09 UTC (rev 104114)
@@ -39,7 +39,7 @@
<version.org.jboss.mc-int>2.2.0.Alpha2</version.org.jboss.mc-int>
<version.org.jboss.weld-int>6.0.0.Beta11</version.org.jboss.weld-int>
<version.javax.faces>2.0.2-FCS</version.javax.faces>
- <version.javassist>3.11.0.GA</version.javassist>
+ <version.javassist>3.12.0.GA</version.javassist>
<version.ant>1.7.1</version.ant>
<version.hibernate>3.5.0-CR-2</version.hibernate>
<version.junit>4.4</version.junit>
@@ -80,6 +80,10 @@
<name>xb.builder.useUnorderedSequence</name>
<value>true</value>
</property>
+ <property>
+ <name>org.jboss.reflect.spi.TypeInfoFactory</name>
+ <value>org.jboss.reflect.plugins.javassist.JavassistTypeInfoFactory</value>
+ </property>
</systemProperties>
</configuration>
</plugin>
Modified: projects/scanning/trunk/testsuite/src/test/java/org/jboss/test/scanning/ScanningDeployersTest.java
===================================================================
--- projects/scanning/trunk/testsuite/src/test/java/org/jboss/test/scanning/ScanningDeployersTest.java 2010-04-21 12:31:26 UTC (rev 104113)
+++ projects/scanning/trunk/testsuite/src/test/java/org/jboss/test/scanning/ScanningDeployersTest.java 2010-04-21 12:32:09 UTC (rev 104114)
@@ -353,10 +353,17 @@
protected void tearDown() throws Exception
{
- for (Closeable handle : assemblyHandles.values())
+ try
{
- handle.close();
+ for (Closeable handle : assemblyHandles.values())
+ {
+ handle.close();
+ }
}
+ finally
+ {
+ super.tearDown();
+ }
}
}
Modified: projects/scanning/trunk/testsuite/src/test/java/org/jboss/test/scanning/ScanningDeployersTestDelegate.java
===================================================================
--- projects/scanning/trunk/testsuite/src/test/java/org/jboss/test/scanning/ScanningDeployersTestDelegate.java 2010-04-21 12:31:26 UTC (rev 104113)
+++ projects/scanning/trunk/testsuite/src/test/java/org/jboss/test/scanning/ScanningDeployersTestDelegate.java 2010-04-21 12:32:09 UTC (rev 104114)
@@ -120,6 +120,8 @@
protected void deploy() throws Exception
{
+ //System.setProperty(TIF_KEY, JAVASSIST_TIF);
+
deployBootstrap("bootstrap");
deployBootstrap("classpool");
@@ -143,7 +145,7 @@
{
super.undeploy();
- AbstractClassPoolFactory.setSystemClassPool(SystemClassPool.getInstance());
+ AbstractClassPoolFactory.setSystemClassPool(SystemClassPool.getInstance());
}
protected MainDeployerImpl getMainDeployer()
Added: projects/scanning/trunk/testsuite/src/test/java/org/jboss/test/scanning/smoke/support/TIFScanningPlugin.java
===================================================================
--- projects/scanning/trunk/testsuite/src/test/java/org/jboss/test/scanning/smoke/support/TIFScanningPlugin.java (rev 0)
+++ projects/scanning/trunk/testsuite/src/test/java/org/jboss/test/scanning/smoke/support/TIFScanningPlugin.java 2010-04-21 12:32:09 UTC (rev 104114)
@@ -0,0 +1,87 @@
+/*
+ * 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.scanning.smoke.support;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.jboss.classloading.spi.visitor.ResourceContext;
+import org.jboss.classloading.spi.visitor.ResourceFilter;
+import org.jboss.reflect.spi.TypeInfo;
+import org.jboss.scanning.plugins.visitor.ReflectProvider;
+import org.jboss.scanning.spi.ScanningHandle;
+import org.jboss.scanning.spi.helpers.AbstractScanningPlugin;
+import org.jboss.scanning.spi.helpers.AllRecurseFilter;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class TIFScanningPlugin extends AbstractScanningPlugin<TIFScanningPlugin, TIFScanningPlugin> implements ScanningHandle<TIFScanningPlugin>
+{
+ private Map<String, TypeInfo> resources = new HashMap<String, TypeInfo>();
+ private ReflectProvider provider;
+
+ public TIFScanningPlugin(ReflectProvider provider)
+ {
+ this.provider = provider;
+ }
+
+ @Override
+ protected TIFScanningPlugin doCreateHandle()
+ {
+ return this;
+ }
+
+ public Class<TIFScanningPlugin> getHandleInterface()
+ {
+ return TIFScanningPlugin.class;
+ }
+
+ public ResourceFilter getFilter()
+ {
+ return AllRecurseFilter.INSTANCE;
+ }
+
+ public void visit(ResourceContext resource)
+ {
+ try
+ {
+ TypeInfo typeInfo = provider.getTypeInfo(resource);
+ resources.put(typeInfo.getName(), typeInfo);
+ }
+ catch (Throwable t)
+ {
+ throw new RuntimeException(t);
+ }
+ }
+
+ public void merge(TIFScanningPlugin subHandle)
+ {
+ }
+
+ public Map<String, TypeInfo> getResources()
+ {
+ return Collections.unmodifiableMap(resources);
+ }
+}
Added: projects/scanning/trunk/testsuite/src/test/java/org/jboss/test/scanning/smoke/support/TIFScanningPluginFactory.java
===================================================================
--- projects/scanning/trunk/testsuite/src/test/java/org/jboss/test/scanning/smoke/support/TIFScanningPluginFactory.java (rev 0)
+++ projects/scanning/trunk/testsuite/src/test/java/org/jboss/test/scanning/smoke/support/TIFScanningPluginFactory.java 2010-04-21 12:32:09 UTC (rev 104114)
@@ -0,0 +1,46 @@
+/*
+ * 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.scanning.smoke.support;
+
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.scanning.plugins.DeploymentScanningPluginFactory;
+import org.jboss.scanning.plugins.helpers.DeploymentUtilsFactory;
+import org.jboss.scanning.plugins.visitor.ReflectProvider;
+import org.jboss.scanning.spi.ScanningPlugin;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class TIFScanningPluginFactory implements DeploymentScanningPluginFactory<TIFScanningPlugin, TIFScanningPlugin>
+{
+ public boolean isRelevant(DeploymentUnit unit)
+ {
+ return true;
+ }
+
+ public ScanningPlugin<TIFScanningPlugin, TIFScanningPlugin> create(DeploymentUnit unit)
+ {
+ ReflectProvider provider = DeploymentUtilsFactory.getProvider(unit);
+ return new TIFScanningPlugin(provider);
+ }
+}
\ No newline at end of file
Modified: projects/scanning/trunk/testsuite/src/test/java/org/jboss/test/scanning/smoke/test/DeploymentSmokeTestCase.java
===================================================================
--- projects/scanning/trunk/testsuite/src/test/java/org/jboss/test/scanning/smoke/test/DeploymentSmokeTestCase.java 2010-04-21 12:31:26 UTC (rev 104113)
+++ projects/scanning/trunk/testsuite/src/test/java/org/jboss/test/scanning/smoke/test/DeploymentSmokeTestCase.java 2010-04-21 12:32:09 UTC (rev 104114)
@@ -25,6 +25,9 @@
import java.util.Set;
import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.kernel.Kernel;
+import org.jboss.kernel.spi.config.KernelConfigurator;
+import org.jboss.reflect.spi.TypeInfo;
import org.jboss.scanning.annotations.spi.AnnotationIndex;
import org.jboss.test.scanning.ScanningDeployersTest;
import org.jboss.test.scanning.annotations.support.Marked;
@@ -32,6 +35,7 @@
import org.jboss.test.scanning.annotations.support.jar.JarMarkOnClass;
import org.jboss.test.scanning.annotations.support.jar.impl.JarMarkOnClassImpl;
import org.jboss.test.scanning.annotations.support.util.Util;
+import org.jboss.test.scanning.smoke.support.TIFScanningPlugin;
import org.jboss.vfs.VFS;
import org.jboss.vfs.VirtualFile;
@@ -52,7 +56,7 @@
return suite(DeploymentSmokeTestCase.class);
}
- public void testSubSub() throws Exception
+ public void testSubSub() throws Throwable
{
VirtualFile ear = createTopLevelWithUtil();
createAssembledDirectory(ear.getChild("my.jar"))
@@ -79,6 +83,33 @@
}
}
+ public void testJavassistTypeInfo() throws Throwable
+ {
+ VirtualFile jar = VFS.getChild(getName()).getChild("top.jar");
+ createAssembledDirectory(jar)
+ .addPackage(JarMarkOnClassImpl.class)
+ .addPackage(JarMarkOnClass.class);
+
+ DeploymentUnit unit = assertDeploy(jar);
+ try
+ {
+ TIFScanningPlugin plugin = unit.getAttachment(TIFScanningPlugin.class);
+ assertNotNull(plugin);
+
+ Kernel kernel = assertBean("Kernel", Kernel.class);
+ KernelConfigurator configurator = kernel.getConfigurator();
+
+ String name = JarMarkOnClass.class.getName();
+ TypeInfo ti = configurator.getTypeInfo(name, unit.getClassLoader());
+ TypeInfo visited = plugin.getResources().get(name);
+ assertSame(ti, visited); // let's check if the cache is working
+ }
+ finally
+ {
+ undeploy(unit);
+ }
+ }
+
protected VirtualFile createTopLevelWithUtil() throws Exception
{
VirtualFile topLevel = VFS.getChild(getName()).getChild("top-level.ear");
Added: projects/scanning/trunk/testsuite/src/test/resources/org/jboss/test/scanning/smoke/test/DeploymentSmokeTestCase#testJavassistTypeInfo.xml
===================================================================
--- projects/scanning/trunk/testsuite/src/test/resources/org/jboss/test/scanning/smoke/test/DeploymentSmokeTestCase#testJavassistTypeInfo.xml (rev 0)
+++ projects/scanning/trunk/testsuite/src/test/resources/org/jboss/test/scanning/smoke/test/DeploymentSmokeTestCase#testJavassistTypeInfo.xml 2010-04-21 12:32:09 UTC (rev 104114)
@@ -0,0 +1,14 @@
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+ <bean name="AnnEnvDeployer" class="org.jboss.scanning.deployers.ScanningDeployer">
+ <incallback method="addFactory" />
+ <uncallback method="removeFactory" />
+ </bean>
+
+ <bean name="Kernel">
+ <constructor><inject bean="jboss.kernel:service=Kernel"/></constructor>
+ </bean>
+
+ <bean name="AnnScanningPlugin" class="org.jboss.test.scanning.smoke.support.TIFScanningPluginFactory"/>
+
+</deployment>
Copied: projects/scanning/trunk/testsuite/src/test/resources/org/jboss/test/scanning/smoke/test/DeploymentSmokeTestCase#testSubSub.xml (from rev 104085, projects/scanning/trunk/testsuite/src/test/resources/org/jboss/test/scanning/smoke/test/DeploymentSmokeTestCase.xml)
===================================================================
--- projects/scanning/trunk/testsuite/src/test/resources/org/jboss/test/scanning/smoke/test/DeploymentSmokeTestCase#testSubSub.xml (rev 0)
+++ projects/scanning/trunk/testsuite/src/test/resources/org/jboss/test/scanning/smoke/test/DeploymentSmokeTestCase#testSubSub.xml 2010-04-21 12:32:09 UTC (rev 104114)
@@ -0,0 +1,13 @@
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+ <bean name="EarStructure" class="org.jboss.test.deployers.vfs.structure.ear.support.MockEarStructureDeployer"/>
+ <bean name="WarStructure" class="org.jboss.deployers.vfs.plugins.structure.war.WARStructure"/>
+
+ <bean name="AnnEnvDeployer" class="org.jboss.scanning.deployers.ScanningDeployer">
+ <incallback method="addFactory" />
+ <uncallback method="removeFactory" />
+ </bean>
+
+ <bean name="AnnScanningPlugin" class="org.jboss.scanning.annotations.plugins.AnnotationsScanningPluginFactory"/>
+
+</deployment>
Deleted: projects/scanning/trunk/testsuite/src/test/resources/org/jboss/test/scanning/smoke/test/DeploymentSmokeTestCase.xml
===================================================================
--- projects/scanning/trunk/testsuite/src/test/resources/org/jboss/test/scanning/smoke/test/DeploymentSmokeTestCase.xml 2010-04-21 12:31:26 UTC (rev 104113)
+++ projects/scanning/trunk/testsuite/src/test/resources/org/jboss/test/scanning/smoke/test/DeploymentSmokeTestCase.xml 2010-04-21 12:32:09 UTC (rev 104114)
@@ -1,13 +0,0 @@
-<deployment xmlns="urn:jboss:bean-deployer:2.0">
-
- <bean name="EarStructure" class="org.jboss.test.deployers.vfs.structure.ear.support.MockEarStructureDeployer"/>
- <bean name="WarStructure" class="org.jboss.deployers.vfs.plugins.structure.war.WARStructure"/>
-
- <bean name="AnnEnvDeployer" class="org.jboss.scanning.deployers.ScanningDeployer">
- <incallback method="addFactory" />
- <uncallback method="removeFactory" />
- </bean>
-
- <bean name="AnnScanningPlugin" class="org.jboss.scanning.annotations.plugins.AnnotationsScanningPluginFactory"/>
-
-</deployment>
More information about the jboss-cvs-commits
mailing list