import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
-
+import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.ListenableFuture;
import java.net.URI;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
-
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
import org.opendaylight.yangtools.yang.data.api.CompositeNode;
import org.opendaylight.yangtools.yang.data.impl.codec.BindingIndependentMappingService;
-import com.google.common.util.concurrent.Futures;
-import com.google.common.util.concurrent.ListenableFuture;
-
public class RpcInvocationStrategyTest {
@Mock
public class MockRpcService implements RpcService {
- public Future<?> rpcnameWithInputNoOutput(DataObject input) {
+ public Future<?> rpcnameWithInputNoOutput(final DataObject input) {
return futureDataObj;
}
- public Future<RpcResult<DataObject>> rpcnameWithInputWithOutput(DataObject input) {
+ public Future<RpcResult<DataObject>> rpcnameWithInputWithOutput(final DataObject input) {
return futureDataObj;
}
urn = new URI(new String("urn:a:valid:urn"));
}
- private void setupForForwardToDom(boolean hasOutput, boolean hasInput, int expectedErrorSize) {
+ private void setupForForwardToDom(final boolean hasOutput, final boolean hasInput, final int expectedErrorSize) {
if (expectedErrorSize > 0) {
errors.add(rpcError);
}
- private void validateForwardToDomBroker(ListenableFuture<RpcResult<?>> forwardToDomBroker,
- boolean expectedSuccess, DataObject expectedResult, int expectedErrorSize)
+ private void validateForwardToDomBroker(final ListenableFuture<RpcResult<?>> forwardToDomBroker,
+ final boolean expectedSuccess, final DataObject expectedResult, final int expectedErrorSize)
throws InterruptedException, ExecutionException {
assertNotNull(forwardToDomBroker);
assertEquals(expectedSuccess, forwardToDomBroker.get().isSuccessful());
assertEquals(expectedErrorSize, forwardToDomBroker.get().getErrors().size());
}
- private void setupTestMethod(String rpcName, String testMethodName, boolean hasInput)
+ private void setupTestMethod(final String rpcName, final String testMethodName, final boolean hasInput)
throws NoSuchMethodException {
- mockQName = new QName(urn, new Date(0L), new String("prefix"), new String(rpcName));
+ mockQName = QName.create(urn, new Date(0L), new String(rpcName));
java.lang.reflect.Method rpcMethod = hasInput ? MockRpcService.class.getMethod(rpcName,
DataObject.class) : MockRpcService.class.getMethod(rpcName);
rpcInvocationStrategy = new RpcInvocationStrategy(mockQName, rpcMethod, mockMappingService,
/*
* invokeOn Tests
*/
- private void setupRpcResultsWithOutput(int expectedErrorSize) {
+ private void setupRpcResultsWithOutput(final int expectedErrorSize) {
if (expectedErrorSize > 0) {
errors.add(rpcError);
}
when(mockMappingService.toDataDom(toDataDomInput)).thenReturn(outputInvokeOn);
}
- private void setupRpcResultsNoOutput(int expectedErrorSize) {
+ private void setupRpcResultsNoOutput(final int expectedErrorSize) {
if (expectedErrorSize > 0) {
errors.add(rpcError);
}
}
private void validateReturnedImmediateFuture(
- ListenableFuture<RpcResult<CompositeNode>> immediateFuture, boolean expectedSuccess,
- CompositeNode expectedReturn, int expectedErrorSize) throws InterruptedException,
+ final ListenableFuture<RpcResult<CompositeNode>> immediateFuture, final boolean expectedSuccess,
+ final CompositeNode expectedReturn, final int expectedErrorSize) throws InterruptedException,
ExecutionException {
assertNotNull(immediateFuture);
assertEquals(expectedSuccess, immediateFuture.get().isSuccessful());