Skip to content

Commit 8beea4c

Browse files
authored
Merge pull request #706 from bci-oss/705-diagram-generation-multiple-languages
Fix diagram generation in multiple languages
2 parents 3fe22c7 + 6d6224b commit 8beea4c

File tree

59 files changed

+858
-402
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+858
-402
lines changed

core/esmf-aspect-meta-model-interface/src/main/java/org/eclipse/esmf/metamodel/datatype/SammXsdType.java

-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
import java.util.Optional;
2121
import java.util.function.Function;
2222
import java.util.function.Predicate;
23-
2423
import javax.xml.datatype.DatatypeConfigurationException;
2524
import javax.xml.datatype.DatatypeFactory;
2625
import javax.xml.datatype.Duration;

core/esmf-aspect-meta-model-java/pom.xml

+38
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,44 @@
7979

8080
<build>
8181
<plugins>
82+
<plugin>
83+
<groupId>org.codehaus.mojo</groupId>
84+
<artifactId>build-helper-maven-plugin</artifactId>
85+
<executions>
86+
<execution>
87+
<id>add-shared-test-source</id>
88+
<phase>initialize</phase>
89+
<goals>
90+
<goal>add-test-source</goal>
91+
</goals>
92+
<configuration>
93+
<sources>
94+
<source>src/test-shared/java</source>
95+
</sources>
96+
</configuration>
97+
</execution>
98+
</executions>
99+
</plugin>
100+
101+
<plugin>
102+
<groupId>org.apache.maven.plugins</groupId>
103+
<artifactId>maven-jar-plugin</artifactId>
104+
<executions>
105+
<execution>
106+
<id>package-test-jar</id>
107+
<phase>package</phase>
108+
<configuration>
109+
<includes>
110+
<include>**/shared/**</include>
111+
</includes>
112+
</configuration>
113+
<goals>
114+
<goal>test-jar</goal>
115+
</goals>
116+
</execution>
117+
</executions>
118+
</plugin>
119+
82120
<!-- Disable surefire report plugin. The report is created in the esmf-sdk-test-report module -->
83121
<plugin>
84122
<groupId>org.apache.maven.plugins</groupId>

core/esmf-test-resources/src/test/java/org/eclipse/esmf/test/AssertTest.java core/esmf-aspect-meta-model-java/src/test-shared/java/org/eclipse/esmf/test/AssertTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
import static org.eclipse.esmf.metamodel.DataTypes.xsd;
1717
import static org.eclipse.esmf.metamodel.Elements.*;
1818
import static org.eclipse.esmf.metamodel.builder.SammBuilder.*;
19-
import static org.eclipse.esmf.test.AspectModelAsserts.assertThat;
19+
import static org.eclipse.esmf.test.shared.AspectModelAsserts.assertThat;
2020

2121
import java.util.Locale;
2222

core/esmf-test-resources/src/main/java/org/eclipse/esmf/test/AbstractCharacteristicAssert.java core/esmf-aspect-meta-model-java/src/test-shared/java/org/eclipse/esmf/test/shared/AbstractCharacteristicAssert.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* SPDX-License-Identifier: MPL-2.0
1212
*/
1313

14-
package org.eclipse.esmf.test;
14+
package org.eclipse.esmf.test.shared;
1515

1616
import static org.assertj.core.api.Assertions.assertThat;
1717
import static org.assertj.core.error.OptionalShouldBePresent.shouldBePresent;

core/esmf-test-resources/src/main/java/org/eclipse/esmf/test/AbstractComplexTypeAssert.java core/esmf-aspect-meta-model-java/src/test-shared/java/org/eclipse/esmf/test/shared/AbstractComplexTypeAssert.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* SPDX-License-Identifier: MPL-2.0
1212
*/
1313

14-
package org.eclipse.esmf.test;
14+
package org.eclipse.esmf.test.shared;
1515

1616
import static org.assertj.core.api.Assertions.assertThat;
1717

core/esmf-test-resources/src/main/java/org/eclipse/esmf/test/AbstractEntityAssert.java core/esmf-aspect-meta-model-java/src/test-shared/java/org/eclipse/esmf/test/shared/AbstractEntityAssert.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* SPDX-License-Identifier: MPL-2.0
1212
*/
1313

