Ejemplo n.º 1
0
 @Test
 public void testResponseHeaders() {
   addSnippetParam("CommunityService.communityUuid", community.getCommunityUuid());
   JavaScriptPreviewPage previewPage = executeSnippet(SNIPPET_ID);
   List jsonList = previewPage.getJsonList();
   Assert.assertTrue("Promise chaining failed", !jsonList.isEmpty());
 }
  @Test
  public void testGetUpdatesFromACommunity() {
    String commId = communitiesTest.getCommunity().getCommunityUuid();
    createEntry("urn:lsid:lconn.ibm.com:communities.community:" + commId, "@all", "@all");

    addSnippetParam("CommunityService.communityUuid", commId);
    JavaScriptPreviewPage previewPage = executeSnippet(SNIPPET_ID);
    List jsonList = previewPage.getJsonList();
    Assert.assertFalse("GetUpdatesFromACommunity returned no results", jsonList.isEmpty());
  }
Ejemplo n.º 3
0
 @Test
 public void testBaseServiceEndpoint() {
   JavaScriptPreviewPage previewPage = executeSnippet(SNIPPET_ID);
   List jsonList = previewPage.getJsonList();
   Assert.assertEquals(2, jsonList.size());
   JsonJavaObject json = (JsonJavaObject) jsonList.get(0);
   Assert.assertEquals("connections", json.getJsonObject("endpoint").getString("name"));
   json = (JsonJavaObject) jsonList.get(1);
   Assert.assertEquals("connections", json.getJsonObject("endpoint").getString("name"));
 }
Ejemplo n.º 4
0
  @Test
  public void testCommunity() {
    AuthType authType = getEnvironment().isSmartCloud() ? AuthType.AUTO_DETECT : AuthType.NONE;
    setAuthType(authType);
    addSnippetParam("CommunityService.communityUuid", community.getCommunityUuid());

    JavaScriptPreviewPage previewPage = executeSnippet(SNIPPET_ID);

    List jsonList = previewPage.getJsonList();
    for (int i = 0; i < jsonList.size(); i++) {
      assertCommunityValid((JsonJavaObject) jsonList.get(i));
    }
  }
Ejemplo n.º 5
0
 @Test
 @Ignore
 public void testBaseEntity() {
   JavaScriptPreviewPage previewPage = executeSnippet(SNIPPET_ID);
   List jsonList = previewPage.getJsonList();
   for (int i = 0; i < jsonList.size(); i++) {
     JsonJavaObject json = (JsonJavaObject) jsonList.get(i);
     Iterator<String> properties = json.getProperties();
     if (properties.hasNext() && Results[i][1] != null) {
       String property = properties.next();
       Object value = json.get(property);
       Assert.assertEquals(Results[i][0], property);
       Assert.assertEquals(
           "Match failed [" + i + "] name:" + property + " type:" + value.getClass(),
           Results[i][1],
           value);
     }
   }
 }