public void onBatchResourceChanges(final @Observes ResourceBatchChangesEvent resourceBatchChangesEvent) { super.onBatchResourceChanges(resourceBatchChangesEvent); }
public void onBatchResourceChanges(final ResourceBatchChangesEvent resourceBatchChangesEvent) { for (final Map.Entry<org.uberfire.backend.vfs.Path, Collection<ResourceChange>> entry : resourceBatchChangesEvent.getBatch().entrySet()) { if (entry.getKey().getFileName().equals("pom.xml") && isDelete(entry.getValue())) { fireDeleteEvent(entry.getKey()); } } }
private void fireDeleteEvent(final org.uberfire.backend.vfs.Path _path) { final Path path = ioService.get(URI.create(_path.toURI())); final T project = getModule(path.getParent()); deleteModuleEvent.fire(new DeleteModuleEvent(project)); }
public void onBatchResourceChanges(final ResourceDeletedEvent event) { if (event.getPath().getFileName().equals("pom.xml")) { fireDeleteEvent(event.getPath()); } }
public void onBatchResourceChanges(final ResourceDeletedEvent event) { if (event.getPath().getFileName().equals("pom.xml")) { fireDeleteEvent(event.getPath()); } }
public void onBatchResourceChanges(final @Observes ResourceDeletedEvent event) { super.onBatchResourceChanges(event); }
public void onBatchResourceChanges(final ResourceBatchChangesEvent resourceBatchChangesEvent) { for (final Map.Entry<org.uberfire.backend.vfs.Path, Collection<ResourceChange>> entry : resourceBatchChangesEvent.getBatch().entrySet()) { if (entry.getKey().getFileName().equals("pom.xml") && isDelete(entry.getValue())) { fireDeleteEvent(entry.getKey()); } } }
private void fireDeleteEvent(final org.uberfire.backend.vfs.Path _path) { final Path path = ioService.get(URI.create(_path.toURI())); final T project = getModule(path.getParent()); deleteModuleEvent.fire(new DeleteModuleEvent(project)); }
@Test public void testResourceDeletedEventNonPomFile() { final Path path = mock(Path.class); final org.uberfire.java.nio.file.Path nioPath = mock(org.uberfire.java.nio.file.Path.class); when(path.getFileName()).thenReturn("cheese.drl"); when(path.toURI()).thenReturn("file://module1/cheese.drl"); when(ioService.get(any(URI.class))).thenReturn(nioPath); bridge.onBatchResourceChanges(new ResourceDeletedEvent(path, "message", sessionInfo)); verify(deleteModuleEvent, times(0)).fire(any(DeleteModuleEvent.class)); }
@Test public void testResourceDeletedEventPomFile() { final Path path = mock(Path.class); final org.uberfire.java.nio.file.Path nioPath = mock(org.uberfire.java.nio.file.Path.class); when(path.getFileName()).thenReturn("pom.xml"); when(path.toURI()).thenReturn("file://module1/pom.xml"); when(ioService.get(any(URI.class))).thenReturn(nioPath); bridge.onBatchResourceChanges(new ResourceDeletedEvent(path, "message", sessionInfo)); verify(deleteModuleEvent, times(1)).fire(any(DeleteModuleEvent.class)); }
@Test public void testResourceDeletedEventPomFile() { final Path path = mock(Path.class); final org.uberfire.java.nio.file.Path nioPath = mock(org.uberfire.java.nio.file.Path.class); when(path.getFileName()).thenReturn("pom.xml"); when(path.toURI()).thenReturn("file://module1/pom.xml"); when(ioService.get(any(URI.class))).thenReturn(nioPath); bridge.onBatchResourceChanges(new ResourceDeletedEvent(path, "message", sessionInfo)); verify(deleteModuleEvent, times(1)).fire(any(DeleteModuleEvent.class)); }
@Test public void testResourceDeletedEventNonPomFile() { final Path path = mock(Path.class); final org.uberfire.java.nio.file.Path nioPath = mock(org.uberfire.java.nio.file.Path.class); when(path.getFileName()).thenReturn("cheese.drl"); when(path.toURI()).thenReturn("file://module1/cheese.drl"); when(ioService.get(any(URI.class))).thenReturn(nioPath); bridge.onBatchResourceChanges(new ResourceDeletedEvent(path, "message", sessionInfo)); verify(deleteModuleEvent, times(0)).fire(any(DeleteModuleEvent.class)); }
@Test public void testResourceBatchChangesEventDeletePomFile() { final Path path = mock(Path.class); final org.uberfire.java.nio.file.Path nioPath = mock(org.uberfire.java.nio.file.Path.class); when(path.getFileName()).thenReturn("pom.xml"); when(path.toURI()).thenReturn("file://module1/pom.xml"); when(ioService.get(any(URI.class))).thenReturn(nioPath); final Map<Path, Collection<ResourceChange>> batch = new HashMap<Path, Collection<ResourceChange>>() {{ put(path, new ArrayList<ResourceChange>() {{ add(new ResourceDeleted("")); }}); }}; bridge.onBatchResourceChanges(new ResourceBatchChangesEvent(batch, "message", sessionInfo)); verify(deleteModuleEvent, times(1)).fire(any(DeleteModuleEvent.class)); }
@Test public void testResourceBatchChangesEventUpdatePomFile() { final Path path = mock(Path.class); final org.uberfire.java.nio.file.Path nioPath = mock(org.uberfire.java.nio.file.Path.class); when(path.getFileName()).thenReturn("pom.xml"); when(path.toURI()).thenReturn("file://module1/pom.xml"); when(ioService.get(any(URI.class))).thenReturn(nioPath); final Map<Path, Collection<ResourceChange>> batch = new HashMap<Path, Collection<ResourceChange>>() {{ put(path, new ArrayList<ResourceChange>() {{ add(new ResourceUpdated("")); }}); }}; bridge.onBatchResourceChanges(new ResourceBatchChangesEvent(batch, "message", sessionInfo)); verify(deleteModuleEvent, times(0)).fire(any(DeleteModuleEvent.class)); }
@Test public void testResourceBatchChangesEventDeleteNonPomFile() { final Path path = mock(Path.class); final org.uberfire.java.nio.file.Path nioPath = mock(org.uberfire.java.nio.file.Path.class); when(path.getFileName()).thenReturn("cheese.drl"); when(path.toURI()).thenReturn("file://module1/cheese.drl"); when(ioService.get(any(URI.class))).thenReturn(nioPath); final Map<Path, Collection<ResourceChange>> batch = new HashMap<Path, Collection<ResourceChange>>() {{ put(path, new ArrayList<ResourceChange>() {{ add(new ResourceDeleted("")); }}); }}; bridge.onBatchResourceChanges(new ResourceBatchChangesEvent(batch, "message", sessionInfo)); verify(deleteModuleEvent, times(0)).fire(any(DeleteModuleEvent.class)); } }
@Test public void testResourceBatchChangesEventDeleteNonPomFile() { final Path path = mock(Path.class); final org.uberfire.java.nio.file.Path nioPath = mock(org.uberfire.java.nio.file.Path.class); when(path.getFileName()).thenReturn("cheese.drl"); when(path.toURI()).thenReturn("file://module1/cheese.drl"); when(ioService.get(any(URI.class))).thenReturn(nioPath); final Map<Path, Collection<ResourceChange>> batch = new HashMap<Path, Collection<ResourceChange>>() {{ put(path, new ArrayList<ResourceChange>() {{ add(new ResourceDeleted("")); }}); }}; bridge.onBatchResourceChanges(new ResourceBatchChangesEvent(batch, "message", sessionInfo)); verify(deleteModuleEvent, times(0)).fire(any(DeleteModuleEvent.class)); } }
@Test public void testResourceBatchChangesEventUpdatePomFile() { final Path path = mock(Path.class); final org.uberfire.java.nio.file.Path nioPath = mock(org.uberfire.java.nio.file.Path.class); when(path.getFileName()).thenReturn("pom.xml"); when(path.toURI()).thenReturn("file://module1/pom.xml"); when(ioService.get(any(URI.class))).thenReturn(nioPath); final Map<Path, Collection<ResourceChange>> batch = new HashMap<Path, Collection<ResourceChange>>() {{ put(path, new ArrayList<ResourceChange>() {{ add(new ResourceUpdated("")); }}); }}; bridge.onBatchResourceChanges(new ResourceBatchChangesEvent(batch, "message", sessionInfo)); verify(deleteModuleEvent, times(0)).fire(any(DeleteModuleEvent.class)); }
@Test public void testResourceBatchChangesEventUpdateNonPomFile() { final Path path = mock(Path.class); final org.uberfire.java.nio.file.Path nioPath = mock(org.uberfire.java.nio.file.Path.class); when(path.getFileName()).thenReturn("cheese.drl"); when(path.toURI()).thenReturn("file://module1/cheese.drl"); when(ioService.get(any(URI.class))).thenReturn(nioPath); final Map<Path, Collection<ResourceChange>> batch = new HashMap<Path, Collection<ResourceChange>>() {{ put(path, new ArrayList<ResourceChange>() {{ add(new ResourceUpdated("")); }}); }}; bridge.onBatchResourceChanges(new ResourceBatchChangesEvent(batch, "message", sessionInfo)); verify(deleteModuleEvent, times(0)).fire(any(DeleteModuleEvent.class)); }
@Test public void testResourceBatchChangesEventUpdateNonPomFile() { final Path path = mock(Path.class); final org.uberfire.java.nio.file.Path nioPath = mock(org.uberfire.java.nio.file.Path.class); when(path.getFileName()).thenReturn("cheese.drl"); when(path.toURI()).thenReturn("file://module1/cheese.drl"); when(ioService.get(any(URI.class))).thenReturn(nioPath); final Map<Path, Collection<ResourceChange>> batch = new HashMap<Path, Collection<ResourceChange>>() {{ put(path, new ArrayList<ResourceChange>() {{ add(new ResourceUpdated("")); }}); }}; bridge.onBatchResourceChanges(new ResourceBatchChangesEvent(batch, "message", sessionInfo)); verify(deleteModuleEvent, times(0)).fire(any(DeleteModuleEvent.class)); }
@Test public void testResourceBatchChangesEventDeletePomFile() { final Path path = mock(Path.class); final org.uberfire.java.nio.file.Path nioPath = mock(org.uberfire.java.nio.file.Path.class); when(path.getFileName()).thenReturn("pom.xml"); when(path.toURI()).thenReturn("file://module1/pom.xml"); when(ioService.get(any(URI.class))).thenReturn(nioPath); final Map<Path, Collection<ResourceChange>> batch = new HashMap<Path, Collection<ResourceChange>>() {{ put(path, new ArrayList<ResourceChange>() {{ add(new ResourceDeleted("")); }}); }}; bridge.onBatchResourceChanges(new ResourceBatchChangesEvent(batch, "message", sessionInfo)); verify(deleteModuleEvent, times(1)).fire(any(DeleteModuleEvent.class)); }