accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ktur...@apache.org
Subject svn commit: r1429150 - in /accumulo/trunk/start/src: main/java/org/apache/accumulo/start/classloader/vfs/ test/java/org/apache/accumulo/start/classloader/vfs/
Date Fri, 04 Jan 2013 22:01:12 GMT
Author: kturner
Date: Fri Jan  4 22:01:12 2013
New Revision: 1429150

URL: http://svn.apache.org/viewvc?rev=1429150&view=rev
Log:
ACCUMULO-930 moved indirection for reloading of classloaders to a higher level

Added:
    accumulo/trunk/start/src/main/java/org/apache/accumulo/start/classloader/vfs/ReloadingClassLoader.java
Modified:
    accumulo/trunk/start/src/main/java/org/apache/accumulo/start/classloader/vfs/AccumuloReloadingVFSClassLoader.java
    accumulo/trunk/start/src/main/java/org/apache/accumulo/start/classloader/vfs/AccumuloVFSClassLoader.java
    accumulo/trunk/start/src/main/java/org/apache/accumulo/start/classloader/vfs/ContextManager.java
    accumulo/trunk/start/src/test/java/org/apache/accumulo/start/classloader/vfs/AccumuloReloadingVFSClassLoaderTest.java
    accumulo/trunk/start/src/test/java/org/apache/accumulo/start/classloader/vfs/AccumuloVFSClassLoaderTest.java
    accumulo/trunk/start/src/test/java/org/apache/accumulo/start/classloader/vfs/ContextManagerTest.java

Modified: accumulo/trunk/start/src/main/java/org/apache/accumulo/start/classloader/vfs/AccumuloReloadingVFSClassLoader.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/start/src/main/java/org/apache/accumulo/start/classloader/vfs/AccumuloReloadingVFSClassLoader.java?rev=1429150&r1=1429149&r2=1429150&view=diff
==============================================================================
--- accumulo/trunk/start/src/main/java/org/apache/accumulo/start/classloader/vfs/AccumuloReloadingVFSClassLoader.java
(original)
+++ accumulo/trunk/start/src/main/java/org/apache/accumulo/start/classloader/vfs/AccumuloReloadingVFSClassLoader.java
Fri Jan  4 22:01:12 2013
@@ -16,12 +16,7 @@
  */
 package org.apache.accumulo.start.classloader.vfs;
 
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.security.SecureClassLoader;
 import java.util.ArrayList;
-import java.util.Enumeration;
 
 import org.apache.commons.vfs2.FileChangeEvent;
 import org.apache.commons.vfs2.FileListener;
@@ -38,7 +33,7 @@ import org.apache.log4j.Logger;
  * the delegate object if there is any change in the classpath.
  *
  */
