public void processResourceUpdate(@Observes final ResourceUpdatedEvent resourceUpdatedEvent) { processResourceChange(resourceUpdatedEvent.getSessionInfo(), resourceUpdatedEvent.getPath(), ResourceChangeType.UPDATE); incrementalBuilder.updateResource(resourceUpdatedEvent.getPath()); }
private String getCommitDescription( ResourceUpdatedEvent event ) { if ( event.getMessage() != null ) { return event.getMessage(); } return ""; }
private void verifyResourceUpdatedEvent(String file, String sessionId, String userId, String commitMessage) { verify(resourceUpdatedEvent, times(1)).fire(resourceUpdatedEventCaptor.capture()); assertEquals(file, resourceUpdatedEventCaptor.getValue().getPath().toURI()); assertEquals(sessionId, resourceUpdatedEventCaptor.getValue().getSessionInfo().getId()); assertEquals(userId, resourceUpdatedEventCaptor.getValue().getSessionInfo().getIdentity().getIdentifier()); assertEquals(commitMessage, resourceUpdatedEventCaptor.getValue().getMessage()); }
@Test public void testCheckBatch() { inboxBackend = new InboxBackendImpl( ioService, systemFS, userServicesBackend, mailboxService, securitySpy ); inboxBackend.recordOpeningEvent( new ResourceOpenedEvent( resourcePath, sessionInfo ) ); verify( ioService, times( 1 ) ).startBatch( mockedFSId ); verify( ioService, times( 1 ) ).endBatch(); inboxBackend.recordUserEditEvent( new ResourceUpdatedEvent( resourcePath, "message", sessionInfo ) ); verify( ioService, times( 2 ) ).startBatch( mockedFSId ); verify( ioService, times( 2 ) ).endBatch(); }
private boolean isASystemEvent( Object _event ) { ResourceUpdatedEvent event = (ResourceUpdatedEvent) _event; final String user = event.getSessionInfo().getIdentity().getIdentifier(); if ( user.equalsIgnoreCase( "system" ) || user.equalsIgnoreCase( "<system>" ) ) { return true; } return false; }
private void verifyResourceUpdatedEvent(String file, String sessionId, String userId, String commitMessage) { verify(resourceUpdatedEvent, times(1)).fire(resourceUpdatedEventCaptor.capture()); assertEquals(file, resourceUpdatedEventCaptor.getValue().getPath().toURI()); assertEquals(sessionId, resourceUpdatedEventCaptor.getValue().getSessionInfo().getId()); assertEquals(userId, resourceUpdatedEventCaptor.getValue().getSessionInfo().getIdentity().getIdentifier()); assertEquals(commitMessage, resourceUpdatedEventCaptor.getValue().getMessage()); }
@Test public void releaseOwnedLockOnly() { lockManager.acquireLockOnDemand(); simulateLockFailure(); simulateLockDemand(); lockManager.onResourceUpdated(new ResourceUpdatedEvent(path, "", new SessionInfoImpl(user))); verify(lockService, never()).releaseLock(any(Path.class), any(ParameterizedCommand.class)); }
public void onResourceUpdated(@Observes final ResourceUpdatedEvent event) { refresh(event.getPath()); }
public void processResourceUpdate(@Observes final ResourceUpdatedEvent resourceUpdatedEvent) { processResourceChange(resourceUpdatedEvent.getSessionInfo(), resourceUpdatedEvent.getPath(), ResourceChangeType.UPDATE); incrementalBuilder.updateResource(resourceUpdatedEvent.getPath()); }
@Test public void testResourceUpdateEvent() { doReturn(createPath()).when(pathPlaceRequest).getPath(); observablePathImpl.onResourceUpdated(new ResourceUpdatedEvent(pathPlaceRequest.getPath(), MESSAGE, createSessionInfo())); verify(onUpdate).execute(any()); verify(observablePathImpl).executeConcurrentUpdateCommand(pathPlaceRequest.getPath(), RESOURCE_SESSION_ID, identityUser); }
public void processResourceUpdate(@Observes final ResourceUpdatedEvent resourceUpdatedEvent) { if (configUpdaterHelper.isPersistenceFile(resourceUpdatedEvent.getPath())) { //persistence.xml has been updated in current project. updateConfig(moduleService.resolveModule(resourceUpdatedEvent.getPath())); } }
public void onResourceUpdate( @Observes final ResourceUpdatedEvent resourceUpdatedEvent ) { if ( defChangeHandler != null && isProcessable( resourceUpdatedEvent.getPath( ) ) ) { defChangeHandler.processResourceUpdate( resourceUpdatedEvent.getPath( ), resourceUpdatedEvent.getSessionInfo( ) ); } }
@Test public void testResourceUpdateEvent() { doReturn(createPath()).when(pathPlaceRequest).getPath(); observablePathImpl.onResourceUpdated(new ResourceUpdatedEvent(pathPlaceRequest.getPath(), MESSAGE, createSessionInfo())); verify(onUpdate).execute(any()); verify(observablePathImpl).executeConcurrentUpdateCommand(pathPlaceRequest.getPath(), RESOURCE_SESSION_ID, identityUser); }
public void processResourceUpdate(@Observes final ResourceUpdatedEvent resourceUpdatedEvent) { if (configUpdaterHelper.isPersistenceFile(resourceUpdatedEvent.getPath())) { //persistence.xml has been updated in current project. updateConfig(moduleService.resolveModule(resourceUpdatedEvent.getPath())); } }
public void processResourceUpdate(@Observes final ResourceUpdatedEvent resourceUpdatedEvent) { processResourceChange(resourceUpdatedEvent.getSessionInfo(), resourceUpdatedEvent.getPath(), ResourceChangeType.UPDATE); incrementalBuilder.updateResource(resourceUpdatedEvent.getPath()); }
@Test public void releaseLockOnUpdate() { lockManager.acquireLockOnDemand(); simulateLockSuccess(); simulateLockDemand(); lockManager.onResourceUpdated(new ResourceUpdatedEvent(path, "", new SessionInfoImpl(user))); verify(lockService, times(1)).releaseLock(any(Path.class), any(ParameterizedCommand.class)); }
void onResourceUpdated(@Observes final ResourceUpdatedEvent updatedEvent) { if (path != null && path.equals(updatedEvent.getPath())) { if (sessionInfo.getId().equals(updatedEvent.getSessionInfo().getId())) { executeUpdateCommands(); } else { executeConcurrentUpdateCommand(updatedEvent.getPath(), updatedEvent.getSessionInfo().getId(), updatedEvent.getSessionInfo().getIdentity()); } } }
@Test public void releaseOwnedLockOnly() { lockManager.acquireLockOnDemand(); simulateLockFailure(); simulateLockDemand(); lockManager.onResourceUpdated(new ResourceUpdatedEvent(path, "", new SessionInfoImpl(user))); verify(lockService, never()).releaseLock(any(Path.class), any(ParameterizedCommand.class)); }
void onResourceUpdated(@Observes ResourceUpdatedEvent res) { if (lockTarget != null && res.getPath().equals(lockTarget.getPath())) { if (!res.getSessionInfo().getIdentity().equals(user)) { reload(); } releaseLock(); } }