Package org.rest.sec.model.dto

Examples of org.rest.sec.model.dto.User


    }

    @Test
    public final void whenUserIsCreatedWithExistingRole_then201IsReceived() {
        final Role existingAssociation = getAssociationAPI().create(getAssociationEntityOps().createNewEntity());
        final User newResource = getEntityOps().createNewEntity();
        newResource.getRoles().add(existingAssociation);

        // When
        final Response response = getApi().createAsResponse(newResource);

        // Then
View Full Code Here


    // TODO: sort

    @Test
    public final void whenScenario_getResource_getAssociationsById() {
        final Role existingAssociation = getAssociationAPI().create(getAssociationEntityOps().createNewEntity());
        final User resourceToCreate = getEntityOps().createNewEntity();
        resourceToCreate.getRoles().add(existingAssociation);

        // When
        final User existingResource = getApi().create(resourceToCreate);
        for (final Role associationOfResourcePotential : existingResource.getRoles()) {
            final Role existingAssociationOfResource = getAssociationAPI().findOne(associationOfResourcePotential.getId());
            assertThat(existingAssociationOfResource, notNullValue());
        }
    }
View Full Code Here

    // scenarios

    @Test
    public final void whenScenarioOfWorkingWithAssociations_thenTheChangesAreCorrectlyPersisted() {
        final Role existingAssociation = getAssociationAPI().create(getAssociationEntityOps().createNewEntity());
        final User resource1 = new User(randomAlphabetic(6), randomAlphabetic(6), Sets.newHashSet(existingAssociation));

        final User resource1ViewOfServerBefore = getApi().create(resource1);
        assertThat(resource1ViewOfServerBefore.getRoles(), hasItem(existingAssociation));

        final User resource2 = new User(randomAlphabetic(6), randomAlphabetic(6), Sets.newHashSet(existingAssociation));
        getApi().createAsResponse(resource2);

        final User resource1ViewOfServerAfter = getApi().findOne(resource1ViewOfServerBefore.getId());
        assertThat(resource1ViewOfServerAfter.getRoles(), hasItem(existingAssociation));
    }
View Full Code Here

        userApi.create(userEntityOps.createNewEntity(nameOfUser));
        final String nameOfRole = randomAlphabetic(6);
        roleApi.create(roleEntityOps.createNewEntity(nameOfRole));

        // When
        final User existingUser = userApi.findByName(nameOfUser);
        final Role existingRole = roleApi.findByName(nameOfRole);
    }
View Full Code Here

    public static User createNewUser() {
        return createNewUser(randomAlphabetic(8), randomAlphabetic(8));
    }

    public static User createNewUser(final String name, final String pass) {
        return new User(name, pass, Sets.<Role> newHashSet());
    }
View Full Code Here

    }

    // API

    public final User createNewEntity(final String name) {
        return new User(name, randomAlphabetic(8), Sets.<Role> newHashSet());
    }
View Full Code Here

    // template method

    @Override
    public final User createNewEntity() {
        return new User(randomAlphabetic(8), randomAlphabetic(8), Sets.<Role> newHashSet());
    }
View Full Code Here

TOP

Related Classes of org.rest.sec.model.dto.User

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.