refactor: hide telemetry field api by default
This commit is contained in:
@@ -43,7 +43,8 @@ is explicitly deployed.
|
|||||||
- Redis is not the long-term historical store.
|
- Redis is not the long-term historical store.
|
||||||
- `event-file-store` Parquet/DuckDB is not the default history store.
|
- `event-file-store` Parquet/DuckDB is not the default history store.
|
||||||
- `telemetry_fields` parsing is not handled by this project when a separate
|
- `telemetry_fields` parsing is not handled by this project when a separate
|
||||||
field parsing service owns that job.
|
field parsing service owns that job; the `telemetry_fields` query API is
|
||||||
|
also disabled by default unless `TDENGINE_TELEMETRY_FIELDS_ENABLED=true`.
|
||||||
|
|
||||||
## Runtime Responsibilities
|
## Runtime Responsibilities
|
||||||
|
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ class VehicleHistoryAppCompositionTest {
|
|||||||
assertThat(context).hasSingleBean(Gb32960DecodedFrameService.class);
|
assertThat(context).hasSingleBean(Gb32960DecodedFrameService.class);
|
||||||
assertThat(context).hasSingleBean(LocationHistoryController.class);
|
assertThat(context).hasSingleBean(LocationHistoryController.class);
|
||||||
assertThat(context).hasSingleBean(RawFrameHistoryController.class);
|
assertThat(context).hasSingleBean(RawFrameHistoryController.class);
|
||||||
assertThat(context).hasSingleBean(TelemetryFieldHistoryController.class);
|
assertThat(context).doesNotHaveBean(TelemetryFieldHistoryController.class);
|
||||||
assertThat(context).doesNotHaveBean(Gb32960FrameController.class);
|
assertThat(context).doesNotHaveBean(Gb32960FrameController.class);
|
||||||
assertThat(context).doesNotHaveBean(Jt808LocationHistoryController.class);
|
assertThat(context).doesNotHaveBean(Jt808LocationHistoryController.class);
|
||||||
assertThat(context).doesNotHaveBean(Gb32960NettyServer.class);
|
assertThat(context).doesNotHaveBean(Gb32960NettyServer.class);
|
||||||
|
|||||||
@@ -154,6 +154,7 @@ public class EventHistoryAutoConfiguration {
|
|||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
@ConditionalOnBean(TdengineHistoryReader.class)
|
@ConditionalOnBean(TdengineHistoryReader.class)
|
||||||
|
@ConditionalOnProperty(prefix = "lingniu.ingest.tdengine-history", name = "telemetry-fields-enabled", havingValue = "true")
|
||||||
@ConditionalOnMissingBean
|
@ConditionalOnMissingBean
|
||||||
public TelemetryFieldHistoryController telemetryFieldHistoryController(TdengineHistoryReader reader) {
|
public TelemetryFieldHistoryController telemetryFieldHistoryController(TdengineHistoryReader reader) {
|
||||||
return new TelemetryFieldHistoryController(reader);
|
return new TelemetryFieldHistoryController(reader);
|
||||||
|
|||||||
@@ -120,14 +120,14 @@ class EventHistoryAutoConfigurationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void createsGenericLocationAndTelemetryControllersWhenTdengineReaderExists() {
|
void createsGenericLocationAndRawControllersWithoutTelemetryFieldsByDefault() {
|
||||||
contextRunner
|
contextRunner
|
||||||
.withPropertyValues("lingniu.ingest.event-history.enabled=true")
|
.withPropertyValues("lingniu.ingest.event-history.enabled=true")
|
||||||
.withBean(TdengineHistoryReader.class, () -> mock(TdengineHistoryReader.class))
|
.withBean(TdengineHistoryReader.class, () -> mock(TdengineHistoryReader.class))
|
||||||
.run(context -> {
|
.run(context -> {
|
||||||
assertThat(context).hasSingleBean(LocationHistoryController.class);
|
assertThat(context).hasSingleBean(LocationHistoryController.class);
|
||||||
assertThat(context).hasSingleBean(RawFrameHistoryController.class);
|
assertThat(context).hasSingleBean(RawFrameHistoryController.class);
|
||||||
assertThat(context).hasSingleBean(TelemetryFieldHistoryController.class);
|
assertThat(context).doesNotHaveBean(TelemetryFieldHistoryController.class);
|
||||||
assertThat(context).doesNotHaveBean(Jt808LocationHistoryController.class);
|
assertThat(context).doesNotHaveBean(Jt808LocationHistoryController.class);
|
||||||
assertThat(context).doesNotHaveBean(Jt808RawFrameHistoryController.class);
|
assertThat(context).doesNotHaveBean(Jt808RawFrameHistoryController.class);
|
||||||
});
|
});
|
||||||
@@ -152,9 +152,11 @@ class EventHistoryAutoConfigurationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void createsTelemetryFieldHistoryControllerWhenTdengineReaderExists() {
|
void createsTelemetryFieldHistoryControllerWhenTelemetryFieldsAreEnabled() {
|
||||||
contextRunner
|
contextRunner
|
||||||
.withPropertyValues("lingniu.ingest.event-history.enabled=true")
|
.withPropertyValues(
|
||||||
|
"lingniu.ingest.event-history.enabled=true",
|
||||||
|
"lingniu.ingest.tdengine-history.telemetry-fields-enabled=true")
|
||||||
.withBean(TdengineHistoryReader.class, () -> mock(TdengineHistoryReader.class))
|
.withBean(TdengineHistoryReader.class, () -> mock(TdengineHistoryReader.class))
|
||||||
.run(context -> assertThat(context).hasSingleBean(TelemetryFieldHistoryController.class));
|
.run(context -> assertThat(context).hasSingleBean(TelemetryFieldHistoryController.class));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user