-
-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CML: Add rule for coordination between services of different contexts (…
- Loading branch information
Showing
30 changed files
with
1,296 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,3 +42,5 @@ plugin.xml_gen | |
.gradle/ | ||
build/ | ||
|
||
# MacOS | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
.../contextmapper/dsl/ide/tests/quickfixes/OpenCoordinationInBPMNSketchMinerActionTest.xtend
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/* | ||
* Copyright 2023 The Context Mapper Project Team | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.contextmapper.dsl.ide.tests.quickfixes | ||
|
||
import org.contextmapper.dsl.ide.tests.commands.AbstractCMLCommandTest | ||
import org.junit.jupiter.api.Test | ||
|
||
class OpenCoordinationInBPMNSketchMinerActionTest extends AbstractCMLCommandTest { | ||
|
||
@Test | ||
def void canOfferCodeAction() { | ||
testCodeAction [ | ||
model = ''' | ||
BoundedContext ContextA { | ||
Application { | ||
Coordination TestCoordination { | ||
ContextA::TestService::testOperation; | ||
} | ||
Service TestService { | ||
testOperation; | ||
} | ||
} | ||
} | ||
''' | ||
expectedCodeActions = ''' | ||
title : Open coordination in BPMN Sketch Miner | ||
kind : quickfix | ||
command : Command [ | ||
title = "Open coordination in BPMN Sketch Miner" | ||
command = "cml.coordination.open.sketch.miner" | ||
arguments = LinkedList ( | ||
"https://www.bpmn-sketch-miner.ai/index.html#EYBwNgdgXAbgjAKALRIQYQPYQC4FMAe2AglAggM64BOMAlgMa4AEAKrudgMrV2MB0eDgHkQ1AIbZaWMkA" | ||
) | ||
] | ||
codes : open-coordination-in-sketch-miner | ||
edit : | ||
''' | ||
] | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
...c/org/contextmapper/dsl/ide/quickfix/impl/OpenCoordinationInSketchMinerCommandMapper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* | ||
* Copyright 2023 The Context Mapper Project Team | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.contextmapper.dsl.ide.quickfix.impl; | ||
|
||
import java.util.Arrays; | ||
|
||
import org.contextmapper.dsl.cml.CMLResource; | ||
import org.contextmapper.dsl.contextMappingDSL.Coordination; | ||
import org.contextmapper.dsl.generator.sketchminer.SketchMinerLinkCreator; | ||
import org.contextmapper.dsl.ide.quickfix.QuickfixCommandMapper; | ||
import org.eclipse.emf.ecore.EObject; | ||
import org.eclipse.lsp4j.CodeAction; | ||
import org.eclipse.lsp4j.CodeActionKind; | ||
import org.eclipse.lsp4j.Command; | ||
|
||
import com.google.common.collect.Lists; | ||
|
||
public class OpenCoordinationInSketchMinerCommandMapper implements QuickfixCommandMapper { | ||
|
||
@Override | ||
public CodeAction getCodeAction(CMLResource cmlResource, EObject selectedObject) { | ||
Coordination coordination = (Coordination) selectedObject; | ||
CodeAction action = new CodeAction("Open coordination in BPMN Sketch Miner"); | ||
action.setKind(CodeActionKind.QuickFix); | ||
Command command = new Command("Open coordination in BPMN Sketch Miner", "cml.coordination.open.sketch.miner"); | ||
command.setArguments(Lists.newLinkedList(Arrays.asList(new String[] { new SketchMinerLinkCreator().createSketchMinerLink(coordination) }))); | ||
action.setCommand(command); | ||
return action; | ||
} | ||
|
||
} |
45 changes: 45 additions & 0 deletions
45
org.contextmapper.dsl.tests/integ-test-files/sketchminer/link-integ-test2.cml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
ContextMap InsuranceMap { | ||
contains UserContext | ||
contains InsuranceQuotes | ||
|
||
InsuranceQuotes <- UserContext | ||
} | ||
|
||
BoundedContext UserContext { | ||
|
||
Application { | ||
Service UserService { | ||
void submitRequest(@Request request); | ||
} | ||
} | ||
} | ||
|
||
BoundedContext InsuranceQuotes { | ||
|
||
Application { | ||
Coordination QuoteRequestAcceptedCoordination { | ||
UserContext::UserService::submitRequest; | ||
InsuranceQuotes::QuoteRequestService::checkRequest; | ||
InsuranceQuotes::QuoteRequestService::receiveAndCheckQuote; | ||
InsuranceQuotes::QuoteRequestService::accept; | ||
} | ||
|
||
Service QuoteRequestService { | ||
void checkRequest(@Request request); | ||
void receiveAndCheckQuote(@Request request); | ||
void reject(@Request request); | ||
void accept(@Request request); | ||
} | ||
} | ||
|
||
Aggregate QuoteRequest { | ||
Entity Request { | ||
aggregateRoot | ||
} | ||
|
||
enum RequestState { | ||
aggregateLifecycle | ||
SUBMITTED, RECEIVED, REJECTED, ACCEPTED, EXPIRED, POLICY_CREATED | ||
} | ||
} | ||
} |
2 changes: 2 additions & 0 deletions
2
org.contextmapper.dsl.tests/integ-test-files/sketchminer/no-coordination-existing-test-1.cml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
|
||
BoundedContext EmptyContext // ignored |
28 changes: 28 additions & 0 deletions
28
org.contextmapper.dsl.tests/integ-test-files/sketchminer/simple-coordination-test-1.cml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
|
||
ContextMap TestMap { | ||
contains ContextA | ||
contains ContextB | ||
|
||
ContextA <- ContextB | ||
} | ||
|
||
BoundedContext ContextA { | ||
Application { | ||
Coordination TestCoordination { | ||
ContextA::ServiceA::operationA; | ||
ContextB::ServiceB::operationB; | ||
} | ||
Service ServiceA { | ||
operationA; | ||
} | ||
} | ||
} | ||
|
||
BoundedContext ContextB { | ||
Application { | ||
Service ServiceB { | ||
operationB; | ||
} | ||
} | ||
} | ||
|
41 changes: 41 additions & 0 deletions
41
org.contextmapper.dsl.tests/integ-test-files/sketchminer/simple-coordination-test-2.cml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
|
||
ContextMap TestMap { | ||
contains ContextA | ||
contains ContextB | ||
contains ContextC | ||
|
||
ContextA <- ContextB | ||
ContextA <- ContextC | ||
} | ||
|
||
BoundedContext ContextA { | ||
Application { | ||
Coordination TestCoordination { | ||
ContextA::ServiceA::operationA1; | ||
ContextB::ServiceB::operationB; | ||
ContextA::ServiceA::operationA2; | ||
ContextC::ServiceC::operationC; | ||
} | ||
Service ServiceA { | ||
operationA1; | ||
operationA2; | ||
} | ||
} | ||
} | ||
|
||
BoundedContext ContextB { | ||
Application { | ||
Service ServiceB { | ||
operationB; | ||
} | ||
} | ||
} | ||
|
||
BoundedContext ContextC { | ||
Application { | ||
Service ServiceC { | ||
operationC; | ||
} | ||
} | ||
} | ||
|
Oops, something went wrong.