2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
20 package org.onap.so.apihandlerinfra;
22 import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
23 import static com.github.tomakehurst.wiremock.client.WireMock.get;
24 import javax.ws.rs.core.MediaType;
25 import org.junit.Rule;
26 import org.junit.Test;
27 import org.junit.rules.ExpectedException;
28 import org.springframework.beans.factory.annotation.Autowired;
29 import org.springframework.beans.factory.annotation.Value;
30 import org.springframework.http.HttpHeaders;
31 import org.springframework.web.client.ResourceAccessException;
33 public class CamundaRequestHandlerTest extends BaseTest {
36 private CamundaRequestHandler camundaRequestHandler;
38 @Value("${wiremock.server.port}")
39 private String wiremockPort;
42 public ExpectedException thrown = ExpectedException.none();
45 public void timeoutTest() {
46 wireMockServer.stubFor(get(
47 ("/sobpmnengine/history/process-instance?processInstanceBusinessKey=6718de35-b9a5-4670-b19f-a0f4ac22bfaf&active=true&maxResults=1"))
48 .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
49 .withBodyFile("Camunda/HistoryCheckResponse.json")
50 .withStatus(org.apache.http.HttpStatus.SC_OK).withFixedDelay(40000)));
52 thrown.expect(ResourceAccessException.class);
53 camundaRequestHandler.getCamundaProcessInstanceHistory("6718de35-b9a5-4670-b19f-a0f4ac22bfaf", false, true,