Package net.minidev.json

Examples of net.minidev.json.JSONObject.containsKey()


        logger.info("this is an info message with user fields");
        String message = appender.getMessages()[0];
        Assert.assertTrue("Event is not valid JSON", JSONValue.isValidJsonStrict(message));
        Object obj = JSONValue.parse(message);
        JSONObject jsonObject = (JSONObject) obj;
        Assert.assertTrue("Event does not contain field 'field1'" , jsonObject.containsKey("field1"));
        Assert.assertEquals("Event does not contain value 'value1'", "value1", jsonObject.get("field1"));

        layout.setUserFields(prevUserData);
    }
View Full Code Here


        logger.info("this is an info message with user fields");
        String message = appender.getMessages()[0];
        Assert.assertTrue("Event is not valid JSON", JSONValue.isValidJsonStrict(message));
        Object obj = JSONValue.parse(message);
        JSONObject jsonObject = (JSONObject) obj;
        Assert.assertTrue("Event does not contain field 'field2'" , jsonObject.containsKey("field2"));
        Assert.assertEquals("Event does not contain value 'value2'", "value2", jsonObject.get("field2"));
        Assert.assertTrue("Event does not contain field 'field3'" , jsonObject.containsKey("field3"));
        Assert.assertEquals("Event does not contain value 'value3'", "value3", jsonObject.get("field3"));

        layout.setUserFields(prevUserData);
View Full Code Here

        Assert.assertTrue("Event is not valid JSON", JSONValue.isValidJsonStrict(message));
        Object obj = JSONValue.parse(message);
        JSONObject jsonObject = (JSONObject) obj;
        Assert.assertTrue("Event does not contain field 'field2'" , jsonObject.containsKey("field2"));
        Assert.assertEquals("Event does not contain value 'value2'", "value2", jsonObject.get("field2"));
        Assert.assertTrue("Event does not contain field 'field3'" , jsonObject.containsKey("field3"));
        Assert.assertEquals("Event does not contain value 'value3'", "value3", jsonObject.get("field3"));

        layout.setUserFields(prevUserData);
    }
View Full Code Here

        logger.info("this is an info message with user fields");
        String message = appender.getMessages()[0];
        Assert.assertTrue("Event is not valid JSON", JSONValue.isValidJsonStrict(message));
        Object obj = JSONValue.parse(message);
        JSONObject jsonObject = (JSONObject) obj;
        Assert.assertTrue("Event does not contain field 'field1'" , jsonObject.containsKey("field1"));
        Assert.assertEquals("Event does not contain value 'propval1'", "propval1", jsonObject.get("field1"));

        layout.setUserFields(prevUserData);
        System.clearProperty(JSONEventLayoutV1.ADDITIONAL_DATA_PROPERTY);
View Full Code Here

        logger.info("this is a test message");
        String message = appender.getMessages()[0];
        Object obj = JSONValue.parse(message);
        JSONObject jsonObject = (JSONObject) obj;
        for (String fieldName : logstashFields) {
            Assert.assertTrue("Event does not contain field: " + fieldName, jsonObject.containsKey(fieldName));
        }
    }

    @Test
    public void testJSONEventLayoutHasNDC() {
View Full Code Here


  public void testToClaimsRequestJSON() {

    JSONObject o = OIDCScopeValue.OPENID.toClaimsRequestJSONObject();
    assertTrue(o.containsKey("sub"));
    assertTrue((Boolean)((JSONObject)o.get("sub")).get("essential"));
    assertEquals(1, o.size());

    o = OIDCScopeValue.PROFILE.toClaimsRequestJSONObject();
    assertTrue(o.containsKey("name"));
View Full Code Here

    assertTrue(o.containsKey("sub"));
    assertTrue((Boolean)((JSONObject)o.get("sub")).get("essential"));
    assertEquals(1, o.size());

    o = OIDCScopeValue.PROFILE.toClaimsRequestJSONObject();
    assertTrue(o.containsKey("name"));
    assertNull(o.get("name"));
    assertTrue(o.containsKey("family_name"));
    assertNull(o.get("family_name"));
    assertTrue(o.containsKey("given_name"));
    assertNull(o.get("given_name"));
View Full Code Here

    assertEquals(1, o.size());

    o = OIDCScopeValue.PROFILE.toClaimsRequestJSONObject();
    assertTrue(o.containsKey("name"));
    assertNull(o.get("name"));
    assertTrue(o.containsKey("family_name"));
    assertNull(o.get("family_name"));
    assertTrue(o.containsKey("given_name"));
    assertNull(o.get("given_name"));
    assertTrue(o.containsKey("middle_name"));
    assertNull(o.get("middle_name"));
View Full Code Here

    o = OIDCScopeValue.PROFILE.toClaimsRequestJSONObject();
    assertTrue(o.containsKey("name"));
    assertNull(o.get("name"));
    assertTrue(o.containsKey("family_name"));
    assertNull(o.get("family_name"));
    assertTrue(o.containsKey("given_name"));
    assertNull(o.get("given_name"));
    assertTrue(o.containsKey("middle_name"));
    assertNull(o.get("middle_name"));
    assertTrue(o.containsKey("nickname"));
    assertNull(o.get("nickname"));
View Full Code Here

    assertNull(o.get("name"));
    assertTrue(o.containsKey("family_name"));
    assertNull(o.get("family_name"));
    assertTrue(o.containsKey("given_name"));
    assertNull(o.get("given_name"));
    assertTrue(o.containsKey("middle_name"));
    assertNull(o.get("middle_name"));
    assertTrue(o.containsKey("nickname"));
    assertNull(o.get("nickname"));
    assertTrue(o.containsKey("preferred_username"));
    assertNull(o.get("preferred_username"));
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.