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

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


  static final String SNIPPET_ID = "Social_Profiles_SmartCloud_API_GetContactByGUID";

  @Test
  public void testGetContactByGUID() {
    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 testProfileFeedJsonDataHandler() {
        JavaScriptPreviewPage previewPage = executeSnippet(SNIPPET_ID);
        List jsonList = previewPage.getJsonList();
        Assert.assertEquals(2, jsonList.size());
      JsonJavaObject json0 = (JsonJavaObject)jsonList.get(0);
      JsonJavaObject json1 = (JsonJavaObject)jsonList.get(1);
     
      Assert.assertEquals("na.collabserv.com:contact:966797", json0.getString("entityId"));
      Assert.assertEquals("na.collabserv.com:contact:966800", json1.getString("entityId"));
     
        Assert.assertEquals("Technical Sales Manager, WorldWide Team.", json0.getString("title"));
        Assert.assertEquals("https://apps.na.collabserv.com/contacts/contacts/view/966797", json0.getString("profileUrl"));
        Assert.assertEquals("https://apps.na.collabserv.com/contacts/contacts/view/966800", json1.getString("profileUrl"));
       
        Assert.assertEquals("Alan Goodwin", json0.getString("name"));
        Assert.assertEquals("Philippe Riand", json1.getString("name"));
       
        Assert.assertEquals(false, json0.getBoolean("thumbnailUrlB"));
        Assert.assertEquals(true, json0.getBoolean("emailB"));
        Assert.assertEquals(true, json0.getBoolean("addressB"));
        Assert.assertEquals(false, json1.getBoolean("thumbnailUrlB"));
        Assert.assertEquals(true, json1.getBoolean("emailB"));
        Assert.assertEquals(false, json1.getBoolean("addressB"));
       
        List jArray = new ArrayList();
        jArray.add("IBM Test - SDK Renovations");
        Assert.assertEquals(jArray, (List)json0.get("departmentA"));
        Assert.assertEquals(jArray, (List)json1.get("departmentA"));
        jArray.clear();
    }
View Full Code Here

      addSnippetParam("sample.email2", getProperty("sample.email2"));
      JavaScriptPreviewPage previewPage = executeSnippet(SNIPPET_ID);      
        List jsonList = previewPage.getJsonList();
        Assert.assertFalse("Create tags returned no results", jsonList.isEmpty());
        for (int i=0; i<jsonList.size(); i++) {
            JsonJavaObject json = (JsonJavaObject)jsonList.get(i);
            Assert.assertFalse("Created tags do not match the expected tag values", "testTag1".equals(json.getString("getTerm")) || "testTag2".equals(json.getString("getTerm")));          
        }
    }
View Full Code Here

     
        addSnippetParam("CommunityService.communityUuid", community.getCommunityUuid());
        addSnippetParam("CommunityService.inviteeUuid", invite.getInviteeUuid());
       
        JavaScriptPreviewPage previewPage = executeSnippet(SNIPPET_ID);
        JsonJavaObject json = previewPage.getJson();
        Assert.assertNull("Unexpected error detected on page", json.getString("code"));
        String inviteUuid = community.getCommunityUuid() + "-" + invite.getInviteeUuid();
        Assert.assertEquals(inviteUuid, json.getString("inviteUuid"));
    }
View Full Code Here

    public void testUpdateTagsInvalidSourceUser() {   
      addSnippetParam("sample.email1", "");
      addSnippetParam("sample.email2", getProperty("sample.id2"));
           
        JavaScriptPreviewPage previewPage = executeSnippet(SNIPPET_ID);
        JsonJavaObject json = previewPage.getJson();
        Assert.assertEquals(400, json.getInt("code"));
    }
View Full Code Here

     
        addSnippetParam("CommunityService.communityUuid", "foo");
        addSnippetParam("CommunityService.inviteeUuid", invite.getInviteeUuid());
       
        JavaScriptPreviewPage previewPage = executeSnippet(SNIPPET_ID);
        JsonJavaObject json = previewPage.getJson();
        Assert.assertEquals(500, json.getAsInt("code"));
        Assert.assertEquals("Error generating atom document.", json.getString("message"));
    }
View Full Code Here

    public void testUpdateTagsInvalidTargetUser() {   
      addSnippetParam("sample.email1", getProperty("sample.id1"));
      addSnippetParam("sample.email2", "");
           
        JavaScriptPreviewPage previewPage = executeSnippet(SNIPPET_ID);
        JsonJavaObject json = previewPage.getJson();
        Assert.assertEquals(400, json.getInt("code"));
    }
View Full Code Here

     
        addSnippetParam("CommunityService.communityUuid", "");
        addSnippetParam("CommunityService.inviteeUuid", invite.getInviteeUuid());
       
        JavaScriptPreviewPage previewPage = executeSnippet(SNIPPET_ID);
        JsonJavaObject json = previewPage.getJson();
        Assert.assertEquals(400, json.getAsInt("code"));
        Assert.assertEquals("Invalid argument, invite with community UUID must be specified.", json.getString("message"));
    }
View Full Code Here

     
        addSnippetParam("CommunityService.communityUuid", community.getCommunityUuid());
        addSnippetParam("CommunityService.inviteeUuid", "foo");
       
        JavaScriptPreviewPage previewPage = executeSnippet(SNIPPET_ID);
        JsonJavaObject json = previewPage.getJson();
        Assert.assertEquals(400, json.getAsInt("code"));
        Assert.assertEquals("Unknown user.", json.getString("message"));
    }
View Full Code Here

     
        addSnippetParam("CommunityService.communityUuid", community.getCommunityUuid());
        addSnippetParam("CommunityService.inviteeUuid", "");
       
        JavaScriptPreviewPage previewPage = executeSnippet(SNIPPET_ID);
        JsonJavaObject json = previewPage.getJson();
        Assert.assertEquals(400, json.getAsInt("code"));
        Assert.assertEquals("Invalid argument, invite with email or userid or invitee must be specified.", json.getString("message"));
    }
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.