use of org.apache.jackrabbit.spi.QValue in project jackrabbit by apache.
the class QValueTest method testUriValueType.
public void testUriValueType() throws RepositoryException, URISyntaxException {
QValue v = factory.create(URI_STRING, PropertyType.URI);
assertTrue("Type of a date value must be PropertyType.URI.", v.getType() == PropertyType.URI);
}
use of org.apache.jackrabbit.spi.QValue in project jackrabbit by apache.
the class QValueTest method testCreateTrueBooleanValue.
public void testCreateTrueBooleanValue() throws RepositoryException {
QValue v = factory.create(true);
assertEquals("Boolean value must be true", Boolean.TRUE.toString(), v.getString());
assertEquals("Boolean value must be true", true, v.getBoolean());
}
use of org.apache.jackrabbit.spi.QValue in project jackrabbit by apache.
the class QValueTest method testEmptyBinaryFromInputStream.
public void testEmptyBinaryFromInputStream() throws RepositoryException, IOException {
InputStream in = new ByteArrayInputStream(new byte[0]);
QValue v = factory.create(in);
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()));
}
use of org.apache.jackrabbit.spi.QValue in project jackrabbit by apache.
the class QValueTest method testCreateFalseBooleanValue.
public void testCreateFalseBooleanValue() throws RepositoryException {
QValue v = factory.create(false);
assertEquals("Boolean value must be false", Boolean.FALSE.toString(), v.getString());
assertEquals("Boolean value must be false", false, v.getBoolean());
}
use of org.apache.jackrabbit.spi.QValue in project jackrabbit by apache.
the class NodeState method getAllNodeTypeNames.
/**
* TODO: clarify usage
* In case the status of the given node state is not {@link Status#EXISTING}
* the transiently added mixin types are taken into account as well.
*
* @return
*/
public synchronized Name[] getAllNodeTypeNames() {
Name[] allNtNames;
if (getStatus() == Status.EXISTING) {
allNtNames = getNodeTypeNames();
} else {
// TODO: check if correct (and only used for creating new)
Name primaryType = getNodeTypeName();
// default
allNtNames = new Name[] { primaryType };
try {
PropertyEntry pe = getNodeEntry().getPropertyEntry(NameConstants.JCR_MIXINTYPES, true);
if (pe != null) {
PropertyState mixins = pe.getPropertyState();
QValue[] values = mixins.getValues();
allNtNames = new Name[values.length + 1];
for (int i = 0; i < values.length; i++) {
allNtNames[i] = values[i].getName();
}
allNtNames[values.length] = primaryType;
}
// else: no jcr:mixinTypes property exists -> ignore
} catch (RepositoryException e) {
// unexpected error: ignore
}
}
return allNtNames;
}
Aggregations