import org.junit.Test;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.meters.Meter;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.meters.MeterBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev150304.SendBarrierOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
private static final MeterId DUMMY_METER_ID_2 = new MeterId(43L);
@Test
- public void testBuildGroupPath() throws Exception {
+ public void testBuildGroupPath() {
final InstanceIdentifier<Node> nodePath = InstanceIdentifier
.create(Nodes.class)
.child(Node.class, new NodeKey(DUMMY_NODE_ID));
}
@Test
- public void testCreateCumulatingFunction() throws Exception {
+ public void testCreateCumulatingFunction() {
final Function<List<RpcResult<String>>, RpcResult<List<BatchFailedMetersOutput>>> function =
MeterUtil.createCumulativeFunction(Lists.newArrayList(
createBatchMeter(DUMMY_METER_ID),
}
@Test
- public void testMeterAddTransformFailure() throws Exception {
+ public void testMeterAddTransformFailure() {
final RpcResult<List<BatchFailedMetersOutput>> input = createBatchOutcomeWithError();
checkBatchErrorOutcomeTransformation(MeterUtil.METER_ADD_TRANSFORM.apply(input));
}
@Test
- public void testMeterAddTransformSuccess() throws Exception {
+ public void testMeterAddTransformSuccess() {
final RpcResult<List<BatchFailedMetersOutput>> input = createEmptyBatchOutcome();
checkBatchSuccessOutcomeTransformation(MeterUtil.METER_ADD_TRANSFORM.apply(input));
}
@Test
- public void testMeterRemoveTransformFailure() throws Exception {
+ public void testMeterRemoveTransformFailure() {
final RpcResult<List<BatchFailedMetersOutput>> input = createBatchOutcomeWithError();
checkBatchErrorOutcomeTransformation(MeterUtil.METER_REMOVE_TRANSFORM.apply(input));
}
@Test
- public void testFlowRemoveTransformSuccess() throws Exception {
+ public void testFlowRemoveTransformSuccess() {
final RpcResult<List<BatchFailedMetersOutput>> input = createEmptyBatchOutcome();
checkBatchSuccessOutcomeTransformation(MeterUtil.METER_REMOVE_TRANSFORM.apply(input));
}
@Test
- public void testFlowUpdateTransformFailure() throws Exception {
+ public void testFlowUpdateTransformFailure() {
final RpcResult<List<BatchFailedMetersOutput>> input = createBatchOutcomeWithError();
checkBatchErrorOutcomeTransformation(MeterUtil.METER_UPDATE_TRANSFORM.apply(input));
}
@Test
- public void testFlowUpdateTransformSuccess() throws Exception {
+ public void testFlowUpdateTransformSuccess() {
final RpcResult<List<BatchFailedMetersOutput>> input = createEmptyBatchOutcome();
checkBatchSuccessOutcomeTransformation(MeterUtil.METER_UPDATE_TRANSFORM.apply(input));
}
private RpcResult<List<BatchFailedMetersOutput>> createEmptyBatchOutcome() {
return RpcResultBuilder
- .<List<BatchFailedMetersOutput>>success(Collections.<BatchFailedMetersOutput>emptyList())
+ .success(Collections.<BatchFailedMetersOutput>emptyList())
.build();
}
}
@Test
- public void testCreateComposingFunction_success_success() throws Exception {
- final Function<Pair<RpcResult<AddMetersBatchOutput>, RpcResult<Void>>, RpcResult<AddMetersBatchOutput>>
- compositeFunction = MeterUtil.createComposingFunction();
+ public void testCreateComposingFunction_success_success() {
+ final Function<Pair<RpcResult<AddMetersBatchOutput>, RpcResult<SendBarrierOutput>>,
+ RpcResult<AddMetersBatchOutput>> compositeFunction = MeterUtil.createComposingFunction();
final RpcResult<AddMetersBatchOutput> addGroupBatchOutput = createAddMetersBatchSuccessOutput();
- final RpcResult<Void> barrierOutput = RpcResultBuilder.<Void>success().build();
- final Pair<RpcResult<AddMetersBatchOutput>, RpcResult<Void>> input =
+ final RpcResult<SendBarrierOutput> barrierOutput = RpcResultBuilder.<SendBarrierOutput>success().build();
+ final Pair<RpcResult<AddMetersBatchOutput>, RpcResult<SendBarrierOutput>> input =
Pair.of(addGroupBatchOutput, barrierOutput);
final RpcResult<AddMetersBatchOutput> composite = compositeFunction.apply(input);
}
@Test
- public void testCreateComposingFunction_failure_success() throws Exception {
- final Function<Pair<RpcResult<AddMetersBatchOutput>, RpcResult<Void>>, RpcResult<AddMetersBatchOutput>>
- compositeFunction = MeterUtil.createComposingFunction();
+ public void testCreateComposingFunction_failure_success() {
+ final Function<Pair<RpcResult<AddMetersBatchOutput>, RpcResult<SendBarrierOutput>>,
+ RpcResult<AddMetersBatchOutput>> compositeFunction = MeterUtil.createComposingFunction();
final RpcResult<AddMetersBatchOutput> addGroupBatchOutput = createAddMetersBatchFailureOutcome();
- final RpcResult<Void> barrierOutput = RpcResultBuilder.<Void>success().build();
- final Pair<RpcResult<AddMetersBatchOutput>, RpcResult<Void>> input =
+ final RpcResult<SendBarrierOutput> barrierOutput = RpcResultBuilder.<SendBarrierOutput>success().build();
+ final Pair<RpcResult<AddMetersBatchOutput>, RpcResult<SendBarrierOutput>> input =
Pair.of(addGroupBatchOutput, barrierOutput);
final RpcResult<AddMetersBatchOutput> composite = compositeFunction.apply(input);
}
@Test
- public void testCreateComposingFunction_success_failure() throws Exception {
- final Function<Pair<RpcResult<AddMetersBatchOutput>, RpcResult<Void>>, RpcResult<AddMetersBatchOutput>>
- compositeFunction = MeterUtil.createComposingFunction();
+ public void testCreateComposingFunction_success_failure() {
+ final Function<Pair<RpcResult<AddMetersBatchOutput>, RpcResult<SendBarrierOutput>>,
+ RpcResult<AddMetersBatchOutput>> compositeFunction = MeterUtil.createComposingFunction();
final RpcResult<AddMetersBatchOutput> addGroupBatchOutput = createAddMetersBatchSuccessOutput();
- final RpcResult<Void> barrierOutput = createBarrierFailureOutcome();
- final Pair<RpcResult<AddMetersBatchOutput>, RpcResult<Void>> input =
+ final RpcResult<SendBarrierOutput> barrierOutput = createBarrierFailureOutcome();
+ final Pair<RpcResult<AddMetersBatchOutput>, RpcResult<SendBarrierOutput>> input =
Pair.of(addGroupBatchOutput, barrierOutput);
final RpcResult<AddMetersBatchOutput> composite = compositeFunction.apply(input);
}
@Test
- public void testCreateComposingFunction_failure_failure() throws Exception {
- final Function<Pair<RpcResult<AddMetersBatchOutput>, RpcResult<Void>>, RpcResult<AddMetersBatchOutput>>
- compositeFunction = MeterUtil.createComposingFunction();
+ public void testCreateComposingFunction_failure_failure() {
+ final Function<Pair<RpcResult<AddMetersBatchOutput>, RpcResult<SendBarrierOutput>>,
+ RpcResult<AddMetersBatchOutput>> compositeFunction = MeterUtil.createComposingFunction();
final RpcResult<AddMetersBatchOutput> addGroupBatchOutput = createAddMetersBatchFailureOutcome();
- final RpcResult<Void> barrierOutput = createBarrierFailureOutcome();
- final Pair<RpcResult<AddMetersBatchOutput>, RpcResult<Void>> input =
+ final RpcResult<SendBarrierOutput> barrierOutput = createBarrierFailureOutcome();
+ final Pair<RpcResult<AddMetersBatchOutput>, RpcResult<SendBarrierOutput>> input =
Pair.of(addGroupBatchOutput, barrierOutput);
final RpcResult<AddMetersBatchOutput> composite = compositeFunction.apply(input);
Assert.assertEquals(1, composite.getResult().getBatchFailedMetersOutput().size());
}
- private RpcResult<Void> createBarrierFailureOutcome() {
- return RpcResultBuilder.<Void>failed()
+ private RpcResult<SendBarrierOutput> createBarrierFailureOutcome() {
+ return RpcResultBuilder.<SendBarrierOutput>failed()
.withError(RpcError.ErrorType.APPLICATION, "ut-barrier-error")
.build();
}
private RpcResult<AddMetersBatchOutput> createAddMetersBatchSuccessOutput() {
return RpcResultBuilder
.success(new AddMetersBatchOutputBuilder()
- .setBatchFailedMetersOutput(Collections.<BatchFailedMetersOutput>emptyList())
+ .setBatchFailedMetersOutput(Collections.emptyList())
.build())
.build();
}
.withRpcErrors(batchOutcomeWithError.getErrors())
.build();
}
-}
\ No newline at end of file
+}