Package com.volantis.synergetics

Examples of com.volantis.synergetics.BooleanWrapper


                                SAXHandler handler,
                                WebDriverConfiguration config) throws Exception {
                final String characterEncoding = "mycharencoding";
                config.setCharacterEncoding(characterEncoding);

                final BooleanWrapper charEncodingSet = new BooleanWrapper(false);

                final XMLFilterImpl xmlFilter = new XMLFilterImpl();
                final XMLResponseConditioner xmlConditioner =
                        new XMLResponseConditioner(xmlFilter) {
                            // javadoc inherited
                            public void condition(InputSource source, XMLProcess consumer)
                                    throws IOException, SAXException {
                                String encoding = source.getEncoding();
                                charEncodingSet.setValue(
                                        encoding.equals(characterEncoding));
                            }
                };

                WebDriverConditionerFactory factory =
                        new WebDriverConditionerFactory() {
                    public ContentConditioner createConditioner(XMLFilter filter) {
                        return xmlConditioner;
                    }
                };

                String contentType = "xml/xdime";
                config.addWebDriverConditionerFactory(contentType, factory);

                process.setNextProcess(consumer);
                process.processResponse(null, is, 200, contentType, null);

                assertTrue("Expected char encoding to be set.",
                        charEncodingSet.getValue());
            }
        };
        executeProcessResponseTestCommand(input, comm);
    }
View Full Code Here


        ContextInternals.setMarinerPageContext(requestContext, pageContext);
       
        // Create a parent ArgumentsElement and push it onto the stack
        final String argName = "arg-name";
        final String argValue = "arg-value";
        final BooleanWrapper calledAdd = new BooleanWrapper(false);
        ArgumentsElement arguments = new ArgumentsElement() {
            void addArgument(String name, String value) {
                calledAdd.setValue(true);
                assertEquals("Unexpected value for name param.",
                        argName, name);
                assertEquals("Unexpected value for value param.",
                        argValue, value);
            }
        };       
        pageContext.pushIAPIElement(arguments);
       
        // Create the ArgumentElement and test the elementStart method.
        ArgumentElement element = new ArgumentElement();
        ArgumentAttributes attrs = new ArgumentAttributes();
        attrs.setName(argName);
        attrs.setValue(argValue);
       
        int result = element.elementStart(requestContext, attrs);
        assertEquals("Unexpected result from elementStart.",
                IAPIConstants.SKIP_ELEMENT_BODY, result);
       
        assertTrue("ArgumentsElement.addArgument should have been called",
                calledAdd.getValue());
    }
View Full Code Here

        final String argName = new String("arg-name");
        final String argValue = new String("arg-value");
        final Map argsMap = new HashMap(1);
        argsMap.put(argName, argValue);

        final BooleanWrapper calledSetArgs = new BooleanWrapper(false);
        InvokeElement invoke = new InvokeElement() {
            void setArguments(Map arguments) {
                calledSetArgs.setValue(true);
                String value = (String) arguments.get(argName);
                assertEquals("Unexpected argument value.", argValue, value);
            }
        };
        pageContext.pushIAPIElement(invoke);

        ArgumentsElement element = new ArgumentsElement();       
        // call elementStart to ensure we have our parent.
        element.elementStart(requestContext, null);
        element.addArgument(argName, argValue);
        int result = element.elementEnd(requestContext, null);
        assertEquals("Unexpected result from elementEnd.",
                IAPIConstants.CONTINUE_PROCESSING, result);
       
        assertTrue("InvokeElement.setArguments should have been invoked.",
                calledSetArgs.getValue());
    }
View Full Code Here

   
    /**
     * Test doPluginInitialize.    
     */
    public void testDoPluginInitialize() throws Exception {
        final BooleanWrapper success = new BooleanWrapper(false);
        final HashMap argMap = new HashMap();
       
        MarkupPlugin plugin = new AbstractMarkupPlugin() {
            // javadoc inherited from superclass.
            public void initialize(Map arguments) {
                success.setValue(true);
                assertSame("Unexpected value for arguments.",
                        argMap, arguments);
            }
        };
       
        InvokeElement invoke = new InvokeElement();
        invoke.doPluginInitialize(plugin, argMap, "name");
       
        assertTrue("MarkupPlugin.initialize should have been invoked.",
                success.getValue());
    }
View Full Code Here

    /**
     * Test the method doPluginProcess.    
     */
    public void testDoPluginProcess() throws Exception {
        final BooleanWrapper success = new BooleanWrapper(false);
        final HashMap argMap = new HashMap();
        final TestMarinerRequestContext requestContext =
                new TestMarinerRequestContext();

        MarkupPlugin plugin = new AbstractMarkupPlugin() {
            // javadoc inherited from superclass.
            public void process(MarinerRequestContext context, Map arguments) {
                success.setValue(true);
                assertSame("Unexpected value for arguments.",
                        argMap, arguments);
                assertSame("Unexpected value for context.",
                        requestContext, context);
            }
        };

        InvokeElement invoke = new InvokeElement();
        invoke.doPluginProcess(requestContext, plugin, argMap, "name");

        assertTrue("MarkupPlugin.process should have been invoked.",
                success.getValue());   
    }
