[jboss-cvs] JBossAS SVN: r107050 - in projects/cl-benchmark/trunk/src/test/java/org/jboss/test/cl/benchmark: test and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Jul 23 09:34:35 EDT 2010


Author: kabir.khan at jboss.com
Date: 2010-07-23 09:34:34 -0400 (Fri, 23 Jul 2010)
New Revision: 107050

Added:
   projects/cl-benchmark/trunk/src/test/java/org/jboss/test/cl/benchmark/SiblingTestSetCreator.java
   projects/cl-benchmark/trunk/src/test/java/org/jboss/test/cl/benchmark/SiblingVFSClassLoaderBenchmarkTestDelegate.java
   projects/cl-benchmark/trunk/src/test/java/org/jboss/test/cl/benchmark/test/AbstractSiblingVFSClassLoaderBenchmark.java
   projects/cl-benchmark/trunk/src/test/java/org/jboss/test/cl/benchmark/test/SiblingVFSImportExportAllOtherAlreadyLoadedLoaderBenchmarkTestCase.java
   projects/cl-benchmark/trunk/src/test/java/org/jboss/test/cl/benchmark/test/SiblingVFSImportExportAllOtherNotAlreadyLoadedLoaderBenchmarkTestCase.java
   projects/cl-benchmark/trunk/src/test/java/org/jboss/test/cl/benchmark/test/SiblingVFSImportExportAllOwnLoaderBenchmarkTestCase.java
   projects/cl-benchmark/trunk/src/test/java/org/jboss/test/cl/benchmark/test/SiblingVFSImportModuleLoaderBenchmarkTestCase.java
   projects/cl-benchmark/trunk/src/test/java/org/jboss/test/cl/benchmark/test/SiblingVFSImportPackageLoaderBenchmarkTestCase.java
Modified:
   projects/cl-benchmark/trunk/src/test/java/org/jboss/test/cl/benchmark/AbstractClassLoaderBenchmark.java
   projects/cl-benchmark/trunk/src/test/java/org/jboss/test/cl/benchmark/AbstractTestSetCreator.java
   projects/cl-benchmark/trunk/src/test/java/org/jboss/test/cl/benchmark/ThreeDeepTestSetCreator.java
   projects/cl-benchmark/trunk/src/test/java/org/jboss/test/cl/benchmark/ThreeDeepVFSClassLoaderBenchmarkTestDelegate.java
Log:
Simpler sibling loading tests just testing one lookup

Modified: projects/cl-benchmark/trunk/src/test/java/org/jboss/test/cl/benchmark/AbstractClassLoaderBenchmark.java
===================================================================
--- projects/cl-benchmark/trunk/src/test/java/org/jboss/test/cl/benchmark/AbstractClassLoaderBenchmark.java	2010-07-23 13:21:57 UTC (rev 107049)
+++ projects/cl-benchmark/trunk/src/test/java/org/jboss/test/cl/benchmark/AbstractClassLoaderBenchmark.java	2010-07-23 13:34:34 UTC (rev 107050)
@@ -22,6 +22,7 @@
 package org.jboss.test.cl.benchmark;
 
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Iterator;
 import java.util.List;
 
@@ -128,4 +129,16 @@
       }
    }
    
+   protected String[] mergeArrays(String[] array1, String[] array2)
+   {
+      if (array2 == null)
+         return array1;
+      if (array1 == null)
+         return array2;
+      String[] all = Arrays.copyOf(array1, array1.length + array2.length);
+      System.arraycopy(array2, 0, all, array1.length, array2.length);
+      return all;
+      
+   }
+   
 }

