Search in sources :

Example 21 with AnyObjectTO

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());
    }
}
Also used : AnyObjectTO(org.apache.syncope.common.lib.to.AnyObjectTO) SyncopeClientException(org.apache.syncope.common.lib.SyncopeClientException) Test(org.junit.jupiter.api.Test)

Example 22 with AnyObjectTO

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);
}
Also used : AnyObjectTO(org.apache.syncope.common.lib.to.AnyObjectTO) AttrTO(org.apache.syncope.common.lib.to.AttrTO) Test(org.junit.jupiter.api.Test)

Example 23 with AnyObjectTO

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;
}
Also used : AnyObjectTO(org.apache.syncope.common.lib.to.AnyObjectTO)

Example 24 with 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);
}
Also used : AnyObjectTO(org.apache.syncope.common.lib.to.AnyObjectTO) AttrTO(org.apache.syncope.common.lib.to.AttrTO) Test(org.junit.jupiter.api.Test)

Example 25 with AnyObjectTO

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());
}
Also used : AnyObjectTO(org.apache.syncope.common.lib.to.AnyObjectTO) Test(org.junit.jupiter.api.Test)

Aggregations

AnyObjectTO (org.apache.syncope.common.lib.to.AnyObjectTO)45 Test (org.junit.jupiter.api.Test)19 GroupTO (org.apache.syncope.common.lib.to.GroupTO)14 UserTO (org.apache.syncope.common.lib.to.UserTO)14 AnyObjectPatch (org.apache.syncope.common.lib.patch.AnyObjectPatch)13 AttrTO (org.apache.syncope.common.lib.to.AttrTO)10 List (java.util.List)9 SyncopeClientException (org.apache.syncope.common.lib.SyncopeClientException)8 MembershipTO (org.apache.syncope.common.lib.to.MembershipTO)8 Map (java.util.Map)7 Pair (org.apache.commons.lang3.tuple.Pair)6 AnyTO (org.apache.syncope.common.lib.to.AnyTO)6 ProvisioningResult (org.apache.syncope.common.lib.to.ProvisioningResult)6 Optional (java.util.Optional)5 Set (java.util.Set)5 ConnObjectTO (org.apache.syncope.common.lib.to.ConnObjectTO)5 AnyQuery (org.apache.syncope.common.rest.api.beans.AnyQuery)5 User (org.apache.syncope.core.persistence.api.entity.user.User)5 ArrayList (java.util.ArrayList)4 Response (javax.ws.rs.core.Response)4