From 25f7c518a61c3018452381f082effe5af335f592 Mon Sep 17 00:00:00 2001 From: highstreetherbert Date: Fri, 10 Jul 2020 18:54:26 +0200 Subject: Reformat sdnr mountpoint-state-provider to ONAP code style Reformat to ONAP code style Issue-ID: SDNC-1280 Signed-off-by: highstreetherbert Change-Id: Ibb4685c594de3733e7c682c4cf761fd311ab52a4 Signed-off-by: highstreetherbert --- .../impl/GeneralConfig.java | 176 +++++++++-------- .../impl/MountpointNodeConnectListenerImpl.java | 10 +- .../impl/MountpointNodeStateListenerImpl.java | 65 +++---- .../impl/MountpointStateProviderImpl.java | 24 +-- .../impl/MountpointStatePublisher.java | 169 ++++++++--------- .../test/GeneralConfigTest.java | 100 +++++----- .../TestMountpointNodeConnectListenerImpl.java | 4 +- .../test/TestMountpointNodeStateListenerImpl.java | 52 +++--- .../test/TestMountpointStateProviderImpl.java | 166 ++++++++-------- .../test/TestMountpointStatePublisher.java | 208 +++++++++++---------- .../test/mock/NetconfAccessorMock.java | 4 +- .../test/mock/NetconfNodeMock.java | 24 +-- .../ClusterSingletonServiceProviderMock.java | 18 +- .../test/mock/odlapi/DataBrokerMountpointMock.java | 70 +++---- .../test/mock/odlapi/DataBrokerNetconfMock.java | 66 +++---- .../test/mock/odlapi/MountPointMock.java | 15 +- .../test/mock/odlapi/MountPointMockNew.java | 4 +- .../test/mock/odlapi/MountPointServiceMock.java | 4 +- .../odlapi/NotificationPublishServiceMock.java | 9 +- .../test/mock/odlapi/RpcConsumerRegistryMock.java | 4 +- .../test/mock/odlapi/RpcProviderRegistryMock.java | 8 +- 21 files changed, 608 insertions(+), 592 deletions(-) (limited to 'sdnr') 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 index 830346027..675ac8a2f 100644 --- 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 @@ -1,4 +1,4 @@ -/******************************************************************************* +/* * ============LICENSE_START======================================================================== * ONAP : ccsdk feature sdnr wt * ================================================================================================= @@ -14,7 +14,7 @@ * 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; @@ -22,111 +22,121 @@ import org.onap.ccsdk.features.sdnr.wt.common.configuration.ConfigurationFileRep /** * 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 + * - 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"; - + 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); - } + 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 index 9d7ce090d..48cb76ead 100644 --- 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 @@ -1,4 +1,4 @@ -/******************************************************************************* +/* * ============LICENSE_START======================================================================== * ONAP : ccsdk feature sdnr wt * ================================================================================================= @@ -14,7 +14,7 @@ * 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; @@ -38,8 +38,8 @@ public class MountpointNodeConnectListenerImpl implements NetconfNodeConnectList NetconfNode netconfNode = accessor.getNetconfNode(); //, MountPoint mountpoint, DataBroker netconfNodeDataBroker; - LOG.debug("In onEnterConnected of MountpointNodeConnectListenerImpl - nNodeId = "+nNodeId.getValue()+ - " IP Address = "+netconfNode.getHost().getIpAddress().getIpv4Address().getValue()); + 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()); @@ -52,7 +52,7 @@ public class MountpointNodeConnectListenerImpl implements NetconfNodeConnectList @Override public void onLeaveConnected(NodeId nNodeId, Optional optionalNetconfNode) { - LOG.debug("In onLeaveConnected of MountpointNodeConnectListenerImpl - nNodeId = "+nNodeId); + LOG.debug("In onLeaveConnected of MountpointNodeConnectListenerImpl - nNodeId = " + nNodeId); JSONObject obj = new JSONObject(); obj.put("NodeId", nNodeId.getValue()); 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 index fb2651ee4..b7d76f38d 100644 --- 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 @@ -1,4 +1,4 @@ -/******************************************************************************* +/* * ============LICENSE_START======================================================================== * ONAP : ccsdk feature sdnr wt * ================================================================================================= @@ -14,7 +14,7 @@ * 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; @@ -29,43 +29,44 @@ 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) { + private static final Logger LOG = LoggerFactory.getLogger(MountpointNodeStateListenerImpl.class); - 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()); + @Override + public void onCreated(NodeId nNodeId, NetconfNode netconfNode) { - MountpointStatePublisher.stateObjects.add(obj); - } + 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()); - @Override - public void onStateChange(NodeId nNodeId, NetconfNode netconfNode) { + MountpointStatePublisher.stateObjects.add(obj); + } - 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()); + @Override + public void onStateChange(NodeId nNodeId, NetconfNode netconfNode) { - MountpointStatePublisher.stateObjects.add(obj); - } + 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()); - @Override - public void onRemoved(NodeId nNodeId) { + MountpointStatePublisher.stateObjects.add(obj); + } - 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()); + @Override + public void onRemoved(NodeId nNodeId) { - MountpointStatePublisher.stateObjects.add(obj); - } + 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 index 0223e7323..cb5cbe3e2 100644 --- 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 @@ -58,7 +58,8 @@ public class MountpointStateProviderImpl implements AutoCloseable, IConfigChange public void init() { LOG.info("Init call for {}", APPLICATION_NAME); - ConfigurationFileRepresentation configFileRepresentation = new ConfigurationFileRepresentation(CONFIGURATIONFILE); + ConfigurationFileRepresentation configFileRepresentation = + new ConfigurationFileRepresentation(CONFIGURATIONFILE); configFileRepresentation.registerConfigChangedListener(this); generalConfig = new GeneralConfig(configFileRepresentation); @@ -72,6 +73,7 @@ public class MountpointStateProviderImpl implements AutoCloseable, IConfigChange /** * Reflect status for Unit Tests + * * @return Text with status */ public String isInitializationOk() { @@ -91,13 +93,13 @@ public class MountpointStateProviderImpl implements AutoCloseable, IConfigChange netconfNodeStateService.registerNetconfNodeConnectListener(nodeConnectListener); netconfNodeStateService.registerNetconfNodeStateListener(nodeStateListener); } else if (dmaapEnabled && !dmaapEnabledNewVal) { - // DMaap enabled earlier (or during bundle startup) but disabled later, stop consumer(s) + // 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); - } + MountpointStatePublisher.stopPublisher(); + } catch (IOException | InterruptedException e) { + LOG.error("Exception while stopping publisher ", e); + } } dmaapEnabled = dmaapEnabledNewVal; } @@ -107,12 +109,12 @@ public class MountpointStateProviderImpl implements AutoCloseable, IConfigChange 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); - } + MountpointStatePublisher.stopPublisher(); + } catch (IOException | InterruptedException e) { + LOG.error("Exception while stopping publisher ", e); + } //close(updateService, mwtnService); - LOG.info("{} closing done",APPLICATION_NAME); + LOG.info("{} closing done", APPLICATION_NAME); } /** 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 index 30857dec5..7f9fb2370 100644 --- 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 @@ -41,88 +41,89 @@ 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 - } + 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/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 index 87bd85fa3..c95dbf56c 100644 --- 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 @@ -1,4 +1,4 @@ -/******************************************************************************* +/* * ============LICENSE_START======================================================================== * ONAP : ccsdk feature sdnr wt * ================================================================================================= @@ -14,70 +14,70 @@ * 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 com.google.common.io.Files; 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"; + // @formatter:off + 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"; + // @formatter:on + + 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()); - private ConfigurationFileRepresentation globalCfg; + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } - @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()); + @After + public void cleanUp() { + File file = new File("test.properties"); + if (file.exists()) { + System.out.println("File exists, Deleting it"); + file.delete(); + } - } 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 index 078109500..8cc7f206f 100644 --- 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 @@ -1,4 +1,4 @@ -/******************************************************************************* +/* * ============LICENSE_START======================================================================== * ONAP : ccsdk feature sdnr wt * ================================================================================================= @@ -14,7 +14,7 @@ * 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; 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 index 2423aa8d4..2ee93b0a3 100644 --- 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 @@ -1,4 +1,4 @@ -/******************************************************************************* +/* * ============LICENSE_START======================================================================== * ONAP : ccsdk feature sdnr wt * ================================================================================================= @@ -14,7 +14,7 @@ * 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; @@ -33,29 +33,29 @@ import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology. 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); - } + 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 index 40951fab9..19d930866 100644 --- 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 @@ -44,88 +44,88 @@ 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"); - }*/ + 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 index 72069d72c..dcb62f253 100644 --- 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 @@ -43,108 +43,110 @@ 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; - } - - }; - } - } + 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/NetconfAccessorMock.java b/sdnr/wt/mountpoint-state-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointstateprovider/test/mock/NetconfAccessorMock.java index 8a4f20b29..69c24d834 100644 --- a/sdnr/wt/mountpoint-state-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointstateprovider/test/mock/NetconfAccessorMock.java +++ b/sdnr/wt/mountpoint-state-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointstateprovider/test/mock/NetconfAccessorMock.java @@ -1,4 +1,4 @@ -/******************************************************************************* +/* * ============LICENSE_START======================================================================== * ONAP : ccsdk feature sdnr wt * ================================================================================================= @@ -14,7 +14,7 @@ * 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 com.google.common.util.concurrent.ListenableFuture; 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 index 297674945..e5f6456c9 100644 --- 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 @@ -1,4 +1,4 @@ -/******************************************************************************* +/* * ============LICENSE_START======================================================================== * ONAP : ccsdk feature sdnr wt * ================================================================================================= @@ -14,7 +14,7 @@ * 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; @@ -28,16 +28,16 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev15 public class NetconfNodeMock { - public NetconfNode getNetconfNode() { + 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; - } + 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 index b9d55ff27..c69f05da3 100644 --- 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 @@ -1,4 +1,4 @@ -/******************************************************************************* +/* * ============LICENSE_START======================================================================== * ONAP : ccsdk feature sdnr wt * ================================================================================================= @@ -14,7 +14,7 @@ * 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; @@ -24,14 +24,14 @@ import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceRegist public class ClusterSingletonServiceProviderMock implements ClusterSingletonServiceProvider { - @Override - public void close() throws Exception { + @Override + public void close() throws Exception { - } + } - @Override - public ClusterSingletonServiceRegistration registerClusterSingletonService(ClusterSingletonService service) { - return null; - } + @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 index b85d66809..271701fc2 100644 --- 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 @@ -1,4 +1,4 @@ -/******************************************************************************* +/* * ============LICENSE_START======================================================= * ONAP : ccsdk feature sdnr wt * ================================================================================ @@ -17,7 +17,7 @@ * 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; @@ -61,45 +61,45 @@ public class DataBrokerMountpointMock implements DataBroker, BindingService { return readOnlyTransaction; } - public ReadWriteTransaction newReadWriteTransaction1() { - return null; + 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; - } + @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 index c8b03e4a0..65ca779a3 100644 --- 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 @@ -1,4 +1,4 @@ -/******************************************************************************* +/* * ============LICENSE_START======================================================= * ONAP : ccsdk feature sdnr wt * ================================================================================ @@ -17,7 +17,7 @@ * 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; @@ -74,37 +74,37 @@ public class DataBrokerNetconfMock implements DataBroker { 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; - } + @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 index 3194189d8..cab9747e9 100644 --- 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 @@ -1,4 +1,4 @@ -/******************************************************************************* +/* * ============LICENSE_START======================================================= * ONAP : ccsdk feature sdnr wt sdnr-wt-devicemanager-provider * ================================================================================ @@ -17,7 +17,7 @@ * 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; @@ -58,12 +58,13 @@ public class MountPointMock implements MountPoint { @Override public Optional getService(Class service) { - System.out.println("Requested mountpoint service: "+service.getSimpleName()+" databrokerAbsent state: "+databrokerAbsent); + 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); + res = databrokerAbsent ? Optional.absent() : Optional.of(dataBroker); } else if (service.isInstance(rpcConsumerRegistry)) { System.out.println("Delivering RpcConsumerRegistryMock"); res = Optional.of(rpcConsumerRegistry); @@ -74,14 +75,14 @@ public class MountPointMock implements MountPoint { System.out.println("Delivering no service"); res = Optional.absent(); } - return (Optional)res; + return (Optional) res; } - public void setDatabrokerAbsent( boolean state) { + public void setDatabrokerAbsent(boolean state) { this.databrokerAbsent = state; } - public void setReadOnlyTransaction(T readOnlyTransaction) { + 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/MountPointMockNew.java b/sdnr/wt/mountpoint-state-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointstateprovider/test/mock/odlapi/MountPointMockNew.java index 03e70b56f..f8035e82e 100644 --- a/sdnr/wt/mountpoint-state-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointstateprovider/test/mock/odlapi/MountPointMockNew.java +++ b/sdnr/wt/mountpoint-state-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointstateprovider/test/mock/odlapi/MountPointMockNew.java @@ -1,4 +1,4 @@ -/******************************************************************************* +/* * ============LICENSE_START======================================================================== * ONAP : ccsdk feature sdnr wt * ================================================================================================= @@ -14,7 +14,7 @@ * 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 java.util.Optional; 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 index 59f742f4a..8802e812b 100644 --- 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 @@ -1,4 +1,4 @@ -/******************************************************************************* +/* * ============LICENSE_START======================================================= * ONAP : ccsdk feature sdnr wt * ================================================================================ @@ -17,7 +17,7 @@ * 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; 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 index b9db050c3..79ba90ae2 100644 --- 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 @@ -1,4 +1,4 @@ -/******************************************************************************* +/* * ============LICENSE_START======================================================= * ONAP : ccsdk feature sdnr wt * ================================================================================ @@ -17,7 +17,7 @@ * 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; @@ -37,14 +37,13 @@ public class NotificationPublishServiceMock implements NotificationPublishServic return null; } - @Override + @Override public ListenableFuture offerNotification(Notification notification, int timeout, TimeUnit unit) throws InterruptedException { return null; } @Override - public void putNotification(Notification notification) throws InterruptedException { - } + 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 index 0f08ec07f..963c9023b 100644 --- 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 @@ -1,4 +1,4 @@ -/******************************************************************************* +/* * ============LICENSE_START======================================================= * ONAP : ccsdk feature sdnr wt sdnr-wt-devicemanager-provider * ================================================================================ @@ -17,7 +17,7 @@ * 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; 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 index 8a72bb630..1a8ed90d6 100644 --- 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 @@ -1,4 +1,4 @@ -/******************************************************************************* +/* * ============LICENSE_START======================================================= * ONAP : ccsdk feature sdnr wt * ================================================================================ @@ -17,7 +17,7 @@ * 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; @@ -37,7 +37,7 @@ public class RpcProviderRegistryMock implements RpcProviderRegistry { return null; } - @Override + @Override public >> ListenerRegistration registerRouteChangeListener( L listener) { return null; @@ -53,7 +53,7 @@ public class RpcProviderRegistryMock implements RpcProviderRegistry { @Override public RpcRegistration addRpcImplementation(Class serviceInterface, T implementation) throws IllegalStateException { - System.out.println("Register class "+serviceInterface); + System.out.println("Register class " + serviceInterface); return null; } -- cgit 1.2.3-korg