Examples of MemoryResourceStore


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

                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

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

     */
    public void testLoadClassAfterResourceStoreRemoved() {

        // Create a class loader & add resource store
        ReloadingClassLoader loader = new ReloadingClassLoader(this.getClass().getClassLoader());
        MemoryResourceStore store = new MemoryResourceStore();
        loader.addResourceStore(store);

        // Check "jci.Simple" class can't be loaded
        try {
            loader.loadClass("jci.Simple").newInstance();       
            fail("Success loadClass[1]");
        } catch(ClassNotFoundException e) {
            // expected not found
        } catch(Exception e) {
            log.error(e);
            fail("Error loadClass[1]: " + e);
        }

        // Add "jci.Simple" class to the resource store
        String toStringValue = "FooBar";
        try {
            byte[] classBytes = SimpleDump.dump(toStringValue);
            store.write("jci/Simple.class", classBytes);
        } catch(Exception e) {
            log.error(e);
            fail("Error adding class to store: " + e);
        }

View Full Code Here

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

        final File serverpagesDir = new File(getServletContext().getRealPath("/") + getInitParameter("serverpagesDir"));

        log("Monitoring serverpages in " + serverpagesDir);

        final TransactionalResourceStore store = new TransactionalResourceStore(new MemoryResourceStore()) {

            private Set<String> newClasses;
            private Map<String, HttpServlet> newServletsByClassname;

            public void onStart() {
View Full Code Here

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

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

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

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

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

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

     */
    public void testLoadClassAfterResourceStoreRemoved() {

        // Create a class loader & add resource store
        ReloadingClassLoader loader = new ReloadingClassLoader(this.getClass().getClassLoader());
        MemoryResourceStore store = new MemoryResourceStore();
        loader.addResourceStore(store);

        // Check "jci.Simple" class can't be loaded
        try {
            Object simple1 = loader.loadClass("jci.Simple").newInstance();       
            fail("Success loadClass[1]");
        } catch(ClassNotFoundException e) {
            // expected not found
        } catch(Exception e) {
            log.error(e);
            fail("Error loadClass[1]: " + e);
        }

        // Add "jci.Simple" class to the resource store
        String toStringValue = "FooBar";
        try {
            byte[] classBytes = SimpleDump.dump(toStringValue);
            store.write("jci/Simple.class", classBytes);
        } catch(Exception e) {
            log.error(e);
            fail("Error adding class to store: " + e);
        }

View Full Code Here

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

                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(clazzBytes);
        assertTrue(clazzBytes.length > 0);
    }
View Full Code Here

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

                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(clazzBytesSimple);
        assertTrue(clazzBytesSimple.length > 0);

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

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

                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(clazzBytes);
        assertTrue(clazzBytes.length > 0);

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

    }
View Full Code Here

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

                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(clazzBytes);
        assertTrue(clazzBytes.length > 0);
    }
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.