Package net.buffalo.protocal.io

Examples of net.buffalo.protocal.io.StreamReader


 
  public void testUnmarshallingBigDecimal() throws Exception {
    StringReader reader = new StringReader("<buffalo-call><map><type>java.math.BigDecimal</type>" +
        "<string>value</string>" +
        "<string>123.456</string></map></buffalo-call>");
    StreamReader streamReader = new FastStreamReader(reader);
    unmarshallingContext = new DefaultUnmarshallingContext(new DefaultConverterLookup(), streamReader);
    BigDecimal number = (BigDecimal) unmarshallingContext.convertAnother();
    assertEquals(new BigDecimal("123.456"), number);
  }
View Full Code Here


 
  public void testUnmarshallingBigInteger() throws Exception {
    StringReader reader = new StringReader("<buffalo-call><map><type>java.math.BigInteger</type>" +
        "<string>value</string>" +
        "<string>123</string></map></buffalo-call>");
    StreamReader streamReader = new FastStreamReader(reader);
    unmarshallingContext = new DefaultUnmarshallingContext(new DefaultConverterLookup(), streamReader);
    BigInteger number = (BigInteger) unmarshallingContext.convertAnother();
    assertEquals(new BigInteger("123"), number);
  }
View Full Code Here

            "</list></map></map>";
    String toString = stringWriter.getBuffer().toString();
 
    assertEquals(string, toString);
   
    StreamReader streamReader = TestUtils.createStreamReader(string);
    unmashallingContext = new DefaultUnmarshallingContext(converterLookup, streamReader);
    Map map = (Map) converter.unmarshal(streamReader, unmashallingContext);
   
    assertNotNull(map);
    assertEquals("integer value", map.get(new Integer(100)));
View Full Code Here

    "<type>java.util.HashMap</type>" +
    "<string>string</string>" +
    "<string>value</string>" +
    "</map>";
   
    StreamReader streamReader = TestUtils.createStreamReader(mapstr);
    unmashallingContext = new DefaultUnmarshallingContext(converterLookup, streamReader);
    HashMap map = (HashMap) converter.unmarshal(streamReader, unmashallingContext);
    assertNotNull(map);
    assertEquals("value", map.get("string"));
  }
View Full Code Here

    "<type></type>" +
    "<string>string</string>" +
    "<string>value</string>" +
    "</map>";
   
    StreamReader streamReader = TestUtils.createStreamReader(mapstr);
    unmashallingContext = new DefaultUnmarshallingContext(converterLookup, streamReader);
    HashMap map = (HashMap) converter.unmarshal(streamReader, unmashallingContext);
    assertNotNull(map);
   
    assertEquals("value", map.get("string"));
View Full Code Here

    assertEquals("value", map.get("string"));
  }
 
  public void testCanDeserializeSqlDate() throws Exception {
    String str = "<map><type>java.sql.Date</type><string>value</string><date>20061001T000000Z</date></map>";
    StreamReader streamReader = TestUtils.createStreamReader(str);
    unmashallingContext = new DefaultUnmarshallingContext(converterLookup, streamReader);
   
    java.sql.Date date = (java.sql.Date)converter.unmarshal(streamReader, unmashallingContext);
    assertNotNull(date);
   
View Full Code Here

            "<boolean>0</boolean>" +
            "<string>friend</string>" +
            "<null></null>" +
            "</map>";
   
    StreamReader streamReader = TestUtils.createStreamReader(string);
    unmashallingContext = new DefaultUnmarshallingContext(converterLookup, streamReader);
   
    People people = (People)converter.unmarshal(streamReader, unmashallingContext);
    assertNotNull(people);
    assertNull(people.getName());
View Full Code Here

        "<int>0</int>" +
        "<string>sex</string>" +
        "<boolean>0</boolean>" +
        "<string>friend</string>" +
        "<null></null></map>";
    StreamReader streamReader = TestUtils.createStreamReader(string);
    unmashallingContext = new DefaultUnmarshallingContext(converterLookup, streamReader);
   
    BirthdayPeople people = (BirthdayPeople)converter.unmarshal(streamReader, unmashallingContext);
    assertNotNull(people);
    assertNull(people.getName());
View Full Code Here

    assertEquals(2, array[0].length);
   
  }
 
  private Object unmarshal(String source) {
    StreamReader streamReader = TestUtils.createStreamReader(source);
    unmarshallingContext = new DefaultUnmarshallingContext(converterLookup, streamReader);
    return cd.unmarshal(streamReader, unmarshallingContext);
  }
View Full Code Here

import net.buffalo.protocal.io.UnmarshallingContext;

public class DeserializerTest extends TestCase {
 
  public void testShouldGetCorrectType() throws Exception {
    StreamReader streamReader = TestUtils.createStreamReader("<buffalo-call><string>hi</string></buffalo-call>");
    UnmarshallingContext des = new DefaultUnmarshallingContext(new DefaultConverterLookup(), streamReader);
    Object o = des.convertAnother();
    assertEquals("hi", o);
  }
View Full Code Here

TOP

Related Classes of net.buffalo.protocal.io.StreamReader

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.