summaryrefslogtreecommitdiffstats
path: root/northbound/asdcApi/provider/src/test
diff options
context:
space:
mode:
authorDan Timoney <dtimoney@att.com>2021-01-29 17:42:42 +0000
committerDan Timoney <dtimoney@att.com>2021-01-29 17:42:42 +0000
commit0e4e58bf061df695341ac250beb97a978cefdaf7 (patch)
tree06539b81ae2f3bbeddd3f7f30199cdd200a8480c /northbound/asdcApi/provider/src/test
parentce4e5f9a00d2677495240ad367b9bfc4b74752d0 (diff)
Revert "migrate sli to alu-SR1"
This reverts commit ce4e5f9a00d2677495240ad367b9bfc4b74752d0. Reason for revert: ODL upgrade changes need to be backed out until issues in ccsdk/features are resolved. Change-Id: I168e2519e37f3eee61609d0da890c14db49ec49e
Diffstat (limited to 'northbound/asdcApi/provider/src/test')
-rw-r--r--northbound/asdcApi/provider/src/test/java/org/onap/ccsdk/sli/northbound/asdcapi/TestAsdcApiApi.java203
1 files changed, 112 insertions, 91 deletions
diff --git a/northbound/asdcApi/provider/src/test/java/org/onap/ccsdk/sli/northbound/asdcapi/TestAsdcApiApi.java b/northbound/asdcApi/provider/src/test/java/org/onap/ccsdk/sli/northbound/asdcapi/TestAsdcApiApi.java
index 15ed92776..1f266365c 100644
--- a/northbound/asdcApi/provider/src/test/java/org/onap/ccsdk/sli/northbound/asdcapi/TestAsdcApiApi.java
+++ b/northbound/asdcApi/provider/src/test/java/org/onap/ccsdk/sli/northbound/asdcapi/TestAsdcApiApi.java
@@ -21,95 +21,116 @@
package org.onap.ccsdk.sli.northbound.asdcapi;
-public class TestAsdcApiApi {//extends AbstractConcurrentDataBrokerTest {
-
-// private AsdcApiProvider asdcApiProvider;
-// private static final Logger LOG = LoggerFactory.getLogger(AsdcApiProvider.class);
-//
-// @Before
-// public void setUp() throws Exception {
-// if (null == asdcApiProvider) {
-// DataBroker dataBroker = getDataBroker();
-// NotificationPublishService mockNotification = mock(NotificationPublishService.class);
-// RpcProviderService mockRpcRegistry = mock(RpcProviderService.class);
-// AsdcApiSliClient mockSliClient = mock(AsdcApiSliClient.class);
-// Properties respProps = new Properties();
-// respProps.setProperty("error-code", "200");
-// respProps.setProperty("error-message", "Success");
-//
-// when(mockSliClient.hasGraph("ASDC-API", "vf-license-model-update" , null, "sync")).thenReturn(true);
-// when(mockSliClient.execute("ASDC-API", "vf-license-model-update", null, "sync", respProps)).thenReturn(respProps);
-//
-// asdcApiProvider = new AsdcApiProvider(dataBroker, mockNotification, mockRpcRegistry, mockSliClient);
-// }
-// }
-//
-// //Testcase should return error 503 when No service logic active for ASDC-API.
-// @Test
-// public void testVfLicenseModelUpdate() {
-//
-// VfLicenseModelUpdateInputBuilder inputBuilder = new VfLicenseModelUpdateInputBuilder();
-//
-// inputBuilder.setArtifactName("abc");
-// inputBuilder.setArtifactVersion("1");
-//
-// // TODO: currently initialize SvcLogicServiceClient is failing, need to fix
-// java.util.concurrent.Future<RpcResult<VfLicenseModelUpdateOutput>> future = asdcApiProvider
-// .vfLicenseModelUpdate(inputBuilder.build());
-// RpcResult<VfLicenseModelUpdateOutput> rpcResult = null;
-// try {
-// rpcResult = future.get();
-// } catch (Exception e) {
-// fail("Error : " + e);
-// }
-// LOG.info("result: {}", rpcResult);
-// assertEquals("200", rpcResult.getResult().getAsdcApiResponseCode());
-// }
-//
-// //Input parameter validation
-// @Test
-// public void testVfLicenseModelUpdateInputValidation() {
-//
-// VfLicenseModelUpdateInputBuilder inputBuilder = new VfLicenseModelUpdateInputBuilder();
-//
-// inputBuilder.setArtifactName("abc");
-// inputBuilder.setArtifactVersion("1");
-//
-// java.util.concurrent.Future<RpcResult<VfLicenseModelUpdateOutput>> future = asdcApiProvider
-// .vfLicenseModelUpdate(null);
-// assertNull(future);
-// }
-//
-// @Test
-// public void testVfLicenseModelUpdateValidation1() {
-//
-// VfLicenseModelUpdateInputBuilder inputBuilder = new VfLicenseModelUpdateInputBuilder();
-//
-// inputBuilder.setArtifactName("license1");
-// inputBuilder.setArtifactVersion("version1");
-//
-// VfLicenseModelBuilder vfLicenseModelBuilder = new VfLicenseModelBuilder();
-// vfLicenseModelBuilder.setVfId("123");
-// vfLicenseModelBuilder.setVendorName("acme");
-// inputBuilder.setVfLicenseModel(vfLicenseModelBuilder.build());
-//
-//
-// java.util.concurrent.Future<RpcResult<VfLicenseModelUpdateOutput>> future = asdcApiProvider
-// .vfLicenseModelUpdate(inputBuilder.build());
-// RpcResult<VfLicenseModelUpdateOutput> rpcResult = null;
-// try {
-// rpcResult = future.get();
-// } catch (Exception e) {
-// fail("Error : " + e);
-// }
-// }
-//
-//
-//
-//
-// @Test
-// public void testAddArtifactVersion() {
-// asdcApiProvider.addArtifactVersion("artifact1",
-// "version1");
-// }
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.fail;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
+import org.opendaylight.controller.md.sal.binding.test.AbstractConcurrentDataBrokerTest;
+import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
+import org.opendaylight.yang.gen.v1.http.xmlns.onap.org.asdc.license.model._1._0.rev160427.vf.license.model.grouping.VfLicenseModelBuilder;
+import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev170201.VfLicenseModelUpdateInputBuilder;
+import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev170201.VfLicenseModelUpdateOutput;
+import org.opendaylight.yangtools.yang.common.RpcResult;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Properties;
+
+public class TestAsdcApiApi extends AbstractConcurrentDataBrokerTest {
+
+ private AsdcApiProvider asdcApiProvider;
+ private static final Logger LOG = LoggerFactory.getLogger(AsdcApiProvider.class);
+
+ @Before
+ public void setUp() throws Exception {
+ if (null == asdcApiProvider) {
+ DataBroker dataBroker = getDataBroker();
+ NotificationPublishService mockNotification = mock(NotificationPublishService.class);
+ RpcProviderRegistry mockRpcRegistry = mock(RpcProviderRegistry.class);
+ AsdcApiSliClient mockSliClient = mock(AsdcApiSliClient.class);
+ Properties respProps = new Properties();
+ respProps.setProperty("error-code", "200");
+ respProps.setProperty("error-message", "Success");
+
+ when(mockSliClient.hasGraph("ASDC-API", "vf-license-model-update" , null, "sync")).thenReturn(true);
+ when(mockSliClient.execute("ASDC-API", "vf-license-model-update", null, "sync", respProps)).thenReturn(respProps);
+
+ asdcApiProvider = new AsdcApiProvider(dataBroker, mockNotification, mockRpcRegistry, mockSliClient);
+ }
+ }
+
+ //Testcase should return error 503 when No service logic active for ASDC-API.
+ @Test
+ public void testVfLicenseModelUpdate() {
+
+ VfLicenseModelUpdateInputBuilder inputBuilder = new VfLicenseModelUpdateInputBuilder();
+
+ inputBuilder.setArtifactName("abc");
+ inputBuilder.setArtifactVersion("1");
+
+ // TODO: currently initialize SvcLogicServiceClient is failing, need to fix
+ java.util.concurrent.Future<RpcResult<VfLicenseModelUpdateOutput>> future = asdcApiProvider
+ .vfLicenseModelUpdate(inputBuilder.build());
+ RpcResult<VfLicenseModelUpdateOutput> rpcResult = null;
+ try {
+ rpcResult = future.get();
+ } catch (Exception e) {
+ fail("Error : " + e);
+ }
+ LOG.info("result: {}", rpcResult);
+ assertEquals("200", rpcResult.getResult().getAsdcApiResponseCode());
+ }
+
+ //Input parameter validation
+ @Test
+ public void testVfLicenseModelUpdateInputValidation() {
+
+ VfLicenseModelUpdateInputBuilder inputBuilder = new VfLicenseModelUpdateInputBuilder();
+
+ inputBuilder.setArtifactName("abc");
+ inputBuilder.setArtifactVersion("1");
+
+ java.util.concurrent.Future<RpcResult<VfLicenseModelUpdateOutput>> future = asdcApiProvider
+ .vfLicenseModelUpdate(null);
+ assertNull(future);
+ }
+
+ @Test
+ public void testVfLicenseModelUpdateValidation1() {
+
+ VfLicenseModelUpdateInputBuilder inputBuilder = new VfLicenseModelUpdateInputBuilder();
+
+ inputBuilder.setArtifactName("license1");
+ inputBuilder.setArtifactVersion("version1");
+
+ VfLicenseModelBuilder vfLicenseModelBuilder = new VfLicenseModelBuilder();
+ vfLicenseModelBuilder.setVfId("123");
+ vfLicenseModelBuilder.setVendorName("acme");
+ inputBuilder.setVfLicenseModel(vfLicenseModelBuilder.build());
+
+
+ java.util.concurrent.Future<RpcResult<VfLicenseModelUpdateOutput>> future = asdcApiProvider
+ .vfLicenseModelUpdate(inputBuilder.build());
+ RpcResult<VfLicenseModelUpdateOutput> rpcResult = null;
+ try {
+ rpcResult = future.get();
+ } catch (Exception e) {
+ fail("Error : " + e);
+ }
+ }
+
+
+
+
+ @Test
+ public void testAddArtifactVersion() {
+ asdcApiProvider.addArtifactVersion("artifact1",
+ "version1");
+ }
}