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;
23 import java.util.UUID;
24 import org.junit.Test;
25 import org.onap.so.monitoring.configuration.camunda.CamundaRestUrlProvider;
28 * @author waqas.ikram@ericsson.com
30 public class CamundaRestUrlProviderTest {
31 private static final String DEFAULT = "default";
32 private static final String CAMUNDA_REST_API_URL = "http://localhost:9080/engine-rest/engine/";
33 private static final String BASE_URL = CAMUNDA_REST_API_URL + DEFAULT;
34 private final CamundaRestUrlProvider objUnderTest = new CamundaRestUrlProvider(CAMUNDA_REST_API_URL, DEFAULT);
35 private static final String ID = UUID.randomUUID().toString();
39 public void test_GetHistoryProcessInstanceUrl() {
40 final String expectedUrl = BASE_URL + "/history/process-instance?variables=requestId_eq_" + ID;
41 final String actualUrl = objUnderTest.getHistoryProcessInstanceUrl(ID);
42 assertEquals(expectedUrl, actualUrl);
46 public void test_GetProcessInstanceUrl() {
47 final String expectedUrl = BASE_URL + "/history/process-instance/" + ID;
48 final String actualUrl = objUnderTest.getSingleProcessInstanceUrl(ID);
49 assertEquals(expectedUrl, actualUrl);
54 public void test_GetProcessDefinitionUrl() {
55 final String expectedUrl = BASE_URL + "/process-definition/" + ID + "/xml";
56 final String actualUrl = objUnderTest.getProcessDefinitionUrl(ID);
57 assertEquals(expectedUrl, actualUrl);
62 public void test_GetActivityIntanceUrl() {
63 final String expectedUrl =
64 BASE_URL + "/history/activity-instance?processInstanceId=" + ID + "&sortBy=startTime&sortOrder=asc";
65 final String actualUrl = objUnderTest.getActivityInstanceUrl(ID);
66 assertEquals(expectedUrl, actualUrl);
71 public void test_GetProcessInstanceVariablesUrl() {
72 final String expectedUrl = BASE_URL + "/history/variable-instance?processInstanceId=" + ID;
73 final String actualUrl = objUnderTest.getProcessInstanceVariablesUrl(ID);
74 assertEquals(expectedUrl, actualUrl);