Search in sources :

Example 6 with FileChangeEvent

use of org.apache.commons.vfs2.FileChangeEvent in project motech by motech.

the class ConfigFileMonitorTest method shouldSaveConfigWhenNewFileCreated.

@Test
public void shouldSaveConfigWhenNewFileCreated() throws IOException {
    final String fileName = "res:config/org.motechproject.motech-module1/somemodule.properties";
    FileObject fileObject = VFS.getManager().resolveFile(fileName);
    configFileMonitor.fileCreated(new FileChangeEvent(fileObject));
    verify(configurationService).addOrUpdate(new File(fileObject.getName().getPath()));
}
Also used : FileObject(org.apache.commons.vfs2.FileObject) FileChangeEvent(org.apache.commons.vfs2.FileChangeEvent) File(java.io.File) Test(org.junit.Test)

Example 7 with FileChangeEvent

use of org.apache.commons.vfs2.FileChangeEvent in project motech by motech.

the class ConfigFileMonitorTest method shouldNotSaveConfigWhenNewFileCreatedIsNotSupported.

@Test
public void shouldNotSaveConfigWhenNewFileCreatedIsNotSupported() throws IOException {
    final String fileName = "res:config/motech-settings.conf";
    FileObject fileObject = VFS.getManager().resolveFile(fileName);
    configFileMonitor.fileCreated(new FileChangeEvent(fileObject));
    verifyZeroInteractions(configurationService);
}
Also used : FileObject(org.apache.commons.vfs2.FileObject) FileChangeEvent(org.apache.commons.vfs2.FileChangeEvent) Test(org.junit.Test)

Aggregations

FileObject (org.apache.commons.vfs2.FileObject)7 File (java.io.File)6 FileChangeEvent (org.apache.commons.vfs2.FileChangeEvent)4 Test (org.junit.Test)4 HashMap (java.util.HashMap)3