You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by vi...@apache.org on 2013/10/29 22:00:05 UTC
git commit: Left system.out.printlns uncommented in last patch
Updated Branches:
refs/heads/master 6140f926d -> d207b9a88
Left system.out.printlns uncommented in last patch
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/d207b9a8
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/d207b9a8
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/d207b9a8
Branch: refs/heads/master
Commit: d207b9a887365d5bee57564964ca748df9f27768
Parents: 6140f92
Author: John Vines <jv...@gmail.com>
Authored: Tue Oct 29 16:59:41 2013 -0400
Committer: John Vines <jv...@gmail.com>
Committed: Tue Oct 29 16:59:41 2013 -0400
----------------------------------------------------------------------
.../vfs/providers/VfsClassLoaderTest.java | 46 +++++++++-----------
1 file changed, 21 insertions(+), 25 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/accumulo/blob/d207b9a8/start/src/test/java/org/apache/accumulo/start/classloader/vfs/providers/VfsClassLoaderTest.java
----------------------------------------------------------------------
diff --git 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
index 215d6fd..9afb84a 100644
--- 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
@@ -32,29 +32,28 @@ import org.junit.Before;
import org.junit.Test;
public class VfsClassLoaderTest extends AccumuloDFSBase {
-
+
private static final Path TEST_DIR = new Path(HDFS_URI + "/test-dir");
private FileSystem hdfs = null;
private VFSClassLoader cl = null;
-
+
@Before
public void setup() throws Exception {
-
+
this.hdfs = cluster.getFileSystem();
this.hdfs.mkdirs(TEST_DIR);
-
- //Copy jar file to TEST_DIR
+
+ // Copy jar file to TEST_DIR
URL jarPath = this.getClass().getResource("/HelloWorld.jar");
Path src = new Path(jarPath.toURI().toString());
Path dst = new Path(TEST_DIR, src.getName());
this.hdfs.copyFromLocalFile(src, dst);
-
-
+
FileObject testDir = vfs.resolveFile(TEST_DIR.toUri().toString());
FileObject[] dirContents = testDir.getChildren();
- //Point the VFSClassLoader to all of the objects in TEST_DIR
+ // Point the VFSClassLoader to all of the objects in TEST_DIR
this.cl = new VFSClassLoader(dirContents, vfs);
}
@@ -64,7 +63,7 @@ public class VfsClassLoaderTest extends AccumuloDFSBase {
Object o = helloWorldClass.newInstance();
Assert.assertEquals("Hello World!", o.toString());
}
-
+
@Test
public void testFileMonitor() throws Exception {
MyFileMonitor listener = new MyFileMonitor();
@@ -73,8 +72,8 @@ public class VfsClassLoaderTest extends AccumuloDFSBase {
FileObject testDir = vfs.resolveFile(TEST_DIR.toUri().toString());
monitor.addFile(testDir);
monitor.start();
-
- //Copy jar file to a new file name
+
+ // Copy jar file to a new file name
URL jarPath = this.getClass().getResource("/HelloWorld.jar");
Path src = new Path(jarPath.toURI().toString());
Path dst = new Path(TEST_DIR, "HelloWorld2.jar");
@@ -83,7 +82,7 @@ public class VfsClassLoaderTest extends AccumuloDFSBase {
Thread.sleep(2000);
Assert.assertTrue(listener.isFileCreated());
- //Update the jar
+ // Update the jar
jarPath = this.getClass().getResource("/HelloWorld.jar");
src = new Path(jarPath.toURI().toString());
dst = new Path(TEST_DIR, "HelloWorld2.jar");
@@ -91,40 +90,38 @@ public class VfsClassLoaderTest extends AccumuloDFSBase {
Thread.sleep(2000);
Assert.assertTrue(listener.isFileChanged());
-
+
this.hdfs.delete(dst, false);
Thread.sleep(2000);
Assert.assertTrue(listener.isFileDeleted());
-
+
monitor.stop();
-
+
}
-
-
+
@After
public void tearDown() throws Exception {
this.hdfs.delete(TEST_DIR, true);
}
-
-
+
public static class MyFileMonitor implements FileListener {
private boolean fileChanged = false;
private boolean fileDeleted = false;
private boolean fileCreated = false;
-
+
public void fileCreated(FileChangeEvent event) throws Exception {
- System.out.println(event.getFile() + " created");
+ // System.out.println(event.getFile() + " created");
this.fileCreated = true;
}
public void fileDeleted(FileChangeEvent event) throws Exception {
- System.out.println(event.getFile() + " deleted");
+ // System.out.println(event.getFile() + " deleted");
this.fileDeleted = true;
}
public void fileChanged(FileChangeEvent event) throws Exception {
- System.out.println(event.getFile() + " changed");
+ // System.out.println(event.getFile() + " changed");
this.fileChanged = true;
}
@@ -139,7 +136,6 @@ public class VfsClassLoaderTest extends AccumuloDFSBase {
public boolean isFileCreated() {
return fileCreated;
}
-
-
+
}
}