Package org.impalaframework.file

Examples of org.impalaframework.file.FileMonitor.lastModified()


        final ConfigurableApplicationContext p13reloaded = getModule(plugin1);
        assertNotSame(p13reloaded, p13);
        FileMonitor f1reloaded = (FileMonitor) context3.getBean("bean1");

        assertEquals(f1.lastModified((File) null), f1reloaded.lastModified((File) null));
        service(f1reloaded);
        assertSame(f1reloaded, f1);

        // now reload plugin2, which will also reload plugin3
        assertTrue(Impala.reloadModule(plugin2));
View Full Code Here


        final ConfigurableApplicationContext p33reloaded = getModule(plugin3);
        assertNotSame(p33reloaded, p33);

        FileMonitor f3reloaded = (FileMonitor) context3.getBean("bean3");

        assertEquals(f3.lastModified((File) null), f3reloaded.lastModified((File) null));
        service(f3reloaded);
        assertSame(f3reloaded, f3);

        // show that this will return null
        assertNull(Impala.reloadModuleLike("unknown"));
View Full Code Here

        ConfigurableApplicationContext parent = SpringModuleUtils.getRootSpringContext(moduleStateHolder);

        // the implementing FileMonitorBean3 will find the monitor.properties
        // file
        FileMonitor bean3 = (FileMonitor) parent.getBean("bean3");
        assertEquals(333L, bean3.lastModified((File) null));
   
        //module3's class loader is set as the context class loader
        assertEquals(333L, bean3.lastModified(new File("./")));
       
        //now override this
View Full Code Here

        // file
        FileMonitor bean3 = (FileMonitor) parent.getBean("bean3");
        assertEquals(333L, bean3.lastModified((File) null));
   
        //module3's class loader is set as the context class loader
        assertEquals(333L, bean3.lastModified(new File("./")));
       
        //now override this
        Thread.currentThread().setContextClassLoader(originalClassLoader);

        //still, using bean class loader, so finds 333L again
View Full Code Here

    }

    private void executeBean(String moduleName, String beanName) {
        RuntimeModule runtimeModule = Impala.getRuntimeModule(moduleName);
        FileMonitor bean = (FileMonitor) runtimeModule.getBean(beanName);
        bean.lastModified(new File("./"));
    }
   
    private ApplicationContext getApplicationContext(String moduleName) {

        Application application = Impala.getCurrentApplication();
View Full Code Here

       
        //now override this
        Thread.currentThread().setContextClassLoader(originalClassLoader);

        //still, using bean class loader, so finds 333L again
        assertEquals(333L, bean3.lastModified(new File("./")));
    }

    public void testLoadUnloadModules() {

        ModuleDefinitionSource source = new SimpleModuleDefinitionSource(rootProjectName, new String[] { "parentTestContext.xml" }, new String[] { plugin1, plugin2 });
View Full Code Here

        ConfigurableApplicationContext parent = SpringModuleUtils.getRootSpringContext(moduleStateHolder);
        assertNotNull(parent);
        assertEquals(3, moduleStateHolder.getRuntimeModules().size());

        FileMonitor bean1 = (FileMonitor) parent.getBean("bean1");
        assertEquals(999L, bean1.lastModified((File) null));

        FileMonitor bean2 = (FileMonitor) parent.getBean("bean2");
        assertEquals(100L, bean2.lastModified((File) null));

        // shutdown module and check behaviour has gone
View Full Code Here

        FileMonitor bean1 = (FileMonitor) parent.getBean("bean1");
        assertEquals(999L, bean1.lastModified((File) null));

        FileMonitor bean2 = (FileMonitor) parent.getBean("bean2");
        assertEquals(100L, bean2.lastModified((File) null));

        // shutdown module and check behaviour has gone
        removeModule(plugin2);

        try {
View Full Code Here

        // shutdown module and check behaviour has gone
        removeModule(plugin2);

        try {
            bean2.lastModified((File) null);
            fail();
        }
        catch (NoServiceException e) {
        }
View Full Code Here

        // now reload the module, and see that behaviour returns
       
        addModule(new SimpleModuleDefinition(plugin2));
        bean2 = (FileMonitor) parent.getBean("bean2");
        assertEquals(100L, bean2.lastModified((File) null));

        addModule(new SimpleModuleDefinition(plugin1));
        bean1 = (FileMonitor) parent.getBean("bean1");
        assertEquals(999L, bean1.lastModified((File) null));
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.