Package com.volantis.mcs.protocols

Examples of com.volantis.mcs.protocols.MenuItem


        menuAttrs.setHelp(new LiteralTextAssetReference("<help>Please select an option from the menu</help>"));
        menuAttrs.setPrompt(new LiteralTextAssetReference("<prompt>Welcome home.<enumerate>For <value " +
                            "expr=\"_prompt\"/>, press <value expr=\"_dtmf\"/> or say " +
                            "<value expr=\"_prompt\"/></enumerate></prompt>"));

        MenuItem item1 = new MenuItem();
        item1.setText("Sports News");
        item1.setHref("http://www.volantis.com:8080/volantis/sports.jsp");
        menuAttrs.addItem(item1);

        MenuItem item2 = new MenuItem();
        item2.setText("Astrology");
        item2.setHref("http://www.volantis.com:8080/volantis/astrology.jsp");
        item2.setPrompt(new LiteralTextAssetReference("<prompt><audio src=\"rtsp://www.volantis.com/" +
                        "mysticmeg.wav\">Mystic Megs Astrology</audio></prompt>"));
        menuAttrs.addItem(item2);

        MenuItem item3 = new MenuItem();
        item3.setText("Fun and Games");
        item3.setHref("http://www.volantis.com:8080/volantis/games.jsp");
        item3.setShortcut(new LiteralTextAssetReference("9"));
        menuAttrs.addItem(item3);

        protocol.doMenu(menuAttrs);

        String actual = DOMUtilities.toString(
View Full Code Here


        TestMarinerPageContext context = new TestMarinerPageContext();
        protocol.setMarinerPageContext(context);

        XMLReader reader = DOMUtilities.getReader();

        MenuItem item1 = new MenuItem();
        item1.setText("Website Index.");
        item1.setHref("http://www.volantis.com/index.jsp");
        item1.setShortcut(new LiteralTextAssetReference("9"));
        MenuAttributes attributes = new MenuAttributes();
        attributes.setManualDTMF(true);
        protocol.doMenuItem(buffer, attributes, item1);
        String actual = DOMUtilities.toString(
                buffer.getRoot(), protocol.getCharacterEncoder());

        String expected = "<choice next=\"http://www.volantis.com/index." +
                "jsp\" dtmf=\"9\">Website Index.</choice>";
        Document expectedDom = DOMUtilities.read(reader, expected);
        String expectedDOMAsString =
                DOMUtilities.toString(
                        expectedDom, protocol.getCharacterEncoder());

        assertEquals("the processed DOM is not as expected.",
                     expectedDOMAsString, actual);


        // Same again but with manualDTMF set to false.
        buffer = getNewDOMOutputBuffer();
        expected = "<choice next=\"http://www.volantis.com/index.jsp\">" +
                "Website Index.</choice>";
        expectedDom = DOMUtilities.read(reader, expected);
        expectedDOMAsString = DOMUtilities.toString(
                expectedDom, protocol.getCharacterEncoder());

        attributes.setManualDTMF(false);
        protocol.doMenuItem(buffer, attributes, item1);
        actual = DOMUtilities.toString(
                buffer.getRoot(), protocol.getCharacterEncoder());

        assertEquals("the processed DOM is not as expected.",
                     expectedDOMAsString, actual);


        // With a prompt in the source this time.  Demonstrates that the text
        // attribute is overriden by the prompt attribute.
        buffer = getNewDOMOutputBuffer();
        MenuItem item2 = new MenuItem();
        item2.setText("Website Index.");
        item2.setHref("http://www.volantis.com/index.jsp");
        item2.setPrompt(new LiteralTextAssetReference("<prompt><audio src=\"rtsp://www.volantis" +
                        ".com/mysticmeg.wav\">Mystic Megs Astrology</audio>" +
                        "</prompt>"));

        expected = "<choice next=\"http://www.volantis.com/index.jsp\">" +
                "<prompt><audio src=\"rtsp://www.volantis.com/mysticmeg" +
                ".wav\">Mystic Megs Astrology</audio></prompt></choice>";
        expectedDom = DOMUtilities.read(reader, expected);
        expectedDOMAsString = DOMUtilities.toString(
                expectedDom, protocol.getCharacterEncoder());

        attributes.setManualDTMF(true);
        protocol.doMenuItem(buffer, attributes, item2);
        actual = DOMUtilities.toString(
                buffer.getRoot(), protocol.getCharacterEncoder());

        assertEquals("the processed DOM is not as expected.",
                     expectedDOMAsString, actual);

        // Null Href - there should be no output from the doMenuItem method.
        buffer = getNewDOMOutputBuffer();
        MenuItem item3 = new MenuItem();
        item3.setText("Some arbitrary text.");
        item3.setShortcut(new LiteralTextAssetReference("5"));

        expectedDOMAsString = "";

        attributes.setManualDTMF(true);
        protocol.doMenuItem(buffer, attributes, item3);
View Full Code Here

        com.volantis.mcs.protocols.MenuItemCollector mAttrs =
            (com.volantis.mcs.protocols.MenuItemCollector)
            ((MenuItemCollectorContainer)element).getMenuItemCollector();
        Collection c = mAttrs.getItems();
        Iterator itr = c.iterator();
        MenuItem menuItem = (MenuItem) itr.next();
        assertTrue(menuItem.getHref().equals("test://mytest"));
    }
View Full Code Here

TOP

Related Classes of com.volantis.mcs.protocols.MenuItem

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.