use of org.apache.sling.api.resource.observation.ResourceChange in project sling by apache.
the class FileVaultFileMonitorTest method testUpdateContent.
@Test
public void testUpdateContent() throws Exception {
List<ResourceChange> changes = resourceListener.getChanges();
assertTrue(changes.isEmpty());
File file = new File(tempDir, "jcr_root/content/samples/en/.content.xml");
FileUtils.touch(file);
Thread.sleep(WAIT_INTERVAL);
assertChange(changes, "/content/samples/en", ChangeType.REMOVED);
assertChange(changes, "/content/samples/en", ChangeType.ADDED);
assertChange(changes, "/content/samples/en/jcr:content", ChangeType.ADDED);
}
use of org.apache.sling.api.resource.observation.ResourceChange in project sling by apache.
the class FileMonitorTest method testRemoveFile.
@Test
public void testRemoveFile() throws Exception {
List<ResourceChange> changes = resourceListener.getChanges();
assertTrue(changes.isEmpty());
File file1a = new File(tempDir, "folder1/file1a.txt");
file1a.delete();
Thread.sleep(WAIT_INTERVAL);
assertEquals(2, changes.size());
assertChange(changes, "/fs-test/folder1", ChangeType.CHANGED);
assertChange(changes, "/fs-test/folder1/file1a.txt", ChangeType.REMOVED);
}
use of org.apache.sling.api.resource.observation.ResourceChange in project sling by apache.
the class FileMonitorTest method testAddFolder.
@Test
public void testAddFolder() throws Exception {
List<ResourceChange> changes = resourceListener.getChanges();
assertTrue(changes.isEmpty());
File folder99 = new File(tempDir, "folder99");
folder99.mkdir();
Thread.sleep(WAIT_INTERVAL);
assertEquals(2, changes.size());
assertChange(changes, "/fs-test", ChangeType.CHANGED);
assertChange(changes, "/fs-test/folder99", ChangeType.ADDED);
}
use of org.apache.sling.api.resource.observation.ResourceChange in project sling by apache.
the class FileVaultFileMonitorTest method testRemoveContent.
@Test
public void testRemoveContent() throws Exception {
List<ResourceChange> changes = resourceListener.getChanges();
assertTrue(changes.isEmpty());
File file = new File(tempDir, "jcr_root/content/samples/en");
FileUtils.deleteDirectory(file);
Thread.sleep(WAIT_INTERVAL);
assertEquals(2, changes.size());
assertChange(changes, "/content/samples", ChangeType.CHANGED);
assertChange(changes, "/content/samples/en", ChangeType.REMOVED);
}
use of org.apache.sling.api.resource.observation.ResourceChange in project sling by apache.
the class FileVaultFileMonitorTest method testRemoveFile.
@Test
public void testRemoveFile() throws Exception {
List<ResourceChange> changes = resourceListener.getChanges();
assertTrue(changes.isEmpty());
File file = new File(tempDir, "jcr_root/content/dam/talk.png/_jcr_content/renditions/web.1280.1280.png");
file.delete();
Thread.sleep(WAIT_INTERVAL);
assertEquals(2, changes.size());
assertChange(changes, "/content/dam/talk.png/jcr:content/renditions", ChangeType.CHANGED);
assertChange(changes, "/content/dam/talk.png/jcr:content/renditions/web.1280.1280.png", ChangeType.REMOVED);
}
Aggregations