Package org.apache.syncope.common.to

Examples of org.apache.syncope.common.to.SchemaTO


        createSchema(AttributableType.MEMBERSHIP, SchemaType.NORMAL, schemaTO);
    }

    @Test
    public void createBinary() {
        SchemaTO schemaTO = new SchemaTO();
        schemaTO.setName("x509certificate");
        schemaTO.setType(AttributeSchemaType.Binary);
        schemaTO.setMimeType("application/x-x509-ca-cert");

        createSchema(AttributableType.ROLE, SchemaType.NORMAL, schemaTO);
    }
View Full Code Here


        createSchema(AttributableType.ROLE, SchemaType.NORMAL, schemaTO);
    }

    @Test
    public void delete() {
        SchemaTO schemaTO = buildSchemaTO("todelete", AttributeSchemaType.String);
        schemaTO.setMandatoryCondition("false");
        createSchema(AttributableType.USER, SchemaType.NORMAL, schemaTO);

        schemaService.delete(AttributableType.USER, SchemaType.NORMAL, schemaTO.getName());
        SchemaTO firstname = null;
        try {
            firstname = schemaService.read(AttributableType.USER, SchemaType.NORMAL, schemaTO.getName());
        } catch (SyncopeClientException e) {
            assertEquals(Response.Status.NOT_FOUND, e.getType().getResponseStatus());
        }
View Full Code Here

        }
    }

    @Test
    public void update() {
        SchemaTO schemaTO = schemaService.read(AttributableType.ROLE, SchemaType.NORMAL, "icon");
        assertNotNull(schemaTO);

        schemaService.update(AttributableType.ROLE, SchemaType.NORMAL, schemaTO.getName(), schemaTO);
        SchemaTO updatedTO = schemaService.read(AttributableType.ROLE, SchemaType.NORMAL, "icon");
        assertEquals(schemaTO, updatedTO);

        updatedTO.setType(AttributeSchemaType.Date);
        try {
            schemaService.update(AttributableType.ROLE, SchemaType.NORMAL, schemaTO.getName(), updatedTO);
            fail("This should not be reacheable");
        } catch (SyncopeClientException e) {
            assertEquals(ClientExceptionType.InvalidRSchema, e.getType());
View Full Code Here

        }
    }

    @Test
    public void issue258() {
        SchemaTO schemaTO = new SchemaTO();
        schemaTO.setName("schema_issue258");
        schemaTO.setType(AttributeSchemaType.Double);

        schemaTO = createSchema(AttributableType.USER, SchemaType.NORMAL, schemaTO);
        assertNotNull(schemaTO);

        UserTO userTO = UserTestITCase.getUniqueSampleTO("issue258@syncope.apache.org");
        userTO.getAttrs().add(attributeTO(schemaTO.getName(), "1.2"));

        userTO = createUser(userTO);
        assertNotNull(userTO);

        schemaTO.setType(AttributeSchemaType.Long);
        try {
            schemaService.update(AttributableType.USER, SchemaType.NORMAL, schemaTO.getName(), schemaTO);
            fail("This should not be reacheable");
        } catch (SyncopeClientException e) {
            assertEquals(ClientExceptionType.InvalidUSchema, e.getType());
        }
    }
View Full Code Here

        }
    }

    @Test
    public void issue259() {
        SchemaTO schemaTO = buildSchemaTO("schema_issue259", AttributeSchemaType.Double);
        schemaTO.setUniqueConstraint(true);

        schemaTO = createSchema(AttributableType.USER, SchemaType.NORMAL, schemaTO);
        assertNotNull(schemaTO);

        UserTO userTO = UserTestITCase.getUniqueSampleTO("issue259@syncope.apache.org");
        userTO.getAttrs().add(attributeTO(schemaTO.getName(), "1"));
        userTO = createUser(userTO);
        assertNotNull(userTO);

        UserTO newUserTO = SerializationUtils.clone(userTO);
        MembershipTO membership = new MembershipTO();
View Full Code Here

        assertNotNull(userTO);
    }

    @Test
    public void issue260() {
        SchemaTO schemaTO = buildSchemaTO("schema_issue260", AttributeSchemaType.Double);
        schemaTO.setUniqueConstraint(true);

        schemaTO = createSchema(AttributableType.USER, SchemaType.NORMAL, schemaTO);
        assertNotNull(schemaTO);

        UserTO userTO = UserTestITCase.getUniqueSampleTO("issue260@syncope.apache.org");
        userTO.getAttrs().add(attributeTO(schemaTO.getName(), "1.2"));
        userTO = createUser(userTO);
        assertNotNull(userTO);

        schemaTO.setUniqueConstraint(false);
        try {
            schemaService.update(AttributableType.USER, SchemaType.NORMAL, schemaTO.getName(), schemaTO);
            fail("This should not be reacheable");
        } catch (SyncopeClientException e) {
            assertEquals(ClientExceptionType.InvalidUSchema, e.getType());
        }
    }
View Full Code Here

        }
    }

    @Test
    public void issueSYNCOPE323() {
        SchemaTO actual = schemaService.read(AttributableType.ROLE, SchemaType.NORMAL, "icon");
        assertNotNull(actual);

        try {
            createSchema(AttributableType.ROLE, SchemaType.NORMAL, actual);
            fail();
        } catch (SyncopeClientException e) {
            assertEquals(Response.Status.CONFLICT, e.getType().getResponseStatus());
            assertEquals(ClientExceptionType.EntityExists, e.getType());
        }

        actual.setName(null);
        try {
            createSchema(AttributableType.ROLE, SchemaType.NORMAL, actual);
            fail();
        } catch (SyncopeClientException e) {
            assertEquals(Response.Status.BAD_REQUEST, e.getType().getResponseStatus());
View Full Code Here

        }
    }

    @Test
    public void issueSYNCOPE418() {
        SchemaTO schema = buildSchemaTO("http://schemas.examples.org/security/authorization/organizationUnit",
                AttributeSchemaType.Double);

        try {
            createSchema(AttributableType.ROLE, SchemaType.NORMAL, schema);
            fail();
View Full Code Here

        assertNotNull(authRoleTO);

        String schemaName = "authTestSchema" + getUUIDString();

        // 1. create a schema (as admin)
        SchemaTO schemaTO = new SchemaTO();
        schemaTO.setName(schemaName);
        schemaTO.setMandatoryCondition("false");
        schemaTO.setType(AttributeSchemaType.String);

        SchemaTO newSchemaTO = createSchema(AttributableType.USER, SchemaType.NORMAL, schemaTO);
        assertEquals(schemaTO, newSchemaTO);

        // 2. create an user with the role created above (as admin)
        UserTO userTO = UserTestITCase.getUniqueSampleTO("auth@test.org");
View Full Code Here

        add(attributeView);
    }

    private void filter(final List<SchemaTO> schemaTOs, final Set<String> allowed) {
        for (ListIterator<SchemaTO> itor = schemaTOs.listIterator(); itor.hasNext();) {
            SchemaTO schema = itor.next();
            if (!allowed.contains(schema.getName())) {
                itor.remove();
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.syncope.common.to.SchemaTO

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.