From d1981f7e68272cdc5618139a363b80806c2aa77c Mon Sep 17 00:00:00 2001 From: herbert Date: Tue, 28 Jan 2020 16:45:58 +0100 Subject: SDN-R update common update common and remove all dependent bundles Issue-ID: SDNC-1025 Signed-off-by: herbert Change-Id: I0cebe27eff0489f9b221ee7451be9250e362a827 --- .../impl/GeneralConfig.java | 132 ------------------- .../impl/MountpointNodeConnectListenerImpl.java | 66 ---------- .../impl/MountpointNodeStateListenerImpl.java | 71 ---------- .../impl/MountpointStateProviderImpl.java | 126 ------------------ .../impl/MountpointStatePublisher.java | 121 ----------------- .../org/opendaylight/blueprint/impl-blueprint.xml | 35 ----- .../provider/src/main/resources/version.properties | 3 - .../test/GeneralConfigTest.java | 83 ------------ .../TestMountpointNodeConnectListenerImpl.java | 61 --------- .../test/TestMountpointNodeStateListenerImpl.java | 61 --------- .../test/TestMountpointStateProviderImpl.java | 124 ------------------ .../test/TestMountpointStatePublisher.java | 143 --------------------- .../test/mock/NetconfNodeMock.java | 43 ------- .../ClusterSingletonServiceProviderMock.java | 37 ------ .../test/mock/odlapi/DataBrokerMountpointMock.java | 106 --------------- .../test/mock/odlapi/DataBrokerNetconfMock.java | 110 ---------------- .../test/mock/odlapi/MountPointMock.java | 90 ------------- .../test/mock/odlapi/MountPointServiceMock.java | 55 -------- .../odlapi/NotificationPublishServiceMock.java | 50 ------- .../test/mock/odlapi/RpcConsumerRegistryMock.java | 39 ------ .../test/mock/odlapi/RpcProviderRegistryMock.java | 60 --------- .../src/test/resources/simplelogger.properties | 38 ------ .../src/test/resources/testpublisher.properties | 11 -- 23 files changed, 1665 deletions(-) delete mode 100644 sdnr/wt/mountpoint-state-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointstateprovider/impl/GeneralConfig.java delete mode 100644 sdnr/wt/mountpoint-state-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointstateprovider/impl/MountpointNodeConnectListenerImpl.java delete mode 100644 sdnr/wt/mountpoint-state-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointstateprovider/impl/MountpointNodeStateListenerImpl.java delete mode 100644 sdnr/wt/mountpoint-state-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointstateprovider/impl/MountpointStateProviderImpl.java delete mode 100644 sdnr/wt/mountpoint-state-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointstateprovider/impl/MountpointStatePublisher.java delete mode 100644 sdnr/wt/mountpoint-state-provider/provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml delete mode 100644 sdnr/wt/mountpoint-state-provider/provider/src/main/resources/version.properties delete mode 100644 sdnr/wt/mountpoint-state-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointstateprovider/test/GeneralConfigTest.java delete mode 100644 sdnr/wt/mountpoint-state-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointstateprovider/test/TestMountpointNodeConnectListenerImpl.java delete mode 100644 sdnr/wt/mountpoint-state-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointstateprovider/test/TestMountpointNodeStateListenerImpl.java delete mode 100644 sdnr/wt/mountpoint-state-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointstateprovider/test/TestMountpointStateProviderImpl.java delete mode 100644 sdnr/wt/mountpoint-state-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointstateprovider/test/TestMountpointStatePublisher.java delete mode 100644 sdnr/wt/mountpoint-state-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointstateprovider/test/mock/NetconfNodeMock.java delete mode 100644 sdnr/wt/mountpoint-state-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointstateprovider/test/mock/odlapi/ClusterSingletonServiceProviderMock.java delete mode 100644 sdnr/wt/mountpoint-state-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointstateprovider/test/mock/odlapi/DataBrokerMountpointMock.java delete mode 100644 sdnr/wt/mountpoint-state-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointstateprovider/test/mock/odlapi/DataBrokerNetconfMock.java delete mode 100644 sdnr/wt/mountpoint-state-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointstateprovider/test/mock/odlapi/MountPointMock.java delete mode 100644 sdnr/wt/mountpoint-state-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointstateprovider/test/mock/odlapi/MountPointServiceMock.java delete mode 100644 sdnr/wt/mountpoint-state-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointstateprovider/test/mock/odlapi/NotificationPublishServiceMock.java delete mode 100644 sdnr/wt/mountpoint-state-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointstateprovider/test/mock/odlapi/RpcConsumerRegistryMock.java delete mode 100644 sdnr/wt/mountpoint-state-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointstateprovider/test/mock/odlapi/RpcProviderRegistryMock.java delete mode 100644 sdnr/wt/mountpoint-state-provider/provider/src/test/resources/simplelogger.properties delete mode 100644 sdnr/wt/mountpoint-state-provider/provider/src/test/resources/testpublisher.properties (limited to 'sdnr/wt/mountpoint-state-provider/provider/src') diff --git a/sdnr/wt/mountpoint-state-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointstateprovider/impl/GeneralConfig.java b/sdnr/wt/mountpoint-state-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointstateprovider/impl/GeneralConfig.java deleted file mode 100644 index 830346027..000000000 --- a/sdnr/wt/mountpoint-state-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointstateprovider/impl/GeneralConfig.java +++ /dev/null @@ -1,132 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================================== - * ONAP : ccsdk feature sdnr wt - * ================================================================================================= - * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved. - * ================================================================================================= - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing permissions and limitations under - * the License. - * ============LICENSE_END========================================================================== - ******************************************************************************/ -package org.onap.ccsdk.features.sdnr.wt.mountpointstateprovider.impl; - -import org.onap.ccsdk.features.sdnr.wt.common.configuration.Configuration; -import org.onap.ccsdk.features.sdnr.wt.common.configuration.ConfigurationFileRepresentation; - -/** - * Configuration of mountpoint-state-provider, general section
- * - dmaapEnabled : Boolean disable/enable service depending on whether DMaaP is running or not - * Generates default Configuration properties if none exist or exist partially - * Generates Publisher properties only for TransportType=HTTPNOAUTH. Other TransportTypes like HTTP, AUTH_KEY and DME2 have additional properties and are not - * generated by default. For a list of applicable properties for the different TranportType values, please see - https://wiki.onap.org/display/DW/Feature+configuration+requirements - */ -public class GeneralConfig implements Configuration { - - private static final String SECTION_MARKER = "general"; - - private static final String PROPERTY_KEY_ENABLED = "dmaapEnabled" ; //"disabled"; - - public static final String PROPERTY_KEY_PUBLISHER_TRANSPORTTYPE = "TransportType"; - private static final String DEFAULT_VALUE_PUBLISHER_TRANSPORTTYPE = "HTTPNOAUTH"; - - public static final String PROPERTY_KEY_PUBLISHER_HOST_PORT = "host"; - private static final String DEFAULT_VALUE_PUBLISHER_HOST_PORT = "onap-dmap:3904"; - - public static final String PROPERTY_KEY_PUBLISHER_TOPIC = "topic"; - private static final String DEFAULT_VALUE_PUBLISHER_TOPIC = "unauthenticated.SDNR_MOUNTPOINT_STATE_INFO"; - - public static final String PROPERTY_KEY_PUBLISHER_CONTENTTYPE = "contenttype"; - private static final String DEFAULT_VALUE_PUBLISHER_CONTENTTYPE = "application/json"; - - public static final String PROPERTY_KEY_PUBLISHER_TIMEOUT = "timeout"; - private static final String DEFAULT_VALUE_PUBLISHER_TIMEOUT = "20000"; - - public static final String PROPERTY_KEY_PUBLISHER_LIMIT = "limit"; - private static final String DEFAULT_VALUE_PUBLISHER_LIMIT = "10000"; - - public static final String PROPERTY_KEY_PUBLISHER_MAXBATCHSIZE = "maxBatchSize"; - public static final String DEFAULT_VALUE_PUBLISHER_MAXBATCHSIZE = "100"; - - public static final String PROPERTY_KEY_PUBLISHER_MAXAGEMS = "maxAgeMs"; - public static final String DEFAULT_VALUE_PUBLISHER_MAXAGEMS = "250"; - - public static final String PROPERTY_KEY_PUBLISHER_MESSAGESENTTHREADOCCURANCE = "MessageSentThreadOccurance"; - public static final String DEFAULT_VALUE_PUBLISHER_MESSAGESENTTHREADOCCURANCE = "50"; - - private final ConfigurationFileRepresentation configuration; - - public GeneralConfig(ConfigurationFileRepresentation configuration) { - this.configuration = configuration; - this.configuration.addSection(SECTION_MARKER); - defaults(); - } - - public Boolean getEnabled() { - Boolean enabled = configuration.getPropertyBoolean(SECTION_MARKER, PROPERTY_KEY_ENABLED); - return enabled; - } - - public String getHostPort() { - return configuration.getProperty(SECTION_MARKER, PROPERTY_KEY_PUBLISHER_HOST_PORT); - } - - public String getTransportType() { - return configuration.getProperty(SECTION_MARKER, PROPERTY_KEY_PUBLISHER_TRANSPORTTYPE); - } - - public String getTopic() { - return configuration.getProperty(SECTION_MARKER, PROPERTY_KEY_PUBLISHER_TOPIC); - } - - public String getTimeout() { - return configuration.getProperty(SECTION_MARKER, PROPERTY_KEY_PUBLISHER_TIMEOUT); - } - - public String getLimit() { - return configuration.getProperty(SECTION_MARKER, PROPERTY_KEY_PUBLISHER_LIMIT); - } - - public String getContenttype() { - return configuration.getProperty(SECTION_MARKER, PROPERTY_KEY_PUBLISHER_CONTENTTYPE); - } - - public String getMaxBatchSize() { - return configuration.getProperty(SECTION_MARKER, PROPERTY_KEY_PUBLISHER_MAXBATCHSIZE); - } - - public String getMaxAgeMs() { - return configuration.getProperty(SECTION_MARKER, PROPERTY_KEY_PUBLISHER_MAXAGEMS); - } - - public String getMessageSentThreadOccurrence() { - return configuration.getProperty(SECTION_MARKER, PROPERTY_KEY_PUBLISHER_MESSAGESENTTHREADOCCURANCE); - } - - @Override - public String getSectionName() { - return SECTION_MARKER; - } - - @Override - public void defaults() { - // The default value should be "false" given that SDNR can be run in environments where DMaaP is not used - configuration.setPropertyIfNotAvailable(SECTION_MARKER, PROPERTY_KEY_ENABLED, Boolean.FALSE); - configuration.setPropertyIfNotAvailable(SECTION_MARKER, PROPERTY_KEY_PUBLISHER_TRANSPORTTYPE, DEFAULT_VALUE_PUBLISHER_TRANSPORTTYPE); - configuration.setPropertyIfNotAvailable(SECTION_MARKER, PROPERTY_KEY_PUBLISHER_HOST_PORT, DEFAULT_VALUE_PUBLISHER_HOST_PORT); - configuration.setPropertyIfNotAvailable(SECTION_MARKER, PROPERTY_KEY_PUBLISHER_TOPIC, DEFAULT_VALUE_PUBLISHER_TOPIC); - configuration.setPropertyIfNotAvailable(SECTION_MARKER, PROPERTY_KEY_PUBLISHER_CONTENTTYPE, DEFAULT_VALUE_PUBLISHER_CONTENTTYPE); - configuration.setPropertyIfNotAvailable(SECTION_MARKER, PROPERTY_KEY_PUBLISHER_TIMEOUT, DEFAULT_VALUE_PUBLISHER_TIMEOUT); - configuration.setPropertyIfNotAvailable(SECTION_MARKER, PROPERTY_KEY_PUBLISHER_LIMIT, DEFAULT_VALUE_PUBLISHER_LIMIT); - configuration.setPropertyIfNotAvailable(SECTION_MARKER, PROPERTY_KEY_PUBLISHER_MAXBATCHSIZE, DEFAULT_VALUE_PUBLISHER_MAXBATCHSIZE); - configuration.setPropertyIfNotAvailable(SECTION_MARKER, PROPERTY_KEY_PUBLISHER_MAXAGEMS, DEFAULT_VALUE_PUBLISHER_MAXAGEMS); - configuration.setPropertyIfNotAvailable(SECTION_MARKER, PROPERTY_KEY_PUBLISHER_MESSAGESENTTHREADOCCURANCE, DEFAULT_VALUE_PUBLISHER_MESSAGESENTTHREADOCCURANCE); - } - -} diff --git a/sdnr/wt/mountpoint-state-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointstateprovider/impl/MountpointNodeConnectListenerImpl.java b/sdnr/wt/mountpoint-state-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointstateprovider/impl/MountpointNodeConnectListenerImpl.java deleted file mode 100644 index f0bf4961e..000000000 --- a/sdnr/wt/mountpoint-state-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointstateprovider/impl/MountpointNodeConnectListenerImpl.java +++ /dev/null @@ -1,66 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================================== - * ONAP : ccsdk feature sdnr wt - * ================================================================================================= - * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved. - * ================================================================================================= - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing permissions and limitations under - * the License. - * ============LICENSE_END========================================================================== - ******************************************************************************/ - -package org.onap.ccsdk.features.sdnr.wt.mountpointstateprovider.impl; - -import org.json.JSONObject; -import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfNodeConnectListener; -import org.opendaylight.mdsal.binding.api.DataBroker; -import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.NetconfNode; -import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.NetconfNodeConnectionStatus.ConnectionStatus; -import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class MountpointNodeConnectListenerImpl implements NetconfNodeConnectListener { - private static final Logger LOG = LoggerFactory.getLogger(MountpointNodeConnectListenerImpl.class); - - @Override - public void onEnterConnected(NodeId nNodeId, NetconfNode netconfNode, DataBroker netconfNodeDataBroker) { - - LOG.debug("In onEnterConnected of MountpointNodeConnectListenerImpl - nNodeId = "+nNodeId.getValue()+ - " IP Address = "+netconfNode.getHost().getIpAddress().getIpv4Address().getValue()); - - JSONObject obj = new JSONObject(); - obj.put("NodeId", nNodeId.getValue()); - obj.put("NetConfNodeState", netconfNode.getConnectionStatus().toString()); - obj.put("TimeStamp", java.time.Clock.systemUTC().instant()); - - MountpointStatePublisher.stateObjects.add(obj); - } - - @Override - public void onLeaveConnected(NodeId nNodeId) { - - LOG.debug("In onLeaveConnected of MountpointNodeConnectListenerImpl - nNodeId = "+nNodeId); - - JSONObject obj = new JSONObject(); - obj.put("NodeId", nNodeId.getValue()); - obj.put("NetConfNodeState", "Unmounted"); - obj.put("TimeStamp", java.time.Clock.systemUTC().instant()); - - MountpointStatePublisher.stateObjects.add(obj); - } - - public void close() throws Exception { - - LOG.debug("In close of MountpointNodeConnectListenerImpl"); - } - -} diff --git a/sdnr/wt/mountpoint-state-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointstateprovider/impl/MountpointNodeStateListenerImpl.java b/sdnr/wt/mountpoint-state-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointstateprovider/impl/MountpointNodeStateListenerImpl.java deleted file mode 100644 index fb2651ee4..000000000 --- a/sdnr/wt/mountpoint-state-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointstateprovider/impl/MountpointNodeStateListenerImpl.java +++ /dev/null @@ -1,71 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================================== - * ONAP : ccsdk feature sdnr wt - * ================================================================================================= - * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved. - * ================================================================================================= - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing permissions and limitations under - * the License. - * ============LICENSE_END========================================================================== - ******************************************************************************/ - -package org.onap.ccsdk.features.sdnr.wt.mountpointstateprovider.impl; - -import org.json.JSONObject; -import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfNodeStateListener; -import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.NetconfNode; -import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.NetconfNodeConnectionStatus.ConnectionStatus; -import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - - -public class MountpointNodeStateListenerImpl implements NetconfNodeStateListener { - private static final Logger LOG = LoggerFactory.getLogger(MountpointNodeStateListenerImpl.class); - @Override - public void onCreated(NodeId nNodeId, NetconfNode netconfNode) { - - LOG.info("In onCreated of MountpointNodeStateListenerImpl - nNodeId = "+nNodeId.getValue()+ - " IP Address = "+netconfNode.getHost().getIpAddress().getIpv4Address().toString()); - JSONObject obj = new JSONObject(); - obj.put("NodeId", nNodeId.getValue()); - obj.put("NetConfNodeState", netconfNode.getConnectionStatus().toString()); - obj.put("TimeStamp", java.time.Clock.systemUTC().instant()); - - MountpointStatePublisher.stateObjects.add(obj); - } - - @Override - public void onStateChange(NodeId nNodeId, NetconfNode netconfNode) { - - LOG.info("In onStateChange of MountpointNodeStateListenerImpl - nNodeId = "+nNodeId.getValue()+ - " IP Address = "+netconfNode.getHost().getIpAddress().getIpv4Address().getValue()); - JSONObject obj = new JSONObject(); - obj.put("NodeId", nNodeId.getValue()); - obj.put("NetConfNodeState", netconfNode.getConnectionStatus().toString()); - obj.put("TimeStamp", java.time.Clock.systemUTC().instant()); - - MountpointStatePublisher.stateObjects.add(obj); - } - - @Override - public void onRemoved(NodeId nNodeId) { - - LOG.info("In onRemoved of MountpointNodeStateListenerImpl - nNodeId = "+nNodeId); - JSONObject obj = new JSONObject(); - obj.put("NodeId", nNodeId.getValue()); - obj.put("NetConfNodeState", "Removed"); - obj.put("TimeStamp", java.time.Clock.systemUTC().instant()); - - MountpointStatePublisher.stateObjects.add(obj); - } - -} diff --git a/sdnr/wt/mountpoint-state-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointstateprovider/impl/MountpointStateProviderImpl.java b/sdnr/wt/mountpoint-state-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointstateprovider/impl/MountpointStateProviderImpl.java deleted file mode 100644 index 5ffae29f4..000000000 --- a/sdnr/wt/mountpoint-state-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointstateprovider/impl/MountpointStateProviderImpl.java +++ /dev/null @@ -1,126 +0,0 @@ -package org.onap.ccsdk.features.sdnr.wt.mountpointstateprovider.impl; -/******************************************************************************* - * ============LICENSE_START======================================================================== - * ONAP : ccsdk feature sdnr wt - * ================================================================================================= - * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved. - * ================================================================================================= - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing permissions and limitations under - * the License. - * ============LICENSE_END========================================================================== - ******************************************************************************/ - -import java.io.IOException; - -import org.onap.ccsdk.features.sdnr.wt.common.configuration.ConfigurationFileRepresentation; -import org.onap.ccsdk.features.sdnr.wt.common.configuration.filechange.IConfigChangedListener; -import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfNodeStateService; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -@SuppressWarnings("deprecation") -public class MountpointStateProviderImpl implements AutoCloseable, IConfigChangedListener { - - private static final Logger LOG = LoggerFactory.getLogger(MountpointStateProviderImpl.class); - private static final String APPLICATION_NAME = "mountpoint-state-provider"; - private static final String CONFIGURATIONFILE = "etc/mountpoint-state-provider.properties"; - - private NetconfNodeStateService netconfNodeStateService; - - private GeneralConfig generalConfig; - private boolean dmaapEnabled = false; - private Thread mountpointStatePublisher = null; - - MountpointNodeConnectListenerImpl nodeConnectListener = new MountpointNodeConnectListenerImpl(); - MountpointNodeStateListenerImpl nodeStateListener = new MountpointNodeStateListenerImpl(); - - public MountpointStateProviderImpl() { - LOG.info("Creating provider class for {}", APPLICATION_NAME); - } - - public void setNetconfNodeStateService(NetconfNodeStateService netconfNodeStateService) { - this.netconfNodeStateService = netconfNodeStateService; - } - - public void init() { - LOG.info("Init call for {}", APPLICATION_NAME); - ConfigurationFileRepresentation configFileRepresentation = new ConfigurationFileRepresentation(CONFIGURATIONFILE); - configFileRepresentation.registerConfigChangedListener(this); - - generalConfig = new GeneralConfig(configFileRepresentation); - if (generalConfig.getEnabled()) { //dmaapEnabled - mountpointStatePublisher = new Thread(new MountpointStatePublisher(generalConfig)); - mountpointStatePublisher.start(); - netconfNodeStateService.registerNetconfNodeConnectListener(nodeConnectListener); - netconfNodeStateService.registerNetconfNodeStateListener(nodeStateListener); - } - } - - /** - * Reflect status for Unit Tests - * @return Text with status - */ - public String isInitializationOk() { - return "No implemented"; - } - - @Override - public void onConfigChanged() { - LOG.info("Service configuration state changed. Enabled: {}", generalConfig.getEnabled()); - boolean dmaapEnabledNewVal = generalConfig.getEnabled(); - - // DMaap disabled earlier (or during bundle startup) but enabled later, start Consumer(s) - if (!dmaapEnabled && dmaapEnabledNewVal) { - LOG.info("DMaaP is enabled, starting Publisher"); - mountpointStatePublisher = new Thread(new MountpointStatePublisher(generalConfig)); - mountpointStatePublisher.start(); - netconfNodeStateService.registerNetconfNodeConnectListener(nodeConnectListener); - netconfNodeStateService.registerNetconfNodeStateListener(nodeStateListener); - } else if (dmaapEnabled && !dmaapEnabledNewVal) { - // DMaap enabled earlier (or during bundle startup) but disabled later, stop consumer(s) - LOG.info("DMaaP is disabled, stop publisher"); - try { - MountpointStatePublisher.stopPublisher(); - } catch (IOException | InterruptedException e) { - LOG.error("Exception while stopping publisher ", e); - } - } - dmaapEnabled = dmaapEnabledNewVal; - } - - @Override - public void close() throws Exception { - LOG.info("{} closing ...", this.getClass().getName()); - //close(updateService, configService, mwtnService); issue#1 - try { - MountpointStatePublisher.stopPublisher(); - } catch (IOException | InterruptedException e) { - LOG.error("Exception while stopping publisher ", e); - } - //close(updateService, mwtnService); - LOG.info("{} closing done",APPLICATION_NAME); - } - - /** - * Used to close all Services, that should support AutoCloseable Pattern - * - * @param toClose - * @throws Exception - */ - @SuppressWarnings("unused") - private void close(AutoCloseable... toCloseList) throws Exception { - for (AutoCloseable element : toCloseList) { - if (element != null) { - element.close(); - } - } - } - -} diff --git a/sdnr/wt/mountpoint-state-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointstateprovider/impl/MountpointStatePublisher.java b/sdnr/wt/mountpoint-state-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointstateprovider/impl/MountpointStatePublisher.java deleted file mode 100644 index 972c251e6..000000000 --- a/sdnr/wt/mountpoint-state-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointstateprovider/impl/MountpointStatePublisher.java +++ /dev/null @@ -1,121 +0,0 @@ -package org.onap.ccsdk.features.sdnr.wt.mountpointstateprovider.impl; -/******************************************************************************* - * ============LICENSE_START======================================================================== - * ONAP : ccsdk feature sdnr wt - * ================================================================================================= - * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved. - * ================================================================================================= - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing permissions and limitations under - * the License. - * ============LICENSE_END========================================================================== - ******************************************************************************/ - -import java.io.IOException; -import java.util.LinkedList; -import java.util.List; -import java.util.Properties; -import java.util.concurrent.TimeUnit; - -import org.json.JSONObject; -import org.onap.ccsdk.features.sdnr.wt.common.configuration.Configuration; -import org.onap.dmaap.mr.client.MRBatchingPublisher; -import org.onap.dmaap.mr.client.MRClientFactory; -import org.onap.dmaap.mr.client.response.MRPublisherResponse; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - - -public class MountpointStatePublisher implements Runnable { - - private static final Logger LOG = LoggerFactory.getLogger(MountpointStatePublisher.class); - public static final List stateObjects = new LinkedList(); - static MRBatchingPublisher pub; - Properties publisherProperties = new Properties(); - static boolean closePublisher = false; //Set this to true in the "Close" method of MountpointStateProviderImpl - private int fetchPause = 5000; // Default pause between fetch - 5 seconds - - - public MountpointStatePublisher(Configuration config) { - initialize(config); - } - - public void initialize(Configuration config) { - LOG.info("In initializePublisher method of MountpointStatePublisher"); - GeneralConfig generalCfg = (GeneralConfig)config; - - publisherProperties.put(GeneralConfig.PROPERTY_KEY_PUBLISHER_TRANSPORTTYPE, generalCfg.getTransportType()); - publisherProperties.put(GeneralConfig.PROPERTY_KEY_PUBLISHER_HOST_PORT, generalCfg.getHostPort()); - publisherProperties.put(GeneralConfig.PROPERTY_KEY_PUBLISHER_CONTENTTYPE, generalCfg.getContenttype()); - publisherProperties.put(GeneralConfig.PROPERTY_KEY_PUBLISHER_TOPIC, generalCfg.getTopic()); - publisherProperties.put(GeneralConfig.PROPERTY_KEY_PUBLISHER_MAXBATCHSIZE, generalCfg.getMaxBatchSize()); - publisherProperties.put(GeneralConfig.PROPERTY_KEY_PUBLISHER_MAXAGEMS, generalCfg.getMaxAgeMs()); - publisherProperties.put(GeneralConfig.PROPERTY_KEY_PUBLISHER_MESSAGESENTTHREADOCCURANCE, generalCfg.getMessageSentThreadOccurrence()); - - createPublisher(publisherProperties); - } - - public MRBatchingPublisher createPublisher(Properties publisherProperties) { - - try { - pub = MRClientFactory.createBatchingPublisher(publisherProperties, false); - return pub; - } catch (IOException e) { - LOG.info("Exception while creating a publisher", e); - - } - return null; - } - - public void publishMessage(MRBatchingPublisher pub, String msg) { - LOG.info("Publishing message {} - ", msg); - try { - pub.send(msg); - } catch (IOException e) { - LOG.info("Exception while publishing a mesage ", e); - } - } - - public MRBatchingPublisher getPublisher() { - return pub; - } - - public void run() { - - while (!closePublisher) { - try { - if (stateObjects.size() > 0) { - JSONObject obj = ((LinkedList) stateObjects).removeFirst(); - publishMessage(getPublisher(), obj.toString()); - } else { - pauseThread(); - } - } catch(Exception ex) { - LOG.error("Exception while publishing message, ignoring and continuing ... ", ex); - } - - MRPublisherResponse res= pub.sendBatchWithResponse(); // As per dmaap-client code understanding, this need not be called but for some reason the messages are not pushed unless this is called - LOG.debug("Response message = {} ",res.toString()); - } - } - - private void pauseThread() throws InterruptedException { - if (fetchPause > 0) { - LOG.debug("No data yet to publish. Pausing {} ms before retry ", fetchPause); - Thread.sleep(fetchPause); - } else { - LOG.debug("No data yet to publish. No fetch pause specified - retrying immediately"); - } - } - - public static void stopPublisher() throws IOException, InterruptedException { - closePublisher = true; - pub.close(100, TimeUnit.MILLISECONDS); // Send any remaining messages and close - } -} diff --git a/sdnr/wt/mountpoint-state-provider/provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml b/sdnr/wt/mountpoint-state-provider/provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml deleted file mode 100644 index b716b69d8..000000000 --- a/sdnr/wt/mountpoint-state-provider/provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - - - - - diff --git a/sdnr/wt/mountpoint-state-provider/provider/src/main/resources/version.properties b/sdnr/wt/mountpoint-state-provider/provider/src/main/resources/version.properties deleted file mode 100644 index 80373399e..000000000 --- a/sdnr/wt/mountpoint-state-provider/provider/src/main/resources/version.properties +++ /dev/null @@ -1,3 +0,0 @@ -# Proberties filled in by maven during build process -version = ${project.version} -build = ${buildtime} diff --git a/sdnr/wt/mountpoint-state-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointstateprovider/test/GeneralConfigTest.java b/sdnr/wt/mountpoint-state-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointstateprovider/test/GeneralConfigTest.java deleted file mode 100644 index 87bd85fa3..000000000 --- a/sdnr/wt/mountpoint-state-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointstateprovider/test/GeneralConfigTest.java +++ /dev/null @@ -1,83 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================================== - * ONAP : ccsdk feature sdnr wt - * ================================================================================================= - * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved. - * ================================================================================================= - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing permissions and limitations under - * the License. - * ============LICENSE_END========================================================================== - ******************************************************************************/ - -package org.onap.ccsdk.features.sdnr.wt.mountpointstateprovider.test; - -import static org.junit.Assert.assertEquals; - -import java.io.File; -import java.io.IOException; -import java.nio.charset.StandardCharsets; - -import org.junit.After; -import org.junit.Test; -import org.onap.ccsdk.features.sdnr.wt.common.configuration.ConfigurationFileRepresentation; -import org.onap.ccsdk.features.sdnr.wt.mountpointstateprovider.impl.GeneralConfig; - -import com.google.common.io.Files; - -public class GeneralConfigTest { - - private static final String TESTCONFIG_CONTENT="[general]\n" + - "dmaapEnabled=false\n" + - "TransportType=HTTPNOAUTH\n" + - "host=onap-dmap:3904\n" + - "topic=unauthenticated.SDNR_MOUNTPOINT_STATE_INFO\n" + - "contenttype=application/json\n" + - "timeout=20000\n" + - "limit=10000\n" + - "maxBatchSize=100\n" + - "maxAgeMs=250\n" + - "MessageSentThreadOccurance=50\n"; - - private ConfigurationFileRepresentation globalCfg; - - @Test - public void test() { - try { - Files.asCharSink(new File("test.properties"), StandardCharsets.UTF_8).write(TESTCONFIG_CONTENT); - globalCfg = new ConfigurationFileRepresentation("test.properties"); - GeneralConfig cfg = new GeneralConfig(globalCfg); - assertEquals("onap-dmap:3904", cfg.getHostPort()); - assertEquals(false, cfg.getEnabled()); - assertEquals("unauthenticated.SDNR_MOUNTPOINT_STATE_INFO", cfg.getTopic()); - assertEquals("application/json", cfg.getContenttype()); - assertEquals("20000", cfg.getTimeout()); - assertEquals("10000", cfg.getLimit()); - assertEquals("100", cfg.getMaxBatchSize()); - assertEquals("250", cfg.getMaxAgeMs()); - assertEquals("50", cfg.getMessageSentThreadOccurrence()); - assertEquals("HTTPNOAUTH", cfg.getTransportType()); - assertEquals("general", cfg.getSectionName()); - - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - - @After - public void cleanUp() { - File file = new File("test.properties"); - if (file.exists()) { - System.out.println("File exists, Deleting it"); - file.delete(); - } - - } -} diff --git a/sdnr/wt/mountpoint-state-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointstateprovider/test/TestMountpointNodeConnectListenerImpl.java b/sdnr/wt/mountpoint-state-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointstateprovider/test/TestMountpointNodeConnectListenerImpl.java deleted file mode 100644 index 0dfd39e6e..000000000 --- a/sdnr/wt/mountpoint-state-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointstateprovider/test/TestMountpointNodeConnectListenerImpl.java +++ /dev/null @@ -1,61 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================================== - * ONAP : ccsdk feature sdnr wt - * ================================================================================================= - * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved. - * ================================================================================================= - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing permissions and limitations under - * the License. - * ============LICENSE_END========================================================================== - ******************************************************************************/ - -package org.onap.ccsdk.features.sdnr.wt.mountpointstateprovider.test; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotEquals; - -import org.junit.Test; -import org.onap.ccsdk.features.sdnr.wt.mountpointstateprovider.impl.MountpointNodeConnectListenerImpl; -import org.onap.ccsdk.features.sdnr.wt.mountpointstateprovider.impl.MountpointStatePublisher; -import org.onap.ccsdk.features.sdnr.wt.mountpointstateprovider.test.mock.NetconfNodeMock; -import org.onap.ccsdk.features.sdnr.wt.mountpointstateprovider.test.mock.odlapi.DataBrokerMountpointMock; -import org.opendaylight.mdsal.binding.api.DataBroker; -import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.NetconfNode; -import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId; - -public class TestMountpointNodeConnectListenerImpl { - - - MountpointNodeConnectListenerImpl nodeConnectListener = new MountpointNodeConnectListenerImpl(); - NetconfNodeMock netconfNodeMock = new NetconfNodeMock(); - NetconfNode netconfNode = netconfNodeMock.getNetconfNode(); - NodeId nNodeId = new NodeId("nSky"); - DataBroker netconfNodeDataBroker = new DataBrokerMountpointMock(); - - - @Test - public void testOnEnterConnected() { - nodeConnectListener.onEnterConnected(nNodeId, netconfNode, netconfNodeDataBroker); - assertNotEquals(MountpointStatePublisher.stateObjects.size(), 0); - } - - @Test - public void testOnLeaveConnected() { - nodeConnectListener.onLeaveConnected(nNodeId); - assertNotEquals(MountpointStatePublisher.stateObjects.size(), 0); - } - - @Test - public void testClose() throws Exception { - //assertEquals(MountpointStatePublisher.stateObjects.size(), 0); - nodeConnectListener.close(); - } - -} diff --git a/sdnr/wt/mountpoint-state-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointstateprovider/test/TestMountpointNodeStateListenerImpl.java b/sdnr/wt/mountpoint-state-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointstateprovider/test/TestMountpointNodeStateListenerImpl.java deleted file mode 100644 index 2423aa8d4..000000000 --- a/sdnr/wt/mountpoint-state-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointstateprovider/test/TestMountpointNodeStateListenerImpl.java +++ /dev/null @@ -1,61 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================================== - * ONAP : ccsdk feature sdnr wt - * ================================================================================================= - * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved. - * ================================================================================================= - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing permissions and limitations under - * the License. - * ============LICENSE_END========================================================================== - ******************************************************************************/ - -package org.onap.ccsdk.features.sdnr.wt.mountpointstateprovider.test; - - -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertNotNull; - -import org.junit.Test; -import org.onap.ccsdk.features.sdnr.wt.mountpointstateprovider.impl.MountpointNodeStateListenerImpl; -import org.onap.ccsdk.features.sdnr.wt.mountpointstateprovider.impl.MountpointStatePublisher; -import org.onap.ccsdk.features.sdnr.wt.mountpointstateprovider.test.mock.NetconfNodeMock; -import org.onap.ccsdk.features.sdnr.wt.mountpointstateprovider.test.mock.odlapi.DataBrokerMountpointMock; -import org.opendaylight.mdsal.binding.api.DataBroker; -import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.NetconfNode; -import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId; - -public class TestMountpointNodeStateListenerImpl { - - MountpointNodeStateListenerImpl nodeStateListener = new MountpointNodeStateListenerImpl(); - NetconfNodeMock netconfNodeMock = new NetconfNodeMock(); - NetconfNode netconfNode = netconfNodeMock.getNetconfNode(); - NodeId nNodeId = new NodeId("nSky"); - DataBroker netconfNodeDataBroker = new DataBrokerMountpointMock(); - - @Test - public void testOnCreated() { - assertNotNull(nNodeId); - assertNotNull(netconfNode); - nodeStateListener.onCreated(nNodeId, netconfNode); - assertNotEquals(MountpointStatePublisher.stateObjects.size(), 0); - } - - @Test - public void testOnStateChange() { - nodeStateListener.onStateChange(nNodeId, netconfNode); - assertNotEquals(MountpointStatePublisher.stateObjects.size(), 0); - } - - @Test - public void testOnRemoved() { - nodeStateListener.onRemoved(nNodeId); - } - -} diff --git a/sdnr/wt/mountpoint-state-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointstateprovider/test/TestMountpointStateProviderImpl.java b/sdnr/wt/mountpoint-state-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointstateprovider/test/TestMountpointStateProviderImpl.java deleted file mode 100644 index efcd86582..000000000 --- a/sdnr/wt/mountpoint-state-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointstateprovider/test/TestMountpointStateProviderImpl.java +++ /dev/null @@ -1,124 +0,0 @@ -package org.onap.ccsdk.features.sdnr.wt.mountpointstateprovider.test; -/******************************************************************************* - * ============LICENSE_START======================================================================== - * ONAP : ccsdk feature sdnr wt - * ================================================================================================= - * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved. - * ================================================================================================= - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing permissions and limitations under - * the License. - * ============LICENSE_END========================================================================== - ******************************************************************************/ - -import static org.junit.Assert.fail; - -import java.io.File; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.PrintWriter; -import java.io.StringWriter; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; - -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Test; -import org.onap.ccsdk.features.sdnr.wt.mountpointstateprovider.impl.MountpointStateProviderImpl; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class TestMountpointStateProviderImpl { - - private static Path KARAF_ETC = Paths.get("etc"); - private static MountpointStateProviderImpl mountpointStateProvider; - - private static final Logger LOG = LoggerFactory.getLogger(TestMountpointStateProviderImpl.class); - - - - @BeforeClass - public static void before() throws InterruptedException, IOException { - - System.out.println("Logger: " + LOG.getClass().getName() + " " + LOG.getName()); - // Call System property to get the classpath value - Path etc = KARAF_ETC; - delete(etc); - - System.out.println("Create empty:" + etc.toString()); - Files.createDirectories(etc); - - // Create mocks - - // start using blueprint interface - try { - mountpointStateProvider = new MountpointStateProviderImpl(); - - //mountpointStateProvider.init(); // Can't be tested as this invokes a thread. Mockito doesn't help either - } catch (Exception e) { - StringWriter sw = new StringWriter(); - e.printStackTrace(new PrintWriter(sw)); - fail("Not initialized" +sw.toString()); - } - System.out.println("Initialization status: " + mountpointStateProvider.isInitializationOk()); - System.out.println("Initialization done"); - } - - @AfterClass - public static void after() throws InterruptedException, IOException { - - System.out.println("Start shutdown"); - // close using blueprint interface - try { - mountpointStateProvider.close(); - } catch (Exception e) { - System.out.println(e); - } - delete(KARAF_ETC); - - } - - @Test - public void test1() { - System.out.println("Test1: slave mountpoint"); - System.out.println("Initialization status: " + mountpointStateProvider.isInitializationOk()); - System.out.println("Test2: Done"); - } - - // ********************* Private - - private static void delete(Path etc) throws IOException { - if (Files.exists(etc)) { - System.out.println("Found and remove:" + etc.toString()); - delete(etc.toFile()); - } - } - - private static void delete(File f) throws IOException { - if (f.isDirectory()) { - for (File c : f.listFiles()) { - delete(c); - } - } - if (!f.delete()) { - throw new FileNotFoundException("Failed to delete file: " + f); - } - } -/* @Test - public void testInit() { - - } - - @Test - public void testOnConfigChanged() { - //fail("Not yet implemented"); - }*/ - -} diff --git a/sdnr/wt/mountpoint-state-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointstateprovider/test/TestMountpointStatePublisher.java b/sdnr/wt/mountpoint-state-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointstateprovider/test/TestMountpointStatePublisher.java deleted file mode 100644 index b9eb9ba30..000000000 --- a/sdnr/wt/mountpoint-state-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointstateprovider/test/TestMountpointStatePublisher.java +++ /dev/null @@ -1,143 +0,0 @@ -package org.onap.ccsdk.features.sdnr.wt.mountpointstateprovider.test; -/******************************************************************************* - * ============LICENSE_START======================================================================== - * ONAP : ccsdk feature sdnr wt - * ================================================================================================= - * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved. - * ================================================================================================= - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing permissions and limitations under - * the License. - * ============LICENSE_END========================================================================== - ******************************************************************************/ - -import java.io.IOException; -import java.util.Collection; -import java.util.List; -import java.util.Properties; -import java.util.concurrent.TimeUnit; - -import org.json.JSONObject; -import org.junit.Before; -import org.junit.Test; -import org.onap.ccsdk.features.sdnr.wt.common.configuration.Configuration; -import org.onap.ccsdk.features.sdnr.wt.common.configuration.ConfigurationFileRepresentation; -import org.onap.ccsdk.features.sdnr.wt.mountpointstateprovider.impl.GeneralConfig; -import org.onap.ccsdk.features.sdnr.wt.mountpointstateprovider.impl.MountpointStatePublisher; -import org.onap.dmaap.mr.client.MRBatchingPublisher; -import org.onap.dmaap.mr.client.response.MRPublisherResponse; -import org.slf4j.Logger; - -public class TestMountpointStatePublisher { - - private static final String CONFIGURATIONTESTFILE = "test.properties"; - public Thread publisher; - - @Before - public void testMountpointStatePublisherData() { - String testJsonData = "{\"NodeId\":\"69322972e178_50001\",\"NetConfNodeState\":\"Connecting\",\"TimeStamp\":\"2019-11-12T12:45:08.604Z\"}"; - JSONObject jsonObj = new JSONObject(testJsonData); - MountpointStatePublisher.stateObjects.add(jsonObj); - } - - @Test - public void testMountpointStatePublisherConfiguration() throws InterruptedException { - ConfigurationFileRepresentation configFileRepresentation = new ConfigurationFileRepresentation(CONFIGURATIONTESTFILE); - GeneralConfig cfg = new GeneralConfig(configFileRepresentation); - - MountpointStatePublisher pub = new MountpointStatePublisherMock(cfg); - pub.createPublisher(null); - pub.publishMessage(pub.createPublisher(null), "Test DMaaP Message"); - - } - - public class MountpointStatePublisherMock extends MountpointStatePublisher { - - public MountpointStatePublisherMock(Configuration config) { - super(config); - } - - @Override - public MRBatchingPublisher createPublisher(Properties publisherProperties) { - - return new MRBatchingPublisher() { - - @Override - public int send(String msg) throws IOException { - // TODO Auto-generated method stub - System.out.println("Message to send - "+msg); - return 0; - } - - @Override - public int send(String partition, String msg) throws IOException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public int send(message msg) throws IOException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public int send(Collection msgs) throws IOException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public void close() { - // TODO Auto-generated method stub - - } - - @Override - public void logTo(Logger log) { - // TODO Auto-generated method stub - - } - - @Override - public void setApiCredentials(String apiKey, String apiSecret) { - // TODO Auto-generated method stub - - } - - @Override - public void clearApiCredentials() { - // TODO Auto-generated method stub - - } - - @Override - public int getPendingMessageCount() { - // TODO Auto-generated method stub - return 0; - } - - @Override - public List close(long timeout, TimeUnit timeoutUnits) - throws IOException, InterruptedException { - // TODO Auto-generated method stub - return null; - } - - @Override - public MRPublisherResponse sendBatchWithResponse() { - // TODO Auto-generated method stub - return null; - } - - }; - } - } - -} diff --git a/sdnr/wt/mountpoint-state-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointstateprovider/test/mock/NetconfNodeMock.java b/sdnr/wt/mountpoint-state-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointstateprovider/test/mock/NetconfNodeMock.java deleted file mode 100644 index 297674945..000000000 --- a/sdnr/wt/mountpoint-state-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointstateprovider/test/mock/NetconfNodeMock.java +++ /dev/null @@ -1,43 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================================== - * ONAP : ccsdk feature sdnr wt - * ================================================================================================= - * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved. - * ================================================================================================= - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing permissions and limitations under - * the License. - * ============LICENSE_END========================================================================== - ******************************************************************************/ - -package org.onap.ccsdk.features.sdnr.wt.mountpointstateprovider.test.mock; - -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Host; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber; -import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.NetconfNode; -import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.NetconfNodeBuilder; -import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.NetconfNodeConnectionStatus.ConnectionStatus; - -public class NetconfNodeMock { - - public NetconfNode getNetconfNode() { - - NetconfNodeBuilder nNodeBuilder = new NetconfNodeBuilder(); - nNodeBuilder.setAvailableCapabilities(null); - nNodeBuilder.setConnectionStatus(ConnectionStatus.Connected); - nNodeBuilder.setHost(new Host(new IpAddress(new Ipv4Address("1.2.3.4")))); - nNodeBuilder.setPort(new PortNumber(2230)); - // build - NetconfNode nNode = nNodeBuilder.build(); - return nNode; - } - -} diff --git a/sdnr/wt/mountpoint-state-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointstateprovider/test/mock/odlapi/ClusterSingletonServiceProviderMock.java b/sdnr/wt/mountpoint-state-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointstateprovider/test/mock/odlapi/ClusterSingletonServiceProviderMock.java deleted file mode 100644 index b9d55ff27..000000000 --- a/sdnr/wt/mountpoint-state-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointstateprovider/test/mock/odlapi/ClusterSingletonServiceProviderMock.java +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================================== - * ONAP : ccsdk feature sdnr wt - * ================================================================================================= - * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved. - * ================================================================================================= - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing permissions and limitations under - * the License. - * ============LICENSE_END========================================================================== - ******************************************************************************/ - -package org.onap.ccsdk.features.sdnr.wt.mountpointstateprovider.test.mock.odlapi; - -import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonService; -import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceProvider; -import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceRegistration; - -public class ClusterSingletonServiceProviderMock implements ClusterSingletonServiceProvider { - - @Override - public void close() throws Exception { - - } - - @Override - public ClusterSingletonServiceRegistration registerClusterSingletonService(ClusterSingletonService service) { - return null; - } - -} diff --git a/sdnr/wt/mountpoint-state-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointstateprovider/test/mock/odlapi/DataBrokerMountpointMock.java b/sdnr/wt/mountpoint-state-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointstateprovider/test/mock/odlapi/DataBrokerMountpointMock.java deleted file mode 100644 index b85d66809..000000000 --- a/sdnr/wt/mountpoint-state-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointstateprovider/test/mock/odlapi/DataBrokerMountpointMock.java +++ /dev/null @@ -1,106 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * ONAP : ccsdk feature sdnr wt - * ================================================================================ - * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. - * All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - ******************************************************************************/ -package org.onap.ccsdk.features.sdnr.wt.mountpointstateprovider.test.mock.odlapi; - -import org.eclipse.jdt.annotation.NonNull; -import org.opendaylight.controller.md.sal.binding.api.BindingService; -import org.opendaylight.controller.md.sal.binding.api.BindingTransactionChain; -import org.opendaylight.mdsal.binding.api.DataBroker; -import org.opendaylight.mdsal.binding.api.ReadTransaction; -import org.opendaylight.mdsal.binding.api.TransactionChain; -import org.opendaylight.controller.md.sal.binding.api.DataTreeChangeListener; -import org.opendaylight.controller.md.sal.binding.api.DataTreeIdentifier; -import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction; -import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction; -import org.opendaylight.controller.md.sal.binding.api.WriteTransaction; -import org.opendaylight.controller.md.sal.common.api.data.TransactionChainListener; -import org.opendaylight.yangtools.concepts.ListenerRegistration; -import org.opendaylight.yangtools.yang.binding.DataObject; - -/** - * @author herbert - * - */ -@SuppressWarnings("deprecation") -public class DataBrokerMountpointMock implements DataBroker, BindingService { - - ReadOnlyTransaction readOnlyTransaction; - - public void setReadOnlyTransaction(ReadOnlyTransaction readOnlyTransaction) { - this.readOnlyTransaction = readOnlyTransaction; - } - - public > ListenerRegistration registerDataTreeChangeListener( - DataTreeIdentifier arg0, L arg1) { - return null; - } - - public BindingTransactionChain createTransactionChain(TransactionChainListener listener) { - return null; - } - - public ReadOnlyTransaction newReadOnlyTransaction1() { - return readOnlyTransaction; - } - - public ReadWriteTransaction newReadWriteTransaction1() { - return null; - } - - public org.opendaylight.mdsal.binding.api.@NonNull WriteTransaction newWriteOnlyTransaction1() { - return null; - } - - @Override - public @NonNull ReadTransaction newReadOnlyTransaction() { - // TODO Auto-generated method stub - return null; - } - - @Override - public org.opendaylight.mdsal.binding.api.@NonNull ReadWriteTransaction newReadWriteTransaction() { - // TODO Auto-generated method stub - return null; - } - - @Override - public org.opendaylight.mdsal.binding.api.@NonNull WriteTransaction newWriteOnlyTransaction() { - // TODO Auto-generated method stub - return null; - } - - @Override - public > @NonNull ListenerRegistration registerDataTreeChangeListener( - org.opendaylight.mdsal.binding.api.@NonNull DataTreeIdentifier treeId, @NonNull L listener) { - // TODO Auto-generated method stub - return null; - } - - @Override - public @NonNull TransactionChain createTransactionChain( - org.opendaylight.mdsal.binding.api.@NonNull TransactionChainListener listener) { - // TODO Auto-generated method stub - return null; - } - - - -} diff --git a/sdnr/wt/mountpoint-state-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointstateprovider/test/mock/odlapi/DataBrokerNetconfMock.java b/sdnr/wt/mountpoint-state-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointstateprovider/test/mock/odlapi/DataBrokerNetconfMock.java deleted file mode 100644 index c8b03e4a0..000000000 --- a/sdnr/wt/mountpoint-state-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointstateprovider/test/mock/odlapi/DataBrokerNetconfMock.java +++ /dev/null @@ -1,110 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * ONAP : ccsdk feature sdnr wt - * ================================================================================ - * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. - * All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - ******************************************************************************/ -package org.onap.ccsdk.features.sdnr.wt.mountpointstateprovider.test.mock.odlapi; - -import org.eclipse.jdt.annotation.NonNull; -import org.opendaylight.controller.md.sal.binding.api.BindingTransactionChain; -import org.opendaylight.mdsal.binding.api.DataBroker; -import org.opendaylight.controller.md.sal.binding.api.DataTreeChangeListener; -import org.opendaylight.controller.md.sal.binding.api.DataTreeIdentifier; -import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction; -import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction; -import org.opendaylight.controller.md.sal.binding.api.WriteTransaction; -import org.opendaylight.controller.md.sal.common.api.data.TransactionChainListener; -import org.opendaylight.mdsal.binding.api.ReadTransaction; -import org.opendaylight.mdsal.binding.api.TransactionChain; -import org.opendaylight.yangtools.concepts.ListenerRegistration; -import org.opendaylight.yangtools.yang.binding.DataObject; - -/** - * @author herbert - * - */ -@SuppressWarnings("deprecation") -public class DataBrokerNetconfMock implements DataBroker { - - - ReadOnlyTransaction readOnlyTransaction; - - public void setReadOnlyTransaction(ReadOnlyTransaction readOnlyTransaction) { - this.readOnlyTransaction = readOnlyTransaction; - } - - //@Override - public > ListenerRegistration registerDataTreeChangeListener( - DataTreeIdentifier arg0, L arg1) { - return null; - } - - //@Override - public BindingTransactionChain createTransactionChain(TransactionChainListener listener) { - return null; - } - - //@Override - public ReadOnlyTransaction newReadOnlyTransaction1() { - return readOnlyTransaction; - } - - //@Override - public ReadWriteTransaction newReadWriteTransaction1() { - return null; - } - - //@Override - public WriteTransaction newWriteOnlyTransaction1() { - return null; - } - - @Override - public @NonNull ReadTransaction newReadOnlyTransaction() { - // TODO Auto-generated method stub - return null; - } - - @Override - public org.opendaylight.mdsal.binding.api.@NonNull ReadWriteTransaction newReadWriteTransaction() { - // TODO Auto-generated method stub - return null; - } - - @Override - public org.opendaylight.mdsal.binding.api.@NonNull WriteTransaction newWriteOnlyTransaction() { - // TODO Auto-generated method stub - return null; - } - - @Override - public > @NonNull ListenerRegistration registerDataTreeChangeListener( - org.opendaylight.mdsal.binding.api.@NonNull DataTreeIdentifier treeId, @NonNull L listener) { - // TODO Auto-generated method stub - return null; - } - - @Override - public @NonNull TransactionChain createTransactionChain( - org.opendaylight.mdsal.binding.api.@NonNull TransactionChainListener listener) { - // TODO Auto-generated method stub - return null; - } - - -} diff --git a/sdnr/wt/mountpoint-state-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointstateprovider/test/mock/odlapi/MountPointMock.java b/sdnr/wt/mountpoint-state-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointstateprovider/test/mock/odlapi/MountPointMock.java deleted file mode 100644 index 3194189d8..000000000 --- a/sdnr/wt/mountpoint-state-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointstateprovider/test/mock/odlapi/MountPointMock.java +++ /dev/null @@ -1,90 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * ONAP : ccsdk feature sdnr wt sdnr-wt-devicemanager-provider - * ================================================================================ - * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. - * All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - ******************************************************************************/ - -package org.onap.ccsdk.features.sdnr.wt.mountpointstateprovider.test.mock.odlapi; - -import com.google.common.base.Optional; -import org.opendaylight.controller.md.sal.binding.api.BindingService; -import org.opendaylight.controller.md.sal.binding.api.MountPoint; -import org.opendaylight.controller.md.sal.binding.api.NotificationService; -import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction; -import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.network.topology.topology.topology.types.TopologyNetconf; -import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NetworkTopology; -import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TopologyId; -import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology; -import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.TopologyKey; -import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; - -/** - * @author herbert - * - */ -@SuppressWarnings("deprecation") -public class MountPointMock implements MountPoint { - - private boolean databrokerAbsent = true; - private final DataBrokerMountpointMock dataBroker = new DataBrokerMountpointMock(); - private final RpcConsumerRegistryMock rpcConsumerRegistry = new RpcConsumerRegistryMock(); - private NotificationService setReadOnlyTransaction; - - private static final InstanceIdentifier NETCONF_TOPO_IID = - InstanceIdentifier.create(NetworkTopology.class).child(Topology.class, - new TopologyKey(new TopologyId(TopologyNetconf.QNAME.getLocalName()))); - - @Override - public InstanceIdentifier getIdentifier() { - return NETCONF_TOPO_IID; - } - - @SuppressWarnings("unchecked") - @Override - public Optional getService(Class service) { - - System.out.println("Requested mountpoint service: "+service.getSimpleName()+" databrokerAbsent state: "+databrokerAbsent); - - Optional res; - if (service.isInstance(dataBroker)) { - System.out.println("Delivering databroker"); - res = databrokerAbsent ? Optional.absent() : Optional.of(dataBroker); - } else if (service.isInstance(rpcConsumerRegistry)) { - System.out.println("Delivering RpcConsumerRegistryMock"); - res = Optional.of(rpcConsumerRegistry); - } else if (service.isInstance(setReadOnlyTransaction)) { - System.out.println("Delivering notificationService"); - res = Optional.of(setReadOnlyTransaction); - } else { - System.out.println("Delivering no service"); - res = Optional.absent(); - } - return (Optional)res; - } - - public void setDatabrokerAbsent( boolean state) { - this.databrokerAbsent = state; - } - - public void setReadOnlyTransaction(T readOnlyTransaction) { - this.setReadOnlyTransaction = readOnlyTransaction; - dataBroker.setReadOnlyTransaction(readOnlyTransaction); - } - - -} diff --git a/sdnr/wt/mountpoint-state-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointstateprovider/test/mock/odlapi/MountPointServiceMock.java b/sdnr/wt/mountpoint-state-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointstateprovider/test/mock/odlapi/MountPointServiceMock.java deleted file mode 100644 index 59f742f4a..000000000 --- a/sdnr/wt/mountpoint-state-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointstateprovider/test/mock/odlapi/MountPointServiceMock.java +++ /dev/null @@ -1,55 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * ONAP : ccsdk feature sdnr wt - * ================================================================================ - * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. - * All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - ******************************************************************************/ -package org.onap.ccsdk.features.sdnr.wt.mountpointstateprovider.test.mock.odlapi; - -import com.google.common.base.Optional; -import org.opendaylight.controller.md.sal.binding.api.MountPoint; -import org.opendaylight.controller.md.sal.binding.api.MountPointService; -import org.opendaylight.yangtools.concepts.ListenerRegistration; -import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; - -/** - * @author herbert - * - */ -@SuppressWarnings("deprecation") -public class MountPointServiceMock implements MountPointService { - - private final MountPointMock mountpoint; - - public MountPointServiceMock(MountPointMock mountpoint) { - this.mountpoint = mountpoint; - } - - @Override - public Optional getMountPoint(InstanceIdentifier mountPoint) { - - Optional optional = Optional.of(mountpoint); - return optional; - } - - @Override - public ListenerRegistration registerListener(InstanceIdentifier path, - T listener) { - return null; - } - -} diff --git a/sdnr/wt/mountpoint-state-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointstateprovider/test/mock/odlapi/NotificationPublishServiceMock.java b/sdnr/wt/mountpoint-state-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointstateprovider/test/mock/odlapi/NotificationPublishServiceMock.java deleted file mode 100644 index b9db050c3..000000000 --- a/sdnr/wt/mountpoint-state-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointstateprovider/test/mock/odlapi/NotificationPublishServiceMock.java +++ /dev/null @@ -1,50 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * ONAP : ccsdk feature sdnr wt - * ================================================================================ - * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. - * All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - ******************************************************************************/ -package org.onap.ccsdk.features.sdnr.wt.mountpointstateprovider.test.mock.odlapi; - -import com.google.common.util.concurrent.ListenableFuture; -import java.util.concurrent.TimeUnit; -import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService; -import org.opendaylight.yangtools.yang.binding.Notification; - -/** - * @author herbert - * - */ -@SuppressWarnings("deprecation") -public class NotificationPublishServiceMock implements NotificationPublishService { - - @Override - public ListenableFuture offerNotification(Notification notification) { - return null; - } - - @Override - public ListenableFuture offerNotification(Notification notification, int timeout, TimeUnit unit) - throws InterruptedException { - return null; - } - - @Override - public void putNotification(Notification notification) throws InterruptedException { - } - -} diff --git a/sdnr/wt/mountpoint-state-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointstateprovider/test/mock/odlapi/RpcConsumerRegistryMock.java b/sdnr/wt/mountpoint-state-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointstateprovider/test/mock/odlapi/RpcConsumerRegistryMock.java deleted file mode 100644 index 0f08ec07f..000000000 --- a/sdnr/wt/mountpoint-state-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointstateprovider/test/mock/odlapi/RpcConsumerRegistryMock.java +++ /dev/null @@ -1,39 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * ONAP : ccsdk feature sdnr wt sdnr-wt-devicemanager-provider - * ================================================================================ - * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. - * All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - ******************************************************************************/ - -package org.onap.ccsdk.features.sdnr.wt.mountpointstateprovider.test.mock.odlapi; - -import org.opendaylight.controller.sal.binding.api.RpcConsumerRegistry; -import org.opendaylight.yangtools.yang.binding.RpcService; - -/** - * @author herbert - * - */ -@SuppressWarnings("deprecation") -public class RpcConsumerRegistryMock implements RpcConsumerRegistry { - - @Override - public T getRpcService(Class serviceInterface) { - return null; - } - -} diff --git a/sdnr/wt/mountpoint-state-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointstateprovider/test/mock/odlapi/RpcProviderRegistryMock.java b/sdnr/wt/mountpoint-state-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointstateprovider/test/mock/odlapi/RpcProviderRegistryMock.java deleted file mode 100644 index 8a72bb630..000000000 --- a/sdnr/wt/mountpoint-state-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointstateprovider/test/mock/odlapi/RpcProviderRegistryMock.java +++ /dev/null @@ -1,60 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * ONAP : ccsdk feature sdnr wt - * ================================================================================ - * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. - * All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - ******************************************************************************/ -package org.onap.ccsdk.features.sdnr.wt.mountpointstateprovider.test.mock.odlapi; - -import org.opendaylight.controller.md.sal.common.api.routing.RouteChangeListener; -import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RoutedRpcRegistration; -import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RpcRegistration; -import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry; -import org.opendaylight.controller.sal.binding.api.rpc.RpcContextIdentifier; -import org.opendaylight.yangtools.concepts.ListenerRegistration; -import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; -import org.opendaylight.yangtools.yang.binding.RpcService; - -@SuppressWarnings("deprecation") -public class RpcProviderRegistryMock implements RpcProviderRegistry { - - @Override - public T getRpcService(Class serviceInterface) { - return null; - } - - @Override - public >> ListenerRegistration registerRouteChangeListener( - L listener) { - return null; - } - - - @Override - public RoutedRpcRegistration addRoutedRpcImplementation(Class serviceInterface, - T implementation) throws IllegalStateException { - return null; - } - - @Override - public RpcRegistration addRpcImplementation(Class serviceInterface, T implementation) - throws IllegalStateException { - System.out.println("Register class "+serviceInterface); - return null; - } - -} diff --git a/sdnr/wt/mountpoint-state-provider/provider/src/test/resources/simplelogger.properties b/sdnr/wt/mountpoint-state-provider/provider/src/test/resources/simplelogger.properties deleted file mode 100644 index 2eb3eb7b3..000000000 --- a/sdnr/wt/mountpoint-state-provider/provider/src/test/resources/simplelogger.properties +++ /dev/null @@ -1,38 +0,0 @@ -# SLF4J's SimpleLogger configuration file -# Simple implementation of Logger that sends all enabled log messages, for all defined loggers, to System.err. - -# Default logging detail level for all instances of SimpleLogger. -# Must be one of ("trace", "debug", "info", "warn", or "error"). -# If not specified, defaults to "info". -org.slf4j.simpleLogger.defaultLogLevel=info - -# Logging detail level for a SimpleLogger instance named "xxx.yyy.zzz". -# Must be one of ("trace", "debug", "info", "warn", or "error"). -# If not specified, the default logging detail level is used. -# org.slf4j.simpleLogger.log.xxx.yyy=debug -org.slf4j.simpleLogger.log.org.onap.ccsdk.features.sdnr.wt.devicemanager=info -org.slf4j.simpleLogger.log.org.onap.ccsdk.features.sdnr.wt.devicemanager.archiveservice=info -org.slf4j.simpleLogger.log.org.onap.ccsdk.features.sdnr.wt.devicemanager.base.internalTypes.Resources=info -org.slf4j.simpleLogger.log.org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.container=info - -# Set to true if you want the current date and time to be included in output messages. -# Default is false, and will output the number of milliseconds elapsed since startup. -#org.slf4j.simpleLogger.showDateTime=false - -# The date and time format to be used in the output messages. -# The pattern describing the date and time format is the same that is used in java.text.SimpleDateFormat. -# If the format is not specified or is invalid, the default format is used. -# The default format is yyyy-MM-dd HH:mm:ss:SSS Z. -#org.slf4j.simpleLogger.dateTimeFormat=yyyy-MM-dd HH:mm:ss:SSS Z - -# Set to true if you want to output the current thread name. -# Defaults to true. -#org.slf4j.simpleLogger.showThreadName=true - -# Set to true if you want the Logger instance name to be included in output messages. -# Defaults to true. -#org.slf4j.simpleLogger.showLogName=true - -# Set to true if you want the last component of the name to be included in output messages. -# Defaults to false. -#org.slf4j.simpleLogger.showShortLogName=false diff --git a/sdnr/wt/mountpoint-state-provider/provider/src/test/resources/testpublisher.properties b/sdnr/wt/mountpoint-state-provider/provider/src/test/resources/testpublisher.properties deleted file mode 100644 index f74399404..000000000 --- a/sdnr/wt/mountpoint-state-provider/provider/src/test/resources/testpublisher.properties +++ /dev/null @@ -1,11 +0,0 @@ -[general] -dmaapEnabled=false -TransportType=HTTPNOAUTH -host=onap-dmap:3904 -topic=unauthenticated.SDNR_MOUNTPOINT_STATE_INFO -contenttype=application/json -timeout=20000 -limit=10000 -maxBatchSize=100 -maxAgeMs=250 -MessageSentThreadOccurance=50 \ No newline at end of file -- cgit 1.2.3-korg