import org.opendaylight.yang.gen.v1.urn.opendaylight.meters.service.rev160316.batch.meter.output.list.grouping.BatchFailedMetersOutputBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.meters.service.rev160316.batch.meter.output.list.grouping.BatchFailedMetersOutputKey;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.common.RpcError;
+import org.opendaylight.yangtools.yang.binding.util.BindingMap;
+import org.opendaylight.yangtools.yang.common.ErrorType;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
+import org.opendaylight.yangtools.yang.common.Uint16;
+import org.opendaylight.yangtools.yang.common.Uint32;
/**
* Test for {@link MeterUtil}.
public class MeterUtilTest {
public static final NodeId DUMMY_NODE_ID = new NodeId("dummyNodeId");
- private static final MeterId DUMMY_METER_ID = new MeterId(42L);
- private static final MeterId DUMMY_METER_ID_2 = new MeterId(43L);
+ private static final MeterId DUMMY_METER_ID = new MeterId(Uint32.valueOf(42));
+ private static final MeterId DUMMY_METER_ID_2 = new MeterId(Uint32.valueOf(43));
@Test
public void testBuildGroupPath() {
final RpcResult<List<BatchFailedMetersOutput>> output = function.apply(Lists.newArrayList(
RpcResultBuilder.success("a").build(),
RpcResultBuilder.<String>failed()
- .withError(RpcError.ErrorType.APPLICATION, "ut-meter-error")
+ .withError(ErrorType.APPLICATION, "ut-meter-error")
.build()));
Assert.assertFalse(output.isSuccessful());
private static RpcResult<List<BatchFailedMetersOutput>> createBatchOutcomeWithError() {
return RpcResultBuilder.<List<BatchFailedMetersOutput>>failed()
- .withError(RpcError.ErrorType.APPLICATION, "ut-flowAddFail")
- .withResult(Collections.singletonList(new BatchFailedMetersOutputBuilder()
+ .withError(ErrorType.APPLICATION, "ut-flowAddFail")
+ .withResult(List.of(new BatchFailedMetersOutputBuilder()
+ .setBatchOrder(Uint16.ZERO)
.setMeterId(DUMMY_METER_ID)
.build()))
.build();
private static RpcResult<SendBarrierOutput> createBarrierFailureOutcome() {
return RpcResultBuilder.<SendBarrierOutput>failed()
- .withError(RpcError.ErrorType.APPLICATION, "ut-barrier-error")
+ .withError(ErrorType.APPLICATION, "ut-barrier-error")
.build();
}
private static RpcResult<AddMetersBatchOutput> createAddMetersBatchSuccessOutput() {
return RpcResultBuilder
.success(new AddMetersBatchOutputBuilder()
- .setBatchFailedMetersOutput(Collections.emptyMap())
+ .setBatchFailedMetersOutput(Map.of())
.build())
.build();
}
final RpcResult<List<BatchFailedMetersOutput>> batchOutcomeWithError = createBatchOutcomeWithError();
return RpcResultBuilder.<AddMetersBatchOutput>failed()
.withResult(new AddMetersBatchOutputBuilder()
- .setBatchFailedMetersOutput(batchOutcomeWithError.getResult())
+ .setBatchFailedMetersOutput(BindingMap.ordered(batchOutcomeWithError.getResult()))
.build())
.withRpcErrors(batchOutcomeWithError.getErrors())
.build();