Skip to content

Commit

Permalink
Merge branch 'main' into 494-make-native-binaries-easier-to-download-…
Browse files Browse the repository at this point in the history
…via-documentation
  • Loading branch information
Yauhenikapl authored Jan 11, 2024
2 parents aa55d3f + 35b7819 commit 2e33ed6
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -433,20 +433,16 @@ private EmbeddedDataSpecification extractEmbeddedDataSpecification( final Aspect
}

private DataSpecificationIec61360 extractDataSpecificationContent( final Property property ) {
final List<LangStringDefinitionTypeIec61360> definitions = property.getCharacteristic().stream().flatMap( characteristic ->
characteristic.getDescriptions().stream() )
.map( LangStringMapper.DEFINITION::map )
.collect( Collectors.toList() );
final List<LangStringDefinitionTypeIec61360> definitionsProperty = property.getDescriptions().stream().map( LangStringMapper.DEFINITION::map ).toList();

final List<LangStringPreferredNameTypeIec61360> preferredNames = property.getPreferredNames().isEmpty() ?
Collections.singletonList( LangStringMapper.PREFERRED_NAME.createLangString( property.getName(), DEFAULT_LOCALE ) ) :
property.getPreferredNames().stream().map( LangStringMapper.PREFERRED_NAME::map ).collect( Collectors.toList() );

return new DefaultDataSpecificationIec61360.Builder()
.definition( definitions )
.definition( definitionsProperty )
.preferredName( preferredNames )
.shortName( LangStringMapper.SHORT_NAME.createLangString( property.getName(), DEFAULT_LOCALE ) )

.dataType( mapIEC61360DataType( property.getCharacteristic() ) )
.build();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ public Property mapToAasProperty( final Type type, final org.eclipse.esmf.metamo
.valueType( mapAASXSDataType( mapType( type ) ) )
.displayName( LangStringMapper.NAME.map( property.getPreferredNames() ) )
.value( context.getPropertyValue( UNKNOWN_EXAMPLE ) )
.description( LangStringMapper.TEXT.map( property.getDescriptions() ) )
.semanticID( buildReferenceToConceptDescription( property ) )
.build();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ public void testGeneration( final TestAspect testAspect ) throws IOException, De
}

@Test
void testGenerateAasxFRomAspectModelWithOperations () throws IOException, DeserializationException {
void testGenerateAasxFromAspectModelWithOperations () throws IOException, DeserializationException {
final Environment environment = getAssetAdministrationShellFromAspect( TestAspect.ASPECT_WITH_OPERATION );

List<SubmodelElement> operations = environment.getSubmodels().get( 0 ).getSubmodelElements();
Expand All @@ -335,6 +335,25 @@ void testGenerateAasxFRomAspectModelWithOperations () throws IOException, Deseri
assertEquals( 7, environment.getConceptDescriptions().size() );
}

@Test
void testGeneratedAasxFromAspectModelWithPropertiesWithDescriptions () throws IOException, DeserializationException {
final Environment environment = getAssetAdministrationShellFromAspect( TestAspect.ASPECT_WITH_PROPERTY_WITH_DESCRIPTIONS );

final Property property = (Property) environment.getSubmodels().get( 0 ).getSubmodelElements().get( 0 );

assertEquals( 1, environment.getSubmodels().get( 0 ).getSubmodelElements().size() );
assertEquals( 2, environment.getConceptDescriptions().size() );
assertEquals( 1, environment.getConceptDescriptions().get( 1 ).getEmbeddedDataSpecifications().size() );

final DataSpecificationIec61360 dataSpecificationIec61360 =
(DataSpecificationIec61360) environment.getConceptDescriptions().get( 1 ).getEmbeddedDataSpecifications().get( 0 ).getDataSpecificationContent();

assertThat( dataSpecificationIec61360.getDefinition().get( 1 ).getText() ).isEqualTo( "Test Description" );

assertThat( property.getDescription() ).isEmpty();

}

private void checkDataSpecificationIEC61360( final Set<String> semanticIds, final Environment env ) {
semanticIds.forEach( x -> getDataSpecificationIEC61360( x, env ) );
}
Expand Down

0 comments on commit 2e33ed6

Please sign in to comment.