Skip to content

Commit 0a17cea

Browse files
committed
Merge branch 'main' into 2.10.x
2 parents bc18f59 + 1374bbf commit 0a17cea

File tree

7 files changed

+24
-14
lines changed

7 files changed

+24
-14
lines changed

core/esmf-aspect-meta-model-java/src/main/java/org/eclipse/esmf/aspectmodel/loader/Instantiator.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,10 +164,9 @@ protected Value buildValue( final RDFNode node, final Optional<Resource> charact
164164
}
165165

166166
if ( node.isResource() ) {
167-
Resource resource = node.asResource();
168-
167+
final Resource resource = node.asResource();
169168
if ( resource.hasProperty( RDF.type, SammNs.SAMM.Value() ) ) {
170-
Optional<String> valueOpt = optionalAttributeValue( resource, SammNs.SAMM.value() ).map( Statement::getString );
169+
final Optional<String> valueOpt = optionalAttributeValue( resource, SammNs.SAMM.value() ).map( Statement::getString );
171170

172171
if ( valueOpt.isEmpty() ) {
173172
throw new AspectLoadingException( "samm:Value must contain a samm:value property" );

core/esmf-aspect-meta-model-java/src/main/java/org/eclipse/esmf/aspectmodel/loader/instantiator/ScalarValueInstantiator.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
import org.apache.jena.rdf.model.Resource;
1111

1212
public class ScalarValueInstantiator extends Instantiator<ScalarValue> {
13-
1413
public ScalarValueInstantiator( final ModelElementFactory modelElementFactory ) {
1514
super( modelElementFactory, ScalarValue.class );
1615
}

core/esmf-aspect-meta-model-java/src/main/java/org/eclipse/esmf/metamodel/impl/DefaultScalarValue.java

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,9 @@ public Set<LangString> getDescriptions() {
6262
return metaModelBaseAttributes.getDescriptions();
6363
}
6464

65-
/**
66-
* Similar to {@link DefaultScalar#getSourceFile()}, scalar values are not defined in Aspect Model files, so this returns null.
67-
*
68-
* @return null
69-
*/
7065
@Override
7166
public AspectModelFile getSourceFile() {
72-
return null;
67+
return metaModelBaseAttributes.getSourceFile();
7368
}
7469

7570
@Override
@@ -90,7 +85,7 @@ public int compareTo( final ScalarValue other ) {
9085

9186
@SuppressWarnings( "unchecked" )
9287
private <T extends Comparable<T>> int compareTo( final Object value1, final Object value2 ) {
93-
return ((T) value1).compareTo( (T) value2 );
88+
return ( (T) value1 ).compareTo( (T) value2 );
9489
}
9590

9691
@Override

core/esmf-aspect-meta-model-java/src/test/java/org/eclipse/esmf/aspectmodel/loader/AspectModelLoaderTest.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import org.eclipse.esmf.metamodel.AbstractEntity;
3030
import org.eclipse.esmf.metamodel.AspectModel;
3131
import org.eclipse.esmf.metamodel.ComplexType;
32+
import org.eclipse.esmf.metamodel.ModelElement;
3233
import org.eclipse.esmf.metamodel.vocabulary.SammNs;
3334
import org.eclipse.esmf.test.InvalidTestAspect;
3435
import org.eclipse.esmf.test.TestAspect;
@@ -38,8 +39,23 @@
3839
import org.apache.jena.rdf.model.Resource;
3940
import org.apache.jena.rdf.model.Statement;
4041
import org.junit.jupiter.api.Test;
42+
import org.junit.jupiter.params.ParameterizedTest;
43+
import org.junit.jupiter.params.provider.EnumSource;
4144

4245
class AspectModelLoaderTest {
46+
@ParameterizedTest
47+
@EnumSource( value = TestAspect.class )
48+
void testLoadAspectModelsSourceFilesArePresent( final TestAspect testAspect ) {
49+
final AspectModel aspectModel = TestResources.load( testAspect );
50+
for ( final ModelElement element : aspectModel.elements() ) {
51+
assertThat( element.getSourceFile() )
52+
.describedAs( "Element %s has no source file", element ).isNotNull();
53+
assertThat( element.getSourceFile() )
54+
.describedAs( "Source file %s must contain defintion for %s", element.getSourceFile(), element.urn() )
55+
.elements().contains( element );
56+
}
57+
}
58+
4359
@Test
4460
void loadAspectModelWithoutCharacteristicDatatype() {
4561
assertThatThrownBy( () -> TestResources.load( InvalidTestAspect.INVALID_CHARACTERISTIC_DATATYPE ) )

core/esmf-aspect-model-document-generators/src/main/java/org/eclipse/esmf/aspectmodel/generator/json/AspectModelJsonPayloadGenerator.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
import java.util.function.BiFunction;
3737
import java.util.function.Supplier;
3838
import java.util.stream.Stream;
39-
4039
import javax.xml.datatype.DatatypeFactory;
4140
import javax.xml.datatype.Duration;
4241
import javax.xml.datatype.XMLGregorianCalendar;

core/esmf-aspect-model-document-generators/src/test/java/org/eclipse/esmf/aspectmodel/generator/json/AspectModelJsonPayloadGeneratorTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
import java.util.stream.IntStream;
3838
import java.util.stream.LongStream;
3939
import java.util.stream.Stream;
40-
4140
import javax.xml.datatype.DatatypeConfigurationException;
4241
import javax.xml.datatype.DatatypeFactory;
4342

tools/esmf-aspect-model-maven-plugin/pom.xml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@
6060
<artifactId>record-builder-processor</artifactId>
6161
<scope>provided</scope>
6262
</dependency>
63-
6463
<dependency>
6564
<groupId>org.eclipse.esmf</groupId>
6665
<artifactId>esmf-aspect-model-starter</artifactId>
@@ -69,6 +68,10 @@
6968
<groupId>org.eclipse.esmf</groupId>
7069
<artifactId>esmf-aspect-model-github-resolver</artifactId>
7170
</dependency>
71+
<dependency>
72+
<groupId>org.apache.commons</groupId>
73+
<artifactId>commons-lang3</artifactId>
74+
</dependency>
7275

7376
<dependency>
7477
<groupId>org.apache.maven.plugin-testing</groupId>

0 commit comments

Comments
 (0)