diff options
author | Ruchira Agarwal <ra1926@att.com> | 2018-03-26 22:40:01 +0000 |
---|---|---|
committer | Ruchira Agarwal <ra1926@att.com> | 2018-03-26 23:23:48 +0000 |
commit | f88c714f725e952025b9376bf1b3a64afaac8c15 (patch) | |
tree | fcb520672ce28b55a09ffcc936a05fa7e1e9f218 /aai-service/provider/src/test/java/org | |
parent | ef9d1e2475a2184ff1b245648e1f0f93ae341c6b (diff) |
Add junit for adaptors
Added new junits for aai-service
Change-Id: Ia717d0e6180f9fd8ecd9d98935d5ceeeaa69530c
Issue-ID: CCSDK-225
Signed-off-by: Ruchira Agarwal <ra1926@att.com>
Diffstat (limited to 'aai-service/provider/src/test/java/org')
7 files changed, 450 insertions, 0 deletions
diff --git a/aai-service/provider/src/test/java/org/onap/ccsdk/sli/adaptors/aai/data/ErrorResponseTest.java b/aai-service/provider/src/test/java/org/onap/ccsdk/sli/adaptors/aai/data/ErrorResponseTest.java new file mode 100644 index 000000000..6232ae34a --- /dev/null +++ b/aai-service/provider/src/test/java/org/onap/ccsdk/sli/adaptors/aai/data/ErrorResponseTest.java @@ -0,0 +1,51 @@ +package org.onap.ccsdk.sli.adaptors.aai.data; + +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.mock; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class ErrorResponseTest { + + ErrorResponse _erInstance; + protected RequestError _requestError; + protected Map<String, Object> _additionalProperties; + + @Before + public void setUp() throws Exception { + _erInstance = new ErrorResponse(); + _requestError = mock(RequestError.class); + _additionalProperties = new HashMap<String, Object>() {{ + put("prop1", "propvalue1"); + put("prop2", "propvalue2"); + }}; + } + + @After + public void tearDown() throws Exception { + _erInstance = null; + _requestError = null; + _additionalProperties = null; + } + + @Test + public void testSetRequestError() { + _erInstance.setRequestError(_requestError); + assertEquals(_erInstance.getRequestError(), _requestError); + } + + @Test + public void testSetAdditionalProperty() { + _erInstance.setAdditionalProperty("prop1", "propvalue1"); + _erInstance.setAdditionalProperty("prop2", "propvalue2"); + assertEquals(_erInstance.getAdditionalProperties(), _additionalProperties); + } + +} diff --git a/aai-service/provider/src/test/java/org/onap/ccsdk/sli/adaptors/aai/data/RequestErrorTest.java b/aai-service/provider/src/test/java/org/onap/ccsdk/sli/adaptors/aai/data/RequestErrorTest.java new file mode 100644 index 000000000..c752c7656 --- /dev/null +++ b/aai-service/provider/src/test/java/org/onap/ccsdk/sli/adaptors/aai/data/RequestErrorTest.java @@ -0,0 +1,51 @@ +package org.onap.ccsdk.sli.adaptors.aai.data; + +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.mock; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class RequestErrorTest { + + RequestError _reInstance; + protected ServiceException _serviceException; + protected Map<String, Object> _additionalProperties; + + @Before + public void setUp() throws Exception { + _reInstance = new RequestError(); + _serviceException = mock(ServiceException.class); + _additionalProperties = new HashMap<String, Object>() {{ + put("prop1", "propvalue1"); + put("prop2", "propvalue2"); + }}; + } + + @After + public void tearDown() throws Exception { + _reInstance = null; + _serviceException = null; + _additionalProperties = null; + } + + @Test + public void testSetServiceException() { + _reInstance.setServiceException(_serviceException); + assertEquals(_reInstance.getServiceException(), _serviceException); + } + + @Test + public void testSetAdditionalProperty() { + _reInstance.setAdditionalProperty("prop1", "propvalue1"); + _reInstance.setAdditionalProperty("prop2", "propvalue2"); + assertEquals(_reInstance.getAdditionalProperties(), _additionalProperties); + } + +} diff --git a/aai-service/provider/src/test/java/org/onap/ccsdk/sli/adaptors/aai/data/ResponseMessageTest.java b/aai-service/provider/src/test/java/org/onap/ccsdk/sli/adaptors/aai/data/ResponseMessageTest.java new file mode 100644 index 000000000..04c9963b5 --- /dev/null +++ b/aai-service/provider/src/test/java/org/onap/ccsdk/sli/adaptors/aai/data/ResponseMessageTest.java @@ -0,0 +1,71 @@ +package org.onap.ccsdk.sli.adaptors.aai.data;
+
+import static org.junit.Assert.*;
+import static org.mockito.Mockito.mock;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.junit.After; +import org.junit.Before; +import org.junit.Test;
+import org.openecomp.aai.inventory.v11.Vlans; + +public class ResponseMessageTest {
+
+ ResponseMessage _rmInstance;
+ protected String _messageId;
+ protected String _text;
+ protected Variables _variables;
+ protected Map<String, Object> _additionalProperties;
+
+ @Before + public void setUp() throws Exception {
+ _rmInstance = new ResponseMessage();
+ _messageId = "messageId";
+ _text = "text";
+ _variables = mock(Variables.class);
+ _additionalProperties = new HashMap<String, Object>() {{
+ put("prop1", "propvalue1");
+ put("prop2", "propvalue2");
+ }};
+ } + + @After + public void tearDown() throws Exception {
+ _rmInstance = null;
+ _messageId = null;
+ _text = null;
+ _variables = null;
+ _additionalProperties = null;
+ } + + @Test + public void testSetMessageId() {
+ _rmInstance.setMessageId(_messageId);
+ assertTrue(_rmInstance.getMessageId().equals(_messageId)); + } + + @Test + public void testSetText() {
+ _rmInstance.setText(_text);
+ assertTrue(_rmInstance.getText().equals(_text)); + } + + @Test + public void testSetVariables() {
+ _rmInstance.setVariables(_variables);
+ assertEquals(_rmInstance.getVariables(), _variables); + } + + @Test + public void testSetAdditionalProperty() {
+ _rmInstance.setAdditionalProperty("prop1", "propvalue1");
+ _rmInstance.setAdditionalProperty("prop2", "propvalue2");
+ assertEquals(_rmInstance.getAdditionalProperties(), _additionalProperties); + } + +} diff --git a/aai-service/provider/src/test/java/org/onap/ccsdk/sli/adaptors/aai/data/ResponseMessagesTest.java b/aai-service/provider/src/test/java/org/onap/ccsdk/sli/adaptors/aai/data/ResponseMessagesTest.java new file mode 100644 index 000000000..f21e969dd --- /dev/null +++ b/aai-service/provider/src/test/java/org/onap/ccsdk/sli/adaptors/aai/data/ResponseMessagesTest.java @@ -0,0 +1,55 @@ +package org.onap.ccsdk.sli.adaptors.aai.data; + +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.mock; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class ResponseMessagesTest { + + ResponseMessages _rmsInstance; + protected List<ResponseMessage> _responseMessage; + protected Map<String, Object> _additionalProperties; + + @Before + public void setUp() throws Exception { + _rmsInstance = new ResponseMessages(); + _responseMessage = new ArrayList<>(); + ResponseMessage rm1 = mock(ResponseMessage.class); + ResponseMessage rm2 = mock(ResponseMessage.class); + _responseMessage.add(rm1); + _responseMessage.add(rm2); + _additionalProperties = new HashMap<String, Object>() {{ + put("prop1", "propvalue1"); + put("prop2", "propvalue2"); + }}; + } + + @After + public void tearDown() throws Exception { + _rmsInstance = null; + _responseMessage = null; + _additionalProperties = null; + } + + @Test + public void testSetResponseMessage() { + _rmsInstance.setResponseMessage(_responseMessage); + assertEquals(_rmsInstance.getResponseMessage(), _responseMessage); + } + + @Test + public void testSetAdditionalProperty() { + _rmsInstance.setAdditionalProperty("prop1", "propvalue1"); + _rmsInstance.setAdditionalProperty("prop2", "propvalue2"); + assertEquals(_rmsInstance.getAdditionalProperties(), _additionalProperties); + } + +} diff --git a/aai-service/provider/src/test/java/org/onap/ccsdk/sli/adaptors/aai/data/ServiceExceptionTest.java b/aai-service/provider/src/test/java/org/onap/ccsdk/sli/adaptors/aai/data/ServiceExceptionTest.java new file mode 100644 index 000000000..f44d9b366 --- /dev/null +++ b/aai-service/provider/src/test/java/org/onap/ccsdk/sli/adaptors/aai/data/ServiceExceptionTest.java @@ -0,0 +1,71 @@ +package org.onap.ccsdk.sli.adaptors.aai.data;
+
+import static org.junit.Assert.*;
+import static org.mockito.Mockito.mock;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+public class ServiceExceptionTest {
+
+ ServiceException _seInstance;
+ protected String _messageId;
+ protected String _text;
+ protected List<String> _variables;
+ protected Map<String, Object> _additionalProperties;
+
+ @Before
+ public void setUp() throws Exception {
+ _seInstance = new ServiceException();
+ _messageId = "messageId";
+ _text = "text";
+ _variables = new ArrayList<>(Arrays.asList("var1", "var2", "var3"));
+ _additionalProperties = new HashMap<String, Object>() {{
+ put("prop1", "propvalue1");
+ put("prop2", "propvalue2");
+ }};
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ _seInstance = null;
+ _messageId = null;
+ _text = null;
+ _variables = null;
+ _additionalProperties = null;
+ }
+
+ @Test
+ public void testSetMessageId() {
+ _seInstance.setMessageId(_messageId);
+ assertTrue(_seInstance.getMessageId().equals(_messageId));
+ }
+
+ @Test
+ public void testSetText() {
+ _seInstance.setText(_text);
+ assertTrue(_seInstance.getText().equals(_text));
+ }
+
+ @Test
+ public void testSetVariables() {
+ _seInstance.setVariables(_variables);
+ assertEquals(_seInstance.getVariables(), _variables);
+ }
+
+ @Test
+ public void testSetAdditionalProperties() {
+ _seInstance.setAdditionalProperty("prop1", "propvalue1");
+ _seInstance.setAdditionalProperty("prop2", "propvalue2");
+ assertEquals(_seInstance.getAdditionalProperties(), _additionalProperties);
+ }
+
+
+}
diff --git a/aai-service/provider/src/test/java/org/onap/ccsdk/sli/adaptors/aai/data/SubInterfaceTest.java b/aai-service/provider/src/test/java/org/onap/ccsdk/sli/adaptors/aai/data/SubInterfaceTest.java new file mode 100644 index 000000000..66717103d --- /dev/null +++ b/aai-service/provider/src/test/java/org/onap/ccsdk/sli/adaptors/aai/data/SubInterfaceTest.java @@ -0,0 +1,95 @@ +package org.onap.ccsdk.sli.adaptors.aai.data;
+
+import static org.junit.Assert.*;
+import static org.mockito.Mockito.mock;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.openecomp.aai.inventory.v11.RelationshipList;
+import org.openecomp.aai.inventory.v11.Vlans;
+
+public class SubInterfaceTest {
+
+ SubInterface _siInstance;
+ protected String _interfaceName;
+ protected String _interfaceRole;
+ protected String _resourceVersion;
+ protected Vlans _vlans;
+ protected RelationshipList _relationshipList;
+ protected Map<String, Object> _additionalProperties;
+
+ @Before
+ public void setUp() throws Exception {
+ _siInstance = new SubInterface();
+ _interfaceName = "interfaceName";
+ _interfaceRole = "interfaceRole";
+ _resourceVersion = "resourceVersion";
+ _vlans = mock(Vlans.class);
+ _relationshipList = mock(RelationshipList.class);
+
+ _additionalProperties = new HashMap<String, Object>() {{
+ put("prop1", "propvalue1");
+ put("prop2", "propvalue2");
+ }};
+
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ _siInstance = null;
+ _interfaceName = null;
+ _interfaceRole = null;
+ _resourceVersion = null;
+ _vlans = null;
+ _relationshipList = null;
+ _additionalProperties = null;
+ }
+
+ @Test
+ public void testSetInterfaceName() {
+ _siInstance.setInterfaceName(_interfaceName);
+ assertTrue(_siInstance.getInterfaceName().equals(_interfaceName));
+ }
+
+
+ @Test
+ public void testSetInterfaceRole() {
+ _siInstance.setInterfaceRole(_interfaceRole);
+ assertTrue(_siInstance.getInterfaceRole().equals(_interfaceRole));
+ }
+
+
+ @Test
+ public void testSetResourceVersion() {
+ _siInstance.setResourceVersion(_resourceVersion);
+ assertTrue(_siInstance.getResourceVersion().equals(_resourceVersion));
+ }
+
+
+ @Test
+ public void testSetVlans() {
+ _siInstance.setVlans(_vlans);
+ assertTrue(_siInstance.getVlans().equals(_vlans));
+ }
+
+
+ @Test
+ public void testSetRelationshipList() {
+ _siInstance.setRelationshipList(_relationshipList);
+ assertTrue(_siInstance.getRelationshipList().equals(_relationshipList));
+ }
+
+ @Test
+ public void testSetAdditionalProperties() {
+ _siInstance.setAdditionalProperty("prop1", "propvalue1");
+ _siInstance.setAdditionalProperty("prop2", "propvalue2");
+ assertEquals(_siInstance.getAdditionalProperties(), _additionalProperties);
+ }
+
+}
diff --git a/aai-service/provider/src/test/java/org/onap/ccsdk/sli/adaptors/aai/data/VariablesTest.java b/aai-service/provider/src/test/java/org/onap/ccsdk/sli/adaptors/aai/data/VariablesTest.java new file mode 100644 index 000000000..1f72f7e67 --- /dev/null +++ b/aai-service/provider/src/test/java/org/onap/ccsdk/sli/adaptors/aai/data/VariablesTest.java @@ -0,0 +1,56 @@ +package org.onap.ccsdk.sli.adaptors.aai.data;
+
+import static org.junit.Assert.*;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import static org.junit.Assert.*;
+import static org.mockito.Mockito.mock;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import java.util.ArrayList;
+
+public class VariablesTest {
+ Variables _variablesInstance;
+ protected List<String> _variable;
+ protected Map<String, Object> _additionalProperties;
+
+ public VariablesTest() {
+ }
+
+ @Before
+ public void setUp() throws Exception {
+ _variablesInstance = new Variables();
+ _variable = new ArrayList<>(Arrays.asList("var1", "var2", "var3"));
+ _additionalProperties = new HashMap<String, Object>() {{
+ put("prop1", "propvalue1");
+ put("prop2", "propvalue2");
+ }};
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ _variablesInstance = null;
+ _variable = null;
+ _additionalProperties = null;
+ }
+
+
+ @Test
+ public void testSetVariable() {
+ _variablesInstance.setVariable(_variable);
+ assertEquals(_variablesInstance.getVariable(), _variable);
+ }
+
+ @Test
+ public void testSetAdditionalProperties() {
+ _variablesInstance.setAdditionalProperty("prop1", "propvalue1");
+ _variablesInstance.setAdditionalProperty("prop2", "propvalue2");
+ assertEquals(_variablesInstance.getAdditionalProperties(), _additionalProperties);
+ }
+
+}
|