Examples of RAMFileSystem


Examples of juzu.impl.fs.spi.ram.RAMFileSystem

        //
        final ReadFileSystem<S> sourcePath = scanner.getFileSystem();

        //
        final RAMFileSystem classOutput = new RAMFileSystem();
        Compiler compiler = Compiler.
            builder().
            sourcePath(sourcePath).
            sourceOutput(classOutput).
            classOutput(classOutput).
            addClassPath(classPath).build();
        compiler.addAnnotationProcessor(new MainProcessor());
        compiler.compile();

        // Copy everything that is not a java source and not already present
        sourcePath.copy(new Filter.Default<S>() {
          @Override
          public boolean acceptFile(S file, String name) throws IOException {
            Iterable<String> names = sourcePath.getNames(file);
            String[] path = classOutput.getPath(names);
            return path == null && !name.endsWith(".java");
          }
        }, classOutput);

        //
        this.classLoader = new LiveClassLoader(new URL[]{classOutput.getURL()}, baseClassLoader);
        this.classes = classOutput;
        this.snapshot = next;
        this.failed = false;

        //
View Full Code Here

Examples of juzu.impl.fs.spi.ram.RAMFileSystem

  }

  @Test
  public void testProcessorErrorOnElement() throws Exception {
    DiskFileSystem fs = diskFS("compiler.annotationexception");
    Compiler compiler = Compiler.builder().javaCompiler(compilerProvider).sourcePath(fs).output(new RAMFileSystem()).build();
    @javax.annotation.processing.SupportedSourceVersion(javax.lang.model.SourceVersion.RELEASE_6)
    @javax.annotation.processing.SupportedAnnotationTypes({"*"})
    class Processor1 extends AbstractProcessor {
      @Override
      public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
View Full Code Here

Examples of juzu.impl.fs.spi.ram.RAMFileSystem

  @Test
  public void testProcessorError() throws Exception {
    // Works only with javac
    if (compilerProvider == JavaCompilerProvider.JAVAC) {
      DiskFileSystem fs = diskFS("compiler.annotationexception");
      Compiler compiler = Compiler.builder().javaCompiler(compilerProvider).sourcePath(fs).output(new RAMFileSystem()).build();
      @javax.annotation.processing.SupportedSourceVersion(javax.lang.model.SourceVersion.RELEASE_6)
      @javax.annotation.processing.SupportedAnnotationTypes({"*"})
      class Processor2 extends AbstractProcessor {
        boolean failed = false;
        @Override
View Full Code Here

Examples of juzu.impl.fs.spi.ram.RAMFileSystem

    Compiler compiler = Compiler.
      builder().
      javaCompiler(compilerProvider).
      config(new CompilerConfig().withProcessorOption("juzu.error_reporting", "formal")).
      sourcePath(fs).
      output(new RAMFileSystem()).
      build();
    P processor = new P();
    compiler.addAnnotationProcessor(processor);
    try {
      compiler.compile();
View Full Code Here

Examples of juzu.impl.fs.spi.ram.RAMFileSystem

/** @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a> */
public class ScannerTestCase extends AbstractTestCase {

  @Test
  public void testFoo() throws IOException {
    RAMFileSystem fs = new RAMFileSystem();
    FileSystemScanner<String[]> scanner = FileSystemScanner.createTimestamped(fs);
   
    //
    Snapshot<String[]> snapshot = scanner.take();
    assertEquals(Collections.<String, Change>emptyMap(), snapshot.getChanges());

    //
    String[] foo = fs.makePath(fs.getRoot(), "foo");
    waitForOneMillis();
    snapshot = snapshot.scan();
    assertEquals(Collections.<String, Change>emptyMap(), snapshot.getChanges());

    //
    String[] bar = fs.makePath(foo, "bar.txt");
    fs.updateResource(bar, new Resource(""));
    waitForOneMillis();
    snapshot = snapshot.scan();
    assertEquals(Collections.singletonMap("/foo/bar.txt", Change.ADD), snapshot.getChanges());
    waitForOneMillis();
    snapshot = snapshot.scan();
    assertEquals(Collections.<String, Change>emptyMap(), snapshot.getChanges());

    //
    fs.updateResource(bar, new Resource("value"));
    waitForOneMillis();
    snapshot = snapshot.scan();
    assertEquals(Collections.singletonMap("/foo/bar.txt", Change.UPDATE), snapshot.getChanges());

    //
    fs.removePath(bar);
    waitForOneMillis();
    snapshot = snapshot.scan();
    assertEquals(Collections.singletonMap("/foo/bar.txt", Change.REMOVE), snapshot.getChanges());
    waitForOneMillis();
    snapshot = snapshot.scan();
View Full Code Here

Examples of juzu.impl.fs.spi.ram.RAMFileSystem

    assertEquals(Collections.<String, Change>emptyMap(), snapshot.getChanges());
  }

  @Test
  public void testIgnoreHiddenFile() throws IOException {
    RAMFileSystem fs = new RAMFileSystem();
    FileSystemScanner<String[]> scanner = FileSystemScanner.createTimestamped(fs);

    //
    Snapshot<String[]> snapshot = scanner.take();
    assertEquals(Collections.<String, Change>emptyMap(), snapshot.getChanges());
    String[] foo = fs.makePath(fs.getRoot(), ".foo");
    fs.updateResource(foo, new Resource(""));
    waitForOneMillis();
    snapshot = snapshot.scan();
    assertEquals(Collections.<String, Change>emptyMap(), snapshot.getChanges());
  }
View Full Code Here

Examples of juzu.impl.fs.spi.ram.RAMFileSystem

    processors.add(annotationProcessorType);
  }

  public void compile(String... compilationUnits) throws IOException, CompilationException {
    // Copy anything that is not a java file
    RAMFileSystem sourcePath1 = new RAMFileSystem();
    sourcePath.copy(new Filter() {
      public boolean acceptDir(Object dir, String name) throws IOException {
        return true;
      }
View Full Code Here

Examples of juzu.impl.fs.spi.ram.RAMFileSystem

    assertEquals(Collections.<String, Change>emptyMap(), snapshot.getChanges());
  }

  @Test
  public void testIgnoreHiddenDir() throws IOException {
    RAMFileSystem fs = new RAMFileSystem();
    FileSystemScanner<String[]> scanner = FileSystemScanner.createTimestamped(fs);

    //
    Snapshot<String[]> snapshot = scanner.take();
    assertEquals(Collections.<String, Change>emptyMap(), snapshot.getChanges());
    String[] bar = fs.makePath(fs.makePath(fs.getRoot(), ".foo"), "bar.txt");
    fs.updateResource(bar, new Resource(""));
    waitForOneMillis();
    snapshot = snapshot.scan();
    assertEquals(Collections.<String, Change>emptyMap(), snapshot.getChanges());
  }
View Full Code Here

Examples of juzu.impl.fs.spi.ram.RAMFileSystem

public class CompositeFileSystemTestCase extends AbstractTestCase {

  @Test
  public void testFoo() throws IOException {

    RAMFileSystem ramFS = new RAMFileSystem();
    ramFS.updateResource(new String[]{"a", "b"}, new Resource("foo"));

    //
    CompositeFileSystem composite = new CompositeFileSystem(ramFS);

    Context root = composite.getRoot();
View Full Code Here

Examples of juzu.impl.fs.spi.ram.RAMFileSystem

  }

  @Test
  public void testGetResourceFromSourcePath() throws Exception {
    DiskFileSystem input = diskFS("compiler.getresource");
    RAMFileSystem output = new RAMFileSystem();
    Compiler compiler = Compiler.builder().javaCompiler(compilerProvider).sourcePath(input).output(output).build();
    GetResource processor = new GetResource(StandardLocation.SOURCE_PATH, FileKey.newResourceName("compiler.getresource", "A.txt"));
    compiler.addAnnotationProcessor(processor);
    compiler.compile();
    assertEquals(1, output.size(ReadFileSystem.FILE));
    processor.assertResource("value");
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.