コード例 #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());
 }
コード例 #2
0
ファイル: BaseApiTest.java プロジェクト: sbasegmez/SocialSDK
 /**
  * @param snippetId
  * @return
  */
 public JavaScriptPreviewPage executeSnippet(String snippetId, long delay) {
   this.snippetId = snippetId;
   ResultPage resultPage = launchSnippet(snippetId, authType, delay);
   JavaScriptPreviewPage previewPage = new JavaScriptPreviewPage(resultPage);
   Trace.log(previewPage.getText());
   return previewPage;
 }
コード例 #3
0
 @Test
 public void testGetActivity() {
   JavaScriptPreviewPage previewPage = executeSnippet(SNIPPET_ID);
   JsonJavaObject json = previewPage.getJson();
   String activityNodeId = json.getAsString("getActivityNodeUuid");
   Assert.assertNotNull(activityNodeId);
 }
コード例 #4
0
 @Test
 public void testProfileCreatePostData() {
   JavaScriptPreviewPage previewPage = executeSnippet(SNIPPET_ID);
   String newPost = previewPage.getWebElement().findElement(By.id("newPost")).getText();
   String newPut = previewPage.getWebElement().findElement(By.id("newPut")).getText();
   Assert.assertNotNull(newPost);
   Assert.assertNotNull(newPut);
 }
コード例 #5
0
  @Test
  public void DeleteProfileWithMissingArguments() {
    addSnippetParam("sample.createProfileId", "");

    JavaScriptPreviewPage previewPage = executeSnippet(SNIPPET_ID);
    JsonJavaObject json = previewPage.getJson();
    Assert.assertEquals(400, json.getInt("code"));
  }
コード例 #6
0
ファイル: GetForumTopic.java プロジェクト: linyunz/SocialSDK
  @Test
  public void testGetForumTopicInvalidArg() {
    addSnippetParam("ForumService.topicUuid", "");

    JavaScriptPreviewPage previewPage = executeSnippet(SNIPPET_ID);
    JsonJavaObject json = previewPage.getJson();
    Assert.assertEquals(400, json.getInt("code"));
    Assert.assertEquals("Invalid argument, expected topicUuid.", json.getString("message"));
  }
コード例 #7
0
  @Test
  public void testCreateForumTopic() {
    addSnippetParam("ForumService.forumUuid", forum.getForumUuid());

    JavaScriptPreviewPage previewPage = executeSnippet(SNIPPET_ID);
    JsonJavaObject json = previewPage.getJson();
    Assert.assertNull("Unexpected error detected on page", json.getString("code"));
    assertForumTopicProperties(json);
  }
コード例 #8
0
  @Test
  public void testCommunityNewSave() {
    JavaScriptPreviewPage previewPage = executeSnippet(SNIPPET_ID);
    JsonJavaObject json = previewPage.getJson();
    Assert.assertNull("Unexpected error detected on page", json.getString("code"));

    community = getCommunity(json.getString("getCommunityUuid"));
    assertCommunityValid(json);
  }
コード例 #9
0
ファイル: GetForumTopic.java プロジェクト: linyunz/SocialSDK
  @Test
  public void testGetForumTopic() {
    String title = createForumTopicName();
    ForumTopic forumTopic = createForumTopic(forum, title, title);
    addSnippetParam("ForumService.topicUuid", forumTopic.getTopicUuid());

    JavaScriptPreviewPage previewPage = executeSnippet(SNIPPET_ID);
    JsonJavaObject json = previewPage.getJson();
    assertForumTopicValid(forumTopic, (JsonJavaObject) json);
  }
コード例 #10
0
  @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());
  }
コード例 #11
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"));
 }
コード例 #12
0
ファイル: GetForumTopic.java プロジェクト: linyunz/SocialSDK
  @Test
  public void testGetForumTopicError() {
    addSnippetParam("ForumService.topicUuid", "Foo");

    JavaScriptPreviewPage previewPage = executeSnippet(SNIPPET_ID);
    JsonJavaObject json = previewPage.getJson();
    Assert.assertEquals(404, json.getInt("code"));
    Assert.assertEquals(
        "No existing forum found. Please contact your system administrator.",
        json.getString("message"));
  }
コード例 #13
0
ファイル: Community.java プロジェクト: CarlosManias/SocialSDK
  @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));
    }
  }
コード例 #14
0
  @Test
  public void testRemoveMember() throws Exception {
    String id = getProperty("sample.email2");
    if (getEnvironment().isSmartCloud()) {
      id = getProperty("smartcloud.id2");
    }
    addMember(community, id, "member");

    addSnippetParam("CommunityService.communityUuid", community.getCommunityUuid());
    addSnippetParam("sample.id2", id);

    JavaScriptPreviewPage previewPage = executeSnippet(SNIPPET_ID);
    JsonJavaObject json = previewPage.getJson();
    Assert.assertFalse("Remove member failed", hasMember(community, getProperty("sample.email2")));
  }
コード例 #15
0
ファイル: BaseEntity.java プロジェクト: priand/SocialSDK
 @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);
     }
   }
 }
コード例 #16
0
 @Test
 public void testAddMemberToActivity() {
   JavaScriptPreviewPage previewPage = executeSnippet(SNIPPET_ID);
   JsonJavaObject json = previewPage.getJson();
   Assert.assertEquals(json.getAsInt("status"), 201); // created
 }
コード例 #17
0
ファイル: UpdateMember.java プロジェクト: howleyj/SocialSDK
 @Test
 public void testUpdateActivityMember() {
   JavaScriptPreviewPage previewPage = executeSnippet(SNIPPET_ID);
   JsonJavaObject json = previewPage.getJson();
   Assert.assertEquals(json.getAsInt("status"), 200); // OK	
 }
コード例 #18
0
 @Test
 public void testGetBookmarksTags() {
   JavaScriptPreviewPage previewPage = executeSnippet(SNIPPET_ID);
   JsonJavaObject json = previewPage.getJson();
   Assert.assertNotNull(json.getString("tagTerm"));
 }
コード例 #19
0
 @Test
 public void testGetActivityMember() {
   JavaScriptPreviewPage previewPage = executeSnippet(SNIPPET_ID);
   JsonJavaObject json = previewPage.getJson();
   Assert.assertEquals(json.getAsString("getUserId"), id);
 }