Modified: projects/cl-benchmark/trunk/src/test/java/org/jboss/test/cl/benchmark/AbstractTestSetCreator.java
===================================================================
--- projects/cl-benchmark/trunk/src/test/java/org/jboss/test/cl/benchmark/AbstractTestSetCreator.java	2010-07-23 13:21:57 UTC (rev 107049)
+++ projects/cl-benchmark/trunk/src/test/java/org/jboss/test/cl/benchmark/AbstractTestSetCreator.java	2010-07-23 13:34:34 UTC (rev 107050)
@@ -50,17 +50,13 @@
  */
 public abstract class AbstractTestSetCreator
 {
-   final static int NUMBER_JARS = 2;
-   final static int PACKAGES_PER_JAR = 2;
-   final static int CLASSES_PER_PACKAGE = 2;
-   
    private List<ClassPathElementInfo> classPathElements = new ArrayList<ClassPathElementInfo>();
 
    protected final File classesDir;
    
    protected final File jarsDir;
    
-   AbstractTestSetCreator() throws Exception
+   AbstractTestSetCreator(String suffix) throws Exception
    {
       URL url = this.getClass().getProtectionDomain().getCodeSource().getLocation();
       File file = new File(url.toURI());
@@ -69,8 +65,8 @@
       if (!file.isDirectory())
          throw new IllegalStateException(file + " is not a directory");
       
-      classesDir = new File(file.getParentFile(), "generated-classes"); 
-      jarsDir = new File(file.getParentFile(), "generated-jars");
+      classesDir = new File(file.getParentFile(), "generated-classes-" + suffix); 
+      jarsDir = new File(file.getParentFile(), "generated-jars-" + suffix);
       
       if (!jarsDir.exists())
       {

Added: projects/cl-benchmark/trunk/src/test/java/org/jboss/test/cl/benchmark/SiblingTestSetCreator.java
===================================================================
--- projects/cl-benchmark/trunk/src/test/java/org/jboss/test/cl/benchmark/SiblingTestSetCreator.java	                        (rev 0)
+++ projects/cl-benchmark/trunk/src/test/java/org/jboss/test/cl/benchmark/SiblingTestSetCreator.java	2010-07-23 13:34:34 UTC (rev 107050)
@@ -0,0 +1,97 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, 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.cl.benchmark;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class SiblingTestSetCreator extends AbstractTestSetCreator
+{
+   final static int NUMBER_JARS = 2;
+   final static int PACKAGES_PER_JAR = 1;
+   final static int CLASSES_PER_PACKAGE = 1;
+   
+
+   public SiblingTestSetCreator() throws Exception
+   {
+      super("sibling");
+   }
+
+   @Override
+   protected void createClassesAndJars() throws Exception
+   {
+      for (int jar = 0 ; jar < NUMBER_JARS ; jar++)
+      {
+         for (int pkg = 0 ; pkg < PACKAGES_PER_JAR ; pkg++)
+         {
+            for (int clazz = 0 ; clazz < CLASSES_PER_PACKAGE ; clazz++)
+            {
+               createClass(getImplName(jar, pkg, clazz), Object.class.getName());
+            }
+         }
+         createJar(getImplJarName(jar), classesDir);
+      }
+   }
+   
+   @Override
+   protected void createClassPathElementInfos() throws Exception
+   {
+      if (jarsDir.exists())
+      for (int jar = 0 ; jar < NUMBER_JARS ; jar++)
+      {
+         List<String> implPackages = new ArrayList<String>();
+         List<String> implClasses = new ArrayList<String>();
+         
+         for (int pkg = 0 ; pkg < PACKAGES_PER_JAR ; pkg++)
+         {
+            implPackages.add(getImplPkg(jar, pkg));
+            for (int clazz = 0 ; clazz < CLASSES_PER_PACKAGE ; clazz++)
+            {
+               implClasses.add(getImplName(jar, pkg, clazz));
+            }
+         }
+         ClassPathElementInfo impl = createClassPathElementInfo(getImplJarName(jar), implPackages, implClasses, true);
+         addClassPathElement(impl);
+      }
+   }
+   
+   private String getImplJarName(int jar)
+   {
+      return "impl" + jar + ".jar";
+   }
+   
+   private String getImplPkg(int jar, int pkg)
+   {
+      return "org.jboss.test.impl" + jar + ".pkg" + pkg;
+   }
+   
+   private String getImplName(int jar, int pkg, int clazz)
+   {
+      return getImplPkg(jar, pkg) + ".Impl" + clazz;
+   }
+
+}

Copied: projects/cl-benchmark/trunk/src/test/java/org/jboss/test/cl/benchmark/SiblingVFSClassLoaderBenchmarkTestDelegate.java (from rev 107048, projects/cl-benchmark/trunk/src/test/java/org/jboss/test/cl/benchmark/ThreeDeepVFSClassLoaderBenchmarkTestDelegate.java)
===================================================================
--- projects/cl-benchmark/trunk/src/test/java/org/jboss/test/cl/benchmark/SiblingVFSClassLoaderBenchmarkTestDelegate.java	                        (rev 0)
+++ projects/cl-benchmark/trunk/src/test/java/org/jboss/test/cl/benchmark/SiblingVFSClassLoaderBenchmarkTestDelegate.java	2010-07-23 13:34:34 UTC (rev 107050)
@@ -0,0 +1,39 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, 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.cl.benchmark;
+
+
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class SiblingVFSClassLoaderBenchmarkTestDelegate extends AbstractVFSCLassLoaderBenchmarkTestDelegate
+{
+   public SiblingVFSClassLoaderBenchmarkTestDelegate(Class<?> clazz) throws Exception
+   {
+      super(clazz, new SiblingTestSetCreator());
+   }
+
+
+}

Modified: projects/cl-benchmark/trunk/src/test/java/org/jboss/test/cl/benchmark/ThreeDeepTestSetCreator.java
===================================================================
--- projects/cl-benchmark/trunk/src/test/java/org/jboss/test/cl/benchmark/ThreeDeepTestSetCreator.java	2010-07-23 13:21:57 UTC (rev 107049)
+++ projects/cl-benchmark/trunk/src/test/java/org/jboss/test/cl/benchmark/ThreeDeepTestSetCreator.java	2010-07-23 13:34:34 UTC (rev 107050)
@@ -31,9 +31,13 @@
  */
 public class ThreeDeepTestSetCreator extends AbstractTestSetCreator
 {
+   final static int NUMBER_JARS = 2;
+   final static int PACKAGES_PER_JAR = 2;
+   final static int CLASSES_PER_PACKAGE = 2;
+   
    public ThreeDeepTestSetCreator() throws Exception
    {
-      super();
+      super("threedeep");
    }
 
    @Override

Modified: projects/cl-benchmark/trunk/src/test/java/org/jboss/test/cl/benchmark/ThreeDeepVFSClassLoaderBenchmarkTestDelegate.java
===================================================================
--- projects/cl-benchmark/trunk/src/test/java/org/jboss/test/cl/benchmark/ThreeDeepVFSClassLoaderBenchmarkTestDelegate.java	2010-07-23 13:21:57 UTC (rev 107049)
+++ projects/cl-benchmark/trunk/src/test/java/org/jboss/test/cl/benchmark/ThreeDeepVFSClassLoaderBenchmarkTestDelegate.java	2010-07-23 13:34:34 UTC (rev 107050)
@@ -30,10 +30,6 @@
  */
 public class ThreeDeepVFSClassLoaderBenchmarkTestDelegate extends AbstractVFSCLassLoaderBenchmarkTestDelegate
 {
-   final static int NUMBER_JARS = 2;
-   final static int PACKAGES_PER_JAR = 2;
-   final static int CLASSES_PER_PACKAGE = 2;
-
    public ThreeDeepVFSClassLoaderBenchmarkTestDelegate(Class<?> clazz) throws Exception
    {
       super(clazz, new ThreeDeepTestSetCreator());

Copied: projects/cl-benchmark/trunk/src/test/java/org/jboss/test/cl/benchmark/test/AbstractSiblingVFSClassLoaderBenchmark.java (from rev 107048, projects/cl-benchmark/trunk/src/test/java/org/jboss/test/cl/benchmark/ThreeDeepVFSClassLoaderBenchmarkTestDelegate.java)
===================================================================
--- projects/cl-benchmark/trunk/src/test/java/org/jboss/test/cl/benchmark/test/AbstractSiblingVFSClassLoaderBenchmark.java	                        (rev 0)
+++ projects/cl-benchmark/trunk/src/test/java/org/jboss/test/cl/benchmark/test/AbstractSiblingVFSClassLoaderBenchmark.java	2010-07-23 13:34:34 UTC (rev 107050)
@@ -0,0 +1,52 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, 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.cl.benchmark.test;
+
+import org.jboss.test.AbstractTestDelegate;
+import org.jboss.test.cl.benchmark.AbstractVFSClassLoaderBenchmark;
+import org.jboss.test.cl.benchmark.SiblingVFSClassLoaderBenchmarkTestDelegate;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public abstract class AbstractSiblingVFSClassLoaderBenchmark extends AbstractVFSClassLoaderBenchmark
+{
+   public AbstractSiblingVFSClassLoaderBenchmark(String name)
+   {
+      super(name);
+   }
+
+   public static AbstractTestDelegate getDelegate(Class<?> clazz)
+   {
+      try
+      {
+         return new SiblingVFSClassLoaderBenchmarkTestDelegate(clazz);
+      }
+      catch (Exception e)
+      {
+         throw new RuntimeException(e);
+      }
+   }
+
+}

Added: projects/cl-benchmark/trunk/src/test/java/org/jboss/test/cl/benchmark/test/SiblingVFSImportExportAllOtherAlreadyLoadedLoaderBenchmarkTestCase.java
===================================================================
--- projects/cl-benchmark/trunk/src/test/java/org/jboss/test/cl/benchmark/test/SiblingVFSImportExportAllOtherAlreadyLoadedLoaderBenchmarkTestCase.java	                        (rev 0)
+++ projects/cl-benchmark/trunk/src/test/java/org/jboss/test/cl/benchmark/test/SiblingVFSImportExportAllOtherAlreadyLoadedLoaderBenchmarkTestCase.java	2010-07-23 13:34:34 UTC (rev 107050)
@@ -0,0 +1,73 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, 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.cl.benchmark.test;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.classloading.spi.metadata.ExportAll;
+import org.jboss.classloading.spi.vfs.metadata.VFSClassLoaderFactory;
+import org.jboss.test.cl.benchmark.BenchmarkScenario;
+import org.jboss.test.cl.benchmark.ClassPathElementInfo;
+import org.jboss.test.cl.benchmark.VFSClassLoaderInfo;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class SiblingVFSImportExportAllOtherAlreadyLoadedLoaderBenchmarkTestCase extends AbstractSiblingVFSClassLoaderBenchmark
+{
+   public SiblingVFSImportExportAllOtherAlreadyLoadedLoaderBenchmarkTestCase(String name)
+   {
+      super(name);
+   }
+
+   public void testOtherLoaderAlreadyLoaded() throws Exception
+   {
+      runBenchmark(new BenchmarkScenario<VFSClassLoaderInfo>()
+      {
+         
+         public List<VFSClassLoaderInfo> createFactories(List<ClassPathElementInfo> infos)
+         {
+            List<VFSClassLoaderInfo> deploymentInfos = new ArrayList<VFSClassLoaderInfo>();
+            
+            for (int i = 0 ; i < infos.size() ; i++)
+            {
+               ClassPathElementInfo info = infos.get(i);
+               ClassPathElementInfo other = i == 0 ? info : infos.get(i-1);
+                  
+               
+               VFSClassLoaderFactory factory = new VFSClassLoaderFactory(info.getName());
+               factory.setExportAll(ExportAll.NON_EMPTY);
+               factory.setImportAll(true);
+               factory.getRoots().add(info.getUrl().toString());
+               
+               deploymentInfos.add(createClassLoaderInfo(info, factory, mergeArrays(info.getClassNames(), other.getClassNames())));
+            }      
+            
+            return deploymentInfos;
+         }
+      });
+   }
+
+}

Added: projects/cl-benchmark/trunk/src/test/java/org/jboss/test/cl/benchmark/test/SiblingVFSImportExportAllOtherNotAlreadyLoadedLoaderBenchmarkTestCase.java
===================================================================
--- projects/cl-benchmark/trunk/src/test/java/org/jboss/test/cl/benchmark/test/SiblingVFSImportExportAllOtherNotAlreadyLoadedLoaderBenchmarkTestCase.java	                        (rev 0)
+++ projects/cl-benchmark/trunk/src/test/java/org/jboss/test/cl/benchmark/test/SiblingVFSImportExportAllOtherNotAlreadyLoadedLoaderBenchmarkTestCase.java	2010-07-23 13:34:34 UTC (rev 107050)
@@ -0,0 +1,74 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, 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.cl.benchmark.test;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.classloading.spi.metadata.ExportAll;
+import org.jboss.classloading.spi.vfs.metadata.VFSClassLoaderFactory;
+import org.jboss.test.cl.benchmark.BenchmarkScenario;
+import org.jboss.test.cl.benchmark.ClassPathElementInfo;
+import org.jboss.test.cl.benchmark.VFSClassLoaderInfo;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class SiblingVFSImportExportAllOtherNotAlreadyLoadedLoaderBenchmarkTestCase extends AbstractSiblingVFSClassLoaderBenchmark
+{
+   public SiblingVFSImportExportAllOtherNotAlreadyLoadedLoaderBenchmarkTestCase(String name)
+   {
+      super(name);
+   }
+
+   public void testOtherLoaderNotAlreadyLoaded() throws Exception
+   {
+      runBenchmark(new BenchmarkScenario<VFSClassLoaderInfo>()
+      {
+         
+         public List<VFSClassLoaderInfo> createFactories(List<ClassPathElementInfo> infos)
+         {
+            List<VFSClassLoaderInfo> deploymentInfos = new ArrayList<VFSClassLoaderInfo>();
+            
+            for (int i = 0 ; i < infos.size() ; i++)
+            {
+               ClassPathElementInfo info = infos.get(i);
+               System.out.println(i < infos.size() - 1);
+               ClassPathElementInfo other = i < infos.size() - 1 ? infos.get(i+1) : info;
+                  
+               
+               VFSClassLoaderFactory factory = new VFSClassLoaderFactory(info.getName());
+               factory.setExportAll(ExportAll.NON_EMPTY);
+               factory.setImportAll(true);
+               factory.getRoots().add(info.getUrl().toString());
+               
+               deploymentInfos.add(createClassLoaderInfo(info, factory, mergeArrays(info.getClassNames(), other.getClassNames())));
+            }      
+            
+            return deploymentInfos;
+         }
+      });
+   }
+
+}

Added: projects/cl-benchmark/trunk/src/test/java/org/jboss/test/cl/benchmark/test/SiblingVFSImportExportAllOwnLoaderBenchmarkTestCase.java
===================================================================
--- projects/cl-benchmark/trunk/src/test/java/org/jboss/test/cl/benchmark/test/SiblingVFSImportExportAllOwnLoaderBenchmarkTestCase.java	                        (rev 0)
+++ projects/cl-benchmark/trunk/src/test/java/org/jboss/test/cl/benchmark/test/SiblingVFSImportExportAllOwnLoaderBenchmarkTestCase.java	2010-07-23 13:34:34 UTC (rev 107050)
@@ -0,0 +1,69 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, 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.cl.benchmark.test;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.classloading.spi.metadata.ExportAll;
+import org.jboss.classloading.spi.vfs.metadata.VFSClassLoaderFactory;
+import org.jboss.test.cl.benchmark.BenchmarkScenario;
+import org.jboss.test.cl.benchmark.ClassPathElementInfo;
+import org.jboss.test.cl.benchmark.VFSClassLoaderInfo;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class SiblingVFSImportExportAllOwnLoaderBenchmarkTestCase extends AbstractSiblingVFSClassLoaderBenchmark
+{
+   public SiblingVFSImportExportAllOwnLoaderBenchmarkTestCase(String name)
+   {
+      super(name);
+   }
+
+   public void testLoadClassesFromOwnLoader() throws Exception
+   {
+      runBenchmark(new BenchmarkScenario<VFSClassLoaderInfo>()
+      {
+         
+         public List<VFSClassLoaderInfo> createFactories(List<ClassPathElementInfo> infos)
+         {
+            List<VFSClassLoaderInfo> deploymentInfos = new ArrayList<VFSClassLoaderInfo>();
+            
+            for (ClassPathElementInfo info : infos)
+            {
+               VFSClassLoaderFactory factory = new VFSClassLoaderFactory(info.getName());
+               factory.setExportAll(ExportAll.NON_EMPTY);
+               factory.setImportAll(true);
+               factory.getRoots().add(info.getUrl().toString());
+               
+               deploymentInfos.add(createClassLoaderInfo(info, factory, mergeArrays(info.getClassNames(), info.getClassNames())));
+            }      
+            
+            return deploymentInfos;
+         }
+      });
+   }
+
+}

Added: projects/cl-benchmark/trunk/src/test/java/org/jboss/test/cl/benchmark/test/SiblingVFSImportModuleLoaderBenchmarkTestCase.java
===================================================================
--- projects/cl-benchmark/trunk/src/test/java/org/jboss/test/cl/benchmark/test/SiblingVFSImportModuleLoaderBenchmarkTestCase.java	                        (rev 0)
+++ projects/cl-benchmark/trunk/src/test/java/org/jboss/test/cl/benchmark/test/SiblingVFSImportModuleLoaderBenchmarkTestCase.java	2010-07-23 13:34:34 UTC (rev 107050)
@@ -0,0 +1,82 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, 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.cl.benchmark.test;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.classloading.plugins.metadata.ModuleRequirement;
+import org.jboss.classloading.plugins.metadata.PackageRequirement;
+import org.jboss.classloading.spi.metadata.ClassLoadingMetaDataFactory;
+import org.jboss.classloading.spi.vfs.metadata.VFSClassLoaderFactory;
+import org.jboss.test.cl.benchmark.BenchmarkScenario;
+import org.jboss.test.cl.benchmark.ClassPathElementInfo;
+import org.jboss.test.cl.benchmark.VFSClassLoaderInfo;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class SiblingVFSImportModuleLoaderBenchmarkTestCase extends AbstractSiblingVFSClassLoaderBenchmark
+{
+   public SiblingVFSImportModuleLoaderBenchmarkTestCase(String name)
+   {
+      super(name);
+   }
+   
+   public void testLoadClassesFromOtherLoader() throws Exception
+   {
+      runBenchmark(new BenchmarkScenario<VFSClassLoaderInfo>()
+      {
+         
+         public List<VFSClassLoaderInfo> createFactories(List<ClassPathElementInfo> infos)
+         {
+            List<VFSClassLoaderInfo> deploymentInfos = new ArrayList<VFSClassLoaderInfo>();
+            
+            for (int i = 0 ; i < infos.size() ; i++)
+            {
+               ClassPathElementInfo info = infos.get(i);
+               
+               VFSClassLoaderFactory factory = new VFSClassLoaderFactory(info.getName());
+               ClassLoadingMetaDataFactory metaData = ClassLoadingMetaDataFactory.getInstance();
+               for (String pkg : info.getPackageNames())
+                  factory.getCapabilities().addCapability(metaData.createPackage(pkg));
+               factory.getCapabilities().addCapability(metaData.createModule(info.getName()));
+               factory.getRoots().add(info.getUrl().toString());
+               
+               String[] otherClasses = info.getClassNames();
+               ClassPathElementInfo other = i > 0 ? infos.get(i - 1) : null;
+               if (other != null)
+               {
+                  factory.getRequirements().addRequirement(new ModuleRequirement(other.getName()));
+                  otherClasses = other.getClassNames();
+               }
+               deploymentInfos.add(createClassLoaderInfo(info, factory, mergeArrays(info.getClassNames(), otherClasses)));
+            }      
+            
+            return deploymentInfos;
+         }
+      });
+   }
+
+}

Added: projects/cl-benchmark/trunk/src/test/java/org/jboss/test/cl/benchmark/test/SiblingVFSImportPackageLoaderBenchmarkTestCase.java
===================================================================
--- projects/cl-benchmark/trunk/src/test/java/org/jboss/test/cl/benchmark/test/SiblingVFSImportPackageLoaderBenchmarkTestCase.java	                        (rev 0)
+++ projects/cl-benchmark/trunk/src/test/java/org/jboss/test/cl/benchmark/test/SiblingVFSImportPackageLoaderBenchmarkTestCase.java	2010-07-23 13:34:34 UTC (rev 107050)
@@ -0,0 +1,80 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, 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.cl.benchmark.test;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.classloading.plugins.metadata.PackageRequirement;
+import org.jboss.classloading.spi.metadata.ClassLoadingMetaDataFactory;
+import org.jboss.classloading.spi.vfs.metadata.VFSClassLoaderFactory;
+import org.jboss.test.cl.benchmark.BenchmarkScenario;
+import org.jboss.test.cl.benchmark.ClassPathElementInfo;
+import org.jboss.test.cl.benchmark.VFSClassLoaderInfo;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class SiblingVFSImportPackageLoaderBenchmarkTestCase extends AbstractSiblingVFSClassLoaderBenchmark
+{
+   public SiblingVFSImportPackageLoaderBenchmarkTestCase(String name)
+   {
+      super(name);
+   }
+   
+   public void testLoadClassesFromOtherLoader() throws Exception
+   {
+      runBenchmark(new BenchmarkScenario<VFSClassLoaderInfo>()
+      {
+         
+         public List<VFSClassLoaderInfo> createFactories(List<ClassPathElementInfo> infos)
+         {
+            List<VFSClassLoaderInfo> deploymentInfos = new ArrayList<VFSClassLoaderInfo>();
+            
+            for (int i = 0 ; i < infos.size() ; i++)
+            {
+               ClassPathElementInfo info = infos.get(i);
+               
+               VFSClassLoaderFactory factory = new VFSClassLoaderFactory(info.getName());
+               ClassLoadingMetaDataFactory metaData = ClassLoadingMetaDataFactory.getInstance();
+               for (String pkg : info.getPackageNames())
+                  factory.getCapabilities().addCapability(metaData.createPackage(pkg));
+               factory.getRoots().add(info.getUrl().toString());
+               
+               String[] otherClasses = info.getClassNames();
+               ClassPathElementInfo other = i > 0 ? infos.get(i - 1) : null;
+               if (other != null)
+               {
+                  for (String pkg : other.getPackageNames())
+                     factory.getRequirements().addRequirement(new PackageRequirement(pkg));
+                  otherClasses = other.getClassNames();
+               }
+               deploymentInfos.add(createClassLoaderInfo(info, factory, mergeArrays(info.getClassNames(), otherClasses)));
+            }      
+            
+            return deploymentInfos;
+         }
+      });
+   }
+}



More information about the jboss-cvs-commits mailing list