Examples of DynamicElementRule


Examples of com.volantis.xml.pipeline.sax.dynamic.DynamicElementRule

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

        // =====================================================================
        //   Test Expectations
        // =====================================================================
        DynamicElementRule rule = new ProxyRule();
        doStartFailure(rule,
                "Proxy tag should have the 'ref' parameter set. " +
                "Value is: ref='null'");
    }
View Full Code Here

Examples of com.volantis.xml.pipeline.sax.dynamic.DynamicElementRule

        contextMock.expects.setProperty(ProxyManager.class, ref, false);

        // =====================================================================
        //   Test Expectations
        // =====================================================================
        DynamicElementRule rule = new ProxyRule();

        addAttribute("ref", ref);

        rule.startElement(dynamicProcessMock, elementName, attributes);
    }
View Full Code Here

Examples of com.volantis.xml.pipeline.sax.dynamic.DynamicElementRule

        // Prepare mocks
        contextMock.expects.findObject(CacheProperties.class).
                returns(properties).any();

        DynamicElementRule rule = new CacheInfoRule();
        Object obj = rule.startElement(dynamicProcessMock, elementName,
                attributes);

        assertNull(obj);

        rule.endElement(dynamicProcessMock, elementName, attributes);
        assertNotNull(properties);
    }
View Full Code Here

Examples of com.volantis.xml.pipeline.sax.dynamic.DynamicElementRule

     * Test: Cache properties with set all attributes can be found on
     * the stack, but cache with those attributes does not exist.
     */
    public void testAttributesOK() throws Exception {

        DynamicElementRule rule = new CacheBodyRule();
        XMLPipeline pipeline = new XMLPipelineProcessImpl(contextMock);

        final String cacheName = "cache406";
        final String cacheKeyValue = "cacheKey406";

        //Create and set attributes for CacheProperties instance
        CacheKey cacheKey = new CacheKey();
        cacheKey.addKey(cacheKeyValue);
        CacheControl cacheControl = new CacheControl();
        cacheControl.setTimeToLive(CacheControlRule.calculateTimeToLive("997"));
        CacheProperties properties = new CacheProperties();
        properties.setCacheControl(cacheControl);
        properties.setCacheKey(cacheKey);
        properties.setCacheName(cacheName);

        // Prepare mocks for startElement method
        contextMock.expects.findObject(CacheProperties.class).
                returns(properties).any();

        final DependencyContextMock dependencyContextMock =
            new DependencyContextMock("dependencyContextMock", expectations);
        contextMock.expects.getDependencyContext().returns(
            dependencyContextMock).any();

        // VBM:2006120611 - using Mocks can be fragile. Needed to add new mock
        // and expectation to get this test to pass again.
        final XMLPipelineConfigurationMock pipelineConfigurationMock =
            new XMLPipelineConfigurationMock("pipelineConfigurationMock",
                expectations);
        pipelineConfigurationMock.expects.retrieveConfiguration(
                CacheProcessConfiguration.class).returns(
                new CacheProcessConfiguration() {
                    {
                        createCache(cacheName, "100", "0");
                    }
                });

        contextMock.expects.getPipelineConfiguration()
                .returns(pipelineConfigurationMock);

        dynamicProcessMock.expects.getPipeline().returns(pipeline);
        dynamicProcessMock.fuzzy.addProcess(mockFactory.
                expectsInstanceOf(CacheBodyOperationProcess.class));

        //startElement
        EndElementAction action = (EndElementAction) rule.
                startElement(dynamicProcessMock, elementName, attributes);
        assertNotNull(action);
        assertNotEquals(action, EndElementAction.DO_NOTHING);

        //Prepare mocks for endElement method
        dynamicProcessMock.expects.removeProcess().
                returns(new XMLPipelineProcessImpl(contextMock));

        //endElement
        rule.endElement(dynamicProcessMock, elementName, action);
    }
View Full Code Here

Examples of com.volantis.xml.pipeline.sax.dynamic.DynamicElementRule

     * Test: cacheProperties can not be found.
     * cache element has a cacheKey attribute set.
     */
    public void testAttributesNoProperties() throws Exception {

        DynamicElementRule rule = new CacheBodyRule();

        // Prepare mocks for startElement method
        contextMock.expects.findObject(CacheProperties.class).
                returns(null).any();

        //startElement   
        EndElementAction action = (EndElementAction) rule.
                startElement(dynamicProcessMock, elementName, attributes);

        assertNotNull(action);
        assertEquals(action, EndElementAction.DO_NOTHING);

        //endElement - no expectations
        rule.endElement(dynamicProcessMock, elementName, action);
    }
View Full Code Here

Examples of com.volantis.xml.pipeline.sax.dynamic.DynamicElementRule

                returns(null).any();

        dynamicProcessMock.fuzzy.error(
                mockFactory.expectsInstanceOf(SAXParseException.class));

        DynamicElementRule rule = new CacheInfoRule();
        EndElementAction action = (EndElementAction) rule.startElement(
                dynamicProcessMock, elementName, attributes);
        assertNull(action);
        rule.endElement(dynamicProcessMock, elementName, action);
    }
View Full Code Here

Examples of com.volantis.xml.pipeline.sax.dynamic.DynamicElementRule

        dynamicProcessMock.fuzzy.error(mockFactory.
                expectsInstanceOf(SAXParseException.class));


        DynamicElementRule rule = new CacheInfoRule();
        EndElementAction action = (EndElementAction) rule.
                startElement(dynamicProcessMock, elementName, attributes);

        assertNull(action);

        rule.endElement(dynamicProcessMock, elementName, action);
        assertNotNull(properties);
    }
View Full Code Here

Examples of com.volantis.xml.pipeline.sax.dynamic.DynamicElementRule

        // Prepare mocks
        contextMock.expects.findObject(CacheProperties.class).
                returns(properties).any();

        DynamicElementRule rule = new CacheControlRule();
        XMLProcess process = (XMLProcess) rule.
                startElement(dynamicProcessMock, elementName, attributes);

        assertNull(process);

        rule.endElement(dynamicProcessMock, elementName, process);

        assertNotNull(properties);
        assertNotNull(properties.getCacheControl());
        assertEquals(cacheControl, properties.getCacheControl());
    }
View Full Code Here

Examples of com.volantis.xml.pipeline.sax.dynamic.DynamicElementRule

                returns(null).any();

        dynamicProcessMock.fuzzy.error(mockFactory.
                expectsInstanceOf(SAXParseException.class));

        DynamicElementRule rule = new CacheControlRule();

        Object obj = rule.startElement(dynamicProcessMock, elementName,
                attributes);

        assertNull(obj);
        rule.endElement(dynamicProcessMock, elementName, attributes);
    }
View Full Code Here

Examples of com.volantis.xml.pipeline.sax.dynamic.DynamicElementRule

        // Prepare mocks
        contextMock.expects.findObject(CacheProperties.class).
                returns(properties).any();

        DynamicElementRule rule = new CacheKeyRule();
        EndElementAction action = (EndElementAction) rule.
                startElement(dynamicProcessMock, elementName, attributes);
        assertNull(action);

        rule.endElement(dynamicProcessMock, elementName, action);

        assertNotNull(properties);
        assertNotNull(properties.getCacheKey());
        assertEquals("Key should match", cacheKey, properties.getCacheKey());
    }
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.