diff options
author | mukesh.paliwal <mukesh.paliwal1@huawei.com> | 2021-02-18 12:07:24 +0530 |
---|---|---|
committer | mukesh.paliwal <mukesh.paliwal1@huawei.com> | 2021-02-18 12:07:24 +0530 |
commit | 55365a40012d165d73e842f3f9871364a567f64f (patch) | |
tree | e6144589021cad95b063ae18b8c486a2198d960e /adapters/mso-vfc-adapter/src/test/java | |
parent | 1073f37d4136f5c7f75ab608830285726765f6e0 (diff) |
Remove mso-vfc-adapter from SO
Issue-ID: SO-3536
Signed-off-by: mukesh.paliwal <mukesh.paliwal1@huawei.com>
Change-Id: Id0836f5e7900fdb69fb6f2c04b8657746b801805
Diffstat (limited to 'adapters/mso-vfc-adapter/src/test/java')
48 files changed, 0 insertions, 4985 deletions
diff --git a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/exceptions/ApplicationExceptionTest.java b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/exceptions/ApplicationExceptionTest.java deleted file mode 100644 index c0305f18de..0000000000 --- a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/exceptions/ApplicationExceptionTest.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * ============LICENSE_START======================================================= ONAP : SO - * ================================================================================ Copyright (C) 2018 TechMahindra - * ================================================================================ Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy - * of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.adapters.vfc.exceptions; - -import static org.junit.Assert.*; -import org.junit.Test; - -public class ApplicationExceptionTest { - private ApplicationException application = new ApplicationException(500, null); - - @Test - public void testApplicationException() { - application.setErrorCode(500); - application.setErrorMsg("ErrorMsg"); - assertEquals(application.getErrorCode(), 500); - assertEquals(application.getErrorMsg(), "ErrorMsg"); - } - - @Test - public void testbuildErrorResponse() { - assert (application.buildErrorResponse() != null); - } -} diff --git a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/AddPnfDataTest.java b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/AddPnfDataTest.java deleted file mode 100644 index 1fedac9cc9..0000000000 --- a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/AddPnfDataTest.java +++ /dev/null @@ -1,189 +0,0 @@ -/* - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -import org.junit.Test; -import java.util.Collection; -import java.util.Iterator; -import java.util.List; -import java.util.ListIterator; -import static org.junit.Assert.*; - -public class AddPnfDataTest { - AddPnfData pnfData = new AddPnfData(); - - @Test - public void getPnfId() { - pnfData.getPnfId(); - } - - - @Test - public void setPnfId() { - pnfData.setPnfId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); - } - - @Test - public void getPnfName() { - pnfData.getPnfName(); - } - - @Test - public void setPnfName() { - pnfData.setPnfName("Router"); - } - - @Test - public void getPnfdId() { - pnfData.getPnfdId(); - } - - @Test - public void setPnfdId() { - pnfData.setPnfdId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); - } - - @Test - public void getPnfProfileId() { - pnfData.getPnfProfileId(); - } - - @Test - public void setPnfProfileId() { - pnfData.setPnfProfileId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); - } - - @Test - public void getCpData() { - pnfData.getCpData(); - } - - @Test - public void setCpData() { - pnfData.setCpData(new List<PnfExtCpData>() { - @Override - public int size() { - return 0; - } - - @Override - public boolean isEmpty() { - return false; - } - - @Override - public boolean contains(Object o) { - return false; - } - - @Override - public Iterator<PnfExtCpData> iterator() { - return null; - } - - @Override - public Object[] toArray() { - return new Object[0]; - } - - @Override - public <T> T[] toArray(T[] a) { - return null; - } - - @Override - public boolean add(PnfExtCpData pnfExtCpData) { - return false; - } - - @Override - public boolean remove(Object o) { - return false; - } - - @Override - public boolean containsAll(Collection<?> c) { - return false; - } - - @Override - public boolean addAll(Collection<? extends PnfExtCpData> c) { - return false; - } - - @Override - public boolean addAll(int index, Collection<? extends PnfExtCpData> c) { - return false; - } - - @Override - public boolean removeAll(Collection<?> c) { - return false; - } - - @Override - public boolean retainAll(Collection<?> c) { - return false; - } - - @Override - public void clear() { - - } - - @Override - public PnfExtCpData get(int index) { - return null; - } - - @Override - public PnfExtCpData set(int index, PnfExtCpData element) { - return null; - } - - @Override - public void add(int index, PnfExtCpData element) { - - } - - @Override - public PnfExtCpData remove(int index) { - return null; - } - - @Override - public int indexOf(Object o) { - return 0; - } - - @Override - public int lastIndexOf(Object o) { - return 0; - } - - @Override - public ListIterator<PnfExtCpData> listIterator() { - return null; - } - - @Override - public ListIterator<PnfExtCpData> listIterator(int index) { - return null; - } - - @Override - public List<PnfExtCpData> subList(int fromIndex, int toIndex) { - return null; - } - }); - } -} diff --git a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/AddressRangeTest.java b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/AddressRangeTest.java deleted file mode 100644 index 9444efd4c5..0000000000 --- a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/AddressRangeTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -import org.junit.Test; -import static org.junit.Assert.*; - -public class AddressRangeTest { - AddressRange addressRange = new AddressRange(); - - @Test - public void getMinAddress() { - addressRange.getMinAddress(); - } - - @Test - public void setMinAddress() { - addressRange.setMinAddress("192.168.10.10"); - } - - @Test - public void getMaxAddress() { - addressRange.getMaxAddress(); - } - - @Test - public void setMaxAddress() { - addressRange.setMaxAddress("192.168.10.10"); - } -} diff --git a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/AffectedNsTest.java b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/AffectedNsTest.java deleted file mode 100644 index 06c52e2e52..0000000000 --- a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/AffectedNsTest.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -import org.junit.Test; -import static org.junit.Assert.*; - -public class AffectedNsTest { - - AffectedNs affectedNs = new AffectedNs(); - - @Test - public void getNsInstanceId() { - affectedNs.getNsInstanceId(); - } - - @Test - public void setNsInstanceId() { - affectedNs.setNsInstanceId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); - } - - @Test - public void getNsdId() { - affectedNs.getNsdId(); - } - - @Test - public void setNsdId() { - affectedNs.setNsdId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); - } -} diff --git a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/AffectedPnfTest.java b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/AffectedPnfTest.java deleted file mode 100644 index beecbe0675..0000000000 --- a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/AffectedPnfTest.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -import org.junit.Test; -import static org.junit.Assert.*; - -public class AffectedPnfTest { - AffectedPnf affectedPnf = new AffectedPnf(); - - @Test - public void getPnfid() { - affectedPnf.getPnfid(); - } - - @Test - public void setPnfid() { - affectedPnf.setPnfid("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); - } - - @Test - public void getPnfdid() { - affectedPnf.getPnfdid(); - } - - @Test - public void setPnfdid() { - affectedPnf.setPnfdid("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); - } - - @Test - public void getPnfProfileId() { - affectedPnf.getPnfProfileId(); - } - - @Test - public void setPnfProfileId() { - affectedPnf.setPnfProfileId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); - } - - @Test - public void getPnfName() { - affectedPnf.getPnfName(); - } - - @Test - public void setPnfName() { - affectedPnf.setPnfName("Router"); - } - - @Test - public void getCpInstanceId() { - affectedPnf.getCpInstanceId(); - } - - @Test - public void setCpInstanceId() { - affectedPnf.setCpInstanceId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); - } -} diff --git a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/AffectedSapTest.java b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/AffectedSapTest.java deleted file mode 100644 index b96fe32836..0000000000 --- a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/AffectedSapTest.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -import org.junit.Test; -import static org.junit.Assert.*; - -public class AffectedSapTest { - AffectedSap affectedSap = new AffectedSap(); - - @Test - public void getSapInstanceId() { - affectedSap.getSapInstanceId(); - } - - @Test - public void setSapInstanceId() { - affectedSap.setSapInstanceId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); - } - - @Test - public void getSapdId() { - affectedSap.getSapdId(); - } - - @Test - public void setSapdId() { - affectedSap.setSapdId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); - } - - @Test - public void getSapName() { - affectedSap.getSapName(); - } - - @Test - public void setSapName() { - affectedSap.setSapName("Dummy SAP"); - } -} diff --git a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/AffectedVirtualLinkTest.java b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/AffectedVirtualLinkTest.java deleted file mode 100644 index dbc6d0811f..0000000000 --- a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/AffectedVirtualLinkTest.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -import org.junit.Test; -import static org.junit.Assert.*; - -public class AffectedVirtualLinkTest { - AffectedVirtualLink affectedVirtualLink = new AffectedVirtualLink(); - - @Test - public void getNsVirtualLinkInstanceId() { - affectedVirtualLink.getNsVirtualLinkInstanceId(); - } - - @Test - public void setNsVirtualLinkInstanceId() { - affectedVirtualLink.setNsVirtualLinkInstanceId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); - } - - @Test - public void getNsVirtualLinkDescId() { - affectedVirtualLink.getNsVirtualLinkDescId(); - } - - @Test - public void setNsVirtualLinkDescId() { - affectedVirtualLink.setNsVirtualLinkDescId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); - } - - @Test - public void getVlProfileId() { - affectedVirtualLink.getVlProfileId(); - } - - @Test - public void setVlProfileId() { - affectedVirtualLink.setVlProfileId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); - } -} diff --git a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/AffectedVnfTest.java b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/AffectedVnfTest.java deleted file mode 100644 index 810f32d005..0000000000 --- a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/AffectedVnfTest.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -import org.junit.Test; -import static org.junit.Assert.*; - -public class AffectedVnfTest { - AffectedVnf affectedVnf = new AffectedVnf(); - - @Test - public void getVnfInstanceId() { - affectedVnf.getVnfInstanceId(); - } - - @Test - public void setVnfInstanceId() { - affectedVnf.setVnfInstanceId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); - } - - @Test - public void getVnfdId() { - affectedVnf.getVnfdId(); - } - - @Test - public void setVnfdId() { - affectedVnf.setVnfdId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); - } - - @Test - public void getVnfProfileId() { - affectedVnf.getVnfProfileId(); - } - - @Test - public void setVnfProfileId() { - affectedVnf.setVnfProfileId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); - } - - @Test - public void getVnfName() { - affectedVnf.getVnfName(); - } - - @Test - public void setVnfName() { - affectedVnf.setVnfName("Dummy Vnf Name"); - } - - @Test - public void getChangedInfo() { - affectedVnf.getChangedInfo(); - } - - @Test - public void setChangedInfo() { - affectedVnf.setChangedInfo(new ChangedInfo()); - } -} diff --git a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/AffectedVnffgTest.java b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/AffectedVnffgTest.java deleted file mode 100644 index 0d5670133d..0000000000 --- a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/AffectedVnffgTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -import org.junit.Test; -import static org.junit.Assert.*; - -public class AffectedVnffgTest { - AffectedVnffg affectedVnffg = new AffectedVnffg(); - - @Test - public void getVnffgInstanceId() { - affectedVnffg.getVnffgInstanceId(); - } - - @Test - public void setVnffgInstanceId() { - affectedVnffg.setVnffgInstanceId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); - } - - @Test - public void getVnffgdId() { - affectedVnffg.getVnffgdId(); - } - - @Test - public void setVnffgdId() { - affectedVnffg.setVnffgdId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); - } -} diff --git a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/AffinityOrAntiAffinityRuleTest.java b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/AffinityOrAntiAffinityRuleTest.java deleted file mode 100644 index 99a40e4ee1..0000000000 --- a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/AffinityOrAntiAffinityRuleTest.java +++ /dev/null @@ -1,283 +0,0 @@ -/* - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -import org.junit.Test; -import java.util.Collection; -import java.util.Iterator; -import java.util.List; -import java.util.ListIterator; -import static org.junit.Assert.*; - -public class AffinityOrAntiAffinityRuleTest { - AffinityOrAntiAffinityRule affinityOrAntiAffinityRule = new AffinityOrAntiAffinityRule(); - - @Test - public void getVnfdId() { - affinityOrAntiAffinityRule.getVnfdId(); - } - - @Test - public void setVnfdId() { - affinityOrAntiAffinityRule.setVnfdId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); - } - - @Test - public void getVnfProfileId() { - affinityOrAntiAffinityRule.getVnfProfileId(); - } - - @Test - public void setVnfProfileId() { - affinityOrAntiAffinityRule.setVnfProfileId(new List<String>() { - @Override - public int size() { - return 0; - } - - @Override - public boolean isEmpty() { - return false; - } - - @Override - public boolean contains(Object o) { - return false; - } - - @Override - public Iterator<String> iterator() { - return null; - } - - @Override - public Object[] toArray() { - return new Object[0]; - } - - @Override - public <T> T[] toArray(T[] a) { - return null; - } - - @Override - public boolean add(String s) { - return false; - } - - @Override - public boolean remove(Object o) { - return false; - } - - @Override - public boolean containsAll(Collection<?> c) { - return false; - } - - @Override - public boolean addAll(Collection<? extends String> c) { - return false; - } - - @Override - public boolean addAll(int index, Collection<? extends String> c) { - return false; - } - - @Override - public boolean removeAll(Collection<?> c) { - return false; - } - - @Override - public boolean retainAll(Collection<?> c) { - return false; - } - - @Override - public void clear() { - - } - - @Override - public String get(int index) { - return null; - } - - @Override - public String set(int index, String element) { - return null; - } - - @Override - public void add(int index, String element) { - - } - - @Override - public String remove(int index) { - return null; - } - - @Override - public int indexOf(Object o) { - return 0; - } - - @Override - public int lastIndexOf(Object o) { - return 0; - } - - @Override - public ListIterator<String> listIterator() { - return null; - } - - @Override - public ListIterator<String> listIterator(int index) { - return null; - } - - @Override - public List<String> subList(int fromIndex, int toIndex) { - return null; - } - }); - } - - @Test - public void getVnfInstanceId() { - affinityOrAntiAffinityRule.getVnfInstanceId(); - } - - @Test - public void setVnfInstanceId() { - affinityOrAntiAffinityRule.setVnfInstanceId(new List<String>() { - @Override - public int size() { - return 0; - } - - @Override - public boolean isEmpty() { - return false; - } - - @Override - public boolean contains(Object o) { - return false; - } - - @Override - public Iterator<String> iterator() { - return null; - } - - @Override - public Object[] toArray() { - return new Object[0]; - } - - @Override - public <T> T[] toArray(T[] a) { - return null; - } - - @Override - public boolean add(String s) { - return false; - } - - @Override - public boolean remove(Object o) { - return false; - } - - @Override - public boolean containsAll(Collection<?> c) { - return false; - } - - @Override - public boolean addAll(Collection<? extends String> c) { - return false; - } - - @Override - public boolean addAll(int index, Collection<? extends String> c) { - return false; - } - - @Override - public boolean removeAll(Collection<?> c) { - return false; - } - - @Override - public boolean retainAll(Collection<?> c) { - return false; - } - - @Override - public void clear() { - - } - - @Override - public String get(int index) { - return null; - } - - @Override - public String set(int index, String element) { - return null; - } - - @Override - public void add(int index, String element) { - - } - - @Override - public String remove(int index) { - return null; - } - - @Override - public int indexOf(Object o) { - return 0; - } - - @Override - public int lastIndexOf(Object o) { - return 0; - } - - @Override - public ListIterator<String> listIterator() { - return null; - } - - @Override - public ListIterator<String> listIterator(int index) { - return null; - } - - @Override - public List<String> subList(int fromIndex, int toIndex) { - return null; - } - }); - } -} diff --git a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/ChangedInfoTest.java b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/ChangedInfoTest.java deleted file mode 100644 index 41077fbe67..0000000000 --- a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/ChangedInfoTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -import org.junit.Test; -import static org.junit.Assert.*; - -public class ChangedInfoTest { - ChangedInfo changedInfo = new ChangedInfo(); - - @Test - public void getChangedVnfInfo() { - changedInfo.getChangedVnfInfo(); - } - - @Test - public void setChangedVnfInfo() { - changedInfo.setChangedVnfInfo(new ModifyVnfInfoData()); - } - - @Test - public void getChangedExtConnectivity() { - changedInfo.getChangedExtConnectivity(); - } - - @Test - public void setChangedExtConnectivity() { - changedInfo.setChangedExtConnectivity(new ExtVirtualLinkInfo()); - } -} diff --git a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/CivicAddressElementTest.java b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/CivicAddressElementTest.java deleted file mode 100644 index e9c011b86a..0000000000 --- a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/CivicAddressElementTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -import org.junit.Test; -import static org.junit.Assert.*; - -public class CivicAddressElementTest { - CivicAddressElement civicAddressElement = new CivicAddressElement(); - - @Test - public void getCaType() { - civicAddressElement.getCaType(); - } - - @Test - public void setCaType() { - civicAddressElement.setCaType(12); - } - - @Test - public void getCaValue() { - civicAddressElement.getCaValue(); - } - - @Test - public void setCaValue() { - civicAddressElement.setCaValue("Dummy Ca value"); - } -} diff --git a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/CpProtocolDataTest.java b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/CpProtocolDataTest.java deleted file mode 100644 index e47d02c926..0000000000 --- a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/CpProtocolDataTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -import org.junit.Test; -import static org.junit.Assert.*; - -public class CpProtocolDataTest { - CpProtocolData cpProtocolData = new CpProtocolData(); - - @Test - public void getLayerProtocol() { - cpProtocolData.getLayerProtocol(); - } - - @Test - public void setLayerProtocol() { - cpProtocolData.setLayerProtocol("BGP"); - } - - @Test - public void getIpOverEthernet() { - cpProtocolData.getIpOverEthernet(); - } - - @Test - public void setIpOverEthernet() { - cpProtocolData.setIpOverEthernet(new IpOverEthernetAddressData()); - } -} diff --git a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/CreateNsRequestTest.java b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/CreateNsRequestTest.java deleted file mode 100644 index a2a6ae4fe1..0000000000 --- a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/CreateNsRequestTest.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -import org.junit.Test; -import static org.junit.Assert.*; - -public class CreateNsRequestTest { - CreateNsRequest createNsRequest = new CreateNsRequest(); - - @Test - public void getNsdId() { - createNsRequest.getNsdId(); - } - - @Test - public void setNsdId() { - createNsRequest.setNsdId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); - } - - @Test - public void getNsDescription() { - createNsRequest.getNsDescription(); - } - - @Test - public void setNsDescription() { - createNsRequest.setNsDescription("Dummy description"); - } - - @Test - public void getNsName() { - createNsRequest.getNsName(); - } - - @Test - public void setNsName() { - createNsRequest.setNsName("Dummy Name"); - } -} diff --git a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/CustomerModelTest.java b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/CustomerModelTest.java deleted file mode 100644 index 548d8b3645..0000000000 --- a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/CustomerModelTest.java +++ /dev/null @@ -1,49 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ -package org.onap.so.adapters.vfc.model; - -import org.junit.Test; - -public class CustomerModelTest { - // TODO: following test case is done for coverage - // later it should be modified for proper test. - CustomerModel customerModel = new CustomerModel(); - - @Test - public void getGlobalCustomerId() throws Exception { - customerModel.getGlobalCustomerId(); - } - - @Test - public void setGlobalCustomerId() throws Exception { - customerModel.setGlobalCustomerId("test"); - } - - @Test - public void getServiceType() throws Exception { - customerModel.getServiceType(); - } - - @Test - public void setServiceType() throws Exception { - customerModel.setServiceType("service"); - } - -} diff --git a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/ExtLinkPortInfoTest.java b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/ExtLinkPortInfoTest.java deleted file mode 100644 index 92cec88b34..0000000000 --- a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/ExtLinkPortInfoTest.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -import org.junit.Test; -import static org.junit.Assert.*; - -public class ExtLinkPortInfoTest { - - ExtLinkPortInfo extLinkPortInfo = new ExtLinkPortInfo(); - - @Test - public void getId() { - extLinkPortInfo.getId(); - } - - @Test - public void setId() { - extLinkPortInfo.setId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); - } - - @Test - public void getResourceHandle() { - extLinkPortInfo.getResourceHandle(); - } - - @Test - public void setResourceHandle() { - extLinkPortInfo.setResourceHandle(new ResourceHandle()); - } -} diff --git a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/ExtVirtualLinkInfoTest.java b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/ExtVirtualLinkInfoTest.java deleted file mode 100644 index c455b36a46..0000000000 --- a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/ExtVirtualLinkInfoTest.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -import org.junit.Test; -import static org.junit.Assert.*; - -public class ExtVirtualLinkInfoTest { - ExtVirtualLinkInfo extVirtualLinkInfo = new ExtVirtualLinkInfo(); - - @Test - public void getId() { - extVirtualLinkInfo.getId(); - } - - @Test - public void setId() { - extVirtualLinkInfo.setId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); - } - - @Test - public void getResourceHandle() { - extVirtualLinkInfo.getResourceHandle(); - } - - @Test - public void setResourceHandle() { - extVirtualLinkInfo.setResourceHandle(new ResourceHandle()); - } - - @Test - public void getExtLinkPorts() { - extVirtualLinkInfo.getExtLinkPorts(); - } - - @Test - public void setExtLinkPorts() { - extVirtualLinkInfo.setExtLinkPorts(new ExtLinkPortInfo()); - } -} diff --git a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/InstantiateNsRequestTest.java b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/InstantiateNsRequestTest.java deleted file mode 100644 index f27b041690..0000000000 --- a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/InstantiateNsRequestTest.java +++ /dev/null @@ -1,413 +0,0 @@ -/* - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -import org.junit.Test; -import java.util.Collection; -import java.util.Iterator; -import java.util.List; -import java.util.ListIterator; -import static org.junit.Assert.*; - -public class InstantiateNsRequestTest { - InstantiateNsRequest instantiateNsRequest = new InstantiateNsRequest(); - - @Test - public void getNsFlavourId() { - instantiateNsRequest.getNsFlavourId(); - } - - @Test - public void setNsFlavourId() { - instantiateNsRequest.setNsFlavourId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); - } - - @Test - public void getSapData() { - instantiateNsRequest.getSapData(); - } - - @Test - public void setSapData() { - instantiateNsRequest.setSapData(new List<SapData>() { - @Override - public int size() { - return 0; - } - - @Override - public boolean isEmpty() { - return false; - } - - @Override - public boolean contains(Object o) { - return false; - } - - @Override - public Iterator<SapData> iterator() { - return null; - } - - @Override - public Object[] toArray() { - return new Object[0]; - } - - @Override - public <T> T[] toArray(T[] a) { - return null; - } - - @Override - public boolean add(SapData sapData) { - return false; - } - - @Override - public boolean remove(Object o) { - return false; - } - - @Override - public boolean containsAll(Collection<?> c) { - return false; - } - - @Override - public boolean addAll(Collection<? extends SapData> c) { - return false; - } - - @Override - public boolean addAll(int index, Collection<? extends SapData> c) { - return false; - } - - @Override - public boolean removeAll(Collection<?> c) { - return false; - } - - @Override - public boolean retainAll(Collection<?> c) { - return false; - } - - @Override - public void clear() { - - } - - @Override - public SapData get(int index) { - return null; - } - - @Override - public SapData set(int index, SapData element) { - return null; - } - - @Override - public void add(int index, SapData element) { - - } - - @Override - public SapData remove(int index) { - return null; - } - - @Override - public int indexOf(Object o) { - return 0; - } - - @Override - public int lastIndexOf(Object o) { - return 0; - } - - @Override - public ListIterator<SapData> listIterator() { - return null; - } - - @Override - public ListIterator<SapData> listIterator(int index) { - return null; - } - - @Override - public List<SapData> subList(int fromIndex, int toIndex) { - return null; - } - }); - } - - @Test - public void getAddpnfData() { - instantiateNsRequest.getAddpnfData(); - } - - @Test - public void setAddpnfData() { - instantiateNsRequest.setAddpnfData(new List<AddPnfData>() { - @Override - public int size() { - return 0; - } - - @Override - public boolean isEmpty() { - return false; - } - - @Override - public boolean contains(Object o) { - return false; - } - - @Override - public Iterator<AddPnfData> iterator() { - return null; - } - - @Override - public Object[] toArray() { - return new Object[0]; - } - - @Override - public <T> T[] toArray(T[] a) { - return null; - } - - @Override - public boolean add(AddPnfData addPnfData) { - return false; - } - - @Override - public boolean remove(Object o) { - return false; - } - - @Override - public boolean containsAll(Collection<?> c) { - return false; - } - - @Override - public boolean addAll(Collection<? extends AddPnfData> c) { - return false; - } - - @Override - public boolean addAll(int index, Collection<? extends AddPnfData> c) { - return false; - } - - @Override - public boolean removeAll(Collection<?> c) { - return false; - } - - @Override - public boolean retainAll(Collection<?> c) { - return false; - } - - @Override - public void clear() { - - } - - @Override - public AddPnfData get(int index) { - return null; - } - - @Override - public AddPnfData set(int index, AddPnfData element) { - return null; - } - - @Override - public void add(int index, AddPnfData element) { - - } - - @Override - public AddPnfData remove(int index) { - return null; - } - - @Override - public int indexOf(Object o) { - return 0; - } - - @Override - public int lastIndexOf(Object o) { - return 0; - } - - @Override - public ListIterator<AddPnfData> listIterator() { - return null; - } - - @Override - public ListIterator<AddPnfData> listIterator(int index) { - return null; - } - - @Override - public List<AddPnfData> subList(int fromIndex, int toIndex) { - return null; - } - }); - } - - @Test - public void getVnfInstanceData() { - instantiateNsRequest.getVnfInstanceData(); - } - - @Test - public void setVnfInstanceData() { - instantiateNsRequest.setVnfInstanceData(new List<VnfInstanceData>() { - @Override - public int size() { - return 0; - } - - @Override - public boolean isEmpty() { - return false; - } - - @Override - public boolean contains(Object o) { - return false; - } - - @Override - public Iterator<VnfInstanceData> iterator() { - return null; - } - - @Override - public Object[] toArray() { - return new Object[0]; - } - - @Override - public <T> T[] toArray(T[] a) { - return null; - } - - @Override - public boolean add(VnfInstanceData vnfInstanceData) { - return false; - } - - @Override - public boolean remove(Object o) { - return false; - } - - @Override - public boolean containsAll(Collection<?> c) { - return false; - } - - @Override - public boolean addAll(Collection<? extends VnfInstanceData> c) { - return false; - } - - @Override - public boolean addAll(int index, Collection<? extends VnfInstanceData> c) { - return false; - } - - @Override - public boolean removeAll(Collection<?> c) { - return false; - } - - @Override - public boolean retainAll(Collection<?> c) { - return false; - } - - @Override - public void clear() { - - } - - @Override - public VnfInstanceData get(int index) { - return null; - } - - @Override - public VnfInstanceData set(int index, VnfInstanceData element) { - return null; - } - - @Override - public void add(int index, VnfInstanceData element) { - - } - - @Override - public VnfInstanceData remove(int index) { - return null; - } - - @Override - public int indexOf(Object o) { - return 0; - } - - @Override - public int lastIndexOf(Object o) { - return 0; - } - - @Override - public ListIterator<VnfInstanceData> listIterator() { - return null; - } - - @Override - public ListIterator<VnfInstanceData> listIterator(int index) { - return null; - } - - @Override - public List<VnfInstanceData> subList(int fromIndex, int toIndex) { - return null; - } - }); - } - - @Test - public void getNestedNsInstanceId() { - instantiateNsRequest.getNestedNsInstanceId(); - } -} diff --git a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/IpAddressesTest.java b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/IpAddressesTest.java deleted file mode 100644 index edf6346bca..0000000000 --- a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/IpAddressesTest.java +++ /dev/null @@ -1,188 +0,0 @@ -/* - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -import org.junit.Test; -import java.util.Collection; -import java.util.Iterator; -import java.util.List; -import java.util.ListIterator; -import static org.junit.Assert.*; - -public class IpAddressesTest { - IpAddresses ipAddresses = new IpAddresses(); - - @Test - public void getType() { - ipAddresses.getType(); - } - - @Test - public void setType() { - ipAddresses.setType("Dummy Type"); - } - - @Test - public void getFixedAddresses() { - ipAddresses.getFixedAddresses(); - } - - @Test - public void setFixedAddresses() { - ipAddresses.setFixedAddresses(new List<String>() { - @Override - public int size() { - return 0; - } - - @Override - public boolean isEmpty() { - return false; - } - - @Override - public boolean contains(Object o) { - return false; - } - - @Override - public Iterator<String> iterator() { - return null; - } - - @Override - public Object[] toArray() { - return new Object[0]; - } - - @Override - public <T> T[] toArray(T[] a) { - return null; - } - - @Override - public boolean add(String s) { - return false; - } - - @Override - public boolean remove(Object o) { - return false; - } - - @Override - public boolean containsAll(Collection<?> c) { - return false; - } - - @Override - public boolean addAll(Collection<? extends String> c) { - return false; - } - - @Override - public boolean addAll(int index, Collection<? extends String> c) { - return false; - } - - @Override - public boolean removeAll(Collection<?> c) { - return false; - } - - @Override - public boolean retainAll(Collection<?> c) { - return false; - } - - @Override - public void clear() { - - } - - @Override - public String get(int index) { - return null; - } - - @Override - public String set(int index, String element) { - return null; - } - - @Override - public void add(int index, String element) { - - } - - @Override - public String remove(int index) { - return null; - } - - @Override - public int indexOf(Object o) { - return 0; - } - - @Override - public int lastIndexOf(Object o) { - return 0; - } - - @Override - public ListIterator<String> listIterator() { - return null; - } - - @Override - public ListIterator<String> listIterator(int index) { - return null; - } - - @Override - public List<String> subList(int fromIndex, int toIndex) { - return null; - } - }); - } - - @Test - public void getNumDynamicAddresses() { - ipAddresses.getNumDynamicAddresses(); - } - - @Test - public void setNumDynamicAddresses() { - ipAddresses.setNumDynamicAddresses(5); - } - - @Test - public void getAddressRange() { - ipAddresses.getAddressRange(); - } - - @Test - public void setAddressRange() { - ipAddresses.setAddressRange(new AddressRange()); - } - - @Test - public void getSubnetId() { - ipAddresses.getSubnetId(); - } - - @Test - public void setSubnetId() { - ipAddresses.setSubnetId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); - } -} diff --git a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/IpOverEthernetAddressDataTest.java b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/IpOverEthernetAddressDataTest.java deleted file mode 100644 index 0088cdc50b..0000000000 --- a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/IpOverEthernetAddressDataTest.java +++ /dev/null @@ -1,158 +0,0 @@ -/* - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -import org.junit.Test; -import java.util.Collection; -import java.util.Iterator; -import java.util.List; -import java.util.ListIterator; -import static org.junit.Assert.*; - -public class IpOverEthernetAddressDataTest { - IpOverEthernetAddressData ipOverEthernetAddressData = new IpOverEthernetAddressData(); - - @Test - public void getMacAddress() { - ipOverEthernetAddressData.getMacAddress(); - } - - @Test - public void setMacAddress() { - ipOverEthernetAddressData.setMacAddress("4e:86:9f:62:c1:bf"); - } - - @Test - public void getIpAddresses() { - ipOverEthernetAddressData.getIpAddresses(); - } - - @Test - public void setIpAddresses() { - ipOverEthernetAddressData.setIpAddresses(new List<IpAddresses>() { - @Override - public int size() { - return 0; - } - - @Override - public boolean isEmpty() { - return false; - } - - @Override - public boolean contains(Object o) { - return false; - } - - @Override - public Iterator<IpAddresses> iterator() { - return null; - } - - @Override - public Object[] toArray() { - return new Object[0]; - } - - @Override - public <T> T[] toArray(T[] a) { - return null; - } - - @Override - public boolean add(IpAddresses ipAddresses) { - return false; - } - - @Override - public boolean remove(Object o) { - return false; - } - - @Override - public boolean containsAll(Collection<?> c) { - return false; - } - - @Override - public boolean addAll(Collection<? extends IpAddresses> c) { - return false; - } - - @Override - public boolean addAll(int index, Collection<? extends IpAddresses> c) { - return false; - } - - @Override - public boolean removeAll(Collection<?> c) { - return false; - } - - @Override - public boolean retainAll(Collection<?> c) { - return false; - } - - @Override - public void clear() { - - } - - @Override - public IpAddresses get(int index) { - return null; - } - - @Override - public IpAddresses set(int index, IpAddresses element) { - return null; - } - - @Override - public void add(int index, IpAddresses element) { - - } - - @Override - public IpAddresses remove(int index) { - return null; - } - - @Override - public int indexOf(Object o) { - return 0; - } - - @Override - public int lastIndexOf(Object o) { - return 0; - } - - @Override - public ListIterator<IpAddresses> listIterator() { - return null; - } - - @Override - public ListIterator<IpAddresses> listIterator(int index) { - return null; - } - - @Override - public List<IpAddresses> subList(int fromIndex, int toIndex) { - return null; - } - }); - } -} diff --git a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/LinkTest.java b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/LinkTest.java deleted file mode 100644 index e447c85ee7..0000000000 --- a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/LinkTest.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -import org.junit.Test; -import static org.junit.Assert.*; - -public class LinkTest { - Link link = new Link(); - - @Test - public void getHref() { - link.getHref(); - } - - @Test - public void setHref() { - link.setHref("dummy href"); - } -} diff --git a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/LinksTest.java b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/LinksTest.java deleted file mode 100644 index aef87c47b1..0000000000 --- a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/LinksTest.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -import org.junit.Test; -import static org.junit.Assert.*; - -public class LinksTest { - Links links = new Links(); - - @Test - public void getSelf() { - links.getSelf(); - } - - @Test - public void setSelf() { - links.setSelf(new Link()); - } - - @Test - public void getNsInstance() { - links.getNsInstance(); - } - - @Test - public void setNsInstance() { - links.setNsInstance(new Link()); - } - - @Test - public void getCancel() { - links.getCancel(); - } - - @Test - public void setCancel() { - links.setCancel(new Link()); - } - - @Test - public void getRetry() { - links.getRetry(); - } - - @Test - public void setRetry() { - links.setRetry(new Link()); - } - - @Test - public void getRollback() { - links.getRollback(); - } - - @Test - public void setRollback() { - links.setRollback(new Link()); - } - - @Test - public void getContinues() { - links.getContinues(); - } - - @Test - public void setContinues() { - links.setContinues(new Link()); - } - - @Test - public void getFail() { - links.getFail(); - } - - @Test - public void setFail() { - links.setFail(new Link()); - } -} diff --git a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/LocationConstraintTest.java b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/LocationConstraintTest.java deleted file mode 100644 index 2b217469e5..0000000000 --- a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/LocationConstraintTest.java +++ /dev/null @@ -1,49 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ -package org.onap.so.adapters.vfc.model; - -import org.junit.Test; - -public class LocationConstraintTest { - // TODO: following test case is done for coverage - // later it should be modified for proper test. - LocationConstraint locationConstraint = new LocationConstraint(); - - @Test - public void getVnfProfileId() throws Exception { - locationConstraint.getVnfProfileId(); - } - - @Test - public void setVnfProfileId() throws Exception { - locationConstraint.setVnfProfileId("profileID"); - } - - @Test - public void getLocationConstraints() throws Exception { - locationConstraint.getLocationConstraints(); - } - - @Test - public void setLocationConstraints() throws Exception { - locationConstraint.setLocationConstraints(new VimLocation()); - } - -} diff --git a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/LocationConstraintsTest.java b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/LocationConstraintsTest.java deleted file mode 100644 index e68b12a626..0000000000 --- a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/LocationConstraintsTest.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -import org.junit.Test; -import static org.junit.Assert.*; - -public class LocationConstraintsTest { - LocationConstraints locationConstraints = new LocationConstraints(); - - @Test - public void getCountryCode() { - locationConstraints.getCountryCode(); - } - - @Test - public void setCountryCode() { - locationConstraints.setCountryCode("IND"); - - } - - @Test - public void getCivicAddressElement() { - locationConstraints.getCivicAddressElement(); - } - - @Test - public void setCivicAddressElement() { - locationConstraints.setCivicAddressElement(new CivicAddressElement()); - } -} diff --git a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/ModifyVnfInfoDataTest.java b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/ModifyVnfInfoDataTest.java deleted file mode 100644 index c300923857..0000000000 --- a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/ModifyVnfInfoDataTest.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -import org.junit.Test; -import java.util.HashMap; -import static org.junit.Assert.*; - -public class ModifyVnfInfoDataTest { - ModifyVnfInfoData modifyVnfInfoData = new ModifyVnfInfoData(); - - @Test - public void getVnfInstanceId() { - modifyVnfInfoData.getVnfInstanceId(); - } - - @Test - public void setVnfInstanceId() { - modifyVnfInfoData.setVnfInstanceId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); - } - - @Test - public void getVnfInstanceName() { - modifyVnfInfoData.getVnfInstanceName(); - } - - @Test - public void setVnfInstanceName() { - modifyVnfInfoData.setVnfInstanceName("Dummy vnfInstanceName"); - } - - @Test - public void getVnfInstanceDescription() { - modifyVnfInfoData.getVnfInstanceDescription(); - } - - @Test - public void setVnfInstanceDescription() { - modifyVnfInfoData.setVnfInstanceDescription("Dummy vnfInstanceDescription"); - } - - @Test - public void getVnfPkgId() { - modifyVnfInfoData.getVnfPkgId(); - } - - @Test - public void setVnfPkgId() { - modifyVnfInfoData.setVnfPkgId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); - } - - @Test - public void getVnfConfigurableProperties() { - modifyVnfInfoData.getVnfConfigurableProperties(); - } - - @Test - public void setVnfConfigurableProperties() { - modifyVnfInfoData.setVnfConfigurableProperties(new HashMap<>()); - } - - @Test - public void getMetadata() { - modifyVnfInfoData.getMetadata(); - } - - @Test - public void setMetadata() { - modifyVnfInfoData.setMetadata(new HashMap<>()); - } - - @Test - public void getExtensions() { - modifyVnfInfoData.getExtensions(); - } - - @Test - public void setExtensions() { - modifyVnfInfoData.setExtensions(new HashMap<>()); - } -} diff --git a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/NSResourceInputParameterTest.java b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/NSResourceInputParameterTest.java deleted file mode 100644 index 082d4e69f4..0000000000 --- a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/NSResourceInputParameterTest.java +++ /dev/null @@ -1,69 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ -package org.onap.so.adapters.vfc.model; - -import org.junit.Test; - -public class NSResourceInputParameterTest { - // TODO: following test case is done for coverage - // later it should be modified for proper test. - NSResourceInputParameter nsResourceInputParameter = new NSResourceInputParameter(); - - @Test - public void getNsServiceName() throws Exception { - nsResourceInputParameter.getNsServiceName(); - } - - @Test - public void setNsServiceName() throws Exception { - nsResourceInputParameter.setNsServiceName("service"); - } - - @Test - public void getNsServiceDescription() throws Exception { - nsResourceInputParameter.getNsServiceDescription(); - } - - @Test - public void setNsServiceDescription() throws Exception { - nsResourceInputParameter.setNsServiceDescription("desc"); - } - - @Test - public void getNsParameters() throws Exception { - nsResourceInputParameter.getNsParameters(); - } - - @Test - public void setNsParameters() throws Exception { - nsResourceInputParameter.setNsParameters(new NsParameters()); - } - - @Test - public void getNsOperationKey() throws Exception { - nsResourceInputParameter.getNsOperationKey(); - } - - @Test - public void setNsOperationKey() throws Exception { - nsResourceInputParameter.setNsOperationKey(new NsOperationKey()); - } - -} diff --git a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/NsCreateReqTest.java b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/NsCreateReqTest.java deleted file mode 100644 index c2e6b583af..0000000000 --- a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/NsCreateReqTest.java +++ /dev/null @@ -1,69 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ -package org.onap.so.adapters.vfc.model; - -import org.junit.Test; - -public class NsCreateReqTest { - // TODO: following test case is done for coverage - // later it should be modified for proper test. - NsCreateReq nsCreateReq = new NsCreateReq(); - - @Test - public void getContext() throws Exception { - nsCreateReq.getContext(); - } - - @Test - public void setContext() throws Exception { - nsCreateReq.setContext(new CustomerModel()); - } - - @Test - public void getCsarId() throws Exception { - nsCreateReq.getCsarId(); - } - - @Test - public void setCsarId() throws Exception { - nsCreateReq.setCsarId("csarid"); - } - - @Test - public void getNsName() throws Exception { - nsCreateReq.getNsName(); - } - - @Test - public void setNsName() throws Exception { - nsCreateReq.setNsName("nsname"); - } - - @Test - public void getDescription() throws Exception { - nsCreateReq.getDescription(); - } - - @Test - public void setDescription() throws Exception { - nsCreateReq.setDescription("desc"); - } - -} diff --git a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/NsInstantiateReqTest.java b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/NsInstantiateReqTest.java deleted file mode 100644 index 70e54a1c09..0000000000 --- a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/NsInstantiateReqTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ -package org.onap.so.adapters.vfc.model; - -import org.junit.Test; - -public class NsInstantiateReqTest { - // TODO: following test case is done for coverage - // later it should be modified for proper test. - NsInstantiateReq nsInstantiateReq = new NsInstantiateReq(); - - @Test - public void getNsInstanceId() throws Exception { - nsInstantiateReq.getNsInstanceId(); - } - - @Test - public void setNsInstanceId() throws Exception { - nsInstantiateReq.setNsInstanceId("test"); - } - -} diff --git a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/NsLcmOpOccTest.java b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/NsLcmOpOccTest.java deleted file mode 100644 index f5d485a8c7..0000000000 --- a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/NsLcmOpOccTest.java +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -import org.junit.Test; -import org.onap.so.adapters.vfc.constant.CommonConstant; -import java.time.LocalDateTime; -import java.util.Date; -import static org.junit.Assert.*; - -public class NsLcmOpOccTest { - NsLcmOpOcc nsLcmOpOcc = new NsLcmOpOcc(); - - @Test - public void getLcmOperationType() { - nsLcmOpOcc.getLcmOperationType(); - } - - @Test - public void setLcmOperationType() { - nsLcmOpOcc.setLcmOperationType(CommonConstant.lcmOperationType.INSTANTIATE); - } - - @Test - public void getCancelMode() { - nsLcmOpOcc.getCancelMode(); - } - - @Test - public void setCancelMode() { - nsLcmOpOcc.setCancelMode(CommonConstant.cancelMode.GRACEFUL); - } - - @Test - public void getOperationState() { - nsLcmOpOcc.getOperationState(); - } - - @Test - public void setOperationState() { - nsLcmOpOcc.setOperationState(CommonConstant.operationState.COMPLETED); - } - - @Test - public void getId() { - nsLcmOpOcc.getId(); - } - - @Test - public void setId() { - nsLcmOpOcc.setId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); - } - - @Test - public void getStatusEnteredTime() { - nsLcmOpOcc.getStatusEnteredTime(); - } - - @Test - public void setStatusEnteredTime() { - nsLcmOpOcc.setStatusEnteredTime(LocalDateTime.now().toString()); - } - - @Test - public void getNsInstanceId() { - nsLcmOpOcc.getNsInstanceId(); - } - - @Test - public void setNsInstanceId() { - nsLcmOpOcc.setNsInstanceId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); - } - - @Test - public void getStartTime() { - nsLcmOpOcc.getStartTime(); - } - - @Test - public void setStartTime() { - nsLcmOpOcc.setStartTime(LocalDateTime.now().toString()); - } - - @Test - public void getAutomaticInvocation() { - nsLcmOpOcc.getAutomaticInvocation(); - } - - @Test - public void setAutomaticInvocation() { - nsLcmOpOcc.setAutomaticInvocation(true); - } - - @Test - public void getOperationParams() { - nsLcmOpOcc.getOperationParams(); - } - - @Test - public void setOperationParams() { - nsLcmOpOcc.setOperationParams("Dummy operationParams"); - } - - @Test - public void getCancelPending() { - nsLcmOpOcc.getCancelPending(); - } - - @Test - public void setCancelPending() { - nsLcmOpOcc.setCancelPending(true); - } - - @Test - public void getError() { - nsLcmOpOcc.getError(); - } - - @Test - public void setError() { - nsLcmOpOcc.setError(new ProblemDetails()); - } - - @Test - public void getLinks() { - nsLcmOpOcc.getLinks(); - } - - @Test - public void setLinks() { - nsLcmOpOcc.setLinks(new Links()); - } -} diff --git a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/NsOperationKeyTest.java b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/NsOperationKeyTest.java deleted file mode 100644 index a8939f8996..0000000000 --- a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/NsOperationKeyTest.java +++ /dev/null @@ -1,79 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ -package org.onap.so.adapters.vfc.model; - -import org.junit.Test; - -public class NsOperationKeyTest { - // TODO: following test case is done for coverage - // later it should be modified for proper test. - NsOperationKey nsOperationKey = new NsOperationKey(); - - @Test - public void getGlobalSubscriberId() throws Exception { - nsOperationKey.getGlobalSubscriberId(); - } - - @Test - public void setGlobalSubscriberId() throws Exception { - nsOperationKey.setGlobalSubscriberId("subscriberid"); - } - - @Test - public void getServiceType() throws Exception { - nsOperationKey.getServiceType(); - } - - @Test - public void setServiceType() throws Exception { - nsOperationKey.setServiceType("servicetype"); - } - - @Test - public void getServiceId() throws Exception { - nsOperationKey.getServiceId(); - } - - @Test - public void setServiceId() throws Exception { - nsOperationKey.setServiceId("serviceid"); - } - - @Test - public void getOperationId() throws Exception { - nsOperationKey.getOperationId(); - } - - @Test - public void setOperationId() throws Exception { - nsOperationKey.setOperationId("test"); - } - - @Test - public void getNodeTemplateUUID() throws Exception { - nsOperationKey.getNodeTemplateUUID(); - } - - @Test - public void setNodeTemplateUUID() throws Exception { - nsOperationKey.setNodeTemplateUUID("nodeTemplateid"); - } - -} diff --git a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/NsParametersTest.java b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/NsParametersTest.java deleted file mode 100644 index 45c46edd0d..0000000000 --- a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/NsParametersTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ -package org.onap.so.adapters.vfc.model; - -import org.junit.Test; -import java.util.Collections; -import java.util.HashMap; - -public class NsParametersTest { - // TODO: following test case is done for coverage - // later it should be modified for proper test. - NsParameters nsParameters = new NsParameters(); - - @Test - public void getLocationConstraints() throws Exception { - nsParameters.getLocationConstraints(); - } - - @Test - public void setLocationConstraints() throws Exception { - nsParameters.setLocationConstraints(Collections.emptyList()); - } - - @Test - public void getAdditionalParamForNs() throws Exception { - nsParameters.getAdditionalParamForNs(); - } - - @Test - public void setAdditionalParamForNs() throws Exception { - nsParameters.setAdditionalParamForNs(new HashMap<>()); - } - -} diff --git a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/NsProgressStatusTest.java b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/NsProgressStatusTest.java deleted file mode 100644 index b1040ef463..0000000000 --- a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/NsProgressStatusTest.java +++ /dev/null @@ -1,60 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ -package org.onap.so.adapters.vfc.model; - -import org.junit.Test; -import java.util.Arrays; - -public class NsProgressStatusTest { - // TODO: following test case is done for coverage - // later it should be modified for proper test. - NsProgressStatus nsProgressStatus = new NsProgressStatus(); - - @Test - public void getJobId() throws Exception { - nsProgressStatus.getJobId(); - } - - @Test - public void setJobId() throws Exception { - nsProgressStatus.setJobId("jobid"); - } - - @Test - public void getResponseDescriptor() throws Exception { - nsProgressStatus.getResponseDescriptor(); - } - - @Test - public void setResponseDescriptor() throws Exception { - nsProgressStatus.setResponseDescriptor(new ResponseDescriptor()); - } - - @Test - public void getResponseHistoryList() throws Exception { - nsProgressStatus.getResponseHistoryList(); - } - - @Test - public void setResponseHistoryList() throws Exception { - nsProgressStatus.setResponseHistoryList(Arrays.asList(new ResponseDescriptor())); - } - -} diff --git a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/ParamsForVnfTest.java b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/ParamsForVnfTest.java deleted file mode 100644 index e0455b0728..0000000000 --- a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/ParamsForVnfTest.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -import org.junit.Test; -import java.util.HashMap; -import static org.junit.Assert.*; - -public class ParamsForVnfTest { - - ParamsForVnf paramsForVnf = new ParamsForVnf(); - - @Test - public void getVnfProfileId() { - paramsForVnf.getVnfProfileId(); - } - - @Test - public void setVnfProfileId() { - paramsForVnf.setVnfProfileId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); - } - - @Test - public void getAdditionalParams() { - paramsForVnf.getAdditionalParams(); - } - - @Test - public void setAdditionalParams() { - paramsForVnf.setAdditionalParams(new HashMap<>()); - } -} diff --git a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/PnfExtCpDataTest.java b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/PnfExtCpDataTest.java deleted file mode 100644 index c586c7eb65..0000000000 --- a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/PnfExtCpDataTest.java +++ /dev/null @@ -1,168 +0,0 @@ -/* - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -import org.junit.Test; -import java.util.Collection; -import java.util.Iterator; -import java.util.List; -import java.util.ListIterator; -import static org.junit.Assert.*; - -public class PnfExtCpDataTest { - PnfExtCpData pnfExtCpData = new PnfExtCpData(); - - @Test - public void getCpInstanceI16() { - pnfExtCpData.getCpInstanceI16(); - } - - @Test - public void setCpInstanceI16() { - pnfExtCpData.setCpInstanceI16("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); - } - - @Test - public void getCpdId() { - pnfExtCpData.getCpdId(); - } - - @Test - public void setCpdId() { - pnfExtCpData.setCpdId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); - } - - @Test - public void getCpProtocolData() { - pnfExtCpData.getCpProtocolData(); - } - - @Test - public void setCpProtocolData() { - pnfExtCpData.setCpProtocolData(new List<CpProtocolData>() { - @Override - public int size() { - return 0; - } - - @Override - public boolean isEmpty() { - return false; - } - - @Override - public boolean contains(Object o) { - return false; - } - - @Override - public Iterator<CpProtocolData> iterator() { - return null; - } - - @Override - public Object[] toArray() { - return new Object[0]; - } - - @Override - public <T> T[] toArray(T[] a) { - return null; - } - - @Override - public boolean add(CpProtocolData cpProtocolData) { - return false; - } - - @Override - public boolean remove(Object o) { - return false; - } - - @Override - public boolean containsAll(Collection<?> c) { - return false; - } - - @Override - public boolean addAll(Collection<? extends CpProtocolData> c) { - return false; - } - - @Override - public boolean addAll(int index, Collection<? extends CpProtocolData> c) { - return false; - } - - @Override - public boolean removeAll(Collection<?> c) { - return false; - } - - @Override - public boolean retainAll(Collection<?> c) { - return false; - } - - @Override - public void clear() { - - } - - @Override - public CpProtocolData get(int index) { - return null; - } - - @Override - public CpProtocolData set(int index, CpProtocolData element) { - return null; - } - - @Override - public void add(int index, CpProtocolData element) { - - } - - @Override - public CpProtocolData remove(int index) { - return null; - } - - @Override - public int indexOf(Object o) { - return 0; - } - - @Override - public int lastIndexOf(Object o) { - return 0; - } - - @Override - public ListIterator<CpProtocolData> listIterator() { - return null; - } - - @Override - public ListIterator<CpProtocolData> listIterator(int index) { - return null; - } - - @Override - public List<CpProtocolData> subList(int fromIndex, int toIndex) { - return null; - } - }); - } -} diff --git a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/ProblemDetailsTest.java b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/ProblemDetailsTest.java deleted file mode 100644 index ddea6cca40..0000000000 --- a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/ProblemDetailsTest.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -import org.junit.Test; -import static org.junit.Assert.*; - -public class ProblemDetailsTest { - ProblemDetails problemDetails = new ProblemDetails(); - - @Test - public void getType() { - problemDetails.getType(); - } - - @Test - public void setType() { - problemDetails.setType("Dummy Type"); - } - - @Test - public void getTitle() { - problemDetails.getTitle(); - } - - @Test - public void setTitle() { - problemDetails.setTitle("Dummy Title"); - } - - @Test - public void getStatus() { - problemDetails.getStatus(); - } - - @Test - public void setStatus() { - problemDetails.setStatus(200); - } - - @Test - public void getDetail() { - problemDetails.getDetail(); - } - - @Test - public void setDetail() { - problemDetails.setTitle("Dummy Title"); - } - - @Test - public void getInstance() { - problemDetails.getInstance(); - } - - @Test - public void setInstance() { - problemDetails.setInstance("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); - } -} diff --git a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/ResourceChangesTest.java b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/ResourceChangesTest.java deleted file mode 100644 index 9c4a0295e6..0000000000 --- a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/ResourceChangesTest.java +++ /dev/null @@ -1,773 +0,0 @@ -/* - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -import org.junit.Test; -import java.util.Collection; -import java.util.Iterator; -import java.util.List; -import java.util.ListIterator; -import static org.junit.Assert.*; - -public class ResourceChangesTest { - ResourceChanges resourceChanges = new ResourceChanges(); - - @Test - public void getAffectedVnfs() { - resourceChanges.getAffectedVnfs(); - } - - @Test - public void setAffectedVnfs() { - resourceChanges.setAffectedVnfs(new List<AffectedVnf>() { - @Override - public int size() { - return 0; - } - - @Override - public boolean isEmpty() { - return false; - } - - @Override - public boolean contains(Object o) { - return false; - } - - @Override - public Iterator<AffectedVnf> iterator() { - return null; - } - - @Override - public Object[] toArray() { - return new Object[0]; - } - - @Override - public <T> T[] toArray(T[] a) { - return null; - } - - @Override - public boolean add(AffectedVnf affectedVnf) { - return false; - } - - @Override - public boolean remove(Object o) { - return false; - } - - @Override - public boolean containsAll(Collection<?> c) { - return false; - } - - @Override - public boolean addAll(Collection<? extends AffectedVnf> c) { - return false; - } - - @Override - public boolean addAll(int index, Collection<? extends AffectedVnf> c) { - return false; - } - - @Override - public boolean removeAll(Collection<?> c) { - return false; - } - - @Override - public boolean retainAll(Collection<?> c) { - return false; - } - - @Override - public void clear() { - - } - - @Override - public AffectedVnf get(int index) { - return null; - } - - @Override - public AffectedVnf set(int index, AffectedVnf element) { - return null; - } - - @Override - public void add(int index, AffectedVnf element) { - - } - - @Override - public AffectedVnf remove(int index) { - return null; - } - - @Override - public int indexOf(Object o) { - return 0; - } - - @Override - public int lastIndexOf(Object o) { - return 0; - } - - @Override - public ListIterator<AffectedVnf> listIterator() { - return null; - } - - @Override - public ListIterator<AffectedVnf> listIterator(int index) { - return null; - } - - @Override - public List<AffectedVnf> subList(int fromIndex, int toIndex) { - return null; - } - }); - } - - @Test - public void getAffectedPnfs() { - resourceChanges.getAffectedPnfs(); - } - - @Test - public void setAffectedPnfs() { - resourceChanges.setAffectedPnfs(new List<AffectedPnf>() { - @Override - public int size() { - return 0; - } - - @Override - public boolean isEmpty() { - return false; - } - - @Override - public boolean contains(Object o) { - return false; - } - - @Override - public Iterator<AffectedPnf> iterator() { - return null; - } - - @Override - public Object[] toArray() { - return new Object[0]; - } - - @Override - public <T> T[] toArray(T[] a) { - return null; - } - - @Override - public boolean add(AffectedPnf affectedPnf) { - return false; - } - - @Override - public boolean remove(Object o) { - return false; - } - - @Override - public boolean containsAll(Collection<?> c) { - return false; - } - - @Override - public boolean addAll(Collection<? extends AffectedPnf> c) { - return false; - } - - @Override - public boolean addAll(int index, Collection<? extends AffectedPnf> c) { - return false; - } - - @Override - public boolean removeAll(Collection<?> c) { - return false; - } - - @Override - public boolean retainAll(Collection<?> c) { - return false; - } - - @Override - public void clear() { - - } - - @Override - public AffectedPnf get(int index) { - return null; - } - - @Override - public AffectedPnf set(int index, AffectedPnf element) { - return null; - } - - @Override - public void add(int index, AffectedPnf element) { - - } - - @Override - public AffectedPnf remove(int index) { - return null; - } - - @Override - public int indexOf(Object o) { - return 0; - } - - @Override - public int lastIndexOf(Object o) { - return 0; - } - - @Override - public ListIterator<AffectedPnf> listIterator() { - return null; - } - - @Override - public ListIterator<AffectedPnf> listIterator(int index) { - return null; - } - - @Override - public List<AffectedPnf> subList(int fromIndex, int toIndex) { - return null; - } - }); - } - - @Test - public void getAffectedVls() { - resourceChanges.getAffectedVls(); - } - - @Test - public void setAffectedVls() { - resourceChanges.setAffectedVls(new List<AffectedVirtualLink>() { - @Override - public int size() { - return 0; - } - - @Override - public boolean isEmpty() { - return false; - } - - @Override - public boolean contains(Object o) { - return false; - } - - @Override - public Iterator<AffectedVirtualLink> iterator() { - return null; - } - - @Override - public Object[] toArray() { - return new Object[0]; - } - - @Override - public <T> T[] toArray(T[] a) { - return null; - } - - @Override - public boolean add(AffectedVirtualLink affectedVirtualLink) { - return false; - } - - @Override - public boolean remove(Object o) { - return false; - } - - @Override - public boolean containsAll(Collection<?> c) { - return false; - } - - @Override - public boolean addAll(Collection<? extends AffectedVirtualLink> c) { - return false; - } - - @Override - public boolean addAll(int index, Collection<? extends AffectedVirtualLink> c) { - return false; - } - - @Override - public boolean removeAll(Collection<?> c) { - return false; - } - - @Override - public boolean retainAll(Collection<?> c) { - return false; - } - - @Override - public void clear() { - - } - - @Override - public AffectedVirtualLink get(int index) { - return null; - } - - @Override - public AffectedVirtualLink set(int index, AffectedVirtualLink element) { - return null; - } - - @Override - public void add(int index, AffectedVirtualLink element) { - - } - - @Override - public AffectedVirtualLink remove(int index) { - return null; - } - - @Override - public int indexOf(Object o) { - return 0; - } - - @Override - public int lastIndexOf(Object o) { - return 0; - } - - @Override - public ListIterator<AffectedVirtualLink> listIterator() { - return null; - } - - @Override - public ListIterator<AffectedVirtualLink> listIterator(int index) { - return null; - } - - @Override - public List<AffectedVirtualLink> subList(int fromIndex, int toIndex) { - return null; - } - }); - } - - @Test - public void getAffectedVnffgs() { - resourceChanges.getAffectedVnffgs(); - } - - @Test - public void setAffectedVnffgs() { - resourceChanges.setAffectedVnffgs(new List<AffectedVnffg>() { - @Override - public int size() { - return 0; - } - - @Override - public boolean isEmpty() { - return false; - } - - @Override - public boolean contains(Object o) { - return false; - } - - @Override - public Iterator<AffectedVnffg> iterator() { - return null; - } - - @Override - public Object[] toArray() { - return new Object[0]; - } - - @Override - public <T> T[] toArray(T[] a) { - return null; - } - - @Override - public boolean add(AffectedVnffg affectedVnffg) { - return false; - } - - @Override - public boolean remove(Object o) { - return false; - } - - @Override - public boolean containsAll(Collection<?> c) { - return false; - } - - @Override - public boolean addAll(Collection<? extends AffectedVnffg> c) { - return false; - } - - @Override - public boolean addAll(int index, Collection<? extends AffectedVnffg> c) { - return false; - } - - @Override - public boolean removeAll(Collection<?> c) { - return false; - } - - @Override - public boolean retainAll(Collection<?> c) { - return false; - } - - @Override - public void clear() { - - } - - @Override - public AffectedVnffg get(int index) { - return null; - } - - @Override - public AffectedVnffg set(int index, AffectedVnffg element) { - return null; - } - - @Override - public void add(int index, AffectedVnffg element) { - - } - - @Override - public AffectedVnffg remove(int index) { - return null; - } - - @Override - public int indexOf(Object o) { - return 0; - } - - @Override - public int lastIndexOf(Object o) { - return 0; - } - - @Override - public ListIterator<AffectedVnffg> listIterator() { - return null; - } - - @Override - public ListIterator<AffectedVnffg> listIterator(int index) { - return null; - } - - @Override - public List<AffectedVnffg> subList(int fromIndex, int toIndex) { - return null; - } - }); - } - - @Test - public void getAffectedNss() { - resourceChanges.getAffectedNss(); - } - - @Test - public void setAffectedNss() { - resourceChanges.setAffectedNss(new List<AffectedNs>() { - @Override - public int size() { - return 0; - } - - @Override - public boolean isEmpty() { - return false; - } - - @Override - public boolean contains(Object o) { - return false; - } - - @Override - public Iterator<AffectedNs> iterator() { - return null; - } - - @Override - public Object[] toArray() { - return new Object[0]; - } - - @Override - public <T> T[] toArray(T[] a) { - return null; - } - - @Override - public boolean add(AffectedNs affectedNs) { - return false; - } - - @Override - public boolean remove(Object o) { - return false; - } - - @Override - public boolean containsAll(Collection<?> c) { - return false; - } - - @Override - public boolean addAll(Collection<? extends AffectedNs> c) { - return false; - } - - @Override - public boolean addAll(int index, Collection<? extends AffectedNs> c) { - return false; - } - - @Override - public boolean removeAll(Collection<?> c) { - return false; - } - - @Override - public boolean retainAll(Collection<?> c) { - return false; - } - - @Override - public void clear() { - - } - - @Override - public AffectedNs get(int index) { - return null; - } - - @Override - public AffectedNs set(int index, AffectedNs element) { - return null; - } - - @Override - public void add(int index, AffectedNs element) { - - } - - @Override - public AffectedNs remove(int index) { - return null; - } - - @Override - public int indexOf(Object o) { - return 0; - } - - @Override - public int lastIndexOf(Object o) { - return 0; - } - - @Override - public ListIterator<AffectedNs> listIterator() { - return null; - } - - @Override - public ListIterator<AffectedNs> listIterator(int index) { - return null; - } - - @Override - public List<AffectedNs> subList(int fromIndex, int toIndex) { - return null; - } - }); - } - - @Test - public void getAffectedSaps() { - resourceChanges.getAffectedSaps(); - } - - @Test - public void setAffectedSaps() { - resourceChanges.setAffectedSaps(new List<AffectedSap>() { - @Override - public int size() { - return 0; - } - - @Override - public boolean isEmpty() { - return false; - } - - @Override - public boolean contains(Object o) { - return false; - } - - @Override - public Iterator<AffectedSap> iterator() { - return null; - } - - @Override - public Object[] toArray() { - return new Object[0]; - } - - @Override - public <T> T[] toArray(T[] a) { - return null; - } - - @Override - public boolean add(AffectedSap affectedSap) { - return false; - } - - @Override - public boolean remove(Object o) { - return false; - } - - @Override - public boolean containsAll(Collection<?> c) { - return false; - } - - @Override - public boolean addAll(Collection<? extends AffectedSap> c) { - return false; - } - - @Override - public boolean addAll(int index, Collection<? extends AffectedSap> c) { - return false; - } - - @Override - public boolean removeAll(Collection<?> c) { - return false; - } - - @Override - public boolean retainAll(Collection<?> c) { - return false; - } - - @Override - public void clear() { - - } - - @Override - public AffectedSap get(int index) { - return null; - } - - @Override - public AffectedSap set(int index, AffectedSap element) { - return null; - } - - @Override - public void add(int index, AffectedSap element) { - - } - - @Override - public AffectedSap remove(int index) { - return null; - } - - @Override - public int indexOf(Object o) { - return 0; - } - - @Override - public int lastIndexOf(Object o) { - return 0; - } - - @Override - public ListIterator<AffectedSap> listIterator() { - return null; - } - - @Override - public ListIterator<AffectedSap> listIterator(int index) { - return null; - } - - @Override - public List<AffectedSap> subList(int fromIndex, int toIndex) { - return null; - } - }); - } -} diff --git a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/ResourceHandleTest.java b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/ResourceHandleTest.java deleted file mode 100644 index 6390c5afbd..0000000000 --- a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/ResourceHandleTest.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -import org.junit.Test; -import static org.junit.Assert.*; - -public class ResourceHandleTest { - ResourceHandle resourceHandle = new ResourceHandle(); - - @Test - public void getVimId() { - resourceHandle.getVimId(); - } - - @Test - public void setVimId() { - resourceHandle.setVimId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); - } - - @Test - public void getResourceProviderId() { - resourceHandle.getResourceProviderId(); - } - - @Test - public void setResourceProviderId() { - resourceHandle.setResourceProviderId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); - } - - @Test - public void getResourceId() { - resourceHandle.getResourceId(); - } - - @Test - public void setResourceId() { - resourceHandle.setResourceId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); - } - - @Test - public void getVimLevelResourceType() { - resourceHandle.getVimLevelResourceType(); - } - - @Test - public void setVimLevelResourceType() { - resourceHandle.setVimLevelResourceType("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); - } -} diff --git a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/ResponseDescriptorTest.java b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/ResponseDescriptorTest.java deleted file mode 100644 index 3f2f73531c..0000000000 --- a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/ResponseDescriptorTest.java +++ /dev/null @@ -1,79 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ -package org.onap.so.adapters.vfc.model; - -import org.junit.Test; - -public class ResponseDescriptorTest { - // TODO: following test case is done for coverage - // later it should be modified for proper test. - ResponseDescriptor responseDescriptor = new ResponseDescriptor(); - - @Test - public void getStatus() throws Exception { - responseDescriptor.getStatus(); - } - - @Test - public void setStatus() throws Exception { - responseDescriptor.setStatus("test"); - } - - @Test - public void getProgress() throws Exception { - responseDescriptor.getProgress(); - } - - @Test - public void setProgress() throws Exception { - responseDescriptor.setProgress("10"); - } - - @Test - public void getStatusDescription() throws Exception { - responseDescriptor.getStatusDescription(); - } - - @Test - public void setStatusDescription() throws Exception { - responseDescriptor.setStatusDescription("test"); - } - - @Test - public void getErrorCode() throws Exception { - responseDescriptor.getErrorCode(); - } - - @Test - public void setErrorCode() throws Exception { - responseDescriptor.setErrorCode(-1); - } - - @Test - public void getResponseId() throws Exception { - responseDescriptor.getResponseId(); - } - - @Test - public void setResponseId() throws Exception { - responseDescriptor.setResponseId(1); - } - -} diff --git a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/RestfulResponseTest.java b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/RestfulResponseTest.java deleted file mode 100644 index 64f8da65b4..0000000000 --- a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/RestfulResponseTest.java +++ /dev/null @@ -1,75 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ -package org.onap.so.adapters.vfc.model; - -import org.junit.Test; -import java.util.HashMap; - -public class RestfulResponseTest { - // TODO: following test case is done for coverage - // later it should be modified for proper test. - RestfulResponse restfulResponse = new RestfulResponse(); - - @Test - public void getStatus() throws Exception { - restfulResponse.getStatus(); - } - - @Test - public void setStatus() throws Exception { - restfulResponse.setStatus(1); - } - - @Test - public void getRespHeaderMap() throws Exception { - restfulResponse.getRespHeaderMap(); - } - - @Test - public void setRespHeaderMap() throws Exception { - restfulResponse.setRespHeaderMap(new HashMap<>()); - } - - @Test - public void getRespHeaderInt() throws Exception { - restfulResponse.getRespHeaderInt("1"); - } - - @Test - public void getRespHeaderLong() throws Exception { - restfulResponse.getRespHeaderLong("1"); - } - - @Test - public void getRespHeaderStr() throws Exception { - restfulResponse.getRespHeaderStr("test"); - } - - @Test - public void getResponseContent() throws Exception { - restfulResponse.getResponseContent(); - } - - @Test - public void setResponseContent() throws Exception { - restfulResponse.setResponseContent("responseString"); - } - -} diff --git a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/SapDataTest.java b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/SapDataTest.java deleted file mode 100644 index 2a455994b8..0000000000 --- a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/SapDataTest.java +++ /dev/null @@ -1,179 +0,0 @@ -/* - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -import org.junit.Test; -import java.util.Collection; -import java.util.Iterator; -import java.util.List; -import java.util.ListIterator; -import static org.junit.Assert.*; - -public class SapDataTest { - - SapData sapData = new SapData(); - - @Test - public void getSapdId() { - sapData.getSapdId(); - } - - @Test - public void setSapdId() { - sapData.setSapdId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); - } - - @Test - public void getSapName() { - sapData.getSapName(); - } - - @Test - public void setSapName() { - sapData.setSapName("Dummy SapName"); - } - - @Test - public void getDescription() { - sapData.getDescription(); - } - - @Test - public void setDescription() { - sapData.setDescription("Dummy Description"); - } - - @Test - public void getSapProtocolData() { - sapData.getSapProtocolData(); - } - - @Test - public void setSapProtocolData() { - sapData.setSapProtocolData(new List<CpProtocolData>() { - @Override - public int size() { - return 0; - } - - @Override - public boolean isEmpty() { - return false; - } - - @Override - public boolean contains(Object o) { - return false; - } - - @Override - public Iterator<CpProtocolData> iterator() { - return null; - } - - @Override - public Object[] toArray() { - return new Object[0]; - } - - @Override - public <T> T[] toArray(T[] a) { - return null; - } - - @Override - public boolean add(CpProtocolData cpProtocolData) { - return false; - } - - @Override - public boolean remove(Object o) { - return false; - } - - @Override - public boolean containsAll(Collection<?> c) { - return false; - } - - @Override - public boolean addAll(Collection<? extends CpProtocolData> c) { - return false; - } - - @Override - public boolean addAll(int index, Collection<? extends CpProtocolData> c) { - return false; - } - - @Override - public boolean removeAll(Collection<?> c) { - return false; - } - - @Override - public boolean retainAll(Collection<?> c) { - return false; - } - - @Override - public void clear() { - - } - - @Override - public CpProtocolData get(int index) { - return null; - } - - @Override - public CpProtocolData set(int index, CpProtocolData element) { - return null; - } - - @Override - public void add(int index, CpProtocolData element) { - - } - - @Override - public CpProtocolData remove(int index) { - return null; - } - - @Override - public int indexOf(Object o) { - return 0; - } - - @Override - public int lastIndexOf(Object o) { - return 0; - } - - @Override - public ListIterator<CpProtocolData> listIterator() { - return null; - } - - @Override - public ListIterator<CpProtocolData> listIterator(int index) { - return null; - } - - @Override - public List<CpProtocolData> subList(int fromIndex, int toIndex) { - return null; - } - }); - } -} diff --git a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/VimLocationTest.java b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/VimLocationTest.java deleted file mode 100644 index 85d3a136af..0000000000 --- a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/VimLocationTest.java +++ /dev/null @@ -1,39 +0,0 @@ - -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */package org.onap.so.adapters.vfc.model; - -import org.junit.Test; - -public class VimLocationTest { - // TODO: following test case is done for coverage - // later it should be modified for proper test. - VimLocation vimLocation = new VimLocation(); - - @Test - public void getVimId() throws Exception { - vimLocation.getVimId(); - } - - @Test - public void setVimId() throws Exception { - vimLocation.setVimId("vimid"); - } - -} diff --git a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/VnfInstanceDataTest.java b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/VnfInstanceDataTest.java deleted file mode 100644 index b9bdfe3f6e..0000000000 --- a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/VnfInstanceDataTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -import org.junit.Test; -import static org.junit.Assert.*; - -public class VnfInstanceDataTest { - VnfInstanceData vnfInstanceData = new VnfInstanceData(); - - @Test - public void getVnfInstanceId() { - vnfInstanceData.getVnfInstanceId(); - } - - @Test - public void setVnfInstanceId() { - vnfInstanceData.setVnfInstanceId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); - } - - @Test - public void getVnfProfileId() { - vnfInstanceData.getVnfProfileId(); - } - - @Test - public void setVnfProfileId() { - vnfInstanceData.setVnfProfileId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); - } -} diff --git a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/VnfLocationConstraintTest.java b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/VnfLocationConstraintTest.java deleted file mode 100644 index b8f9b8e3e2..0000000000 --- a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/VnfLocationConstraintTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -import org.junit.Test; -import static org.junit.Assert.*; - -public class VnfLocationConstraintTest { - VnfLocationConstraint vnfLocationConstraint = new VnfLocationConstraint(); - - @Test - public void getVnfProfileId() { - vnfLocationConstraint.getVnfProfileId(); - } - - @Test - public void setVnfProfileId() { - vnfLocationConstraint.setVnfProfileId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); - } - - @Test - public void getLocationConstraints() { - vnfLocationConstraint.getLocationConstraints(); - } - - @Test - public void setLocationConstraints() { - vnfLocationConstraint.setLocationConstraints(new LocationConstraint()); - } -} diff --git a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/rest/EmbeddedMariaDbConfig.java b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/rest/EmbeddedMariaDbConfig.java deleted file mode 100644 index feb40f73e0..0000000000 --- a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/rest/EmbeddedMariaDbConfig.java +++ /dev/null @@ -1,86 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.adapters.vfc.rest; - -import ch.vorburger.exec.ManagedProcessException; -import ch.vorburger.mariadb4j.DBConfigurationBuilder; -import ch.vorburger.mariadb4j.springframework.MariaDB4jSpringService; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.boot.jdbc.DataSourceBuilder; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.Primary; -import org.springframework.context.annotation.Profile; -import org.springframework.data.jpa.repository.config.EnableJpaRepositories; -import org.springframework.orm.jpa.JpaTransactionManager; -import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; -import org.springframework.transaction.PlatformTransactionManager; -import org.springframework.transaction.annotation.EnableTransactionManagement; -import javax.persistence.EntityManagerFactory; -import javax.sql.DataSource; - -@Configuration -@Profile({"test"}) -@EnableTransactionManagement -@EnableJpaRepositories(entityManagerFactoryRef = "requestEntityManagerFactory", - transactionManagerRef = "requestTransactionManager", basePackages = {"org.onap.so.db.request.data.repository"}) -public class EmbeddedMariaDbConfig { - - @Bean - MariaDB4jSpringService mariaDB4jSpringService() { - return new MariaDB4jSpringService(); - } - - @Primary - @Bean(name = "requestDataSource") - @ConfigurationProperties(prefix = "spring.datasource") - DataSource dataSource(MariaDB4jSpringService mariaDB4jSpringService, - @Value("${mariaDB4j.databaseName}") String databaseName, - @Value("${spring.datasource.username}") String datasourceUsername, - @Value("${spring.datasource.password}") String datasourcePassword, - @Value("${spring.datasource.driver-class-name}") String datasourceDriver) throws ManagedProcessException { - // Create our database with default root user and no password - mariaDB4jSpringService.getDB().createDB(databaseName); - - DBConfigurationBuilder config = mariaDB4jSpringService.getConfiguration(); - - return DataSourceBuilder.create().username(datasourceUsername).password(datasourcePassword) - .url(config.getURL(databaseName)).driverClassName(datasourceDriver).build(); - } - - @Primary - @Bean(name = "requestEntityManagerFactory") - public LocalContainerEntityManagerFactoryBean entityManagerFactory(EntityManagerFactoryBuilder builder, - @Qualifier("requestDataSource") DataSource dataSource) { - return builder.dataSource(dataSource).packages("org.onap.so.db.request.beans").persistenceUnit("requestDB") - .build(); - } - - @Primary - @Bean(name = "requestTransactionManager") - public PlatformTransactionManager transactionManager( - @Qualifier("requestEntityManagerFactory") EntityManagerFactory entityManagerFactory) { - return new JpaTransactionManager(entityManagerFactory); - } -} diff --git a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/rest/HealthCheckHandlerTest.java b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/rest/HealthCheckHandlerTest.java deleted file mode 100644 index fe2bd0bb98..0000000000 --- a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/rest/HealthCheckHandlerTest.java +++ /dev/null @@ -1,67 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.adapters.vfc.rest; - -import static org.junit.Assert.*; -import javax.ws.rs.core.Response; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.onap.so.adapters.vfc.MSOVfcApplication; -import org.springframework.boot.configurationprocessor.json.JSONException; -import org.springframework.boot.web.server.LocalServerPort; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.web.client.TestRestTemplate; -import org.springframework.http.HttpEntity; -import org.springframework.http.HttpHeaders; -import org.springframework.http.HttpMethod; -import org.springframework.http.ResponseEntity; -import org.springframework.test.context.ActiveProfiles; -import org.springframework.test.context.junit4.SpringRunner; - - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = MSOVfcApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) -@ActiveProfiles("test") -public class HealthCheckHandlerTest { - - @LocalServerPort - private int port; - - TestRestTemplate restTemplate = new TestRestTemplate(); - - HttpHeaders headers = new HttpHeaders(); - - - @Test - public void testHealthcheck() throws JSONException { - - HttpEntity<String> entity = new HttpEntity<String>(null, headers); - - ResponseEntity<String> response = - restTemplate.exchange(createURLWithPort("manage/health"), HttpMethod.GET, entity, String.class); - - assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value()); - } - - private String createURLWithPort(String uri) { - return "http://localhost:" + port + uri; - } -} diff --git a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/rest/VfcManagerSol005Test.java b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/rest/VfcManagerSol005Test.java deleted file mode 100644 index 799283ddb4..0000000000 --- a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/rest/VfcManagerSol005Test.java +++ /dev/null @@ -1,221 +0,0 @@ -/* - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.rest; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.Mockito; -import org.mockito.MockitoAnnotations; -import org.onap.so.adapters.vfc.exceptions.ApplicationException; -import org.onap.so.adapters.vfc.model.NSResourceInputParameter; -import org.onap.so.adapters.vfc.model.RestfulResponse; -import org.onap.so.adapters.vfc.util.JsonUtil; -import org.onap.so.adapters.vfc.util.RestfulUtil; -import org.onap.so.db.request.beans.InstanceNfvoMapping; -import org.onap.so.db.request.beans.OperationStatus; -import org.onap.so.db.request.beans.ResourceOperationStatus; -import org.onap.so.db.request.data.repository.InstanceNfvoMappingRepository; -import org.onap.so.db.request.data.repository.OperationStatusRepository; -import org.onap.so.db.request.data.repository.ResourceOperationStatusRepository; -import org.springframework.test.context.junit4.SpringRunner; -import java.io.File; -import java.nio.file.Files; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import static org.mockito.Mockito.when; - -@RunWith(SpringRunner.class) -public class VfcManagerSol005Test { - @InjectMocks - VfcManagerSol005 vfcManagerSol005; - - @Mock - InstanceNfvoMappingRepository instanceNfvoMappingRepository; - - @Mock - ResourceOperationStatusRepository resourceOperationStatusRepository; - - @Mock - OperationStatusRepository operationStatusRepository; - - @Mock - RestfulUtil restfulUtil; - - OperationStatus operationStatus = new OperationStatus(); - - InstanceNfvoMapping instanceNfvoMapping = new InstanceNfvoMapping(); - RestfulResponse restfulResponse = new RestfulResponse(); - RestfulResponse vfcrestfulResponse = new RestfulResponse(); - NSResourceInputParameter nsResourceInputParameter = new NSResourceInputParameter(); - ResourceOperationStatus resourceOperationStatus = new ResourceOperationStatus(); - - @Test - public void createNs() throws ApplicationException, Exception { - restfulResponse.setStatus(200); - ClassLoader classLoader = ClassLoader.getSystemClassLoader(); - - File file = new File(classLoader.getResource("json/createNsReq.json").getFile()); - String content = new String(Files.readAllBytes(file.toPath())).replace("\n", ""); - nsResourceInputParameter = JsonUtil.unMarshal(content, NSResourceInputParameter.class); - file = new File(classLoader.getResource("json/aainfvoResponse.json").getFile()); - content = new String(Files.readAllBytes(file.toPath())).replace("\n", ""); - restfulResponse.setResponseContent(content); - // restfulResponse.setResponseContent("{\"nfvoId\":\"6ee79fe2-9579-475a-9bb9-20cf4358a19e\",\"name\":\"external_nfvo\",\"api-root\":\"xyz\",\"vendor\":\"vz\",\"version\":\"v1.0\",\"url\":\"http://sample.com/\",\"userName\":\"admin\",\"password\":\"sacjnasnc\"}"); - file = new File(classLoader.getResource("json/createNsSol005Response.json").getFile()); - content = new String(Files.readAllBytes(file.toPath())).replace("\n", ""); - vfcrestfulResponse.setStatus(202); - vfcrestfulResponse.setResponseContent(content); - // vfcrestfulResponse.setResponseContent("{\"_links\": {\"heal\": {\"href\": \"\"}, \"instantiate\": {\"href\": - // \"\"}, \"nestedNsInstances\": {\"href\": \"\"}, \"scale\": {\"href\": \"\"}, \"self\": {\"href\": \"\"}, - // \"terminate\": {\"href\": \"\"}, \"update\": {\"href\": \"\"}}, \"additionalAffinityOrAntiAffiniityRule\": - // [{\"Scope\": \"\", \"affinityOrAntiAffiinty\": \"\", \"vnfInstanceId\": [], \"vnfProfileId\": [], \"vnfdId\": - // []}], \"flavourId\": \"\", \"id\": \"c9f0a95e-dea0-4698-96e5-5a79bc5a233d\", \"nestedNsInstanceId\": [], - // \"nsInstanceDescription\": \"\", \"nsInstanceName\": \"\", \"nsScaleStatus\": [{\"nsScaleLevelId\": \"\", - // \"nsScalingAspectId\": \"\"}], \"nsState\": \"\", \"nsdId\": \"\", \"nsdInfoId\": \"\", \"pnfInfo\": - // [{\"cpInfo\": [{\"cpInstanceId\": \"\", \"cpProtocolData\": {\"ipOverEthernet\": {\"ipAddresses\": - // {\"addressRange\": {\"maxAddress\": \"\", \"minAddress\": \"\"}, \"fixedAddresses\": \"\", - // \"numDynamicAddresses\": 1, \"subnetId\": \"\", \"type\": \"\"}, \"macAddress\": {}}, \"layerProtocol\": - // \"IP_OVER_ETHERNET\"}, \"cpdId\": \"\"}], \"pnfId\": \"\", \"pnfName\": \"\", \"pnfProfileId\": \"\", - // \"pnfdId\": \"\", \"pnfdInfoId\": \"\"}], \"sapInfo\": [{\"description\": \"\", \"id\": \"\", \"sapName\": - // \"\", \"sapProtocolInfo\": {\"ipOverEthernet\": {\"ipAddresses\": {\"addressRange\": {\"maxAddress\": \"\", - // \"minAddress\": \"\"}, \"fixedAddresses\": \"\", \"numDynamicAddresses\": 1, \"subnetId\": \"\", \"type\": - // \"\"}, \"macAddress\": \"\"}, \"layerProtocol\": \"IP_OVER_ETHERNET\"}, \"sapdId\": \"\"}], - // \"virtualLinkInfo\": [{\"id\": \"\", \"linkPort\": [{\"id\": \"\", \"resourceHandle\": {\"resourceId\": \"\", - // \"resourceProviderId\": \"\", \"vimId\": \"\", \"vimLevelResourceType\": \"\"}}], \"nsVirtualLinkDescId\": - // \"\", \"resourceHandle\": [{\"resourceId\": \"\", \"resourceProviderId\": \"\", \"vimId\": \"\", - // \"vimLevelResourceType\": \"\"}]}], \"vnfInstance\": [{\"vnfInstanceId\": \"\", \"vnfProfileId\": \"\"}], - // \"vnffgInfo\": [{\"id\": \"\", \"nfpInfo\": [{\"description\": \"\", \"id\": \"\", \"nfpName\": \"\", - // \"nfpRule\": {\"destinationIpAddressPrefix\": \"\", \"destinationPortRange\": \"\", \"dscp\": \"\", - // \"etherDestinationAddress\": \"\", \"etherSourceAddress\": \"\", \"etherType\": \"\", \"extendedCriteria\": - // [{\"length\": 1, \"startingPoint\": 1, \"value\": \"\"}], \"protocol\": \"\", \"sourceIpAddressPrefix\": - // \"\", \"sourcePortRange\": \"\", \"vlanTag\": []}, \"nfpState\": \"\", \"nfpdId\": \"\", \"nscpHandle\": - // [{\"nsInstanceId\": \"\", \"nsSapInstanceId\": \"\", \"pnfExtCpInstanceId\": \"\", \"pnfInfoId\": \"\", - // \"vnfExtCpInstanceId\": \"\", \"vnfInstanceId\": \"\"}], \"totalCp\": 1}], \"nsCpHandle\": - // [{\"nsInstanceId\": \"\", \"nsSapInstanceId\": \"\", \"pnfExtCpInstanceId\": \"\", \"pnfInfoId\": \"\", - // \"vnfExtCpInstanceId\": \"\", \"vnfInstanceId\": \"\"}], \"nsVirtualLinkInfoId\": [], \"pnfInfoId\": [], - // \"vnfInstanceId\": [], \"vnffgdId\": \"\"}]}"); - - resourceOperationStatus.setStatus("processing"); - resourceOperationStatus.setOperationId(nsResourceInputParameter.getNsOperationKey().getOperationId()); - resourceOperationStatus.setServiceId(nsResourceInputParameter.getNsOperationKey().getServiceId()); - resourceOperationStatus - .setResourceTemplateUUID(nsResourceInputParameter.getNsOperationKey().getNodeTemplateUUID()); - when(instanceNfvoMappingRepository.save(instanceNfvoMapping)).thenReturn(instanceNfvoMapping); - when(restfulUtil.getNfvoFromAAI("b1bb0ce7-2222-4fa7-95ed-4840d70a1101")).thenReturn(restfulResponse); - when(restfulUtil.send(Mockito.anyString(), Mockito.anyString(), Mockito.anyString(), Mockito.anyMap())) - .thenReturn(vfcrestfulResponse); - when(resourceOperationStatusRepository.save(resourceOperationStatus)).thenReturn(resourceOperationStatus); - vfcManagerSol005.createNs(nsResourceInputParameter); - - } - - @Test - public void terminateNs() throws Exception { - instanceNfvoMapping.setInstanceId("b1bb0ce7-2222-4fa7-95ed-4840d70a1101"); - instanceNfvoMapping.setPassword("sacjnasnc"); - instanceNfvoMapping.setUsername("admin"); - instanceNfvoMapping.setNfvoName("external_nfvo"); - instanceNfvoMapping.setEndpoint("http://sample.com/"); - instanceNfvoMapping.setApiRoot("xyz"); - String nsInstanceId = "c9f0a95e-dea0-4698-96e5-5a79bc5a233d"; - ClassLoader classLoader = ClassLoader.getSystemClassLoader(); - File file = new File(classLoader.getResource("json/createNsReq.json").getFile()); - String content = new String(Files.readAllBytes(file.toPath())).replace("\n", ""); - nsResourceInputParameter = JsonUtil.unMarshal(content, NSResourceInputParameter.class); - Map<String, String> header = new HashMap<>(); - header.put("Location", "http://192.168.10.57:5000/ns_lcm_op_ops/12204a12-7da2-4ddf-8c2f-992a1a1acebf"); - vfcrestfulResponse.setStatus(202); - vfcrestfulResponse.setResponseContent(null); - vfcrestfulResponse.setRespHeaderMap(header); - when(instanceNfvoMappingRepository.findOneByInstanceId(nsInstanceId)).thenReturn(instanceNfvoMapping); - when(restfulUtil.send(Mockito.anyString(), Mockito.anyString(), Mockito.anyString())) - .thenReturn(vfcrestfulResponse); - vfcManagerSol005.terminateNs(nsResourceInputParameter.getNsOperationKey(), nsInstanceId); - } - - @Test - public void getNsProgress() throws Exception { - String jobId = "12204a12-7da2-4ddf-8c2f-992a1a1acebf"; - instanceNfvoMapping.setInstanceId("b1bb0ce7-2222-4fa7-95ed-4840d70a1101"); - instanceNfvoMapping.setPassword("sacjnasnc"); - instanceNfvoMapping.setUsername("admin"); - instanceNfvoMapping.setNfvoName("external_nfvo"); - instanceNfvoMapping.setEndpoint("http://sample.com/"); - instanceNfvoMapping.setApiRoot("xyz"); - instanceNfvoMapping.setJobId(jobId); - ClassLoader classLoader = ClassLoader.getSystemClassLoader(); - File file = new File(classLoader.getResource("json/createNsReq.json").getFile()); - String content = new String(Files.readAllBytes(file.toPath())).replace("\n", ""); - nsResourceInputParameter = JsonUtil.unMarshal(content, NSResourceInputParameter.class); - operationStatus.setProgress("40"); - operationStatus.setServiceId(nsResourceInputParameter.getNsOperationKey().getServiceId()); - operationStatus.setOperationId(nsResourceInputParameter.getNsOperationKey().getOperationId()); - ResourceOperationStatus resourceOperationStatus = - new ResourceOperationStatus(nsResourceInputParameter.getNsOperationKey().getServiceId(), - nsResourceInputParameter.getNsOperationKey().getOperationId(), - nsResourceInputParameter.getNsOperationKey().getNodeTemplateUUID()); - file = new File(classLoader.getResource("json/lcmOperRsp.json").getFile()); - content = new String(Files.readAllBytes(file.toPath())).replace("\n", ""); - vfcrestfulResponse.setStatus(202); - vfcrestfulResponse.setResponseContent(content); - List<ResourceOperationStatus> resourceOperationStatuses = new ArrayList<>(); - resourceOperationStatuses.add(resourceOperationStatus); - when(instanceNfvoMappingRepository.findOneByJobId(jobId)).thenReturn(instanceNfvoMapping); - when(restfulUtil.send(Mockito.anyString(), Mockito.anyString(), Mockito.anyString())) - .thenReturn(vfcrestfulResponse); - when(operationStatusRepository.findOneByServiceIdAndOperationId( - nsResourceInputParameter.getNsOperationKey().getServiceId(), - nsResourceInputParameter.getNsOperationKey().getOperationId())).thenReturn(operationStatus); - when(resourceOperationStatusRepository.findByServiceIdAndOperationId( - nsResourceInputParameter.getNsOperationKey().getServiceId(), - nsResourceInputParameter.getNsOperationKey().getOperationId())).thenReturn(resourceOperationStatuses); - when(operationStatusRepository.save(operationStatus)).thenReturn(operationStatus); - vfcManagerSol005.getNsProgress(nsResourceInputParameter.getNsOperationKey(), jobId); - - } - - @Test - public void instantiateNs() throws Exception { - String nsInstanceId = "c9f0a95e-dea0-4698-96e5-5a79bc5a233d"; - ClassLoader classLoader = ClassLoader.getSystemClassLoader(); - File file = new File(classLoader.getResource("json/createNsReq.json").getFile()); - String content = new String(Files.readAllBytes(file.toPath())).replace("\n", ""); - nsResourceInputParameter = JsonUtil.unMarshal(content, NSResourceInputParameter.class); - instanceNfvoMapping.setInstanceId("b1bb0ce7-2222-4fa7-95ed-4840d70a1101"); - instanceNfvoMapping.setPassword("sacjnasnc"); - instanceNfvoMapping.setUsername("admin"); - instanceNfvoMapping.setNfvoName("external_nfvo"); - instanceNfvoMapping.setEndpoint("http://sample.com/"); - instanceNfvoMapping.setApiRoot("xyz"); - resourceOperationStatus.setStatus("processing"); - resourceOperationStatus.setOperationId(nsResourceInputParameter.getNsOperationKey().getOperationId()); - resourceOperationStatus.setServiceId(nsResourceInputParameter.getNsOperationKey().getServiceId()); - resourceOperationStatus - .setResourceTemplateUUID(nsResourceInputParameter.getNsOperationKey().getNodeTemplateUUID()); - Map<String, String> header = new HashMap<>(); - header.put("Location", "http://192.168.10.57:5000/ns_lcm_op_ops/12204a12-7da2-4ddf-8c2f-992a1a1acebf"); - vfcrestfulResponse.setStatus(202); - vfcrestfulResponse.setResponseContent(null); - vfcrestfulResponse.setRespHeaderMap(header); - when(instanceNfvoMappingRepository.findOneByInstanceId(nsInstanceId)).thenReturn(instanceNfvoMapping); - when(restfulUtil.send(Mockito.anyString(), Mockito.anyString(), Mockito.anyString())) - .thenReturn(vfcrestfulResponse); - when(resourceOperationStatusRepository.save(resourceOperationStatus)).thenReturn(resourceOperationStatus); - when(instanceNfvoMappingRepository.save(instanceNfvoMapping)).thenReturn(instanceNfvoMapping); - vfcManagerSol005.instantiateNs(nsInstanceId, nsResourceInputParameter); - - } -} diff --git a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/rest/VfcManagerTest.java b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/rest/VfcManagerTest.java deleted file mode 100644 index 08fe6187ea..0000000000 --- a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/rest/VfcManagerTest.java +++ /dev/null @@ -1,156 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (c) 2019 Samsung. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.adapters.vfc.rest; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.Spy; -import org.mockito.junit.MockitoJUnitRunner; -import org.onap.so.adapters.vfc.constant.CommonConstant; -import org.onap.so.adapters.vfc.model.NSResourceInputParameter; -import org.onap.so.adapters.vfc.model.NsOperationKey; -import org.onap.so.adapters.vfc.model.NsParameters; -import org.onap.so.adapters.vfc.model.NsScaleParameters; -import org.onap.so.adapters.vfc.model.RestfulResponse; -import org.onap.so.adapters.vfc.util.RestfulUtil; -import org.onap.so.db.request.beans.ResourceOperationStatus; -import org.onap.so.db.request.data.repository.ResourceOperationStatusRepository; -import org.springframework.http.HttpStatus; -import static org.junit.Assert.*; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Mockito.when; - -@RunWith(MockitoJUnitRunner.class) -public class VfcManagerTest { - - @Mock - private ResourceOperationStatusRepository resourceOperationStatusRepository; - - @Mock - private RestfulUtil restfulUtil; - - @InjectMocks - @Spy - private VfcManager vfcManager; - - @Test - public void createNs() throws Exception { - - NSResourceInputParameter segInput = new NSResourceInputParameter(); - segInput.setNsOperationKey(new NsOperationKey()); - - RestfulResponse restfulResponse = new RestfulResponse(); - restfulResponse.setStatus(HttpStatus.OK.value()); - restfulResponse.setResponseContent("{\"" + CommonConstant.NS_INSTANCE_ID + "\": \"someNsInstanceId\"}"); - when(restfulUtil.send(any(), any(), any())).thenReturn(restfulResponse); - - RestfulResponse response = vfcManager.createNs(segInput); - assertEquals(HttpStatus.OK.value(), restfulResponse.getStatus()); - } - - @Test - public void deleteNs() throws Exception { - - RestfulResponse restfulResponse = new RestfulResponse(); - restfulResponse.setStatus(HttpStatus.OK.value()); - restfulResponse.setResponseContent("{\"" + CommonConstant.NS_INSTANCE_ID + "\": \"someNsInstanceId\"}"); - when(restfulUtil.send(any(), any(), any())).thenReturn(restfulResponse); - - NsOperationKey nsOperationKey = new NsOperationKey(); - - RestfulResponse response = vfcManager.deleteNs(nsOperationKey, "someNsInstanceId"); - assertEquals(HttpStatus.OK.value(), restfulResponse.getStatus()); - } - - @Test - public void instantiateNs() throws Exception { - - RestfulResponse restfulResponse = new RestfulResponse(); - restfulResponse.setStatus(HttpStatus.OK.value()); - restfulResponse.setResponseContent("{\"" + CommonConstant.JOB_ID + "\": \"someJobId\"}"); - when(restfulUtil.send(any(), any(), any())).thenReturn(restfulResponse); - - NsParameters nsParameters = new NsParameters(); - NSResourceInputParameter segInput = new NSResourceInputParameter(); - segInput.setNsParameters(nsParameters); - segInput.setNsOperationKey(new NsOperationKey()); - - RestfulResponse response = vfcManager.instantiateNs("someNsInstanceId", segInput); - assertEquals(HttpStatus.OK.value(), restfulResponse.getStatus()); - } - - @Test - public void terminateNs() throws Exception { - - NsOperationKey nsOperationKey = new NsOperationKey(); - - RestfulResponse restfulResponse = new RestfulResponse(); - restfulResponse.setStatus(HttpStatus.OK.value()); - restfulResponse.setResponseContent("{\"" + CommonConstant.JOB_ID + "\": \"someJobId\"}"); - when(restfulUtil.send(any(), any(), any())).thenReturn(restfulResponse); - - RestfulResponse response = vfcManager.terminateNs(nsOperationKey, "someNsInstanceId"); - assertEquals(HttpStatus.OK.value(), response.getStatus()); - } - - @Test - public void getNsProgress() throws Exception { - - NsOperationKey nsOperationKey = new NsOperationKey(); - ResourceOperationStatus resourceOperationStatus = new ResourceOperationStatus(); - - RestfulResponse restfulResponse = new RestfulResponse(); - restfulResponse.setStatus(HttpStatus.OK.value()); - restfulResponse.setResponseContent( - "{\"" + CommonConstant.JOB_ID + "\": \"someJobId\", " + "\"responseDescriptor\" : {}}"); - when(restfulUtil.send(any(), any(), any())).thenReturn(restfulResponse); - - when(resourceOperationStatusRepository.findOne(any())) - .thenReturn(java.util.Optional.ofNullable(resourceOperationStatus)); - - RestfulResponse response = vfcManager.getNsProgress(nsOperationKey, "someJobId"); - assertEquals(HttpStatus.OK.value(), response.getStatus()); - } - - @Test - public void scaleNs() throws Exception { - - ResourceOperationStatus resourceOperationStatus = new ResourceOperationStatus(); - NSResourceInputParameter segInput = new NSResourceInputParameter(); - NsScaleParameters nsScaleParameters = new NsScaleParameters(); - segInput.setNsScaleParameters(nsScaleParameters); - - RestfulResponse restfulResponse = new RestfulResponse(); - restfulResponse.setStatus(HttpStatus.OK.value()); - segInput.setNsOperationKey(new NsOperationKey()); - restfulResponse.setResponseContent("{\"" + CommonConstant.JOB_ID + "\": \"someJobId\"}"); - when(restfulUtil.send(any(), any(), any())).thenReturn(restfulResponse); - - when(resourceOperationStatusRepository.findOne(any())) - .thenReturn(java.util.Optional.ofNullable(resourceOperationStatus)); - - RestfulResponse response = vfcManager.scaleNs("someNsInstanceId", segInput); - assertEquals(HttpStatus.OK.value(), restfulResponse.getStatus()); - } - -} diff --git a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/util/RestfulUtilTest.java b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/util/RestfulUtilTest.java deleted file mode 100644 index 4b6baa5cf4..0000000000 --- a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/util/RestfulUtilTest.java +++ /dev/null @@ -1,164 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (c) 2019 Samsung. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.adapters.vfc.util; - -import org.apache.http.HttpEntity; -import org.apache.http.HttpResponse; -import org.apache.http.Header; -import org.apache.http.message.BasicHeader; -import org.apache.http.StatusLine; -import org.apache.http.client.HttpClient; -import org.apache.http.client.methods.HttpDelete; -import org.apache.http.client.methods.HttpGet; -import org.apache.http.client.methods.HttpPost; -import org.apache.http.client.methods.HttpPut; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.Spy; -import org.mockito.junit.MockitoJUnitRunner; -import org.onap.so.adapters.vfc.model.RestfulResponse; -import org.springframework.http.HttpStatus; -import javax.ws.rs.HttpMethod; -import java.io.ByteArrayInputStream; -import java.io.IOException; -import static org.junit.Assert.assertEquals; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -@RunWith(MockitoJUnitRunner.class) -public class RestfulUtilTest { - - @InjectMocks - @Spy - private RestfulUtil restfulUtil; - - @Mock - private HttpClient client; - - private HttpEntity httpEntity; - private HttpResponse httpResponse; - private StatusLine statusLine; - private Header httpResponseHeader; - - @Before - public void setUp() { - httpEntity = mock(HttpEntity.class); - httpResponse = mock(HttpResponse.class); - statusLine = mock(StatusLine.class); - httpResponseHeader = mock(Header.class); - } - - private void sendInit() throws IOException { - - Header[] headerList = new BasicHeader[2]; - headerList[0] = new BasicHeader("Content-Type", "application/json"); - headerList[1] = new BasicHeader("cache-control", "no-cache"); - doReturn("https://testHost/").when(restfulUtil).getMsbHost(); - - when(statusLine.getStatusCode()).thenReturn(HttpStatus.OK.value()); - when(httpResponse.getStatusLine()).thenReturn(statusLine); - when(httpResponse.getEntity()).thenReturn(httpEntity); - when(httpResponse.getAllHeaders()).thenReturn(headerList); - } - - @Test - public void sendGet() throws Exception { - - sendInit(); - - ByteArrayInputStream responseStream = new ByteArrayInputStream(new String("GET").getBytes()); - when(client.execute(any(HttpGet.class))).thenReturn(httpResponse); - when(httpEntity.getContent()).thenReturn(responseStream); - - RestfulResponse restfulResponse = restfulUtil.send("test", HttpMethod.GET, "some request content"); - - assertEquals(HttpStatus.OK.value(), restfulResponse.getStatus()); - assertEquals("GET", restfulResponse.getResponseContent()); - - } - - @Test - public void sendPost() throws Exception { - - sendInit(); - - - ByteArrayInputStream responseStream = new ByteArrayInputStream(new String("POST").getBytes()); - when(client.execute(any(HttpPost.class))).thenReturn(httpResponse); - when(httpEntity.getContent()).thenReturn(responseStream); - - RestfulResponse restfulResponse = restfulUtil.send("test", HttpMethod.POST, "some request content"); - - assertEquals(HttpStatus.OK.value(), restfulResponse.getStatus()); - assertEquals("POST", restfulResponse.getResponseContent()); - - } - - @Test - public void sendPut() throws Exception { - - sendInit(); - - ByteArrayInputStream responseStream = new ByteArrayInputStream(new String("PUT").getBytes()); - when(client.execute(any(HttpPut.class))).thenReturn(httpResponse); - when(httpEntity.getContent()).thenReturn(responseStream); - - RestfulResponse restfulResponse = restfulUtil.send("test", HttpMethod.PUT, "some request content"); - - assertEquals(HttpStatus.OK.value(), restfulResponse.getStatus()); - assertEquals("PUT", restfulResponse.getResponseContent()); - - } - - @Test - public void sendDelete() throws Exception { - - sendInit(); - - ByteArrayInputStream responseStream = new ByteArrayInputStream(new String("DELETE").getBytes()); - when(client.execute(any(HttpDelete.class))).thenReturn(httpResponse); - when(httpEntity.getContent()).thenReturn(responseStream); - - RestfulResponse restfulResponse = restfulUtil.send("test", HttpMethod.DELETE, "some request content"); - - assertEquals(HttpStatus.OK.value(), restfulResponse.getStatus()); - assertEquals("DELETE", restfulResponse.getResponseContent()); - - } - - @Test - public void sendOptions() throws Exception { - - doReturn("https://testHost/").when(restfulUtil).getMsbHost(); - - RestfulResponse restfulResponse = restfulUtil.send("test", HttpMethod.OPTIONS, "some request content"); - - assertEquals(HttpStatus.INTERNAL_SERVER_ERROR.value(), restfulResponse.getStatus()); - assertEquals("Error processing request to VFC", restfulResponse.getResponseContent()); - - } - -} |