forked from OpenNTF/SocialSDK
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1412842
commit 8461a99
Showing
26 changed files
with
1,806 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
...ava/com/ibm/sbt/services/client/connections/activities/ActivityCreatePerformanceTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
/* | ||
* © Copyright IBM Corp. 2014 | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at: | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or | ||
* implied. See the License for the specific language governing | ||
* permissions and limitations under the License. | ||
*/ | ||
package com.ibm.sbt.services.client.connections.activities; | ||
|
||
import java.util.ArrayList; | ||
import java.util.HashMap; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
import org.junit.Assert; | ||
import org.junit.Test; | ||
|
||
import com.ibm.commons.xml.XMLException; | ||
import com.ibm.sbt.services.client.ClientServicesException; | ||
import com.ibm.sbt.services.client.base.datahandlers.EntityList; | ||
|
||
/** | ||
* @author mwallace | ||
* | ||
*/ | ||
public class ActivityCreatePerformanceTest extends BaseActivityServiceTest { | ||
|
||
@Test | ||
public void testCreateActivityWithTags() throws ClientServicesException, XMLException { | ||
EntityList<Activity> activities = activityService.getMyActivities(); | ||
int totalResults = activities.getTotalResults(); | ||
//System.out.println(DOMUtil.getXMLString((Node)activities.getData())); | ||
System.out.println("Total number of activities: "+totalResults); | ||
System.out.println("Creating "+5+" activities"); | ||
for (int i=0; i<5; i++) { | ||
long start = System.currentTimeMillis(); | ||
Activity activity = createActivity(); | ||
long duration = System.currentTimeMillis() - start; | ||
System.out.println("Creating "+activity.getActivityUuid()+" took "+duration+"(ms)"); | ||
} | ||
// prevent last activity being auto-deleted | ||
activity = null; | ||
|
||
long start = System.currentTimeMillis(); | ||
Map<String, String> params = new HashMap<String, String>(); | ||
params.put("page", "1"); | ||
params.put("ps", "1"); | ||
params.put("nodetype", "activity"); | ||
activities = activityService.getAllActivities(params); | ||
long duration = System.currentTimeMillis() - start; | ||
System.out.println("Reading all activities feed took "+duration+"(ms)"); | ||
|
||
start = System.currentTimeMillis(); | ||
params.put("tag", "personal"); | ||
activities = activityService.getAllActivities(params); | ||
duration = System.currentTimeMillis() - start; | ||
System.out.println("Reading all activities feed (with tag=personal) took "+duration+"(ms)"); | ||
|
||
start = System.currentTimeMillis(); | ||
activities = activityService.getMyActivities(params); | ||
duration = System.currentTimeMillis() - start; | ||
System.out.println("Reading my activities feed (with tag=personal) took "+duration+"(ms)"); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
...ava/com/ibm/sbt/services/client/connections/activities/ActivityMemberPerformanceTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/* | ||
* © Copyright IBM Corp. 2014 | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at: | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or | ||
* implied. See the License for the specific language governing | ||
* permissions and limitations under the License. | ||
*/ | ||
package com.ibm.sbt.services.client.connections.activities; | ||
|
||
import java.text.MessageFormat; | ||
|
||
import org.junit.Test; | ||
import org.w3c.dom.Document; | ||
|
||
import com.ibm.commons.xml.XMLException; | ||
import com.ibm.sbt.services.client.ClientServicesException; | ||
import com.ibm.sbt.services.client.base.ConnectionsConstants; | ||
import com.ibm.sbt.services.client.base.datahandlers.EntityList; | ||
import com.ibm.sbt.services.client.base.datahandlers.XmlDataHandler; | ||
import com.ibm.sbt.services.client.connections.common.Member; | ||
|
||
/** | ||
* @author mwallace | ||
* | ||
*/ | ||
public class ActivityMemberPerformanceTest extends BaseActivityServiceTest { | ||
|
||
@Test | ||
public void testAddActivityMember() throws ClientServicesException, XMLException { | ||
Activity activity = createActivity(); | ||
|
||
// e.g. ajones{0}@janet.iris.com | ||
String emailPattern = System.getProperty("EmailPattern"); | ||
|
||
for (int i=2; i<500; i++) { | ||
try { | ||
long startAdd = System.currentTimeMillis(); | ||
String email = MessageFormat.format(emailPattern, i); | ||
Member member = activity.addMember(Member.TYPE_PERSON, email, Member.ROLE_OWNER); | ||
long durationAdd = System.currentTimeMillis() - startAdd; | ||
|
||
long startRead = System.currentTimeMillis(); | ||
EntityList<Member> members = activity.getMembers(); | ||
XmlDataHandler dataHandler = new XmlDataHandler((Document)members.getData(), ConnectionsConstants.nameSpaceCtx); | ||
long durationRead = System.currentTimeMillis() - startRead; | ||
|
||
System.out.println(email+","+durationAdd+","+durationRead); | ||
} catch (Exception ignore) { | ||
} | ||
} | ||
} | ||
|
||
} |
47 changes: 47 additions & 0 deletions
47
...c/test/java/com/ibm/sbt/services/client/connections/activities/ActivityMoveEntryTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
* © Copyright IBM Corp. 2014 | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at: | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or | ||
* implied. See the License for the specific language governing | ||
* permissions and limitations under the License. | ||
*/ | ||
package com.ibm.sbt.services.client.connections.activities; | ||
|
||
import org.junit.Assert; | ||
import org.junit.Test; | ||
|
||
import com.ibm.commons.xml.XMLException; | ||
import com.ibm.sbt.services.client.ClientServicesException; | ||
import com.ibm.sbt.services.client.base.datahandlers.EntityList; | ||
|
||
/** | ||
* @author mwallace | ||
* | ||
*/ | ||
public class ActivityMoveEntryTest extends BaseActivityServiceTest { | ||
|
||
@Test | ||
public void testMoveEntry() throws ClientServicesException, XMLException { | ||
Activity activity1 = createActivity(); | ||
ActivityNode activityNode = createActivityNode(); | ||
|
||
Activity activity2 = createActivity(); | ||
|
||
activityService.moveNode(activityNode.getActivityNodeUuid(), activity2.getActivityUuid()); | ||
|
||
EntityList<ActivityNode> descendants = activityService.getActivityNodeDescendants(activity2.getActivityUuid()); | ||
|
||
Assert.assertTrue("Invalid number of descendants", descendants.size() == 1); | ||
Assert.assertEquals("Invalid activity node id", activityNode.getActivityNodeUuid(), descendants.get(0).getActivityNodeUuid()); | ||
} | ||
|
||
|
||
} |
Oops, something went wrong.