View Full Code Here

    /**
     * Test the method doPluginRelease    
     */
    public void testDoPluginRelease() throws Exception {
        final BooleanWrapper success = new BooleanWrapper(false);       

        MarkupPlugin plugin = new AbstractMarkupPlugin() {
            // javadoc inherited from superclass.
            public void release() {
                success.setValue(true);
            }
        };

        InvokeElement invoke = new InvokeElement();
        invoke.doPluginRelease(plugin, "name");

        assertTrue("MarkupPlugin.initialize should have been invoked.",
                success.getValue());   
    }
View Full Code Here

    /**
     * Test the method setInitialRequestContext(MarinerRequestContext)    
     */
    public void testSetInitialRequestContext() throws Exception {
        final BooleanWrapper calledMethod = new BooleanWrapper(false);
        final TestMarinerRequestContext context =
                new TestMarinerRequestContext();


        // =====================================================================
        //   Create Mocks
        // =====================================================================

        final MarinerPageContextMock pageContextMock =
                new MarinerPageContextMock("pageContextMock",
                        expectations);

        final ProjectManagerMock projectManagerMock =
                new ProjectManagerMock("projectManagerMock", expectations);

        ProjectStack projectStack = new ProjectStack();

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

        pageContextMock.expects.getRequestURL(false).returns(null);
        pageContextMock.fuzzy.setBaseURLProvider(
                mockFactory.expectsInstanceOf(BaseURLTracker.class));
        pageContextMock.expects.getProjectManager()
                .returns(projectManagerMock).any();
        pageContextMock.expects.getProjectStack().returns(projectStack).any();

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

        ContextInternals.setMarinerPageContext(context, pageContextMock);
       
        AbstractMarlinContentHandler defaultHandler = new TestHandler() {
            // Javadoc inherited from MarlinContentHandler interface
            public void setInitialRequestContext(
                    MarinerRequestContext requestContext) {
                calledMethod.setValue(true);
                assertSame("Unexpected value for request context.",
                        context, requestContext);
            }
        };       
       
        NamespaceSwitchContentHandler handler =
                new NamespaceSwitchContentHandler(defaultHandler);
        handler.setInitialRequestContext(context);
       
        assertTrue("Expected method to be invoked.", calledMethod.getValue());
    }
View Full Code Here

    /**
     * Test the method setDocumentLocator    
     */
    public void testSetDocumentLocator() throws Exception {
        final BooleanWrapper calledMethod = new BooleanWrapper(false);
        final LocatorImpl locatorImpl = new LocatorImpl();
       
        AbstractMarlinContentHandler defaultHandler = new TestHandler() {
            // Javadoc inherited from ContentHandler interface
            public void setDocumentLocator(Locator locator) {
                calledMethod.setValue(true);
                assertSame("Unexpected value for Locator.",
                        locatorImpl, locator);
                this.locator = locator;
            }
        };
       
        NamespaceSwitchContentHandler handler =
                new NamespaceSwitchContentHandler(defaultHandler);
        handler.setDocumentLocator(locatorImpl);
       
        assertTrue("Expected method to be invoked.", calledMethod.getValue());
        assertSame("Unexpected value for Locator.",
                locatorImpl, handler.getDocumentLocator());
    }
View Full Code Here

    /**
     * Test the method startDocument.    
     */
    public void testStartDocument() throws Exception {
        final BooleanWrapper calledMethod = new BooleanWrapper(false);
       
        AbstractMarlinContentHandler defaultHandler = new TestHandler() {
            // Javadoc inherited from ContentHandler interface
            public void startDocument() throws SAXException {
                calledMethod.setValue(true);
            }
        };
       
        NamespaceSwitchContentHandler handler =
                new NamespaceSwitchContentHandler(defaultHandler);
        handler.startDocument();
       
        assertTrue("Expected method to be invoked.", calledMethod.getValue());
    }
View Full Code Here

    /**
     * Test the method endDocument    
     */
    public void testEndDocument() throws Exception {
        final BooleanWrapper calledMethod = new BooleanWrapper(false);

        AbstractMarlinContentHandler defaultHandler = new TestHandler() {
            // Javadoc inherited from ContentHandler interface
            public void endDocument() throws SAXException {
                calledMethod.setValue(true);
            }
        };

        NamespaceSwitchContentHandler handler =
                new NamespaceSwitchContentHandler(defaultHandler);
        handler.endDocument();

        assertTrue("Expected method to be invoked.", calledMethod.getValue());
    }
View Full Code Here

TOP

Related Classes of com.volantis.synergetics.BooleanWrapper

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.