public JarExpander(Node node) throws RepositoryException { this.node = node; prop = node.getProperty("jcr:data"); path = prop.getPath(); }
public String jsGet_path() { try { return property.getPath(); } catch (RepositoryException e) { return property.toString(); } }
PageCompareDataLineImpl(Property property, String basePath, int depth) throws RepositoryException { this.path = property.getPath().replace(basePath, ""); this.name = property.getName(); this.value = EvolutionConfig.printProperty(property); this.depth = depth; }
@Override public String getExternalIdentifier() { try { return "/" + FileSystemConnector.class.getName() + ":projections:" + property().getPath(); } catch (final RepositoryException e) { throw new RepositoryRuntimeException(e); } } }
protected void setUp() throws Exception { super.setUp(); Node n = testRootNode.addNode(nodeName1, testNodeType); testNodePath = n.getPath(); Value v = getJcrValue(superuser, RepositoryStub.PROP_PROP_VALUE1, RepositoryStub.PROP_PROP_TYPE1, "test"); Property p = n.setProperty(propertyName1, v); testPropertyPath = p.getPath(); testRootNode.getSession().save(); readOnlySession = getHelper().getReadOnlySession(); }
/** * Tests if getPath() returns the correct path. */ public void testGetPath() throws NotExecutableException, RepositoryException { assertEquals("getPath returns wrong result", testRoot + "/" + property.getName(), property.getPath()); }
/** * Test if Item.isNew() returns true direct after a new PropertyItem is set * (before node is saved (transient)). * * @see javax.jcr.Item#isNew() */ public void testTransientPropertyItemIsNew () throws RepositoryException { Property testProperty = testNode.setProperty(propertyName1, "test"); Item testPropertyItem = superuser.getItem(testProperty.getPath()); // check testPropertyItem.isNew() before save assertTrue("Item.isNew() must return true directly after a new Property is set (before current node is saved)", testPropertyItem.isNew()); }
public CurrentEvolutionEntryImpl(Property property, EvolutionConfig config) { try { this.config = config; this.type = EvolutionEntryType.PROPERTY; this.name = property.getName(); this.depth = EvolutionPathUtil.getLastDepthForPath(property.getPath()); this.path = property.getParent().getName(); this.value = config.printProperty(property); } catch (Exception e) { log.error("Could not inititalize VersionEntry", e); } }
public void testSingleValueWithName() throws RepositoryException { Value weakRef = vf.createValue(target, true); referring.setProperty(propertyName1, weakRef); superuser.save(); PropertyIterator it = target.getWeakReferences(propertyName1); assertTrue("no weak references returned", it.hasNext()); Property p = it.nextProperty(); assertEquals("wrong weak reference property", referring.getProperty(propertyName1).getPath(), p.getPath()); assertFalse("no more weak references expected", it.hasNext()); }
public void testMultiValues() throws RepositoryException { Value weakRef = vf.createValue(target, true); Value[] refs = new Value[]{weakRef, weakRef}; referring.setProperty(propertyName1, refs); superuser.save(); PropertyIterator it = target.getWeakReferences(); assertTrue("no weak references returned", it.hasNext()); Property p = it.nextProperty(); assertEquals("wrong weak reference property", referring.getProperty(propertyName1).getPath(), p.getPath()); assertFalse("no more weak references expected", it.hasNext()); }
public void testMultiValuesWithName() throws RepositoryException { Value weakRef = vf.createValue(target, true); Value[] refs = new Value[]{weakRef, weakRef}; referring.setProperty(propertyName1, refs); superuser.save(); PropertyIterator it = target.getWeakReferences(propertyName1); assertTrue("no weak references returned", it.hasNext()); Property p = it.nextProperty(); assertEquals("wrong weak reference property", referring.getProperty(propertyName1).getPath(), p.getPath()); assertFalse("no more weak references expected", it.hasNext()); }
@Test public void testRootPropertyPath() throws RepositoryException { Property property = getAdminSession().getRootNode().getProperty("jcr:primaryType"); assertEquals("/jcr:primaryType", property.getPath()); }
private static Set<String> getReferencingPaths(Node n) throws RepositoryException { Set<String> refs = Sets.newHashSet(); PropertyIterator it = n.getReferences(); while (it.hasNext()) { refs.add(it.nextProperty().getPath()); } return refs; } }
private static void checkReferences(String msg, PropertyIterator refs, String ... expected) throws RepositoryException { List<String> paths = new LinkedList<String>(); while (refs.hasNext()) { paths.add(refs.nextProperty().getPath()); } checkEquals(msg, paths, expected); }
public void testTransientRententionPolicy2() throws RepositoryException, NotExecutableException { retentionMgr.setRetentionPolicy(testNodePath, getApplicableRetentionPolicy()); assertNoEffect((Node) otherS.getItem(testNodePath), nodeName3, propertyName2); assertNoEffect((Node) otherS.getItem(childN.getPath()), nodeName3, propertyName2); assertNoEffect((Property) otherS.getItem(childP.getPath())); }
public NodeIterator execute() throws Exception { Node n = getNode(); String value = getRandomText(5); String path = n.setProperty(name, value).getPath(); log.info(path + ": " + value); return wrapWithIterator(getNode()); } }
private RestProperty createRestProperty( Session session, Property property, String baseUrl ) throws RepositoryException { List<String> values = restPropertyValues(property, baseUrl, session); String url = RestHelper.urlFrom(baseUrl, ITEMS_METHOD_NAME, encodedPath(property.getPath())); String parentUrl = RestHelper.urlFrom(baseUrl, ITEMS_METHOD_NAME, encodedPath(property.getParent().getPath())); boolean multiValued = property.isMultiple(); return new RestProperty(property.getName(), url, parentUrl, values, multiValued); }
public void testGetPropertyOrNullExisting() throws RepositoryException { JackrabbitSession js = (JackrabbitSession) superuser; Property property = js.getPropertyOrNull(PATH_EXISTING_PROPERTY); assertNotNull(property); assertEquals(property.getPath(), PATH_EXISTING_PROPERTY); }
@Test public void accessRemovedProperty() throws RepositoryException { Node foo = getNode("/foo"); Property p = foo.setProperty("name", "value"); p.remove(); try { p.getPath(); fail("Expected InvalidItemStateException"); } catch (InvalidItemStateException expected) { } }
@Test public void getProperty() throws RepositoryException { Property property = getProperty("/foo/stringProp"); assertNotNull(property); assertEquals("stringProp", property.getName()); assertEquals("/foo/stringProp", property.getPath()); Value value = property.getValue(); assertNotNull(value); assertEquals(PropertyType.STRING, value.getType()); assertEquals("stringVal", value.getString()); }