Package com.volantis.mcs.policies

Examples of com.volantis.mcs.policies.PolicyBuilderResponse


            // Look for the policy in the actual project, if it is found
            // then it is treated as if it belonged to the logical project.
            PolicyBuilderReader reader = actualProject.getPolicyBuilderReader();

            // Try and get the response, may be null.
            PolicyBuilderResponse response =
                    reader.getPolicyBuilder(actualProject, name);
            if (response == null) {
                // No response from reader so try next one.
                continue;
            }

            // If the logical project is the global project then it
            // maybe that the policy is actually in a different project
            // but the request was deferred until now in order to allow
            // the project identification to be combined with retrieval
            // of the policy in order to save time on the server.
            RuntimeProject responseProject = (RuntimeProject)
                    response.getProject();
            if (responseProject != actualProject) {
                RuntimeProject global = projectManager.getGlobalProject();
                if (actualProject == global && logicalProject == global) {
                    actualProject = responseProject;
                    logicalProject = responseProject;
                } else {
                    // The project can change only if the policy is remote and
                    // the actual project is the global project.
                    throw new IllegalStateException(
                            "Response indicates policy is in " +
                            responseProject + " instead of " + actualProject +
                            " but either it, or " + logicalProject +
                            " is not the global project " + global);
                }
            }

            // Get the builder from the response, again may be null.
            PolicyBuilder policyBuilder = response.getBuilder();
            if (policyBuilder == null) {
                // No response from builder so try next one.
                continue;
            }
View Full Code Here


        // =====================================================================
        //   Set Expectations
        // =====================================================================

        readerMock.expects.getPolicyBuilder(projectMock, name)
                .returns(new PolicyBuilderResponse(projectMock,
                        builderMock));

        activatorMock.expects.activate(projectMock,
                builderMock, projectMock)
                .returns(policyMock);
View Full Code Here

        // =====================================================================
        //   Set Expectations
        // =====================================================================

        readerMock.expects.getPolicyBuilder(projectMock, name)
                .returns(new PolicyBuilderResponse(projectMock, null));

        // No base project.
        projectMock.expects.getBaseProject().returns(null).any();

        // =====================================================================
View Full Code Here

        // =====================================================================
        //   Set Expectations
        // =====================================================================

        globalReaderMock.expects.getPolicyBuilder(globalProjectMock, name)
                .returns(new PolicyBuilderResponse(actualProjectMock,
                        builderMock));

        activatorMock.expects.activate(actualProjectMock,
                builderMock, actualProjectMock)
                .returns(policyMock);
View Full Code Here

        // If any reader other then the one for the global project returns a
        // different project in the response than the requested one then it is
        // an error.
        readerMock.expects.getPolicyBuilder(projectMock, name)
                .returns(new PolicyBuilderResponse(actualProjectMock,
                        builderMock));

        // =====================================================================
        //   Test Expectations
        // =====================================================================
View Full Code Here

                .returns(null);

        projectMock.expects.getBaseProject().returns(globalProjectMock).any();

        globalReaderMock.expects.getPolicyBuilder(globalProjectMock, name)
                .returns(new PolicyBuilderResponse(actualProjectMock,
                        builderMock));

        // =====================================================================
        //   Test Expectations
        // =====================================================================
View Full Code Here

        // Try base project.
        projectMock.expects.getBaseProject().returns(actualProjectMock).any();

        actualReaderMock.expects.getPolicyBuilder(actualProjectMock, name)
                .returns(new PolicyBuilderResponse(actualProjectMock,
                        builderMock));

        activatorMock.expects.activate(actualProjectMock,
                builderMock, projectMock)
                .returns(policyMock);
View Full Code Here

        // =====================================================================
        //   Test Expectations
        // =====================================================================

        RemotePolicyBuilderReader reader = createReader();
        PolicyBuilderResponse response = (PolicyBuilderResponse)
                reader.getPolicyBuilder(runtimeProjectMock, absoluteURL);
        assertNotNull(response.getBuilder());
        assertSame(runtimeProjectMock, response.getProject());
    }
View Full Code Here

        // =====================================================================
        //   Test Expectations
        // =====================================================================

        RemotePolicyBuilderReader reader = createReader();
        PolicyBuilderResponse response = (PolicyBuilderResponse)
                reader.getPolicyBuilder(runtimeProjectMock, url);
        assertNotNull(response.getBuilder());
        assertSame(runtimeProjectMock, response.getProject());
    }
View Full Code Here

    protected void doFailureTest(String url)
            throws RepositoryException {

        RemotePolicyBuilderReader reader = createReader();
        PolicyBuilderResponse response = reader.getPolicyBuilder(
                runtimeProjectMock, url);
        PolicyBuilder builder = response.getBuilder();
        assertNull(builder);
    }
View Full Code Here

TOP

Related Classes of com.volantis.mcs.policies.PolicyBuilderResponse

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.