[jboss-cvs] JBossAS SVN: r78503 - in projects/jboss-cl/trunk/classloading-vfs/src/test: resources/classloader and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Sun Sep 14 00:56:22 EDT 2008


Author: scott.stark at jboss.org
Date: 2008-09-14 00:56:22 -0400 (Sun, 14 Sep 2008)
New Revision: 78503

Added:
   projects/jboss-cl/trunk/classloading-vfs/src/test/java/org/jboss/test/classloading/vfs/policy/test/PackageInfoUnitTestCase.java
Modified:
   projects/jboss-cl/trunk/classloading-vfs/src/test/resources/classloader/testear1x.ear
Log:
JBCL-43, add a test showing the problem

Added: projects/jboss-cl/trunk/classloading-vfs/src/test/java/org/jboss/test/classloading/vfs/policy/test/PackageInfoUnitTestCase.java
===================================================================
--- projects/jboss-cl/trunk/classloading-vfs/src/test/java/org/jboss/test/classloading/vfs/policy/test/PackageInfoUnitTestCase.java	                        (rev 0)
+++ projects/jboss-cl/trunk/classloading-vfs/src/test/java/org/jboss/test/classloading/vfs/policy/test/PackageInfoUnitTestCase.java	2008-09-14 04:56:22 UTC (rev 78503)
@@ -0,0 +1,79 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * 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.classloading.vfs.policy.test;
+
+import java.net.URL;
+
+import org.jboss.classloader.spi.PackageInformation;
+import org.jboss.classloading.spi.metadata.ExportAll;
+import org.jboss.classloading.spi.vfs.policy.VFSClassLoaderPolicy;
+import org.jboss.test.BaseTestCase;
+import org.jboss.virtual.VFS;
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * Package related tests of VFSClassLoaderPolicy
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public class PackageInfoUnitTestCase extends BaseTestCase
+{
+
+   public PackageInfoUnitTestCase(String name)
+   {
+      super(name);
+      // TODO Auto-generated constructor stub
+   }
+
+   /**
+    * Test that non-package directories are not returned as package info
+    * {@link https://jira.jboss.org/jira/browse/JBCL-43}
+    * @throws Exception
+    */
+   public void testCorrectPackage()
+      throws Exception
+   {
+      URL testear1xURL = getResource("/classloader/testear1x.ear");
+      VirtualFile testear1x = VFS.getRoot(testear1xURL);
+      VirtualFile jar1 = testear1x.getChild("lib/jar1.jar");
+      assertNotNull(jar1);
+      VirtualFile jar2 = testear1x.getChild("lib/jar2.jar");
+      assertNotNull(jar2);
+      VFSClassLoaderPolicy policy = VFSClassLoaderPolicy.createVFSClassLoaderPolicy("testCorrectPackage", testear1x, jar2, jar1);
+      policy.setExportAll(ExportAll.NON_EMPTY);
+      policy.setImportAll(true);
+
+      PackageInformation utilInfo = policy.getPackageInformation("util");
+      /*
+      Specification-Title: testear1x.ear/lib/jar1.jar
+      Specification-Version: 1.0.1.GA
+      Specification-Vendor: JBoss
+      Implementation-Title: JBoss [division of RedHat]
+      Implementation-URL: http://www.jboss.org/
+      Implementation-Version: 1.0.1.GA 
+      Implementation-Vendor: JBoss.org
+      Implementation-Vendor-Id: http://www.jboss.org/
+       */
+      assertEquals("testear1x.ear/lib/jar1.jar", utilInfo.specTitle);
+      assertEquals("1.0.1.GA", utilInfo.specVersion);
+   }
+}


Property changes on: projects/jboss-cl/trunk/classloading-vfs/src/test/java/org/jboss/test/classloading/vfs/policy/test/PackageInfoUnitTestCase.java
___________________________________________________________________
Name: svn:keywords
   + Revision

Modified: projects/jboss-cl/trunk/classloading-vfs/src/test/resources/classloader/testear1x.ear
===================================================================
(Binary files differ)




More information about the jboss-cvs-commits mailing list