Skip to content

Commit fc94b31

Browse files
committed
Updated tests to load the Base library model from a file.
1 parent 84136aa commit fc94b31

11 files changed

Lines changed: 239 additions & 104 deletions
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
package Base {
2+
3+
/*
4+
* Anything is the top level generalized type in the language.
5+
*/
6+
abstract Class Anything;
7+
8+
/*
9+
* Object is the most general class of individuals with reference identity.
10+
*/
11+
abstract class Object specializes Anything;
12+
13+
/*
14+
* Value is the most general class of individuals with value identity.
15+
* EnumeratedValue is a specialization that is the most general class for enumerated values.
16+
*/
17+
abstract datatype Value specializes Anything;
18+
abstract datatype EnumeratedValue specializes Value;
19+
20+
/*
21+
* Link is the most general association between two or more things.
22+
* (It is actually class, not an association, because an association
23+
* must have a specific number of ends.)
24+
*/
25+
class Link specializes Object {
26+
feature participant: Anything[2..*] ordered;
27+
}
28+
29+
/*
30+
* BinaryLink is the most general binary association between exactly two things,
31+
* nominally directed from source to target.
32+
*/
33+
assoc BinaryLink specializes Link {
34+
end sourceEnd: Anything[0..*];
35+
end targetEnd: Anything[0..*];
36+
37+
feature participant: Anything[2] redefines Link::participant;
38+
39+
feature sourceParticipant: Anything[1..1] subsets participant = participant[1];
40+
feature targetParticipant: Anything[1..1] subsets participant = participant[2];
41+
42+
private connector linkage: BinaryLink is sourceParticipant to targetParticipant;
43+
}
44+
45+
/*
46+
* SelfLink is a binary association in which the individuals at the two ends are asserted
47+
* to be the same.
48+
*/
49+
assoc SelfLink specializes Link {
50+
end self: Anything[0..*] redefines BinaryLink::sourceEnd;
51+
end myself: Anything[0..*] redefines BinaryLink::targetEnd;
52+
53+
feature sourceParticipant: Anything[1..1] redefines BinaryLink::sourceParticipant subsets targetParticipant;
54+
feature targetParticipant: Anything[1..1] redefines BinaryLink::targetParticipant subsets sourceParticipant;
55+
}
56+
57+
/*
58+
* Occurrence is the most general class of entities that may occur over time.
59+
* BehaviorOccurrence and FunctionOccurrence are specializations representing the
60+
* occurrence (execution/evaluation) of behaviors and functions.
61+
*/
62+
abstract class Occurrence specializes Anything;
63+
abstract class BehaviorOccurrence specializes Occurrence;
64+
abstract class FunctionEvaluation specializes BehaviorOccurrence;
65+
66+
/*
67+
* property is the top-level feature in the language.
68+
* referenceProperty and valueProperty are specializations that restrict the feature type
69+
* to Objects and Values, respectively.
70+
*/
71+
feature property: Anything[0..*] nonunique;
72+
feature referenceProperty: Object[0..*] nonunique subsets property;
73+
feature valueProperty: Value[0..*] nonunique subsets property;
74+
75+
/*
76+
* connection is the most general feature of links between individuals.
77+
* binaryConnection and binding are specializations of binary links and self links.
78+
*/
79+
feature connection: Link[0..*] nonunique subsets property;
80+
feature binaryConnection: BinaryLink[0..*] nonunique subsets connection;
81+
feature binding: SelfLink[0..*] nonunique subsets binaryConnection;
82+
83+
/*
84+
* execution is the most general feature of occurrences of behaviors.
85+
* evaluation is a specialization for occurrences of functions.
86+
*/
87+
feature execution: BehaviorOccurrence[0..*] nonunique subsets property;
88+
feature evaluation: FunctionEvaluation[0..*] nonunique subsets execution;
89+
}

org.omg.sysml.tests/src/org/omg/sysml/tests/AlfParsingTest.xtend

Lines changed: 0 additions & 28 deletions
This file was deleted.

org.omg.sysml.tests/src/org/omg/sysml/tests/Dependency.xtend

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
/*****************************************************************************
22
* SysML 2 Pilot Implementation
33
* Copyright (c) 2018 IncQuery Labs Ltd.
4+
* Copyright (c) 2018, 2019 California Institute of Technology/Jet Propulsion Laboratory
5+
* Copyright (c) 2019 Model Driven Solutions
46
*
57
* This program is free software: you can redistribute it and/or modify
68
* it under the terms of the GNU Lesser General Public License as published by
@@ -18,8 +20,10 @@
1820
* @license LGPL-3.0-or-later <http://spdx.org/licenses/LGPL-3.0-or-later>
1921
*
2022
* Contributors:
21-
* Zoltan Kiss
22-
* Balazs Grill
23+
* Zoltan Kiss, IncQuery
24+
* Balazs Grill, IncQuery
25+
* Miyako Wilson, JPL
26+
* Ed Seidewitz, MDS
2327
*
2428
*****************************************************************************/
2529
package org.omg.sysml.tests
@@ -30,18 +34,28 @@ import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl
3034
import org.eclipse.xtext.resource.XtextResourceSet
3135
import org.eclipse.xtext.testing.util.ParseHelper
3236
import org.omg.sysml.lang.sysml.Package
37+
import org.eclipse.emf.common.util.URI
3338

3439
class Dependency {
40+
41+
public static final String LIBRARY_BASE_PATH = "library/Base.alf";
3542

3643
@Inject
3744
private Provider<XtextResourceSet> resourceSetProvider;
3845

3946
@Inject
4047
ParseHelper<Package> parseHelper
48+
49+
// Loads Base library file, which has elements that are needed for default specializations
50+
public def ResourceSetImpl getLibraryBasePackage() {
51+
val rs = resourceSetProvider.get
52+
rs.getResource(URI.createFileURI(LIBRARY_BASE_PATH), true)
53+
rs
54+
}
4155

4256
// Basic import file most of the tests use this
4357
public def ResourceSetImpl getDependencyOuterPackage() {
44-
val rs = resourceSetProvider.get
58+
val rs = getLibraryBasePackage
4559
parseHelper.parse(
4660
'''package OuterPackage{
4761
class A{
@@ -56,7 +70,7 @@ class Dependency {
5670

5771
// Basic import file most of the tests use this
5872
public def ResourceSetImpl getDependencyOuterPackage2() {
59-
val rs = resourceSetProvider.get
73+
val rs = getLibraryBasePackage
6074
parseHelper.parse(
6175
'''package OuterPackage{
6276
class A{
@@ -116,7 +130,7 @@ class Dependency {
116130

117131
// It's for the shadowing tests
118132
def ResourceSetImpl getDependencyAlias() {
119-
val rs = resourceSetProvider.get
133+
val rs = getLibraryBasePackage
120134
parseHelper.parse('''
121135
package PackageAlias1{
122136
A_alias is A;
@@ -144,7 +158,7 @@ class Dependency {
144158

145159
// It's for the shadowing tests
146160
def ResourceSetImpl getDependencySameNamesImport() {
147-
val rs = resourceSetProvider.get
161+
val rs = getLibraryBasePackage
148162
parseHelper.parse('''
149163
package SamePackage{
150164
class container{
@@ -164,7 +178,7 @@ class Dependency {
164178

165179
// The Visibility tests use this source
166180
def ResourceSetImpl getDependencyVisibilityPackage() {
167-
val rs = resourceSetProvider.get
181+
val rs = getLibraryBasePackage
168182
parseHelper.parse('''
169183
package VisibilityPackage {
170184
private class c_Private{

0 commit comments

Comments
 (0)