21a877b7765f6a5ed9e212c7e3fdaf44dae3cc7a
[vfc/nfvo/driver/sfc.git] / zte / sfc-driver / sfc-driver / src / test / java / org / onap / sfc / TestPortPairGroup.java
1 /**
2  * Copyright 2016 [ZTE] and others.
3  *
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
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16 package org.onap.sfc;
17
18 import org.junit.Before;
19 import org.junit.Test;
20 import org.junit.runner.RunWith;
21 import org.openo.sfc.entity.PortPairGroupReq4N;
22 import org.openo.sfc.service.ISdnControllerService;
23 import org.openo.sfc.wrapper.N2sReqWrapper;
24 import org.powermock.api.mockito.PowerMockito;
25 import org.powermock.core.classloader.annotations.PrepareForTest;
26 import org.powermock.modules.junit4.PowerMockRunner;
27
28 import javax.ws.rs.core.*;
29 import java.lang.annotation.Annotation;
30 import java.net.URI;
31 import java.util.Date;
32 import java.util.Locale;
33 import java.util.Map;
34 import java.util.Set;
35
36 @RunWith(PowerMockRunner.class)
37 @PrepareForTest(ISdnControllerService.class)
38 public class TestPortPairGroup {
39
40     @Test
41     public void test_createportpairgroup() throws Exception {
42         N2sReqWrapper.convertPortPairGroup(new PortPairGroupReq4N());
43     }
44
45     @Before
46     public void setupBeforeTest() throws Exception {
47 //        SdnServiceConsumer consumer = PowerMockito.mock(SdnServiceConsumer.class);
48 //        PowerMockito.when(consumer.getMsbRegisterService("http://127.0.0.1:80")).thenReturn(new MsbService() {
49 //            @Override
50 //            public MsbRegisterEntity registerServce(@QueryParam("createOrUpdate") String createOrUpdate, MsbRegisterEntity entity) throws Exception {
51 //                return null;
52 //            }
53 //        }) ;
54
55         PowerMockito.mockStatic(ISdnControllerService.class);
56         ISdnControllerService service = PowerMockito.mock(ISdnControllerService.class);
57         PowerMockito.when(service.createPortPair("Authorization","")).thenReturn(new Response() {
58             @Override
59             public int getStatus() {
60                 return 0;  //To change body of implemented methods use File | Settings | File Templates.
61             }
62
63             @Override
64             public StatusType getStatusInfo() {
65                 return null;  //To change body of implemented methods use File | Settings | File Templates.
66             }
67
68             @Override
69             public Object getEntity() {
70                 return null;  //To change body of implemented methods use File | Settings | File Templates.
71             }
72
73             @Override
74             public <T> T readEntity(Class<T> tClass) {
75                 return null;  //To change body of implemented methods use File | Settings | File Templates.
76             }
77
78             @Override
79             public <T> T readEntity(GenericType<T> tGenericType) {
80                 return null;  //To change body of implemented methods use File | Settings | File Templates.
81             }
82
83             @Override
84             public <T> T readEntity(Class<T> tClass, Annotation[] annotations) {
85                 return null;  //To change body of implemented methods use File | Settings | File Templates.
86             }
87
88             @Override
89             public <T> T readEntity(GenericType<T> tGenericType, Annotation[] annotations) {
90                 return null;  //To change body of implemented methods use File | Settings | File Templates.
91             }
92
93             @Override
94             public boolean hasEntity() {
95                 return false;  //To change body of implemented methods use File | Settings | File Templates.
96             }
97
98             @Override
99             public boolean bufferEntity() {
100                 return false;  //To change body of implemented methods use File | Settings | File Templates.
101             }
102
103             @Override
104             public void close() {
105                 //To change body of implemented methods use File | Settings | File Templates.
106             }
107
108             @Override
109             public MediaType getMediaType() {
110                 return null;  //To change body of implemented methods use File | Settings | File Templates.
111             }
112
113             @Override
114             public Locale getLanguage() {
115                 return null;  //To change body of implemented methods use File | Settings | File Templates.
116             }
117
118             @Override
119             public int getLength() {
120                 return 0;  //To change body of implemented methods use File | Settings | File Templates.
121             }
122
123             @Override
124             public Set<String> getAllowedMethods() {
125                 return null;  //To change body of implemented methods use File | Settings | File Templates.
126             }
127
128             @Override
129             public Map<String, NewCookie> getCookies() {
130                 return null;  //To change body of implemented methods use File | Settings | File Templates.
131             }
132
133             @Override
134             public EntityTag getEntityTag() {
135                 return null;  //To change body of implemented methods use File | Settings | File Templates.
136             }
137
138             @Override
139             public Date getDate() {
140                 return null;  //To change body of implemented methods use File | Settings | File Templates.
141             }
142
143             @Override
144             public Date getLastModified() {
145                 return null;  //To change body of implemented methods use File | Settings | File Templates.
146             }
147
148             @Override
149             public URI getLocation() {
150                 return null;  //To change body of implemented methods use File | Settings | File Templates.
151             }
152
153             @Override
154             public Set<Link> getLinks() {
155                 return null;  //To change body of implemented methods use File | Settings | File Templates.
156             }
157
158             @Override
159             public boolean hasLink(String s) {
160                 return false;  //To change body of implemented methods use File | Settings | File Templates.
161             }
162
163             @Override
164             public Link getLink(String s) {
165                 return null;  //To change body of implemented methods use File | Settings | File Templates.
166             }
167
168             @Override
169             public Link.Builder getLinkBuilder(String s) {
170                 return null;  //To change body of implemented methods use File | Settings | File Templates.
171             }
172
173             @Override
174             public MultivaluedMap<String, Object> getMetadata() {
175                 return null;  //To change body of implemented methods use File | Settings | File Templates.
176             }
177
178             @Override
179             public MultivaluedMap<String, String> getStringHeaders() {
180                 return null;  //To change body of implemented methods use File | Settings | File Templates.
181             }
182
183             @Override
184             public String getHeaderString(String s) {
185                 return null;  //To change body of implemented methods use File | Settings | File Templates.
186             }
187         });
188     }
189
190 }