14-
package org.eclipse.esmf.test;
14+
package org.eclipse.esmf.test.shared;
1515

1616
import org.eclipse.esmf.metamodel.AbstractEntity;
1717
import org.eclipse.esmf.metamodel.Entity;

core/esmf-test-resources/src/main/java/org/eclipse/esmf/test/AbstractHasDescriptionAssert.java core/esmf-aspect-meta-model-java/src/test-shared/java/org/eclipse/esmf/test/shared/AbstractHasDescriptionAssert.java

+28-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111
* SPDX-License-Identifier: MPL-2.0
1212
*/
1313

14-
package org.eclipse.esmf.test;
14+
package org.eclipse.esmf.test.shared;
15+
16+
import static org.assertj.core.api.Assertions.assertThat;
1517

1618
import java.util.Locale;
1719
import java.util.function.Predicate;
@@ -20,6 +22,7 @@
2022
import org.eclipse.esmf.metamodel.datatype.LangString;
2123

2224
import org.assertj.core.api.AbstractAssert;
25+
import org.assertj.core.api.AbstractStringAssert;
2326
import org.assertj.core.api.ListAssert;
2427

2528
/**
@@ -36,6 +39,20 @@ protected AbstractHasDescriptionAssert( final ACTUAL actual, final Class<?> self
3639
super( actual, selfType );
3740
}
3841

42+
public SELF hasName( final String name ) {
43+
assertThat( actual.getName() ).isEqualTo( name );
44+
return myself;
45+
}
46+
47+
public AbstractStringAssert<?> name() {
48+
return assertThat( actual.getName() );
49+
}
50+
51+
public SELF hasNoPreferredName() {
52+
preferredNames().isEmpty();
53+
return myself;
54+
}
55+
3956
public SELF hasPreferredName( final LangString langString ) {
4057
return hasPreferredNameMatching( langString::equals );
4158
}
@@ -53,6 +70,11 @@ public SELF hasPreferredNameMatching( final Predicate<LangString> predicate ) {
5370
return myself;
5471
}
5572

73+
public SELF hasNoDescription() {
74+
descriptions().isEmpty();
75+
return myself;
76+
}
77+
5678
public SELF hasDescription( final LangString langString ) {
5779
return hasDescriptionMatching( langString::equals );
5880
}
@@ -70,6 +92,11 @@ public SELF hasDescriptionMatching( final Predicate<LangString> predicate ) {
7092
return myself;
7193
}
7294

95+
public SELF hasNoSee() {
96+
see().isEmpty();
97+
return myself;
98+
}
99+
73100
public SELF hasSee( final String seeReference ) {
74101
return hasSeeMatching( seeReference::equals );
75102
}

core/esmf-test-resources/src/main/java/org/eclipse/esmf/test/AspectAssert.java core/esmf-aspect-meta-model-java/src/test-shared/java/org/eclipse/esmf/test/shared/AspectAssert.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2024 Robert Bosch Manufacturing Solutions GmbH
2+
* Copyright (c) 2025 Robert Bosch Manufacturing Solutions GmbH
33
*
44
* See the AUTHORS file(s) distributed with this work for additional
55
* information regarding authorship.
@@ -11,7 +11,7 @@
1111
* SPDX-License-Identifier: MPL-2.0
1212
*/
1313

14-
package org.eclipse.esmf.test;
14+
package org.eclipse.esmf.test.shared;
1515

1616
import static org.assertj.core.api.Assertions.assertThat;
1717

core/esmf-test-resources/src/main/java/org/eclipse/esmf/test/AspectModelAssert.java core/esmf-aspect-meta-model-java/src/test-shared/java/org/eclipse/esmf/test/shared/AspectModelAssert.java

+42-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2024 Robert Bosch Manufacturing Solutions GmbH
2+
* Copyright (c) 2025 Robert Bosch Manufacturing Solutions GmbH
33
*
44
* See the AUTHORS file(s) distributed with this work for additional
55
* information regarding authorship.
@@ -11,7 +11,7 @@
1111
* SPDX-License-Identifier: MPL-2.0
1212
*/
1313

