Package com.jaxws.json.codec.decode

Examples of com.jaxws.json.codec.decode.JSONReader


public class WSJSONPopulatorTest extends TestCase {

  public void testPopulatePrimitive() throws Exception{
   
    WSJSONPopulator populator = new WSJSONPopulator(null, null, null, null, null);
    JSONReader r = new JSONReader();
    TestClass object = new TestClass();
    populator.populateObject(object, (Map) r.read("{\"name\":\"nm\"}"), null, null);
    assertEquals(object.name, "nm");
    assertEquals(object.values, null);
   
    populator.populateObject(object, (Map) r.read("{\"integer\":\"24\"}"), null, null);
    assertEquals(object.integer, 24);
    assertEquals(object.values, null);
  }
View Full Code Here


  }
 
  public void testList() throws Exception{
   
    WSJSONPopulator populator = new WSJSONPopulator(null, null, null, null, null);
    JSONReader r = new JSONReader();
    TestClass object = new TestClass();
    populator.populateObject(object, (Map) r.read("{\"values\":[\"nm\"]}"), null, null);
    assertEquals(object.name, null);
    assertEquals(object.values.size(), 1);
    assertEquals(object.values.get(0), "nm");
   
    // empty list
    populator.populateObject(object, (Map) r.read("{\"values\":[]}"), null, null);
    assertNotNull(object.values);
    assertEquals(object.values.size(), 0);
  }
View Full Code Here

  public String getContentType() {
    return "application/json; charset=\"utf-8\"";
  }

  public void process() {
    JSONReader       reader   = new JSONReader();
    @SuppressWarnings("unchecked")
    Map<String,Object>   doc   = (Map<String,Object>)reader.read(
        WSJSONWriter.writeMetadata(getMetadataModelMap(this.codec.getEndpoint(),true),
            this.codec.getCustomSerializer()));
    StringBuffer     buffer   = new StringBuffer();
    getJQTree(doc, buffer,0);
    endPointDocuments.put(this.codec.getEndpoint().getServiceName(),buffer.toString());
View Full Code Here

TOP

Related Classes of com.jaxws.json.codec.decode.JSONReader

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.