@@ -127,15 +127,9 @@ class UpstreamDownstreamRelationshipDSLParsingTest {
127127 ' ' ' ;
128128 val dslSnippets = new ArrayList<String > ;
129129 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" ));
135132 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]" ));
139133
140134 for (dslSnippet : dslSnippets) {
141135 // when
@@ -174,15 +168,9 @@ class UpstreamDownstreamRelationshipDSLParsingTest {
174168 ' ' ' ;
175169 val dslSnippets = new ArrayList<String > ;
176170 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" ));
182173 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]" ));
186174
187175 for (dslSnippet : dslSnippets) {
188176 // when
@@ -204,6 +192,83 @@ class UpstreamDownstreamRelationshipDSLParsingTest {
204192 assertTrue(upstreamDownstreamRelationship. downstreamRoles. contains(DownstreamRole . CONFORMIST ))
205193 }
206194 }
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+ }
207272
208273 @Test
209274 def void canDefineCustomerSupplier () {
@@ -309,15 +374,7 @@ class UpstreamDownstreamRelationshipDSLParsingTest {
309374 val dslSnippets = new ArrayList<String > ;
310375 // all variants only with S and C
311376 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
317377 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]" ));
321378
322379 for (dslSnippet : dslSnippets) {
323380 // when
@@ -352,15 +409,7 @@ class UpstreamDownstreamRelationshipDSLParsingTest {
352409 val dslSnippets = new ArrayList<String > ;
353410 // all variants only with S and C
354411 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
360412 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]" ));
364413
365414 for (dslSnippet : dslSnippets) {
366415 // when
@@ -395,15 +444,7 @@ class UpstreamDownstreamRelationshipDSLParsingTest {
395444 val dslSnippets = new ArrayList<String > ;
396445 // all variants only with S and C
397446 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
403447 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]" ));
407448
408449 for (dslSnippet : dslSnippets) {
409450 // when
0 commit comments