public void testMixins() throws Exception {
this.rootNode.getSession().refresh(false);
final Node testNode = this.rootNode.addNode("testMixins" + System.currentTimeMillis());
testNode.getSession().save();
final PersistableValueMap pvm = new JcrModifiablePropertyMap(testNode);
final String[] types = pvm.get("jcr:mixinTypes", String[].class);
final Set<String> exNodeTypes = getMixinNodeTypes(testNode);
assertEquals(exNodeTypes.size(), (types == null ? 0 : types.length));
if ( types != null ) {
for(final String name : types) {
assertTrue(exNodeTypes.contains(name));
}
String[] newTypes = new String[types.length + 1];
System.arraycopy(types, 0, newTypes, 0, types.length);
newTypes[types.length] = "mix:referenceable";
pvm.put("jcr:mixinTypes", newTypes);
} else {
pvm.put("jcr:mixinTypes", "mix:referenceable");
}
pvm.save();
final Set<String> newNodeTypes = getMixinNodeTypes(testNode);
assertEquals(newNodeTypes.size(), exNodeTypes.size() + 1);
}