use of org.apache.syncope.common.lib.to.PlainSchemaTO in project syncope by apache.
the class PlainSchemaITCase method issue258.
@Test
public void issue258() {
PlainSchemaTO schemaTO = new PlainSchemaTO();
schemaTO.setKey("schema_issue258");
schemaTO.setType(AttrSchemaType.Double);
schemaTO = createSchema(SchemaType.PLAIN, schemaTO);
assertNotNull(schemaTO);
AnyTypeClassTO typeClass = new AnyTypeClassTO();
typeClass.setKey("issue258");
typeClass.getPlainSchemas().add(schemaTO.getKey());
anyTypeClassService.create(typeClass);
UserTO userTO = UserITCase.getUniqueSampleTO("issue258@syncope.apache.org");
userTO.getAuxClasses().add(typeClass.getKey());
userTO.getPlainAttrs().add(attrTO(schemaTO.getKey(), "1.2"));
userTO = createUser(userTO).getEntity();
assertNotNull(userTO);
schemaTO.setType(AttrSchemaType.Long);
try {
schemaService.update(SchemaType.PLAIN, schemaTO);
fail("This should not be reacheable");
} catch (SyncopeClientException e) {
assertEquals(ClientExceptionType.InvalidPlainSchema, e.getType());
}
}
use of org.apache.syncope.common.lib.to.PlainSchemaTO in project syncope by apache.
the class PlainSchemaITCase method createREnumWithoutEnumeration.
@Test
public void createREnumWithoutEnumeration() {
PlainSchemaTO schemaTO = new PlainSchemaTO();
schemaTO.setKey("enumcheck");
schemaTO.setType(AttrSchemaType.Enum);
try {
createSchema(SchemaType.PLAIN, schemaTO);
fail("This should not be reacheable");
} catch (SyncopeClientException e) {
assertEquals(ClientExceptionType.InvalidPlainSchema, e.getType());
assertTrue(e.getElements().iterator().next().contains(EntityViolationType.InvalidSchemaEnum.name()));
}
}
use of org.apache.syncope.common.lib.to.PlainSchemaTO in project syncope by apache.
the class PlainSchemaITCase method buildPlainSchemaTO.
private PlainSchemaTO buildPlainSchemaTO(final String name, final AttrSchemaType type) {
PlainSchemaTO schemaTO = new PlainSchemaTO();
schemaTO.setKey(name + getUUIDString());
schemaTO.setType(type);
return schemaTO;
}
use of org.apache.syncope.common.lib.to.PlainSchemaTO in project syncope by apache.
the class PlainSchemaITCase method create.
@Test
public void create() {
PlainSchemaTO schemaTO = buildPlainSchemaTO("testAttribute", AttrSchemaType.String);
schemaTO.setMandatoryCondition("false");
PlainSchemaTO newPlainSchemaTO = createSchema(SchemaType.PLAIN, schemaTO);
assertEquals(schemaTO, newPlainSchemaTO);
try {
createSchema(SchemaType.PLAIN, schemaTO);
fail("This should not happen");
} catch (SyncopeClientException e) {
assertEquals(ClientExceptionType.EntityExists, e.getType());
}
}
use of org.apache.syncope.common.lib.to.PlainSchemaTO in project syncope by apache.
the class PlainSchemaITCase method issue260.
@Test
public void issue260() {
PlainSchemaTO schemaTO = buildPlainSchemaTO("schema_issue260", AttrSchemaType.Double);
schemaTO.setUniqueConstraint(true);
schemaTO = createSchema(SchemaType.PLAIN, schemaTO);
assertNotNull(schemaTO);
AnyTypeClassTO typeClass = new AnyTypeClassTO();
typeClass.setKey("issue260");
typeClass.getPlainSchemas().add(schemaTO.getKey());
anyTypeClassService.create(typeClass);
UserTO userTO = UserITCase.getUniqueSampleTO("issue260@syncope.apache.org");
userTO.getAuxClasses().add(typeClass.getKey());
userTO.getPlainAttrs().add(attrTO(schemaTO.getKey(), "1.2"));
userTO = createUser(userTO).getEntity();
assertNotNull(userTO);
schemaTO.setUniqueConstraint(false);
try {
schemaService.update(SchemaType.PLAIN, schemaTO);
fail("This should not be reacheable");
} catch (SyncopeClientException e) {
assertEquals(ClientExceptionType.InvalidPlainSchema, e.getType());
}
}
Aggregations