[jboss-cvs] JBossAS SVN: r107552 - in projects/scanning/trunk/testsuite/src/test: java/org/jboss/test/scanning/annotations/support and 4 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Aug 12 07:26:22 EDT 2010


Author: alesj
Date: 2010-08-12 07:26:21 -0400 (Thu, 12 Aug 2010)
New Revision: 107552

Added:
   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/jbcts/
   projects/scanning/trunk/testsuite/src/test/java/org/jboss/test/scanning/annotations/support/jbcts/Classes.java
   projects/scanning/trunk/testsuite/src/test/java/org/jboss/test/scanning/annotations/support/jbcts/Provider.java
   projects/scanning/trunk/testsuite/src/test/java/org/jboss/test/scanning/annotations/support/jbcts/a/
   projects/scanning/trunk/testsuite/src/test/java/org/jboss/test/scanning/annotations/support/jbcts/a/A.java
   projects/scanning/trunk/testsuite/src/test/java/org/jboss/test/scanning/annotations/test/SmokeAnnotationsScanningTestCase.java
   projects/scanning/trunk/testsuite/src/test/resources/org/jboss/test/scanning/annotations/test/SmokeAnnotationsScanningTestCase.xml
Modified:
   projects/scanning/trunk/testsuite/src/test/java/org/jboss/test/scanning/annotations/AnnotationsTestSuite.java
   projects/scanning/trunk/testsuite/src/test/java/org/jboss/test/scanning/annotations/test/AnnotationsScanningTestCase.java
Log:
[JBCTS-1039]; test mssing annotation's value class.

Modified: projects/scanning/trunk/testsuite/src/test/java/org/jboss/test/scanning/annotations/AnnotationsTestSuite.java
===================================================================
--- projects/scanning/trunk/testsuite/src/test/java/org/jboss/test/scanning/annotations/AnnotationsTestSuite.java	2010-08-12 10:02:55 UTC (rev 107551)
+++ projects/scanning/trunk/testsuite/src/test/java/org/jboss/test/scanning/annotations/AnnotationsTestSuite.java	2010-08-12 11:26:21 UTC (rev 107552)
@@ -25,6 +25,7 @@
 import org.jboss.test.scanning.annotations.test.AnnotationEnvTestCase;
 import org.jboss.test.scanning.annotations.test.AnnotationsScanningTestCase;
 import org.jboss.test.scanning.annotations.test.AnnotationsScanningWithMetaDataTestCase;
+import org.jboss.test.scanning.annotations.test.SmokeAnnotationsScanningTestCase;
 
 import junit.framework.Test;
 import junit.framework.TestSuite;
@@ -44,6 +45,7 @@
    {
       TestSuite suite = new TestSuite("Annotations Scanning Tests");
 
+      suite.addTest(SmokeAnnotationsScanningTestCase.suite());
       suite.addTest(AnnotationEnvTestCase.suite());
       suite.addTest(AnnotationsScanningTestCase.suite());
       suite.addTest(AnnotationsScanningWithMetaDataTestCase.suite());

Added: 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/ErrorHandlerDeployer.java	                        (rev 0)
+++ projects/scanning/trunk/testsuite/src/test/java/org/jboss/test/scanning/annotations/support/ErrorHandlerDeployer.java	2010-08-12 11:26:21 UTC (rev 107552)
@@ -0,0 +1,57 @@
+/*
+ * 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.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.DeploymentStages;
+import org.jboss.deployers.spi.deployer.helpers.AbstractDeployer;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.scanning.plugins.visitor.ErrorHandler;
+import org.jboss.scanning.plugins.visitor.IgnoreSetErrorHandler;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class ErrorHandlerDeployer extends AbstractDeployer
+{
+   private ErrorHandler errorHandler;
+
+   public ErrorHandlerDeployer()
+   {
+      this(new IgnoreSetErrorHandler());
+   }
+
+   public ErrorHandlerDeployer(ErrorHandler errorHandler)
+   {
+      if (errorHandler == null)
+         throw new IllegalArgumentException("Null error handler");
+
+      setStage(DeploymentStages.DESCRIBE);
+      this.errorHandler = errorHandler;
+   }
+
+   public void deploy(DeploymentUnit unit) throws DeploymentException
+   {
+      unit.addAttachment(ErrorHandler.class, errorHandler);
+   }
+}

Added: projects/scanning/trunk/testsuite/src/test/java/org/jboss/test/scanning/annotations/support/jbcts/Classes.java
===================================================================
--- projects/scanning/trunk/testsuite/src/test/java/org/jboss/test/scanning/annotations/support/jbcts/Classes.java	                        (rev 0)
+++ projects/scanning/trunk/testsuite/src/test/java/org/jboss/test/scanning/annotations/support/jbcts/Classes.java	2010-08-12 11:26:21 UTC (rev 107552)
@@ -0,0 +1,38 @@
+/*
+ * 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.jbcts;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+ at Target(ElementType.TYPE)
+ at Retention(RetentionPolicy.RUNTIME)
+public @interface Classes
+{
+   Class<?>[] value() default {};
+}

Added: projects/scanning/trunk/testsuite/src/test/java/org/jboss/test/scanning/annotations/support/jbcts/Provider.java
===================================================================
--- projects/scanning/trunk/testsuite/src/test/java/org/jboss/test/scanning/annotations/support/jbcts/Provider.java	                        (rev 0)
+++ projects/scanning/trunk/testsuite/src/test/java/org/jboss/test/scanning/annotations/support/jbcts/Provider.java	2010-08-12 11:26:21 UTC (rev 107552)
@@ -0,0 +1,33 @@
+/*
+ * 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.jbcts;
+
+import org.jboss.test.scanning.annotations.support.jbcts.a.A;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+ at Classes({A.class})
+public class Provider
+{
+}

Added: projects/scanning/trunk/testsuite/src/test/java/org/jboss/test/scanning/annotations/support/jbcts/a/A.java
===================================================================
--- projects/scanning/trunk/testsuite/src/test/java/org/jboss/test/scanning/annotations/support/jbcts/a/A.java	                        (rev 0)
+++ projects/scanning/trunk/testsuite/src/test/java/org/jboss/test/scanning/annotations/support/jbcts/a/A.java	2010-08-12 11:26:21 UTC (rev 107552)
@@ -0,0 +1,30 @@
+/*
+ * 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.jbcts.a;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class A
+{
+}

Modified: projects/scanning/trunk/testsuite/src/test/java/org/jboss/test/scanning/annotations/test/AnnotationsScanningTestCase.java
===================================================================
--- projects/scanning/trunk/testsuite/src/test/java/org/jboss/test/scanning/annotations/test/AnnotationsScanningTestCase.java	2010-08-12 10:02:55 UTC (rev 107551)
+++ projects/scanning/trunk/testsuite/src/test/java/org/jboss/test/scanning/annotations/test/AnnotationsScanningTestCase.java	2010-08-12 11:26:21 UTC (rev 107552)
@@ -21,15 +21,16 @@
 */
 package org.jboss.test.scanning.annotations.test;
 
-import junit.framework.Test;
+import java.util.Set;
+
 import org.jboss.deployers.structure.spi.DeploymentUnit;
 import org.jboss.scanning.annotations.spi.AnnotationIndex;
 import org.jboss.test.scanning.annotations.support.Marked;
 import org.jboss.test.scanning.annotations.support.jar.JarMarkOnImplementedInterface;
+
+import junit.framework.Test;
 import org.junit.Assert;
 
-import java.util.Set;
-
 /**
  * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
  */
@@ -57,8 +58,6 @@
       Set<String> classes = env.classesImplementingInterfacesAnnotatedWith(Marked.class.getName());
       Assert.assertEquals(1, classes.size());
       Assert.assertEquals(JarMarkOnImplementedInterface.class.getName(), classes.iterator().next());
-
-
    }
 
    protected void assertWar(DeploymentUnit war)

