Package org.rest.sec.model

Examples of org.rest.sec.model.Role


    @Override
    @Test
    public final void givenResourceHasAssociations_whenResourceIsRetrieved_thenAssociationsAreAlsoRetrieved() {
        // Given
        final Privilege existingAssociation = getAssociationAPI().create(getAssociationEntityOps().createNewEntity());
        final Role newResource = getEntityOps().createNewEntity();
        newResource.getPrivileges().add(existingAssociation);

        // When
        final Role existingResource = getApi().create(newResource);

        // Then
        assertThat(existingResource.getPrivileges(), notNullValue());
        assertThat(existingResource.getPrivileges(), not(Matchers.<Privilege> empty()));
    }
View Full Code Here


    // escaping characters

    @Test
    @Ignore("temp + move in parent")
    public final void givenWorkingWithSpecialCharacters_whtnResourcesIfRetrievedByName_thenResourceIsCorrectlyRetrieved() {
        final Role newResource = getEntityOps().createNewEntity();
        newResource.setName("Macy's,Dell, Inc.");
        getApi().createAsResponse(newResource);

        // When
        final Role retrievedResource = getApi().findByName(newResource.getName());
        assertEquals(newResource, retrievedResource);
    }
View Full Code Here

    // find one

    @Test
    public final void givenResourceExists_whenResourceIsRetrievedByName_thenResourceIsCorrectlyRetrieved() {
        final Role newResource = getEntityOps().createNewEntity();
        getApi().create(newResource);
        final Role existingResourceByName = getApi().findByName(newResource.getName());
        assertEquals(newResource, existingResourceByName);
    }
View Full Code Here

    // find all

    @Test
    @Ignore("in progress - create association first")
    public final void whenResourceIsRetrieved_thenAssociationsAreAlsoRetrieved() {
        final Role existingResource = getApi().create(getEntityOps().createNewEntity());
        assertThat(existingResource.getPrivileges(), not(Matchers.<Privilege> empty()));
    }
View Full Code Here

    // create

    @Test
    public final void givenResourceHasNameWithSpace_whenResourceIsCreated_then201IsReceived() {
        final Role newResource = getEntityOps().createNewEntity();
        newResource.setName(randomAlphabetic(4) + " " + randomAlphabetic(4));

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

        // Then
View Full Code Here

    }

    @Test
    @Ignore("temp")
    public final void givenExistingResourceHasNameWithSpace_whenResourcesIfRetrievedByName_thenResourceIsCorrectlyRetrieved() {
        final Role newResource = getEntityOps().createNewEntity();
        newResource.setName(randomAlphabetic(4) + " " + randomAlphabetic(4));
        getApi().createAsResponse(newResource);

        // When
        final Role retrievedResource = getApi().findByName(newResource.getName());
        assertEquals(newResource, retrievedResource);
    }
View Full Code Here

    }

    @Test
    public final void whenCreatingNewResourceWithExistingAssociations_thenNewResourceIsCorrectlyCreated() {
        final Privilege existingAssociation = getAssociationAPI().create(getAssociationEntityOps().createNewEntity());
        final Role newResource = getEntityOps().createNewEntity();
        newResource.getPrivileges().add(existingAssociation);
        getApi().create(newResource);

        final Role newResource2 = getEntityOps().createNewEntity();
        newResource2.getPrivileges().add(existingAssociation);
        getApi().create(newResource2);
    }
View Full Code Here

     * - note: this test ensures that a new User cannot automatically create new Privileges <br>
     * - note: the standard way to do this is: first create the Privilege resource(s), then associate them with the new User resource and then create the User resource
     */
    @Test
    public final void whenResourceIsCreatedWithNewAssociation_then409IsReceived() {
        final Role newResource = getEntityOps().createNewEntity();
        newResource.getPrivileges().add(getAssociationEntityOps().createNewEntity());

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

        // Then
View Full Code Here

    @Test
    public final void whenResourceIsCreatedWithInvalidAssociation_then409IsReceived() {
        final Privilege invalidAssociation = getAssociationEntityOps().createNewEntity();
        getAssociationEntityOps().invalidate(invalidAssociation);
        final Role newResource = getEntityOps().createNewEntity();
        newResource.getPrivileges().add(invalidAssociation);

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

        // Then
View Full Code Here

    }

    @Test
    public final void whenResourceIsCreatedWithExistingAssociation_then201IsReceived() {
        final Privilege existingAssociation = getAssociationAPI().create(getAssociationEntityOps().createNewEntity());
        final Role newResource = getEntityOps().createNewEntity();
        newResource.getPrivileges().add(existingAssociation);

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

        // Then
View Full Code Here

TOP

Related Classes of org.rest.sec.model.Role

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.