use of org.apache.syncope.common.lib.to.AnyObjectTO in project syncope by apache.
the class AnyObjectITCase method delete.
@Test
public void delete() {
try {
anyObjectService.delete(UUID.randomUUID().toString());
} catch (SyncopeClientException e) {
assertEquals(Response.Status.NOT_FOUND, e.getType().getResponseStatus());
}
AnyObjectTO anyObjectTO = getSampleTO("deletable");
anyObjectTO.setRealm("/even");
anyObjectTO = createAnyObject(anyObjectTO).getEntity();
assertNotNull(anyObjectTO);
AnyObjectTO deletedAnyObject = deleteAnyObject(anyObjectTO.getKey()).getEntity();
assertNotNull(deletedAnyObject);
try {
anyObjectService.read(deletedAnyObject.getKey());
} catch (SyncopeClientException e) {
assertEquals(Response.Status.NOT_FOUND, e.getType().getResponseStatus());
}
}
use of org.apache.syncope.common.lib.to.AnyObjectTO in project syncope by apache.
the class AnyObjectITCase method readAttrs.
@Test
public void readAttrs() {
AnyObjectTO anyObjectTO = getSampleTO("readAttrs");
anyObjectTO = createAnyObject(anyObjectTO).getEntity();
assertNotNull(anyObjectTO);
Set<AttrTO> attrs = anyObjectService.read(anyObjectTO.getKey(), SchemaType.PLAIN);
assertEquals(anyObjectTO.getPlainAttrs(), attrs);
AttrTO location = anyObjectService.read(anyObjectTO.getKey(), SchemaType.PLAIN, "location");
assertEquals(anyObjectTO.getPlainAttr("location").get(), location);
}
use of org.apache.syncope.common.lib.to.AnyObjectTO in project syncope by apache.
the class AnyObjectITCase method getSampleTO.
public static AnyObjectTO getSampleTO(final String location) {
AnyObjectTO anyObjectTO = new AnyObjectTO();
anyObjectTO.setName(location + getUUIDString());
anyObjectTO.setRealm(SyncopeConstants.ROOT_REALM);
anyObjectTO.setType("PRINTER");
anyObjectTO.getPlainAttrs().add(attrTO("location", location + getUUIDString()));
anyObjectTO.getResources().add(RESOURCE_NAME_DBSCRIPTED);
return anyObjectTO;
}
use of org.apache.syncope.common.lib.to.AnyObjectTO in project syncope by apache.
the class AnyObjectITCase method updateAttr.
@Test
public void updateAttr() {
AnyObjectTO anyObjectTO = getSampleTO("updateAttr");
anyObjectTO = createAnyObject(anyObjectTO).getEntity();
assertNotNull(anyObjectTO);
AttrTO updated = attrTO("location", "newlocation");
anyObjectService.update(anyObjectTO.getKey(), SchemaType.PLAIN, updated);
AttrTO location = anyObjectService.read(anyObjectTO.getKey(), SchemaType.PLAIN, "location");
// need to remove schemaInfo which is included when reading the any object
location.setSchemaInfo(null);
assertEquals(updated, location);
}
use of org.apache.syncope.common.lib.to.AnyObjectTO in project syncope by apache.
the class AnyObjectITCase method read.
@Test
public void read() {
AnyObjectTO anyObjectTO = anyObjectService.read("fc6dbc3a-6c07-4965-8781-921e7401a4a5");
assertNotNull(anyObjectTO);
assertNotNull(anyObjectTO.getPlainAttrs());
assertFalse(anyObjectTO.getPlainAttrs().isEmpty());
}
Aggregations