Copied: projects/scanning/trunk/testsuite/src/test/java/org/jboss/test/scanning/annotations/test/SmokeAnnotationsScanningTestCase.java (from rev 106592, projects/scanning/trunk/testsuite/src/test/java/org/jboss/test/scanning/annotations/test/AbstractAnnotationsScanningTest.java)
===================================================================
--- projects/scanning/trunk/testsuite/src/test/java/org/jboss/test/scanning/annotations/test/SmokeAnnotationsScanningTestCase.java	                        (rev 0)
+++ projects/scanning/trunk/testsuite/src/test/java/org/jboss/test/scanning/annotations/test/SmokeAnnotationsScanningTestCase.java	2010-08-12 11:26:21 UTC (rev 107552)
@@ -0,0 +1,89 @@
+/*
+* 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.scanning.annotations.test;
+
+import java.util.Set;
+
+import org.jboss.classloader.plugins.jdk.AbstractJDKChecker;
+import org.jboss.test.scanning.ScanningDeployersTest;
+import org.jboss.test.scanning.annotations.support.jbcts.Classes;
+import org.jboss.vfs.VFS;
+import org.jboss.vfs.VirtualFile;
+
+import junit.framework.Test;
+
+/**
+ * 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";
+
+   public SmokeAnnotationsScanningTestCase(String name)
+   {
+      super(name);
+   }
+
+   public static Test suite()
+   {
+      return suite(SmokeAnnotationsScanningTestCase.class);
+   }
+
+   @Override
+   protected void setUp() throws Exception
+   {
+      super.setUp();
+
+      Set<Class<?>> classes = AbstractJDKChecker.getExcluded();
+      Class<?> sysClass = getClass().getClassLoader().loadClass(sysClassName);
+      classes.add(sysClass);
+   }
+
+   @Override
+   protected void tearDown() throws Exception
+   {
+      Set<Class<?>> classes = AbstractJDKChecker.getExcluded();
+      Class<?> sysClass = getClass().getClassLoader().loadClass(sysClassName);
+      classes.remove(sysClass);
+      
+      super.tearDown();
+   }
+
+   public void testMissingAnnotationsValueClass() throws Throwable
+   {
+      VirtualFile jar = VFS.getChild(getName()).getChild("top-level.jar");
+      createAssembledDirectory(jar).addPackage(Classes.class); // Provider is missing A.class
+
+      try
+      {
+         assertDeploy(jar);
+         fail("Should not be here.");
+      }
+      catch (Exception e)
+      {
+         getLog().info(e);
+      }
+   }
+}
\ No newline at end of file

Copied: projects/scanning/trunk/testsuite/src/test/resources/org/jboss/test/scanning/annotations/test/SmokeAnnotationsScanningTestCase.xml (from rev 106592, projects/scanning/trunk/testsuite/src/test/resources/org/jboss/test/scanning/annotations/test/AnnotationsScanningTestCase.xml)
===================================================================
--- projects/scanning/trunk/testsuite/src/test/resources/org/jboss/test/scanning/annotations/test/SmokeAnnotationsScanningTestCase.xml	                        (rev 0)
+++ projects/scanning/trunk/testsuite/src/test/resources/org/jboss/test/scanning/annotations/test/SmokeAnnotationsScanningTestCase.xml	2010-08-12 11:26:21 UTC (rev 107552)
@@ -0,0 +1,12 @@
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+  <bean name="EHDeployer" class="org.jboss.test.scanning.annotations.support.ErrorHandlerDeployer"/>
+
+  <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