Search in sources :

Example 1 with PartitionStatus

use of io.camunda.zeebe.test.util.actuator.PartitionsActuatorClient.PartitionStatus in project zeebe by camunda.

the class ContainerStateAssert method hasNoSnapshotAvailable.

@SuppressWarnings("ConstantConditions")
public ContainerStateAssert hasNoSnapshotAvailable(final int partitionId) {
    final Either<Throwable, Map<String, PartitionStatus>> response = actual.getPartitionsActuatorClient().queryPartitions();
    if (response.isLeft()) {
        failWithMessage("expected partitions query to be successful, but was %s", response.getLeft());
    }
    final Map<String, PartitionStatus> partitions = response.get();
    final PartitionStatus partitionStatus = partitions.get(String.valueOf(partitionId));
    if (partitionStatus == null) {
        failWithMessage("expected partitions query to return info about partition %d, but got %s", partitionId, partitions.keySet());
    }
    // disable the warning
    if (partitionStatus.snapshotId != null && !partitionStatus.snapshotId.isBlank()) {
        failWithMessage("expected to have no snapshot, but got %s", partitionStatus.snapshotId);
    }
    return myself;
}
Also used : PartitionStatus(io.camunda.zeebe.test.util.actuator.PartitionsActuatorClient.PartitionStatus) Map(java.util.Map)

Example 2 with PartitionStatus

use of io.camunda.zeebe.test.util.actuator.PartitionsActuatorClient.PartitionStatus in project zeebe by zeebe-io.

the class ContainerStateAssert method hasNoSnapshotAvailable.

@SuppressWarnings("ConstantConditions")
public ContainerStateAssert hasNoSnapshotAvailable(final int partitionId) {
    final Either<Throwable, Map<String, PartitionStatus>> response = actual.getPartitionsActuatorClient().queryPartitions();
    if (response.isLeft()) {
        failWithMessage("expected partitions query to be successful, but was %s", response.getLeft());
    }
    final Map<String, PartitionStatus> partitions = response.get();
    final PartitionStatus partitionStatus = partitions.get(String.valueOf(partitionId));
    if (partitionStatus == null) {
        failWithMessage("expected partitions query to return info about partition %d, but got %s", partitionId, partitions.keySet());
    }
    // disable the warning
    if (partitionStatus.snapshotId != null && !partitionStatus.snapshotId.isBlank()) {
        failWithMessage("expected to have no snapshot, but got %s", partitionStatus.snapshotId);
    }
    return myself;
}
Also used : PartitionStatus(io.camunda.zeebe.test.util.actuator.PartitionsActuatorClient.PartitionStatus) Map(java.util.Map)

Example 3 with PartitionStatus

use of io.camunda.zeebe.test.util.actuator.PartitionsActuatorClient.PartitionStatus in project zeebe by zeebe-io.

the class ContainerStateAssert method hasSnapshotAvailable.

@SuppressWarnings("ConstantConditions")
public ContainerStateAssert hasSnapshotAvailable(final int partitionId) {
    final Either<Throwable, Map<String, PartitionStatus>> response = actual.getPartitionsActuatorClient().queryPartitions();
    if (response.isLeft()) {
        failWithMessage("expected partitions query to be successful, but was %s", response.getLeft());
    }
    final Map<String, PartitionStatus> partitions = response.get();
    final PartitionStatus partitionStatus = partitions.get(String.valueOf(partitionId));
    if (partitionStatus == null) {
        failWithMessage("expected partitions query to return info about partition %d, but got %s", partitionId, partitions.keySet());
    }
    // disable the warning
    if (partitionStatus.snapshotId == null || partitionStatus.snapshotId.isBlank()) {
        failWithMessage("expected to have a snapshot, but got nothing");
    }
    return myself;
}
Also used : PartitionStatus(io.camunda.zeebe.test.util.actuator.PartitionsActuatorClient.PartitionStatus) Map(java.util.Map)

Example 4 with PartitionStatus

use of io.camunda.zeebe.test.util.actuator.PartitionsActuatorClient.PartitionStatus in project zeebe by camunda-cloud.

the class ContainerStateAssert method hasSnapshotAvailable.

@SuppressWarnings("ConstantConditions")
public ContainerStateAssert hasSnapshotAvailable(final int partitionId) {
    final Either<Throwable, Map<String, PartitionStatus>> response = actual.getPartitionsActuatorClient().queryPartitions();
    if (response.isLeft()) {
        failWithMessage("expected partitions query to be successful, but was %s", response.getLeft());
    }
    final Map<String, PartitionStatus> partitions = response.get();
    final PartitionStatus partitionStatus = partitions.get(String.valueOf(partitionId));
    if (partitionStatus == null) {
        failWithMessage("expected partitions query to return info about partition %d, but got %s", partitionId, partitions.keySet());
    }
    // disable the warning
    if (partitionStatus.snapshotId == null || partitionStatus.snapshotId.isBlank()) {
        failWithMessage("expected to have a snapshot, but got nothing");
    }
    return myself;
}
Also used : PartitionStatus(io.camunda.zeebe.test.util.actuator.PartitionsActuatorClient.PartitionStatus) Map(java.util.Map)

Example 5 with PartitionStatus

use of io.camunda.zeebe.test.util.actuator.PartitionsActuatorClient.PartitionStatus in project zeebe by camunda-cloud.

the class ContainerStateAssert method hasNoSnapshotAvailable.

@SuppressWarnings("ConstantConditions")
public ContainerStateAssert hasNoSnapshotAvailable(final int partitionId) {
    final Either<Throwable, Map<String, PartitionStatus>> response = actual.getPartitionsActuatorClient().queryPartitions();
    if (response.isLeft()) {
        failWithMessage("expected partitions query to be successful, but was %s", response.getLeft());
    }
    final Map<String, PartitionStatus> partitions = response.get();
    final PartitionStatus partitionStatus = partitions.get(String.valueOf(partitionId));
    if (partitionStatus == null) {
        failWithMessage("expected partitions query to return info about partition %d, but got %s", partitionId, partitions.keySet());
    }
    // disable the warning
    if (partitionStatus.snapshotId != null && !partitionStatus.snapshotId.isBlank()) {
        failWithMessage("expected to have no snapshot, but got %s", partitionStatus.snapshotId);
    }
    return myself;
}
Also used : PartitionStatus(io.camunda.zeebe.test.util.actuator.PartitionsActuatorClient.PartitionStatus) Map(java.util.Map)

Aggregations

PartitionStatus (io.camunda.zeebe.test.util.actuator.PartitionsActuatorClient.PartitionStatus)6 Map (java.util.Map)6