diff options
Diffstat (limited to 'aai-service/provider/src/test')
12 files changed, 857 insertions, 0 deletions
diff --git a/aai-service/provider/src/test/java/org/onap/ccsdk/sli/adaptors/aai/query/FormattedQueryRequestDataTest.java b/aai-service/provider/src/test/java/org/onap/ccsdk/sli/adaptors/aai/query/FormattedQueryRequestDataTest.java new file mode 100644 index 000000000..a89dbded6 --- /dev/null +++ b/aai-service/provider/src/test/java/org/onap/ccsdk/sli/adaptors/aai/query/FormattedQueryRequestDataTest.java @@ -0,0 +1,53 @@ +package org.onap.ccsdk.sli.adaptors.aai.query; + +import static org.junit.Assert.*; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.onap.ccsdk.sli.adaptors.aai.data.Variables; + +public class FormattedQueryRequestDataTest { + + FormattedQueryRequestData _fqrdInstance; + protected List<String> _start; + protected String _query; + + @Before + public void setUp() throws Exception { + _fqrdInstance = new FormattedQueryRequestData(); + _start = new ArrayList<>(Arrays.asList("start1", "start2", "start3")); + _query = "query"; + } + + @After + public void tearDown() throws Exception { + _fqrdInstance = null; + _start = null; + _query = null; + } + + @Test + public void testSetStart() { + _fqrdInstance.setStart(_start); + assertEquals(_fqrdInstance.getStart(), _start); + } + + @Test + public void testSetQuery() { + _fqrdInstance.setQuery(_query); + assertEquals(_fqrdInstance.getQuery(), _query); + } + + @Test + public void testToString() { + _fqrdInstance.setStart(_start); + _fqrdInstance.setQuery(_query); + assertNotNull(_fqrdInstance.toString()); + } + +} diff --git a/aai-service/provider/src/test/java/org/onap/ccsdk/sli/adaptors/aai/query/FormattedQueryResultListTest.java b/aai-service/provider/src/test/java/org/onap/ccsdk/sli/adaptors/aai/query/FormattedQueryResultListTest.java new file mode 100644 index 000000000..f26051917 --- /dev/null +++ b/aai-service/provider/src/test/java/org/onap/ccsdk/sli/adaptors/aai/query/FormattedQueryResultListTest.java @@ -0,0 +1,49 @@ +package org.onap.ccsdk.sli.adaptors.aai.query; + +import static org.junit.Assert.*; +import static org.mockito.Mockito.mock; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import java.util.ArrayList;
+
+public class FormattedQueryResultListTest {
+ FormattedQueryResultList _fqrlInstance;
+ protected List<Result> _results;
+
+ @Before
+ public void setUp() throws Exception {
+ _fqrlInstance = new FormattedQueryResultList(); + _results = new ArrayList<>(); + Result r1 = mock(Result.class); + Result r2 = mock(Result.class); + _results.add(r1); + _results.add(r2);
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ _fqrlInstance = null;
+ _results = null;
+ }
+
+
+ @Test
+ public void testSetResults() {
+ _fqrlInstance.setResults(_results);
+ assertEquals(_fqrlInstance.getResults(), _results);
+ }
+
+ @Test
+ public void testToString() { + _fqrlInstance.setResults(_results); + assertTrue(_fqrlInstance.toString() != null);
+ }
+
+}
diff --git a/aai-service/provider/src/test/java/org/onap/ccsdk/sli/adaptors/aai/query/InstanceFilterTest.java b/aai-service/provider/src/test/java/org/onap/ccsdk/sli/adaptors/aai/query/InstanceFilterTest.java new file mode 100644 index 000000000..1bc226ec5 --- /dev/null +++ b/aai-service/provider/src/test/java/org/onap/ccsdk/sli/adaptors/aai/query/InstanceFilterTest.java @@ -0,0 +1,127 @@ +package org.onap.ccsdk.sli.adaptors.aai.query; + +import static org.junit.Assert.*; +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; + +import org.openecomp.aai.inventory.v11.CloudRegion; +import org.openecomp.aai.inventory.v11.GenericVnf; +import org.openecomp.aai.inventory.v11.L3Network; +import org.openecomp.aai.inventory.v11.Pnf; +import org.openecomp.aai.inventory.v11.LogicalLink; +import org.openecomp.aai.inventory.v11.PInterface; +import org.openecomp.aai.inventory.v11.ServiceInstance; +import org.openecomp.aai.inventory.v11.Tenant; +import org.openecomp.aai.inventory.v11.Vnf; +import org.openecomp.aai.inventory.v11.Vserver; + +public class InstanceFilterTest { + + InstanceFilter _ifInstance; + protected LogicalLink _logicalLink; + protected Pnf _pnf; + protected L3Network _l3Network; + protected PInterface _pInterface; + protected GenericVnf _genericVnf; + protected Vserver _vserver; + protected Tenant _tenant; + protected CloudRegion _cloudRegion; + protected ServiceInstance _serviceInstance; + protected Vnf _vnfc; + protected Map<String, Object> _additionalProperties; + + @Before + public void setUp() throws Exception { + _ifInstance = new InstanceFilter(); + LogicalLink _logicalLink = mock(LogicalLink.class); + Pnf _pnf = mock(Pnf.class); + L3Network _l3Network = mock(L3Network.class); + PInterface _pInterface = mock(PInterface.class); + GenericVnf _genericVnf = mock(GenericVnf.class); + Vserver _vserver = mock(Vserver.class); + Tenant _tenant = mock(Tenant.class); + CloudRegion _cloudRegion = mock(CloudRegion.class); + ServiceInstance _serviceInstance = mock(ServiceInstance.class); + // as per class + Vnf _vnfc = mock(Vnf.class); + _additionalProperties = new HashMap<String, Object>() {{ + put("prop1", "propvalue1"); + put("prop2", "propvalue2"); + }}; + } + + @After + public void tearDown() throws Exception { + _ifInstance = null; + _additionalProperties = null; + } + + @Test + public void testSetLogicalLink() { + _ifInstance.setLogicalLink(_logicalLink); + assertEquals(_ifInstance.getLogicalLink(), _logicalLink); + } + + @Test + public void testSetPnf() { + _ifInstance.setPnf(_pnf); + assertEquals(_ifInstance.getPnf(), _pnf); + } + + @Test + public void testSetL3Network() { + _ifInstance.setL3Network(_l3Network); + assertEquals(_ifInstance.getL3Network(), _l3Network); + } + + @Test + public void testSetServiceInstance() { + _ifInstance.setServiceInstance(_serviceInstance); + assertEquals(_ifInstance.getServiceInstance(), _serviceInstance); + } + + @Test + public void testSetGenericVnf() { + _ifInstance.setGenericVnf(_genericVnf); + assertEquals(_ifInstance.getGenericVnf(), _genericVnf); + } + + @Test + public void testSetVserver() { + _ifInstance.setVserver(_vserver); + assertEquals(_ifInstance.getVserver(), _vserver); + } + + @Test + public void testSetTenant() { + _ifInstance.setTenant(_tenant); + assertEquals(_ifInstance.getTenant(), _tenant); + } + + @Test + public void testSetCloudRegion() { + _ifInstance.setCloudRegion(_cloudRegion); + assertEquals(_ifInstance.getCloudRegion(), _cloudRegion); + } + + @Test + public void testSetVnfc() { + _ifInstance.setVnfc(_vnfc); + assertEquals(_ifInstance.getVnfc(), _vnfc); + } + + @Test + public void testSetAdditionalProperty() { + _ifInstance.setAdditionalProperty("prop1", "propvalue1"); + _ifInstance.setAdditionalProperty("prop2", "propvalue2"); + assertEquals(_ifInstance.getAdditionalProperties(), _additionalProperties); + } +} diff --git a/aai-service/provider/src/test/java/org/onap/ccsdk/sli/adaptors/aai/query/InstanceFiltersTest.java b/aai-service/provider/src/test/java/org/onap/ccsdk/sli/adaptors/aai/query/InstanceFiltersTest.java new file mode 100644 index 000000000..e44e8454b --- /dev/null +++ b/aai-service/provider/src/test/java/org/onap/ccsdk/sli/adaptors/aai/query/InstanceFiltersTest.java @@ -0,0 +1,55 @@ +package org.onap.ccsdk.sli.adaptors.aai.query; + +import static org.junit.Assert.*; +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 InstanceFiltersTest { + + InstanceFilters _ifsInstance; + protected List<InstanceFilter> _instanceFilter; + protected Map<String, Object> _additionalProperties; + + @Before + public void setUp() throws Exception { + _ifsInstance = new InstanceFilters(); + _instanceFilter = new ArrayList<>(); + InstanceFilter if1 = mock(InstanceFilter.class); + InstanceFilter if2 = mock(InstanceFilter.class); + _instanceFilter.add(if1); + _instanceFilter.add(if2); + _additionalProperties = new HashMap<String, Object>() {{ + put("prop1", "propvalue1"); + put("prop2", "propvalue2"); + }}; + } + + @After + public void tearDown() throws Exception { + _ifsInstance = null; + _instanceFilter = null; + _additionalProperties = null; + } + + @Test + public void testSetInstanceFilter() { + _ifsInstance.setInstanceFilter(_instanceFilter); + assertEquals(_ifsInstance.getInstanceFilter(), _instanceFilter); + + } + + @Test + public void testSetAdditionalProperty() { + _ifsInstance.setAdditionalProperty("prop1", "propvalue1"); + _ifsInstance.setAdditionalProperty("prop2", "propvalue2"); + } + +} diff --git a/aai-service/provider/src/test/java/org/onap/ccsdk/sli/adaptors/aai/query/NamedQueryDataTest.java b/aai-service/provider/src/test/java/org/onap/ccsdk/sli/adaptors/aai/query/NamedQueryDataTest.java new file mode 100644 index 000000000..9f01e84a9 --- /dev/null +++ b/aai-service/provider/src/test/java/org/onap/ccsdk/sli/adaptors/aai/query/NamedQueryDataTest.java @@ -0,0 +1,60 @@ +package org.onap.ccsdk.sli.adaptors.aai.query; + +import static org.junit.Assert.*; +import static org.mockito.Mockito.mock; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class NamedQueryDataTest { + + NamedQueryData _nqdInstance; + protected QueryParameters _queryParameters; + protected InstanceFilters _instanceFilters; + protected Map<String, Object> _additionalProperties; + + @Before + public void setUp() throws Exception { + _nqdInstance = new NamedQueryData(); + _queryParameters = mock(QueryParameters.class); + _instanceFilters = mock(InstanceFilters.class); + _additionalProperties = new HashMap<String, Object>() {{ + put("prop1", "propvalue1"); + put("prop2", "propvalue2"); + }}; + } + + @After + public void tearDown() throws Exception { + _nqdInstance = null; + _queryParameters = null; + _instanceFilters = null; + _additionalProperties = null; + } + + @Test + public void testSetQueryParameters() { + _nqdInstance.setQueryParameters(_queryParameters); + assertEquals(_nqdInstance.getQueryParameters(), _queryParameters); + } + + @Test + public void testSetInstanceFilters() { + _nqdInstance.setInstanceFilters(_instanceFilters); + assertEquals(_nqdInstance.getInstanceFilters(), _instanceFilters); + } + + @Test + public void testSetAdditionalProperty() { + _nqdInstance.setAdditionalProperty("prop1", "propvalue1"); + _nqdInstance.setAdditionalProperty("prop2", "propvalue2"); + assertEquals(_nqdInstance.getAdditionalProperties(), _additionalProperties); + } + +} diff --git a/aai-service/provider/src/test/java/org/onap/ccsdk/sli/adaptors/aai/query/NamedQueryTest.java b/aai-service/provider/src/test/java/org/onap/ccsdk/sli/adaptors/aai/query/NamedQueryTest.java new file mode 100644 index 000000000..02a239a22 --- /dev/null +++ b/aai-service/provider/src/test/java/org/onap/ccsdk/sli/adaptors/aai/query/NamedQueryTest.java @@ -0,0 +1,51 @@ +package org.onap.ccsdk.sli.adaptors.aai.query; + +import static org.junit.Assert.*; +import static org.mockito.Mockito.mock; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class NamedQueryTest { + + NamedQuery _nqInstance; + protected String _namedQueryUuid; + protected Map<String, Object> _additionalProperties; + + @Before + public void setUp() throws Exception { + _nqInstance = new NamedQuery(); + _namedQueryUuid = "uuid"; + _additionalProperties = new HashMap<String, Object>() {{ + put("prop1", "propvalue1"); + put("prop2", "propvalue2"); + }}; + } + + @After + public void tearDown() throws Exception { + _nqInstance = null; + _namedQueryUuid = null; + _additionalProperties = null; + } + + @Test + public void testSetNamedQueryUuid() { + _nqInstance.setNamedQueryUuid(_namedQueryUuid); + assertEquals(_nqInstance.getNamedQueryUuid(), _namedQueryUuid); + } + + @Test + public void testSetAdditionalProperty() { + _nqInstance.setAdditionalProperty("prop1", "propvalue1"); + _nqInstance.setAdditionalProperty("prop2", "propvalue2"); + assertEquals(_nqInstance.getAdditionalProperties(), _additionalProperties); + } + +} diff --git a/aai-service/provider/src/test/java/org/onap/ccsdk/sli/adaptors/aai/query/QueryParametersTest.java b/aai-service/provider/src/test/java/org/onap/ccsdk/sli/adaptors/aai/query/QueryParametersTest.java new file mode 100644 index 000000000..d9a578903 --- /dev/null +++ b/aai-service/provider/src/test/java/org/onap/ccsdk/sli/adaptors/aai/query/QueryParametersTest.java @@ -0,0 +1,53 @@ +package org.onap.ccsdk.sli.adaptors.aai.query; + +import static org.junit.Assert.*; +import static org.mockito.Mockito.mock; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.onap.ccsdk.sli.adaptors.aai.data.ErrorResponse; +import org.onap.ccsdk.sli.adaptors.aai.data.RequestError; + +public class QueryParametersTest { + + QueryParameters _qpInstance; + protected NamedQuery _namedQuery; + protected Map<String, Object> _additionalProperties; + + @Before + public void setUp() throws Exception { + _qpInstance = new QueryParameters(); + _namedQuery = mock(NamedQuery.class); + _additionalProperties = new HashMap<String, Object>() {{ + put("prop1", "propvalue1"); + put("prop2", "propvalue2"); + }}; + } + + @After + public void tearDown() throws Exception { + _qpInstance = null; + _namedQuery = null; + _additionalProperties = null; + } + + @Test + public void testSetNamedQuery() { + _qpInstance.setNamedQuery(_namedQuery); + assertEquals(_qpInstance.getNamedQuery(), _namedQuery); + } + + @Test + public void testSetAdditionalProperty() { + _qpInstance.setAdditionalProperty("prop1", "propvalue1"); + _qpInstance.setAdditionalProperty("prop2", "propvalue2"); + assertEquals(_qpInstance.getAdditionalProperties(), _additionalProperties); + } + +} diff --git a/aai-service/provider/src/test/java/org/onap/ccsdk/sli/adaptors/aai/query/ResultTest.java b/aai-service/provider/src/test/java/org/onap/ccsdk/sli/adaptors/aai/query/ResultTest.java new file mode 100644 index 000000000..4bec98724 --- /dev/null +++ b/aai-service/provider/src/test/java/org/onap/ccsdk/sli/adaptors/aai/query/ResultTest.java @@ -0,0 +1,159 @@ +package org.onap.ccsdk.sli.adaptors.aai.query; + +import static org.junit.Assert.*; +import static org.mockito.Mockito.mock; + +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.CloudRegion; +import org.openecomp.aai.inventory.v11.Complex; +import org.openecomp.aai.inventory.v11.Configuration; +import org.openecomp.aai.inventory.v11.GenericVnf; +import org.openecomp.aai.inventory.v11.L3InterfaceIpv4AddressList; +import org.openecomp.aai.inventory.v11.L3InterfaceIpv6AddressList; +import org.openecomp.aai.inventory.v11.L3Network; +import org.openecomp.aai.inventory.v11.LInterface; +//import org.openecomp.aai.inventory.v11.OwningEntity; +import org.openecomp.aai.inventory.v11.Pserver; +import org.openecomp.aai.inventory.v11.ServiceInstance; +import org.openecomp.aai.inventory.v11.Vnfc; +import org.openecomp.aai.inventory.v11.Vserver; + +public class ResultTest { + + Result _rInstance; + + protected CloudRegion _cloudRegion; + protected Complex _complex; + protected Configuration _configuration; + protected GenericVnf _genericVnf; + protected L3InterfaceIpv4AddressList _l3InterfaceIpv4AddressList; + protected L3InterfaceIpv6AddressList _l3InterfaceIpv6AddressList; + protected L3Network _l3Network; + protected LInterface _lInterface; + protected Pserver _pserver; + protected ServiceInstance _serviceInstance; + protected Vnfc _vnfc; + protected Vserver _vserver; + + protected Map<String, Object> _additionalProperties; + + @Before + public void setUp() throws Exception { + _rInstance = new Result(); + + CloudRegion _cloudRegion = mock(CloudRegion.class); + Complex _complex = mock(Complex.class); + Configuration _configuration = mock(Configuration.class); + L3InterfaceIpv4AddressList _l3InterfaceIpv4AddressList = mock(L3InterfaceIpv4AddressList.class); + L3InterfaceIpv6AddressList _l3InterfaceIpv6AddressList = mock(L3InterfaceIpv6AddressList.class); + L3Network _l3Network = mock(L3Network.class); + LInterface _pInterface = mock(LInterface.class); + GenericVnf _genericVnf = mock(GenericVnf.class); + Vserver _vserver = mock(Vserver.class); + Pserver _pserver = mock(Pserver.class); + Vnfc _vnfc = mock(Vnfc.class); + ServiceInstance _serviceInstance = mock(ServiceInstance.class); + + _additionalProperties = new HashMap<String, Object>() {{ + put("prop1", "propvalue1"); + put("prop2", "propvalue2"); + }}; + } + + @After + public void tearDown() throws Exception { + _rInstance = null; + _additionalProperties = null; + } + + @Test + public void testSetComplex() { + _rInstance.setComplex(_complex); + assertEquals(_rInstance.getComplex(), _complex); + } + + @Test + public void testSetConfiguration() { + _rInstance.setConfiguration(_configuration); + assertEquals(_rInstance.getConfiguration(), _configuration); + } + + @Test + public void testSetL3InterfaceIpv4AddressList() { + _rInstance.setL3InterfaceIpv4AddressList(_l3InterfaceIpv4AddressList); + assertEquals(_rInstance.getL3InterfaceIpv4AddressList(), _l3InterfaceIpv4AddressList); + } + + @Test + public void testSetL3InterfaceIpv6AddressList() { + _rInstance.setL3InterfaceIpv6AddressList(_l3InterfaceIpv6AddressList); + assertEquals(_rInstance.getL3InterfaceIpv6AddressList(), _l3InterfaceIpv6AddressList); + } + + @Test + public void testSetL3Network() { + _rInstance.setL3Network(_l3Network); + assertEquals(_rInstance.getL3Network(), _l3Network); + } + + @Test + public void testSetServiceInstance() { + _rInstance.setServiceInstance(_serviceInstance); + assertEquals(_rInstance.getServiceInstance(), _serviceInstance); + } + + @Test + public void testSetGenericVnf() { + _rInstance.setGenericVnf(_genericVnf); + assertEquals(_rInstance.getGenericVnf(), _genericVnf); + } + + @Test + public void testSetVserver() { + _rInstance.setVserver(_vserver); + assertEquals(_rInstance.getVserver(), _vserver); + } + + @Test + public void testSetCloudRegion() { + _rInstance.setCloudRegion(_cloudRegion); + assertEquals(_rInstance.getCloudRegion(), _cloudRegion); + } + + @Test + public void testSetVnfc() { + _rInstance.setVnfc(_vnfc); + assertEquals(_rInstance.getVnfc(), _vnfc); + } + + @Test + public void testSetLInterface() { + _rInstance.setLInterface(_lInterface); + assertEquals(_rInstance.getLInterface(), _lInterface); + } + + @Test + public void testSetPserver() { + _rInstance.setPserver(_pserver); + assertEquals(_rInstance.getPserver(), _pserver); + } + + @Test + public void testSetAdditionalProperty() { + _rInstance.setAdditionalProperty("prop1", "propvalue1"); + _rInstance.setAdditionalProperty("prop2", "propvalue2"); + assertEquals(_rInstance.getAdditionalProperties(), _additionalProperties); + } + + @Test + public void testToString() { + assertNotNull(_rInstance.toString()); + } + +} diff --git a/aai-service/provider/src/test/java/org/onap/ccsdk/sli/adaptors/aai/update/ActionDatumTest.java b/aai-service/provider/src/test/java/org/onap/ccsdk/sli/adaptors/aai/update/ActionDatumTest.java new file mode 100644 index 000000000..7b858ea65 --- /dev/null +++ b/aai-service/provider/src/test/java/org/onap/ccsdk/sli/adaptors/aai/update/ActionDatumTest.java @@ -0,0 +1,58 @@ +package org.onap.ccsdk.sli.adaptors.aai.update; + +import static org.junit.Assert.*; + +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 ActionDatumTest { + + ActionDatum _oInstance; + protected Map<String, Object> _additionalProperties; + protected String _propertyName; + protected String _propertyValue; + + @Before + public void setUp() throws Exception { + _oInstance = new ActionDatum(); + _propertyName = "propertyName"; + _propertyValue = "propertyValue"; + _additionalProperties = new HashMap<String, Object>() {{ + put("prop1", "propvalue1"); + put("prop2", "propvalue2"); + }}; + } + + @After + public void tearDown() throws Exception { + _oInstance = null; + _additionalProperties = null; + } + + @Test + public void testSetPropertyName() { + _oInstance.setPropertyName(_propertyName); + assertEquals(_oInstance.getPropertyName(), _propertyName); + } + + @Test + public void testSetPropertyValue() { + _oInstance.setPropertyValue(_propertyValue); + assertEquals(_oInstance.getPropertyValue(), _propertyValue); + } + + @Test + public void testSetAdditionalProperty() { + _oInstance.setAdditionalProperty("prop1", "propvalue1"); + _oInstance.setAdditionalProperty("prop2", "propvalue2"); + assertEquals(_oInstance.getAdditionalProperties(), _additionalProperties); + } + +} diff --git a/aai-service/provider/src/test/java/org/onap/ccsdk/sli/adaptors/aai/update/ActionTest.java b/aai-service/provider/src/test/java/org/onap/ccsdk/sli/adaptors/aai/update/ActionTest.java new file mode 100644 index 000000000..459396c1c --- /dev/null +++ b/aai-service/provider/src/test/java/org/onap/ccsdk/sli/adaptors/aai/update/ActionTest.java @@ -0,0 +1,64 @@ +package org.onap.ccsdk.sli.adaptors.aai.update; + +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.onap.ccsdk.sli.adaptors.aai.query.Result; + +public class ActionTest { + + Action _oInstance; + protected Map<String, Object> _additionalProperties; + protected String _actionType; + protected List<ActionDatum> _actionData; + + @Before + public void setUp() throws Exception { + _oInstance = new Action(); + _actionType = "actionType"; + _actionData = new ArrayList<>(); + ActionDatum a1 = mock(ActionDatum.class); + ActionDatum a2 = mock(ActionDatum.class); + _actionData.add(a1); + _actionData.add(a2); + _additionalProperties = new HashMap<String, Object>() {{ + put("prop1", "propvalue1"); + put("prop2", "propvalue2"); + }}; + } + + @After + public void tearDown() throws Exception { + _oInstance = null; + _actionData = null; + _additionalProperties = null; + } + + @Test + public void testSetActionData() { + _oInstance.setActionData(_actionData); + assertEquals(_oInstance.getActionData(), _actionData); + } + + @Test + public void testSetActionType() { + _oInstance.setActionType(_actionType); + assertEquals(_oInstance.getActionType(), _actionType); + } + + @Test + public void testSetAdditionalProperty() { + _oInstance.setAdditionalProperty("prop1", "propvalue1"); + _oInstance.setAdditionalProperty("prop2", "propvalue2"); + assertEquals(_oInstance.getAdditionalProperties(), _additionalProperties); + } +} diff --git a/aai-service/provider/src/test/java/org/onap/ccsdk/sli/adaptors/aai/update/UpdateNodeKeyTest.java b/aai-service/provider/src/test/java/org/onap/ccsdk/sli/adaptors/aai/update/UpdateNodeKeyTest.java new file mode 100644 index 000000000..360a0948f --- /dev/null +++ b/aai-service/provider/src/test/java/org/onap/ccsdk/sli/adaptors/aai/update/UpdateNodeKeyTest.java @@ -0,0 +1,53 @@ +package org.onap.ccsdk.sli.adaptors.aai.update; + +import static org.junit.Assert.*; + +import java.util.HashMap; +import java.util.Map; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class UpdateNodeKeyTest { + UpdateNodeKey _oInstance; + protected Map<String, Object> _additionalProperties; + protected String _keyName; + protected String _keyValue; + @Before + public void setUp() throws Exception { + _oInstance = new UpdateNodeKey(); + _keyName = "keyName"; + _keyValue = "keyValue"; + _additionalProperties = new HashMap<String, Object>() {{ + put("prop1", "propvalue1"); + put("prop2", "propvalue2"); + }}; + } + + @After + public void tearDown() throws Exception { + _oInstance = null; + _additionalProperties = null; + } + + @Test + public void testSetKeyName() { + _oInstance.setKeyName(_keyName); + assertEquals(_oInstance.getKeyName(), _keyName); + } + + @Test + public void testSetKeyValue() { + _oInstance.setKeyName(_keyName); + assertEquals(_oInstance.getKeyName(), _keyName); + } + + @Test + public void testSetAdditionalProperty() { + _oInstance.setAdditionalProperty("prop1", "propvalue1"); + _oInstance.setAdditionalProperty("prop2", "propvalue2"); + assertEquals(_oInstance.getAdditionalProperties(), _additionalProperties); + } + +} diff --git a/aai-service/provider/src/test/java/org/onap/ccsdk/sli/adaptors/aai/update/UpdateTest.java b/aai-service/provider/src/test/java/org/onap/ccsdk/sli/adaptors/aai/update/UpdateTest.java new file mode 100644 index 000000000..8f8a06eac --- /dev/null +++ b/aai-service/provider/src/test/java/org/onap/ccsdk/sli/adaptors/aai/update/UpdateTest.java @@ -0,0 +1,75 @@ +package org.onap.ccsdk.sli.adaptors.aai.update; + +import static org.junit.Assert.*; +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 UpdateTest { + + Update _oInstance; + protected Map<String, Object> _additionalProperties; + protected String _updateNodeType; + protected List<UpdateNodeKey> _updateNodeKey; + protected List<Action> _action; + + @Before + public void setUp() throws Exception { + _oInstance = new Update(); + _updateNodeType = "updateNodeType"; + _action = new ArrayList<>(); + Action a1 = mock(Action.class); + Action a2 = mock(Action.class); + _action.add(a1); + _action.add(a2); + _updateNodeKey = new ArrayList<>(); + UpdateNodeKey k1 = mock(UpdateNodeKey.class); + UpdateNodeKey k2 = mock(UpdateNodeKey.class); + _updateNodeKey.add(k1); + _updateNodeKey.add(k2); + _additionalProperties = new HashMap<String, Object>() {{ + put("prop1", "propvalue1"); + put("prop2", "propvalue2"); + }}; + } + + @After + public void tearDown() throws Exception { + _oInstance = null; + _action = null; + _additionalProperties = null; + } + + @Test + public void testSetUpdateNodeType() { + _oInstance.setUpdateNodeType(_updateNodeType); + assertEquals(_oInstance.getUpdateNodeType(), _updateNodeType); + } + + @Test + public void testSetAction() { + _oInstance.setAction(_action); + assertEquals(_oInstance.getAction(), _action); + } + + @Test + public void testSetUpdateNodeKey() { + _oInstance.setUpdateNodeKey(_updateNodeKey); + assertEquals(_oInstance.getUpdateNodeKey(), _updateNodeKey); + } + + + @Test + public void testSetAdditionalProperty() { + _oInstance.setAdditionalProperty("prop1", "propvalue1"); + _oInstance.setAdditionalProperty("prop2", "propvalue2"); + assertEquals(_oInstance.getAdditionalProperties(), _additionalProperties); + } +} |