use of org.contextmapper.dsl.refactoring.SwitchFromPartnershipToSharedKernelRefactoring in project context-mapper-dsl by ContextMapper.
the class SwitchFromPartnershipToSharedKernelRefactoringTest method canCheck4MultipleSKRelationships.
@Test
void canCheck4MultipleSKRelationships() throws IOException {
// given
String boundedContext1 = "CustomerManagement";
String boundedContext2 = "AnotherContext";
CMLResource input = getResourceCopyOfTestCML("switch-from-partnership-to-sharedkernel-precondition-checks-multiple-rels-input.cml");
// when, then
Assertions.assertThrows(RefactoringInputException.class, () -> {
new SwitchFromPartnershipToSharedKernelRefactoring(boundedContext1, boundedContext2).refactor(input);
});
}
use of org.contextmapper.dsl.refactoring.SwitchFromPartnershipToSharedKernelRefactoring in project context-mapper-dsl by ContextMapper.
the class SwitchFromPartnershipToSharedKernelRefactoringTest method canCheck4NullBoundedContext2.
@Test
void canCheck4NullBoundedContext2() throws IOException {
// given
String boundedContext1 = null;
String boundedContext2 = "TestContext";
CMLResource input = getResourceCopyOfTestCML("switch-from-partnership-to-sharedkernel-precondition-checks-input.cml");
// when, then
Assertions.assertThrows(RefactoringInputException.class, () -> {
new SwitchFromPartnershipToSharedKernelRefactoring(boundedContext1, boundedContext2).refactor(input);
});
}
use of org.contextmapper.dsl.refactoring.SwitchFromPartnershipToSharedKernelRefactoring in project context-mapper-dsl by ContextMapper.
the class SwitchFromPartnershipToSharedKernelRefactoringTest method canCheck4NoRelationshipAvailable.
@Test
void canCheck4NoRelationshipAvailable() throws IOException {
// given
String boundedContext1 = "TestContext1";
String boundedContext2 = "TestContext2";
CMLResource input = getResourceCopyOfTestCML("switch-from-partnership-to-sharedkernel-precondition-checks-no-rel-input.cml");
// when, then
Assertions.assertThrows(RefactoringInputException.class, () -> {
new SwitchFromPartnershipToSharedKernelRefactoring(boundedContext1, boundedContext2).refactor(input);
});
}
use of org.contextmapper.dsl.refactoring.SwitchFromPartnershipToSharedKernelRefactoring in project context-mapper-dsl by ContextMapper.
the class SwitchFromPartnershipToSharedKernelRefactoringTest method canCheck4NullBoundedContext1.
@Test
void canCheck4NullBoundedContext1() throws IOException {
// given
String boundedContext1 = "TestContext";
String boundedContext2 = null;
CMLResource input = getResourceCopyOfTestCML("switch-from-partnership-to-sharedkernel-precondition-checks-input.cml");
// when, then
Assertions.assertThrows(RefactoringInputException.class, () -> {
new SwitchFromPartnershipToSharedKernelRefactoring(boundedContext1, boundedContext2).refactor(input);
});
}
use of org.contextmapper.dsl.refactoring.SwitchFromPartnershipToSharedKernelRefactoring in project context-mapper-dsl by ContextMapper.
the class SwitchFromPartnershipToSharedKernelRefactoringHandler method executeRefactoring.
@Override
protected void executeRefactoring(CMLResource resource, ExecutionEvent event) {
Partnership partnership = (Partnership) getSelectedElement();
SemanticCMLRefactoring ar = new SwitchFromPartnershipToSharedKernelRefactoring(partnership.getParticipant1().getName(), partnership.getParticipant2().getName());
ar.refactor(resource);
ar.persistChanges(serializer);
}
Aggregations