Search in sources :

Example 1 with DataStreamInfo

use of org.opensearch.action.admin.indices.datastream.GetDataStreamAction.Response.DataStreamInfo in project OpenSearch by opensearch-project.

the class GetDataStreamResponseTests method randomInstance.

private static DataStreamInfo randomInstance() {
    List<Index> indices = randomIndexInstances();
    long generation = indices.size() + randomLongBetween(1, 128);
    String dataStreamName = randomAlphaOfLength(10).toLowerCase(Locale.ROOT);
    indices.add(new Index(getDefaultBackingIndexName(dataStreamName, generation), UUIDs.randomBase64UUID(random())));
    DataStream dataStream = new DataStream(dataStreamName, createTimestampField("@timestamp"), indices, generation);
    return new DataStreamInfo(dataStream, ClusterHealthStatus.YELLOW, randomAlphaOfLengthBetween(2, 10));
}
Also used : DataStreamInfo(org.opensearch.action.admin.indices.datastream.GetDataStreamAction.Response.DataStreamInfo) DataStream(org.opensearch.cluster.metadata.DataStream) Index(org.opensearch.index.Index)

Example 2 with DataStreamInfo

use of org.opensearch.action.admin.indices.datastream.GetDataStreamAction.Response.DataStreamInfo in project OpenSearch by opensearch-project.

the class GetDataStreamResponseTests method assertInstances.

@Override
protected void assertInstances(GetDataStreamAction.Response serverTestInstance, GetDataStreamResponse clientInstance) {
    assertEquals(serverTestInstance.getDataStreams().size(), clientInstance.getDataStreams().size());
    Iterator<DataStreamInfo> serverIt = serverTestInstance.getDataStreams().iterator();
    Iterator<org.opensearch.client.indices.DataStream> clientIt = clientInstance.getDataStreams().iterator();
    while (serverIt.hasNext()) {
        org.opensearch.client.indices.DataStream client = clientIt.next();
        DataStream server = serverIt.next().getDataStream();
        assertEquals(server.getName(), client.getName());
        assertEquals(server.getIndices().stream().map(Index::getName).collect(Collectors.toList()), client.getIndices());
        assertEquals(server.getTimeStampField().getName(), client.getTimeStampField());
        assertEquals(server.getGeneration(), client.getGeneration());
    }
}
Also used : DataStreamInfo(org.opensearch.action.admin.indices.datastream.GetDataStreamAction.Response.DataStreamInfo) DataStream(org.opensearch.cluster.metadata.DataStream) Index(org.opensearch.index.Index)

Aggregations

DataStreamInfo (org.opensearch.action.admin.indices.datastream.GetDataStreamAction.Response.DataStreamInfo)2 DataStream (org.opensearch.cluster.metadata.DataStream)2 Index (org.opensearch.index.Index)2