Search in sources :

Example 91 with QValue

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

the class QValueTest method testReferenceValueType.

public void testReferenceValueType() throws RepositoryException {
    QValue v = factory.create(REFERENCE, PropertyType.REFERENCE);
    assertTrue("Type of a date value must be PropertyType.REFERENCE.", v.getType() == PropertyType.REFERENCE);
}
Also used : QValue(org.apache.jackrabbit.spi.QValue)

Example 92 with QValue

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

the class QValueTest method testEqualityDifferentTypes3.

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

Example 93 with QValue

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

the class QValueTest method testUriValueEquality.

public void testUriValueEquality() throws RepositoryException, URISyntaxException {
    QValue v = factory.create(URI_STRING, PropertyType.URI);
    QValue otherV = factory.create(URI_STRING, PropertyType.URI);
    assertEquals("Uri values created from the same string must be equal.", v, otherV);
    URI uri = new URI(URI_STRING);
    v = factory.create(uri);
    assertEquals("Uri values created from the same string must be equal.", v, otherV);
}
Also used : QValue(org.apache.jackrabbit.spi.QValue) URI(java.net.URI)

Example 94 with QValue

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

the class QValueTest method testGetLongOnBooleanValue.

public void testGetLongOnBooleanValue() throws RepositoryException {
    try {
        QValue v = factory.create(true);
        v.getLong();
        fail("'true' cannot be converted to a valid long value.");
    } catch (ValueFormatException e) {
    // ok
    }
}
Also used : QValue(org.apache.jackrabbit.spi.QValue) ValueFormatException(javax.jcr.ValueFormatException)

Example 95 with QValue

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

the class ValueFormatTest method testGetPathQValue.

/**
     * Path values must never be normalized.
     *
     * @throws RepositoryException
     */
public void testGetPathQValue() throws RepositoryException {
    List<String> l = new ArrayList<String>();
    // a non-normalized absolute path
    l.add("/a/.././b/c/.");
    // an identifier based path
    l.add("[" + UUID.randomUUID().toString() + "]");
    for (String jcrPath : l) {
        QValue qv = ValueFormat.getQValue(jcrPath, PropertyType.PATH, resolver, qvFactory);
        assertFalse(qv.getPath().isNormalized());
        assertEquals("Path values must not be normalized", jcrPath, ValueFormat.getJCRValue(qv, resolver, vFactory).getString());
    }
}
Also used : QValue(org.apache.jackrabbit.spi.QValue) ArrayList(java.util.ArrayList)

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