Package net.buffalo.protocal.io

Examples of net.buffalo.protocal.io.DefaultUnmarshallingContext


  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

    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)));
    Map nestedMap = (Map) map.get("nestedMap");
View Full Code Here

    "<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

    "<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

  }
 
  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);
   
    assertEquals(1, unmashallingContext.getObjects().size());
View Full Code Here

            "<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());
    assertEquals(0, people.getAge());
View Full Code Here

        "<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());
    assertEquals(0, people.getAge());
View Full Code Here

   
  }
 
  private Object unmarshal(String source) {
    StreamReader streamReader = TestUtils.createStreamReader(source);
    unmarshallingContext = new DefaultUnmarshallingContext(converterLookup, streamReader);
    return cd.unmarshal(streamReader, unmarshallingContext);
  }
View Full Code Here

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.DefaultUnmarshallingContext

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.