From 1d47d3ec1a83c2d10b17178c482948e53a084174 Mon Sep 17 00:00:00 2001 From: Esteban Zimanyi Date: Fri, 29 May 2026 15:25:08 +0200 Subject: [PATCH] build(meos): select the extended temporal-type families via MobilityDB/MEOS build flags The extended families are selected at build time with the same uppercase flag names and ON|OFF (also 1|0) values as the MobilityDB/MEOS CMake build: NPOINT is included by default; CBUFFER, POSE, RGEO, and H3 are included with -D=ON (or =1) and dropped otherwise (RGEO needs POSE). Each family's MeosOps* facade sources and its per-family smoke test are excluded when the family is off; the core and geo smoke checks remain in MeosFacadeSmokeTest. --- flink-processor/pom.xml | 314 ++++++++++++++++++ .../flink/meos/MeosCbufferSmokeTest.java | 40 +++ .../flink/meos/MeosFacadeSmokeTest.java | 38 +-- .../flink/meos/MeosNpointSmokeTest.java | 39 +++ .../flink/meos/MeosPoseSmokeTest.java | 40 +++ 5 files changed, 441 insertions(+), 30 deletions(-) create mode 100644 flink-processor/src/test/java/org/mobilitydb/flink/meos/MeosCbufferSmokeTest.java create mode 100644 flink-processor/src/test/java/org/mobilitydb/flink/meos/MeosNpointSmokeTest.java create mode 100644 flink-processor/src/test/java/org/mobilitydb/flink/meos/MeosPoseSmokeTest.java diff --git a/flink-processor/pom.xml b/flink-processor/pom.xml index f4c288f..99ae9d0 100755 --- a/flink-processor/pom.xml +++ b/flink-processor/pom.xml @@ -216,4 +216,318 @@ + + + + + cbuffer-exclude-unset + + !CBUFFER + + + + + maven-compiler-plugin + + + **/meos/MeosOpsTCbuffer.java + **/meos/MeosOpsFreeCbuffer.java + **/meos/MeosOpsCbufferSet.java + + + **/MeosCbufferSmokeTest.java + + + + + + + + cbuffer-exclude-off + + CBUFFEROFF + + + + + maven-compiler-plugin + + + **/meos/MeosOpsTCbuffer.java + **/meos/MeosOpsFreeCbuffer.java + **/meos/MeosOpsCbufferSet.java + + + **/MeosCbufferSmokeTest.java + + + + + + + + cbuffer-exclude-zero + + CBUFFER0 + + + + + maven-compiler-plugin + + + **/meos/MeosOpsTCbuffer.java + **/meos/MeosOpsFreeCbuffer.java + **/meos/MeosOpsCbufferSet.java + + + **/MeosCbufferSmokeTest.java + + + + + + + + pose-exclude-unset + + !POSE + + + + + maven-compiler-plugin + + + **/meos/MeosOpsTPose.java + **/meos/MeosOpsFreePose.java + **/meos/MeosOpsPoseSet.java + + + **/MeosPoseSmokeTest.java + + + + + + + + pose-exclude-off + + POSEOFF + + + + + maven-compiler-plugin + + + **/meos/MeosOpsTPose.java + **/meos/MeosOpsFreePose.java + **/meos/MeosOpsPoseSet.java + + + **/MeosPoseSmokeTest.java + + + + + + + + pose-exclude-zero + + POSE0 + + + + + maven-compiler-plugin + + + **/meos/MeosOpsTPose.java + **/meos/MeosOpsFreePose.java + **/meos/MeosOpsPoseSet.java + + + **/MeosPoseSmokeTest.java + + + + + + + + rgeo-exclude-unset + + !RGEO + + + + + maven-compiler-plugin + + + **/meos/MeosOpsTRGeometry.java + **/meos/MeosOpsTRGeometryInst.java + **/meos/MeosOpsFreeRgeo.java + + + + + + + + rgeo-exclude-off + + RGEOOFF + + + + + maven-compiler-plugin + + + **/meos/MeosOpsTRGeometry.java + **/meos/MeosOpsTRGeometryInst.java + **/meos/MeosOpsFreeRgeo.java + + + + + + + + rgeo-exclude-zero + + RGEO0 + + + + + maven-compiler-plugin + + + **/meos/MeosOpsTRGeometry.java + **/meos/MeosOpsTRGeometryInst.java + **/meos/MeosOpsFreeRgeo.java + + + + + + + + h3-exclude-unset + + !H3 + + + + + maven-compiler-plugin + + + **/meos/MeosOpsTh3index.java + **/meos/MeosOpsFreeH3.java + + + + + + + + h3-exclude-off + + H3OFF + + + + + maven-compiler-plugin + + + **/meos/MeosOpsTh3index.java + **/meos/MeosOpsFreeH3.java + + + + + + + + h3-exclude-zero + + H30 + + + + + maven-compiler-plugin + + + **/meos/MeosOpsTh3index.java + **/meos/MeosOpsFreeH3.java + + + + + + + + npoint-exclude-off + + NPOINTOFF + + + + + maven-compiler-plugin + + + **/meos/MeosOpsTNpoint.java + **/meos/MeosOpsTNpointInst.java + **/meos/MeosOpsFreeNpoint.java + **/meos/MeosOpsNpointSet.java + + + **/MeosNpointSmokeTest.java + + + + + + + + npoint-exclude-zero + + NPOINT0 + + + + + maven-compiler-plugin + + + **/meos/MeosOpsTNpoint.java + **/meos/MeosOpsTNpointInst.java + **/meos/MeosOpsFreeNpoint.java + **/meos/MeosOpsNpointSet.java + + + **/MeosNpointSmokeTest.java + + + + + + + \ No newline at end of file diff --git a/flink-processor/src/test/java/org/mobilitydb/flink/meos/MeosCbufferSmokeTest.java b/flink-processor/src/test/java/org/mobilitydb/flink/meos/MeosCbufferSmokeTest.java new file mode 100644 index 0000000..7573d36 --- /dev/null +++ b/flink-processor/src/test/java/org/mobilitydb/flink/meos/MeosCbufferSmokeTest.java @@ -0,0 +1,40 @@ +package org.mobilitydb.flink.meos; + +import functions.GeneratedFunctions; +import jnr.ffi.Pointer; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.condition.EnabledIfSystemProperty; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; + +/** + * Runtime check that the cbuffer facade family calls into libmeos and returns + * correct results. Compiled and run only when the build includes the cbuffer + * family ({@code -DCBUFFER=ON}); the family requires a libmeos built with + * {@code -DCBUFFER=ON}. + */ +@EnabledIfSystemProperty(named = "mobilityflink.meos.enabled", matches = "true") +class MeosCbufferSmokeTest { + + @BeforeAll + static void init() { + GeneratedFunctions.meos_initialize_error_handler((level, code, message) -> { }); + GeneratedFunctions.meos_initialize(); + } + + @AfterAll + static void finalizeMeos() { + GeneratedFunctions.meos_finalize(); + } + + @Test + void cbuffer() { + Pointer cb = MeosOpsFreeCbuffer.cbuffer_make(MeosOpsFreeGeo.geom_in("POINT(1 1)", 0), 0.5); + assertNotNull(cb); + assertEquals(0.5, MeosOpsFreeCbuffer.cbuffer_radius(cb), 1e-9); + assertNotNull(MeosOpsFreeCbuffer.cbuffer_out(cb, 6)); + } +} diff --git a/flink-processor/src/test/java/org/mobilitydb/flink/meos/MeosFacadeSmokeTest.java b/flink-processor/src/test/java/org/mobilitydb/flink/meos/MeosFacadeSmokeTest.java index b116f65..395e5cf 100644 --- a/flink-processor/src/test/java/org/mobilitydb/flink/meos/MeosFacadeSmokeTest.java +++ b/flink-processor/src/test/java/org/mobilitydb/flink/meos/MeosFacadeSmokeTest.java @@ -7,16 +7,18 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.condition.EnabledIfSystemProperty; -import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertTrue; /** - * Per-family runtime check that the generated MEOS facade calls into libmeos and - * returns correct results. Each family constructs a value through a {@code MeosOps*} - * facade method and reads it back. Runs only with {@code -Dmobilityflink.meos.enabled=true} - * and a libmeos on the load path; the extended families (cbuffer, npoint, pose) require a - * libmeos built with {@code -DCBUFFER=ON -DNPOINT=ON -DPOSE=ON -DRGEO=ON}. + * Runtime check that the always-built MEOS facade families (core and geo) call + * into libmeos and return correct results. Each constructs a value through a + * {@code MeosOps*} facade method and reads it back. Runs only with + * {@code -Dmobilityflink.meos.enabled=true} and a libmeos on the load path. The + * optional families have their own gated smoke tests + * ({@link MeosCbufferSmokeTest}, {@link MeosNpointSmokeTest}, + * {@link MeosPoseSmokeTest}), each compiled only when its build flag includes + * the family. */ @EnabledIfSystemProperty(named = "mobilityflink.meos.enabled", matches = "true") class MeosFacadeSmokeTest { @@ -61,28 +63,4 @@ void geoGeometry() { assertNotNull(geom); assertTrue(MeosOpsFreeGeo.geo_as_text(geom, 6).toUpperCase().contains("POINT")); } - - @Test - void cbuffer() { - Pointer cb = MeosOpsFreeCbuffer.cbuffer_make(MeosOpsFreeGeo.geom_in("POINT(1 1)", 0), 0.5); - assertNotNull(cb); - assertEquals(0.5, MeosOpsFreeCbuffer.cbuffer_radius(cb), 1e-9); - assertNotNull(MeosOpsFreeCbuffer.cbuffer_out(cb, 6)); - } - - @Test - void npoint() { - Pointer np = MeosOpsFreeNpoint.npoint_make(1, 0.5); - assertNotNull(np); - assertEquals(1, MeosOpsFreeNpoint.npoint_route(np)); - assertEquals(0.5, MeosOpsFreeNpoint.npoint_position(np), 1e-9); - } - - @Test - void pose() { - Pointer pose = MeosOpsFreePose.pose_in("Pose(Point(1 1), 0.5)"); - assertNotNull(pose); - assertNotNull(MeosOpsFreePose.pose_out(pose, 6)); - assertEquals(0.5, MeosOpsFreePose.pose_rotation(pose), 1e-9); - } } diff --git a/flink-processor/src/test/java/org/mobilitydb/flink/meos/MeosNpointSmokeTest.java b/flink-processor/src/test/java/org/mobilitydb/flink/meos/MeosNpointSmokeTest.java new file mode 100644 index 0000000..6af10d7 --- /dev/null +++ b/flink-processor/src/test/java/org/mobilitydb/flink/meos/MeosNpointSmokeTest.java @@ -0,0 +1,39 @@ +package org.mobilitydb.flink.meos; + +import functions.GeneratedFunctions; +import jnr.ffi.Pointer; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.condition.EnabledIfSystemProperty; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; + +/** + * Runtime check that the npoint facade family calls into libmeos and returns + * correct results. Compiled and run when the build includes the npoint family + * (the default; dropped with {@code -DNPOINT=OFF}). + */ +@EnabledIfSystemProperty(named = "mobilityflink.meos.enabled", matches = "true") +class MeosNpointSmokeTest { + + @BeforeAll + static void init() { + GeneratedFunctions.meos_initialize_error_handler((level, code, message) -> { }); + GeneratedFunctions.meos_initialize(); + } + + @AfterAll + static void finalizeMeos() { + GeneratedFunctions.meos_finalize(); + } + + @Test + void npoint() { + Pointer np = MeosOpsFreeNpoint.npoint_make(1, 0.5); + assertNotNull(np); + assertEquals(1, MeosOpsFreeNpoint.npoint_route(np)); + assertEquals(0.5, MeosOpsFreeNpoint.npoint_position(np), 1e-9); + } +} diff --git a/flink-processor/src/test/java/org/mobilitydb/flink/meos/MeosPoseSmokeTest.java b/flink-processor/src/test/java/org/mobilitydb/flink/meos/MeosPoseSmokeTest.java new file mode 100644 index 0000000..c4e13c9 --- /dev/null +++ b/flink-processor/src/test/java/org/mobilitydb/flink/meos/MeosPoseSmokeTest.java @@ -0,0 +1,40 @@ +package org.mobilitydb.flink.meos; + +import functions.GeneratedFunctions; +import jnr.ffi.Pointer; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.condition.EnabledIfSystemProperty; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; + +/** + * Runtime check that the pose facade family calls into libmeos and returns + * correct results. Compiled and run only when the build includes the pose + * family ({@code -DPOSE=ON}); the family requires a libmeos built with + * {@code -DPOSE=ON}. + */ +@EnabledIfSystemProperty(named = "mobilityflink.meos.enabled", matches = "true") +class MeosPoseSmokeTest { + + @BeforeAll + static void init() { + GeneratedFunctions.meos_initialize_error_handler((level, code, message) -> { }); + GeneratedFunctions.meos_initialize(); + } + + @AfterAll + static void finalizeMeos() { + GeneratedFunctions.meos_finalize(); + } + + @Test + void pose() { + Pointer pose = MeosOpsFreePose.pose_in("Pose(Point(1 1), 0.5)"); + assertNotNull(pose); + assertNotNull(MeosOpsFreePose.pose_out(pose, 6)); + assertEquals(0.5, MeosOpsFreePose.pose_rotation(pose), 1e-9); + } +}