final DateTime date( Calendar value ) { return session.dateFactory().create(value); }
final DateTime date( Calendar value ) { return session.dateFactory().create(value); }
@Test public void shouldTestEventIteratorTest_testSkip() throws Exception { // create events List<Event> events = new ArrayList<Event>(); DateTime now = session.dateFactory().create(); JcrEventBundle bundle = new JcrEventBundle(now, "userId", null); String id1 = UUID.randomUUID().toString(); String id2 = UUID.randomUUID().toString(); String id3 = UUID.randomUUID().toString(); events.add(new JcrObservationManager.JcrEvent(bundle, Event.NODE_ADDED, "/testroot/node1", id1, nodeType(JcrNtLexicon.UNSTRUCTURED), null)); events.add(new JcrObservationManager.JcrEvent(bundle, Event.NODE_ADDED, "/testroot/node2", id2, nodeType(JcrNtLexicon.UNSTRUCTURED), null)); events.add(new JcrObservationManager.JcrEvent(bundle, Event.NODE_ADDED, "/testroot/node3", id3, nodeType(JcrNtLexicon.UNSTRUCTURED), null)); // create iterator EventIterator itr = new JcrObservationManager.JcrEventIterator(events); // tests itr.skip(0); // skip zero elements assertThat("getPosition() for first element should return 0.", itr.getPosition(), is(0L)); itr.skip(2); // skip one element assertThat("Wrong value when skipping ", itr.getPosition(), is(2L)); try { itr.skip(2); // skip past end fail("EventIterator must throw NoSuchElementException when skipping past the end"); } catch (NoSuchElementException e) { // success } }
private void initializeVersionHistoryFor( AbstractJcrNode node, NodeKey historyKey, SessionCache cache ) throws RepositoryException { SystemContent content = new SystemContent(session.createSystemCache(false)); CachedNode cachedNode = node.node(); Name primaryTypeName = cachedNode.getPrimaryType(cache); Set<Name> mixinTypeNames = cachedNode.getMixinTypes(cache); NodeKey versionedKey = cachedNode.getKey(); Path versionHistoryPath = versionHistoryPathFor(versionedKey); DateTime now = session().dateFactory().create(); content.initializeVersionStorage(versionedKey, historyKey, null, primaryTypeName, mixinTypeNames, versionHistoryPath, null, now); content.save(); }
private void initializeVersionHistoryFor( AbstractJcrNode node, NodeKey historyKey, SessionCache cache ) throws RepositoryException { SystemContent content = new SystemContent(session.createSystemCache(false)); CachedNode cachedNode = node.node(); Name primaryTypeName = cachedNode.getPrimaryType(cache); Set<Name> mixinTypeNames = cachedNode.getMixinTypes(cache); NodeKey versionedKey = cachedNode.getKey(); Path versionHistoryPath = versionHistoryPathFor(versionedKey); DateTime now = session().dateFactory().create(); content.initializeVersionStorage(versionedKey, historyKey, null, primaryTypeName, mixinTypeNames, versionHistoryPath, null, now); content.save(); }
final DateTime now = dateFactory().create(); final Sequencer.Context context = new Sequencer.Context() {
final DateTime now = dateFactory().create(); final Sequencer.Context context = new Sequencer.Context() {
DateTime now = outputSession.dateFactory().create(); Sequencer.Context context = new SequencingContext(now, outputSession.getValueFactory()); if (inputSession.isLive() && (inputSession == outputSession || outputSession.isLive())) {
DateTime now = outputSession.dateFactory().create(); Sequencer.Context context = new SequencingContext(now, outputSession.getValueFactory()); if (inputSession.isLive() && (inputSession == outputSession || outputSession.isLive())) {
@Override @Before public void beforeEach() throws Exception { super.beforeEach(); stringFactory = session.stringFactory(); binaryValue = "This is a binary value".getBytes(); dateValue = session.dateFactory().create(); doubleValue = 3.14159d; longValue = 100L; booleanValue = true; stringValue = "stringValue"; nameValue = "acme:SomeName"; pathValue = "/Cars/Hybrid/Toyota Highlander/acme:SomethingElse"; // Add the mixin to the 'Cars' node ... cars = session.getNode("/Cars"); cars.addMixin("mixinWithAllPropTypes"); altima = session.getNode("/Cars/Hybrid/Nissan Altima"); altima.addMixin("mix:referenceable"); // Set each property ... cars.setProperty("booleanProperty", booleanValue); cars.setProperty("dateProperty", dateValue.toCalendar()); cars.setProperty("doubleProperty", doubleValue); cars.setProperty("binaryProperty", new ByteArrayInputStream(binaryValue)); cars.setProperty("longProperty", longValue); cars.setProperty("referenceProperty", altima); cars.setProperty("stringProperty", stringValue); cars.setProperty("pathProperty", pathValue); cars.setProperty("nameProperty", nameValue); cars.setProperty("undefinedProperty", "100"); }
Path versionHistoryPath = versionHistoryPathFor(versionedKey); CachedNode cachedNode = node.node(); DateTime now = session().dateFactory().create();
Path versionHistoryPath = versionHistoryPathFor(versionedKey); CachedNode cachedNode = node.node(); DateTime now = session().dateFactory().create();
super.beforeEach(); session.getWorkspace().getNamespaceRegistry().registerNamespace("acme", "http://example.com"); dateFactory = session.dateFactory();