@Override public Property getProperty() throws RepositoryException { Property internalProperty = delegate.getProperty(); return new PropertyFacade<>(internalProperty, session); }
/** * Tests dereferencing a REFERENCE property to a Property * @since JCR 2.0 */ public void testGetProperty() throws RepositoryException { try { prop.getProperty(); fail("A REFERENCE property cannot be resolved to a Property."); } catch (ValueFormatException e) { // ok } }
@Override public Property getProperty() throws ItemNotFoundException, ValueFormatException, RepositoryException { return getWrappedProperty().getProperty(); }
public Property getProperty() throws ItemNotFoundException, ValueFormatException, RepositoryException { return factory.getPropertyDecorator(session, property.getProperty()); }
/** * Tests the conversion from Binary type to Path type. This conversion * passes through previous String conversion. */ public void testGetProperty() throws RepositoryException, NotExecutableException { if (!multiple) { // not testable since format of ID is implementation specific } else { try { prop.getProperty(); fail("Property.getProperty() called on a multivalue property " + "should throw a ValueFormatException."); } catch (ValueFormatException vfe) { // ok } } }
/** * Tests conversion from String type to Reference or Path type. */ public void testGetProperty() throws RepositoryException, NotExecutableException { if (!multiple) { // not testable as a STRING may or may not be convertable to Path or Reference } else { try { prop.getProperty(); fail("Property.getNode() called on a multivalue property " + "should throw a ValueFormatException."); } catch (ValueFormatException vfe) { // ok } } }
/** * Tests failure of conversion from Double type to Path type. */ public void testGetProperty() throws RepositoryException { if (!multiple) { try { prop.getProperty(); fail("Conversion from a Double value to a Path value " + "should throw a ValueFormatException."); } catch (ValueFormatException e) { // success. } } else { try { prop.getProperty(); fail("Property.getProperty() called on a multivalue property " + "should throw a ValueFormatException."); } catch (ValueFormatException vfe) { // ok } } }
/** * Tests failure of conversion from Long type to Path type. */ public void testGetProperty() throws RepositoryException { if (!multiple) { try { prop.getProperty(); fail("Conversion from a Long value to a Path value " + "should throw a ValueFormatException."); } catch (ValueFormatException e) { // success. } } else { try { prop.getProperty(); fail("Property.getProperty() called on a multivalue property " + "should throw a ValueFormatException."); } catch (ValueFormatException vfe) { // ok } } }
/** * Tests failure of conversion from Date type to Path type. */ public void testGetProperty() throws RepositoryException { if (!multiple) { try { prop.getProperty(); fail("Conversion from a Date value to a Path value " + "should throw a ValueFormatException."); } catch (ValueFormatException vfe) { //ok } } else { try { prop.getProperty(); fail("Property.getProperty() called on a multivalue property " + "should throw a ValueFormatException."); } catch (ValueFormatException vfe) { // ok } } }
/** * Tests failure of conversion from Boolean type to Path type. */ public void testGetProperty() throws RepositoryException { if (!multiple) { try { prop.getProperty(); fail("Conversion from a Boolean value to a Path value " + "should throw a ValueFormatException."); } catch (ValueFormatException vfe) { //ok } } else { try { prop.getProperty(); fail("Property.getProperty() called on a multivalue property " + "should throw a ValueFormatException."); } catch (ValueFormatException vfe) { // ok } } }
/** * Since JCR 2.0 a path property can be dereferenced if it points to a * Property. * TODO: create several tests out of this one */ public void testGetProperty() throws RepositoryException { if (!multiple) { String path = prop.getString(); if (prop.getParent().hasProperty(path)) { Property p = prop.getProperty(); assertEquals("The name of the dereferenced property must be equal to the value", path, p.getName()); } else { try { prop.getProperty(); fail("Calling Property.getProperty() for a NAME value that doesn't have a corresponding Node, ItemNotFoundException is expected"); } catch (ItemNotFoundException e) { // success. } } } else { try { prop.getProperty(); fail("Property.getNode() called on a multivalue property " + "should throw a ValueFormatException."); } catch (ValueFormatException vfe) { // ok } } } }
public Property getProperty() throws ItemNotFoundException, ValueFormatException, RepositoryException { return PropertyWrapper.wrap(getDelegate().getProperty(), getSessionWrapper()); }
public JcrProperty execute() throws Exception { return JcrProperty.Wrapper.wrap(getDelegate().getProperty(), getJcrSession()); } });
public Property getProperty() throws RepositoryException { Property property = this.item.getProperty(); return new PropertyProxy(property, new NodeProxy(property.getParent())); }
Property p = prop.getProperty(); assertEquals("The path of the dereferenced property must be equal to the value", path, p.getPath()); assertTrue("The property value must be resolved to the correct property.", prop.isSame(p)); p = prop.getProperty(); assertEquals("The path of the dereferenced property must be equal to the value", path, p.getName()); assertTrue("The property value must be resolved to the correct property.", prop.getParent().getProperty(path).isSame(p)); prop.getProperty(); fail("Calling Property.getProperty() for a PATH value that doesn't have a corresponding Property, ItemNotFoundException is expected"); } catch (ItemNotFoundException e) { prop.getProperty(); fail("Property.getNode() called on a multivalue property " + "should throw a ValueFormatException.");
@Test public void testPropertyReturnedFromPropertyIsWrapped() throws Exception { MockSession session = new MockSession("sessionName"); Node rootNode = session.getRootNode(); Node referredTo = rootNode.addNode("referredTo"); referredTo.setProperty("text", "<html/>"); Node referrer = rootNode.addNode("referrer"); referrer.setProperty("reference", "/referredTo/text"); // Reference to a property HTMLEscapingNodeWrapper wrapper = new HTMLEscapingNodeWrapper(referrer, false); Property property = wrapper.getProperty("reference").getProperty(); assertTrue(property instanceof HTMLEscapingPropertyWrapper); assertEquals("<html/>", property.getString()); }
@Test public void returnsWrappedPropertyGetPropertyFromProperty() throws Exception { // GIVEN MockSession session = new MockSession("blah"); Node node = session.getRootNode().addNode("foo"); ContentDecoratorNodeWrapper wrapped = new ContentDecoratorNodeWrapper(node, new ContentDecoratorSuperClass()); // WHEN Property test = wrapped.setProperty("test", "/foo/test"); // THEN assertEquals(wrapped.getProperty("test").getProperty(), test); }