29
29
import javax .xml .datatype .DatatypeFactory ;
30
30
import javax .xml .datatype .XMLGregorianCalendar ;
31
31
32
- import org .junit .jupiter .params .ParameterizedTest ;
33
- import org .junit .jupiter .params .provider .EnumSource ;
34
- import org .junit .jupiter .params .provider .MethodSource ;
35
-
36
- import com .github .javaparser .ast .CompilationUnit ;
37
- import com .google .common .collect .ImmutableMap ;
38
- import com .google .common .reflect .TypeToken ;
39
-
40
- import org .eclipse .esmf .samm .KnownVersion ;
41
- import org .eclipse .esmf .metamodel .datatypes .Curie ;
42
- import org .eclipse .esmf .metamodel .impl .DefaultCharacteristic ;
43
32
import org .eclipse .esmf .characteristic .impl .DefaultList ;
44
33
import org .eclipse .esmf .characteristic .impl .DefaultMeasurement ;
34
+ import org .eclipse .esmf .metamodel .datatypes .Curie ;
35
+ import org .eclipse .esmf .metamodel .impl .DefaultCharacteristic ;
36
+ import org .eclipse .esmf .samm .KnownVersion ;
45
37
import org .eclipse .esmf .staticmetamodel .StaticContainerProperty ;
46
38
import org .eclipse .esmf .staticmetamodel .StaticProperty ;
47
39
import org .eclipse .esmf .staticmetamodel .StaticUnitProperty ;
48
40
import org .eclipse .esmf .staticmetamodel .constraint .StaticConstraintContainerProperty ;
49
41
import org .eclipse .esmf .staticmetamodel .constraint .StaticConstraintProperty ;
50
42
import org .eclipse .esmf .test .TestAspect ;
51
43
import org .eclipse .esmf .test .TestSharedAspect ;
44
+ import org .junit .jupiter .params .ParameterizedTest ;
45
+ import org .junit .jupiter .params .provider .EnumSource ;
46
+ import org .junit .jupiter .params .provider .MethodSource ;
47
+
48
+ import com .github .javaparser .ast .CompilationUnit ;
49
+ import com .google .common .collect .ImmutableMap ;
50
+ import com .google .common .reflect .TypeToken ;
52
51
53
52
public class StaticMetaModelJavaGeneratorTest extends StaticMetaModelGeneratorTest {
54
53
@@ -83,7 +82,7 @@ ImmutableMap.<String, Object> builder().put( "NAMESPACE", String.class ).put( "M
83
82
.put ( "CHARACTERISTIC_NAMESPACE" , String .class ).put ( "INSTANCE" , "MetaAspectWithOptionalPropertiesWithEntity" )
84
83
.put ( "TEST_STRING" , new TypeToken <StaticProperty <String >>() {
85
84
} ).put ( "TEST_OPTIONAL_STRING" , new TypeToken <StaticContainerProperty <String , Optional <String >>>() {
86
- } ).put ( "TEST_OPTIONAL_ENTITY" , "StaticContainerProperty<TestEntity,java.util.Optional<TestEntity>>" ).build (), new HashMap <>() );
85
+ } ).put ( "TEST_OPTIONAL_ENTITY" , "StaticContainerProperty<TestEntity, java.util.Optional<TestEntity>>" ).build (), new HashMap <>() );
87
86
88
87
result .assertFields ( "MetaTestEntity" , ImmutableMap .<String , Object > builder ().put ( "NAMESPACE" , String .class ).put ( "MODEL_ELEMENT_URN" , String .class )
89
88
.put ( "CHARACTERISTIC_NAMESPACE" , String .class ).put ( "INSTANCE" , "MetaTestEntity" )
@@ -125,7 +124,7 @@ public void testGenerateStaticMetaModelWithEither( final KnownVersion metaModelV
125
124
result .assertFields ( "MetaAspectWithEitherWithComplexTypes" ,
126
125
ImmutableMap .<String , Object > builder ().put ( "NAMESPACE" , String .class ).put ( "MODEL_ELEMENT_URN" , String .class )
127
126
.put ( "CHARACTERISTIC_NAMESPACE" , String .class ).put ( "INSTANCE" , "MetaAspectWithEitherWithComplexTypes" )
128
- .put ( "TEST_PROPERTY" , "StaticProperty<Either<LeftEntity,RightEntity>>" ).build (), new HashMap <>() );
127
+ .put ( "TEST_PROPERTY" , "StaticProperty<Either<LeftEntity, RightEntity>>" ).build (), new HashMap <>() );
129
128
130
129
result .assertFields ( "MetaLeftEntity" , ImmutableMap .<String , Object > builder ().put ( "NAMESPACE" , String .class ).put ( "MODEL_ELEMENT_URN" , String .class )
131
130
.put ( "CHARACTERISTIC_NAMESPACE" , String .class ).put ( "INSTANCE" , "MetaLeftEntity" ).put ( "RESULT" , new TypeToken <StaticProperty <String >>() {
@@ -158,7 +157,7 @@ public void testGenerateStaticMetaModelWithMeasurementTwo( final KnownVersion me
158
157
result .assertFields ( "MetaAspectWithExtendedEntity" ,
159
158
ImmutableMap .<String , Object > builder ().put ( "NAMESPACE" , String .class ).put ( "MODEL_ELEMENT_URN" , String .class )
160
159
.put ( "CHARACTERISTIC_NAMESPACE" , String .class ).put ( "INSTANCE" , "MetaAspectWithExtendedEntity" )
161
- .put ( "TEST_PROPERTY" , "StaticContainerProperty<TestEntity,java.util.LinkedHashSet<TestEntity>>" ).build (), new HashMap <>() );
160
+ .put ( "TEST_PROPERTY" , "StaticContainerProperty<TestEntity, java.util.LinkedHashSet<TestEntity>>" ).build (), new HashMap <>() );
162
161
}
163
162
164
163
@ ParameterizedTest
@@ -173,7 +172,7 @@ ImmutableMap.<String, Object> builder().put( "NAMESPACE", String.class ).put( "M
173
172
.put ( "TEST_PROPERTY" , "StaticProperty<TestEntity>" ).build (), new HashMap <>() );
174
173
result .assertFields ( "MetaTestEntity" , ImmutableMap .<String , Object > builder ().put ( "NAMESPACE" , String .class ).put ( "MODEL_ELEMENT_URN" , String .class )
175
174
.put ( "CHARACTERISTIC_NAMESPACE" , String .class ).put ( "INSTANCE" , "MetaTestEntity" )
176
- .put ( "TEST_PROPERTY" , "StaticContainerProperty<TestEntity,java.util.Optional<TestEntity>>" ).build (), new HashMap <>() );
175
+ .put ( "TEST_PROPERTY" , "StaticContainerProperty<TestEntity, java.util.Optional<TestEntity>>" ).build (), new HashMap <>() );
177
176
}
178
177
179
178
@ ParameterizedTest
@@ -317,7 +316,7 @@ public void testGenerateStaticMetaModelWithErrorCollection( final KnownVersion m
317
316
result .assertFields ( "MetaAspectWithErrorCollection" ,
318
317
ImmutableMap .<String , Object > builder ().put ( "NAMESPACE" , String .class ).put ( "MODEL_ELEMENT_URN" , String .class )
319
318
.put ( "CHARACTERISTIC_NAMESPACE" , String .class ).put ( "INSTANCE" , "MetaAspectWithErrorCollection" )
320
- .put ( "ITEMS" , "StaticContainerProperty<Error,java.util.Collection<Error>>" ).put ( "_datatypeFactory" , DatatypeFactory .class ).build (),
319
+ .put ( "ITEMS" , "StaticContainerProperty<Error, java.util.Collection<Error>>" ).put ( "_datatypeFactory" , DatatypeFactory .class ).build (),
321
320
new HashMap <>() );
322
321
}
323
322
@@ -331,7 +330,7 @@ public void testGenerateStaticMetaModelWithCollectionAndSimpleElementCharacteris
331
330
result .assertFields ( "MetaAspectWithCollectionAndSimpleElementCharacteristic" ,
332
331
ImmutableMap .<String , Object > builder ().put ( "NAMESPACE" , String .class ).put ( "MODEL_ELEMENT_URN" , String .class )
333
332
.put ( "CHARACTERISTIC_NAMESPACE" , String .class ).put ( "INSTANCE" , "MetaAspectWithCollectionAndSimpleElementCharacteristic" )
334
- .put ( "ITEMS" , "StaticContainerProperty<String,java.util.Collection<String>>" ).build (), new HashMap <>() );
333
+ .put ( "ITEMS" , "StaticContainerProperty<String, java.util.Collection<String>>" ).build (), new HashMap <>() );
335
334
}
336
335
337
336
@ ParameterizedTest
@@ -344,7 +343,7 @@ public void testGenerateStaticMetaModelWithCollectionAndElementCharacteristic( f
344
343
result .assertFields ( "MetaAspectWithCollectionAndElementCharacteristic" ,
345
344
ImmutableMap .<String , Object > builder ().put ( "NAMESPACE" , String .class ).put ( "MODEL_ELEMENT_URN" , String .class )
346
345
.put ( "CHARACTERISTIC_NAMESPACE" , String .class ).put ( "INSTANCE" , "MetaAspectWithCollectionAndElementCharacteristic" )
347
- .put ( "ITEMS" , "StaticContainerProperty<TestEntity,java.util.Collection<TestEntity>>" ).build (), new HashMap <>() );
346
+ .put ( "ITEMS" , "StaticContainerProperty<TestEntity, java.util.Collection<TestEntity>>" ).build (), new HashMap <>() );
348
347
}
349
348
350
349
@ ParameterizedTest
@@ -375,7 +374,7 @@ ImmutableMap.<String, Object> builder().put( "NAMESPACE", String.class ).put( "M
375
374
376
375
result .assertFields ( "MetaMyEntityOne" , ImmutableMap .<String , Object > builder ().put ( "NAMESPACE" , String .class ).put ( "MODEL_ELEMENT_URN" , String .class )
377
376
.put ( "CHARACTERISTIC_NAMESPACE" , String .class ).put ( "INSTANCE" , "MetaMyEntityOne" )
378
- .put ( "ENTITY_PROPERTY_ONE" , "StaticContainerProperty<MyEntityTwo,java.util.List<MyEntityTwo>>" ).build (), new HashMap <>() );
377
+ .put ( "ENTITY_PROPERTY_ONE" , "StaticContainerProperty<MyEntityTwo, java.util.List<MyEntityTwo>>" ).build (), new HashMap <>() );
379
378
380
379
result .assertFields ( "MetaMyEntityTwo" , ImmutableMap .<String , Object > builder ().put ( "NAMESPACE" , String .class ).put ( "MODEL_ELEMENT_URN" , String .class )
381
380
.put ( "CHARACTERISTIC_NAMESPACE" , String .class ).put ( "INSTANCE" , "MetaMyEntityTwo" ).put ( "ENTITY_PROPERTY_TWO" , "StaticProperty<String>" )
@@ -501,12 +500,12 @@ public void testGenerateStaticMetaModelForAspectModelWithCollectionWithAbstractE
501
500
result .assertNumberOfFiles ( 6 );
502
501
503
502
final String expectedTestPropertyCharacteristicConstructorCall =
504
- "new DefaultCollection(MetaModelBaseAttributes.builderFor(\" EntityCollectionCharacteristic\" ).withMetaModelVersion(KnownVersion.SAMM_2_0_0)"
505
- + ".withUrn(AspectModelUrn.fromUrn(NAMESPACE + \" EntityCollectionCharacteristic\" )).withDescription(Locale.forLanguageTag(\" en\" ), "
506
- + "\" This is an entity collection characteristic\" ).build(), Optional.of(DefaultAbstractEntity.createDefaultAbstractEntity("
507
- + "MetaModelBaseAttributes.builderFor(\" AbstractTestEntity\" ).withMetaModelVersion(KnownVersion.SAMM_2_0_0).withUrn("
508
- + "AspectModelUrn.fromUrn(NAMESPACE + \" AbstractTestEntity\" )).withDescription(Locale.forLanguageTag(\" en\" ), "
509
- + "\" This is an abstract test entity\" ).build(), MetaAbstractTestEntity.INSTANCE.getProperties(), Optional.empty(), "
503
+ "new DefaultCollection(MetaModelBaseAttributes.builderFor(\" EntityCollectionCharacteristic\" ).withMetaModelVersion(KnownVersion.SAMM_2_0_0)"
504
+ + ".withUrn(AspectModelUrn.fromUrn(NAMESPACE + \" EntityCollectionCharacteristic\" )).withDescription(Locale.forLanguageTag(\" en\" ), "
505
+ + "\" This is an entity collection characteristic\" ).build(), Optional.of(DefaultAbstractEntity.createDefaultAbstractEntity("
506
+ + "MetaModelBaseAttributes.builderFor(\" AbstractTestEntity\" ).withMetaModelVersion(KnownVersion.SAMM_2_0_0).withUrn("
507
+ + "AspectModelUrn.fromUrn(NAMESPACE + \" AbstractTestEntity\" )).withDescription(Locale.forLanguageTag(\" en\" ), "
508
+ + "\" This is an abstract test entity\" ).build(), MetaAbstractTestEntity.INSTANCE.getProperties(), Optional.empty(), "
510
509
+ "List.of(AspectModelUrn.fromUrn(\" urn:samm:org.eclipse.esmf.test:1.0.0#ExtendingTestEntity\" )))), Optional.empty())" ;
511
510
512
511
result .assertConstructorArgumentForProperties ( "MetaAspectWithCollectionWithAbstractEntity" ,
0 commit comments