This is an automated email from the ASF dual-hosted git repository. asf-gitbox-commits pushed a commit to branch geoapi-4.0 in repository https://gitbox.apache.org/repos/asf/sis.git
commit 23e4f168e8afa82b8a132debb5605efe01827fbe Author: Martin Desruisseaux <[email protected]> AuthorDate: Sat Nov 14 19:47:31 2026 +0100 Add a test of parallel execution. --- .../org/apache/sis/image/AggregatedImageTest.java | 30 +++++++++++++++++----- 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/endorsed/src/org.apache.sis.feature/test/org/apache/sis/image/AggregatedImageTest.java b/endorsed/src/org.apache.sis.feature/test/org/apache/sis/image/AggregatedImageTest.java index 6b01080b8a..4154815c68 100644 --- a/endorsed/src/org.apache.sis.feature/test/org/apache/sis/image/AggregatedImageTest.java +++ b/endorsed/src/org.apache.sis.feature/test/org/apache/sis/image/AggregatedImageTest.java @@ -81,6 +81,11 @@ public final class AggregatedImageTest extends TestCase { */ private AggregatedImage image; + /** + * Whether to enable parallel execution. + */ + private boolean parallel; + /** * Creates a new test case. */ @@ -134,12 +139,9 @@ public final class AggregatedImageTest extends TestCase { private void createAggregatedImage(final AggregatedImage.Source... sources) throws TransformException { final var tileSize = new Dimension(tileWidth, tileHeight); final var minTile = new Point(minTileX, minTileY); - image = new AggregatedImage( - sources, - new ImageLayout(null, tileSize, false, false, true, minTile), - bounds, - Aggregation.RASTER_SPACE_WEIGHTING, - null); // Fill values. + final var layout = new ImageLayout(null, tileSize, false, false, true, minTile); + image = new AggregatedImage(sources, layout, bounds, Aggregation.RASTER_SPACE_WEIGHTING, null); + image.parallel = parallel; } /** @@ -275,6 +277,22 @@ public final class AggregatedImageTest extends TestCase { NaN, NaN, 2320, 2321, 2420, 2421, NaN, NaN, NaN, NaN); } + /** + * Tests the aggregation of three source images using parallel execution. + * This is the same test as {@link #testThreeSources()}, with the same expected values. + * With three sources, the aggregation task is split in background tasks working on different images, + * and the task working on the last image is split again in background tasks working on different tiles. + * Since all partial sums in this test are exact, the result does not depend on the order in which the + * background tasks are merged. + * + * @throws TransformException if an error occurred while computing the bounds of the aggregated image. + */ + @Test + public void testParallelExecution() throws TransformException { + parallel = true; + testThreeSources(); + } + /** * Tests the aggregation of two source images having different numbers of bands. * The aggregated image bounds are computed automatically. The sources are:
