Skip to content

Commit 7492acb

Browse files
authored
Merge pull request #632 from bci-oss/603-samm2aas-entities-in-sets
Fix AAS serialization from native executable samm-cli
2 parents 2fb9b73 + 7dab357 commit 7492acb

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ void generateAasxWithAspectDataForCollectionProperty() throws DeserializationExc
142142

143143
@Test
144144
void generateAasxWithAspectDataForCollectionPropertyWithCustomMapper() throws DeserializationException {
145-
AspectModelAasGenerator customGenerator = new AspectModelAasGenerator( List.of( new IntegerCollectionMapper() ) );
145+
final AspectModelAasGenerator customGenerator = new AspectModelAasGenerator( List.of( new IntegerCollectionMapper() ) );
146146
final Environment env = getAssetAdministrationShellFromAspectWithData( TestAspect.ASPECT_WITH_COLLECTION_OF_SIMPLE_TYPE,
147147
customGenerator );
148148
assertThat( env.getSubmodels() )
@@ -357,17 +357,17 @@ void testGenerateAasxFromAspectModelWithEnumeration() throws DeserializationExce
357357
// anonymous enumeration in test has no urn for enum values but is required for Concept
358358
// Description referencing
359359
public void testGeneration( final TestAspect testAspect ) throws DeserializationException {
360-
final String aspectAsString = aspectToString( testAspect );
361-
final byte[] xmlFile = aspectAsString.getBytes();
360+
final String aasXmlString = aspectToAasXml( testAspect );
361+
final byte[] aasXmlInput = aasXmlString.getBytes();
362362

363-
final String aasXml = new String( xmlFile );
363+
final String aasXml = new String( aasXmlInput );
364364
assertThat( aasXml ).doesNotContain( "DefaultScalarValue[" );
365365
assertThat( aasXml ).doesNotContain( "DefaultEntity[" );
366366
assertThat( aasXml ).doesNotContain( "Optional[" );
367367

368-
final Environment env = loadAasx( new ByteArrayInputStream( xmlFile ) );
368+
final Environment env = loadAasx( new ByteArrayInputStream( aasXmlInput ) );
369369
assertThat( env.getSubmodels() ).isNotEmpty();
370-
validate( new ByteArrayInputStream( xmlFile ) );
370+
validate( new ByteArrayInputStream( aasXmlInput ) );
371371
}
372372

373373
@Test
@@ -455,7 +455,7 @@ private Environment getAssetAdministrationShellFromAspectWithData( final TestAsp
455455
return loadAasx( generator.generateAsByteArray( AasFileFormat.XML, aspect, aspectData ) );
456456
}
457457

458-
private String aspectToString( final TestAspect testAspect ) {
458+
private String aspectToAasXml( final TestAspect testAspect ) {
459459
final Aspect aspect = TestResources.load( testAspect ).aspect();
460460
return new String( generator.generateAsByteArray( AasFileFormat.XML, aspect ), StandardCharsets.UTF_8 );
461461
}

tools/samm-cli/src/main/java/org/eclipse/esmf/nativefeatures/AasReflection.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ public void beforeAnalysis( final BeforeAnalysisAccess access ) {
3333

3434
registerClassesInPackage( ReflectionHelper.MODEL_PACKAGE_NAME );
3535
registerClassesInPackage( ReflectionHelper.DEFAULT_IMPLEMENTATION_PACKAGE_NAME );
36+
registerClassesInPackage( ReflectionHelper.JSON_MIXINS_PACKAGE_NAME );
37+
registerClassesInPackage( ReflectionHelper.XML_MIXINS_PACKAGE_NAME );
3638
}
3739

3840
@Override

0 commit comments

Comments
 (0)