import com.google.common.util.concurrent.SettableFuture;
import java.util.Collections;
import java.util.List;
-import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import org.junit.Assert;
import org.junit.Test;
import org.mockito.Mockito;
import org.mockito.stubbing.Answer;
import org.opendaylight.mdsal.binding.api.RpcProviderService;
-import org.opendaylight.openflowplugin.api.openflow.statistics.ofpspecific.EventIdentifier;
import org.opendaylight.openflowplugin.impl.datastore.MultipartWriterProviderFactory;
import org.opendaylight.openflowplugin.impl.services.ServiceMocking;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyTableFeaturesCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.table.features._case.MultipartReplyTableFeaturesBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.table.features._case.multipart.reply.table.features.TableFeaturesBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.table.features.properties.grouping.TableFeatureProperties;
import org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.UpdateTableInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.UpdateTableInputBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.UpdateTableOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.table.update.UpdatedTableBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.TableFeatures;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
return null;
})
.when(mockedOutboundQueue).commitEntry(
- anyLong(), ArgumentMatchers.<OfHeader>any(), ArgumentMatchers.<FutureCallback<OfHeader>>any());
+ anyLong(), ArgumentMatchers.any(), ArgumentMatchers.any());
final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();
salTableService = new SalTableServiceImpl(mockedRequestContextStack, mockedDeviceContext,
}
@Test
- public void testUpdateTableFail1() throws ExecutionException, InterruptedException {
+ public void testUpdateTableFail1() {
Mockito.doAnswer((Answer<Void>) invocation -> {
final RpcResult<List<MultipartReply>> rpcResult =
RpcResultBuilder.<List<MultipartReply>>failed().build();
handleResultFuture.set(rpcResult);
return null;
- }).when(multiMessageCollector).endCollecting(ArgumentMatchers.<EventIdentifier>any());
+ }).when(multiMessageCollector).endCollecting(ArgumentMatchers.any());
final Future<RpcResult<UpdateTableOutput>> rpcResultFuture = salTableService.updateTable(prepareUpdateTable());
Assert.assertNotNull(rpcResultFuture);
}
@Test
- public void testUpdateTableFail2() throws ExecutionException, InterruptedException {
+ public void testUpdateTableFail2() {
Mockito.doAnswer((Answer<Void>) invocation -> {
final RpcResult<List<MultipartReply>> rpcResult =
RpcResultBuilder.success(Collections.<MultipartReply>emptyList())
.build();
handleResultFuture.set(rpcResult);
return null;
- }).when(multiMessageCollector).endCollecting(ArgumentMatchers.<EventIdentifier>any());
+ }).when(multiMessageCollector).endCollecting(ArgumentMatchers.any());
final Future<RpcResult<UpdateTableOutput>> rpcResultFuture = salTableService.updateTable(prepareUpdateTable());
Assert.assertNotNull(rpcResultFuture);
}
@Test
- public void testUpdateTableSuccess() throws ExecutionException, InterruptedException {
+ public void testUpdateTableSuccess() {
Mockito.doAnswer((Answer<Void>) invocation -> {
TableFeaturesBuilder tableFeaturesBld = new TableFeaturesBuilder()
.setTableId((short) 0)
.setName("Zafod")
.setMaxEntries(42L)
- .setTableFeatureProperties(Collections.<TableFeatureProperties>emptyList());
+ .setTableFeatureProperties(Collections.emptyList());
MultipartReplyTableFeaturesBuilder mpTableFeaturesBld = new MultipartReplyTableFeaturesBuilder()
.setTableFeatures(Collections.singletonList(tableFeaturesBld.build()));
MultipartReplyTableFeaturesCaseBuilder mpBodyBld = new MultipartReplyTableFeaturesCaseBuilder()
.build();
handleResultFuture.set(rpcResult);
return null;
- }).when(multiMessageCollector).endCollecting(ArgumentMatchers.<EventIdentifier>any());
+ }).when(multiMessageCollector).endCollecting(ArgumentMatchers.any());
final Future<RpcResult<UpdateTableOutput>> rpcResultFuture = salTableService.updateTable(prepareUpdateTable());
Assert.assertNotNull(rpcResultFuture);
verify(mockedRequestContextStack).createRequestContext();
}
- private UpdateTableInput prepareUpdateTable() {
+ private static UpdateTableInput prepareUpdateTable() {
UpdateTableInputBuilder updateTableInputBuilder = new UpdateTableInputBuilder();
UpdatedTableBuilder updatedTableBuilder = new UpdatedTableBuilder();
- updatedTableBuilder.setTableFeatures(Collections.<TableFeatures>emptyList());
+ updatedTableBuilder.setTableFeatures(Collections.emptyList());
updateTableInputBuilder.setUpdatedTable(updatedTableBuilder.build());
return updateTableInputBuilder.build();
}