@FixFor( "MODE-1370" ) @Test public void shouldReceiveUserDataWithEventWhenObservationSessionIsSameThatMadeChange() throws Exception { SimpleListener listener = addListener(1, Event.NODE_ADDED, null, false, null, null, false); Node addedNode = getRoot().addNode("node1", UNSTRUCTURED); String userData = "my user data"; getRoot().getSession().getWorkspace().getObservationManager().setUserData(userData); save(); listener.waitForEvents(); removeListener(listener); checkResults(listener); assertTrue("Path for added node is wrong: actual=" + listener.getEvents().get(0).getPath() + ", expected=" + addedNode.getPath(), containsPath(listener, addedNode.getPath())); for (Event event : listener.events) { String eventUserData = event.getUserData(); assertThat(eventUserData, is(userData)); } assertThat(listener.userData.size(), is(not(0))); for (String receivedUserData : listener.userData) { assertThat(receivedUserData, is(userData)); } }
@Override public void setUserData( String userData ) { this.session.addContextData(OBSERVATION_USER_DATA_KEY, userData); }
JcrObservationManager implements ObservationManager { @Override public void setUserData( String userData ) { this.session.addContextData(OBSERVATION_USER_DATA_KEY, userData); } }
JcrObservationManager implements ObservationManager { @Override public void setUserData( String userData ) { this.session.addContextData(OBSERVATION_USER_DATA_KEY, userData); } JcrObservationManager( JcrSession session,
                           Observable repositoryObservable ); }
JcrObservationManager implements ObservationManager { @Override public void setUserData( String userData ) { this.session.addContextData(OBSERVATION_USER_DATA_KEY, userData); } JcrObservationManager( JcrSession session,
                           Observable repositoryObservable ); @Override void addEventListener( EventListener listener,
                                  int eventTypes,
                                  String absPath,
                                  boolean isDeep,
                                  String[] uuid,
                                  String[] nodeTypeName,
                                  boolean noLocal ); @Override EventListenerIterator getRegisteredEventListeners(); @Override void removeEventListener( EventListener listener ); @Override void setUserData( String userData ); @Override EventJournal getEventJournal(); @Override EventJournal getEventJournal( int eventTypes,
                                         String absPath,
                                         boolean isDeep,
                                         String[] uuid,
                                         String[] nodeTypeName ); }
JcrObservationManager implements ObservationManager { @Override public void setUserData( String userData ) { this.session.addContextData(OBSERVATION_USER_DATA_KEY, userData); } JcrObservationManager( JcrSession session,
                           Observable repositoryObservable ); @Override void addEventListener( EventListener listener,
                                  int eventTypes,
                                  String absPath,
                                  boolean isDeep,
                                  String[] uuid,
                                  String[] nodeTypeName,
                                  boolean noLocal ); @Override EventListenerIterator getRegisteredEventListeners(); @Override void removeEventListener( EventListener listener ); @Override void setUserData( String userData ); @Override EventJournal getEventJournal(); @Override EventJournal getEventJournal( int eventTypes,
                                         String absPath,
                                         boolean isDeep,
                                         String[] uuid,
                                         String[] nodeTypeName );  }