[jboss-cvs] JBossAS SVN: r78532 - in projects/jboss-cl/branches/Branch_2_0/classloading-vfs/src/test/java/org/jboss/test/classloading: vfs/policy/test and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Sep 15 08:10:43 EDT 2008


Author: adrian at jboss.org
Date: 2008-09-15 08:10:43 -0400 (Mon, 15 Sep 2008)
New Revision: 78532

Added:
   projects/jboss-cl/branches/Branch_2_0/classloading-vfs/src/test/java/org/jboss/test/classloading/vfs/policy/test/PackageInfoUnitTestCase.java
Modified:
   projects/jboss-cl/branches/Branch_2_0/classloading-vfs/src/test/java/org/jboss/test/classloading/ClassLoadingVFSTestSuite.java
Log:
[JBCL-43] - Port the test from trunk

Modified: projects/jboss-cl/branches/Branch_2_0/classloading-vfs/src/test/java/org/jboss/test/classloading/ClassLoadingVFSTestSuite.java
===================================================================
--- projects/jboss-cl/branches/Branch_2_0/classloading-vfs/src/test/java/org/jboss/test/classloading/ClassLoadingVFSTestSuite.java	2008-09-15 12:10:26 UTC (rev 78531)
+++ projects/jboss-cl/branches/Branch_2_0/classloading-vfs/src/test/java/org/jboss/test/classloading/ClassLoadingVFSTestSuite.java	2008-09-15 12:10:43 UTC (rev 78532)
@@ -38,6 +38,7 @@
 import org.jboss.test.classloading.vfs.metadata.test.VFSResourceVisitorUnitTestCase;
 import org.jboss.test.classloading.vfs.metadata.xml.test.VFSClassLoaderFactoryXMLUnitTestCase;
 import org.jboss.test.classloading.vfs.policy.test.ExportAllUnitTestCase;
+import org.jboss.test.classloading.vfs.policy.test.PackageInfoUnitTestCase;
 
 /**
  * ClassLoading VFS Test Suite.
@@ -79,6 +80,7 @@
       suite.addTest(UsesPackageUnitTestCase.suite());
       suite.addTest(VFSResourceVisitorUnitTestCase.suite());
       suite.addTest(ClientClassPathUnitTestCase.suite());
+      suite.addTest(PackageInfoUnitTestCase.suite());
 
       return suite;
    }

Added: projects/jboss-cl/branches/Branch_2_0/classloading-vfs/src/test/java/org/jboss/test/classloading/vfs/policy/test/PackageInfoUnitTestCase.java
===================================================================
--- projects/jboss-cl/branches/Branch_2_0/classloading-vfs/src/test/java/org/jboss/test/classloading/vfs/policy/test/PackageInfoUnitTestCase.java	                        (rev 0)
+++ projects/jboss-cl/branches/Branch_2_0/classloading-vfs/src/test/java/org/jboss/test/classloading/vfs/policy/test/PackageInfoUnitTestCase.java	2008-09-15 12:10:43 UTC (rev 78532)
@@ -0,0 +1,81 @@
+/*
+ * 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 junit.framework.Test;
+import junit.framework.TestSuite;
+
+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: 78503 $
+ */
+public class PackageInfoUnitTestCase extends BaseTestCase
+{
+
+   public PackageInfoUnitTestCase(String name)
+   {
+      super(name);
+   }
+
+   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);
+   }
+
+   public static Test suite()
+   {
+      return new TestSuite(PackageInfoUnitTestCase.class);
+   }
+}




More information about the jboss-cvs-commits mailing list