2 * ============LICENSE_START=======================================================
3 * Copyright (C) 2018 Ericsson. All rights reserved.
4 * ================================================================================
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
17 * SPDX-License-Identifier: Apache-2.0
18 * ============LICENSE_END=========================================================
20 package org.onap.so.monitoring.configuration;
22 import static org.junit.Assert.assertEquals;
24 import java.util.UUID;
26 import org.junit.Test;
27 import org.onap.so.monitoring.configuration.camunda.CamundaRestUrlProvider;
30 * @author waqas.ikram@ericsson.com
32 public class CamundaRestUrlProviderTest {
33 private static final String DEFAULT = "default";
34 private static final String CAMUNDA_REST_API_URL = "http://localhost:9080/engine-rest/engine/";
35 private static final String BASE_URL = CAMUNDA_REST_API_URL + DEFAULT;
36 private final CamundaRestUrlProvider objUnderTest = new CamundaRestUrlProvider(CAMUNDA_REST_API_URL, DEFAULT);
37 private static final String ID = UUID.randomUUID().toString();
41 public void test_GetHistoryProcessInstanceUrl() {
42 final String expectedUrl = BASE_URL + "/history/process-instance?variables=requestId_eq_" + ID;
43 final String actualUrl = objUnderTest.getHistoryProcessInstanceUrl(ID);
44 assertEquals(expectedUrl, actualUrl);
48 public void test_GetProcessInstanceUrl() {
49 final String expectedUrl = BASE_URL + "/history/process-instance/" + ID;
50 final String actualUrl = objUnderTest.getSingleProcessInstanceUrl(ID);
51 assertEquals(expectedUrl, actualUrl);
56 public void test_GetProcessDefinitionUrl() {
57 final String expectedUrl = BASE_URL + "/process-definition/" + ID + "/xml";
58 final String actualUrl = objUnderTest.getProcessDefinitionUrl(ID);
59 assertEquals(expectedUrl, actualUrl);
64 public void test_GetActivityIntanceUrl() {
65 final String expectedUrl =
66 BASE_URL + "/history/activity-instance?processInstanceId=" + ID + "&sortBy=startTime&sortOrder=asc";
67 final String actualUrl = objUnderTest.getActivityInstanceUrl(ID);
68 assertEquals(expectedUrl, actualUrl);
73 public void test_GetProcessInstanceVariablesUrl() {
74 final String expectedUrl = BASE_URL + "/history/variable-instance?processInstanceId=" + ID;
75 final String actualUrl = objUnderTest.getProcessInstanceVariablesUrl(ID);
76 assertEquals(expectedUrl, actualUrl);