Skip to content

Commit 44dd043

Browse files
committed
WIP: migrate pipeline test class
1 parent 485a18c commit 44dd043

File tree

2 files changed

+86
-0
lines changed

2 files changed

+86
-0
lines changed

packages/core/java/src/main/java/org/itk/wasm/Pipeline.java

+5
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
import java.nio.file.Path;
5454
import java.nio.file.Paths;
5555
import java.util.ArrayList;
56+
import java.util.Collections;
5657
import java.util.HashSet;
5758
import java.util.List;
5859
import java.util.Map;
@@ -87,6 +88,10 @@ public Pipeline(byte[] wasmBytes) {
8788
module = new Module(engine, wasmBytes);
8889
}
8990

91+
public List<PipelineOutput<?>> run(List<String> args) {
92+
return run(args, Collections.emptyList(), Collections.emptyList());
93+
}
94+
9095
public List<PipelineOutput<?>> run(List<String> args, List<PipelineOutput<?>> outputs, List<PipelineInput<?>> inputs) {
9196
try (RunInstance ri = new RunInstance(args, outputs, inputs)) {
9297
int returnCode = ri.delayedStart();
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
/*-
2+
* #%L
3+
* Java bindings for itk-wasm.
4+
* %%
5+
* Copyright (C) 2023 ITK developers.
6+
* %%
7+
* Licensed under the Apache License, Version 2.0 (the "License");
8+
* you may not use this file except in compliance with the License.
9+
* You may obtain a copy of the License at
10+
*
11+
* http://www.apache.org/licenses/LICENSE-2.0
12+
*
13+
* Unless required by applicable law or agreed to in writing, software
14+
* distributed under the License is distributed on an "AS IS" BASIS,
15+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
* See the License for the specific language governing permissions and
17+
* limitations under the License.
18+
* #L%
19+
*/
20+
package org.itk.wasm;
21+
22+
import java.io.IOException;
23+
import java.nio.file.Path;
24+
import java.nio.file.Paths;
25+
import java.util.ArrayList;
26+
27+
import org.junit.jupiter.api.Test;
28+
import org.junit.jupiter.api.condition.EnabledOnOs;
29+
import org.junit.jupiter.api.condition.OS;
30+
31+
public class TestPipeline {
32+
33+
private Path test_input_dir;
34+
private Path test_baseline_dir;
35+
36+
public TestPipeline() {
37+
test_input_dir = Paths.get("").toAbsolutePath().resolve("input");
38+
test_baseline_dir = Paths.get("").toAbsolutePath().resolve("baseline");
39+
}
40+
41+
@Test
42+
public void testStdoutStderr() throws IOException {
43+
// Test logic goes here
44+
Pipeline pipeline = new Pipeline(test_input_dir.resolve("stdout-stderr-test.wasi.wasm").toString());
45+
pipeline.run(new ArrayList<>());
46+
47+
// Test re-run
48+
pipeline.run(new ArrayList<>());
49+
}
50+
51+
@Test
52+
public void test_pipeline_bytes() {
53+
// Test logic goes here
54+
}
55+
56+
@Test
57+
public void test_pipeline_input_output_streams() {
58+
// Test logic goes here
59+
}
60+
61+
@EnabledOnOs(OS.LINUX) // Skip this test on Windows platform
62+
@Test
63+
public void test_pipeline_input_output_files() {
64+
// Test logic goes here
65+
}
66+
67+
@Test
68+
public void test_pipeline_write_read_image() {
69+
// Test logic goes here
70+
}
71+
72+
@Test
73+
public void test_pipeline_write_read_mesh() {
74+
// Test logic goes here
75+
}
76+
77+
@Test
78+
public void test_pipeline_write_read_polydata() {
79+
// Test logic goes here
80+
}
81+
}

0 commit comments

Comments
 (0)