Merge branch '1.5.1-SNAPSHOT' into 1.6.0-SNAPSHOT
Conflicts:
start/src/test/java/org/apache/accumulo/start/classloader/vfs/AccumuloReloadingVFSClassLoaderTest.java
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/1a913262
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/1a913262
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/1a913262
Branch: refs/heads/1.6.0-SNAPSHOT
Commit: 1a913262aa4b86c69c43128fab8168b3c89e104e
Parents: e9966e9 a9cd5d1
Author: Josh Elser <[email protected]>
Authored: Thu Feb 13 19:13:41 2014 -0500
Committer: Josh Elser <[email protected]>
Committed: Thu Feb 13 19:13:41 2014 -0500
----------------------------------------------------------------------
.../vfs/AccumuloReloadingVFSClassLoaderTest.java | 16 +++++++++++-----
.../vfs/providers/VfsClassLoaderTest.java | 3 +++
2 files changed, 14 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/accumulo/blob/1a913262/start/src/test/java/org/apache/accumulo/start/classloader/vfs/AccumuloReloadingVFSClassLoaderTest.java
----------------------------------------------------------------------
diff --cc
start/src/test/java/org/apache/accumulo/start/classloader/vfs/AccumuloReloadingVFSClassLoaderTest.java
index eb99297,96ee517..3d52832
---
a/start/src/test/java/org/apache/accumulo/start/classloader/vfs/AccumuloReloadingVFSClassLoaderTest.java
+++
b/start/src/test/java/org/apache/accumulo/start/classloader/vfs/AccumuloReloadingVFSClassLoaderTest.java
@@@ -101,65 -97,22 +101,70 @@@ public class AccumuloReloadingVFSClassL
Object o1 = clazz1.newInstance();
Assert.assertEquals("Hello World!", o1.toString());
- //Check that the class is the same before the update
+ // Check that the class is the same before the update
Class<?> clazz1_5 = arvcl.getClassLoader().loadClass("test.HelloWorld");
Assert.assertEquals(clazz1, clazz1_5);
-
+
new File(folder1.getRoot(), "HelloWorld.jar").delete();
+ // VFS-487 significantly wait to avoid failure
+ Thread.sleep(7000);
+
// Update the class
FileUtils.copyURLToFile(this.getClass().getResource("/HelloWorld.jar"),
folder1.newFile("HelloWorld2.jar"));
+ // Wait for the monitor to notice
- Thread.sleep(2000);
++ // VFS-487 significantly wait to avoid failure
++ Thread.sleep(7000);
+
+ Class<?> clazz2 = arvcl.getClassLoader().loadClass("test.HelloWorld");
+ Object o2 = clazz2.newInstance();
+ Assert.assertEquals("Hello World!", o2.toString());
+
+ // This is false because they are loaded by a different classloader
+ Assert.assertFalse(clazz1.equals(clazz2));
+ Assert.assertFalse(o1.equals(o2));
+
+ arvcl.close();
+ }
+
+ // This test fails because of an error with the underlying monitor
(ACCUMULO-1507/VFS-487). Uncomment when this has been addressed.
+ //
+ // This is caused by the filed being deleted and then readded in the same
monitor tick. This causes the file to ultimately register the deletion over any
+ // other events.
+ @Test @Ignore
+ public void testFastDeleteAndReAdd() throws Exception {
+ FileObject testDir =
vfs.resolveFile(folder1.getRoot().toURI().toString());
+ FileObject[] dirContents = testDir.getChildren();
+
+ AccumuloReloadingVFSClassLoader arvcl = new
AccumuloReloadingVFSClassLoader(folderPath, vfs, new ReloadingClassLoader() {
+
+ @Override
+ public ClassLoader getClassLoader() {
+ return ClassLoader.getSystemClassLoader();
+ }
+ }, 1000, true);
+
+ FileObject[] files = ((VFSClassLoader)
arvcl.getClassLoader()).getFileObjects();
+ Assert.assertArrayEquals(createFileSystems(dirContents), files);
+
+ 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 = arvcl.getClassLoader().loadClass("test.HelloWorld");
+ Assert.assertEquals(clazz1, clazz1_5);
+
+ new File(folder1.getRoot(), "HelloWorld.jar").delete();
+
+ // Update the class
+ FileUtils.copyURLToFile(this.getClass().getResource("/HelloWorld.jar"),
folder1.newFile("HelloWorld.jar"));
+
- // Wait for the monitor to notice
- Thread.sleep(2000);
-
+ //Wait for the monitor to notice
+ // VFS-487 significantly wait to avoid failure
+ Thread.sleep(7000);
+
Class<?> clazz2 = arvcl.getClassLoader().loadClass("test.HelloWorld");
Object o2 = clazz2.newInstance();
Assert.assertEquals("Hello World!", o2.toString());
@@@ -204,9 -158,11 +209,10 @@@
// Update the class
FileUtils.copyURLToFile(this.getClass().getResource("/HelloWorld2.jar"),
folder1.newFile("HelloWorld.jar"));
-
+
// Wait for the monitor to notice
- Thread.sleep(2000);
+ // VFS-487 significantly wait to avoid failure
+ Thread.sleep(7000);
-
Class<?> clazz2 = arvcl.getClassLoader().loadClass("test.HelloWorld");
Object o2 = clazz2.newInstance();
http://git-wip-us.apache.org/repos/asf/accumulo/blob/1a913262/start/src/test/java/org/apache/accumulo/start/classloader/vfs/providers/VfsClassLoaderTest.java
----------------------------------------------------------------------
diff --cc
start/src/test/java/org/apache/accumulo/start/classloader/vfs/providers/VfsClassLoaderTest.java
index 262b009,c0a07cd..d10ca01
---
a/start/src/test/java/org/apache/accumulo/start/classloader/vfs/providers/VfsClassLoaderTest.java
+++
b/start/src/test/java/org/apache/accumulo/start/classloader/vfs/providers/VfsClassLoaderTest.java
@@@ -88,17 -90,20 +89,19 @@@ public class VfsClassLoaderTest extend
dst = new Path(TEST_DIR, "HelloWorld2.jar");
this.hdfs.copyFromLocalFile(src, dst);
+ // VFS-487 significantly wait to avoid failure
Thread.sleep(7000);
Assert.assertTrue(listener.isFileChanged());
-
+
this.hdfs.delete(dst, false);
+ // VFS-487 significantly wait to avoid failure
Thread.sleep(7000);
Assert.assertTrue(listener.isFileDeleted());
-
+
monitor.stop();
-
+
}
-
-
+
@After
public void tearDown() throws Exception {
this.hdfs.delete(TEST_DIR, true);