[jboss-cvs] JBossAS SVN: r107558 - in projects/scanning/trunk/testsuite/src/test/java/org/jboss/test/scanning/annotations: test and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Aug 12 10:21:37 EDT 2010
Author: alesj
Date: 2010-08-12 10:21:36 -0400 (Thu, 12 Aug 2010)
New Revision: 107558
Added:
projects/scanning/trunk/testsuite/src/test/java/org/jboss/test/scanning/annotations/support/TempJDKChecker.java
Modified:
projects/scanning/trunk/testsuite/src/test/java/org/jboss/test/scanning/annotations/test/SmokeAnnotationsScanningTestCase.java
Log:
[JBCTS-1039]; ignore Javassist requesting class.
Copied: projects/scanning/trunk/testsuite/src/test/java/org/jboss/test/scanning/annotations/support/TempJDKChecker.java (from rev 107552, projects/scanning/trunk/testsuite/src/test/java/org/jboss/test/scanning/annotations/support/ErrorHandlerDeployer.java)
===================================================================
--- projects/scanning/trunk/testsuite/src/test/java/org/jboss/test/scanning/annotations/support/TempJDKChecker.java (rev 0)
+++ projects/scanning/trunk/testsuite/src/test/java/org/jboss/test/scanning/annotations/support/TempJDKChecker.java 2010-08-12 14:21:36 UTC (rev 107558)
@@ -0,0 +1,43 @@
+/*
+ * 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.annotations.support;
+
+import org.jboss.classloader.plugins.jdk.AbstractJDKChecker;
+import org.jboss.test.scanning.annotations.support.jbcts.a.A;
+
+/**
+ * Temp JDK checker.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class TempJDKChecker extends AbstractJDKChecker
+{
+ @Override
+ protected boolean isJDKRequestingClass(String name, Class<?> requesting)
+ {
+ if (A.class.getName().equals(name))
+ throw new Error("Req: " + requesting);
+
+ return super.isJDKRequestingClass(name, requesting);
+ }
+}
Modified: projects/scanning/trunk/testsuite/src/test/java/org/jboss/test/scanning/annotations/test/SmokeAnnotationsScanningTestCase.java
===================================================================
--- projects/scanning/trunk/testsuite/src/test/java/org/jboss/test/scanning/annotations/test/SmokeAnnotationsScanningTestCase.java 2010-08-12 12:27:25 UTC (rev 107557)
+++ projects/scanning/trunk/testsuite/src/test/java/org/jboss/test/scanning/annotations/test/SmokeAnnotationsScanningTestCase.java 2010-08-12 14:21:36 UTC (rev 107558)
@@ -24,6 +24,7 @@
import java.util.Set;
import org.jboss.classloader.plugins.jdk.AbstractJDKChecker;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
import org.jboss.test.scanning.ScanningDeployersTest;
import org.jboss.test.scanning.annotations.support.jbcts.Classes;
import org.jboss.vfs.VFS;
@@ -33,13 +34,14 @@
/**
* Smoke tests -- annotation scanning.
- *
+ *
* @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
*/
public class SmokeAnnotationsScanningTestCase extends ScanningDeployersTest
{
// TODO -- configurable system class
private String sysClassName = "sun.reflect.generics.factory.CoreReflectionFactory";
+ private String sysJavassist = "javassist.bytecode.annotation.MemberValue";
public SmokeAnnotationsScanningTestCase(String name)
{
@@ -57,20 +59,29 @@
super.setUp();
Set<Class<?>> classes = AbstractJDKChecker.getExcluded();
- Class<?> sysClass = getClass().getClassLoader().loadClass(sysClassName);
+ ClassLoader cl = getClass().getClassLoader();
+ // jdk system
+ Class<?> sysClass = cl.loadClass(sysClassName);
classes.add(sysClass);
+ // javassist
+ Class<?> javassistClass = cl.loadClass(sysJavassist);
+ classes.add(javassistClass);
}
@Override
protected void tearDown() throws Exception
{
Set<Class<?>> classes = AbstractJDKChecker.getExcluded();
- Class<?> sysClass = getClass().getClassLoader().loadClass(sysClassName);
+ ClassLoader cl = getClass().getClassLoader();
+ Class<?> sysClass = cl.loadClass(sysClassName);
classes.remove(sysClass);
-
+ Class<?> javassistClass = cl.loadClass(sysJavassist);
+ classes.remove(javassistClass);
+
super.tearDown();
}
+ @SuppressWarnings({"UnusedDeclaration"})
public void testMissingAnnotationsValueClass() throws Throwable
{
VirtualFile jar = VFS.getChild(getName()).getChild("top-level.jar");
@@ -78,7 +89,16 @@
try
{
- assertDeploy(jar);
+ DeploymentUnit unit = assertDeploy(jar);
+// AnnotationIndex ai = unit.getAttachment(AnnotationIndex.class);
+// assertNotNull(ai);
+// Set<Element<Annotation, Class<?>>> elementSet = ai.classIsAnnotatedWith(Classes.class.getName());
+// Element<Annotation, Class<?>> elt = elementSet.iterator().next();
+// Annotation ann = elt.getAnnotation();
+// Object value = ann.getClass().getMethod("value").invoke(ann);
+// Class[] classes = Class[].class.cast(value);
+// ClassLoader cl = classes[0].getClassLoader();
+// getLog().fatal("cl=" + cl);
fail("Should not be here.");
}
catch (Exception e)
More information about the jboss-cvs-commits
mailing list