Package com.ibm.commons.util.io.json

Examples of com.ibm.commons.util.io.json.JsonJavaObject


        addSnippetParam("CommunityService.communityUuid", community.getCommunityUuid());
        addSnippetParam("sample.communityTitle", duplicateTitle);
        addSnippetParam("sample.communityContent", updatedContent);

        JavaScriptPreviewPage previewPage = executeSnippet(SNIPPET_ID);
        JsonJavaObject json = previewPage.getJson();
        Assert.assertEquals(409, json.getInt("code"));
        Assert.assertEquals("A community with the requested name already exists, choose a different name and resubmit.", json.getString("message"));
       
    deleteCommunity(community2);
    }
View Full Code Here


        addSnippetParam("CommunityService.communityUuid", "Foo");
        addSnippetParam("sample.communityTitle", "Foo");
        addSnippetParam("sample.communityContent", "Foo");
       
        JavaScriptPreviewPage previewPage = executeSnippet(SNIPPET_ID);
        JsonJavaObject json = previewPage.getJson();
        Assert.assertTrue("Invalid return code, expected 404 or 500", json.getInt("code") == 404 || json.getInt("code") == 500); // TODO 500 OK because of issue in SmartCloud
        String errorMessage  =  json.getString("message");
        boolean isMessageValid = errorMessage.contains("The referenced community does not exist.") || errorMessage.contains("Error generating atom document.");
        Assert.assertTrue("expected message different than "+errorMessage, isMessageValid);
    }
View Full Code Here

    public void testGetCommunityError() {
        addSnippetParam("CommunityService.communityUuid", "Foo");
       
        JavaScriptPreviewPage previewPage = executeSnippet(SNIPPET_ID);
        List jsonList = previewPage.getJsonList();
        JsonJavaObject json = (JsonJavaObject)jsonList.get(0);
        Assert.assertEquals(404, json.getInt("code"));
        Assert.assertEquals("The community which this resource or page is associated with does not exist.", json.getString("message"));
    }
View Full Code Here

    public void testGetCommunityInvalidArg() {
        addSnippetParam("CommunityService.communityUuid", "");
       
        JavaScriptPreviewPage previewPage = executeSnippet(SNIPPET_ID);
        List jsonList = previewPage.getJsonList();
        JsonJavaObject json = (JsonJavaObject)jsonList.get(0);
        Assert.assertEquals(400, json.getInt("code"));
        Assert.assertEquals("Invalid argument, expected communityUuid.", json.getString("message"));
    }
View Full Code Here

    static final String SNIPPET_ID = "Social_Profiles_API_CreateProfile";
       
    @Test
    public void testCreateProfileWithMissingInputs() {             
      JavaScriptPreviewPage previewPage = executeSnippet(SNIPPET_ID);
        JsonJavaObject json = previewPage.getJson();       
        Assert.assertEquals(400, json.getInt("code"));
        Assert.assertEquals("Invalid argument, profile with valid userid or email must be specified.", json.getString("message"));
    }
View Full Code Here

    static final String SNIPPET_ID = "Social_Profiles_SmartCloud_API_TestNumberJsonDataHandler";

    @Test
    public void testProfileEntryJsonDataHandler() {
        JavaScriptPreviewPage previewPage = executeSnippet(SNIPPET_ID);
        JsonJavaObject json = previewPage.getJson();
       
        Assert.assertEquals(123, json.getInt("number"));
        Assert.assertEquals(12.12, json.getDouble("decimalNumber"),0.01);
        Assert.assertEquals(234, json.getInt("stringNumber"));
        Assert.assertEquals(4, json.getInt("array"));
        //commenting out the below tests, because the jsonBeanStringify is currently not adding the NaN values in the json response.
//        Assert.assertEquals(Double.NaN, json.getAsInt("notANumber"),0.01);
//        Assert.assertEquals(Double.NaN, json.getAsInt("notANumber1"),0.01);
    }
View Full Code Here

  static final String SNIPPET_ID = "Social_Profiles_SmartCloud_API_GetProfileByGUID";

  @Test
  public void testGetProfileByGUID() throws SBTServiceException {
    JavaScriptPreviewPage previewPage = executeSnippet(SNIPPET_ID);
    JsonJavaObject json = previewPage.getJson();
    Assert.assertFalse("Get Profile  returned no results", json.isEmpty());
  }
View Full Code Here

    static final String SNIPPET_ID = "Social_Profiles_SmartCloud_API_GetMyProfile";

    @Test
    public void testGetMyProfile() throws SBTServiceException {
        JavaScriptPreviewPage previewPage = executeSnippet(SNIPPET_ID);
        JsonJavaObject json = previewPage.getJson();
        Assert.assertFalse("Get Profile  returned no results", json.isEmpty());
    }
View Full Code Here

    }

    @Test
    public void testOrgIdRegression() throws SBTServiceException {
        JavaScriptPreviewPage previewPage = executeSnippet(SNIPPET_ID);
        JsonJavaObject json = previewPage.getJson();
        Assert.assertFalse("Get Profile  returned no results", json.isEmpty());
        String orgId = json.getString("getOrgId");
        Assert.assertFalse(Integer.valueOf(orgId) == 0);
    }
View Full Code Here

    static final String SNIPPET_ID = "Social_Profiles_SmartCloud_API_ProfileEntryJsonDataHandler";

    @Test
    public void testProfileEntryJsonDataHandler() {
        JavaScriptPreviewPage previewPage = executeSnippet(SNIPPET_ID);
        JsonJavaObject json = previewPage.getJson();
       
        Assert.assertEquals("na.collabserv.com:user:20547574", json.getString("entityId"));
       
        Assert.assertEquals("Sales Executive", json.getString("title"));
        Assert.assertEquals("https://apps.na.collabserv.com/contacts/profiles/view/20547574", json.getString("profileUrl"));
        Assert.assertEquals("Frank Adams", json.getString("name"));
       
       
        Assert.assertEquals(true, json.getBoolean("thumbnailUrlB"));
        Assert.assertEquals(true, json.getBoolean("emailB"));
        Assert.assertEquals(true, json.getBoolean("addressB"));
       
        Assert.assertEquals(45609, json.getInt("phoneNumber"));
        Assert.assertEquals(20542369, json.getInt("organisationIdN"));
       
        ArrayList jArray = new ArrayList();
        jArray.add("IBM Test - SDK Renovations");
        Assert.assertEquals(jArray, (List)json.get("departmentA"));
        jArray.clear();
        jArray.add("US");
        Assert.assertEquals(jArray, (List)json.get("countryA"));
        jArray.clear();
        jArray.add("Sales Executive IBM Collaboration Software");
        Assert.assertEquals(jArray, (List)json.get("aboutA"));
    }
View Full Code Here

TOP

Related Classes of com.ibm.commons.util.io.json.JsonJavaObject

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.