use of org.apache.jackrabbit.oak.spi.xml.PropInfo in project jackrabbit-oak by apache.
the class UserImporterPasswordTreeTest method testInvalidPropName.
@Test
public void testInvalidPropName() throws Exception {
PropInfo propInfo = createPropInfo(null, "value");
PropertyDefinition propDef = when(mock(PropertyDefinition.class).getName()).thenReturn(null).getMock();
assertFalse(importer.handlePropInfo(pwTree, propInfo, propDef));
}
use of org.apache.jackrabbit.oak.spi.xml.PropInfo in project jackrabbit-oak by apache.
the class UserImporterPasswordTreeTest method testLastModifiedWithRequiredType.
@Test
public void testLastModifiedWithRequiredType() throws Exception {
PropInfo propInfo = createPropInfo(REP_PASSWORD_LAST_MODIFIED, "23000");
PropertyDefinition propDef = when(mock(PropertyDefinition.class).getRequiredType()).thenReturn(PropertyType.LONG).getMock();
when(propDef.isMultiple()).thenReturn(true);
assertTrue(importer.handlePropInfo(pwTree, propInfo, propDef));
PropertyState ps = pwTree.getProperty(REP_PASSWORD_LAST_MODIFIED);
assertNotNull(ps);
assertSame(Type.LONGS, ps.getType());
assertEquals(1, ps.count());
assertEquals(23000, ps.getValue(Type.LONG, 0).longValue());
}
use of org.apache.jackrabbit.oak.spi.xml.PropInfo in project jackrabbit-oak by apache.
the class UserImporterPasswordTreeTest method testAnyPropNameUndefinedRequiredType.
@Test
public void testAnyPropNameUndefinedRequiredType() throws Exception {
PropInfo propInfo = createPropInfo("any", "value");
PropertyDefinition propDef = when(mock(PropertyDefinition.class).getRequiredType()).thenReturn(PropertyType.UNDEFINED).getMock();
when(propDef.isMultiple()).thenReturn(true);
assertTrue(importer.handlePropInfo(pwTree, propInfo, propDef));
PropertyState ps = pwTree.getProperty("any");
assertNotNull(ps);
assertSame(Type.STRINGS, ps.getType());
assertTrue(ps.isArray());
assertEquals("value", ps.getValue(Type.STRING, 0));
}
use of org.apache.jackrabbit.oak.spi.xml.PropInfo in project jackrabbit-oak by apache.
the class UserImporterPasswordTreeTest method testAnyPropNameWithRequiredType.
@Test
public void testAnyPropNameWithRequiredType() throws Exception {
PropInfo propInfo = createPropInfo("any", "true");
PropertyDefinition propDef = when(mock(PropertyDefinition.class).getRequiredType()).thenReturn(PropertyType.BOOLEAN).getMock();
when(propDef.isMultiple()).thenReturn(false);
assertTrue(importer.handlePropInfo(pwTree, propInfo, propDef));
PropertyState ps = pwTree.getProperty("any");
assertNotNull(ps);
assertSame(Type.BOOLEAN, ps.getType());
assertTrue(ps.getValue(Type.BOOLEAN));
}
use of org.apache.jackrabbit.oak.spi.xml.PropInfo in project jackrabbit-oak by apache.
the class UserImporterPasswordTreeTest method testLastModifiedUndefinedRequiredType.
@Test
public void testLastModifiedUndefinedRequiredType() throws Exception {
PropInfo propInfo = createPropInfo(REP_PASSWORD_LAST_MODIFIED, "23000");
PropertyDefinition propDef = when(mock(PropertyDefinition.class).getRequiredType()).thenReturn(PropertyType.UNDEFINED).getMock();
when(propDef.isMultiple()).thenReturn(false);
assertTrue(importer.handlePropInfo(pwTree, propInfo, propDef));
PropertyState ps = pwTree.getProperty(REP_PASSWORD_LAST_MODIFIED);
assertNotNull(ps);
assertSame(Type.LONG, ps.getType());
assertEquals(23000, ps.getValue(Type.LONG).longValue());
assertFalse(ps.isArray());
}
Aggregations