public Object call() throws RepositoryException { return service.createBatch(unwrap(sessionInfo), itemId); } }, "createBatch(SessionInfo, ItemId)", new Object[]{unwrap(sessionInfo), itemId});
public Object call() throws RepositoryException { return service.createBatch(unwrap(sessionInfo), itemId); } }, "createBatch(SessionInfo, ItemId)", new Object[]{unwrap(sessionInfo), itemId});
public Batch createBatch(SessionInfo sessionInfo, ItemId itemId) throws RepositoryException { return repositoryService.createBatch(sessionInfo, itemId); }
private void removeTestNode(String path) throws RepositoryException { Batch b = rs.createBatch(si, getNodeId("/")); b.remove(getNodeId(path)); rs.submit(b); }
public void testEmptyValueArray2() throws RepositoryException { NodeId nid = getNodeId(testPath); Name propName = resolver.getQName("mvProperty"); Batch b = rs.createBatch(si, nid); b.addProperty(nid, propName, new QValue[] { rs.getQValueFactory().create(true)}); rs.submit(b); PropertyId pid = getPropertyId(nid, propName); b = rs.createBatch(si, pid); b.setValue(pid, new QValue[0]); rs.submit(b); PropertyInfo pi = rs.getPropertyInfo(si, pid); assertTrue(pi.isMultiValued()); assertEquals(Arrays.asList(new QValue[0]), Arrays.asList(pi.getValues())); }
public void testSetMixin() throws RepositoryException { NodeId nid = getNodeId(testPath); Batch b = rs.createBatch(si, nid); b.addNode(nid, resolver.getQName("anyNode"), NameConstants.NT_UNSTRUCTURED, null); NodeId id = getNodeId(testPath + "/anyNode"); b.setMixins(id, new Name[] {NameConstants.MIX_LOCKABLE}); rs.submit(b); b = rs.createBatch(si, id); b.setMixins(id, new Name[0]); rs.submit(b); NodeInfo nInfo = rs.getNodeInfo(si, id); assertEquals(0, nInfo.getMixins().length); }
public void testReorder() throws RepositoryException { NodeId nid = getNodeId(testPath); Batch b = rs.createBatch(si, nid); b.addNode(nid, resolver.getQName("1"), NameConstants.NT_UNSTRUCTURED, null); b.addNode(nid, resolver.getQName("3"), NameConstants.NT_UNSTRUCTURED, null); b.addNode(nid, resolver.getQName("2"), NameConstants.NT_UNSTRUCTURED, null); rs.submit(b); b = rs.createBatch(si, nid); b.reorderNodes(nid, getNodeId(testPath + "/3"), null); rs.submit(b); Iterator<ChildInfo> it = rs.getChildInfos(si, nid); int i = 1; while (it.hasNext()) { ChildInfo ci = it.next(); assertEquals(i, Integer.parseInt(ci.getName().getLocalName())); i++; } }
@Override protected void tearDown() throws Exception { try { Batch b = rs.createBatch(si, getNodeId("/")); b.remove(getNodeId(testPath)); rs.submit(b); } finally { rs.dispose(si); super.tearDown(); } }
private void createTestNode(String testPath) throws RepositoryException { Batch b = rs.createBatch(si, getNodeId("/")); String name = Text.getName(testPath); b.addNode(getNodeId("/"), resolver.getQName(name), NameConstants.NT_UNSTRUCTURED, null); rs.submit(b); }
@Override protected void tearDown() throws Exception { try { Batch b = rs.createBatch(si, getNodeId("/")); b.remove(getNodeId(testPath)); rs.submit(b); } finally { rs.dispose(si); super.tearDown(); } }
@Override protected void tearDown() throws Exception { try { Batch b = rs.createBatch(si, getNodeId("/")); b.remove(getNodeId(testPath)); rs.submit(b); } finally { rs.dispose(si); super.tearDown(); } }
public void testRemove() throws RepositoryException { NodeId nid = getNodeId(testPath); Batch b = rs.createBatch(si, nid); NodeId id = getNodeId(testPath + "/aTestNode"); b.addNode(nid, resolver.getQName("aTestNode"), NameConstants.NT_UNSTRUCTURED, null); b.addProperty(id, resolver.getQName("aString"), rs.getQValueFactory().create("ba", PropertyType.STRING)); rs.submit(b); PropertyId pid = getPropertyId(id, resolver.getQName("aString")); b = rs.createBatch(si, nid); b.remove(pid); rs.submit(b); try { rs.getPropertyInfo(si, pid); fail(); } catch (RepositoryException e) { // success } }
public void testMultiValuedProperty() throws RepositoryException { NodeId nid = getNodeId(testPath); Name propName = resolver.getQName("mvProperty2"); QValue[] vs = new QValue[] {rs.getQValueFactory().create(111), rs.getQValueFactory().create(222), rs.getQValueFactory().create(333)}; Batch b = rs.createBatch(si, nid); b.addProperty(nid, propName, vs); rs.submit(b); PropertyInfo pi = rs.getPropertyInfo(si, getPropertyId(nid, propName)); assertTrue(pi.isMultiValued()); assertEquals(Arrays.asList(vs), Arrays.asList(pi.getValues())); assertEquals(PropertyType.LONG, pi.getType()); }
public void testUseConsumedBatch() throws RepositoryException { NodeId nid = getNodeId(testPath); Batch b = rs.createBatch(si, nid); b.addProperty(nid, resolver.getQName("any"), rs.getQValueFactory().create(1.34)); rs.submit(b); try { b.remove(nid); rs.submit(b); fail(); } catch (IllegalStateException e) { // success } } //--------------------------------------------------------------------------
private void createFile(Name fileName) throws RepositoryException, IOException { NodeId root = getNodeId(testPath); Batch b = rs.createBatch(si, root); b.addNode(root, fileName, NameConstants.NT_FILE, null); String filePath = testPath + "/" + fileName.getLocalName(); NodeId file = getNodeId(filePath); b.addNode(file, NameConstants.JCR_CONTENT, NameConstants.NT_RESOURCE, null); NodeId content = getNodeId(filePath + "/" + NameConstants.JCR_CONTENT); b.addProperty(content, resolver.getQName(JcrConstants.JCR_LASTMODIFIED), lastModified); b.addProperty(content, resolver.getQName(JcrConstants.JCR_MIMETYPE), mimeType); b.addProperty(content, resolver.getQName(JcrConstants.JCR_ENCODING), enc); InputStream data = new ByteArrayInputStream("\u0633\u0634".getBytes("UTF-8")); b.addProperty(content, resolver.getQName(JcrConstants.JCR_DATA), rs.getQValueFactory().create(data)); rs.submit(b); } }
public void testSetBinaryValue() throws RepositoryException, IOException { NodeId nid = getNodeId(testPath); Name propName = resolver.getQName("binProp"); Batch b = rs.createBatch(si, nid); b.addProperty(nid, propName, rs.getQValueFactory().create(new byte[] {'a', 'b', 'c'})); rs.submit(b); PropertyInfo pi = rs.getPropertyInfo(si, getPropertyId(nid, propName)); assertFalse(pi.isMultiValued()); assertEquals("abc", pi.getValues()[0].getString()); assertEquals(PropertyType.BINARY, pi.getType()); }
public void testSetDateValue() throws RepositoryException { NodeId nid = getNodeId(testPath); Name propName = resolver.getQName("dateProp"); QValue v = rs.getQValueFactory().create(Calendar.getInstance()); Batch b = rs.createBatch(si, nid); b.addProperty(nid, propName, v); rs.submit(b); PropertyInfo pi = rs.getPropertyInfo(si, getPropertyId(nid, propName)); assertFalse(pi.isMultiValued()); assertEquals(v, pi.getValues()[0]); assertEquals(v.getString(), pi.getValues()[0].getString()); assertEquals(PropertyType.DATE, pi.getType()); pi = getPropertyInfo(nid, propName); assertEquals(v, pi.getValues()[0]); assertEquals(v.getString(), pi.getValues()[0].getString()); assertEquals(PropertyType.DATE, pi.getType()); }
public void testSetBooleanValue() throws RepositoryException { NodeId nid = getNodeId(testPath); Name propName = resolver.getQName("booleanProp"); QValue v = rs.getQValueFactory().create(false); Batch b = rs.createBatch(si, nid); b.addProperty(nid, propName, v); rs.submit(b); PropertyInfo pi = rs.getPropertyInfo(si, getPropertyId(nid, propName)); assertFalse(pi.isMultiValued()); assertFalse(pi.getValues()[0].getBoolean()); assertEquals(PropertyType.BOOLEAN, pi.getType()); pi = getPropertyInfo(nid, propName); assertFalse(pi.getValues()[0].getBoolean()); assertEquals(PropertyType.BOOLEAN, pi.getType()); }
public void testSetPathValue() throws RepositoryException { NodeId nid = getNodeId(testPath); Name propName = resolver.getQName("pathProp"); QValue v = rs.getQValueFactory().create(resolver.getQPath(testPath)); Batch b = rs.createBatch(si, nid); b.addProperty(nid, propName, v); rs.submit(b); PropertyInfo pi = rs.getPropertyInfo(si, getPropertyId(nid, propName)); assertFalse(pi.isMultiValued()); assertEquals(v, pi.getValues()[0]); assertEquals(PropertyType.PATH, pi.getType()); pi = getPropertyInfo(nid, propName); assertEquals(v.getPath(), pi.getValues()[0].getPath()); assertEquals(v, pi.getValues()[0]); assertEquals(PropertyType.PATH, pi.getType()); }
public void testSetDoubleValue() throws RepositoryException { NodeId nid = getNodeId(testPath); Name propName = resolver.getQName("doubleProp"); QValue v = rs.getQValueFactory().create((double) 12); Batch b = rs.createBatch(si, nid); b.addProperty(nid, propName, v); rs.submit(b); PropertyInfo pi = rs.getPropertyInfo(si, getPropertyId(nid, propName)); assertFalse(pi.isMultiValued()); assertEquals(v, pi.getValues()[0]); assertEquals(v.getString(), pi.getValues()[0].getString()); assertEquals(PropertyType.DOUBLE, pi.getType()); pi = getPropertyInfo(nid, propName); assertEquals(v, pi.getValues()[0]); assertEquals(v.getString(), pi.getValues()[0].getString()); assertEquals(PropertyType.DOUBLE, pi.getType()); }