* [Data-Frame] Sort `GET` transforms and stats by ID * removing unused import
This commit is contained in:
parent
0f29b89655
commit
926291aac8
|
@ -28,8 +28,8 @@ import org.elasticsearch.xpack.dataframe.persistence.DataFrameTransformsConfigMa
|
|||
import org.elasticsearch.xpack.dataframe.transforms.DataFrameTransformConfig;
|
||||
import org.elasticsearch.xpack.dataframe.transforms.DataFrameTransformTask;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
@ -52,8 +52,10 @@ public class TransportGetDataFrameTransformsAction extends
|
|||
@Override
|
||||
protected Response newResponse(Request request, List<Response> tasks, List<TaskOperationFailure> taskOperationFailures,
|
||||
List<FailedNodeException> failedNodeExceptions) {
|
||||
List<DataFrameTransformConfig> configs = tasks.stream().map(GetDataFrameTransformsAction.Response::getTransformConfigurations)
|
||||
.flatMap(Collection::stream).collect(Collectors.toList());
|
||||
List<DataFrameTransformConfig> configs = tasks.stream()
|
||||
.flatMap(r -> r.getTransformConfigurations().stream())
|
||||
.sorted(Comparator.comparing(DataFrameTransformConfig::getId))
|
||||
.collect(Collectors.toList());
|
||||
return new Response(configs, taskOperationFailures, failedNodeExceptions);
|
||||
}
|
||||
|
||||
|
|
|
@ -26,8 +26,8 @@ import org.elasticsearch.xpack.dataframe.action.GetDataFrameTransformsStatsActio
|
|||
import org.elasticsearch.xpack.dataframe.persistence.DataFramePersistentTaskUtils;
|
||||
import org.elasticsearch.xpack.dataframe.transforms.DataFrameTransformTask;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
@ -48,8 +48,9 @@ public class TransportGetDataFrameTransformsStatsAction extends
|
|||
protected Response newResponse(Request request, List<Response> tasks, List<TaskOperationFailure> taskOperationFailures,
|
||||
List<FailedNodeException> failedNodeExceptions) {
|
||||
List<DataFrameTransformStateAndStats> responses = tasks.stream()
|
||||
.map(GetDataFrameTransformsStatsAction.Response::getTransformsStateAndStats).flatMap(Collection::stream)
|
||||
.collect(Collectors.toList());
|
||||
.flatMap(r -> r.getTransformsStateAndStats().stream())
|
||||
.sorted(Comparator.comparing(DataFrameTransformStateAndStats::getId))
|
||||
.collect(Collectors.toList());
|
||||
return new Response(responses, taskOperationFailures, failedNodeExceptions);
|
||||
}
|
||||
|
||||
|
@ -95,4 +96,4 @@ public class TransportGetDataFrameTransformsStatsAction extends
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -89,11 +89,15 @@ setup:
|
|||
data_frame.get_data_frame_transform:
|
||||
transform_id: "*"
|
||||
- match: { count: 2 }
|
||||
- match: { transforms.0.id: "airline-transform" }
|
||||
- match: { transforms.1.id: "airline-transform-dos" }
|
||||
|
||||
- do:
|
||||
data_frame.get_data_frame_transform:
|
||||
transform_id: "_all"
|
||||
- match: { count: 2 }
|
||||
- match: { transforms.0.id: "airline-transform" }
|
||||
- match: { transforms.1.id: "airline-transform-dos" }
|
||||
|
||||
- do:
|
||||
data_frame.delete_data_frame_transform:
|
||||
|
|
|
@ -78,11 +78,15 @@ teardown:
|
|||
data_frame.get_data_frame_transform_stats:
|
||||
transform_id: "*"
|
||||
- match: { count: 2 }
|
||||
- match: { transforms.0.id: "airline-transform-stats" }
|
||||
- match: { transforms.1.id: "airline-transform-stats-dos" }
|
||||
|
||||
- do:
|
||||
data_frame.get_data_frame_transform_stats:
|
||||
transform_id: "_all"
|
||||
- match: { count: 2 }
|
||||
- match: { transforms.0.id: "airline-transform-stats" }
|
||||
- match: { transforms.1.id: "airline-transform-stats-dos" }
|
||||
|
||||
- do:
|
||||
data_frame.delete_data_frame_transform:
|
||||
|
|
Loading…
Reference in New Issue