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);
}
Aggregations