@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()); }
@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")); }
@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)); } }
@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); } } }