Package org.apache.commons.jci.stores

Examples of org.apache.commons.jci.stores.MemoryResourceStore


        this.packageName = packageName;
        this.knowledgeHelper = knowledgeHelper;

        this.src = new MemoryResourceReader();
        this.dst = new MemoryResourceStore();

        compile();

        //        //srcJar may be null so check before we do toURL
        //        URL srcJarUrl = null;
View Full Code Here


    public CompilingListener() {
        this(new JavaCompilerFactory().createCompiler("eclipse"));
    }

    public CompilingListener( final JavaCompiler pCompiler ) {
        this(pCompiler, new TransactionalResourceStore(new MemoryResourceStore()));
    }
View Full Code Here

   
    private final Set<ReloadNotificationListener> notificationListeners = new HashSet<ReloadNotificationListener>();
    private final ResourceStore store;
   
    public ReloadingListener() {
        this(new MemoryResourceStore());
    }
View Full Code Here

                return sources.containsKey(pResourceName);
            }

        };

        final MemoryResourceStore store = new MemoryResourceStore();
        final CompilationResult result = compiler.compile(
                new String[] {
                        "jci/Simple.java"
                }, reader, store);

        assertEquals(toString(result.getErrors()), 0, result.getErrors().length);
        assertEquals(toString(result.getWarnings()), 0, result.getWarnings().length);

        final byte[] clazzBytes = store.read("jci/Simple.class");
        assertNotNull("jci/Simple.class is not null",clazzBytes);
        assertTrue("jci/Simple.class is not empty", clazzBytes.length > 0);
    }
View Full Code Here

                return sources.containsKey(pResourceName);
            }

        };

        final MemoryResourceStore store = new MemoryResourceStore();
        final CompilationResult result = compiler.compile(
                new String[] {
                        "jci/Extended.java",
                        "jci/Simple.java"
                }, reader, store);

        assertEquals(toString(result.getErrors()), 0, result.getErrors().length);
        assertEquals(toString(result.getWarnings()), 0, result.getWarnings().length);

        final byte[] clazzBytesSimple = store.read("jci/Simple.class");
        assertNotNull("jci/Simple.class is not null", clazzBytesSimple);
        assertTrue("jci/Simple.class is not empty", clazzBytesSimple.length > 0);

        final byte[] clazzBytesExtended = store.read("jci/Extended.class");
        assertNotNull("jci/Extended.class is not null", clazzBytesExtended);
        assertTrue("jci/Extended.class is not empty",clazzBytesExtended.length > 0);
    }
View Full Code Here

                return sources.containsKey(pResourceName);
            }

        };

        final MemoryResourceStore store = new MemoryResourceStore();
        final CompilationResult result = compiler.compile(
                new String[] {
                        "jci/Simple.java"
                }, reader, store);

        assertEquals(toString(result.getErrors()), 0, result.getErrors().length);
        assertEquals(toString(result.getWarnings()), 0, result.getWarnings().length);

        final byte[] clazzBytes = store.read("jci/Simple.class");
        assertNotNull("jci/Simple.class is not null", clazzBytes);
        assertTrue("jci/Simple.class is not empty", clazzBytes.length > 0);

        final byte[] subClazzBytes = store.read("jci/Simple$Sub.class");
        assertNotNull("jci/Simple$Sub.class is not null", subClazzBytes);
        assertTrue("jci/Simple$Sub.class is not empty", subClazzBytes.length > 0);

    }
View Full Code Here

                return sources.containsKey(pResourceName);
            }

        };

        final MemoryResourceStore store = new MemoryResourceStore();
        final CompilationResult result = compiler.compile(
                new String[] {
                        "Jci/Simple.java"
                }, reader, store);

        assertEquals(toString(result.getErrors()), 0, result.getErrors().length);
        assertEquals(toString(result.getWarnings()), 0, result.getWarnings().length);

        final byte[] clazzBytes = store.read("Jci/Simple.class");
        assertNotNull("Jci/Simple.class is not null", clazzBytes);
        assertTrue("Jci/Simple.class is not empty", clazzBytes.length > 0);
    }
View Full Code Here

        final JavaCompilerSettings settings = compiler.createDefaultSettings();
        settings.setTargetVersion("1.5");
        settings.setSourceVersion("1.5");

        final MemoryResourceStore store = new MemoryResourceStore();
        final CompilationResult result = compiler.compile(
                new String[] {
                        "jci/Func1.java",
                        "jci/Func2.java"
                }, reader, store, this.getClass().getClassLoader(), settings);

        assertEquals(toString(result.getErrors()), 0, result.getErrors().length);
        assertEquals(toString(result.getWarnings()), 0, result.getWarnings().length);

        final byte[] clazzBytesFunc1 = store.read("jci/Func1.class");
        assertNotNull("jci/Func1.class is not null", clazzBytesFunc1);
        assertTrue("jci/Func1.class is not empty", clazzBytesFunc1.length > 0);

        final byte[] clazzBytesFunc2 = store.read("jci/Func2.class");
        assertNotNull("jci/Func2.class is not null", clazzBytesFunc2);
        assertTrue("jci/Func2.class is not empty", clazzBytesFunc2.length > 0);
    }
View Full Code Here

           public boolean isAvailable( final String pResourceName ) {
               return sources.containsKey(pResourceName);
           }
        };
   
        final MemoryResourceStore store = new MemoryResourceStore();
        final CompilationResult result = compiler.compile(
               new String[] {
                       "jci/Simple.java"
               }, reader, store);
   
        assertEquals("Unexpected errors(s): " + toString(result.getErrors()), 0, result.getErrors().length);
   
        final byte[] clazzBytes = store.read("jci/Simple.class");
        assertNotNull("Expected to find jci/Simple.class", clazzBytes);
        assertTrue(clazzBytes.length > 0);

        final byte[] additionalTopLevelBytes = store.read("jci/AdditionalTopLevel.class");
        assertNotNull("Expected to find jci/AdditionalTopLevel.class", additionalTopLevelBytes);
        assertTrue(additionalTopLevelBytes.length > 0);

        assertEquals("Unexpected warning(s): " + toString(result.getWarnings()), 0, result.getWarnings().length);
    }
View Full Code Here

                return sources.containsKey(pResourceName);
            }

        };

        final MemoryResourceStore store = new MemoryResourceStore();
        final CompilationResult result = compiler.compile(
                new String[] {
                        "jci/Simple.js"
                }, reader, store);

        assertEquals(toString(result.getErrors()), 0, result.getErrors().length);
        assertEquals(toString(result.getWarnings()), 0, result.getWarnings().length);

        final byte[] clazzBytes = store.read("jci/Simple.class");
        assertNotNull(clazzBytes);
        assertTrue(clazzBytes.length > 0);
    }
View Full Code Here

TOP

Related Classes of org.apache.commons.jci.stores.MemoryResourceStore

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.