Skip to content

Commit 18f6dc1

Browse files
committed
Adjust POM to import AAS4j JSON lib and adding CLI test code for AAS JSON generation
Signed-off-by: Johannes Kristan <[email protected]>
1 parent 8b890a1 commit 18f6dc1

File tree

3 files changed

+28
-6
lines changed

3 files changed

+28
-6
lines changed

core/esmf-aspect-model-aas-generator/pom.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@
3939
<groupId>org.eclipse.digitaltwin.aas4j</groupId>
4040
<artifactId>dataformat-aasx</artifactId>
4141
</dependency>
42+
<dependency>
43+
<groupId>org.eclipse.digitaltwin.aas4j</groupId>
44+
<artifactId>dataformat-json</artifactId>
45+
</dependency>
4246
<dependency>
4347
<groupId>org.eclipse.esmf</groupId>
4448
<artifactId>esmf-test-resources</artifactId>

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<parent>
1919
<groupId>org.eclipse.esmf</groupId>
2020
<artifactId>esmf-parent</artifactId>
21-
<version>3</version>
21+
<version>4</version>
2222
</parent>
2323

2424
<artifactId>esmf-sdk-parent</artifactId>

tools/samm-cli/src/test/java/org/eclipse/esmf/SammCliTest.java

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ public void testAspectToAasXmlToStdout() {
219219
}
220220

221221
@Test
222-
public void testAspectToAasAasxToFile() throws TikaException, IOException {
222+
public void testAspectToAasAasxToFile() {
223223
final File targetFile = outputFile( "output.aasx" );
224224
final ExecutionResult result = sammCli.runAndExpectSuccess( "--disable-color", "aspect", defaultInputFile, "to", "aas", "--format", "aasx", "-o",
225225
targetFile.getAbsolutePath() );
@@ -230,12 +230,30 @@ public void testAspectToAasAasxToFile() throws TikaException, IOException {
230230
}
231231

232232
@Test
233-
public void testAspectToAasAasxToStdout() throws TikaException, IOException {
233+
public void testAspectToAasAasxToStdout() {
234234
final ExecutionResult result = sammCli.runAndExpectSuccess( "--disable-color", "aspect", defaultInputFile, "to", "aas", "--format", "aasx" );
235235
assertThat( result.stderr() ).isEmpty();
236236
assertThat( contentType( result.stdoutRaw() ) ).isEqualTo( MediaType.application( "x-tika-ooxml" ) );
237237
}
238238

239+
@Test
240+
public void testAspectToAasJsonToFile() {
241+
final File targetFile = outputFile( "output.json" );
242+
final ExecutionResult result = sammCli.runAndExpectSuccess( "--disable-color", "aspect", defaultInputFile, "to", "aas", "--format", "json", "-o",
243+
targetFile.getAbsolutePath() );
244+
assertThat( result.stdout() ).isEmpty();
245+
assertThat( result.stderr() ).isEmpty();
246+
assertThat( targetFile ).exists();
247+
assertThat( contentType( targetFile ) ).isEqualTo( MediaType.text( "plain" ) );
248+
}
249+
250+
@Test
251+
public void testAspectToAasJsonToStdout() {
252+
final ExecutionResult result = sammCli.runAndExpectSuccess( "--disable-color", "aspect", defaultInputFile, "to", "aas", "--format", "json" );
253+
assertThat( result.stderr() ).isEmpty();
254+
assertThat( contentType( result.stdoutRaw() ) ).isEqualTo( MediaType.text( "plain" ) );
255+
}
256+
239257
@Test
240258
public void testAspectToDotWithDefaultLanguage() {
241259
final File targetFile = outputFile( "output.dot" );
@@ -585,7 +603,7 @@ public void testAspectToOpenApiWithResourcePathAndCustomResolver() {
585603
}
586604

587605
@Test
588-
public void testAspectToPngWithDefaultLanguage() throws TikaException, IOException {
606+
public void testAspectToPngWithDefaultLanguage() {
589607
final File targetFile = outputFile( "output.png" );
590608
final ExecutionResult result = sammCli.runAndExpectSuccess( "--disable-color", "aspect", defaultInputFile, "to", "png", "-o",
591609
targetFile.getAbsolutePath() );
@@ -596,7 +614,7 @@ public void testAspectToPngWithDefaultLanguage() throws TikaException, IOExcepti
596614
}
597615

598616
@Test
599-
public void testAspectToPngWithGivenLanguage() throws TikaException, IOException {
617+
public void testAspectToPngWithGivenLanguage() {
600618
final File targetFile = outputFile( "output.png" );
601619
final ExecutionResult result = sammCli.runAndExpectSuccess( "--disable-color", "aspect", defaultInputFile, "to", "png", "-o",
602620
targetFile.getAbsolutePath(),
@@ -619,7 +637,7 @@ public void testAspectToPngWithNonExistentLanguage() {
619637
}
620638

621639
@Test
622-
public void testAspectToPngToStdout() throws TikaException, IOException {
640+
public void testAspectToPngToStdout() {
623641
final ExecutionResult result = sammCli.runAndExpectSuccess( "--disable-color", "aspect", defaultInputFile, "to", "png" );
624642
assertThat( result.stderr() ).isEmpty();
625643
assertThat( contentType( result.stdoutRaw() ) ).isEqualTo( MediaType.image( "png" ) );

0 commit comments

Comments
 (0)