use of org.apache.syncope.common.lib.SyncopeClientException in project syncope by apache.
the class PlainSchemaITCase method update.
@Test
public void update() {
PlainSchemaTO schemaTO = schemaService.read(SchemaType.PLAIN, "icon");
assertNotNull(schemaTO);
schemaService.update(SchemaType.PLAIN, schemaTO);
PlainSchemaTO updatedTO = schemaService.read(SchemaType.PLAIN, "icon");
assertEquals(schemaTO, updatedTO);
updatedTO.setType(AttrSchemaType.Date);
try {
schemaService.update(SchemaType.PLAIN, updatedTO);
fail("This should not be reacheable");
} catch (SyncopeClientException e) {
assertEquals(ClientExceptionType.InvalidPlainSchema, e.getType());
}
}
use of org.apache.syncope.common.lib.SyncopeClientException in project syncope by apache.
the class PlainSchemaITCase method issueSYNCOPE323.
@Test
public void issueSYNCOPE323() {
PlainSchemaTO actual = schemaService.read(SchemaType.PLAIN, "icon");
assertNotNull(actual);
try {
createSchema(SchemaType.PLAIN, actual);
fail("This should not happen");
} catch (SyncopeClientException e) {
assertEquals(Response.Status.CONFLICT, e.getType().getResponseStatus());
assertEquals(ClientExceptionType.EntityExists, e.getType());
}
actual.setKey(null);
try {
createSchema(SchemaType.PLAIN, actual);
fail("This should not happen");
} catch (SyncopeClientException e) {
assertEquals(Response.Status.BAD_REQUEST, e.getType().getResponseStatus());
assertEquals(ClientExceptionType.RequiredValuesMissing, e.getType());
}
}
use of org.apache.syncope.common.lib.SyncopeClientException in project syncope by apache.
the class PolicyITCase method buildPullPolicyTO.
private PullPolicyTO buildPullPolicyTO() throws IOException {
ImplementationTO corrRule = null;
try {
corrRule = implementationService.read(ImplementationType.PULL_CORRELATION_RULE, "TestPullRule");
} catch (SyncopeClientException e) {
if (e.getType().getResponseStatus() == Response.Status.NOT_FOUND) {
corrRule = new ImplementationTO();
corrRule.setKey("TestPullRule");
corrRule.setEngine(ImplementationEngine.GROOVY);
corrRule.setType(ImplementationType.PULL_CORRELATION_RULE);
corrRule.setBody(IOUtils.toString(getClass().getResourceAsStream("/TestPullRule.groovy"), StandardCharsets.UTF_8));
Response response = implementationService.create(corrRule);
corrRule = implementationService.read(corrRule.getType(), response.getHeaderString(RESTHeaders.RESOURCE_KEY));
assertNotNull(corrRule);
}
}
assertNotNull(corrRule);
PullPolicyTO policy = new PullPolicyTO();
policy.getCorrelationRules().put(AnyTypeKind.USER.name(), corrRule.getKey());
policy.setDescription("Pull policy");
return policy;
}
use of org.apache.syncope.common.lib.SyncopeClientException in project syncope by apache.
the class PolicyITCase method delete.
@Test
public void delete() throws IOException {
PullPolicyTO policy = buildPullPolicyTO();
PullPolicyTO policyTO = createPolicy(PolicyType.PULL, policy);
assertNotNull(policyTO);
policyService.delete(PolicyType.PULL, policyTO.getKey());
try {
policyService.read(PolicyType.PULL, policyTO.getKey());
fail("This should not happen");
} catch (SyncopeClientException e) {
assertNotNull(e);
}
}
use of org.apache.syncope.common.lib.SyncopeClientException in project syncope by apache.
the class PullTaskITCase method testPullActionsSetup.
@BeforeAll
public static void testPullActionsSetup() {
ImplementationTO pullActions = null;
try {
pullActions = implementationService.read(ImplementationType.PULL_ACTIONS, TestPullActions.class.getSimpleName());
} catch (SyncopeClientException e) {
if (e.getType().getResponseStatus() == Response.Status.NOT_FOUND) {
pullActions = new ImplementationTO();
pullActions.setKey(TestPullActions.class.getSimpleName());
pullActions.setEngine(ImplementationEngine.JAVA);
pullActions.setType(ImplementationType.PULL_ACTIONS);
pullActions.setBody(TestPullActions.class.getName());
Response response = implementationService.create(pullActions);
pullActions = implementationService.read(pullActions.getType(), response.getHeaderString(RESTHeaders.RESOURCE_KEY));
assertNotNull(pullActions);
}
}
assertNotNull(pullActions);
PullTaskTO pullTask = taskService.read(TaskType.PULL, PULL_TASK_KEY, true);
pullTask.getActions().add(pullActions.getKey());
taskService.update(TaskType.PULL, pullTask);
}
Aggregations