|
|
@@ -152,6 +152,28 @@ class CockpitDeviceBoundaryControllerTest {
|
|
|
.andExpect(jsonPath("$.data.statistics.typeKindMismatchCount").value(1));
|
|
|
}
|
|
|
|
|
|
+ @Test
|
|
|
+ void mismatchedDeviceTypeIsExcludedFromFormalIndustryStatistics() throws Exception {
|
|
|
+ when(adapter.load()).thenReturn(new CockpitDeviceBoundarySnapshot(
|
|
|
+ Arrays.asList(
|
|
|
+ new SourceType("WATER_SUPPLY_SENSOR", "供水压力计", "WATER_SUPPLY", null, "SMART_DEVICE"),
|
|
|
+ new SourceType("WATER_PLANT", "水厂", "WATER_SUPPLY", null, "FACILITY")),
|
|
|
+ Collections.emptyList(),
|
|
|
+ Arrays.asList(
|
|
|
+ new SourceDevice("EQ-WS-001", "供水压力计-001", "WATER_SUPPLY_SENSOR"),
|
|
|
+ new SourceDevice("EQ-MISMATCH-001", "误挂设施类型的设备-001", "WATER_PLANT"))));
|
|
|
+
|
|
|
+ mockMvc.perform(get("/api/cockpit/v1/device-boundary"))
|
|
|
+ .andExpect(status().isOk())
|
|
|
+ .andExpect(jsonPath("$.data.devices[0].formalScope").value(true))
|
|
|
+ .andExpect(jsonPath("$.data.devices[1].formalScope").value(false))
|
|
|
+ .andExpect(jsonPath("$.data.devices[1].typeResolution").value("TYPE_KIND_MISMATCH"))
|
|
|
+ .andExpect(jsonPath("$.data.statistics.smartDeviceCount").value(2))
|
|
|
+ .andExpect(jsonPath("$.data.statistics.formalSmartDeviceCount").value(1))
|
|
|
+ .andExpect(jsonPath("$.data.statistics.industries.waterSupply.smartDeviceCount").value(1))
|
|
|
+ .andExpect(jsonPath("$.data.statistics.typeKindMismatchCount").value(1));
|
|
|
+ }
|
|
|
+
|
|
|
@Test
|
|
|
void mutatingRequestIsRejectedBeforeReadAdapterIsCalled() throws Exception {
|
|
|
mockMvc.perform(post("/api/cockpit/v1/device-boundary"))
|