diff options
author | 2020-04-21 11:59:38 +0200 | |
---|---|---|
committer | 2020-04-21 11:59:38 +0200 | |
commit | 66fe4dac91a89e0c080bc53f63bc2474b1724ac8 (patch) | |
tree | fcaaaf0f078116ebdaed087e4e09c08271a2ed86 /netconfsimulator/src | |
parent | 9203c9c40e963b4a5e451b38d32687a185f3b8c6 (diff) |
Provide the parametrized type for this generic
Generic types shouldn't be used raw (without type parameters) in variable declarations or return values. Doing so bypasses generic type checking, and defers the catch of unsafe code to runtime.
Issue-ID: INT-1517
Signed-off-by: Zebek Bogumil <bogumil.zebek@nokia.com>
Change-Id: I211f57a49a78edcb538a9c9d19e543371811845b
Diffstat (limited to 'netconfsimulator/src')
2 files changed, 10 insertions, 10 deletions
diff --git a/netconfsimulator/src/main/java/org/onap/netconfsimulator/kafka/listener/KafkaListenerEntry.java b/netconfsimulator/src/main/java/org/onap/netconfsimulator/kafka/listener/KafkaListenerEntry.java index e3c04c9..501d36b 100644 --- a/netconfsimulator/src/main/java/org/onap/netconfsimulator/kafka/listener/KafkaListenerEntry.java +++ b/netconfsimulator/src/main/java/org/onap/netconfsimulator/kafka/listener/KafkaListenerEntry.java @@ -7,9 +7,9 @@ * 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. @@ -27,9 +27,9 @@ import org.springframework.kafka.listener.AbstractMessageListenerContainer; public class KafkaListenerEntry { private String clientId; - private AbstractMessageListenerContainer listenerContainer; + private AbstractMessageListenerContainer<String, String> listenerContainer; - public KafkaListenerEntry(String clientId, AbstractMessageListenerContainer listenerContainer) { + public KafkaListenerEntry(String clientId, AbstractMessageListenerContainer<String, String> listenerContainer) { this.clientId = clientId; this.listenerContainer = listenerContainer; } diff --git a/netconfsimulator/src/test/java/org/onap/netconfsimulator/websocket/NetconfEndpointTest.java b/netconfsimulator/src/test/java/org/onap/netconfsimulator/websocket/NetconfEndpointTest.java index c1484d4..e0bffc1 100644 --- a/netconfsimulator/src/test/java/org/onap/netconfsimulator/websocket/NetconfEndpointTest.java +++ b/netconfsimulator/src/test/java/org/onap/netconfsimulator/websocket/NetconfEndpointTest.java @@ -7,9 +7,9 @@ * 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. @@ -74,7 +74,7 @@ class NetconfEndpointTest { @Test void shouldCreateKafkaListenerWhenClientInitializeConnection() { NetconfEndpoint netconfEndpoint = new NetconfEndpoint(kafkaListenerHandler); - AbstractMessageListenerContainer abstractMessageListenerContainer = getListenerContainer(); + AbstractMessageListenerContainer<String, String> abstractMessageListenerContainer = getListenerContainer(); when(session.getBasicRemote()).thenReturn(remoteEndpoint); KafkaListenerEntry kafkaListenerEntry = new KafkaListenerEntry("sampleGroupId", abstractMessageListenerContainer); @@ -93,7 +93,7 @@ class NetconfEndpointTest { @Test void shouldCloseListenerWhenClientDisconnects() { NetconfEndpoint netconfEndpoint = new NetconfEndpoint(kafkaListenerHandler); - AbstractMessageListenerContainer abstractMessageListenerContainer = getListenerContainer(); + AbstractMessageListenerContainer<String, String> abstractMessageListenerContainer = getListenerContainer(); netconfEndpoint.setEntry( Optional.of(new KafkaListenerEntry("sampleGroupId", abstractMessageListenerContainer)) ); netconfEndpoint.onClose(session, mock(CloseReason.class)); @@ -101,7 +101,7 @@ class NetconfEndpointTest { verify(abstractMessageListenerContainer).stop(); } - class TestAbstractMessageListenerContainer extends AbstractMessageListenerContainer { + class TestAbstractMessageListenerContainer extends AbstractMessageListenerContainer<String,String> { TestAbstractMessageListenerContainer(ContainerProperties containerProperties) { @@ -124,7 +124,7 @@ class NetconfEndpointTest { } } - private AbstractMessageListenerContainer getListenerContainer() { + private AbstractMessageListenerContainer<String, String> getListenerContainer() { ContainerProperties containerProperties = new ContainerProperties("config"); containerProperties.setGroupId("sample"); containerProperties.setMessageListener(mock(GenericMessageListener.class)); |