2 * Copyright 2017 ZTE Corporation.
\r
4 * Licensed under the Apache License, Version 2.0 (the "License");
\r
5 * you may not use this file except in compliance with the License.
\r
6 * You may obtain a copy of the License at
\r
8 * http://www.apache.org/licenses/LICENSE-2.0
\r
10 * Unless required by applicable law or agreed to in writing, software
\r
11 * distributed under the License is distributed on an "AS IS" BASIS,
\r
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
13 * See the License for the specific language governing permissions and
\r
14 * limitations under the License.
\r
18 package org.onap.holmes.rulemgt.bolt.enginebolt;
\r
21 import org.apache.http.HttpResponse;
\r
22 import org.apache.http.client.methods.CloseableHttpResponse;
\r
23 import org.apache.http.impl.client.CloseableHttpClient;
\r
24 import org.apache.http.impl.client.HttpClients;
\r
25 import org.junit.Before;
\r
26 import org.junit.Rule;
\r
27 import org.junit.rules.ExpectedException;
\r
28 import org.onap.holmes.rulemgt.bean.request.CorrelationDeployRule4Engine;
\r
29 import org.powermock.api.easymock.PowerMock;
\r
30 import org.powermock.core.classloader.annotations.PrepareForTest;
\r
31 import org.powermock.modules.junit4.rule.PowerMockRule;
\r
33 @PrepareForTest({HttpClients.class, CloseableHttpClient.class})
\r
34 public class EngineServiceTest {
\r
37 public ExpectedException thrown = ExpectedException.none();
\r
39 public PowerMockRule powerMockRule = new PowerMockRule();
\r
40 private EngineService engineService;
\r
41 private HttpResponse httpResponseMock;
\r
42 private CloseableHttpClient closeableHttpClient;
\r
43 private CorrelationDeployRule4Engine correlationDeployRule4Engine;
\r
44 private CloseableHttpResponse closeableHttpResponseMock;
\r
47 public void setUp() {
\r
48 engineService = new EngineService();
\r
49 closeableHttpClient = PowerMock.createMock(CloseableHttpClient.class);
\r
50 httpResponseMock = PowerMock.createMock(HttpResponse.class);
\r
51 closeableHttpResponseMock = PowerMock.createMock(CloseableHttpResponse.class);
\r
52 correlationDeployRule4Engine = new CorrelationDeployRule4Engine();
\r
53 correlationDeployRule4Engine.setContent("{\"package\":\"test\"}");
\r
54 correlationDeployRule4Engine.setEngineId("engine_id");
\r