+/*-\r
+ * ============LICENSE_START=======================================================\r
+ * ONAP - SO\r
+ * ================================================================================\r
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
+ * ================================================================================\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ * ============LICENSE_END=========================================================\r
+ */\r
+\r
package org.openecomp.mso.bpmn.common;\r
\r
import static org.junit.Assert.assertEquals;\r
+import static org.junit.Assert.assertNotNull;\r
+import static org.junit.Assert.assertNull;\r
+import static org.junit.Assert.assertTrue;\r
import static org.junit.Assert.fail;\r
import static org.mockito.Matchers.any;\r
import static org.mockito.Mockito.doAnswer;\r
}\r
\r
@SuppressWarnings("unchecked")\r
- public static <T extends Object> T getRawVariable(ProcessEngineServices processEngineServices, String processDefinitionID, String name) {\r
+ public static <T> T getRawVariable(ProcessEngineServices processEngineServices, String processDefinitionID, String name) {\r
String pID = getProcessInstanceId(processEngineServices,\r
processDefinitionID);\r
assertProcessInstanceFinished(processEngineServices, pID);\r
.getValue();\r
return (T) responseData;\r
}\r
+\r
+ \r
+ public static void assertAnyProcessInstanceFinished(ProcessEngineServices processEngineServices, String processDefinitionID) {\r
+ String pID = getProcessInstanceId(processEngineServices,\r
+ processDefinitionID);\r
+ assertNotNull(pID);\r
+ assertTrue(processEngineServices.getHistoryService().createHistoricProcessInstanceQuery().processInstanceId(pID).finished().count() > 0);\r
+ }\r
\r
+ public static void assertNoProcessInstance(ProcessEngineServices processEngineServices, String processDefinitionID) {\r
+ assertNull(getProcessInstanceId(processEngineServices, processDefinitionID));\r
+ }\r
\r
public static void assertProcessInstanceFinished(ProcessEngineServices processEngineServices, String pid) {\r
assertEquals(1, processEngineServices.getHistoryService().createHistoricProcessInstanceQuery().processInstanceId(pid).finished().count());\r
\r
\r
private static void buildVariable(String key, String value, Map<String,Object> variableValueType) {\r
- Map<String, Object> host = new HashMap<String, Object>();\r
+ Map<String, Object> host = new HashMap<>();\r
host.put("value", value);\r
host.put("type", "String");\r
variableValueType.put(key, host);\r
WorkflowResource workflowResource = new WorkflowResource();\r
VariableMapImpl variableMap = new VariableMapImpl();\r
\r
- Map<String, Object> variableValueType = new HashMap<String, Object>();\r
+ Map<String, Object> variableValueType = new HashMap<>();\r
for (String key : variables.keySet()) {\r
buildVariable(key, variables.get(key), variableValueType);\r
}\r
WorkflowAsyncResource workflowResource = new WorkflowAsyncResource();\r
VariableMapImpl variableMap = new VariableMapImpl();\r
\r
- Map<String, Object> variableValueType = new HashMap<String, Object>();\r
+ Map<String, Object> variableValueType = new HashMap<>();\r
for (String key : variables.keySet()) {\r
buildVariable(key, variables.get(key), variableValueType);\r
}\r