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:07:18 UTC

git commit: ACCUMULO-1507 - adding a (nonfunctional/commented out) test for the monitor issue

Updated Branches:
  refs/heads/master d207b9a88 -> ebbedb4fe


ACCUMULO-1507 - adding a (nonfunctional/commented out) test for the monitor issue


Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/ebbedb4f
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/ebbedb4f
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/ebbedb4f

Branch: refs/heads/master
Commit: ebbedb4fe3cf90460e31657b5f8872a9d296bed6
Parents: d207b9a
Author: John Vines <jv...@gmail.com>
Authored: Tue Oct 29 17:06:50 2013 -0400
Committer: John Vines <jv...@gmail.com>
Committed: Tue Oct 29 17:06:50 2013 -0400

----------------------------------------------------------------------
 .../AccumuloReloadingVFSClassLoaderTest.java    | 47 ++++++++++++++++++++
 1 file changed, 47 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/ebbedb4f/start/src/test/java/org/apache/accumulo/start/classloader/vfs/AccumuloReloadingVFSClassLoaderTest.java
----------------------------------------------------------------------
diff --git 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
index f590376..06c914b 100644
--- 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
@@ -123,6 +123,53 @@ public class AccumuloReloadingVFSClassLoaderTest {
     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
+//  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);
+//
+//    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();
+//  }
+
   @Test
   public void testModifiedClass() throws Exception {
 


Re: git commit: ACCUMULO-1507 - adding a (nonfunctional/commented out) test for the monitor issue

Posted by John Vines <vi...@apache.org>.
It can totally use the @Ignore tag, I was just unaware of it. I'll fix that
posthaste


On Tue, Oct 29, 2013 at 6:30 PM, Mike Drob <md...@mdrob.com> wrote:

> Does this test compile? If so, I'd like to see it uncommented and annotated
> with @Ignore. If not, I'd like to see a more surgical comment block,
> instead of taking a hammer to the whole method. Code like this is very easy
> to forget about down the read, whereas an ignored test shows up in reports
> and mike pique somebody's curiosity for improvement.
>
>
> On Tue, Oct 29, 2013 at 5:07 PM, <vi...@apache.org> wrote:
>
> > Updated Branches:
> >   refs/heads/master d207b9a88 -> ebbedb4fe
> >
> >
> > ACCUMULO-1507 - adding a (nonfunctional/commented out) test for the
> > monitor issue
> >
> >
> > Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
> > Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/ebbedb4f
> > Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/ebbedb4f
> > Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/ebbedb4f
> >
> > Branch: refs/heads/master
> > Commit: ebbedb4fe3cf90460e31657b5f8872a9d296bed6
> > Parents: d207b9a
> > Author: John Vines <jv...@gmail.com>
> > Authored: Tue Oct 29 17:06:50 2013 -0400
> > Committer: John Vines <jv...@gmail.com>
> > Committed: Tue Oct 29 17:06:50 2013 -0400
> >
> > ----------------------------------------------------------------------
> >  .../AccumuloReloadingVFSClassLoaderTest.java    | 47
> ++++++++++++++++++++
> >  1 file changed, 47 insertions(+)
> > ----------------------------------------------------------------------
> >
> >
> >
> >
> http://git-wip-us.apache.org/repos/asf/accumulo/blob/ebbedb4f/start/src/test/java/org/apache/accumulo/start/classloader/vfs/AccumuloReloadingVFSClassLoaderTest.java
> > ----------------------------------------------------------------------
> > diff --git
> >
> 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
> > index f590376..06c914b 100644
> > ---
> >
> 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
> > @@ -123,6 +123,53 @@ public class AccumuloReloadingVFSClassLoaderTest {
> >      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
> > +//  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);
> > +//
> > +//    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();
> > +//  }
> > +
> >    @Test
> >    public void testModifiedClass() throws Exception {
> >
> >
> >
>

Re: git commit: ACCUMULO-1507 - adding a (nonfunctional/commented out) test for the monitor issue

Posted by Mike Drob <md...@mdrob.com>.
Does this test compile? If so, I'd like to see it uncommented and annotated
with @Ignore. If not, I'd like to see a more surgical comment block,
instead of taking a hammer to the whole method. Code like this is very easy
to forget about down the read, whereas an ignored test shows up in reports
and mike pique somebody's curiosity for improvement.


On Tue, Oct 29, 2013 at 5:07 PM, <vi...@apache.org> wrote:

> Updated Branches:
>   refs/heads/master d207b9a88 -> ebbedb4fe
>
>
> ACCUMULO-1507 - adding a (nonfunctional/commented out) test for the
> monitor issue
>
>
> Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
> Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/ebbedb4f
> Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/ebbedb4f
> Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/ebbedb4f
>
> Branch: refs/heads/master
> Commit: ebbedb4fe3cf90460e31657b5f8872a9d296bed6
> Parents: d207b9a
> Author: John Vines <jv...@gmail.com>
> Authored: Tue Oct 29 17:06:50 2013 -0400
> Committer: John Vines <jv...@gmail.com>
> Committed: Tue Oct 29 17:06:50 2013 -0400
>
> ----------------------------------------------------------------------
>  .../AccumuloReloadingVFSClassLoaderTest.java    | 47 ++++++++++++++++++++
>  1 file changed, 47 insertions(+)
> ----------------------------------------------------------------------
>
>
>
> http://git-wip-us.apache.org/repos/asf/accumulo/blob/ebbedb4f/start/src/test/java/org/apache/accumulo/start/classloader/vfs/AccumuloReloadingVFSClassLoaderTest.java
> ----------------------------------------------------------------------
> diff --git
> 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
> index f590376..06c914b 100644
> ---
> 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
> @@ -123,6 +123,53 @@ public class AccumuloReloadingVFSClassLoaderTest {
>      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
> +//  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);
> +//
> +//    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();
> +//  }
> +
>    @Test
>    public void testModifiedClass() throws Exception {
>
>
>