Package com.volantis.shared.dependency

Examples of com.volantis.shared.dependency.Dependency


            public boolean isComplex() {
                return false;
            }
        };
        final Dependency dependency = new FixedTTLDependency(
            SystemClock.getDefaultInstance(), Period.inSeconds(0));
        cache.retrieve(cacheKey, new TestCacheableObjectProvider(
            cache.getRootGroup(), true,
            new CacheBodyOperationProcess.RecordingWithDependency(
                recording, dependency)));
View Full Code Here


            public boolean isComplex() {
                return false;
            }
        };
        final Dependency dependency = new FixedTTLDependency(
            SystemClock.getDefaultInstance(), Period.inSeconds(0)) {
            public Freshness freshness(final DependencyContext context) {
                return Freshness.FRESH;
            }
        };
View Full Code Here

            public boolean isComplex() {
                return false;
            }
        };
        final Dependency dependency = new FixedTTLDependency(
            SystemClock.getDefaultInstance(), Period.inSeconds(0)) {
            public Freshness freshness(final DependencyContext context) {
                return Freshness.REVALIDATE;
            }
            public Freshness revalidate(final DependencyContext context) {
View Full Code Here

     */
    public abstract boolean isFresh();

    // javadoc inherited
    public Dependency getDependency() {
        return new Dependency() {

            // javadoc inherited
            public Cacheability getCacheability() {
                return Cacheability.CACHEABLE;
            }
View Full Code Here

            throws SAXException {

        XMLPipelineContext pipelineContext = dynamicProcess.getPipelineContext();
        DependencyContext context = pipelineContext.getDependencyContext();

        Dependency dependency = context.extractDependency();

        context.popDependencyTracker();

        XMLProcess target = getTargetProcess(dynamicProcess);

        // Generate an element containing the freshness.
        Freshness freshness = dependency.freshness(context);
        generateSimpleElement(target, freshness.toString(),
                "freshness");

        // Generate an element containing the revalidated freshness.
        if (freshness == Freshness.REVALIDATE) {
            Freshness revalidated = dependency.revalidate(context);
            generateSimpleElement(target, revalidated.toString(),
                    "revalidated");
        }

        Cacheability cacheability = dependency.getCacheability();
        generateSimpleElement(target, cacheability.toString(), "cacheability");

        Period timeToLive = dependency.getTimeToLive();
        generateSimpleElement(target, timeToLive.toString(), "time-to-live");

        Validity validity = context.checkValidity(dependency);
        generateSimpleElement(target, validity.toString(), "validity");
    }
View Full Code Here

            timeToLive = Period.INDEFINITELY;
        } else {
            timeToLive = Period.inSeconds(Integer.parseInt(value));
        }

        Dependency dependency = new TestDependency(
                cacheability, timeToLive, freshness, revalidated);

        dependencyContext.addDependency(dependency);

        return null;
View Full Code Here

        int min = fresh1 == Freshness.STALE ? 0 : 1;

        contextMock.expects.checkFreshness(dependency2Mock).returns(fresh2)
                .min(min).max(1);

        Dependency aggregate = new Dependencies(Arrays.asList(
                new Dependency[] {
                    dependency1Mock, dependency2Mock
                }));

        Freshness actual = aggregate.freshness(contextMock);
        assertEquals(expected, actual);
    }
View Full Code Here

        }

        Cacheability cacheability =
                cacheable ? Cacheability.CACHEABLE : Cacheability.UNCACHEABLE;

        Dependency dependency = new TestDependency(cacheability, timeToLive,
                freshness, revalidated);
        DependencyContext dependencyContext = context.getDependencyContext();
        dependencyContext.addDependency(dependency);

        ExpressionFactory factory = context.getFactory();
View Full Code Here

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

        DependencyTracker tracker =
                new DependencyTrackerImpl();
        Dependency dependency = tracker.extractDependency();
        assertEquals(Cacheability.CACHEABLE, dependency.getCacheability());
        assertEquals(Period.INDEFINITELY, dependency.getTimeToLive());
        TestCaseAbstract.assertEquals(Freshness.FRESH, dependency.freshness(contextMock));
        try {
            dependency.revalidate(contextMock);
            fail("Did not detect invalid call to revalidate");
        } catch(IllegalStateException e) {
            // Expected.
        }
View Full Code Here

        // =====================================================================

        DependencyTracker tracker =
                new DependencyTrackerImpl();
        tracker.addDependency(dependency1Mock);
        Dependency aggregate = tracker.extractDependency();
        assertSame(dependency1Mock, aggregate);
    }
View Full Code Here

TOP

Related Classes of com.volantis.shared.dependency.Dependency

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.