[jboss-cvs] JBossAS SVN: r103652 - in projects/scanning/trunk/testsuite/src/test: java/org/jboss/test/scanning/metadata and 5 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Apr 7 15:37:50 EDT 2010


Author: alesj
Date: 2010-04-07 15:37:49 -0400 (Wed, 07 Apr 2010)
New Revision: 103652

Added:
   projects/scanning/trunk/testsuite/src/test/java/org/jboss/test/scanning/metadata/
   projects/scanning/trunk/testsuite/src/test/java/org/jboss/test/scanning/metadata/test/
   projects/scanning/trunk/testsuite/src/test/java/org/jboss/test/scanning/metadata/test/ScanningMetaDataTestCase.java
   projects/scanning/trunk/testsuite/src/test/resources/metadata/
   projects/scanning/trunk/testsuite/src/test/resources/metadata/smoke/
   projects/scanning/trunk/testsuite/src/test/resources/metadata/smoke/META-INF/
   projects/scanning/trunk/testsuite/src/test/resources/metadata/smoke/META-INF/jboss-scanning.xml
Log:
Port metadata tests.

Added: projects/scanning/trunk/testsuite/src/test/java/org/jboss/test/scanning/metadata/test/ScanningMetaDataTestCase.java
===================================================================
--- projects/scanning/trunk/testsuite/src/test/java/org/jboss/test/scanning/metadata/test/ScanningMetaDataTestCase.java	                        (rev 0)
+++ projects/scanning/trunk/testsuite/src/test/java/org/jboss/test/scanning/metadata/test/ScanningMetaDataTestCase.java	2010-04-07 19:37:49 UTC (rev 103652)
@@ -0,0 +1,114 @@
+/*
+ * 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.metadata.test;
+
+import java.util.List;
+import java.util.Set;
+
+import org.jboss.deployers.vfs.plugins.structure.AbstractVFSDeploymentContext;
+import org.jboss.deployers.vfs.plugins.structure.AbstractVFSDeploymentUnit;
+import org.jboss.deployers.vfs.spi.deployer.SchemaResolverDeployer;
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentContext;
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+import org.jboss.scanning.deployers.metadata.ScanningMetaDataDeployer;
+import org.jboss.scanning.plugins.metadata.AbstractScanningMetaData;
+import org.jboss.scanning.spi.metadata.PathEntryMetaData;
+import org.jboss.scanning.spi.metadata.PathMetaData;
+import org.jboss.scanning.spi.metadata.ScanningMetaData;
+import org.jboss.test.deployers.BaseDeployersVFSTest;
+import org.jboss.vfs.VirtualFile;
+
+import junit.framework.Test;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class ScanningMetaDataTestCase extends BaseDeployersVFSTest
+{
+   public ScanningMetaDataTestCase(String name)
+   {
+      super(name);
+   }
+
+   public static Test suite()
+   {
+      return suite(ScanningMetaDataTestCase.class);
+   }
+
+   public void testSMDRead() throws Exception
+   {
+      SchemaResolverDeployer<AbstractScanningMetaData> deployer = new ScanningMetaDataDeployer();
+      deployer.create();
+      try
+      {
+         VirtualFile file = getVirtualFile("/metadata", "smoke");
+         VFSDeploymentContext deployment = new AbstractVFSDeploymentContext(file, "");
+         deployment.setMetaDataPath(createMetaDataEntries("META-INF"));
+         VFSDeploymentUnit unit = new AbstractVFSDeploymentUnit(deployment);
+         deployer.deploy(unit);
+         try
+         {
+            ScanningMetaData metaData = unit.getAttachment(ScanningMetaData.class);
+            assertNotNull(metaData);
+            List<PathMetaData> paths = metaData.getPaths();
+            assertNotNull(paths);
+            assertEquals(2, paths.size());
+
+            PathMetaData pmd = paths.get(0);
+            assertNotNull(pmd);
+            assertEquals("myejbs.jar", pmd.getPathName());
+            Set<PathEntryMetaData> includes = pmd.getIncludes();
+            assertNotNull(includes);
+            assertEquals(1, includes.size());
+            PathEntryMetaData pemd = includes.iterator().next();
+            assertNotNull(pemd);
+            assertEquals("com.acme.foo", pemd.getName());
+            Set<PathEntryMetaData> excludes = pmd.getExcludes();
+            assertNotNull(excludes);
+            pemd = excludes.iterator().next();
+            assertNotNull(pemd);
+            assertEquals("com.acme.foo.bar", pemd.getName());
+            assertEquals(1, excludes.size());
+
+            pmd = paths.get(1);
+            assertNotNull(pmd);
+            assertEquals("my.war/WEB-INF/classes", pmd.getPathName());
+            includes = pmd.getIncludes();
+            assertNotNull(includes);
+            assertEquals(1, includes.size());
+            pemd = includes.iterator().next();
+            assertNotNull(pemd);
+            assertEquals("com.acme.foo", pemd.getName());
+            assertNull(pmd.getExcludes());
+         }
+         finally
+         {
+            deployer.undeploy(unit);
+         }
+      }
+      finally
+      {
+         deployer.destroy();
+      }
+   }
+}

Added: projects/scanning/trunk/testsuite/src/test/resources/metadata/smoke/META-INF/jboss-scanning.xml
===================================================================
--- projects/scanning/trunk/testsuite/src/test/resources/metadata/smoke/META-INF/jboss-scanning.xml	                        (rev 0)
+++ projects/scanning/trunk/testsuite/src/test/resources/metadata/smoke/META-INF/jboss-scanning.xml	2010-04-07 19:37:49 UTC (rev 103652)
@@ -0,0 +1,9 @@
+<scanning xmlns="urn:jboss:scanning:1.0">
+  <path name="myejbs.jar">
+    <include name="com.acme.foo"/>
+    <exclude name="com.acme.foo.bar"/>
+  </path>
+  <path name="my.war/WEB-INF/classes">
+    <include name="com.acme.foo"/>
+  </path>
+</scanning>




More information about the jboss-cvs-commits mailing list