2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 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=========================================================
21 package org.onap.policy.template.demo;
23 import static org.junit.Assert.*;
25 import java.util.HashMap;
27 import org.junit.AfterClass;
28 import org.junit.BeforeClass;
29 import org.junit.Ignore;
30 import org.junit.Test;
31 import org.onap.policy.drools.http.server.HttpServletServer;
32 import org.onap.policy.vfc.VFCResponse;
33 import org.onap.policy.vfc.util.Serialization;
34 import org.onap.policy.rest.RESTManager;
35 import org.onap.policy.rest.RESTManager.Pair;
37 public class VfcSimulatorTest {
40 public static void setUpSimulator() {
43 } catch (InterruptedException e) {
49 public static void tearDownSimulator() {
50 HttpServletServer.factory.destroy();
54 public void testPost(){
55 Pair<Integer, String> httpDetails = RESTManager.post("http://localhost:6668/api/nslcm/v1/ns/1234567890/heal", "username", "password", new HashMap<String, String>(), "application/json", "Some Request Here");
56 assertNotNull(httpDetails);
57 VFCResponse response = Serialization.gsonPretty.fromJson(httpDetails.b, VFCResponse.class);
58 assertNotNull(response);
61 //This test case fails because the model code does not match the response I was given, I do not know which is wrong
64 public void testGet(){
65 Pair<Integer, String> httpDetails = RESTManager.get("http://localhost:6668/api/nslcm/v1/jobs/1234&responseId=5678", "username", "password", new HashMap<String, String>());
66 assertNotNull(httpDetails);
67 VFCResponse response = Serialization.gsonPretty.fromJson(httpDetails.b, VFCResponse.class);
68 assertNotNull(response);