refactor: reject legacy jt808 mileage state store
This commit is contained in:
@@ -28,6 +28,13 @@ import java.time.ZoneId;
|
||||
@ConditionalOnProperty(prefix = "lingniu.ingest.vehicle-stat", name = "enabled", havingValue = "true")
|
||||
public class VehicleStatAutoConfiguration {
|
||||
|
||||
@Bean
|
||||
@ConditionalOnProperty(prefix = "lingniu.ingest.vehicle-stat.jt808", name = "state-store")
|
||||
public Object rejectedLegacyJt808MileageStateStore() {
|
||||
throw new IllegalStateException(
|
||||
"vehicle-stat.jt808.state-store has been removed; JT808 daily mileage uses vehicle_stat_metric only");
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnBean(JdbcTemplate.class)
|
||||
@ConditionalOnMissingBean
|
||||
|
||||
@@ -74,17 +74,17 @@ class VehicleStatAutoConfigurationTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void ignoresLegacyStateStorePropertyAndUsesMetricRepositoryOnly() {
|
||||
void rejectsLegacyStateStorePropertyInsteadOfCreatingHiddenRuntimeMode() {
|
||||
contextRunner
|
||||
.withBean(JdbcTemplate.class, () -> mock(JdbcTemplate.class))
|
||||
.withPropertyValues(
|
||||
"lingniu.ingest.vehicle-stat.enabled=true",
|
||||
"lingniu.ingest.vehicle-stat.jt808.enabled=true",
|
||||
"lingniu.ingest.vehicle-stat.jt808.state-store=memory")
|
||||
.run(context -> {
|
||||
assertThat(context).hasSingleBean(Jt808MileageStreamProcessor.class);
|
||||
assertThat(context).hasSingleBean(VehicleStatEnvelopeIngestor.class);
|
||||
});
|
||||
.run(context -> assertThat(context.getStartupFailure())
|
||||
.hasRootCauseInstanceOf(IllegalStateException.class)
|
||||
.hasMessageContaining("vehicle-stat.jt808.state-store has been removed")
|
||||
.hasMessageContaining("vehicle_stat_metric"));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user