use of org.apache.flink.runtime.io.network.partition.DataSetMetaInfo in project flink by apache.
the class ClusterDataSetListResponseBodyTest method getTestResponseInstance.
@Override
protected ClusterDataSetListResponseBody getTestResponseInstance() throws Exception {
final Map<IntermediateDataSetID, DataSetMetaInfo> dataSets = new HashMap<>();
dataSets.put(new IntermediateDataSetID(), DataSetMetaInfo.withNumRegisteredPartitions(1, 2));
return ClusterDataSetListResponseBody.from(dataSets);
}
use of org.apache.flink.runtime.io.network.partition.DataSetMetaInfo in project flink by apache.
the class ClusterDataSetListResponseBodyTest method testFrom.
@Test
public void testFrom() {
final Map<IntermediateDataSetID, DataSetMetaInfo> originalDataSets = new HashMap<>();
originalDataSets.put(new IntermediateDataSetID(), DataSetMetaInfo.withNumRegisteredPartitions(1, 2));
originalDataSets.put(new IntermediateDataSetID(), DataSetMetaInfo.withNumRegisteredPartitions(2, 2));
List<ClusterDataSetEntry> convertedDataSets = ClusterDataSetListResponseBody.from(originalDataSets).getDataSets();
assertThat(convertedDataSets, hasSize(2));
for (ClusterDataSetEntry convertedDataSet : convertedDataSets) {
IntermediateDataSetID id = new IntermediateDataSetID(new AbstractID(StringUtils.hexStringToByte(convertedDataSet.getDataSetId())));
DataSetMetaInfo dataSetMetaInfo = originalDataSets.get(id);
assertThat(convertedDataSet.isComplete(), is(dataSetMetaInfo.getNumRegisteredPartitions().orElse(0) == dataSetMetaInfo.getNumTotalPartitions()));
}
}
Aggregations