Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Updated the test cases

  • Loading branch information...
commit 8e0b9a569e21aeed26402f2ec23c464ff1804c50 1 parent d3908e8
Sandeep authored
View
2  Buildfile
@@ -77,7 +77,7 @@ define "tempo" do
compile { open_jpa_enhance }
task "package" => generate_sql([project], "workflow.tms")
- test.with APACHE_DERBY, LOG4J, DB_CONNECTOR.values, XMLUNIT, WOODSTOX, INSTINCT, SECURITY_WS_COMMON, APACHE_COMMONS[:pool], APACHE_COMMONS[:collections]
+ test.with APACHE_DERBY, LOG4J, DB_CONNECTOR.values, XMLUNIT, WOODSTOX, INSTINCT, SECURITY_WS_COMMON, APACHE_COMMONS[:pool], APACHE_COMMONS[:collections], APACHE_COMMONS[:httpclient]
test.exclude '*TestUtils*'
unless ENV["LIVE"] == 'yes'
test.exclude '*N3AuthProviderLiveTest*'
View
13 .../test/java/org/intalio/tempo/workflow/tms/client/dependent_tests/RemoteTMSClientTest.java
@@ -18,6 +18,7 @@
import java.net.URI;
import java.net.URL;
import java.security.SecureRandom;
+import java.util.HashMap;
import java.util.Random;
import junit.framework.Assert;
@@ -57,7 +58,7 @@ public void testInput() throws Exception {
// ITaskManagementService tms = new TMSFactory(TMS_REMOTE_URL, TOKEN).getService();
Document input1 = Utils.createXMLDocument("/absr.xml");
String task1ID = nextRandom();
- PATask task1 = new PATask(task1ID, new URI("http://localhost/1"), "processID", "urn:completeSOAPAction", input1);
+ PATask task1 = new PATask(task1ID, new URI("http://localhost/1"), "processID", "urn:completeSOAPAction", input1, new HashMap<String, String>());
task1.getUserOwners().add("intalio\\admin");
tms.create(task1);
testRoundTrip(task1, input1);
@@ -71,7 +72,7 @@ public void testUpdate() throws Exception {
// ITaskManagementService tms = new TMSFactory(TMS_REMOTE_URL, TOKEN).getService();
Document input1 = Utils.createXMLDocument("/absr.xml");
String id = "583c10bfdbd326ba:69a8b3cd:124dd681279:-7ef6127.0.1.1163844" + System.currentTimeMillis();
- PATask task1 = new PATask(id, new URI("http://localhost/1"), "processID", "urn:completeSOAPAction", input1);
+ PATask task1 = new PATask(id, new URI("http://localhost/1"), "processID", "urn:completeSOAPAction", input1, new HashMap<String, String>());
String description = "new two:" + System.currentTimeMillis();
task1.getUserOwners().add("intalio\\admin");
tms.create(task1);
@@ -120,7 +121,7 @@ public void testBasicPATaskLifecycle() throws Exception {
Assert.assertNotNull(tasks);
String task1ID = nextRandom();
- PATask task1 = new PATask(task1ID, new URI("http://localhost/1"), "processID", "urn:completeSOAPAction", Utils.createXMLDocument());
+ PATask task1 = new PATask(task1ID, new URI("http://localhost/1"), "processID", "urn:completeSOAPAction", Utils.createXMLDocument(), new HashMap<String, String>());
task1.getUserOwners().add("intalio\\admin");
tms.create(task1);
@@ -128,7 +129,7 @@ public void testBasicPATaskLifecycle() throws Exception {
TaskEquality.areTasksEquals(task1, task2);
String task3ID = nextRandom();
- PATask task3 = new PATask(task3ID, new URI("http://localhost/3"), "processID", "urn:completeSOAPAction", Utils.createXMLDocument());
+ PATask task3 = new PATask(task3ID, new URI("http://localhost/3"), "processID", "urn:completeSOAPAction", Utils.createXMLDocument(), new HashMap<String, String>());
task3.getUserOwners().add("intalio.admin");
task3.getUserOwners().add("intalio\\admin");
tms.create(task3);
@@ -149,7 +150,7 @@ public void testBasicPATaskLifecycle() throws Exception {
Assert.assertEquals(TaskState.COMPLETED, task5.getState());
String task6ID = nextRandom();
- PATask task6 = new PATask(task6ID, new URI("http://localhost/6"), "processID", "urn:completeSOAPAction", Utils.createXMLDocument());
+ PATask task6 = new PATask(task6ID, new URI("http://localhost/6"), "processID", "urn:completeSOAPAction", Utils.createXMLDocument(), new HashMap<String, String>());
task6.getUserOwners().add("intalio\\admin");
tms.create(task6);
tms.complete(task6ID);
@@ -186,7 +187,7 @@ public void testAttachments() throws Exception {
// ITaskManagementService tms = new TMSFactory(TMS_REMOTE_URL, TOKEN).getService();
String task1ID = nextRandom();
- PATask task1 = new PATask(task1ID, new URI("http://localhost/1"), "processID", "urn:completeSOAPAction", Utils.createXMLDocument());
+ PATask task1 = new PATask(task1ID, new URI("http://localhost/1"), "processID", "urn:completeSOAPAction", Utils.createXMLDocument(), new HashMap<String, String>());
task1.getUserOwners().add("test.system-test");
task1.getUserOwners().add("intalio\\admin");
Attachment attachment1 = new Attachment(new AttachmentMetadata(), new URL("http://localhost/a1"));
View
3  ...st/java/org/intalio/tempo/workflow/tms/server/dependent_tests/RemoteReassginTaskTest.java
@@ -4,6 +4,7 @@
import java.net.URI;
import java.util.Arrays;
import java.util.Collection;
+import java.util.HashMap;
import java.util.Random;
import junit.framework.Assert;
@@ -91,7 +92,7 @@ public void testReassginTaskLifecycle() throws Exception {
* Create a new task for current user
*/
PATask task1 = new PATask(String.valueOf(new Random().nextInt(10000)), new URI("http://localhost/1"),
- "processID", "urn:completeSOAPAction", Utils.createXMLDocument());
+ "processID", "urn:completeSOAPAction", Utils.createXMLDocument(), new HashMap<String, String>());
task1.getUserOwners().add(USER_CURRENT);
tms.create(task1);
View
3  tms-common/src/main/java/org/intalio/tempo/workflow/task/PATask.java
@@ -145,12 +145,13 @@ public PATask(String id, URI formURL) {
super(id, formURL);
}
- public PATask(String id, URI formURL, String processID, String completeSOAPAction, Document input) {
+ public PATask(String id, URI formURL, String processID, String completeSOAPAction, Document input, Map<String, String> customMetadata) {
super(id, formURL);
this.setProcessID(processID);
this.setCompleteSOAPAction(completeSOAPAction);
if (input != null)
this.setInput(input);
+ this.setCustomMetadata(customMetadata);
}
public void setCustomMetadata(Map<String, String> customMetadata) {
View
13 tms-common/src/main/java/org/intalio/tempo/workflow/task/xml/TaskMarshaller.java
@@ -166,13 +166,14 @@ private XmlObject marshalXMLTaskMetadata(Task task, UserRoles roles) {
Map<String, String> customMetadataMap = customMetadataTask.getCustomMetadata();
- Set<String> keySet = customMetadataMap.keySet();
- for(String key: keySet){
- CustomMetadataKeyValueType xmlCustomMetadataKeyValueType = customMetadataType.addNewCustomMetadataKeyValue();
- xmlCustomMetadataKeyValueType.setKey(key);
- xmlCustomMetadataKeyValueType.setValue( customMetadataMap.get(key));
+ if(customMetadataMap != null){
+ Set<String> keySet = customMetadataMap.keySet();
+ for(String key: keySet){
+ CustomMetadataKeyValueType xmlCustomMetadataKeyValueType = customMetadataType.addNewCustomMetadataKeyValue();
+ xmlCustomMetadataKeyValueType.setKey(key);
+ xmlCustomMetadataKeyValueType.setValue( customMetadataMap.get(key));
+ }
}
-
taskMetadataElement.setCustomMetadata( customMetadataType);
}
View
18 tms-common/src/test/java/org/intalio/tempo/workflow/task/JPATaskTest.java
@@ -198,12 +198,13 @@ private PATask getSampleTask(TaskState state) throws URISyntaxException,
Exception {
String id = getUniqueTaskID();
PATask task1 = new PATask(id, new URI("http://hellonico.net"),
- "processId", "soap", getXmlSampleDocument());
+ "processId", "soap", getXmlSampleDocument(), new HashMap<String, String>());
task1.authorizeActionForUser("save", "examples\\manager");
task1.setPriority(2);
task1.setState(state);
task1.getRoleOwners().add("role1");
task1.getUserOwners().add("user1");
+ task1.getCustomMetadata().put("test", "intalio");
return task1;
}
@@ -578,9 +579,9 @@ public void PATaskPersistence() throws Exception {
String id = getUniqueTaskID();
PATask task1 = new PATask(id, new URI("http://hellonico.net"),
- "processId", "soap", getXmlSampleDocument());
+ "processId", "soap", getXmlSampleDocument(), new HashMap<String, String>());
task1.setDeadline(new Date());
-
+ task1.getCustomMetadata().put("test", "intalio");
persist(task1);
Query q = em.createNamedQuery(Task.FIND_BY_ID).setParameter(1, id);
@@ -685,10 +686,10 @@ public void PAWithInputOutput() throws Exception {
PATask task2;
PATask task1 = new PATask(getUniqueTaskID(), new URI(
"http://hellonico.net"), "processId", "soap",
- getXmlSampleDocument());
+ getXmlSampleDocument(), new HashMap<String, String>());
task1.setInput(xml.getXmlDocument("/pa_input.xml"));
task1.setOutput(xml.getXmlDocument("/pa_output.xml"));
-
+ task1.getCustomMetadata().put("test", "intalio");
task1.getUserOwners().add("intalio\\admin");
persist(task1);
@@ -709,7 +710,7 @@ public void attachmentsPATask() throws Exception {
"http://hellonico.net"));
String id = "pa" + System.currentTimeMillis();
PATask task1 = new PATask(id, new URI("http://hellonico.net"),
- "processId", "soap", getXmlSampleDocument());
+ "processId", "soap", getXmlSampleDocument(), new HashMap<String, String>());
task1.addAttachment(att);
persist(task1);
@@ -726,12 +727,13 @@ public void attachmentsPATask() throws Exception {
public void authorizeUserRolesAndIsAvailable() throws Exception {
String id = getUniqueTaskID();
PATask task1 = new PATask(id, new URI("http://hellonico.net"),
- "processId", "soap", getXmlSampleDocument());
+ "processId", "soap", getXmlSampleDocument(), new HashMap<String, String>());
task1.authorizeActionForUser("save", "examples\\manager");
task1.authorizeActionForUser("save", "user1");
task1.getUserOwners().add("user2");
task1.getRoleOwners().add("role1");
-
+ task1.getCustomMetadata().put("test", "intalio");
+
task1.setPriority(2);
persist(task1);
View
18 tms-common/src/test/java/org/intalio/tempo/workflow/task/PATaskTest.java
@@ -16,6 +16,8 @@
import java.net.URI;
import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
@@ -53,8 +55,9 @@ private PATask createPATask()
String processID = "processID";
String completeSOAPAction = "urn:complete";
Document input = this.createXMLDocument();
-
- return new PATask(taskID, formURL, processID, completeSOAPAction, input);
+ Map<String, String> customMetadata = new HashMap<String, String>();
+ customMetadata.put("test", "intalio");
+ return new PATask(taskID, formURL, processID, completeSOAPAction, input, customMetadata);
}
public void testPATask()
@@ -64,8 +67,9 @@ public void testPATask()
String processID = "processID";
String completeSOAPAction = "urn:complete";
Document input = this.createXMLDocument();
-
- PATask task = new PATask(taskID, formURL, processID, completeSOAPAction, input);
+ Map<String, String> customMetadata = new HashMap<String, String>();
+ customMetadata.put("test", "intalio");
+ PATask task = new PATask(taskID, formURL, processID, completeSOAPAction, input, customMetadata);
Assert.assertEquals(processID, task.getProcessID());
Assert.assertEquals(completeSOAPAction, task.getCompleteSOAPAction());
Assert.assertTrue(XmlTooling.equals(input, task.getInput()));
@@ -74,19 +78,19 @@ public void testPATask()
Assert.assertTrue(task.getAttachments().isEmpty());
try {
- new PATask(taskID, formURL, null, completeSOAPAction, input);
+ new PATask(taskID, formURL, null, completeSOAPAction, input, customMetadata);
Assert.fail("RequiredArgumentException expected");
} catch (RequiredArgumentException e) {
}
try {
- new PATask(taskID, formURL, processID, null, input);
+ new PATask(taskID, formURL, processID, null, input, customMetadata);
Assert.fail("RequiredArgumentException expected");
} catch (RequiredArgumentException e) {
}
try {
- PATask inputLessTask = new PATask(taskID, formURL, processID, completeSOAPAction, null);
+ PATask inputLessTask = new PATask(taskID, formURL, processID, completeSOAPAction, null, customMetadata);
inputLessTask.getInput();
Assert.fail("IllegalStateException expected");
} catch (IllegalStateException e) {
View
14 tms-common/src/test/java/org/intalio/tempo/workflow/task/xml/TaskMarshallerTest.java
@@ -18,6 +18,7 @@
import java.net.URI;
import java.net.URL;
import java.util.Date;
+import java.util.HashMap;
import junit.framework.TestCase;
@@ -64,11 +65,12 @@ public void testPIPATaskMarshalling() throws Exception {
}
public void testPATaskMarshalling() throws Exception {
- PATask task = new PATask("id", new URI("http://localhost/form"), "processID", "urn:completeSoapAction", TestUtils.createXMLDocument());
+ PATask task = new PATask("id", new URI("http://localhost/form"), "processID", "urn:completeSoapAction", TestUtils.createXMLDocument(), new HashMap<String, String>());
task.getUserOwners().add("test/user1");
task.getRoleOwners().add("test.role1");
task.getRoleOwners().add("test\\role2");
task.setOutput(TestUtils.createXMLDocument());
+ task.getCustomMetadata().put("test", "intalio");
task.addAttachment(new Attachment(new AttachmentMetadata(), new URL("http://localhost/url1")));
AttachmentMetadata metadata = new AttachmentMetadata();
@@ -94,10 +96,11 @@ public void testPIPATaskMetaMarshalling() throws Exception {
}
public void testPATaskMetaMarshalling() throws Exception {
- PATask task = new PATask("id", new URI("http://localhost/form"), "processID", "urn:completeSoapAction", TestUtils.createXMLDocument());
+ PATask task = new PATask("id", new URI("http://localhost/form"), "processID", "urn:completeSoapAction", TestUtils.createXMLDocument(), new HashMap<String, String>());
task.getUserOwners().add("test/user1");
task.getRoleOwners().add("test.role1");
task.getRoleOwners().add("test\\role2");
+ task.getCustomMetadata().put("test", "intalio");
task.setOutput(TestUtils.createXMLDocument());
task.addAttachment(new Attachment(new AttachmentMetadata(), new URL("http://localhost/url1")));
@@ -115,7 +118,7 @@ public void testNotificationMetaMarshalling() throws Exception {
}
public void testPATaskChainedBefore() throws Exception {
- PATask task = new PATask("id", new URI("http://localhost/form"), "processID", "urn:completeSoapAction", TestUtils.createXMLDocument());
+ PATask task = new PATask("id", new URI("http://localhost/form"), "processID", "urn:completeSoapAction", TestUtils.createXMLDocument(), new HashMap<String, String>());
task.getUserOwners().add("test/user1");
task.getRoleOwners().add("test.role1");
@@ -123,12 +126,13 @@ public void testPATaskChainedBefore() throws Exception {
task.setState(TaskState.READY);
task.setPreviousTaskID("p1");
task.setChainedBefore(true);
+ task.getCustomMetadata().put("test", "intalio");
this.testTaskMarshalling(task);
}
public void testPATaskMarshallingWithOtherProperty() throws Exception {
- PATask task = new PATask("id", new URI("http://localhost/form"), "processID", "urn:completeSoapAction", TestUtils.createXMLDocument());
+ PATask task = new PATask("id", new URI("http://localhost/form"), "processID", "urn:completeSoapAction", TestUtils.createXMLDocument(), new HashMap<String, String>());
task.getUserOwners().add("test/user1");
task.getRoleOwners().add("test.role1");
task.getRoleOwners().add("test\\role2");
@@ -147,6 +151,8 @@ public void testPATaskMarshallingWithOtherProperty() throws Exception {
AttachmentMetadata metadata = new AttachmentMetadata();
metadata.setMimeType("image/jpeg");
task.addAttachment(new Attachment(metadata, new URL("http://localhost/url2")));
+
+ task.getCustomMetadata().put("test", "intalio");
this.testTaskMarshalling(task);
}
View
6 ...ommon/src/test/java/org/intalio/tempo/workflow/task/xml/TaskMarshallingRoundtripTest.java
@@ -18,6 +18,7 @@
import java.net.URI;
import java.util.Calendar;
import java.util.Date;
+import java.util.HashMap;
import junit.framework.TestCase;
@@ -41,7 +42,7 @@
*/
public void testFullPAMarshallingRoundtrip() throws Exception {
PATask task1 = new PATask("taskID", new URI("http://localhost/URL"), "processID", "urn:completeSOAPAction",
- TestUtils.createXMLDocument());
+ TestUtils.createXMLDocument(), new HashMap<String, String>());
task1.setPriority(new Integer(3));
task1.authorizeActionForRole("save", "intalio\\engineer");
task1.authorizeActionForUser("save", "david");
@@ -56,6 +57,7 @@ public void testFullPAMarshallingRoundtrip() throws Exception {
task1.setFailureCode("123");
task1.setFailureReason("Who knows");
task1.setOutput(TestUtils.createXMLDocument());
+ task1.getCustomMetadata().put("test", "intalio");
}
/**
@@ -80,7 +82,7 @@ public void testNotificationMarshallingRoundtrip() throws Exception {
*/
public void testPAWithInput() throws Exception {
Document doc = new XmlTooling().getXmlDocument("/inputWithNamespace.xml");
- PATask task = new PATask("taskID", new URI("http://localhost/URL"), "processID", "urn:completeSOAPAction", doc);
+ PATask task = new PATask("taskID", new URI("http://localhost/URL"), "processID", "urn:completeSOAPAction", doc, new HashMap<String, String>());
task.setOutput(doc);
PATask task2 = (PATask) testRoundTrip(task);
TaskEquality.areDocumentsEqual(doc, task2.getInput());
View
11 tms-service/src/test/java/org/intalio/tempo/workflow/tms/server/JPAFactoriesTest.java
@@ -11,6 +11,8 @@
import java.net.URI;
import java.net.URISyntaxException;
+import java.util.HashMap;
+import java.util.Map;
import java.util.Random;
import junit.framework.Assert;
@@ -150,7 +152,8 @@ private PATask getSampleTask(TaskState state) throws URISyntaxException,
Exception {
String id = String.valueOf(new Object().hashCode());
PATask task1 = new PATask(id, new URI("http://hellonico.net"),
- "processId", "soap", getXmlSampleDocument());
+ "processId", "soap", getXmlSampleDocument(), new HashMap<String, String>());
+ task1.getCustomMetadata().put("test", "intalio");
task1.authorizeActionForUser("save", "examples\\manager");
task1.setPriority(2);
task1.setState(state);
@@ -162,6 +165,8 @@ private PATask getSampleTask(TaskState state) throws URISyntaxException,
Task getRandomSampleTask() throws Exception {
String id = "id_" + (ID_COUNTER++);
URI uri = new URI("http://hellonico.net");
+ Map<String, String> customMetadata = new HashMap<String, String>();
+ customMetadata.put("test", "intalio");
switch (type) {
case NOTIFICATION:
return new Notification(id, uri, xml.parseXML("<hello/>"));
@@ -169,13 +174,13 @@ Task getRandomSampleTask() throws Exception {
return new PIPATask(id, uri, uri, uri, "initOperationSOAPAction");
case PA:
return new PATask(id, new URI("http://hellonico.net"), "processId",
- "soap", xml.parseXML("<hello/>"));
+ "soap", xml.parseXML("<hello/>"), customMetadata);
default:
int rand = random.nextInt(3);
switch (rand) {
case 0:
return new PATask(id, new URI("http://hellonico.net"),
- "processId", "soap", xml.parseXML("<hello/>"));
+ "processId", "soap", xml.parseXML("<hello/>"), customMetadata);
case 1:
return new PIPATask(id, uri, uri, uri,
"initOperationSOAPAction");
View
9 tms-service/src/test/java/org/intalio/tempo/workflow/tms/server/TMSServerTest.java
@@ -17,6 +17,7 @@
import java.net.URI;
import java.net.URISyntaxException;
+import java.util.HashMap;
import junit.framework.Assert;
import junit.framework.TestCase;
@@ -46,10 +47,10 @@ public static void main(String[] args) {
public void testPATaskLifecycle() throws Exception {
ITMSServer server = Utils.createTMSServer();
- PATask paTask = new PATask("taskID", new URI("http://localhost/1"), "processID", "urn:completeSOAPAction", Utils.createXMLDocument());
+ PATask paTask = new PATask("taskID", new URI("http://localhost/1"), "processID", "urn:completeSOAPAction", Utils.createXMLDocument(), new HashMap<String, String>());
paTask.getUserOwners().add("test/user1");
paTask.getRoleOwners().add("test/role3");
-
+ paTask.getCustomMetadata().put("test", "intalio");
paTask.getUserOwners().add("test/user1");
paTask.getRoleOwners().add("test/role3");
ITaskDAOConnectionFactory daoFactory=new SimpleTaskDAOConnectionFactory();
@@ -114,9 +115,11 @@ public void testPATaskLifecycle() throws Exception {
}
private PATask getPATask(String id) throws URISyntaxException, Exception {
- PATask pa = new PATask(id, new URI("http://localhost/1"), "processID", "urn:completeSOAPAction", Utils.createXMLDocument());
+ PATask pa = new PATask(id, new URI("http://localhost/1"), "processID", "urn:completeSOAPAction",
+ Utils.createXMLDocument(), new HashMap<String, String>());
pa.getUserOwners().add("test/user1");
pa.getRoleOwners().add("test/role3");
+ pa.getCustomMetadata().put("test", "intalio");
return pa;
}

0 comments on commit 8e0b9a5

Please sign in to comment.
Something went wrong with that request. Please try again.