use of org.apache.syncope.core.persistence.api.entity.PlainSchema in project syncope by apache.
the class PlainSchemaTest method checkIdUniqueness.
@Test
public void checkIdUniqueness() {
assertNotNull(derSchemaDAO.find("cn"));
PlainSchema schema = entityFactory.newEntity(PlainSchema.class);
schema.setKey("cn");
schema.setType(AttrSchemaType.String);
plainSchemaDAO.save(schema);
try {
plainSchemaDAO.flush();
fail("This should not happen");
} catch (Exception e) {
assertTrue(e instanceof EntityExistsException);
}
}
use of org.apache.syncope.core.persistence.api.entity.PlainSchema in project syncope by apache.
the class PlainSchemaTest method delete.
@Test
public void delete() {
PlainSchema firstname = plainSchemaDAO.find("firstname");
plainSchemaDAO.delete(firstname.getKey());
PlainSchema actual = plainSchemaDAO.find("firstname");
assertNull(actual);
}
use of org.apache.syncope.core.persistence.api.entity.PlainSchema in project syncope by apache.
the class PlainSchemaTest method findByName.
@Test
public void findByName() {
PlainSchema schema = plainSchemaDAO.find("fullname");
assertNotNull(schema);
}
use of org.apache.syncope.core.persistence.api.entity.PlainSchema in project syncope by apache.
the class PlainSchemaTest method saveNonValid.
@Test
public void saveNonValid() {
assertThrows(InvalidEntityException.class, () -> {
PlainSchema schema = entityFactory.newEntity(PlainSchema.class);
schema.setKey("secondaryEmail");
schema.setType(AttrSchemaType.String);
schema.setValidator(implementationDAO.find("EmailAddressValidator"));
schema.setMandatoryCondition("false");
schema.setMultivalue(true);
schema.setUniqueConstraint(true);
plainSchemaDAO.save(schema);
});
}
use of org.apache.syncope.core.persistence.api.entity.PlainSchema in project syncope by apache.
the class PlainSchemaTest method save.
@Test
public void save() {
PlainSchema schema = entityFactory.newEntity(PlainSchema.class);
schema.setKey("secondaryEmail");
schema.setType(AttrSchemaType.String);
schema.setValidator(implementationDAO.find("EmailAddressValidator"));
schema.setMandatoryCondition("false");
schema.setMultivalue(true);
plainSchemaDAO.save(schema);
PlainSchema actual = plainSchemaDAO.find("secondaryEmail");
assertNotNull(actual);
assertEquals(schema, actual);
}
Aggregations