14-
package org.eclipse.esmf.test;
14+
package org.eclipse.esmf.test.shared;
1515

1616
import static org.assertj.core.api.Assertions.assertThat;
1717
import static org.assertj.core.api.Fail.fail;
@@ -51,6 +51,16 @@ public <S extends AspectAssert<S, A>, A extends Aspect> AspectAssert<S, A> hasSi
5151
return new AspectAssert<>( (A) actual.aspect() );
5252
}
5353

54+
public SELF hasAtLeastOneAspect() {
55+
aspects().isNotEmpty();
56+
return myself;
57+
}
58+
59+
public SELF hasNoAspects() {
60+
aspects().isEmpty();
61+
return myself;
62+
}
63+
5464
public ListAssert<Aspect> aspects() {
5565
return assertThat( actual.aspects() );
5666
}
@@ -63,10 +73,30 @@ public <S extends AspectModelFileAssert<S, A>, A extends AspectModelFile> Aspect
6373
return new AspectModelFileAssert<>( (A) actual.files().get( 0 ) );
6474
}
6575

76+
public SELF hasAtLeastOneFile() {
77+
files().isNotEmpty();
78+
return myself;
79+
}
80+
81+
public SELF hasNoFiles() {
82+
files().isEmpty();
83+
return myself;
84+
}
85+
6686
public ListAssert<AspectModelFile> files() {
6787
return assertThat( actual.files() );
6888
}
6989

90+
public SELF hasAtLeastOneElement() {
91+
elements().isNotEmpty();
92+
return myself;
93+
}
94+
95+
public SELF hasNoElements() {
96+
elements().isEmpty();
97+
return myself;
98+
}
99+
70100
public ListAssert<ModelElement> elements() {
71101
return assertThat( actual.elements() );
72102
}
@@ -98,6 +128,16 @@ public <S extends NamespaceAssert<S, A>, A extends Namespace> NamespaceAssert<S,
98128
return new NamespaceAssert<>( (A) actual.namespaces().get( 0 ) );
99129
}
100130

131+
public SELF hasAtLeastOneNamespace() {
132+
namespaces().isNotEmpty();
133+
return myself;
134+
}
135+
136+
public SELF hasNoNamespaces() {
137+
namespaces().isEmpty();
138+
return myself;
139+
}
140+
101141
public ListAssert<Namespace> namespaces() {
102142
return assertThat( actual.namespaces() );
103143
}

core/esmf-test-resources/src/main/java/org/eclipse/esmf/test/AspectModelAsserts.java core/esmf-aspect-meta-model-java/src/test-shared/java/org/eclipse/esmf/test/shared/AspectModelAsserts.java

+62-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2024 Robert Bosch Manufacturing Solutions GmbH
2+
* Copyright (c) 2025 Robert Bosch Manufacturing Solutions GmbH
33
*
44
* See the AUTHORS file(s) distributed with this work for additional
55
* information regarding authorship.
@@ -11,7 +11,7 @@
1111
* SPDX-License-Identifier: MPL-2.0
1212
*/
1313

14-
package org.eclipse.esmf.test;
14+
package org.eclipse.esmf.test.shared;
1515

1616
import org.eclipse.esmf.aspectmodel.AspectModelFile;
1717
import org.eclipse.esmf.aspectmodel.urn.AspectModelUrn;
@@ -28,6 +28,7 @@
2828
import org.eclipse.esmf.metamodel.Namespace;
2929
import org.eclipse.esmf.metamodel.Operation;
3030
import org.eclipse.esmf.metamodel.Property;
31+
import org.eclipse.esmf.metamodel.QuantityKind;
3132
import org.eclipse.esmf.metamodel.Scalar;
3233
import org.eclipse.esmf.metamodel.ScalarValue;
3334
import org.eclipse.esmf.metamodel.Type;
@@ -56,6 +57,7 @@
5657
import org.eclipse.esmf.metamodel.constraint.RegularExpressionConstraint;
5758

5859
import org.apache.jena.rdf.model.Model;
60+
import org.assertj.core.api.InstanceOfAssertFactory;
5961

