use of org.apache.jackrabbit.spi.QValue in project jackrabbit by apache.
the class DateConstraintTest method createNonMatchingValues.
protected QValue[] createNonMatchingValues() throws RepositoryException {
Calendar cd = Calendar.getInstance();
cd.setTimeInMillis(997);
return new QValue[] { valueFactory.create(cd) };
}
use of org.apache.jackrabbit.spi.QValue in project jackrabbit by apache.
the class ValueConstraintTest method testCheckWrongValueType.
public void testCheckWrongValueType() throws RepositoryException {
QValue val = createOtherValueType();
String[] qDefs = getQDefinitions();
for (int i = 0; i < qDefs.length; i++) {
ValueConstraint vc = createValueConstraint(qDefs[i]);
try {
vc.check(val);
fail("ValueConstraint.check() with non-matching value should throw ConstraintViolationException.");
} catch (RepositoryException e) {
//ok
}
}
}
use of org.apache.jackrabbit.spi.QValue in project jackrabbit by apache.
the class ValueFormatTest method testDecimal.
public void testDecimal() throws RepositoryException {
BigDecimal bd = new BigDecimal(Double.MIN_VALUE);
Value v = vFactory.createValue(bd);
QValue qv = qvFactory.create(bd);
assertEquals(v, ValueFormat.getJCRValue(qv, resolver, vFactory));
assertEquals(qv, ValueFormat.getQValue(v, resolver, qvFactory));
}
use of org.apache.jackrabbit.spi.QValue in project jackrabbit by apache.
the class QValueTest method testNameValueType.
public void testNameValueType() throws IOException, RepositoryException {
QValue v = factory.create(NameConstants.JCR_DATA);
assertTrue(v.getType() == PropertyType.NAME);
v = factory.create(NameConstants.JCR_DATA.toString(), PropertyType.NAME);
assertTrue(v.getType() == PropertyType.NAME);
}
use of org.apache.jackrabbit.spi.QValue in project jackrabbit by apache.
the class QValueTest method testBinaryFromInputStream.
public void testBinaryFromInputStream() throws RepositoryException, IOException {
InputStream in = new ByteArrayInputStream(new byte[] { 'a', 'b', 'c' });
QValue v = factory.create(in);
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()));
}
Aggregations