Search in sources :

Example 36 with QValue

use of org.apache.jackrabbit.spi.QValue in project jackrabbit by apache.

the class QValueTest method testDateValueEquality2.

public void testDateValueEquality2() throws RepositoryException {
    QValue v = factory.create(CALENDAR);
    QValue otherV = factory.create(v.getString(), PropertyType.DATE);
    assertEquals("Equality of date value must be calculated based on their String representation.", v, otherV);
}
Also used : QValue(org.apache.jackrabbit.spi.QValue)

Example 37 with QValue

use of org.apache.jackrabbit.spi.QValue in project jackrabbit by apache.

the class QValueTest method testEmptyBinaryFromByteArray.

public void testEmptyBinaryFromByteArray() throws RepositoryException, IOException {
    QValue v = factory.create(new byte[0]);
    assertEquals(PropertyType.BINARY, v.getType());
    assertEquals(0, v.getLength());
    assertEquals("", v.getString());
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    spool(out, v.getStream());
    assertEquals("", new String(out.toByteArray()));
}
Also used : QValue(org.apache.jackrabbit.spi.QValue) ByteArrayOutputStream(java.io.ByteArrayOutputStream)

Example 38 with QValue

use of org.apache.jackrabbit.spi.QValue in project jackrabbit by apache.

the class QValueTest method testEqualityDifferentTypes2.

public void testEqualityDifferentTypes2() throws RepositoryException {
    QValue v = factory.create(REFERENCE, PropertyType.WEAKREFERENCE);
    QValue v2 = factory.create(REFERENCE, PropertyType.STRING);
    assertFalse(v.equals(v2));
}
Also used : QValue(org.apache.jackrabbit.spi.QValue)

Example 39 with QValue

use of org.apache.jackrabbit.spi.QValue in project jackrabbit by apache.

the class QValueTest method testCreateTrueFromString.

public void testCreateTrueFromString() throws ValueFormatException, RepositoryException {
    QValue v = factory.create(Boolean.TRUE.toString(), PropertyType.STRING);
    assertEquals("Boolean value must be true", true, v.getBoolean());
}
Also used : QValue(org.apache.jackrabbit.spi.QValue)

Example 40 with QValue

use of org.apache.jackrabbit.spi.QValue in project jackrabbit by apache.

the class PathConstraintTest method createNonMatchingValues.

protected QValue[] createNonMatchingValues() throws RepositoryException {
    QValue root = valueFactory.create(resolver.getQPath("/"));
    QValue abs = valueFactory.create(resolver.getQPath("/uvw/xyz"));
    QValue rel = valueFactory.create(resolver.getQPath("uvw/xyz"));
    return new QValue[] { abs, abs, rel, root, abs };
}
Also used : QValue(org.apache.jackrabbit.spi.QValue)

Aggregations

QValue (org.apache.jackrabbit.spi.QValue)125 Name (org.apache.jackrabbit.spi.Name)40 RepositoryException (javax.jcr.RepositoryException)23 Value (javax.jcr.Value)21 NodeId (org.apache.jackrabbit.spi.NodeId)21 Batch (org.apache.jackrabbit.spi.Batch)19 PropertyInfo (org.apache.jackrabbit.spi.PropertyInfo)18 QPropertyDefinition (org.apache.jackrabbit.spi.QPropertyDefinition)12 IOException (java.io.IOException)9 ArrayList (java.util.ArrayList)9 ByteArrayOutputStream (java.io.ByteArrayOutputStream)8 ValueFormatException (javax.jcr.ValueFormatException)8 Path (org.apache.jackrabbit.spi.Path)8 QValueConstraint (org.apache.jackrabbit.spi.QValueConstraint)8 HashMap (java.util.HashMap)7 ValueConstraint (org.apache.jackrabbit.spi.commons.nodetype.constraint.ValueConstraint)7 InputStream (java.io.InputStream)5 Node (javax.jcr.Node)5 ConstraintViolationException (javax.jcr.nodetype.ConstraintViolationException)5 PropertyId (org.apache.jackrabbit.spi.PropertyId)5