diff options
Diffstat (limited to 'ms/neng/src/test')
5 files changed, 309 insertions, 0 deletions
diff --git a/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/resource/model/AaiResponseTest.java b/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/resource/model/AaiResponseTest.java new file mode 100644 index 00000000..81279b9d --- /dev/null +++ b/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/resource/model/AaiResponseTest.java @@ -0,0 +1,41 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : CCSDK.apps + * ================================================================================ + * Copyright (C) 2018 IBM. + * ================================================================================ + * 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.ccsdk.apps.ms.neng.core.resource.model; + +import static org.junit.Assert.assertEquals; +import org.junit.Before; +import org.junit.Test; + +public class AaiResponseTest { + private AaiResponse aai; + + @Before + public void setup() { + aai = new AaiResponse(); + } + + @Test + public void isRecFound() { + aai.setRecFound(true); + assertEquals(true, aai.isRecFound()); + } + +} diff --git a/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/service/SpringServiceTest.java b/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/service/SpringServiceTest.java index 7ea63e61..22063a4d 100644 --- a/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/service/SpringServiceTest.java +++ b/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/service/SpringServiceTest.java @@ -109,6 +109,11 @@ public class SpringServiceTest { Assert.assertNotNull(springserviceImpl.releaseNetworkElementName(request)); } + @Test(expected=Exception.class) + public void releaseNetworkElementNameTestForNull() throws Exception { + springserviceImpl.releaseNetworkElementName(null); + } + @Test public void testGetQuickHello() { Assert.assertTrue(springserviceImpl.getQuickHello("testMessage") instanceof HelloWorld); diff --git a/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/persistence/entity/GeneratedNameTest.java b/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/persistence/entity/GeneratedNameTest.java new file mode 100644 index 00000000..7965b7a4 --- /dev/null +++ b/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/persistence/entity/GeneratedNameTest.java @@ -0,0 +1,90 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : CCSDK.apps + * ================================================================================ + * Copyright (C) 2018 IBM. + * ================================================================================ + * 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.ccsdk.apps.ms.neng.persistence.entity; + +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + +public class GeneratedNameTest { + private GeneratedName generatedName; + + @Before + public void setUp() { + generatedName = new GeneratedName(); + } + + @Test + public void testGetSetGeneratedNameId() { + generatedName.setGeneratedNameId(1); + Integer expected = 1; + Assert.assertEquals(expected, generatedName.getGeneratedNameId()); + } + + @Test + public void testGetSetSequenceNumber() { + generatedName.setSequenceNumber(2121314312321L); + Long expected = 2121314312321L; + Assert.assertEquals(expected, generatedName.getSequenceNumber()); + } + + @Test + public void testGetSetSequenceNumberEnc() { + generatedName.setSequenceNumberEnc("TestSequenceNumberEnc"); + String expected = "TestSequenceNumberEnc"; + Assert.assertEquals(expected, generatedName.getSequenceNumberEnc()); + } + + @Test + public void testGetSetElementType() { + generatedName.setElementType("TestElementType"); + String expected = "TestElementType"; + Assert.assertEquals(expected, generatedName.getElementType()); + } + + @Test + public void testGetSetName() { + generatedName.setName("TestName"); + String expected = "TestName"; + Assert.assertEquals(expected, generatedName.getName()); + } + + @Test + public void testGetSetPrefix() { + generatedName.setPrefix("TestPrefix"); + String expected = "TestPrefix"; + Assert.assertEquals(expected, generatedName.getPrefix()); + } + + @Test + public void testGetSetSuffix() { + generatedName.setSuffix("TestSuffix"); + String expected = "TestSuffix"; + Assert.assertEquals(expected, generatedName.getSuffix()); + } + + @Test + public void testGetSetIsReleased() { + generatedName.setIsReleased("TestIsReleased"); + String expected = "TestIsReleased"; + Assert.assertEquals(expected, generatedName.getIsReleased()); + } + +} diff --git a/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/persistence/entity/IdentifierMapTest.java b/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/persistence/entity/IdentifierMapTest.java new file mode 100644 index 00000000..dc510429 --- /dev/null +++ b/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/persistence/entity/IdentifierMapTest.java @@ -0,0 +1,98 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : CCSDK.apps + * ================================================================================ + * Copyright (C) 2018 IBM. + * ================================================================================ + * 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.ccsdk.apps.ms.neng.persistence.entity; + +import java.sql.Timestamp; +import java.text.DateFormat; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Date; + +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + +public class IdentifierMapTest { + private IdentifierMap identifierMap; + + @Before + public void setUp() { + identifierMap = new IdentifierMap(); + } + + @Test + public void testGetSetIdentifierMapId() { + identifierMap.setIdentifierMapId(1); + Integer expected = 1; + Assert.assertEquals(expected, identifierMap.getIdentifierMapId()); + } + + @Test + public void testGetSetPolicyFnName() { + identifierMap.setPolicyFnName("PolicyFnName"); + String expected = "PolicyFnName"; + Assert.assertEquals(expected, identifierMap.getPolicyFnName()); + } + + @Test + public void testGetSetJsFnName() { + identifierMap.setJsFnName("JsFnName"); + String expected = "JsFnName"; + Assert.assertEquals(expected, identifierMap.getJsFnName()); + } + + @Test + public void testGetSetCreatedTime() throws ParseException { + DateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy"); + Date date = dateFormat.parse("23/09/2007"); + long time = date.getTime(); + Timestamp timeStamp = new Timestamp(time); + identifierMap.setCreatedTime(timeStamp); + Timestamp expected = timeStamp; + Assert.assertEquals(expected, identifierMap.getCreatedTime()); + } + + @Test + public void testGetSetCreatedBy() { + identifierMap.setCreatedBy("Name"); + String expected = "Name"; + Assert.assertEquals(expected, identifierMap.getCreatedBy()); + } + + @Test + public void testGetSetLastUpdatedTime() throws ParseException { + DateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy"); + Date date = dateFormat.parse("23/09/2007"); + long time = date.getTime(); + Timestamp timeStamp = new Timestamp(time); + identifierMap.setLastUpdatedTime(timeStamp); + Timestamp expected = timeStamp; + Assert.assertEquals(expected, identifierMap.getLastUpdatedTime()); + } + + @Test + public void testGetSetLastUpdatedBy() { + identifierMap.setLastUpdatedBy("Name"); + String expected = "Name"; + Assert.assertEquals(expected, identifierMap.getLastUpdatedBy()); + } + +} diff --git a/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/persistence/entity/PolicyDetailsTest.java b/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/persistence/entity/PolicyDetailsTest.java new file mode 100644 index 00000000..70508684 --- /dev/null +++ b/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/persistence/entity/PolicyDetailsTest.java @@ -0,0 +1,75 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : CCSDK.apps + * ================================================================================ + * Copyright (C) 2018 IBM. + * ================================================================================ + * 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.ccsdk.apps.ms.neng.persistence.entity; + + +import java.sql.Timestamp; +import java.text.DateFormat; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Date; + +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + +public class PolicyDetailsTest { + private PolicyDetails policyDetails; + + @Before + public void setUp() { + policyDetails = new PolicyDetails(); + } + + @Test + public void testGetSetPolicyId() { + policyDetails.setPolicyId(1); + Integer expected = 1; + Assert.assertEquals(expected, policyDetails.getPolicyId()); + } + + @Test + public void testGetSetPolicyName() { + policyDetails.setPolicyName("PolicyName"); + String expected = "PolicyName"; + Assert.assertEquals(expected, policyDetails.getPolicyName()); + } + + @Test + public void testGetSetPolicyResponse() { + policyDetails.setPolicyResponse("PolicyResponse"); + String expected = "PolicyResponse"; + Assert.assertEquals(expected, policyDetails.getPolicyResponse()); + } + + @Test + public void testGetSetCreatedTime() throws ParseException { + DateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy"); + Date date = dateFormat.parse("23/09/2007"); + long time = date.getTime(); + Timestamp timeStamp = new Timestamp(time); + policyDetails.setCreatedTime(timeStamp); + String expected = "PolicyResponse"; + Assert.assertEquals(timeStamp, policyDetails.getCreatedTime()); + } + + +} |