@Override public PropertyIterator getProperties(final String namePattern) throws RepositoryException { final Pattern pattern = Pattern.compile(namePattern); RangeIterator items = getMockedSession().listChildren(getPath(), new ItemFilter() { @Override public boolean accept(final Item item) throws RepositoryException { return (item instanceof Property) && pattern.matcher(item.getName()).matches(); } }); return new PropertyIteratorAdapter(items, items.getSize()); }
@Override public NodeIterator getNodes(final String namePattern) throws RepositoryException { final Pattern pattern = Pattern.compile(namePattern); RangeIterator items = getMockedSession().listChildren(getPath(), new ItemFilter() { @Override public boolean accept(final Item item) throws RepositoryException { return (item instanceof Node) && pattern.matcher(item.getName()).matches(); } }); return new NodeIteratorAdapter(items, items.getSize()); }
@Override public NodeIterator getNodes() throws RepositoryException { RangeIterator items = getMockedSession().listChildren(getPath(), new ItemFilter() { @Override public boolean accept(final Item item) { return item instanceof Node; } }); return new NodeIteratorAdapter(items, items.getSize()); }
@Override public PropertyIterator getProperties() throws RepositoryException { RangeIterator items = getMockedSession().listChildren(getPath(), new ItemFilter() { @Override public boolean accept(final Item item) { return item instanceof Property; } }); return new PropertyIteratorAdapter(items, items.getSize()); }
@Override public Property setProperty(final String name, final boolean value) throws RepositoryException { Property property = new MockProperty(getPath() + "/" + name, getSession()); property.setValue(value); getMockedSession().addItem(property); return property; }
@Override public Property setProperty(final String name, final Value value) throws RepositoryException { Property property = new MockProperty(getPath() + "/" + name, getSession()); property.setValue(value); getMockedSession().addItem(property); return property; }
@Override public Property setProperty(final String name, final String value) throws RepositoryException { Property property = new MockProperty(getPath() + "/" + name, getSession()); property.setValue(value); getMockedSession().addItem(property); return property; }
@Override public Property setProperty(final String name, final Calendar value) throws RepositoryException { Property property = new MockProperty(getPath() + "/" + name, getSession()); property.setValue(value); getMockedSession().addItem(property); return property; }
@Override public Property setProperty(final String name, final String[] values) throws RepositoryException { Property property = new MockProperty(getPath() + "/" + name, getSession()); property.setValue(values); getMockedSession().addItem(property); return property; }
@Override @SuppressWarnings("deprecation") public Property setProperty(final String name, final InputStream value) throws RepositoryException { Property property = new MockProperty(getPath() + "/" + name, getSession()); property.setValue(value); getMockedSession().addItem(property); return property; }
@Override public Property setProperty(final String name, final Value[] values) throws RepositoryException { Property property = new MockProperty(getPath() + "/" + name, getSession()); property.setValue(values); getMockedSession().addItem(property); return property; }
@Override public Property setProperty(final String name, final long value) throws RepositoryException { Property property = new MockProperty(getPath() + "/" + name, getSession()); property.setValue(value); getMockedSession().addItem(property); return property; }
@Override public Property setProperty(final String name, final Node value) throws RepositoryException { Property property = new MockProperty(getPath() + "/" + name, getSession()); property.setValue(value); getMockedSession().addItem(property); return property; }
@Override public Property setProperty(final String name, final double value) throws RepositoryException { Property property = new MockProperty(getPath() + "/" + name, getSession()); property.setValue(value); getMockedSession().addItem(property); return property; }
@Override public Property setProperty(final String name, final Binary value) throws RepositoryException { Property property = new MockProperty(getPath() + "/" + name, getSession()); property.setValue(value); getMockedSession().addItem(property); return property; }
@Override public Property setProperty(final String name, final BigDecimal value) throws RepositoryException { Property property = new MockProperty(getPath() + "/" + name, getSession()); property.setValue(value); getMockedSession().addItem(property); return property; }
@Override public Node addNode(final String relPath, final String primaryNodeTypeName) throws RepositoryException { String path = makeAbsolutePath(relPath); Node node = new MockNode(path, getSession(), new MockNodeType(primaryNodeTypeName)); getMockedSession().addItem(node); return node; }