Skip to content

Commit 5d2e814

Browse files
committed
Update tests. Add getting IDTA from github
1 parent aa107cb commit 5d2e814

File tree

3 files changed

+15
-6
lines changed

3 files changed

+15
-6
lines changed

core/esmf-aspect-model-aas-generator/src/test/java/org/eclipse/esmf/aspectmodel/aas/AasToAspectModelGeneratorTest.java

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import java.io.ByteArrayInputStream;
2121
import java.io.IOException;
2222
import java.io.InputStream;
23+
import java.net.URL;
2324
import java.util.List;
2425
import java.util.function.Consumer;
2526

@@ -39,21 +40,19 @@ class AasToAspectModelGeneratorTest {
3940

4041
@Test
4142
void testTranslateDigitalNameplate() {
42-
final InputStream aasx = AasToAspectModelGeneratorTest.class.getClassLoader()
43-
.getResourceAsStream( "idta/Sample_ZVEI_Digital_Nameplate_V10.aasx" );
43+
final InputStream aasx = getIdtaModel(
44+
"ZVEI_Digital_Nameplate/1/0/Sample_ZVEI_Digital_Nameplate_V10.aasx" );
4445
final AasToAspectModelGenerator aspectModelGenerator = AasToAspectModelGenerator.fromAasx( aasx );
4546
assertThatCode( aspectModelGenerator::generateAspects ).doesNotThrowAnyException();
4647
}
4748

4849
@Test
4950
void testSeeReferences() {
50-
final InputStream inputStream = AasToAspectModelGeneratorTest.class.getClassLoader().getResourceAsStream(
51-
"idta/IDTA 02022-1-0_Template_Wireless Communication.aasx" );
51+
final InputStream inputStream = getIdtaModel(
52+
"Wireless Communication/1/0/IDTA 02022-1-0_Template_Wireless Communication.aasx" );
5253
final AasToAspectModelGenerator aspectModelGenerator = AasToAspectModelGenerator.fromAasx( inputStream );
5354
final List<Aspect> aspects = aspectModelGenerator.generateAspects();
5455

55-
assertThatCode( aspectModelGenerator::generateAspects ).doesNotThrowAnyException();
56-
5756
aspects.stream()
5857
.flatMap( aspect -> aspect.getProperties().stream() )
5958
.flatMap( property -> property.getSee().stream() )
@@ -149,4 +148,14 @@ private Environment loadEnvironment( final String name ) {
149148
}
150149
return null;
151150
}
151+
152+
private InputStream getIdtaModel( final String path ) {
153+
try {
154+
final URL url = new URL( "https://github.com/admin-shell-io/submodel-templates/raw/refs/heads/main/published/" + path.replaceAll( " ", "%20" ) );
155+
return url.openStream();
156+
} catch ( Exception e ) {
157+
e.printStackTrace();
158+
return null;
159+
}
160+
}
152161
}
-9.11 KB
Binary file not shown.
-7.66 KB
Binary file not shown.

0 commit comments

Comments
 (0)