Package javax.jcr.observation

Examples of javax.jcr.observation.EventIterator.nextEvent()


        when(propertyEvent.getType()).thenReturn(Event.PROPERTY_ADDED);
        when(propertyEvent.getPath()).thenReturn(resourcePath + "/" + SuperimposingResourceProvider.PROP_SUPERIMPOSE_SOURCE_PATH);

        EventIterator eventIterator = mock(EventIterator.class);
        when(eventIterator.hasNext()).thenReturn(true, true, false);
        when(eventIterator.nextEvent()).thenReturn(nodeEvent, propertyEvent);
        return eventIterator;
    }

    private EventIterator prepareNodeChangeEvent(Resource pResource) throws RepositoryException {
        String resourcePath = pResource.getPath();
View Full Code Here


        when(propertyEvent.getType()).thenReturn(Event.PROPERTY_CHANGED);
        when(propertyEvent.getPath()).thenReturn(resourcePath + "/" + SuperimposingResourceProvider.PROP_SUPERIMPOSE_SOURCE_PATH);

        EventIterator eventIterator = mock(EventIterator.class);
        when(eventIterator.hasNext()).thenReturn(true, false);
        when(eventIterator.nextEvent()).thenReturn(propertyEvent);
        return eventIterator;
    }

    private EventIterator prepareNodeRemoveEvent(Resource pResource) throws RepositoryException {
        String resourcePath = pResource.getPath();
View Full Code Here

        when(nodeEvent.getType()).thenReturn(Event.NODE_REMOVED);
        when(nodeEvent.getPath()).thenReturn(resourcePath);

        EventIterator eventIterator = mock(EventIterator.class);
        when(eventIterator.hasNext()).thenReturn(true, false);
        when(eventIterator.nextEvent()).thenReturn(nodeEvent);
        return eventIterator;
    }

    private EventIterator prepareNodeMoveEvent(Resource pResource, String pOldPath) throws RepositoryException {
        String resourcePath = pResource.getPath();
View Full Code Here

        when(nodeCreateEvent.getType()).thenReturn(Event.NODE_ADDED);
        when(nodeCreateEvent.getPath()).thenReturn(resourcePath);

        EventIterator eventIterator = mock(EventIterator.class);
        when(eventIterator.hasNext()).thenReturn(true, true, false);
        when(eventIterator.nextEvent()).thenReturn(nodeRemoveEvent, nodeCreateEvent);
        return eventIterator;
    }

    @SuppressWarnings("unchecked")
    @Test
View Full Code Here

        testRootNode.save();
        removeEventListener(listener);
        EventIterator events = listener.getEventIterator(DEFAULT_WAIT_TIMEOUT);
        assertNotNull("No events delivered within " + DEFAULT_WAIT_TIMEOUT + "ms.", events);
        assertEquals("Initial call to getPosition() must return 0.", 0, events.getPosition());
        events.nextEvent();
        assertEquals("Wrong value for getPosition()", 1, events.getPosition());
        events.nextEvent();
        assertEquals("Wrong value for getPosition()", 2, events.getPosition());
        events.nextEvent();
        assertEquals("Wrong value for getPosition()", 3, events.getPosition());
View Full Code Here

        EventIterator events = listener.getEventIterator(DEFAULT_WAIT_TIMEOUT);
        assertNotNull("No events delivered within " + DEFAULT_WAIT_TIMEOUT + "ms.", events);
        assertEquals("Initial call to getPosition() must return 0.", 0, events.getPosition());
        events.nextEvent();
        assertEquals("Wrong value for getPosition()", 1, events.getPosition());
        events.nextEvent();
        assertEquals("Wrong value for getPosition()", 2, events.getPosition());
        events.nextEvent();
        assertEquals("Wrong value for getPosition()", 3, events.getPosition());
    }
View Full Code Here

        assertEquals("Initial call to getPosition() must return 0.", 0, events.getPosition());
        events.nextEvent();
        assertEquals("Wrong value for getPosition()", 1, events.getPosition());
        events.nextEvent();
        assertEquals("Wrong value for getPosition()", 2, events.getPosition());
        events.nextEvent();
        assertEquals("Wrong value for getPosition()", 3, events.getPosition());
    }

    /**
     * Tests the method skip()
View Full Code Here

        testRootNode.save();
        removeEventListener(listener);
        EventIterator events = listener.getEventIterator(DEFAULT_WAIT_TIMEOUT);
        assertNotNull("No events delivered within " + DEFAULT_WAIT_TIMEOUT + "ms.", events);
        assertEquals("Initial call to getPosition() must return 0.", 0, events.getPosition());
        events.nextEvent();
        assertEquals("Wrong value for getPosition()", 1, events.getPosition());
        events.nextEvent();
        assertEquals("Wrong value for getPosition()", 2, events.getPosition());
        events.nextEvent();
        assertEquals("Wrong value for getPosition()", 3, events.getPosition());
View Full Code Here

        EventIterator events = listener.getEventIterator(DEFAULT_WAIT_TIMEOUT);
        assertNotNull("No events delivered within " + DEFAULT_WAIT_TIMEOUT + "ms.", events);
        assertEquals("Initial call to getPosition() must return 0.", 0, events.getPosition());
        events.nextEvent();
        assertEquals("Wrong value for getPosition()", 1, events.getPosition());
        events.nextEvent();
        assertEquals("Wrong value for getPosition()", 2, events.getPosition());
        events.nextEvent();
        assertEquals("Wrong value for getPosition()", 3, events.getPosition());
    }
View Full Code Here

        assertEquals("Initial call to getPosition() must return 0.", 0, events.getPosition());
        events.nextEvent();
        assertEquals("Wrong value for getPosition()", 1, events.getPosition());
        events.nextEvent();
        assertEquals("Wrong value for getPosition()", 2, events.getPosition());
        events.nextEvent();
        assertEquals("Wrong value for getPosition()", 3, events.getPosition());
    }

    /**
     * Tests the method skip()
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.