Package org.apache.flink.streaming.connectors.json

Examples of org.apache.flink.streaming.connectors.json.JSONParser


  @Test
  public void testGetBooleanFunction() {
    String jsonText = "{\"key\":true}";
    String searchedField = "key";
    try {
      JSONParser parser = new JSONParser(jsonText);
      JSONObject jo = parser.parse(searchedField);

      assertTrue(jo.getBoolean("retValue"));
    }
    catch (JSONException e) {
      fail();
View Full Code Here


  public void testGetDoubleFunction() {
    double expected = 12345.12345;
    String jsonText = "{\"key\":" + expected + "}";
    String searchedField = "key";
    try {
      JSONParser parser = new JSONParser(jsonText);
      JSONObject jo = parser.parse(searchedField);

      assertEquals(expected,jo.getDouble("retValue"),0.000001);
    }
    catch (JSONException e) {
      fail();
View Full Code Here

  public void testGetIntFunction() {
    int expected = 15;
    String jsonText = "{\"key\":" + expected + "}";
    String searchedField = "key";
    try {
      JSONParser parser = new JSONParser(jsonText);
      JSONObject jo = parser.parse(searchedField);

      assertEquals(expected,jo.getInt("retValue"));
    }
    catch (JSONException e) {
      fail();
View Full Code Here

  public void testGetLongFunction() {
    long expected = 111111111111L;
    String jsonText = "{\"key\":" + expected + "}";
    String searchedField = "key";
    try {
      JSONParser parser = new JSONParser(jsonText);
      JSONObject jo = parser.parse(searchedField);

      assertEquals(expected,jo.getLong("retValue"));
    }
    catch (JSONException e) {
      fail();
View Full Code Here

  }

  @Test
  public void test() {
    try {
      JSONParser parser = new JSONParser(jsonText);
      JSONObject jo = parser.parse(searchedField);
      String expected = "{\"retValue\":\"value\"}";

      assertTrue(expected.equals(jo.toString()));
    }
    catch (JSONException e) {
View Full Code Here

TOP

Related Classes of org.apache.flink.streaming.connectors.json.JSONParser

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.