Search in sources :

Example 96 with QValue

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

the class QValueTest method testPathValueEquality.

public void testPathValueEquality() throws IOException, RepositoryException {
    QValue v = factory.create(ROOT_PATH);
    QValue v2 = factory.create(ROOT_PATH.toString(), PropertyType.PATH);
    assertTrue(v.equals(v2));
}
Also used : QValue(org.apache.jackrabbit.spi.QValue)

Example 97 with QValue

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

the class QValueTest method testDateValueEquality.

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

Example 98 with QValue

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

the class QValueTest method testDateValueStringRepresentation.

public void testDateValueStringRepresentation() throws RepositoryException {
    QValue v = factory.create(CALENDAR);
    String s = ISO8601.format(CALENDAR);
    assertEquals("Expected String representation of date value to be ISO8601 compliant.", s, v.getString());
}
Also used : QValue(org.apache.jackrabbit.spi.QValue)

Example 99 with QValue

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

the class QValueTest method testReferenceValueEquality.

public void testReferenceValueEquality() throws RepositoryException {
    QValue v = factory.create(REFERENCE, PropertyType.REFERENCE);
    QValue otherV = factory.create(REFERENCE, PropertyType.REFERENCE);
    assertEquals("Reference values created from the same string must be equal.", v, otherV);
}
Also used : QValue(org.apache.jackrabbit.spi.QValue)

Example 100 with QValue

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

the class QValueTest method testBinaryFromFile.

public void testBinaryFromFile() throws RepositoryException, IOException {
    File f = File.createTempFile("QValueFactoryImplTest", ".txt");
    f.deleteOnExit();
    FileWriter fw = new FileWriter(f);
    fw.write("abc");
    fw.close();
    QValue v = factory.create(f);
    assertEquals(PropertyType.BINARY, v.getType());
    assertEquals(3, v.getLength());
    assertEquals("abc", v.getString());
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    spool(out, v.getStream());
    assertEquals("abc", new String(out.toByteArray()));
}
Also used : QValue(org.apache.jackrabbit.spi.QValue) FileWriter(java.io.FileWriter) ByteArrayOutputStream(java.io.ByteArrayOutputStream) File(java.io.File)

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