Remove mso-oof-adapter from SO
[so.git] / so-monitoring / so-monitoring-handler / src / test / java / org / onap / so / monitoring / configuration / CamundaRestUrlProviderTest.java
1 /*-
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
8  * 
9  *      http://www.apache.org/licenses/LICENSE-2.0
10  * 
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.
16  * 
17  * SPDX-License-Identifier: Apache-2.0
18  * ============LICENSE_END=========================================================
19  */
20 package org.onap.so.monitoring.configuration;
21
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;
26
27 /**
28  * @author waqas.ikram@ericsson.com
29  */
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();
36
37
38     @Test
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);
43     }
44
45     @Test
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);
50     }
51
52
53     @Test
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);
58
59     }
60
61     @Test
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);
67
68     }
69
70     @Test
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);
75
76     }
77
78 }