*/
protected <O extends DataObject> ListenableFuture<RpcResult<O>> sendToSwitchFuture(final Object input,
final String failureInfo) {
- SimpleRpcListener<O> listener = new SimpleRpcListener(input, failureInfo);
- return enqueueMessage(listener);
+ return enqueueMessage(new SimpleRpcListener<>(input, failureInfo));
}
private <T> ListenableFuture<RpcResult<T>> enqueueMessage(final AbstractRpcListener<T> promise) {
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-
package org.opendaylight.openflowjava.protocol.impl.core.connection;
import io.netty.channel.Channel;
public void testEnqueue() {
ChannelOutboundQueue queue = new ChannelOutboundQueue(channel, 1, null);
boolean enqueued;
- enqueued = queue.enqueue(new SimpleRpcListener("INPUT", "Failed to send INPUT"));
+ enqueued = queue.enqueue(new SimpleRpcListener<>("INPUT", "Failed to send INPUT"));
Assert.assertTrue("Enqueue problem", enqueued);
- enqueued = queue.enqueue(new SimpleRpcListener("INPUT", "Failed to send INPUT"));
+ enqueued = queue.enqueue(new SimpleRpcListener<>("INPUT", "Failed to send INPUT"));
Assert.assertFalse("Enqueue problem", enqueued);
}
}
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-
package org.opendaylight.openflowjava.protocol.impl.core.connection;
import org.junit.Assert;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloInputBuilder;
/**
- * UNit tests for MessageListenerWrapper.
+ * Unit tests for MessageListenerWrapper.
*
* @author michal.polkorab
*/
public void test() {
HelloInputBuilder builder = new HelloInputBuilder();
HelloInput hello = builder.build();
- SimpleRpcListener listener = new SimpleRpcListener(hello, "Error");
+ SimpleRpcListener<?> listener = new SimpleRpcListener<>(hello, "Error");
MessageListenerWrapper wrapper = new MessageListenerWrapper(hello, listener);
Assert.assertEquals("Wrong message", hello, wrapper.getMsg());
Assert.assertEquals("Wrong listener", listener, wrapper.getListener());
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-
package org.opendaylight.openflowjava.protocol.impl.core.connection;
import static org.junit.Assert.fail;
*/
@Test
public void test() {
- SimpleRpcListener listener = new SimpleRpcListener("MESSAGE", "Failed to send message");
+ SimpleRpcListener<?> listener = new SimpleRpcListener<>("MESSAGE", "Failed to send message");
Assert.assertEquals("Wrong message", "MESSAGE", listener.takeMessage());
Assert.assertEquals("Wrong message", listener, listener.takeListener());
}
*/
@Test
public void testSuccessfulRpc() {
- SimpleRpcListener<?> listener = new SimpleRpcListener("MESSAGE", "Failed to send message");
+ SimpleRpcListener<?> listener = new SimpleRpcListener<>("MESSAGE", "Failed to send message");
listener.operationSuccessful();
SettableFuture<RpcResult<?>> result = SettableFuture.create();
result.set(RpcResultBuilder.success((Void)null).build());
@Test
public void testOperationComplete() {
when(future.isSuccess()).thenReturn(false);
- SimpleRpcListener<?> listener = new SimpleRpcListener("MESSAGE", "Failed to send message");
+ SimpleRpcListener<?> listener = new SimpleRpcListener<>("MESSAGE", "Failed to send message");
listener.operationComplete(future);
verify(future, times(1)).cause();
try {
@Test
public void testOperationComplete2() {
when(future.isSuccess()).thenReturn(true);
- SimpleRpcListener<?> listener = new SimpleRpcListener("MESSAGE", "Failed to send message");
+ SimpleRpcListener<?> listener = new SimpleRpcListener<>("MESSAGE", "Failed to send message");
listener.operationComplete(future);
verify(future, times(0)).cause();
try {