// Path: node-projects/src/main/java/org/netbeans/modules/nodejs/registry/FileChangeRegistry.java
// public enum EventType {
//     CHANGE,
//     DELETED,
//     NEW_CHILD
// }
// 
// Path: node-projects/src/main/java/org/netbeans/modules/nodejs/registry/FileChangeRegistry.java
// public interface FileObserver {
//     public void onEvent ( EventType type, String path );
// }


import org.openide.filesystems.FileObject;
import org.openide.filesystems.FileSystem;
import org.openide.filesystems.FileUtil;
import org.openide.util.Lookup;
import org.openide.util.lookup.Lookups;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List;
import org.junit.Test;
import static org.junit.Assert.*;
import org.junit.Before;
import org.netbeans.api.project.Project;
import org.netbeans.modules.nodejs.registry.FileChangeRegistry.EventType;
import org.netbeans.modules.nodejs.registry.FileChangeRegistry.FileObserver;
import org.openide.filesystems.FileLock;
    @Before
    public void setUp () throws IOException {
        mfs = FileUtil.createMemoryFileSystem();
        projectRoot = addFolder( "prj" );
        fake = new Fake( projectRoot );
        sub = addFolder( "prj/sub" );
        sublet = addFolder( "prj/sublet" );
        a = addFile( "prj/sub/a.txt" );
        b = addFile( "prj/sub/b.txt" );
        c = addFile( "prj/project.json" );
        d = addFile( "offRoot.txt" );
        su = addFolder( "prj/su" );
        reg = new FileChangeRegistry( fake );
        oRoot = new O( "root" );
        oSub = new O( "sub" );
        oa = new O( "a" );
        ob = new O( "b" );
        oc = new O( "c" );
        od = new O( "d" );
        reg.registerInterest( a, oa );
        reg.registerInterest( b, ob );
        reg.registerInterest( c, oc );
        reg.registerInterest( c, od );
        reg.registerInterest( projectRoot, oRoot );
        reg.registerInterest( sub, oSub );
    }

    @Test
    public void testEditFile () throws IOException, InterruptedException {
        write( "prj/sub/a.txt", "Hello world" );
// Path: node-projects/src/main/java/org/netbeans/modules/nodejs/registry/FileChangeRegistry.java
// public enum EventType {
//     CHANGE,
//     DELETED,
//     NEW_CHILD
// }
// 
// Path: node-projects/src/main/java/org/netbeans/modules/nodejs/registry/FileChangeRegistry.java
// public interface FileObserver {
//     public void onEvent ( EventType type, String path );
// }


// Path: node-projects/src/test/java/org/netbeans/modules/nodejs/registry/FileChangeRegistryTest.java
import org.openide.filesystems.FileObject;
import org.openide.filesystems.FileSystem;
import org.openide.filesystems.FileUtil;
import org.openide.util.Lookup;
import org.openide.util.lookup.Lookups;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List;
import org.junit.Test;
import static org.junit.Assert.*;
import org.junit.Before;
import org.netbeans.api.project.Project;
import org.netbeans.modules.nodejs.registry.FileChangeRegistry.EventType;
import org.netbeans.modules.nodejs.registry.FileChangeRegistry.FileObserver;
import org.openide.filesystems.FileLock;

    @Before
    public void setUp () throws IOException {
        mfs = FileUtil.createMemoryFileSystem();
        projectRoot = addFolder( "prj" );
        fake = new Fake( projectRoot );
        sub = addFolder( "prj/sub" );
        sublet = addFolder( "prj/sublet" );
        a = addFile( "prj/sub/a.txt" );
        b = addFile( "prj/sub/b.txt" );
        c = addFile( "prj/project.json" );
        d = addFile( "offRoot.txt" );
        su = addFolder( "prj/su" );
        reg = new FileChangeRegistry( fake );
        oRoot = new O( "root" );
        oSub = new O( "sub" );
        oa = new O( "a" );
        ob = new O( "b" );
        oc = new O( "c" );
        od = new O( "d" );
        reg.registerInterest( a, oa );
        reg.registerInterest( b, ob );
        reg.registerInterest( c, oc );
        reg.registerInterest( c, od );
        reg.registerInterest( projectRoot, oRoot );
        reg.registerInterest( sub, oSub );
    }

    @Test
    public void testEditFile () throws IOException, InterruptedException {
        write( "prj/sub/a.txt", "Hello world" );
        List<EventType> l = oSub.await();