Search in sources :

Example 31 with ConnObjectTO

use of org.apache.syncope.common.lib.to.ConnObjectTO in project syncope by apache.

the class JSONTest method provisioningResult.

@Test
public void provisioningResult() throws IOException {
    GroupTO group = new GroupTO();
    group.setName(UUID.randomUUID().toString());
    group.setRealm(SyncopeConstants.ROOT_REALM);
    group.getVirAttrs().add(new AttrTO.Builder().schema("rvirtualdata").value("rvirtualvalue").build());
    group.getADynMembershipConds().put("USER", "username==a*");
    ProvisioningResult<GroupTO> original = new ProvisioningResult<>();
    original.setEntity(group);
    PropagationStatus status = new PropagationStatus();
    status.setFailureReason("failed");
    status.setBeforeObj(new ConnObjectTO());
    original.getPropagationStatuses().add(status);
    ObjectMapper mapper = new ObjectMapper();
    StringWriter writer = new StringWriter();
    mapper.writeValue(writer, original);
    ProvisioningResult<GroupTO> actual = mapper.readValue(writer.toString(), new TypeReference<ProvisioningResult<GroupTO>>() {
    });
    assertEquals(original, actual);
}
Also used : StringWriter(java.io.StringWriter) ProvisioningResult(org.apache.syncope.common.lib.to.ProvisioningResult) PropagationStatus(org.apache.syncope.common.lib.to.PropagationStatus) ConnObjectTO(org.apache.syncope.common.lib.to.ConnObjectTO) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) GroupTO(org.apache.syncope.common.lib.to.GroupTO) Test(org.junit.jupiter.api.Test)

Aggregations

ConnObjectTO (org.apache.syncope.common.lib.to.ConnObjectTO)31 Test (org.junit.jupiter.api.Test)24 UserTO (org.apache.syncope.common.lib.to.UserTO)20 ResourceTO (org.apache.syncope.common.lib.to.ResourceTO)11 SyncopeClientException (org.apache.syncope.common.lib.SyncopeClientException)9 UserPatch (org.apache.syncope.common.lib.patch.UserPatch)9 GroupTO (org.apache.syncope.common.lib.to.GroupTO)9 ArrayList (java.util.ArrayList)8 ProvisioningResult (org.apache.syncope.common.lib.to.ProvisioningResult)8 MembershipTO (org.apache.syncope.common.lib.to.MembershipTO)7 Response (javax.ws.rs.core.Response)6 AttrTO (org.apache.syncope.common.lib.to.AttrTO)6 PasswordPatch (org.apache.syncope.common.lib.patch.PasswordPatch)5 List (java.util.List)4 Optional (java.util.Optional)4 ImplementationTO (org.apache.syncope.common.lib.to.ImplementationTO)4 PropagationStatus (org.apache.syncope.common.lib.to.PropagationStatus)4 IOException (java.io.IOException)3 Map (java.util.Map)3 Set (java.util.Set)3