-public class AccumuloReloadingVFSClassLoader extends SecureClassLoader implements FileListener
{
+public class AccumuloReloadingVFSClassLoader implements FileListener, ReloadingClassLoader
{
   
   private static final Logger log = Logger.getLogger(AccumuloReloadingVFSClassLoader.class);
 
@@ -48,20 +43,16 @@ public class AccumuloReloadingVFSClassLo
   private String uris;
   private FileObject[] files;
   private FileSystemManager vfs = null;
-  private ClassLoader parent = null;
+  private ReloadingClassLoader parent = null;
   private DefaultFileMonitor monitor = null;
-  private volatile VFSClassLoader cl = null;
+  private VFSClassLoader cl = null;
 
-  private synchronized VFSClassLoader getClassloader() {
-    if (cl == null) {
+  @Override
+  public synchronized ClassLoader getClassLoader() {
+    if (cl == null || cl.getParent() != parent.getClassLoader()) {
       try {
         files = AccumuloVFSClassLoader.resolve(vfs, uris);
-        
-        if (null != parent)
-          setClassloader(new VFSClassLoader(files, vfs, parent));
-        else
-          setClassloader(new VFSClassLoader(files, vfs));
-
+        setClassloader(new VFSClassLoader(files, vfs, parent.getClassLoader()));
       } catch (FileSystemException fse) {
         throw new RuntimeException(fse);
       }
@@ -75,9 +66,8 @@ public class AccumuloReloadingVFSClassLo
     
   }
 
-  public AccumuloReloadingVFSClassLoader(String uris, FileSystemManager vfs, ClassLoader
parent, long monitorDelay) throws FileSystemException {
-    super(parent);
-    
+  public AccumuloReloadingVFSClassLoader(String uris, FileSystemManager vfs, ReloadingClassLoader
parent, long monitorDelay) throws FileSystemException {
+
     this.uris = uris;
     this.vfs = vfs;
     this.parent = parent;
@@ -85,10 +75,7 @@ public class AccumuloReloadingVFSClassLo
     ArrayList<FileObject> pathsToMonitor = new ArrayList<FileObject>();
     files = AccumuloVFSClassLoader.resolve(vfs, uris, pathsToMonitor);
 
-    if (null != parent)
-      cl = new VFSClassLoader(files, vfs, parent);
-    else
-      cl = new VFSClassLoader(files, vfs);
+    cl = new VFSClassLoader(files, vfs, parent.getClassLoader());
     
     monitor = new DefaultFileMonitor(this);
     monitor.setDelay(monitorDelay);
@@ -100,7 +87,7 @@ public class AccumuloReloadingVFSClassLo
     monitor.start();
   }
   
-  public AccumuloReloadingVFSClassLoader(String uris, FileSystemManager vfs, ClassLoader
parent) throws FileSystemException {
+  public AccumuloReloadingVFSClassLoader(String uris, FileSystemManager vfs, final ReloadingClassLoader
parent) throws FileSystemException {
     this(uris, vfs, parent, DEFAULT_TIMEOUT);
   }
 
@@ -133,55 +120,7 @@ public class AccumuloReloadingVFSClassLo
     setClassloader(null);
   }
 
-  @Override
-  public Class<?> loadClass(String name) throws ClassNotFoundException {
-     return this.getClassloader().loadClass(name);
-  }
   
-  @Override
-  protected synchronized Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException
{
-    return this.loadClass(name);
-  }
-
-  @Override
-  protected Class<?> findClass(String name) throws ClassNotFoundException {
-    return this.loadClass(name);
-  }
-
-  @Override
-  public URL getResource(String name) {
-    return this.getClassloader().getResource(name);
-  }
-
-  @Override
-  public Enumeration<URL> getResources(String name) throws IOException {
-    return this.getClassloader().getResources(name);
-  }
-
-  @Override
-  public InputStream getResourceAsStream(String name) {
-    return this.getClassloader().getResourceAsStream(name);
-  }
-
-  @Override
-  public synchronized void setDefaultAssertionStatus(boolean enabled) {
-    this.getClassloader().setDefaultAssertionStatus(enabled);
-  }
-
-  @Override
-  public synchronized void setPackageAssertionStatus(String packageName, boolean enabled)
{
-    this.getClassloader().setPackageAssertionStatus(packageName, enabled);
-  }
-
-  @Override
-  public synchronized void setClassAssertionStatus(String className, boolean enabled) {
-    this.getClassloader().setClassAssertionStatus(className, enabled);
-  }
-
-  @Override
-  public synchronized void clearAssertionStatus() {
-    this.getClassloader().clearAssertionStatus();
-  }
   
   @Override
   public String toString() {
@@ -199,5 +138,6 @@ public class AccumuloReloadingVFSClassLo
   }
 
 
+
   
 }

Modified: accumulo/trunk/start/src/main/java/org/apache/accumulo/start/classloader/vfs/AccumuloVFSClassLoader.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/start/src/main/java/org/apache/accumulo/start/classloader/vfs/AccumuloVFSClassLoader.java?rev=1429150&r1=1429149&r2=1429150&view=diff
==============================================================================
--- accumulo/trunk/start/src/main/java/org/apache/accumulo/start/classloader/vfs/AccumuloVFSClassLoader.java
(original)
+++ accumulo/trunk/start/src/main/java/org/apache/accumulo/start/classloader/vfs/AccumuloVFSClassLoader.java
Fri Jan  4 22:01:12 2013
@@ -76,7 +76,7 @@ public class AccumuloVFSClassLoader {
   
   private static DefaultFileSystemManager vfs = null;
   private static ClassLoader parent = null;
-  private static volatile ClassLoader loader = null;
+  private static volatile ReloadingClassLoader loader = null;
   private static final Object lock = new Object();
 
   private static ContextManager contextManager;
@@ -154,7 +154,7 @@ public class AccumuloVFSClassLoader {
     return classpath.toArray(new FileObject[classpath.size()]);
   }
 
-  private static ClassLoader createDynamicClassloader(ClassLoader parent) throws FileSystemException,
IOException {
+  private static ReloadingClassLoader createDynamicClassloader(final ClassLoader parent)
throws FileSystemException, IOException {
     String dynamicCPath = AccumuloClassLoader.getAccumuloString(DYNAMIC_CLASSPATH_PROPERTY_NAME,
DEFAULT_DYNAMIC_CLASSPATH_VALUE);
     
     String envJars = System.getenv("ACCUMULO_XTRAJARS");
@@ -164,15 +164,22 @@ public class AccumuloVFSClassLoader {
       else
         dynamicCPath = envJars;
     
+    ReloadingClassLoader wrapper = new ReloadingClassLoader() {
+      @Override
+      public ClassLoader getClassLoader() {
+        return parent;
+      }
+    };
+
     if (dynamicCPath == null || dynamicCPath.equals(""))
-      return parent;
+      return wrapper;
 
     // TODO monitor time for lib/ext was 1 sec... should this be configurable?
-    return new AccumuloReloadingVFSClassLoader(dynamicCPath, vfs, parent, 1000);
+    return new AccumuloReloadingVFSClassLoader(dynamicCPath, vfs, wrapper, 1000);
   }
 
   public static ClassLoader getClassLoader() throws IOException {
-    ClassLoader localLoader = loader;
+    ReloadingClassLoader localLoader = loader;
     while (null == localLoader) {
       synchronized (lock) {
         if (null == loader) {
@@ -229,17 +236,17 @@ public class AccumuloVFSClassLoader {
           if (vfsCP.length == 0) {
             localLoader = createDynamicClassloader(parent);
             loader = localLoader;
-            return localLoader;
+            return localLoader.getClassLoader();
           }
           
           //Create the Accumulo Context ClassLoader using the DEFAULT_CONTEXT
-          localLoader = new VFSClassLoader(vfsCP, vfs, parent);
-          localLoader = createDynamicClassloader(localLoader);
+          localLoader = createDynamicClassloader(new VFSClassLoader(vfsCP, vfs, parent));
           loader = localLoader;
         }
       }
     }
-    return localLoader;
+
+    return localLoader.getClassLoader();
   }
   
   public static void printClassPath() {
@@ -271,8 +278,6 @@ public class AccumuloVFSClassLoader {
               System.out.println("\t" + u.toExternalForm());
             }
 
-        } else if (classLoader instanceof AccumuloReloadingVFSClassLoader) {
-          System.out.println("VFS classpaths items are:\n" + classLoader.toString());
         } else if (classLoader instanceof VFSClassLoader) {
           System.out.println("VFS classpaths items are:");
           VFSClassLoader vcl = (VFSClassLoader) classLoader;
@@ -291,10 +296,17 @@ public class AccumuloVFSClassLoader {
 
   
   public static synchronized ContextManager getContextManager() throws IOException {
-    // TODO is there problem with using this lck?
-    
     if (contextManager == null) {
-      contextManager = new ContextManager(vfs, getClassLoader());
+      contextManager = new ContextManager(vfs, new ReloadingClassLoader() {
+        @Override
+        public ClassLoader getClassLoader() {
+          try {
+            return AccumuloVFSClassLoader.getClassLoader();
+          } catch (IOException e) {
+            throw new RuntimeException(e);
+          }
+        }
+      });
     }
 
     return contextManager;

Modified: accumulo/trunk/start/src/main/java/org/apache/accumulo/start/classloader/vfs/ContextManager.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/start/src/main/java/org/apache/accumulo/start/classloader/vfs/ContextManager.java?rev=1429150&r1=1429149&r2=1429150&view=diff
==============================================================================
--- accumulo/trunk/start/src/main/java/org/apache/accumulo/start/classloader/vfs/ContextManager.java
(original)
+++ accumulo/trunk/start/src/main/java/org/apache/accumulo/start/classloader/vfs/ContextManager.java
Fri Jan  4 22:01:12 2013
@@ -58,9 +58,9 @@ public class ContextManager {
 
   private volatile ContextConfig config;
   private FileSystemManager vfs;
-  private ClassLoader parent;
+  private ReloadingClassLoader parent;
   
-  ContextManager(FileSystemManager vfs, ClassLoader parent) {
+  ContextManager(FileSystemManager vfs, ReloadingClassLoader parent) {
     this.vfs = vfs;
     this.parent = parent;
   }
@@ -116,7 +116,7 @@ public class ContextManager {
       return getClassLoader(contextName);
     }
     
-    return loader;
+    return loader.getClassLoader();
 
   }
   

Added: accumulo/trunk/start/src/main/java/org/apache/accumulo/start/classloader/vfs/ReloadingClassLoader.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/start/src/main/java/org/apache/accumulo/start/classloader/vfs/ReloadingClassLoader.java?rev=1429150&view=auto
==============================================================================
--- accumulo/trunk/start/src/main/java/org/apache/accumulo/start/classloader/vfs/ReloadingClassLoader.java
(added)
+++ accumulo/trunk/start/src/main/java/org/apache/accumulo/start/classloader/vfs/ReloadingClassLoader.java
Fri Jan  4 22:01:12 2013
@@ -0,0 +1,24 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.accumulo.start.classloader.vfs;
+
+/**
+ * 
+ */
+public interface ReloadingClassLoader {
+  ClassLoader getClassLoader();
+}

Modified: accumulo/trunk/start/src/test/java/org/apache/accumulo/start/classloader/vfs/AccumuloReloadingVFSClassLoaderTest.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/start/src/test/java/org/apache/accumulo/start/classloader/vfs/AccumuloReloadingVFSClassLoaderTest.java?rev=1429150&r1=1429149&r2=1429150&view=diff
==============================================================================
--- accumulo/trunk/start/src/test/java/org/apache/accumulo/start/classloader/vfs/AccumuloReloadingVFSClassLoaderTest.java
(original)
+++ accumulo/trunk/start/src/test/java/org/apache/accumulo/start/classloader/vfs/AccumuloReloadingVFSClassLoaderTest.java
Fri Jan  4 22:01:12 2013
@@ -20,6 +20,8 @@ import java.net.URL;
 
 import org.apache.accumulo.test.AccumuloDFSBase;
 import org.apache.commons.vfs2.FileObject;
+import org.apache.commons.vfs2.FileSystemException;
+import org.apache.commons.vfs2.impl.VFSClassLoader;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
 import org.apache.log4j.Level;
@@ -34,8 +36,7 @@ public class AccumuloReloadingVFSClassLo
   private static final Path TEST_DIR = new Path(HDFS_URI + "/test-dir");
 
   private FileSystem hdfs = null;
-  private AccumuloReloadingVFSClassLoader cl = null;
- 
+
   @Before
   public void setup() throws Exception {
     Logger.getRootLogger().setLevel(Level.ERROR);
@@ -51,14 +52,36 @@ public class AccumuloReloadingVFSClassLo
     
   }
   
+  FileObject[] createFileSystems(FileObject[] fos) throws FileSystemException {
+    FileObject[] rfos = new FileObject[fos.length];
+    for (int i = 0; i < fos.length; i++) {
+      if (vfs.canCreateFileSystem(fos[i]))
+        rfos[i] = vfs.createFileSystem(fos[i]);
+      else
+        rfos[i] = fos[i];
+    }
+    
+    return rfos;
+  }
+
   @Test
   public void testConstructor() throws Exception {
     FileObject testDir = vfs.resolveFile(TEST_DIR.toUri().toString());
     FileObject[] dirContents = testDir.getChildren();
     
-    cl = new AccumuloReloadingVFSClassLoader(TEST_DIR.toUri().toString(), vfs, ClassLoader.getSystemClassLoader());
-    FileObject[] files = cl.getFiles();
-    Assert.assertArrayEquals(dirContents, files);
+    AccumuloReloadingVFSClassLoader arvcl = new AccumuloReloadingVFSClassLoader(TEST_DIR.toUri().toString(),
vfs, new ReloadingClassLoader() {
+      @Override
+      public ClassLoader getClassLoader() {
+        return ClassLoader.getSystemClassLoader();
+      }
+    });
+    
+    VFSClassLoader cl = (VFSClassLoader) arvcl.getClassLoader();
+    
+    FileObject[] files = cl.getFileObjects();
+    Assert.assertArrayEquals(createFileSystems(dirContents), files);
+    
+    arvcl.close();
   }
   
   @Test
@@ -66,16 +89,22 @@ public class AccumuloReloadingVFSClassLo
     FileObject testDir = vfs.resolveFile(TEST_DIR.toUri().toString());
     FileObject[] dirContents = testDir.getChildren();
     
-    cl = new AccumuloReloadingVFSClassLoader(TEST_DIR.toUri().toString(), vfs, ClassLoader.getSystemClassLoader(),
1000);
-    FileObject[] files = cl.getFiles();
-    Assert.assertArrayEquals(dirContents, files);
+    AccumuloReloadingVFSClassLoader arvcl = new AccumuloReloadingVFSClassLoader(TEST_DIR.toUri().toString(),
vfs, new ReloadingClassLoader() {
+      @Override
+      public ClassLoader getClassLoader() {
+        return ClassLoader.getSystemClassLoader();
+      }
+    }, 1000);
+    
+    FileObject[] files = ((VFSClassLoader) arvcl.getClassLoader()).getFileObjects();
+    Assert.assertArrayEquals(createFileSystems(dirContents), files);
 
-    Class<?> clazz1 = cl.loadClass("test.HelloWorld");
+    Class<?> clazz1 = arvcl.getClassLoader().loadClass("test.HelloWorld");
     Object o1 = clazz1.newInstance();
     Assert.assertEquals("Hello World!", o1.toString());
 
     //Check that the class is the same before the update
-    Class<?> clazz1_5 = cl.loadClass("test.HelloWorld");
+    Class<?> clazz1_5 = arvcl.getClassLoader().loadClass("test.HelloWorld");
     Assert.assertEquals(clazz1, clazz1_5);
     
     //Update the class
@@ -87,7 +116,7 @@ public class AccumuloReloadingVFSClassLo
     //Wait for the monitor to notice
     Thread.sleep(2000);
     
-    Class<?> clazz2 = cl.loadClass("test.HelloWorld");
+    Class<?> clazz2 = arvcl.getClassLoader().loadClass("test.HelloWorld");
     Object o2 = clazz2.newInstance();
     Assert.assertEquals("Hello World!", o2.toString());
     
@@ -95,11 +124,11 @@ public class AccumuloReloadingVFSClassLo
     Assert.assertFalse(clazz1.equals(clazz2));
     Assert.assertFalse(o1.equals(o2));
     
+    arvcl.close();
   }
   
   @After
   public void tearDown() throws Exception {
-    cl.close();
     this.hdfs.delete(TEST_DIR, true);
   }
 

Modified: accumulo/trunk/start/src/test/java/org/apache/accumulo/start/classloader/vfs/AccumuloVFSClassLoaderTest.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/start/src/test/java/org/apache/accumulo/start/classloader/vfs/AccumuloVFSClassLoaderTest.java?rev=1429150&r1=1429149&r2=1429150&view=diff
==============================================================================
--- accumulo/trunk/start/src/test/java/org/apache/accumulo/start/classloader/vfs/AccumuloVFSClassLoaderTest.java
(original)
+++ accumulo/trunk/start/src/test/java/org/apache/accumulo/start/classloader/vfs/AccumuloVFSClassLoaderTest.java
Fri Jan  4 22:01:12 2013
@@ -55,7 +55,7 @@ public class AccumuloVFSClassLoaderTest 
     Whitebox.setInternalState(AccumuloClassLoader.class, "SITE_CONF", new File(defaultDir.getPath()
+ "/conf/accumulo-site.xml").toURI().toURL().toString());
     Whitebox.setInternalState(AccumuloVFSClassLoader.class, "lock", new Object());
     ClassLoader acl = AccumuloVFSClassLoader.getClassLoader();
-    Assert.assertTrue((acl instanceof AccumuloReloadingVFSClassLoader));
+    Assert.assertTrue((acl instanceof VFSClassLoader));
     Assert.assertTrue((acl.getParent() instanceof URLClassLoader));
 
     // URLClassLoader ucl = (URLClassLoader) acl;
@@ -88,7 +88,7 @@ public class AccumuloVFSClassLoaderTest 
     Whitebox.setInternalState(AccumuloClassLoader.class, "SITE_CONF", new File(defaultDir.getPath()
+ "/conf/accumulo-site.xml").toURI().toURL().toString());
     Whitebox.setInternalState(AccumuloVFSClassLoader.class, "lock", new Object());
     ClassLoader acl = AccumuloVFSClassLoader.getClassLoader();
-    Assert.assertTrue((acl instanceof AccumuloReloadingVFSClassLoader));
+    Assert.assertTrue((acl instanceof VFSClassLoader));
     Assert.assertTrue((acl.getParent() instanceof VFSClassLoader));
     VFSClassLoader arvcl = (VFSClassLoader) acl.getParent();
     Assert.assertEquals(1, arvcl.getFileObjects().length);

Modified: accumulo/trunk/start/src/test/java/org/apache/accumulo/start/classloader/vfs/ContextManagerTest.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/start/src/test/java/org/apache/accumulo/start/classloader/vfs/ContextManagerTest.java?rev=1429150&r1=1429149&r2=1429150&view=diff
==============================================================================
--- accumulo/trunk/start/src/test/java/org/apache/accumulo/start/classloader/vfs/ContextManagerTest.java
(original)
+++ accumulo/trunk/start/src/test/java/org/apache/accumulo/start/classloader/vfs/ContextManagerTest.java
Fri Jan  4 22:01:12 2013
@@ -22,6 +22,8 @@ import java.util.HashSet;
 import org.apache.accumulo.start.classloader.vfs.ContextManager.ContextConfig;
 import org.apache.accumulo.test.AccumuloDFSBase;
 import org.apache.commons.vfs2.FileObject;
+import org.apache.commons.vfs2.FileSystemException;
+import org.apache.commons.vfs2.impl.VFSClassLoader;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
 import org.junit.After;
@@ -53,10 +55,28 @@ public class ContextManagerTest extends 
 
   }
 
+  FileObject[] createFileSystems(FileObject[] fos) throws FileSystemException {
+    FileObject[] rfos = new FileObject[fos.length];
+    for (int i = 0; i < fos.length; i++) {
+      if (vfs.canCreateFileSystem(fos[i]))
+        rfos[i] = vfs.createFileSystem(fos[i]);
+      else
+        rfos[i] = fos[i];
+    }
+    
+    return rfos;
+  }
+
   @Test
   public void differentContexts() throws Exception {
     
-    ContextManager cm = new ContextManager(vfs, ClassLoader.getSystemClassLoader());
+    ContextManager cm = new ContextManager(vfs, new ReloadingClassLoader() {
+      @Override
+      public ClassLoader getClassLoader() {
+        return ClassLoader.getSystemClassLoader();
+      }
+    });
+
     cm.setContextConfig(new ContextConfig() {
       @Override
       public String getContextURIs(String context) {
@@ -78,15 +98,14 @@ public class ContextManagerTest extends 
     FileObject testDir = vfs.resolveFile(TEST_DIR.toUri().toString());
     FileObject[] dirContents = testDir.getChildren();
     ClassLoader cl1 = cm.getClassLoader("CX1");
-    FileObject[] files = ((AccumuloReloadingVFSClassLoader) cl1).getFiles();
-    Assert.assertArrayEquals(dirContents, files);
-
+    FileObject[] files = ((VFSClassLoader) cl1).getFileObjects();
+    Assert.assertArrayEquals(createFileSystems(dirContents), files);
 
     FileObject testDir2 = vfs.resolveFile(TEST_DIR2.toUri().toString());
     FileObject[] dirContents2 = testDir2.getChildren();
     ClassLoader cl2 = cm.getClassLoader("CX2");
-    FileObject[] files2 = ((AccumuloReloadingVFSClassLoader) cl2).getFiles();
-    Assert.assertArrayEquals(dirContents2, files2);
+    FileObject[] files2 = ((VFSClassLoader) cl2).getFileObjects();
+    Assert.assertArrayEquals(createFileSystems(dirContents2), files2);
     
     Class<?> defaultContextClass = cl1.loadClass("test.HelloWorld");
     Object o1 = defaultContextClass.newInstance();



Mime
View raw message