diff options
author | Michael DÜrre <michael.duerre@highstreet-technologies.com> | 2022-03-10 10:39:16 +0100 |
---|---|---|
committer | Dan Timoney <dtimoney@att.com> | 2022-03-23 15:08:48 -0400 |
commit | eb2a7c97c0007b013bd1784ac17d57be02b63d03 (patch) | |
tree | b0861438532727219216cfd426e21ae053abb31a /sdnr/wt/netconfnode-state-service/provider/src/test | |
parent | 3c74361514bb920ed441d105f66ca978bd074ced (diff) |
migrate sdnr features to phosphorus
fix mapper and switch to dom api
Updated to use phosphorus version of parent poms
Issue-ID: CCSDK-3566
Signed-off-by: Michael DÜrre <michael.duerre@highstreet-technologies.com>
Change-Id: I98c5bef9286622e0d66b53db687557d798cd53f5
Signed-off-by: Michael DÜrre <michael.duerre@highstreet-technologies.com>
Diffstat (limited to 'sdnr/wt/netconfnode-state-service/provider/src/test')
2 files changed, 13 insertions, 10 deletions
diff --git a/sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/TestNetconfNodeStateService.java b/sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/TestNetconfNodeStateService.java index b6d731418..70480d5bb 100644 --- a/sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/TestNetconfNodeStateService.java +++ b/sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/TestNetconfNodeStateService.java @@ -81,9 +81,9 @@ import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology. import org.opendaylight.yangtools.concepts.ListenerRegistration; import org.opendaylight.yangtools.yang.binding.DataObject; import org.opendaylight.yangtools.yang.common.RpcResult; -import org.opendaylight.yangtools.yang.model.parser.api.YangParserException; -import org.opendaylight.yangtools.yang.model.parser.api.YangParserFactory; -import org.opendaylight.yangtools.yang.parser.impl.YangParserFactoryImpl; +import org.opendaylight.yangtools.yang.parser.api.YangParserException; +import org.opendaylight.yangtools.yang.parser.api.YangParserFactory; +import org.opendaylight.yangtools.yang.parser.impl.DefaultYangParserFactory; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -143,7 +143,7 @@ public class TestNetconfNodeStateService extends Mockito { NotificationPublishService notificationPublishService = mock(NotificationPublishService.class); RpcProviderService rpcProviderRegistry = mock(RpcProviderService.class); IEntityDataProvider entityProviderMock = mock(IEntityDataProvider.class); - YangParserFactory yangParserFactory = new YangParserFactoryImpl(); + YangParserFactory yangParserFactory = new DefaultYangParserFactory(); BindingNormalizedNodeSerializer bindingNormalizedNodeSerializer = new BindingCodecContext(BindingRuntimeHelpers.createRuntimeContext()); // start using blueprint interface @@ -165,7 +165,9 @@ public class TestNetconfNodeStateService extends Mockito { public static void after() throws InterruptedException, IOException { System.out.println("Start shutdown"); // close using blueprint interface - netconfStateService.close(); + if(netconfStateService!=null) { + netconfStateService.close(); + } delete(KARAF_ETC); } diff --git a/sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/example/ExampleConfig.java b/sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/example/ExampleConfig.java index f17453803..9630897fb 100644 --- a/sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/example/ExampleConfig.java +++ b/sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/example/ExampleConfig.java @@ -30,11 +30,12 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.config.rev201208 import org.opendaylight.yangtools.yang.common.QName; import org.opendaylight.yangtools.yang.common.QNameModule; import org.opendaylight.yangtools.yang.common.Revision; +import org.opendaylight.yangtools.yang.common.XMLNamespace; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext; -import org.opendaylight.yangtools.yang.model.parser.api.YangParser; -import org.opendaylight.yangtools.yang.model.parser.api.YangParserException; +import org.opendaylight.yangtools.yang.parser.api.YangParser; +import org.opendaylight.yangtools.yang.parser.api.YangParserException; import org.opendaylight.yangtools.yang.model.repo.api.YangTextSchemaSource; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -45,7 +46,7 @@ public class ExampleConfig { // specification of YANG module private static final QNameModule CONFIG_MODULE = QNameModule.create( - URI.create("urn:ietf:params:xml:ns:yang:config"), Revision.of("2020-12-08")); + XMLNamespace.of("urn:ietf:params:xml:ns:yang:config"), Revision.of("2020-12-08")); // path to 'configuration' container (it is a root container) private static final YangInstanceIdentifier CONFIGURATION_PATH = YangInstanceIdentifier.builder() .node(QName.create(CONFIG_MODULE, "configuration")) @@ -61,7 +62,7 @@ public class ExampleConfig { final EffectiveModelContext schemaContext = parser.buildEffectiveModel(); // (2) parsing of configuration into binding-independent format - final NormalizedNode<?, ?> data = DomParser.parseJsonFile("/example.json", schemaContext); + final NormalizedNode data = DomParser.parseJsonFile("/example.json", schemaContext); // (3) conversion into binding-aware format (md-sal codec needs to know about path on which data is placed) final Configuration config = (Configuration) domContext.getBindingNormalizedNodeSerializer().fromNormalizedNode(CONFIGURATION_PATH, data) @@ -69,7 +70,7 @@ public class ExampleConfig { // (4) printing some useful information LOG.info("Value of 'config1': {}", config.getConfig1()); - LOG.info("Value of 'config2': {}", config.isConfig2()); + LOG.info("Value of 'config2': {}", config.requireConfig2()); Objects.requireNonNull(config.getEntry()).forEach((entryKey, entry) -> LOG.info("Value of '{}' setting: {}", entry.getSetting(), entry.getValue())); } |