Package org.apache.syncope.core.persistence.beans.user

Examples of org.apache.syncope.core.persistence.beans.user.USchema


        assertEquals(actual.getValues().size(), 1);
    }

    @Test
    public void validateAndSave() {
        final USchema emailSchema = userSchemaDAO.find("email", USchema.class);
        assertNotNull(emailSchema);

        final USchema fullnameSchema = userSchemaDAO.find("fullname", USchema.class);
        assertNotNull(fullnameSchema);

        UAttr attribute = new UAttr();
        attribute.setSchema(emailSchema);
View Full Code Here


        UAttr attribute = attrDAO.find(200L, UAttr.class);
        String attrSchemaName = attribute.getSchema().getName();

        attrDAO.delete(attribute.getId(), UAttr.class);

        USchema schema = userSchemaDAO.find(attrSchemaName, USchema.class);
        assertNotNull("user attribute schema deleted when deleting values", schema);
    }
View Full Code Here

        assertEquals(resourceTOs, Arrays.asList(actual));
    }

    @Test
    public void issue42() {
        USchema userId = schemaDAO.find("userId", USchema.class);

        Set<AbstractMappingItem> beforeUserIdMappings = new HashSet<AbstractMappingItem>();
        for (ExternalResource res : resourceDAO.findAll()) {
            if (res.getUmapping() != null) {
                for (AbstractMappingItem mapItem : res.getUmapping().getItems()) {
                    if (userId.getName().equals(mapItem.getIntAttrName())) {
                        beforeUserIdMappings.add(mapItem);
                    }
                }
            }
        }

        ResourceTO resourceTO = new ResourceTO();
        resourceTO.setName("resource-issue42");
        resourceTO.setConnectorId(100L);
        resourceTO.setPropagationMode(PropagationMode.ONE_PHASE);
        resourceTO.setEnforceMandatoryCondition(true);

        MappingTO mapping = new MappingTO();
        resourceTO.setUmapping(mapping);

        MappingItemTO item = new MappingItemTO();
        item.setIntAttrName("userId");
        item.setIntMappingType(IntMappingType.UserSchema);
        item.setExtAttrName("campo1");
        item.setAccountid(true);
        item.setMandatoryCondition("false");
        item.setPurpose(MappingPurpose.BOTH);
        mapping.setAccountIdItem(item);

        ExternalResource resource = resourceDataBinder.create(resourceTO);
        resource = resourceDAO.save(resource);
        assertNotNull(resource);
        assertNotNull(resource.getUmapping());
        assertEquals(1, resource.getUmapping().getItems().size());

        resourceDAO.flush();

        ExternalResource actual = resourceDAO.find("resource-issue42");
        assertNotNull(actual);
        assertEquals(resource, actual);

        userId = schemaDAO.find("userId", USchema.class);

        Set<AbstractMappingItem> afterUserIdMappings = new HashSet<AbstractMappingItem>();
        for (ExternalResource res : resourceDAO.findAll()) {
            if (res.getUmapping() != null) {
                for (AbstractMappingItem mapItem : res.getUmapping().getItems()) {
                    if (userId.getName().equals(mapItem.getIntAttrName())) {
                        afterUserIdMappings.add(mapItem);
                    }
                }
            }
        }
View Full Code Here

        assertEquals(5, roleList.size());
    }

    @Test
    public void findByName() {
        USchema schema = schemaDAO.find("fullname", USchema.class);
        assertNotNull("did not find expected attribute schema", schema);
    }
View Full Code Here

        }
    }

    @Test
    public void save() {
        USchema schema = new USchema();
        schema.setName("secondaryEmail");
        schema.setType(AttributeSchemaType.String);
        schema.setValidatorClass("org.apache.syncope.core.validation.EmailAddressValidator");
        schema.setMandatoryCondition("false");
        schema.setMultivalue(true);

        schemaDAO.save(schema);

        USchema actual = schemaDAO.find("secondaryEmail", USchema.class);
        assertNotNull("expected save to work", actual);
        assertEquals(schema, actual);
    }
View Full Code Here

        assertEquals(schema, actual);
    }

    @Test(expected = InvalidEntityException.class)
    public void saveNonValid() {
        USchema schema = new USchema();
        schema.setName("secondaryEmail");
        schema.setType(AttributeSchemaType.String);
        schema.setValidatorClass("org.apache.syncope.core.validation.EmailAddressValidator");
        schema.setMandatoryCondition("false");
        schema.setMultivalue(true);
        schema.setUniqueConstraint(true);

        schemaDAO.save(schema);
    }
View Full Code Here

        assertFalse(actual.getEnumerationKeys().isEmpty());
    }

    @Test(expected = InvalidEntityException.class)
    public void saveInvalidSchema() {
        USchema schema = new USchema();
        schema.setName("username");
        schemaDAO.save(schema);
    }
View Full Code Here

        schemaDAO.save(schema);
    }

    @Test
    public void delete() {
        USchema fullnam = schemaDAO.find("fullname", USchema.class);

        schemaDAO.delete(fullnam.getName(), AttributableUtil.getInstance(AttributableType.USER));

        USchema actual = schemaDAO.find("fullname", USchema.class);
        assertNull("delete did not work", actual);
    }
View Full Code Here

        assertNull("delete did not work", actual);
    }

    @Test
    public void issueSYNCOPE418() {
        USchema schema = new USchema();
        schema.setName("http://schemas.examples.org/security/authorization/organizationUnit");

        try {
            schemaDAO.save(schema);
            fail();
        } catch (InvalidEntityException e) {
View Full Code Here

                item.setAccountid(true);
            }
        }

        // search for user schema fullname
        USchema schema = schemaDAO.find("fullname", USchema.class);
        assertNotNull(schema);

        // check for associated mappings
        Set<AbstractMappingItem> mapItems = new HashSet<AbstractMappingItem>();
        for (ExternalResource resource : resourceDAO.findAll()) {
            if (resource.getUmapping() != null) {
                for (AbstractMappingItem mapItem : resource.getUmapping().getItems()) {
                    if (schema.getName().equals(mapItem.getIntAttrName())) {
                        mapItems.add(mapItem);
                    }
                }
            }
        }
View Full Code Here

TOP

Related Classes of org.apache.syncope.core.persistence.beans.user.USchema

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.