6062
/**
6163
* Convenience wrapper for the construction of all SAMM-related assertsThat() methods. Intended use is by
@@ -188,6 +190,14 @@ public static <SELF extends AspectModelAssert<SELF, ACTUAL>, ACTUAL extends Aspe
188190
return new PropertyAssert<>( property );
189191
}
190192

193+
@SuppressWarnings( "IncorrectFormatting" )
194+
//@formatter:off
195+
public static <SELF extends QuantityKindAssert<SELF, ACTUAL>, ACTUAL extends QuantityKind> QuantityKindAssert<SELF, ACTUAL>
196+
assertThat( final ACTUAL quantityKind ) {
197+
//@formatter:on
198+
return new QuantityKindAssert<>( quantityKind );
199+
}
200+
191201
@SuppressWarnings( "IncorrectFormatting" )
192202
//@formatter:off
193203
public static <SELF extends ScalarAssert<SELF, ACTUAL>, ACTUAL extends Scalar> ScalarAssert<SELF, ACTUAL>
@@ -391,4 +401,54 @@ ConstraintAssert.FixedPointConstraintAssert<SELF, ACTUAL> assertThat( final ACTU
391401
//@formatter:on
392402
return new ConstraintAssert.FixedPointConstraintAssert<>( element );
393403
}
404+
405+
// Assertion factories that are required when asserts for collections should be chained with their actual type, e.g.:
406+
// assertThat( aspectModel ).namespaces().first( as( NAMESPACE ) ).hasName( "urn:samm:org.eclipse.esmf.test:1.0.0" );
407+
// Without the InstanceOfAssertFactory, first() on a ListAssert would only provide a generic ObjectAssert;
408+
// with it the result of first() is an actual NamespaceAssert.
409+
410+
public static final InstanceOfAssertFactory<AbstractEntity, AbstractEntityAssert<?, ?>> ABSTRACT_ENTITY =
411+
new InstanceOfAssertFactory<>( AbstractEntity.class, AspectModelAsserts::assertThat );
412+
public static final InstanceOfAssertFactory<Aspect, AspectAssert<?, ?>> ASPECT =
413+
new InstanceOfAssertFactory<>( Aspect.class, AspectModelAsserts::assertThat );
414+
public static final InstanceOfAssertFactory<AspectModel, AspectModelAssert<?, ?>> ASPECT_MODEL =
415+
new InstanceOfAssertFactory<>( AspectModel.class, AspectModelAsserts::assertThat );
416+
public static final InstanceOfAssertFactory<AspectModelFile, AspectModelFileAssert<?, ?>> ASPECT_MODEL_FILE =
417+
new InstanceOfAssertFactory<>( AspectModelFile.class, AspectModelAsserts::assertThat );
418+
public static final InstanceOfAssertFactory<AspectModelUrn, AspectModelUrnAssert<?, ?>> ASPECT_MODEL_URN =
419+
new InstanceOfAssertFactory<>( AspectModelUrn.class, AspectModelAsserts::assertThat );
420+
public static final InstanceOfAssertFactory<Characteristic, CharacteristicAssert<?, ?>> CHARACTERISTIC =
421+
new InstanceOfAssertFactory<>( Characteristic.class, AspectModelAsserts::assertThat );
422+
public static final InstanceOfAssertFactory<CollectionValue, CollectionValueAssert<?, ?>> COLLECTION_VALUE =
423+
new InstanceOfAssertFactory<>( CollectionValue.class, AspectModelAsserts::assertThat );
424+
public static final InstanceOfAssertFactory<Constraint, ConstraintAssert<?, ?>> CONSTRAINT =
425+
new InstanceOfAssertFactory<>( Constraint.class, AspectModelAsserts::assertThat );
426+
public static final InstanceOfAssertFactory<Entity, EntityAssert<?, ?>> ENTITY =
427+
new InstanceOfAssertFactory<>( Entity.class, AspectModelAsserts::assertThat );
428+
public static final InstanceOfAssertFactory<EntityInstance, EntityInstanceAssert<?, ?>> ENTITY_INSTANCE =
429+
new InstanceOfAssertFactory<>( EntityInstance.class, AspectModelAsserts::assertThat );
430+
public static final InstanceOfAssertFactory<Event, EventAssert<?, ?>> EVENT =
431+
new InstanceOfAssertFactory<>( Event.class, AspectModelAsserts::assertThat );
432+
public static final InstanceOfAssertFactory<Model, ModelAssert<?, ?>> MODEL =
433+
new InstanceOfAssertFactory<>( Model.class, AspectModelAsserts::assertThat );
434+
public static final InstanceOfAssertFactory<ModelElement, ModelElementAssert<?, ?>> MODEL_ELEMENT =
435+
new InstanceOfAssertFactory<>( ModelElement.class, AspectModelAsserts::assertThat );
436+
public static final InstanceOfAssertFactory<Namespace, NamespaceAssert<?, ?>> NAMESPACE =
437+
new InstanceOfAssertFactory<>( Namespace.class, AspectModelAsserts::assertThat );
438+
public static final InstanceOfAssertFactory<Operation, OperationAssert<?, ?>> OPERATION =
439+
new InstanceOfAssertFactory<>( Operation.class, AspectModelAsserts::assertThat );
440+
public static final InstanceOfAssertFactory<Property, PropertyAssert<?, ?>> PROPERTY =
441+
new InstanceOfAssertFactory<>( Property.class, AspectModelAsserts::assertThat );
442+
public static final InstanceOfAssertFactory<QuantityKind, QuantityKindAssert<?, ?>> QUANTITY_KIND =
443+
new InstanceOfAssertFactory<>( QuantityKind.class, AspectModelAsserts::assertThat );
444+
public static final InstanceOfAssertFactory<Scalar, ScalarAssert<?, ?>> SCALAR =
445+
new InstanceOfAssertFactory<>( Scalar.class, AspectModelAsserts::assertThat );
446+
public static final InstanceOfAssertFactory<ScalarValue, ScalarValueAssert<?, ?>> SCALAR_VALUE =
447+
new InstanceOfAssertFactory<>( ScalarValue.class, AspectModelAsserts::assertThat );
448+
public static final InstanceOfAssertFactory<Type, TypeAssert<?, ?>> TYPE =
449+
new InstanceOfAssertFactory<>( Type.class, AspectModelAsserts::assertThat );
450+
public static final InstanceOfAssertFactory<Unit, UnitAssert<?, ?>> UNIT =
451+
new InstanceOfAssertFactory<>( Unit.class, AspectModelAsserts::assertThat );
452+
public static final InstanceOfAssertFactory<Value, ValueAssert<?, ?>> VALUE =
453+
new InstanceOfAssertFactory<>( Value.class, AspectModelAsserts::assertThat );
394454
}

core/esmf-test-resources/src/main/java/org/eclipse/esmf/test/AspectModelFileAssert.java core/esmf-aspect-meta-model-java/src/test-shared/java/org/eclipse/esmf/test/shared/AspectModelFileAssert.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2024 Robert Bosch Manufacturing Solutions GmbH
2+
* Copyright (c) 2025 Robert Bosch Manufacturing Solutions GmbH
33
*
44
* See the AUTHORS file(s) distributed with this work for additional
55
* information regarding authorship.
@@ -11,7 +11,7 @@
1111
* SPDX-License-Identifier: MPL-2.0
1212
*/
1313

14-
package org.eclipse.esmf.test;
14+
package org.eclipse.esmf.test.shared;
1515

1616
import static org.assertj.core.api.Assertions.assertThat;
1717

core/esmf-test-resources/src/main/java/org/eclipse/esmf/test/AspectModelUrnAssert.java core/esmf-aspect-meta-model-java/src/test-shared/java/org/eclipse/esmf/test/shared/AspectModelUrnAssert.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2024 Robert Bosch Manufacturing Solutions GmbH
2+
* Copyright (c) 2025 Robert Bosch Manufacturing Solutions GmbH
33
*
44
* See the AUTHORS file(s) distributed with this work for additional
55
* information regarding authorship.
@@ -11,7 +11,7 @@
1111
* SPDX-License-Identifier: MPL-2.0
1212
*/
1313

14-
package org.eclipse.esmf.test;
14+
package org.eclipse.esmf.test.shared;
1515

1616
import static org.assertj.core.api.Assertions.assertThat;
1717

0 commit comments

Comments
 (0)