ep.setUrl(p.get("url"));
ep.setUser(p.get("user"));
ep.setPassword(p.get("password"));
ep.setForceTrustSSLCertificate(true);
final ActivityService svc = new ActivityService(ep);
Activity c = new Activity();
c = svc.createActivity(c);
final String uuid = c.getActivityUuid();
//fails even when mutexed
final Object mutex = new Object();
Thread t1 = new Thread(new Runnable() {
@Override
public void run() {
Activity a;
try {
a = svc.getActivity(uuid);
for (int i = 0; i < 10; i++) {
a.setCompleted(a.isCompleted());
a.setContent("content " + System.currentTimeMillis());
synchronized (mutex) {
svc.updateActivity(a);
}
}
} catch (ClientServicesException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
});
Thread t2 = new Thread(new Runnable() {
@Override
public void run() {
try {
for (int i = 0; i < 10; i++) {
ActivityNode activityNode = new ActivityNode(svc);
activityNode.setActivityUuid(uuid);
//activityNode.setEntryType(type);
activityNode.setTitle("Node from Test " + System.currentTimeMillis());
activityNode.setContent("Node Content " + System.currentTimeMillis());
List<String> tagList = new ArrayList<String>();
tagList.add("tag1");
tagList.add("tag2");
activityNode.setTags(tagList);
synchronized (mutex) {
activityNode = svc.createActivityNode(activityNode);
}
}
} catch (ClientServicesException e) {
// TODO Auto-generated catch block
e.printStackTrace();