Package org.springsource.loaded.agent

Examples of org.springsource.loaded.agent.FileSystemWatcher


  @Ignore
  @Test
  public void dirs() throws IOException {
    TestFileChangeListener listener = new TestFileChangeListener();
    File dir = getTempDir();
    FileSystemWatcher watcher = new FileSystemWatcher(listener, -1, "test");
    watcher.register(dir);
    pause(1000);
    create(dir, "abc.txt");
    pause(1100);
    create(dir, "abcd.txt");
    pause(1100);
    watcher.shutdown();
    Assert.assertTrue(listener.changesDetected.contains("abc.txt"));
    Assert.assertTrue(listener.changesDetected.contains("abcd.txt"));
  }
View Full Code Here


  @Test
  public void files() throws IOException {
    TestFileChangeListener listener = new TestFileChangeListener();
    File dir = getTempDir();
    FileSystemWatcher watcher = new FileSystemWatcher(listener, -1, "test");
    pause(1000);
    File f1 = create(dir, "abc.txt");
    watcher.register(f1);
    pause(1100);
    File f2 = create(dir, "abcd.txt");
    watcher.register(f2);
    pause(1100);
    watcher.setPaused(true);
    // Whilst paused, touch both files
    touch(f2);
    touch(f1);
    watcher.setPaused(false);
    pause(3000);
    watcher.shutdown();
    System.out.println(listener.changesDetected);
    assertEquals("abc.txt", listener.changesDetected.get(0));
    assertEquals("abcd.txt", listener.changesDetected.get(1));
  }
View Full Code Here

  @Test
  public void innersFirst() throws IOException {
    System.out.println("innersFirst");
    TestFileChangeListener listener = new TestFileChangeListener();
    File dir = getTempDir();
    FileSystemWatcher watcher = new FileSystemWatcher(listener, -1, "test");
    pause(1000);
    File f1 = create(dir, "Book$1.class");
    watcher.register(f1);
    pause(1100);
    File f2 = create(dir, "Book.class");
    watcher.register(f2);
    pause(1100);
    File f3 = create(dir, "Book$_2.class");
    watcher.register(f3);
    pause(1100);
    watcher.setPaused(true);
    // Whilst paused, touch both files
    touch(f3);
    touch(f2);
    touch(f1);
    watcher.setPaused(false);
    pause(3000);
    System.out.println(listener.changesDetected);
    watcher.shutdown();
    // Check that inners reported first
    assertEquals("Book$1.class", listener.changesDetected.get(0));
    assertEquals("Book$_2.class", listener.changesDetected.get(1));
    assertEquals("Book.class", listener.changesDetected.get(2));
  }
View Full Code Here

  @Ignore
  @Test
  public void innerInnersFirst() throws IOException {
    TestFileChangeListener listener = new TestFileChangeListener();
    File dir = getTempDir();
    FileSystemWatcher watcher = new FileSystemWatcher(listener, -1, "test");
    pause(1000);
    File f1 = create(dir, "Book$1.class");
    watcher.register(f1);
    pause(1100);
    File f2 = create(dir, "Book.class");
    watcher.register(f2);
    pause(1100);
    File f3 = create(dir, "Book$_2.class");
    watcher.register(f3);
    pause(1100);
    File f4 = create(dir, "Book$Foo.class");
    watcher.register(f4);
    pause(1100);
    File f5 = create(dir, "Book$Foo$1.class");
    watcher.register(f5);
    pause(1100);
    watcher.setPaused(true);
    // Whilst paused, touch both files
    touch(f5);
    touch(f4);
    touch(f3);
    touch(f2);
    touch(f1);
    watcher.setPaused(false);
    pause(1100);
    watcher.shutdown();
    // Check that inners reported first
    System.out.println(listener.changesDetected);
    assertEquals("Book$1.class", listener.changesDetected.get(0));
    assertEquals("Book$Foo$1.class", listener.changesDetected.get(1));
    assertEquals("Book$Foo.class", listener.changesDetected.get(2));
View Full Code Here

      File f = new File(externalForm);
      if (fileChangeListener == null) {
        fileChangeListener = new ReloadableFileChangeListener(this);
      }
      if (fsWatcher == null) {
        fsWatcher = new FileSystemWatcher(fileChangeListener, id, getClassLoaderName());
      }
      fileChangeListener.register(rtype, f);
      fsWatcher.register(f);
      watching.add(externalForm);
    }
View Full Code Here

TOP

Related Classes of org.springsource.loaded.agent.FileSystemWatcher

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.