Package com.volantis.impl.mcs.runtime.policies

Examples of com.volantis.impl.mcs.runtime.policies.CachingActivatedPolicyRetriever.retrievePolicy()


        ActivatedPolicyRetriever retriever =
                new CachingActivatedPolicyRetriever(policyCache, retrieverMock);
        ActivatedPolicy actualPolicy;

        // Get the policy, this should invoke the underlying retriever.
        actualPolicy = retriever.retrievePolicy(projectMock, projectRelativeName);
        assertSame(policy, actualPolicy);

        // Get the policy, this should get the policy from the cache.
        actualPolicy = retriever.retrievePolicy(projectMock, projectRelativeName);
        assertSame(policy, actualPolicy);
View Full Code Here


        // Get the policy, this should invoke the underlying retriever.
        actualPolicy = retriever.retrievePolicy(projectMock, projectRelativeName);
        assertSame(policy, actualPolicy);

        // Get the policy, this should get the policy from the cache.
        actualPolicy = retriever.retrievePolicy(projectMock, projectRelativeName);
        assertSame(policy, actualPolicy);

        // Make sure that the object was stored in the cache.
        Object object = policyCache.retrieve(
                new ProjectSpecificKey(projectMock, projectRelativeName),
View Full Code Here

        ActivatedPolicyRetriever retriever =
                new CachingActivatedPolicyRetriever(policyCache, retrieverMock);
        ActivatedPolicy actualPolicy;

        // Get the policy, this should invoke the underlying retriever.
        actualPolicy = retriever.retrievePolicy(projectMock, projectRelativeName);
        assertSame(policy, actualPolicy);

        // Get the policy, this should get the policy from the cache.
        actualPolicy = retriever.retrievePolicy(projectMock, projectRelativeName);
        assertSame(policy, actualPolicy);
View Full Code Here

        // Get the policy, this should invoke the underlying retriever.
        actualPolicy = retriever.retrievePolicy(projectMock, projectRelativeName);
        assertSame(policy, actualPolicy);

        // Get the policy, this should get the policy from the cache.
        actualPolicy = retriever.retrievePolicy(projectMock, projectRelativeName);
        assertSame(policy, actualPolicy);

        // Make sure that the object was stored in the cache.
        Object object = policyCache.retrieve(remoteName, providerMock);
        assertSame(policy, object);
View Full Code Here

        ActivatedPolicyRetriever retriever =
                new CachingActivatedPolicyRetriever(policyCache, retrieverMock);
        ActivatedPolicy policy;

        // Get the policy, this should invoke the underlying retriever.
        policy = retriever.retrievePolicy(projectMock, projectRelativeName);
        assertNull(policy);

        // Get the policy, this should get the policy from the cache.
        policy = retriever.retrievePolicy(projectMock, projectRelativeName);
        assertNull(policy);
View Full Code Here

        // Get the policy, this should invoke the underlying retriever.
        policy = retriever.retrievePolicy(projectMock, projectRelativeName);
        assertNull(policy);

        // Get the policy, this should get the policy from the cache.
        policy = retriever.retrievePolicy(projectMock, projectRelativeName);
        assertNull(policy);
    }

    /**
     * Ensure that the caching retriever works properly.
View Full Code Here

                .returns(originalPolicy);

        // The current time for the calculation of the expiration time.
        clockMock.expects.getCurrentTime().returns(Time.inMilliSeconds(1000));

        actualPolicy = retriever.retrievePolicy(projectMock,
                projectRelativeName);
        assertSame(originalPolicy, actualPolicy);

        expectations.verify();
View Full Code Here

        // expired so is returned without invoking the provider.

        // The current time used to determine whether the policy has expired.
        clockMock.expects.getCurrentTime().returns(Time.inMilliSeconds(1500));

        actualPolicy = retriever.retrievePolicy(projectMock,
                projectRelativeName);
        assertSame(originalPolicy, actualPolicy);

        expectations.verify();
View Full Code Here

        // retrieved policy. This is different to the above as it will
        // happen after the provider has returned the policy which will be
        // some time afterwards.
        clockMock.expects.getCurrentTime().returns(Time.inMilliSeconds(3000));

        actualPolicy = retriever.retrievePolicy(projectMock,
                projectRelativeName);
        assertSame(refreshedPolicy, actualPolicy);

        expectations.verify();
View Full Code Here

        // Get the time after the retriever has failed to return a policy so
        // that it can calculate the expiry time for the retry.
        clockMock.expects.getCurrentTime().returns(Time.inMilliSeconds(8000));

        actualPolicy = retriever.retrievePolicy(projectMock,
                projectRelativeName);
        assertSame(refreshedPolicy, actualPolicy);

        expectations.verify();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.