@Test void computeSchemaStateShouldReturnTooOldWhenVersionIsMoreThanMaxVersion() { SchemaVersion currentVersion = maxVersion.next(); when(schemaVersionDAO.getCurrentSchemaVersion()) .thenReturn(Mono.just(Optional.of(currentVersion))); CassandraSchemaVersionManager testee = new CassandraSchemaVersionManager( schemaVersionDAO, minVersion, maxVersion); assertThat(testee.computeSchemaState()).isEqualTo(TOO_RECENT); }
public SchemaState computeSchemaState() { SchemaVersion version = computeVersion().block(); if (version.isBefore(minVersion)) { return TOO_OLD; } else if (version.isBefore(maxVersion)) { return UPGRADABLE; } else if (version.equals(maxVersion)) { return UP_TO_DATE; } else { return TOO_RECENT; } }
CassandraSchemaVersionManager { public SchemaState computeSchemaState() { SchemaVersion version = computeVersion().block(); if (version.isBefore(minVersion)) { return TOO_OLD; } else if (version.isBefore(maxVersion)) { return UPGRADABLE; } else if (version.equals(maxVersion)) { return UP_TO_DATE; } else { return TOO_RECENT; } } }
CassandraSchemaVersionManager { public SchemaState computeSchemaState() { SchemaVersion version = computeVersion().block(); if (version.isBefore(minVersion)) { return TOO_OLD; } else if (version.isBefore(maxVersion)) { return UPGRADABLE; } else if (version.equals(maxVersion)) { return UP_TO_DATE; } else { return TOO_RECENT; } } @Inject  CassandraSchemaVersionManager(CassandraSchemaVersionDAO schemaVersionDAO); @VisibleForTesting  CassandraSchemaVersionManager(CassandraSchemaVersionDAO schemaVersionDAO, SchemaVersion minVersion, SchemaVersion maxVersion); }
CassandraSchemaVersionManager { public SchemaState computeSchemaState() { SchemaVersion version = computeVersion().block(); if (version.isBefore(minVersion)) { return TOO_OLD; } else if (version.isBefore(maxVersion)) { return UPGRADABLE; } else if (version.equals(maxVersion)) { return UP_TO_DATE; } else { return TOO_RECENT; } } @Inject  CassandraSchemaVersionManager(CassandraSchemaVersionDAO schemaVersionDAO); @VisibleForTesting  CassandraSchemaVersionManager(CassandraSchemaVersionDAO schemaVersionDAO, SchemaVersion minVersion, SchemaVersion maxVersion); Mono<Boolean> isBefore(SchemaVersion minimum); Mono<SchemaVersion> computeVersion(); SchemaVersion getMinimumSupportedVersion(); SchemaVersion getMaximumSupportedVersion(); SchemaState computeSchemaState(); }
CassandraSchemaVersionManager { public SchemaState computeSchemaState() { SchemaVersion version = computeVersion().block(); if (version.isBefore(minVersion)) { return TOO_OLD; } else if (version.isBefore(maxVersion)) { return UPGRADABLE; } else if (version.equals(maxVersion)) { return UP_TO_DATE; } else { return TOO_RECENT; } } @Inject  CassandraSchemaVersionManager(CassandraSchemaVersionDAO schemaVersionDAO); @VisibleForTesting  CassandraSchemaVersionManager(CassandraSchemaVersionDAO schemaVersionDAO, SchemaVersion minVersion, SchemaVersion maxVersion); Mono<Boolean> isBefore(SchemaVersion minimum); Mono<SchemaVersion> computeVersion(); SchemaVersion getMinimumSupportedVersion(); SchemaVersion getMaximumSupportedVersion(); SchemaState computeSchemaState(); static final SchemaVersion MIN_VERSION; static final SchemaVersion MAX_VERSION; static final SchemaVersion DEFAULT_VERSION; }