diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 4cb82baa..ae11ec1f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -28,10 +28,10 @@ jobs: - uses: actions/setup-java@v1 with: - java-version: 11 + java-version: 17 - name: Cache - uses: actions/cache@v2.0.0 + uses: actions/cache@v2 with: # Cache gradle directories path: | diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5c94209f..b20fff44 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -20,7 +20,7 @@ jobs: - uses: actions/checkout@v2 - uses: actions/setup-java@v1 with: - java-version: 11 + java-version: 17 - name: Gradle cache uses: actions/cache@v2 @@ -94,7 +94,7 @@ jobs: - name: Build docker uses: docker/build-push-action@v2 with: - # Allow running the image on the architectures supported by openjdk:11-jre-slim + # Allow running the image on X86 and ARM. platforms: linux/amd64,linux/arm64 push: true tags: ${{ steps.docker_meta.outputs.tags }} diff --git a/Dockerfile b/Dockerfile index 84b99597..ba988961 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM gradle:7.0-jdk11 as builder +FROM gradle:7.3-jdk17 as builder RUN mkdir -p /code/java-sdk WORKDIR /code/java-sdk @@ -27,7 +27,7 @@ RUN gradle distTar --no-watch-fs -Pprofile=docker \ && cd ../../../radar-catalog-server/build/distributions \ && tar xzf radar-catalog-server*.tar.gz -FROM openjdk:11-jre-slim +FROM azul/zulu-openjdk-alpine:17-jre-headless ENV KAFKA_SCHEMA_REGISTRY=http://schema-registry-1:8081 \ SCHEMA_REGISTRY_API_KEY="" \ @@ -39,10 +39,10 @@ ENV KAFKA_SCHEMA_REGISTRY=http://schema-registry-1:8081 \ KAFKA_CONFIG_PATH="" \ NO_VALIDATE="" -RUN apt-get update && apt-get install -y --no-install-recommends \ +RUN apk add --no-cache \ + bash \ curl \ - rsync \ - && rm -rf /var/lib/apt/lists/* + rsync WORKDIR /schema diff --git a/commons/passive/canedge/canedge_obd2.avsc b/commons/passive/canedge/canedge_obd2.avsc new file mode 100644 index 00000000..e2609773 --- /dev/null +++ b/commons/passive/canedge/canedge_obd2.avsc @@ -0,0 +1,1197 @@ +{ + "type":"record", + "namespace":"org.radarcns.passive.canedge", + "name":"CanEdgeObd2", + "doc":"AVRO Schema for CAN Edge OBD2 Service 01. These are OBD2 PIDs extracted from raw CANEdge MF4 file.", + "fields":[ + { + "name":"time", + "type":"double", + "doc":"This refers to the time of the dataset." + }, + { + "name":"timeReceived", + "type":"double", + "doc":"This is the processing time in UTC (s)." + }, + { + "name":"fuelSystemStatus", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Fuel system status. The OBD2 name is S1_PID_03_FuelSystemStatus. Min value is 0. Max value is 65535. The unit is Encoded." + }, + { + "name":"calcEngineLoad", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Calculated engine load. The OBD2 name is S1_PID_04_CalcEngineLoad. Min value is 0. Max value is 100. The unit is %." + }, + { + "name":"engineCoolantTemp", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Engine coolant temperature. The OBD2 name is S1_PID_05_EngineCoolantTemp. Min value is -40. Max value is 215. The unit is degC." + }, + { + "name":"shortFuelTrimBank1", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Short term fuel trim (bank 1). The OBD2 name is S1_PID_06_ShortFuelTrimBank1. Min value is -100. Max value is 99. The unit is %." + }, + { + "name":"longFuelTrimBank1", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Long term fuel trim (bank 1). The OBD2 name is S1_PID_07_LongFuelTrimBank1. Min value is -100. Max value is 99. The unit is %." + }, + { + "name":"shortFuelTrimBank2", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Short term fuel trim (bank 2). The OBD2 name is S1_PID_08_ShortFuelTrimBank2. Min value is -100. Max value is 99. The unit is %." + }, + { + "name":"longFuelTrimBank2", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Long term fuel trim (bank 2). The OBD2 name is S1_PID_09_LongFuelTrimBank2. Min value is -100. Max value is 99. The unit is %." + }, + { + "name":"fuelPressure", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Fuel pressure (gauge pressure). The OBD2 name is S1_PID_0A_FuelPressure. Min value is 0. Max value is 765. The unit is kPa." + }, + { + "name":"intakeManiAbsPress", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Intake manifold absolute pressure. The OBD2 name is S1_PID_0B_IntakeManiAbsPress. Min value is 0. Max value is 255. The unit is kPa." + }, + { + "name":"engineRpm", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Engine speed. The OBD2 name is S1_PID_0C_EngineRPM. Min value is 0. Max value is 16384. The unit is rpm." + }, + { + "name":"vehicleSpeed", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Vehicle Speed. The OBD2 name is S1_PID_0D_VehicleSpeed. Min value is 0. Max value is 255. The unit is km/h." + }, + { + "name":"timingAdvance", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Timing Advance. The OBD2 name is S1_PID_0E_TimingAdvance. Min value is -64. Max value is 64. The unit is deg." + }, + { + "name":"intakeAirTemperature", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Intake air temperature. The OBD2 name is S1_PID_0F_IntakeAirTemperature. Min value is -40. Max value is 215. The unit is degC." + }, + { + "name":"mafAirFlowRate", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Mass air flow sensor air flow rate. The OBD2 name is S1_PID_10_MAFAirFlowRate. Min value is 0. Max value is 655. The unit is grams/sec." + }, + { + "name":"throttlePosition", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Throttle position. The OBD2 name is S1_PID_11_ThrottlePosition. Min value is 0. Max value is 100. The unit is %." + }, + { + "name":"cmdSecAirStatus", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Commanded secondary air status. The OBD2 name is S1_PID_12_CmdSecAirStatus. Min value is 0. Max value is 255. The unit is Encoded." + }, + { + "name":"oxySensor1Volt14", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Oxygen sensor 1 (voltage). The OBD2 name is S1_PID_14_OxySensor1_Volt. Min value is 0. Max value is 1. The unit is volts." + }, + { + "name":"oxySensor1Stft", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Oxygen sensor 1 (short term fuel trim). The OBD2 name is S1_PID_14_OxySensor1_STFT. Min value is -100. Max value is 99. The unit is %." + }, + { + "name":"oxySensor2Volt14", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Oxygen sensor 2 (voltage). The OBD2 name is S1_PID_14_OxySensor2_Volt. Min value is 0. Max value is 1. The unit is volts." + }, + { + "name":"oxySensor2Stft", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Oxygen sensor 2 (short term fuel trim). The OBD2 name is S1_PID_14_OxySensor2_STFT. Min value is -100. Max value is 99. The unit is %." + }, + { + "name":"oxySensor3Volt14", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Oxygen sensor 3 (voltage). The OBD2 name is S1_PID_14_OxySensor3_Volt. Min value is 0. Max value is 1. The unit is volts." + }, + { + "name":"oxySensor3Stft", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Oxygen sensor 3 (short term fuel trim). The OBD2 name is S1_PID_14_OxySensor3_STFT. Min value is -100. Max value is 99. The unit is %." + }, + { + "name":"oxySensor4Volt14", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Oxygen sensor 4 (voltage). The OBD2 name is S1_PID_14_OxySensor4_Volt. Min value is 0. Max value is 1. The unit is volts." + }, + { + "name":"oxySensor4Stft", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Oxygen sensor 4 (short term fuel trim). The OBD2 name is S1_PID_14_OxySensor4_STFT. Min value is -100. Max value is 99. The unit is %." + }, + { + "name":"oxySensor5Volt14", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Oxygen sensor 5 (voltage). The OBD2 name is S1_PID_14_OxySensor5_Volt. Min value is 0. Max value is 1. The unit is volts." + }, + { + "name":"oxySensor5Stft", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Oxygen sensor 5 (short term fuel trim). The OBD2 name is S1_PID_14_OxySensor5_STFT. Min value is -100. Max value is 99. The unit is %." + }, + { + "name":"oxySensor6Volt14", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Oxygen sensor 6 (voltage). The OBD2 name is S1_PID_14_OxySensor6_Volt. Min value is 0. Max value is 1. The unit is volts." + }, + { + "name":"oxySensor6Stft", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Oxygen sensor 6 (short term fuel trim). The OBD2 name is S1_PID_14_OxySensor6_STFT. Min value is -100. Max value is 99. The unit is %." + }, + { + "name":"oxySensor7Volt14", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Oxygen sensor 7 (voltage). The OBD2 name is S1_PID_14_OxySensor7_Volt. Min value is 0. Max value is 1. The unit is volts." + }, + { + "name":"oxySensor7Stft", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Oxygen sensor 7 (short term fuel trim). The OBD2 name is S1_PID_14_OxySensor7_STFT. Min value is -100. Max value is 99. The unit is %." + }, + { + "name":"oxySensor8Volt14", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Oxygen sensor 8 (voltage). The OBD2 name is S1_PID_14_OxySensor8_Volt. Min value is 0. Max value is 1. The unit is volts." + }, + { + "name":"oxySensor8Stft", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Oxygen sensor 8 (short term fuel trim). The OBD2 name is S1_PID_14_OxySensor8_STFT. Min value is -100. Max value is 99. The unit is %." + }, + { + "name":"timeSinceEngStart", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Run time since engine start. The OBD2 name is S1_PID_1F_TimeSinceEngStart. Min value is 0. Max value is 65535. The unit is seconds." + }, + { + "name":"distanceMilOn", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Distance traveled with MIL on. The OBD2 name is S1_PID_21_DistanceMILOn. Min value is 0. Max value is 65535. The unit is km." + }, + { + "name":"fuelRailPres", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Fuel rail pres. (rel. to manifold vacuum). The OBD2 name is S1_PID_22_FuelRailPres. Min value is 0. Max value is 5177. The unit is kPa." + }, + { + "name":"fuelRailGaug", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Fuel rail gauge pres. (diesel, gas inject). The OBD2 name is S1_PID_23_FuelRailGaug. Min value is 0. Max value is 655350. The unit is kPa." + }, + { + "name":"oxySensor1Faer24", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Oxygen sensor 1 (air-fuel equiv. ratio). The OBD2 name is S1_PID_24_OxySensor1_FAER. Min value is 0. Max value is 2. The unit is ratio." + }, + { + "name":"oxySensor1Volt24", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Oxygen sensor 1 (voltage). The OBD2 name is S1_PID_24_OxySensor1_Volt. Min value is 0. Max value is 2. The unit is volts." + }, + { + "name":"oxySensor2Faer25", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Oxygen sensor 2 (air-fuel equiv. ratio). The OBD2 name is S1_PID_25_OxySensor2_FAER. Min value is 0. Max value is 2. The unit is ratio." + }, + { + "name":"oxySensor2Volt25", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Oxygen sensor 2 (voltage). The OBD2 name is S1_PID_25_OxySensor2_Volt. Min value is 0. Max value is 8. The unit is volts." + }, + { + "name":"oxySensor3Faer26", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Oxygen sensor 3 (air-fuel equiv. ratio). The OBD2 name is S1_PID_26_OxySensor3_FAER. Min value is 0. Max value is 2. The unit is ratio." + }, + { + "name":"oxySensor3Volt26", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Oxygen sensor 3 (voltage). The OBD2 name is S1_PID_26_OxySensor3_Volt. Min value is 0. Max value is 8. The unit is volts." + }, + { + "name":"oxySensor4Faer27", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Oxygen sensor 4 (air-fuel equiv. ratio). The OBD2 name is S1_PID_27_OxySensor4_FAER. Min value is 0. Max value is 2. The unit is ratio." + }, + { + "name":"oxySensor4Volt27", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Oxygen sensor 4 (voltage). The OBD2 name is S1_PID_27_OxySensor4_Volt. Min value is 0. Max value is 8. The unit is volts." + }, + { + "name":"oxySensor5Faer28", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Oxygen sensor 5 (air-fuel equiv. ratio). The OBD2 name is S1_PID_28_OxySensor5_FAER. Min value is 0. Max value is 2. The unit is ratio." + }, + { + "name":"oxySensor5Volt28", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Oxygen sensor 5 (voltage). The OBD2 name is S1_PID_28_OxySensor5_Volt. Min value is 0. Max value is 8. The unit is volts." + }, + { + "name":"oxySensor6Faer29", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Oxygen sensor 6 (air-fuel equiv. ratio). The OBD2 name is S1_PID_29_OxySensor6_FAER. Min value is 0. Max value is 2. The unit is ratio." + }, + { + "name":"oxySensor6Volt29", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Oxygen sensor 6 (voltage). The OBD2 name is S1_PID_29_OxySensor6_Volt. Min value is 0. Max value is 8. The unit is volts." + }, + { + "name":"oxySensor7Faer2A", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Oxygen sensor 7 (air-fuel equiv. ratio). The OBD2 name is S1_PID_2A_OxySensor7_FAER. Min value is 0. Max value is 2. The unit is ratio." + }, + { + "name":"oxySensor7Volt2A", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Oxygen sensor 7 (voltage). The OBD2 name is S1_PID_2A_OxySensor7_Volt. Min value is 0. Max value is 8. The unit is volts." + }, + { + "name":"oxySensor8Faer2B", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Oxygen sensor 8 (air-fuel equiv. ratio). The OBD2 name is S1_PID_2B_OxySensor8_FAER. Min value is 0. Max value is 2. The unit is ratio." + }, + { + "name":"oxySensor8Volt2B", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Oxygen sensor 8 (voltage). The OBD2 name is S1_PID_2B_OxySensor8_Volt. Min value is 0. Max value is 8. The unit is volts." + }, + { + "name":"cmdEgr", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Commanded EGR. The OBD2 name is S1_PID_2C_CmdEGR. Min value is 0. Max value is 100. The unit is %." + }, + { + "name":"egrError", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"EGR Error. The OBD2 name is S1_PID_2D_EGRError. Min value is -100. Max value is 99. The unit is %." + }, + { + "name":"cmdEvapPurge", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Commanded evaporative purge. The OBD2 name is S1_PID_2E_CmdEvapPurge. Min value is 0. Max value is 100. The unit is %." + }, + { + "name":"fuelTankLevel", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Fuel tank level input. The OBD2 name is S1_PID_2F_FuelTankLevel. Min value is 0. Max value is 100. The unit is %." + }, + { + "name":"warmUpsSinceCodeClear", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Warmups since DTCs cleared. The OBD2 name is S1_PID_30_WarmUpsSinceCodeClear. Min value is 0. Max value is 255. The unit is count." + }, + { + "name":"distanceSinceCodeClear", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Distance traveled since DTCs cleared. The OBD2 name is S1_PID_31_DistanceSinceCodeClear. Min value is 0. Max value is 65535. The unit is km." + }, + { + "name":"evapSysVaporPres", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Evap. system vapor pressure. The OBD2 name is S1_PID_32_EvapSysVaporPres. Min value is -8192. Max value is 8192. The unit is Pa." + }, + { + "name":"absBaroPres", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Absolute barometric pressure. The OBD2 name is S1_PID_33_AbsBaroPres. Min value is 0. Max value is 255. The unit is kPa." + }, + { + "name":"oxySensor1Faer34", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Oxygen sensor 1 (air-fuel equiv. ratio). The OBD2 name is S1_PID_34_OxySensor1_FAER. Min value is 0. Max value is 2. The unit is ratio." + }, + { + "name":"oxySensor1Crnt", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Oxygen sensor 1 (current). The OBD2 name is S1_PID_34_OxySensor1_Crnt. Min value is -128. Max value is 128. The unit is mA." + }, + { + "name":"oxySensor2Faer35", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Oxygen sensor 2 (air-fuel equiv. ratio). The OBD2 name is S1_PID_35_OxySensor2_FAER. Min value is 0. Max value is 2. The unit is ratio." + }, + { + "name":"oxySensor2Crnt", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Oxygen sensor 2 (current). The OBD2 name is S1_PID_35_OxySensor2_Crnt. Min value is -128. Max value is 128. The unit is mA." + }, + { + "name":"oxySensor3Faer36", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Oxygen sensor 3 (air-fuel equiv. ratio). The OBD2 name is S1_PID_36_OxySensor3_FAER. Min value is 0. Max value is 2. The unit is ratio." + }, + { + "name":"oxySensor3Crnt", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Oxygen sensor 3 (current). The OBD2 name is S1_PID_36_OxySensor3_Crnt. Min value is -128. Max value is 128. The unit is mA." + }, + { + "name":"oxySensor4Faer37", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Oxygen sensor 4 (air-fuel equiv. ratio). The OBD2 name is S1_PID_37_OxySensor4_FAER. Min value is 0. Max value is 2. The unit is ratio." + }, + { + "name":"oxySensor4Crnt", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Oxygen sensor 4 (current). The OBD2 name is S1_PID_37_OxySensor4_Crnt. Min value is -128. Max value is 128. The unit is mA." + }, + { + "name":"oxySensor5Faer38", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Oxygen sensor 5 (air-fuel equiv. ratio). The OBD2 name is S1_PID_38_OxySensor5_FAER. Min value is 0. Max value is 2. The unit is ratio." + }, + { + "name":"oxySensor5Crnt", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Oxygen sensor 5 (current). The OBD2 name is S1_PID_38_OxySensor5_Crnt. Min value is -128. Max value is 128. The unit is mA." + }, + { + "name":"oxySensor6Faer39", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Oxygen sensor 6 (air-fuel equiv. ratio). The OBD2 name is S1_PID_39_OxySensor6_FAER. Min value is 0. Max value is 2. The unit is ratio." + }, + { + "name":"oxySensor6Crnt", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Oxygen sensor 6 (current). The OBD2 name is S1_PID_39_OxySensor6_Crnt. Min value is -128. Max value is 128. The unit is mA." + }, + { + "name":"oxySensor7Faer3A", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Oxygen sensor 7 (air-fuel equiv. ratio). The OBD2 name is S1_PID_3A_OxySensor7_FAER. Min value is 0. Max value is 2. The unit is ratio." + }, + { + "name":"oxySensor7Crnt", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Oxygen sensor 7 (current). The OBD2 name is S1_PID_3A_OxySensor7_Crnt. Min value is -128. Max value is 128. The unit is mA." + }, + { + "name":"oxySensor8Faer3B", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Oxygen sensor 8 (air-fuel equiv. ratio). The OBD2 name is S1_PID_3B_OxySensor8_FAER. Min value is 0. Max value is 2. The unit is ratio." + }, + { + "name":"oxySensor8Crnt", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Oxygen sensor 8 (current). The OBD2 name is S1_PID_3B_OxySensor8_Crnt. Min value is -128. Max value is 128. The unit is mA." + }, + { + "name":"catTempBank1Sens1", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Catalyst temperature (bank 1, sensor 1). The OBD2 name is S1_PID_3C_CatTempBank1Sens1. Min value is -40. Max value is 6514. The unit is degC." + }, + { + "name":"catTempBank2Sens1", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Catalyst temperature (bank 2, sensor 1). The OBD2 name is S1_PID_3D_CatTempBank2Sens1. Min value is -40. Max value is 6514. The unit is degC." + }, + { + "name":"catTempBank1Sens2", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Catalyst temperature (bank 1, sensor 2). The OBD2 name is S1_PID_3E_CatTempBank1Sens2. Min value is -40. Max value is 6514. The unit is degC." + }, + { + "name":"catTempBank2Sens2", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Catalyst temperature (bank 2, sensor 2). The OBD2 name is S1_PID_3F_CatTempBank2Sens2. Min value is -40. Max value is 6514. The unit is degC." + }, + { + "name":"monStatusDriveCycle", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Monitor status this drive cycle. The OBD2 name is S1_PID_41_MonStatusDriveCycle. Min value is 0. Max value is 4294967295. The unit is Encoded." + }, + { + "name":"controlModuleVolt", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Control module voltage. The OBD2 name is S1_PID_42_ControlModuleVolt. Min value is 0. Max value is 66. The unit is V." + }, + { + "name":"absLoadValue", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Absolute load value. The OBD2 name is S1_PID_43_AbsLoadValue. Min value is 0. Max value is 25700. The unit is %." + }, + { + "name":"fuelAirCmdEquiv", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Commanded air-fuel equiv. ratio. The OBD2 name is S1_PID_44_FuelAirCmdEquiv. Min value is 0. Max value is 2. The unit is ratio." + }, + { + "name":"relThrottlePos", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Relative throttle position. The OBD2 name is S1_PID_45_RelThrottlePos. Min value is 0. Max value is 100. The unit is %." + }, + { + "name":"ambientAirTemp", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Ambient air temperature. The OBD2 name is S1_PID_46_AmbientAirTemp. Min value is -40. Max value is 215. The unit is degC." + }, + { + "name":"absThrottlePosB", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Absolute throttle position B. The OBD2 name is S1_PID_47_AbsThrottlePosB. Min value is 0. Max value is 100. The unit is %." + }, + { + "name":"absThrottlePosC", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Absolute throttle position C. The OBD2 name is S1_PID_48_AbsThrottlePosC. Min value is 0. Max value is 100. The unit is %." + }, + { + "name":"absThrottlePosCd", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Absolute throttle position D. The OBD2 name is S1_PID_49_AbsThrottlePosD. Min value is 0. Max value is 100. The unit is %." + }, + { + "name":"absThrottlePosE", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Absolute throttle position E. The OBD2 name is S1_PID_4A_AbsThrottlePosE. Min value is 0. Max value is 100. The unit is %." + }, + { + "name":"absThrottlePosF", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Absolute throttle position F. The OBD2 name is S1_PID_4B_AbsThrottlePosF. Min value is 0. Max value is 100. The unit is %." + }, + { + "name":"cmdThrottleAct", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Commanded throttle actuator. The OBD2 name is S1_PID_4C_CmdThrottleAct. Min value is 0. Max value is 100. The unit is %." + }, + { + "name":"timeRunMilOn", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Time run with MIL on. The OBD2 name is S1_PID_4D_TimeRunMILOn. Min value is 0. Max value is 65535. The unit is minutes." + }, + { + "name":"timeSinceCodeClear", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Time since DTCs cleared. The OBD2 name is S1_PID_4E_TimeSinceCodeClear. Min value is 0. Max value is 65535. The unit is minutes." + }, + { + "name":"maxFaer", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Max fuel-air equiv. ratio. The OBD2 name is S1_PID_4F_Max_FAER. Min value is 0. Max value is 255. The unit is ratio." + }, + { + "name":"maxOxySensVol", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Max oxygen sensor voltage. The OBD2 name is S1_PID_4F_Max_OxySensVol. Min value is 0. Max value is 255. The unit is V." + }, + { + "name":"maxOxySensCrnt", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Max oxygen sensor current. The OBD2 name is S1_PID_4F_Max_OxySensCrnt. Min value is 0. Max value is 255. The unit is mA." + }, + { + "name":"maxIntManiAbsPres", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Max intake manifold absolute pressure. The OBD2 name is S1_PID_4F_Max_IntManiAbsPres. Min value is 0. Max value is 2550. The unit is kPa." + }, + { + "name":"maxAirFlowMaf", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Max air flow rate from MAF sensor. The OBD2 name is S1_PID_50_Max_AirFlowMAF. Min value is 0. Max value is 2550. The unit is g/s." + }, + { + "name":"fuelType", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Fuel type. The OBD2 name is S1_PID_51_FuelType. Min value is 0. Max value is 255. The unit is Encoded." + }, + { + "name":"ethanolFuelPct", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Ethanol fuel percentage. The OBD2 name is S1_PID_52_EthanolFuelPct. Min value is 0. Max value is 100. The unit is %." + }, + { + "name":"absEvapSysVapPres", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Absolute evap system vapor pressure. The OBD2 name is S1_PID_53_AbsEvapSysVapPres. Min value is 0. Max value is 328. The unit is kPa." + }, + { + "name":"evapSysVapPres", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Evap system vapor pressure. The OBD2 name is S1_PID_54_EvapSysVapPres. Min value is -32767. Max value is 32768. The unit is Pa." + }, + { + "name":"shortSecOxyTrimBank1", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Short term sec. oxygen trim (bank 1). The OBD2 name is S1_PID_55_ShortSecOxyTrimBank1. Min value is -100. Max value is 99. The unit is %." + }, + { + "name":"shortSecOxyTrimBank3", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Short term sec. oxygen trim (bank 3). The OBD2 name is S1_PID_55_ShortSecOxyTrimBank3. Min value is -100. Max value is 99. The unit is %." + }, + { + "name":"longSecOxyTrimBank1", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Long term sec. oxygen trim (bank 1). The OBD2 name is S1_PID_56_LongSecOxyTrimBank1. Min value is -100. Max value is 99. The unit is %." + }, + { + "name":"longSecOxyTrimBank3", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Long term sec. oxygen trim (bank 3). The OBD2 name is S1_PID_56_LongSecOxyTrimBank3. Min value is -100. Max value is 99. The unit is %." + }, + { + "name":"shortSecOxyTrimBank2", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Short term sec. oxygen trim (bank 2). The OBD2 name is S1_PID_57_ShortSecOxyTrimBank2. Min value is -100. Max value is 99. The unit is %." + }, + { + "name":"shortSecOxyTrimBank4", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Short term sec. oxygen trim (bank 4). The OBD2 name is S1_PID_57_ShortSecOxyTrimBank4. Min value is -100. Max value is 99. The unit is %." + }, + { + "name":"longSecOxyTrimBank2", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Long term sec. oxygen trim (bank 2). The OBD2 name is S1_PID_58_LongSecOxyTrimBank2. Min value is -100. Max value is 99. The unit is %." + }, + { + "name":"longSecOxyTrimBank4", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Long term sec. oxygen trim (bank 4). The OBD2 name is S1_PID_58_LongSecOxyTrimBank4. Min value is -100. Max value is 99. The unit is %." + }, + { + "name":"fuelRailAbsPres", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Fuel rail absolute pressure. The OBD2 name is S1_PID_59_FuelRailAbsPres. Min value is 0. Max value is 655350. The unit is kPa." + }, + { + "name":"relAccelPedalPos", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Relative accelerator pedal position. The OBD2 name is S1_PID_5A_RelAccelPedalPos. Min value is 0. Max value is 100. The unit is %." + }, + { + "name":"hybrBatPackRemLife", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Hybrid battery pack remaining life. The OBD2 name is S1_PID_5B_HybrBatPackRemLife. Min value is 0. Max value is 100. The unit is %." + }, + { + "name":"engineOilTemp", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Engine oil temperature. The OBD2 name is S1_PID_5C_EngineOilTemp. Min value is -40. Max value is 215. The unit is degC." + }, + { + "name":"fuelInjectionTiming", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Fuel injection timing. The OBD2 name is S1_PID_5D_FuelInjectionTiming. Min value is -210. Max value is 302. The unit is deg." + }, + { + "name":"engineFuelRate", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Engine fuel rate. The OBD2 name is S1_PID_5E_EngineFuelRate. Min value is 0. Max value is 3277. The unit is L/h." + }, + { + "name":"emissionReq", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Emission requirements. The OBD2 name is S1_PID_5F_EmissionReq. Min value is 0. Max value is 255. The unit is Encoded." + }, + { + "name":"demandEngTorqPct", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Demanded engine percent torque. The OBD2 name is S1_PID_61_DemandEngTorqPct. Min value is -125. Max value is 130. The unit is %." + }, + { + "name":"actualEngTorqPct", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Actual engine percent torque. The OBD2 name is S1_PID_62_ActualEngTorqPct. Min value is -125. Max value is 130. The unit is %." + }, + { + "name":"engRefTorq", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Engine reference torque. The OBD2 name is S1_PID_63_EngRefTorq. Min value is 0. Max value is 65535. The unit is Nm." + }, + { + "name":"engPctTorqIdle", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Engine pct. torque (idle). The OBD2 name is S1_PID_64_EngPctTorq_Idle. Min value is -125. Max value is 130. The unit is %." + }, + { + "name":"engPctTorqEp1", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Engine pct. torque (engine point 1). The OBD2 name is S1_PID_64_EngPctTorq_EP1. Min value is -125. Max value is 130. The unit is %." + }, + { + "name":"engPctTorqEp2", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Engine pct. torque (engine point 2). The OBD2 name is S1_PID_64_EngPctTorq_EP2. Min value is -125. Max value is 130. The unit is %." + }, + { + "name":"engPctTorqEp3", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Engine pct. torque (engine point 3). The OBD2 name is S1_PID_64_EngPctTorq_EP3. Min value is -125. Max value is 130. The unit is %." + }, + { + "name":"engPctTorqEp4", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Engine pct. torque (engine point 4). The OBD2 name is S1_PID_64_EngPctTorq_EP4. Min value is -125. Max value is 130. The unit is %." + }, + { + "name":"auxInputOutput", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Auxiliary input/output supported. The OBD2 name is S1_PID_65_AuxInputOutput. Min value is 0. Max value is 255. The unit is Encoded." + }, + { + "name":"mafSensor", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Mass air flow sensor. The OBD2 name is S1_PID_66_MAFSensor. Min value is 0. Max value is 2048. The unit is grams/sec." + }, + { + "name":"engineCoolantTemp67", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Engine coolant temperature. The OBD2 name is S1_PID_67_EngineCoolantTemp. Min value is -40. Max value is 215. The unit is degC." + }, + { + "name":"intakeAirTempSens", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Intake air temperature. The OBD2 name is S1_PID_68_IntakeAirTempSens. Min value is -40. Max value is 215. The unit is degC." + }, + { + "name":"engineFrictionPercentTorque", + "type":[ + "null", + "float" + ], + "default":null, + "doc":"Engine friction percent torque. The OBD2 name is S1_PID_8E_EngFrictionPctTorq. Min value is -125. Max value is 130. The unit is %." + } + ] +} diff --git a/docker/list_raw.sh b/docker/list_raw.sh index b8867d27..67a317d6 100755 --- a/docker/list_raw.sh +++ b/docker/list_raw.sh @@ -1,2 +1,2 @@ #/bin/bash -radar-schemas-tools list -q --raw merged | tr '\n' ',' +radar-schemas-tools list -q --raw merged | tr '\n' ',' | sed 's/,$//' diff --git a/java-sdk/build.gradle b/java-sdk/build.gradle index 59a2193b..dc692230 100644 --- a/java-sdk/build.gradle +++ b/java-sdk/build.gradle @@ -3,12 +3,13 @@ //---------------------------------------------------------------------------// plugins { - id 'com.github.davidmc24.gradle.plugin.avro-base' version '1.2.0' + id 'com.github.davidmc24.gradle.plugin.avro-base' version '1.2.1' id("io.github.gradle-nexus.publish-plugin") version "1.1.0" + id("com.github.ben-manes.versions") version "0.39.0" } allprojects { - version = '0.7.4' + version = '0.7.5' group = 'org.radarbase' } @@ -24,17 +25,16 @@ subprojects { ext { avroVersion = '1.9.2' - argparseVersion = '0.8.1' - jacksonVersion = '2.12.3' - jacksonModuleVersion = '2.12.3' - radarJerseyVersion = "0.6.2" + argparseVersion = '0.9.0' + jacksonVersion = '2.12.5' + radarJerseyVersion = "0.8.0.1" junitVersion = '4.13.2' - confluentVersion = '6.1.1' - kafkaVersion = '6.1.1-ce' - okHttpVersion = '4.9.1' + confluentVersion = '7.0.1' + kafkaVersion = '7.0.1-ce' + okHttpVersion = '4.9.3' radarCommonsVersion = '0.13.2' - slf4jVersion = '1.7.30' + slf4jVersion = '1.7.32' javaxValidationVersion = '2.0.1.Final' logbackVersion = '1.2.3' } @@ -73,5 +73,5 @@ nexusPublishing { } wrapper { - gradleVersion '7.2' + gradleVersion '7.3.1' } diff --git a/java-sdk/config/checkstyle/checkstyle.xml b/java-sdk/config/checkstyle/checkstyle.xml index 582d375d..04b9832d 100644 --- a/java-sdk/config/checkstyle/checkstyle.xml +++ b/java-sdk/config/checkstyle/checkstyle.xml @@ -53,7 +53,6 @@ - @@ -190,10 +189,11 @@ - + + - + diff --git a/java-sdk/config/pmd/ruleset.xml b/java-sdk/config/pmd/ruleset.xml index feffafc2..5b3d1cc8 100644 --- a/java-sdk/config/pmd/ruleset.xml +++ b/java-sdk/config/pmd/ruleset.xml @@ -51,7 +51,7 @@ - + diff --git a/java-sdk/gradle/testing.gradle b/java-sdk/gradle/testing.gradle index 5c1db397..82cfa1d1 100644 --- a/java-sdk/gradle/testing.gradle +++ b/java-sdk/gradle/testing.gradle @@ -21,16 +21,14 @@ test { // Style checking // //---------------------------------------------------------------------------// checkstyle { - // codacy version - toolVersion '8.31' + toolVersion '9.2' ignoreFailures false configFile = file("$rootDir/config/checkstyle/checkstyle.xml") } pmd { - // pmd version - toolVersion = '6.23.0' + toolVersion = '6.41.0' ignoreFailures = false sourceSets = [sourceSets.main] diff --git a/java-sdk/gradle/wrapper/gradle-wrapper.properties b/java-sdk/gradle/wrapper/gradle-wrapper.properties index ffed3a25..84d1f85f 100644 --- a/java-sdk/gradle/wrapper/gradle-wrapper.properties +++ b/java-sdk/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/java-sdk/radar-catalog-server/build.gradle b/java-sdk/radar-catalog-server/build.gradle index 54a1fd64..08c3ea18 100644 --- a/java-sdk/radar-catalog-server/build.gradle +++ b/java-sdk/radar-catalog-server/build.gradle @@ -3,8 +3,8 @@ plugins { } compileJava { - targetCompatibility = JavaVersion.VERSION_11 - sourceCompatibility = JavaVersion.VERSION_11 + targetCompatibility = JavaVersion.VERSION_17 + sourceCompatibility = JavaVersion.VERSION_17 } configurations { @@ -23,7 +23,7 @@ dependencies { implementation project(':radar-schemas-core') implementation group: 'net.sourceforge.argparse4j', name: 'argparse4j', version: argparseVersion - def log4j2Version = "2.14.1" + def log4j2Version = "2.16.0" runtimeOnly("org.apache.logging.log4j:log4j-slf4j-impl:$log4j2Version") runtimeOnly("org.apache.logging.log4j:log4j-api:$log4j2Version") runtimeOnly("org.apache.logging.log4j:log4j-jul:$log4j2Version") diff --git a/java-sdk/radar-catalog-server/src/main/java/org/radarbase/schema/service/SourceCatalogueJerseyEnhancer.java b/java-sdk/radar-catalog-server/src/main/java/org/radarbase/schema/service/SourceCatalogueJerseyEnhancer.java index 6d22528b..034f2b71 100644 --- a/java-sdk/radar-catalog-server/src/main/java/org/radarbase/schema/service/SourceCatalogueJerseyEnhancer.java +++ b/java-sdk/radar-catalog-server/src/main/java/org/radarbase/schema/service/SourceCatalogueJerseyEnhancer.java @@ -4,8 +4,8 @@ import org.glassfish.jersey.internal.inject.AbstractBinder; import org.glassfish.jersey.server.ResourceConfig; import org.jetbrains.annotations.NotNull; -import org.radarbase.jersey.config.ConfigLoader.Filters; -import org.radarbase.jersey.config.JerseyResourceEnhancer; +import org.radarbase.jersey.enhancer.JerseyResourceEnhancer; +import org.radarbase.jersey.filter.Filters; import org.radarbase.schema.specification.SourceCatalogue; public class SourceCatalogueJerseyEnhancer implements JerseyResourceEnhancer { diff --git a/java-sdk/radar-catalog-server/src/main/java/org/radarbase/schema/service/SourceCatalogueServer.java b/java-sdk/radar-catalog-server/src/main/java/org/radarbase/schema/service/SourceCatalogueServer.java index e8478b33..e05c5385 100644 --- a/java-sdk/radar-catalog-server/src/main/java/org/radarbase/schema/service/SourceCatalogueServer.java +++ b/java-sdk/radar-catalog-server/src/main/java/org/radarbase/schema/service/SourceCatalogueServer.java @@ -8,6 +8,7 @@ import org.glassfish.jersey.server.ResourceConfig; import org.radarbase.jersey.GrizzlyServer; import org.radarbase.jersey.config.ConfigLoader; +import org.radarbase.jersey.enhancer.Enhancers; import org.radarbase.schema.specification.SourceCatalogue; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -44,10 +45,10 @@ public void close() { @SuppressWarnings("PMD.SignatureDeclareThrowsException") public void start(SourceCatalogue sourceCatalogue) { ResourceConfig config = ConfigLoader.INSTANCE.createResourceConfig(List.of( - ConfigLoader.Enhancers.INSTANCE.getUtility(), - ConfigLoader.Enhancers.INSTANCE.getGeneralException(), - ConfigLoader.Enhancers.INSTANCE.getHttpException(), - ConfigLoader.Enhancers.INSTANCE.getHealth(), + Enhancers.INSTANCE.getMapper(), + Enhancers.INSTANCE.getOkhttp(), + Enhancers.INSTANCE.getException(), + Enhancers.INSTANCE.getHealth(), new SourceCatalogueJerseyEnhancer(sourceCatalogue))); server = new GrizzlyServer(URI.create("http://0.0.0.0:" + serverPort + "/"), config, false); server.listen(); diff --git a/java-sdk/radar-schemas-core/src/main/java/org/radarbase/schema/specification/DataProducer.java b/java-sdk/radar-schemas-core/src/main/java/org/radarbase/schema/specification/DataProducer.java index 9f4c9914..a8b2e5a8 100644 --- a/java-sdk/radar-schemas-core/src/main/java/org/radarbase/schema/specification/DataProducer.java +++ b/java-sdk/radar-schemas-core/src/main/java/org/radarbase/schema/specification/DataProducer.java @@ -32,7 +32,7 @@ public abstract class DataProducer { private Map properties; @JsonProperty - private List labels; + private Map labels; /** * If true, register the schema during kafka initialization, otherwise, the producer should do @@ -56,7 +56,7 @@ public String getDoc() { @NotNull public abstract Scope getScope(); - public List getLabels() { + public Map getLabels() { return labels; } @@ -86,7 +86,7 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) { return false; } - DataProducer producer = (DataProducer) o; + DataProducer producer = (DataProducer) o; return Objects.equals(name, producer.name) && Objects.equals(doc, producer.doc) && Objects.equals(getData(), producer.getData()); diff --git a/java-sdk/radar-schemas-core/src/main/java/org/radarbase/schema/specification/SourceCatalogue.java b/java-sdk/radar-schemas-core/src/main/java/org/radarbase/schema/specification/SourceCatalogue.java index b59deebd..0b5d5764 100644 --- a/java-sdk/radar-schemas-core/src/main/java/org/radarbase/schema/specification/SourceCatalogue.java +++ b/java-sdk/radar-schemas-core/src/main/java/org/radarbase/schema/specification/SourceCatalogue.java @@ -146,7 +146,7 @@ private static Map initSources(ObjectReader reader, Path root, Sc filename.toUpperCase(Locale.ENGLISH), reader.readValue(f.toFile())); } catch (IOException ex) { - logger.error("Failed to load configuration {}", f, ex); + logger.error("Failed to load configuration {}: {}", f, ex.toString()); return null; } }) diff --git a/java-sdk/radar-schemas-core/src/main/java/org/radarbase/schema/specification/active/questionnaire/QuestionnaireDataTopic.java b/java-sdk/radar-schemas-core/src/main/java/org/radarbase/schema/specification/active/questionnaire/QuestionnaireDataTopic.java index 21a5d629..9f111724 100644 --- a/java-sdk/radar-schemas-core/src/main/java/org/radarbase/schema/specification/active/questionnaire/QuestionnaireDataTopic.java +++ b/java-sdk/radar-schemas-core/src/main/java/org/radarbase/schema/specification/active/questionnaire/QuestionnaireDataTopic.java @@ -28,7 +28,7 @@ */ @JsonInclude(Include.NON_NULL) public class QuestionnaireDataTopic extends DataTopic { - @JsonProperty + @JsonProperty("questionnaire_definition_url") private URL questionnaireDefinitionUrl; public URL getQuestionnaireDefinitionUrl() { @@ -38,6 +38,6 @@ public URL getQuestionnaireDefinitionUrl() { @Override protected void propertiesMap(Map props, boolean reduced) { super.propertiesMap(props, reduced); - props.put("questionnaireDefinitionUrl", questionnaireDefinitionUrl); + props.put("questionnaire_definition_url", questionnaireDefinitionUrl); } } diff --git a/java-sdk/radar-schemas-core/src/main/java/org/radarbase/schema/validation/SpecificationsValidator.java b/java-sdk/radar-schemas-core/src/main/java/org/radarbase/schema/validation/SpecificationsValidator.java index 0e15f82b..d533a09a 100644 --- a/java-sdk/radar-schemas-core/src/main/java/org/radarbase/schema/validation/SpecificationsValidator.java +++ b/java-sdk/radar-schemas-core/src/main/java/org/radarbase/schema/validation/SpecificationsValidator.java @@ -16,8 +16,12 @@ package org.radarbase.schema.validation; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.dataformat.yaml.YAMLFactory; import org.radarbase.schema.Scope; import org.radarbase.schema.validation.config.ExcludeConfig; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.io.IOException; import java.nio.file.Files; @@ -29,9 +33,12 @@ * Validates RADAR-Schemas specifications. */ public class SpecificationsValidator { + private static final Logger logger = LoggerFactory.getLogger(SpecificationsValidator.class); + public static final String YML_EXTENSION = "yml"; private final ExcludeConfig config; - private final Path root; + private final Path specificationsRoot; + private final ObjectMapper mapper; /** * Specifications validator for given RADAR-Schemas directory. @@ -39,17 +46,44 @@ public class SpecificationsValidator { * @param config configuration to exclude certain schemas or fields from validation. */ public SpecificationsValidator(Path root, ExcludeConfig config) { - this.root = root; + this.specificationsRoot = root.resolve(SPECIFICATIONS_PATH); this.config = config; + this.mapper = new ObjectMapper(new YAMLFactory()); } /** Check that all files in the specifications directory are YAML files. */ public boolean specificationsAreYmlFiles(Scope scope) throws IOException { - return Files.walk(scope.getPath(root.resolve(SPECIFICATIONS_PATH))) + Path baseFolder = scope.getPath(specificationsRoot); + if (baseFolder == null) { + logger.info(scope + " sources folder not present"); + return false; + } + + return Files.walk(baseFolder) .filter(p -> Files.isRegularFile(p) && !config.skipFile(p)) .allMatch(SpecificationsValidator::isYmlFile); } + public boolean checkSpecificationParsing(Scope scope, Class clazz) throws IOException { + Path baseFolder = scope.getPath(specificationsRoot); + if (baseFolder == null) { + logger.info(scope + " sources folder not present"); + return false; + } + + return Files.walk(baseFolder) + .filter(Files::isRegularFile) + .allMatch(f -> { + try { + mapper.readerFor(clazz).readValue(f.toFile()); + return true; + } catch (IOException ex) { + logger.error("Failed to load configuration {}: {}", f, ex.toString()); + return false; + } + }); + } + private static boolean isYmlFile(Path path) { return ValidationHelper.matchesExtension(path, YML_EXTENSION); } diff --git a/java-sdk/radar-schemas-core/src/test/java/org/radarbase/schema/validation/SourceCatalogueValidation.java b/java-sdk/radar-schemas-core/src/test/java/org/radarbase/schema/validation/SourceCatalogueValidation.java index 09c7edf5..839fcde5 100644 --- a/java-sdk/radar-schemas-core/src/test/java/org/radarbase/schema/validation/SourceCatalogueValidation.java +++ b/java-sdk/radar-schemas-core/src/test/java/org/radarbase/schema/validation/SourceCatalogueValidation.java @@ -78,7 +78,8 @@ public void validateTopicSchemas() { .flatMap(source -> source.getData().stream()) .forEach(data -> { try { - assertTrue(data.getTopics(catalogue.getSchemaCatalogue()).count() > 0); + assertTrue(data.getTopics(catalogue.getSchemaCatalogue()) + .findAny().isPresent()); } catch (IOException ex) { fail("Cannot create topic from specification: " + ex); } diff --git a/java-sdk/radar-schemas-core/src/test/java/org/radarbase/schema/validation/SpecificationsValidatorTest.java b/java-sdk/radar-schemas-core/src/test/java/org/radarbase/schema/validation/SpecificationsValidatorTest.java index 0a842e4e..2fa84221 100644 --- a/java-sdk/radar-schemas-core/src/test/java/org/radarbase/schema/validation/SpecificationsValidatorTest.java +++ b/java-sdk/radar-schemas-core/src/test/java/org/radarbase/schema/validation/SpecificationsValidatorTest.java @@ -7,6 +7,12 @@ import org.junit.Before; import org.junit.Test; import org.radarbase.schema.Scope; +import org.radarbase.schema.specification.active.ActiveSource; +import org.radarbase.schema.specification.connector.ConnectorSource; +import org.radarbase.schema.specification.monitor.MonitorSource; +import org.radarbase.schema.specification.passive.PassiveSource; +import org.radarbase.schema.specification.push.PushSource; +import org.radarbase.schema.specification.stream.StreamGroup; import org.radarbase.schema.validation.config.ExcludeConfig; public class SpecificationsValidatorTest { @@ -20,25 +26,36 @@ public void setUp() throws IOException { @Test public void activeIsYml() throws IOException { assertTrue(validator.specificationsAreYmlFiles(Scope.ACTIVE)); + assertTrue(validator.checkSpecificationParsing(Scope.ACTIVE, ActiveSource.class)); } @Test public void monitorIsYml() throws IOException { assertTrue(validator.specificationsAreYmlFiles(Scope.MONITOR)); + assertTrue(validator.checkSpecificationParsing(Scope.MONITOR, MonitorSource.class)); } @Test public void passiveIsYml() throws IOException { assertTrue(validator.specificationsAreYmlFiles(Scope.PASSIVE)); + assertTrue(validator.checkSpecificationParsing(Scope.PASSIVE, PassiveSource.class)); } @Test public void connectorIsYml() throws IOException { assertTrue(validator.specificationsAreYmlFiles(Scope.CONNECTOR)); + assertTrue(validator.checkSpecificationParsing(Scope.CONNECTOR, ConnectorSource.class)); + } + + @Test + public void pushIsYml() throws IOException { + assertTrue(validator.specificationsAreYmlFiles(Scope.PUSH)); + assertTrue(validator.checkSpecificationParsing(Scope.PUSH, PushSource.class)); } @Test public void streamIsYml() throws IOException { assertTrue(validator.specificationsAreYmlFiles(Scope.STREAM)); + assertTrue(validator.checkSpecificationParsing(Scope.STREAM, StreamGroup.class)); } } diff --git a/java-sdk/radar-schemas-tools/build.gradle b/java-sdk/radar-schemas-tools/build.gradle index c67faa75..0e8c5eed 100644 --- a/java-sdk/radar-schemas-tools/build.gradle +++ b/java-sdk/radar-schemas-tools/build.gradle @@ -3,8 +3,8 @@ plugins { } compileJava { - targetCompatibility = JavaVersion.VERSION_11 - sourceCompatibility = JavaVersion.VERSION_11 + targetCompatibility = JavaVersion.VERSION_17 + sourceCompatibility = JavaVersion.VERSION_17 } configurations { @@ -24,7 +24,7 @@ repositories { dependencies { implementation project(':radar-schemas-registration') - implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:$jacksonModuleVersion") + implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:$jacksonVersion") implementation group: 'net.sourceforge.argparse4j', name: 'argparse4j', version: argparseVersion diff --git a/specifications/passive/canedge-1.0.0.yml b/specifications/passive/canedge-1.0.0.yml new file mode 100644 index 00000000..e03c15bc --- /dev/null +++ b/specifications/passive/canedge-1.0.0.yml @@ -0,0 +1,11 @@ +#====================================== For CSS Electronics CANedge1 =====================================# +vendor: CSSElectronics +model: CANedge1 +version: 1.0.0 +doc: Vehicle CAN bus OBD2 data collected and uploaded by web application +data: + - doc: This is vehicle CAN bus OBD2 data captured from CANedge1 device + unit: NON_DIMENSIONAL + processing_state: VENDOR + topic: canedge_obd2 + value_schema: .passive.canedge.CanEdgeObd2 diff --git a/specifications/passive/carl-cloud-1.0.0.yml b/specifications/passive/carl-cloud-1.0.0.yml index dc9b9e3a..0928b676 100644 --- a/specifications/passive/carl-cloud-1.0.0.yml +++ b/specifications/passive/carl-cloud-1.0.0.yml @@ -3,8 +3,6 @@ name: CARLCLoud vendor: CERTH model: CARLCLoud version: 1.0.0 -labels: - assessment_type: APP doc: CARL CLoud schemas and topics data: - type: FIBAROSECTION