Package com.volantis.mcs.wbsax

Examples of com.volantis.mcs.wbsax.StringReference


                } catch (WBSAXException e) {
                    e.printStackTrace();
                    fail("Unable to get string from WBSAXString");
                }
              } else if (p1 instanceof StringReference) {
                  StringReference r1 = (StringReference) p1;
                  TestStringReference r2 = (TestStringReference) p2;
                  if (r1.resolveLogicalIndex() != r2.getLogicalOffset() ||
                          r1.resolvePhysicalIndex().getInteger() != r2.getPhysicalOffset() ||
                          !r1.resolveString().getString().equals(r2.getContents())) {
                      return
                          "Parameter " + i + " does not match (Got " + p1 + ", expected " + p2 + ")";
                  }
              } else {
                  if(!(p1.equals(p2))) {
View Full Code Here


        assertEquals("Wrong url prefix",
                     new WBSAXString(codec, "http://www.my.com/page.jsp"),
                     (WBSAXString)events.next());
       
        // Check jsessionid
        StringReference stringReference1 = (StringReference)events.next();       
        assertEquals("Wrong url jsessionid",
                     new WBSAXString(codec, ";jsessionid=123"),
                     stringReference1.resolveString());
       
        // Check suffix
        assertEquals("Wrong url suffix",
                     new WBSAXString(codec, "?parm=value#ref"),
                     (WBSAXString)events.next());
       
        // Check title
        aStartCode = (AttributeStartCode)events.next();
        assertEquals("Wrong AttributeStartCode integer", 0x36,
                     aStartCode.getInteger());
        assertEquals("Wrong AttributeStartCode name", "title",
                     aStartCode.getName());
        assertNull("Wrong AttributeStartCode value prefix",
                   aStartCode.getValuePrefix());
       
        // Check title's value       
        assertEquals("Wrong title",
                     new WBSAXString(codec, "my title"),
                     (WBSAXString)events.next());
       
        // Check href
        aStartCode = (AttributeStartCode)events.next();
        assertEquals("Wrong AttributeStartCode integer", 0x4A,
                     aStartCode.getInteger());
        assertEquals("Wrong AttributeStartCode name", "href",
                     aStartCode.getName());
        assertNull("Wrong AttributeStartCode value prefix",
                   aStartCode.getValuePrefix());
       
        // Check prefix
        assertEquals("Wrong url prefix",
                     new WBSAXString(codec, "http://www.my.com/page2.jsp"),
                     (WBSAXString)events.next());
       
        // Check jsessionid, can now check logical and physical refs to ensure
        // jsession id was added only once to string table
        StringReference stringReference2 = (StringReference)events.next();       
        assertEquals("Wrong logical ref",
                     stringReference1.resolveLogicalIndex(),
                     stringReference2.resolveLogicalIndex());
        assertEquals("Wrong physical ref",
                     stringReference1.resolvePhysicalIndex(),
                     stringReference2.resolvePhysicalIndex());
        assertEquals("Wrong url jsessionid",
                     new WBSAXString(codec, ";jsessionid=123"),
                     stringReference2.resolveString());
       
        // Check suffix
        assertEquals("Wrong url suffix",
                     new WBSAXString(codec, "?parm=value#ref2"),
                events.next());
View Full Code Here

            boolean bufferBefore) throws WBSAXException {
        String xValue = "X";
        String yValue = "Y";
        String volantisValue = "volantis.com/next";
       
        StringReference xRef = null;
        StringReference yRef = null;
        StringReference volantisRef = null;
       
        if (bufferBefore) {
            // These must be created in same order as below.
            volantisRef = references.createReference(volantisValue);
            xRef = references.createReference(xValue);
View Full Code Here

    public void fireEvents(WBSAXContentHandler handler,
            boolean bufferBefore) throws WBSAXException {
        String xValue = "X";
        String yValue = "Y";
       
        StringReference xRef = null;
        StringReference yRef = null;
       
        if (bufferBefore) {
            xRef = references.createReference(xValue);
            yRef = references.createReference(yValue);
            stringTable.markComplete();
View Full Code Here

        // returns the shard link url obtained from the shard link details.
        return new ShardLinkOpaqueValue();
    }

    public int addStringTableEntry(String string) throws SAXException {
        StringReference reference = references.createReference(string);
        return reference.resolveLogicalIndex();
    }
View Full Code Here

    // Inherit Javadoc.
    public void fireEvents(WBSAXContentHandler handler,
            boolean bufferBefore) throws WBSAXException {
        char[] abcValue = "abc".toCharArray();
       
        StringReference abcRef = null;
       
        if (bufferBefore) {
            abcRef = references.createReference(abcValue);
            stringTable.markComplete();
        }
View Full Code Here

    public void fireEvents(WBSAXContentHandler handler,
            boolean bufferBefore) throws WBSAXException {
        char[] abcValue = "abc".toCharArray();
        char[] enterNameValue = " Enter name: ".toCharArray();
       
        StringReference abcRef = null;
        StringReference enterNameRef = null;
       
        if (bufferBefore) {
            abcRef = references.createReference(abcValue);
            enterNameRef = references.createReference(enterNameValue);
            stringTable.markComplete();
View Full Code Here

            WBSAXString prefix = strings.create(splitURL.getPrefix());
            handler.addAttributeValue(prefix);
           
            // If present, add jsessionid to the string table  
            if (splitURL.hasJsessionid()) {
                StringReference jsessionid
                     = references.createReference(splitURL.getJsessionid());
                handler.addAttributeValue(jsessionid);
            }
           
            // If present, add the part of the url after the jsessionid as an
View Full Code Here

            contentHandler.startElement(nameCode, attributes, content);
        } else {
            // There was no code for the element in the token table.
            // So, we fall back to starting the element with a literal
            // name, and hope the device understands it.
            StringReference nameRef =
                    context.getReferences().createReference(name);
            contentHandler.startElement(nameRef, attributes, content);
        }
        if (attributes) {
            contentHandler.startAttributes();
View Full Code Here

    }

    // Inherit Javadoc.
    public String getSharedContentDescription(int index)
            throws DissectionException {
        StringReference reference = inputReferences.createReference(index);
        try {
            StringWriter sw = new StringWriter();
            PrintWriter pw = new PrintWriter(sw);
            reference.accept(new DebugValuePrinter(pw));
            return sw.toString();
        } catch (WBSAXException e) {
            throw new DissectionException(e);
        }
    }
View Full Code Here

TOP

Related Classes of com.volantis.mcs.wbsax.StringReference

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.