2 * Copyright 2017 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.
18 import org.junit.Before;
19 import org.junit.Test;
20 import org.junit.runner.RunWith;
21 import org.onap.sfc.entity.PortPairGroupReq4N;
22 import org.onap.sfc.service.ISdnControllerService;
23 import org.onap.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;
28 import javax.ws.rs.core.*;
29 import java.lang.annotation.Annotation;
31 import java.util.Date;
32 import java.util.Locale;
36 @RunWith(PowerMockRunner.class)
37 @PrepareForTest(ISdnControllerService.class)
38 public class TestPortPairGroup {
41 public void test_createportpairgroup() throws Exception {
42 N2sReqWrapper.convertPortPairGroup(new PortPairGroupReq4N());
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() {
50 // public MsbRegisterEntity registerServce(@QueryParam("createOrUpdate") String createOrUpdate, MsbRegisterEntity entity) throws Exception {
55 PowerMockito.mockStatic(ISdnControllerService.class);
56 ISdnControllerService service = PowerMockito.mock(ISdnControllerService.class);
57 PowerMockito.when(service.createPortPair("Authorization","")).thenReturn(new Response() {
59 public int getStatus() {
60 return 0; //To change body of implemented methods use File | Settings | File Templates.
64 public StatusType getStatusInfo() {
65 return null; //To change body of implemented methods use File | Settings | File Templates.
69 public Object getEntity() {
70 return null; //To change body of implemented methods use File | Settings | File Templates.
74 public <T> T readEntity(Class<T> tClass) {
75 return null; //To change body of implemented methods use File | Settings | File Templates.
79 public <T> T readEntity(GenericType<T> tGenericType) {
80 return null; //To change body of implemented methods use File | Settings | File Templates.
84 public <T> T readEntity(Class<T> tClass, Annotation[] annotations) {
85 return null; //To change body of implemented methods use File | Settings | File Templates.
89 public <T> T readEntity(GenericType<T> tGenericType, Annotation[] annotations) {
90 return null; //To change body of implemented methods use File | Settings | File Templates.
94 public boolean hasEntity() {
95 return false; //To change body of implemented methods use File | Settings | File Templates.
99 public boolean bufferEntity() {
100 return false; //To change body of implemented methods use File | Settings | File Templates.
104 public void close() {
105 //To change body of implemented methods use File | Settings | File Templates.
109 public MediaType getMediaType() {
110 return null; //To change body of implemented methods use File | Settings | File Templates.
114 public Locale getLanguage() {
115 return null; //To change body of implemented methods use File | Settings | File Templates.
119 public int getLength() {
120 return 0; //To change body of implemented methods use File | Settings | File Templates.
124 public Set<String> getAllowedMethods() {
125 return null; //To change body of implemented methods use File | Settings | File Templates.
129 public Map<String, NewCookie> getCookies() {
130 return null; //To change body of implemented methods use File | Settings | File Templates.
134 public EntityTag getEntityTag() {
135 return null; //To change body of implemented methods use File | Settings | File Templates.
139 public Date getDate() {
140 return null; //To change body of implemented methods use File | Settings | File Templates.
144 public Date getLastModified() {
145 return null; //To change body of implemented methods use File | Settings | File Templates.
149 public URI getLocation() {
150 return null; //To change body of implemented methods use File | Settings | File Templates.
154 public Set<Link> getLinks() {
155 return null; //To change body of implemented methods use File | Settings | File Templates.
159 public boolean hasLink(String s) {
160 return false; //To change body of implemented methods use File | Settings | File Templates.
164 public Link getLink(String s) {
165 return null; //To change body of implemented methods use File | Settings | File Templates.
169 public Link.Builder getLinkBuilder(String s) {
170 return null; //To change body of implemented methods use File | Settings | File Templates.
174 public MultivaluedMap<String, Object> getMetadata() {
175 return null; //To change body of implemented methods use File | Settings | File Templates.
179 public MultivaluedMap<String, String> getStringHeaders() {
180 return null; //To change body of implemented methods use File | Settings | File Templates.
184 public String getHeaderString(String s) {
185 return null; //To change body of implemented methods use File | Settings | File Templates.