summaryrefslogtreecommitdiffstats
path: root/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/test
diff options
context:
space:
mode:
authorJoss Armstrong <joss.armstrong@ericsson.com>2019-02-05 13:59:47 +0000
committerPatrick Brady <patrick.brady@att.com>2019-02-06 21:32:54 +0000
commit4fc2e746a0c79e6f81fd08241733b02b781dc5d0 (patch)
treee616e5a7ec9236e6f8b021c0071363210e7baa16 /appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/test
parente38c122ec2c57e63d0788148841fbe6231957482 (diff)
Test coverage for AppcNetconfAdapterActivator
Added 100% coverage for untested class. Moved other test file to correct package. Issue-ID: APPC-1389 Change-Id: I73e768f21d5cda8865f891c63b9ad3f3ea2cce80 Signed-off-by: Joss Armstrong <joss.armstrong@ericsson.com>
Diffstat (limited to 'appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/test')
-rw-r--r--appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/test/java/org/onap/appc/adapter/netconf/AppcNetconfAdapterActivatorTest.java42
-rw-r--r--appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/test/java/org/onap/appc/adapter/netconf/OperationalStateValidatorTest.java (renamed from appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/test/java/OperationalStateValidatorTest.java)10
2 files changed, 47 insertions, 5 deletions
diff --git a/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/test/java/org/onap/appc/adapter/netconf/AppcNetconfAdapterActivatorTest.java b/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/test/java/org/onap/appc/adapter/netconf/AppcNetconfAdapterActivatorTest.java
new file mode 100644
index 000000000..c1321ec10
--- /dev/null
+++ b/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/test/java/org/onap/appc/adapter/netconf/AppcNetconfAdapterActivatorTest.java
@@ -0,0 +1,42 @@
+package org.onap.appc.adapter.netconf;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mockito;
+import org.onap.appc.adapter.netconf.internal.NetconfDataAccessServiceImpl;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceRegistration;
+import org.powermock.reflect.Whitebox;
+
+public class AppcNetconfAdapterActivatorTest {
+
+ private BundleContext bundle;
+
+ @Before
+ public void setup() {
+ bundle = Mockito.mock(BundleContext.class);
+ }
+
+ @Test
+ public void testStart() throws Exception {
+ AppcNetconfAdapterActivator activator = new AppcNetconfAdapterActivator();
+ activator.start(bundle);
+ Mockito.verify(bundle, Mockito.times(2)).registerService(Mockito.any(Class.class),
+ Mockito.any(NetconfDataAccessServiceImpl.class), Mockito.any());
+ }
+
+ @Test
+ public void testStop() throws Exception {
+ AppcNetconfAdapterActivator activator = Mockito.spy(new AppcNetconfAdapterActivator());
+ ServiceRegistration registration = Mockito.mock(ServiceRegistration.class);
+ ServiceRegistration reporterRegistration = Mockito.mock(ServiceRegistration.class);
+ ServiceRegistration factoryRegistration = Mockito.mock(ServiceRegistration.class);
+ ServiceRegistration dbRegistration = Mockito.mock(ServiceRegistration.class);
+ Whitebox.setInternalState(activator, "registration", registration);
+ Whitebox.setInternalState(activator, "reporterRegistration", reporterRegistration);
+ Whitebox.setInternalState(activator, "factoryRegistration", factoryRegistration);
+ Whitebox.setInternalState(activator, "dbRegistration", dbRegistration);
+ activator.stop(bundle);
+ Mockito.verify(dbRegistration).unregister();
+ }
+}
diff --git a/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/test/java/OperationalStateValidatorTest.java b/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/test/java/org/onap/appc/adapter/netconf/OperationalStateValidatorTest.java
index e3521910e..5fe7c79c5 100644
--- a/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/test/java/OperationalStateValidatorTest.java
+++ b/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/test/java/org/onap/appc/adapter/netconf/OperationalStateValidatorTest.java
@@ -5,6 +5,8 @@
* Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Copyright (C) 2017 Amdocs
+ * ================================================================================
+ * Modifications Copyright (C) 2019 Ericsson
* =============================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,14 +23,12 @@
* ============LICENSE_END=========================================================
*/
-import org.onap.appc.exceptions.APPCException;
-import org.junit.Test;
-import org.onap.appc.adapter.netconf.OperationalStateValidator;
-import org.onap.appc.adapter.netconf.OperationalStateValidatorFactory;
-import org.onap.appc.adapter.netconf.VnfType;
+package org.onap.appc.adapter.netconf;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.fail;
+import org.junit.Test;
+import org.onap.appc.exceptions.APPCException;
public class OperationalStateValidatorTest {