@@ -127,15 +127,9 @@ class UpstreamDownstreamRelationshipDSLParsingTest {
127
127
' ' ' ;
128
128
val dslSnippets = new ArrayList<String > ;
129
129
dslSnippets. add(dslSnippetTemplate. replace(" <<relationship>>" , " testContext [U,OHS,PL]->[D,CF] anotherTestContext" ));
130
- dslSnippets. add(dslSnippetTemplate. replace(" <<relationship>>" , " [U,OHS,PL]testContext -> [D,CF]anotherTestContext" ));
131
- dslSnippets. add(dslSnippetTemplate. replace(" <<relationship>>" , " testContext[U,OHS,PL] -> anotherTestContext[D,CF]" ));
132
- dslSnippets. add(dslSnippetTemplate. replace(" <<relationship>>" , " [U,OHS,PL]testContext -> anotherTestContext[D,CF]" ));
133
-
134
- // also without the U and D:
130
+ dslSnippets. add(dslSnippetTemplate. replace(" <<relationship>>" , " testContext [U,OHS,PL]->[CF] anotherTestContext" ));
131
+ dslSnippets. add(dslSnippetTemplate. replace(" <<relationship>>" , " testContext [OHS,PL]->[D,CF] anotherTestContext" ));
135
132
dslSnippets. add(dslSnippetTemplate. replace(" <<relationship>>" , " testContext [OHS,PL]->[CF] anotherTestContext" ));
136
- dslSnippets. add(dslSnippetTemplate. replace(" <<relationship>>" , " [OHS,PL]testContext -> [CF]anotherTestContext" ));
137
- dslSnippets. add(dslSnippetTemplate. replace(" <<relationship>>" , " testContext[OHS,PL] -> anotherTestContext[CF]" ));
138
- dslSnippets. add(dslSnippetTemplate. replace(" <<relationship>>" , " [OHS,PL]testContext -> anotherTestContext[CF]" ));
139
133
140
134
for (dslSnippet : dslSnippets) {
141
135
// when
@@ -174,15 +168,9 @@ class UpstreamDownstreamRelationshipDSLParsingTest {
174
168
' ' ' ;
175
169
val dslSnippets = new ArrayList<String > ;
176
170
dslSnippets. add(dslSnippetTemplate. replace(" <<relationship>>" , " anotherTestContext [D,CF]<-[U,OHS,PL] testContext" ));
177
- dslSnippets. add(dslSnippetTemplate. replace(" <<relationship>>" , " [D,CF]anotherTestContext <- [U,OHS,PL]testContext" ));
178
- dslSnippets. add(dslSnippetTemplate. replace(" <<relationship>>" , " anotherTestContext[D,CF] <- testContext[U,OHS,PL]" ));
179
- dslSnippets. add(dslSnippetTemplate. replace(" <<relationship>>" , " [D,CF]anotherTestContext <- testContext[U,OHS,PL]" ));
180
-
181
- // also without the U and D:
171
+ dslSnippets. add(dslSnippetTemplate. replace(" <<relationship>>" , " anotherTestContext [D,CF]<-[OHS,PL] testContext" ));
172
+ dslSnippets. add(dslSnippetTemplate. replace(" <<relationship>>" , " anotherTestContext [CF]<-[U,OHS,PL] testContext" ));
182
173
dslSnippets. add(dslSnippetTemplate. replace(" <<relationship>>" , " anotherTestContext [CF]<-[OHS,PL] testContext" ));
183
- dslSnippets. add(dslSnippetTemplate. replace(" <<relationship>>" , " [CF]anotherTestContext <- [OHS,PL]testContext" ));
184
- dslSnippets. add(dslSnippetTemplate. replace(" <<relationship>>" , " anotherTestContext[CF] <- testContext[OHS,PL]" ));
185
- dslSnippets. add(dslSnippetTemplate. replace(" <<relationship>>" , " [CF]anotherTestContext <- testContext[OHS,PL]" ));
186
174
187
175
for (dslSnippet : dslSnippets) {
188
176
// when
@@ -204,6 +192,83 @@ class UpstreamDownstreamRelationshipDSLParsingTest {
204
192
assertTrue(upstreamDownstreamRelationship. downstreamRoles. contains(DownstreamRole . CONFORMIST ))
205
193
}
206
194
}
195
+
196
+ @Test
197
+ def void canDefineUpstreamDownstreamInShortSyntaxWithUpstreamRolesOnly () {
198
+ // given
199
+ val String dslSnippetTemplate = ' ' '
200
+ ContextMap {
201
+ contains testContext
202
+ contains anotherTestContext
203
+
204
+ <<relationship>>
205
+ }
206
+
207
+ BoundedContext testContext
208
+ BoundedContext anotherTestContext
209
+ ' ' ' ;
210
+ val dslSnippets = new ArrayList<String > ;
211
+ dslSnippets. add(dslSnippetTemplate. replace(" <<relationship>>" , " anotherTestContext [D]<-[U,OHS,PL] testContext" ));
212
+ dslSnippets. add(dslSnippetTemplate. replace(" <<relationship>>" , " anotherTestContext [D]<-[OHS,PL] testContext" ));
213
+ dslSnippets. add(dslSnippetTemplate. replace(" <<relationship>>" , " anotherTestContext <-[U,OHS,PL] testContext" ));
214
+ dslSnippets. add(dslSnippetTemplate. replace(" <<relationship>>" , " anotherTestContext <-[OHS,PL] testContext" ));
215
+
216
+ for (dslSnippet : dslSnippets) {
217
+ // when
218
+ val ContextMappingModel result = parseHelper. parse(dslSnippet);
219
+ // then
220
+ assertThatNoParsingErrorsOccurred(result);
221
+ assertThatNoValidationErrorsOccurred(result);
222
+
223
+ val Relationship relationship = result. map. relationships. get(0 )
224
+ assertTrue(relationship. class. interfaces. contains(UpstreamDownstreamRelationship ))
225
+
226
+ val UpstreamDownstreamRelationship upstreamDownstreamRelationship = relationship as UpstreamDownstreamRelationship
227
+ assertEquals(" testContext" , upstreamDownstreamRelationship. upstream. name)
228
+ assertEquals(" anotherTestContext" , upstreamDownstreamRelationship. downstream. name)
229
+
230
+ assertTrue(upstreamDownstreamRelationship. upstreamRoles. contains(UpstreamRole . OPEN_HOST_SERVICE ))
231
+ assertTrue(upstreamDownstreamRelationship. upstreamRoles. contains(UpstreamRole . PUBLISHED_LANGUAGE ))
232
+ }
233
+ }
234
+
235
+ @Test
236
+ def void canDefineUpstreamDownstreamInShortSyntaxWithDownstreamRolesOnly () {
237
+ // given
238
+ val String dslSnippetTemplate = ' ' '
239
+ ContextMap {
240
+ contains testContext
241
+ contains anotherTestContext
242
+
243
+ <<relationship>>
244
+ }
245
+
246
+ BoundedContext testContext
247
+ BoundedContext anotherTestContext
248
+ ' ' ' ;
249
+ val dslSnippets = new ArrayList<String > ;
250
+ dslSnippets. add(dslSnippetTemplate. replace(" <<relationship>>" , " anotherTestContext [D,CF]<-[U] testContext" ));
251
+ dslSnippets. add(dslSnippetTemplate. replace(" <<relationship>>" , " anotherTestContext [D,CF]<- testContext" ));
252
+ dslSnippets. add(dslSnippetTemplate. replace(" <<relationship>>" , " anotherTestContext [CF]<-[U] testContext" ));
253
+ dslSnippets. add(dslSnippetTemplate. replace(" <<relationship>>" , " anotherTestContext [CF]<- testContext" ));
254
+
255
+ for (dslSnippet : dslSnippets) {
256
+ // when
257
+ val ContextMappingModel result = parseHelper. parse(dslSnippet);
258
+ // then
259
+ assertThatNoParsingErrorsOccurred(result);
260
+ assertThatNoValidationErrorsOccurred(result);
261
+
262
+ val Relationship relationship = result. map. relationships. get(0 )
263
+ assertTrue(relationship. class. interfaces. contains(UpstreamDownstreamRelationship ))
264
+
265
+ val UpstreamDownstreamRelationship upstreamDownstreamRelationship = relationship as UpstreamDownstreamRelationship
266
+ assertEquals(" testContext" , upstreamDownstreamRelationship. upstream. name)
267
+ assertEquals(" anotherTestContext" , upstreamDownstreamRelationship. downstream. name)
268
+
269
+ assertTrue(upstreamDownstreamRelationship. downstreamRoles. contains(DownstreamRole . CONFORMIST ))
270
+ }
271
+ }
207
272
208
273
@Test
209
274
def void canDefineCustomerSupplier () {
@@ -309,15 +374,7 @@ class UpstreamDownstreamRelationshipDSLParsingTest {
309
374
val dslSnippets = new ArrayList<String > ;
310
375
// all variants only with S and C
311
376
dslSnippets. add(dslSnippetTemplate. replace(" <<relationship>>" , " anotherTestContext [C]<-[S] testContext" ));
312
- dslSnippets. add(dslSnippetTemplate. replace(" <<relationship>>" , " [C]anotherTestContext <- [S]testContext" ));
313
- dslSnippets. add(dslSnippetTemplate. replace(" <<relationship>>" , " anotherTestContext[C] <- testContext[S]" ));
314
- dslSnippets. add(dslSnippetTemplate. replace(" <<relationship>>" , " [C]anotherTestContext <- testContext[S]" ));
315
-
316
- // all variants with U, S and D, C
317
377
dslSnippets. add(dslSnippetTemplate. replace(" <<relationship>>" , " anotherTestContext [D,C]<-[U,S] testContext" ));
318
- dslSnippets. add(dslSnippetTemplate. replace(" <<relationship>>" , " [D,C]anotherTestContext <- [U,S]testContext" ));
319
- dslSnippets. add(dslSnippetTemplate. replace(" <<relationship>>" , " anotherTestContext[D,C] <- testContext[U,S]" ));
320
- dslSnippets. add(dslSnippetTemplate. replace(" <<relationship>>" , " [D,C]anotherTestContext <- testContext[U,S]" ));
321
378
322
379
for (dslSnippet : dslSnippets) {
323
380
// when
@@ -352,15 +409,7 @@ class UpstreamDownstreamRelationshipDSLParsingTest {
352
409
val dslSnippets = new ArrayList<String > ;
353
410
// all variants only with S and C
354
411
dslSnippets. add(dslSnippetTemplate. replace(" <<relationship>>" , " testContext [S]->[C] anotherTestContext" ));
355
- dslSnippets. add(dslSnippetTemplate. replace(" <<relationship>>" , " [S]testContext -> [C]anotherTestContext" ));
356
- dslSnippets. add(dslSnippetTemplate. replace(" <<relationship>>" , " testContext[S] -> anotherTestContext[C]" ));
357
- dslSnippets. add(dslSnippetTemplate. replace(" <<relationship>>" , " [S]testContext -> anotherTestContext[C]" ));
358
-
359
- // all variants with U, S and D, C
360
412
dslSnippets. add(dslSnippetTemplate. replace(" <<relationship>>" , " testContext [U,S]->[D,C] anotherTestContext" ));
361
- dslSnippets. add(dslSnippetTemplate. replace(" <<relationship>>" , " [U,S]testContext -> [D,C]anotherTestContext" ));
362
- dslSnippets. add(dslSnippetTemplate. replace(" <<relationship>>" , " testContext[U,S] -> anotherTestContext[D,C]" ));
363
- dslSnippets. add(dslSnippetTemplate. replace(" <<relationship>>" , " [U,S]testContext -> anotherTestContext[D,C]" ));
364
413
365
414
for (dslSnippet : dslSnippets) {
366
415
// when
@@ -395,15 +444,7 @@ class UpstreamDownstreamRelationshipDSLParsingTest {
395
444
val dslSnippets = new ArrayList<String > ;
396
445
// all variants only with S and C
397
446
dslSnippets. add(dslSnippetTemplate. replace(" <<relationship>>" , " testContext [S,PL]->[C,ACL] anotherTestContext" ));
398
- dslSnippets. add(dslSnippetTemplate. replace(" <<relationship>>" , " [S,PL]testContext -> [C,ACL]anotherTestContext" ));
399
- dslSnippets. add(dslSnippetTemplate. replace(" <<relationship>>" , " testContext[S,PL] -> anotherTestContext[C,ACL]" ));
400
- dslSnippets. add(dslSnippetTemplate. replace(" <<relationship>>" , " [S,PL]testContext -> anotherTestContext[C,ACL]" ));
401
-
402
- // all variants with U, S and D, C
403
447
dslSnippets. add(dslSnippetTemplate. replace(" <<relationship>>" , " testContext [U,S,PL]->[D,C,ACL] anotherTestContext" ));
404
- dslSnippets. add(dslSnippetTemplate. replace(" <<relationship>>" , " [U,S,PL]testContext -> [D,C,ACL]anotherTestContext" ));
405
- dslSnippets. add(dslSnippetTemplate. replace(" <<relationship>>" , " testContext[U,S,PL] -> anotherTestContext[D,C,ACL]" ));
406
- dslSnippets. add(dslSnippetTemplate. replace(" <<relationship>>" , " [U,S,PL]testContext -> anotherTestContext[D,C,ACL]" ));
407
448
408
449
for (dslSnippet : dslSnippets) {
409
450
// when
0 commit comments