2 * Copyright 2018 ZTE Corporation.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package org.onap.sfc.resources;
18 import org.junit.Test;
19 import org.onap.sfc.entity.DelReqInfo;
20 import org.onap.sfc.entity.FlowClassfierReq4N;
21 import org.onap.sfc.entity.PortChainReq4N;
22 import org.onap.sfc.entity.PortPairGroupReq4N;
23 import org.onap.sfc.entity.portpair.PortPairReq4N;
25 import javax.ws.rs.ProcessingException;
27 public class DriverResourceTest {
28 public static final String URL = "http://0.0.0.0:8080";
29 private DriverResource driverResource = new DriverResource();
32 public void createPortPair() throws Exception {
34 PortPairReq4N portPairReq4N = new PortPairReq4N();
35 portPairReq4N.setUrl(URL);
36 driverResource.createPortPair(portPairReq4N);
37 } catch (ProcessingException ex) {
38 String message = ex.getMessage();
39 assert message.contains(" Connection refused");
44 public void createPortPairGroup() throws Exception {
46 PortPairGroupReq4N portPairGroupReq4N = new PortPairGroupReq4N();
47 portPairGroupReq4N.setUrl(URL);
48 driverResource.createPortPairGroup(portPairGroupReq4N);
49 } catch (ProcessingException ex) {
50 String message = ex.getMessage();
51 assert message.contains(" Connection refused");
56 public void createFlowClassfier() throws Exception {
58 FlowClassfierReq4N flowClassfierReq4N = new FlowClassfierReq4N();
59 flowClassfierReq4N.setUrl(URL);
60 driverResource.createFlowClassfier(flowClassfierReq4N);
61 } catch (ProcessingException ex) {
62 String message = ex.getMessage();
63 assert message.contains(" Connection refused");
68 public void creatPortChain() throws Exception {
70 PortChainReq4N portChainReq4N = new PortChainReq4N();
71 portChainReq4N.setUrl(URL);
72 driverResource.creatPortChain(portChainReq4N);
73 } catch (ProcessingException ex) {
74 String message = ex.getMessage();
75 assert message.contains(" Connection refused");
80 public void delPortPair() throws Exception {
82 DelReqInfo delReqInfo = new DelReqInfo();
83 delReqInfo.setUrl(URL);
84 delReqInfo.setId("123-456-789");
85 driverResource.delPortPair(delReqInfo);
86 } catch (ProcessingException ex) {
87 String message = ex.getMessage();
88 assert message.contains(" Connection refused");
93 public void delPortPairGroup() throws Exception {
95 DelReqInfo delReqInfo = new DelReqInfo();
96 delReqInfo.setUrl(URL);
97 delReqInfo.setId("123-456-789");
98 driverResource.delPortPairGroup(delReqInfo);
99 } catch (ProcessingException ex) {
100 String message = ex.getMessage();
101 assert message.contains(" Connection refused");
106 public void delFlowClassfier() throws Exception {
108 DelReqInfo delReqInfo = new DelReqInfo();
109 delReqInfo.setUrl(URL);
110 delReqInfo.setId("123-456-789");
111 driverResource.delFlowClassfier(delReqInfo);
112 } catch (ProcessingException ex) {
113 String message = ex.getMessage();
114 assert message.contains(" Connection refused");
119 public void delPortChain() throws Exception {
121 DelReqInfo delReqInfo = new DelReqInfo();
122 delReqInfo.setUrl(URL);
123 delReqInfo.setId("123-456-789");
124 driverResource.delPortChain(delReqInfo);
125 } catch (ProcessingException ex) {
126 String message = ex.getMessage();
127 assert message.contains(" Connection refused");