Skip to content

Commit

Permalink
Value Impact Map generator (#356)
Browse files Browse the repository at this point in the history
  • Loading branch information
stefan-ka authored Aug 13, 2024
1 parent e9161d2 commit 15d8b2a
Show file tree
Hide file tree
Showing 20 changed files with 1,036 additions and 32 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
BoundedContext SameDayDelivery

Stakeholders of SameDayDelivery {
StakeholderGroup Drivers
}

ValueRegister SD_Values for SameDayDelivery {

Value WorkLifeBalance {
isCore
demonstrator "Drivers value a healthy work-life-balance"
Stakeholder Drivers {
priority HIGH
impact HIGH
consequences
bad "SDD will harm work-life-balance of drivers"
action "hire more drivers" ACT
}
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

Stakeholders {
StakeholderGroup Drivers
}

ValueRegister SD_Values {

Value WorkLifeBalance {
Stakeholder Drivers {
}
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
BoundedContext SameDayDelivery

Stakeholders of SameDayDelivery {
StakeholderGroup Drivers
}

ValueRegister SD_Values for SameDayDelivery {

Value WorkLifeBalance {
isCore
demonstrator "Drivers value a healthy work-life-balance"
Stakeholder Drivers {
priority HIGH
impact HIGH
consequences
bad "SDD will harm work-life-balance of drivers"
action "hire more drivers" ACT
}
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Stakeholders {
StakeholderGroup Customers_and_Shoppers {
Stakeholder Shoppers_in_Emergency_Situations
Stakeholder Others
}
}

ValueRegister SD_Values {

ValueCluster Autonomy {
core AUTONOMY
demonstrator "customer values potentially increased freedom"
demonstrator "delivery staff's freedom might suffer because of work-life-balance"

Stakeholder Customers_and_Shoppers {
priority HIGH
impact MEDIUM
consequences
good "increased freedom"
}

}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@

Stakeholders {
StakeholderGroup Customers_and_Shoppers {
Stakeholder Shoppers_in_Emergency_Situations
Stakeholder Others
}
StakeholderGroup Delivery_Staff_of_Suppliers
}

ValueRegister SD_Values {

ValueCluster Autonomy {
core AUTONOMY
demonstrator "customer values potentially increased freedom"
demonstrator "delivery staff's freedom might suffer because of work-life-balance"

Value Freedom {
Stakeholder Customers_and_Shoppers {
priority HIGH
impact MEDIUM
consequences
good "increased freedom"
}

Stakeholder Delivery_Staff_of_Suppliers {
priority HIGH
impact HIGH
consequences
bad "work-life-balance"
good "tbd"

}
}
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@

Stakeholders {
StakeholderGroup Customers_and_Shoppers {
Stakeholder Shoppers_in_Emergency_Situations
Stakeholder Others
}
StakeholderGroup Delivery_Staff_of_Suppliers
}

ValueRegister SD_Values {

ValueCluster Autonomy {
core AUTONOMY
demonstrator "customer values potentially increased freedom"
demonstrator "delivery staff's freedom might suffer because of work-life-balance"

Value Freedom {
Stakeholder Customers_and_Shoppers {
priority HIGH
impact MEDIUM
consequences
good "increased freedom"
}

Stakeholder Delivery_Staff_of_Suppliers {
priority HIGH
impact HIGH
consequences
bad "work-life-balance"
good "tbd"

}

}
Value Sustainability {
Stakeholder Customers_and_Shoppers {
priority HIGH
impact LOW
consequences
bad "fostering unsustainable behavior (always ordering last minute)"
}
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ void canCreatePlantUMLDiagramFiles() {

// when
IFileSystemAccess2Mock filesystem = new IFileSystemAccess2Mock();
this.generator.doGenerate(new ContextMappingModelResourceMock(model, "testmodel", "cml"), filesystem, new IGeneratorContextMock());
this.generator.doGenerate(new ContextMappingModelResourceMock(model, "testmodel", "cml"), filesystem,
new IGeneratorContextMock());

// then
assertTrue(filesystem.getGeneratedFilesSet().contains("testmodel_ContextMap.puml"));
Expand All @@ -85,7 +86,8 @@ void canCreateBoundedContextClassDiagramsWithoutContextMap() {

// when
IFileSystemAccess2Mock filesystem = new IFileSystemAccess2Mock();
this.generator.doGenerate(new ContextMappingModelResourceMock(model, "testmodel", "cml"), filesystem, new IGeneratorContextMock());
this.generator.doGenerate(new ContextMappingModelResourceMock(model, "testmodel", "cml"), filesystem,
new IGeneratorContextMock());

// then
assertTrue(filesystem.getGeneratedFilesSet().contains("testmodel_BC_TestContext.puml"));
Expand All @@ -108,7 +110,8 @@ void canCreatePlantUMLDiagrmFiles4SubdomainIfEntitiesAvailable() {

// when
IFileSystemAccess2Mock filesystem = new IFileSystemAccess2Mock();
this.generator.doGenerate(new ContextMappingModelResourceMock(model, "testmodel", "cml"), filesystem, new IGeneratorContextMock());
this.generator.doGenerate(new ContextMappingModelResourceMock(model, "testmodel", "cml"), filesystem,
new IGeneratorContextMock());

// then
assertFalse(filesystem.getGeneratedFilesSet().contains("testmodel_SD_TestSubdomain1.puml"));
Expand All @@ -118,100 +121,133 @@ void canCreatePlantUMLDiagrmFiles4SubdomainIfEntitiesAvailable() {
@Test
void canCreateStateDiagram4ApplicationFlowIfAvailable() throws IOException {
// given
ContextMappingModel model = getOriginalResourceOfTestCML("state-diagram-generation-flow-test.cml").getContextMappingModel();
ContextMappingModel model = getOriginalResourceOfTestCML("state-diagram-generation-flow-test.cml")
.getContextMappingModel();

// when
IFileSystemAccess2Mock filesystem = new IFileSystemAccess2Mock();
this.generator.doGenerate(new ContextMappingModelResourceMock(model, "testmodel", "cml"), filesystem, new IGeneratorContextMock());
this.generator.doGenerate(new ContextMappingModelResourceMock(model, "testmodel", "cml"), filesystem,
new IGeneratorContextMock());

// then
assertTrue(filesystem.getGeneratedFilesSet().contains("testmodel_BC_InsuranceQuotes_QuoteFlow_StateDiagram.puml"));
assertTrue(
filesystem.getGeneratedFilesSet().contains("testmodel_BC_InsuranceQuotes_QuoteFlow_StateDiagram.puml"));
}

@Test
void canCreateClass4AggregateIfAvailable() throws IOException {
// given
ContextMappingModel model = getOriginalResourceOfTestCML("class-diagram-generation-aggregate-test-1.cml").getContextMappingModel();
ContextMappingModel model = getOriginalResourceOfTestCML("class-diagram-generation-aggregate-test-1.cml")
.getContextMappingModel();

// when
IFileSystemAccess2Mock filesystem = new IFileSystemAccess2Mock();
this.generator.doGenerate(new ContextMappingModelResourceMock(model, "testmodel", "cml"), filesystem, new IGeneratorContextMock());
this.generator.doGenerate(new ContextMappingModelResourceMock(model, "testmodel", "cml"), filesystem,
new IGeneratorContextMock());

// then
assertTrue(filesystem.getGeneratedFilesSet().contains("testmodel_BC_InsuranceQuotes_QuoteRequest.puml"));
}

@Test
void canCreateClass4ModuleIfAvailable() throws IOException {
// given
ContextMappingModel model = getOriginalResourceOfTestCML("class-diagram-generation-module-test-1.cml").getContextMappingModel();
ContextMappingModel model = getOriginalResourceOfTestCML("class-diagram-generation-module-test-1.cml")
.getContextMappingModel();

// when
IFileSystemAccess2Mock filesystem = new IFileSystemAccess2Mock();
this.generator.doGenerate(new ContextMappingModelResourceMock(model, "testmodel", "cml"), filesystem, new IGeneratorContextMock());
this.generator.doGenerate(new ContextMappingModelResourceMock(model, "testmodel", "cml"), filesystem,
new IGeneratorContextMock());

// then
assertTrue(filesystem.getGeneratedFilesSet().contains("testmodel_BC_InsuranceQuotes_QuoteRequest.puml"));
}

@Test
void canCreateStateDiagram4AggregateIfAvailable() throws IOException {
// given
ContextMappingModel model = getOriginalResourceOfTestCML("state-diagram-generation-aggregate-test-1.cml").getContextMappingModel();
ContextMappingModel model = getOriginalResourceOfTestCML("state-diagram-generation-aggregate-test-1.cml")
.getContextMappingModel();

// when
IFileSystemAccess2Mock filesystem = new IFileSystemAccess2Mock();
this.generator.doGenerate(new ContextMappingModelResourceMock(model, "testmodel", "cml"), filesystem, new IGeneratorContextMock());
this.generator.doGenerate(new ContextMappingModelResourceMock(model, "testmodel", "cml"), filesystem,
new IGeneratorContextMock());

// then
assertTrue(filesystem.getGeneratedFilesSet().contains("testmodel_BC_InsuranceQuotes_QuoteRequest_StateDiagram.puml"));
assertTrue(filesystem.getGeneratedFilesSet()
.contains("testmodel_BC_InsuranceQuotes_QuoteRequest_StateDiagram.puml"));
}

@Test
void canCreateUseCaseDiagram4UseCasesIfAvailable() throws IOException {
// given
ContextMappingModel model = getOriginalResourceOfTestCML("use-case-diagram-generation-test-1.cml").getContextMappingModel();
ContextMappingModel model = getOriginalResourceOfTestCML("use-case-diagram-generation-test-1.cml")
.getContextMappingModel();

// when
IFileSystemAccess2Mock filesystem = new IFileSystemAccess2Mock();
this.generator.doGenerate(new ContextMappingModelResourceMock(model, "testmodel", "cml"), filesystem, new IGeneratorContextMock());
this.generator.doGenerate(new ContextMappingModelResourceMock(model, "testmodel", "cml"), filesystem,
new IGeneratorContextMock());

// then
assertTrue(filesystem.getGeneratedFilesSet().contains("testmodel_UseCases.puml"));
}

@Test
void canCreateSequenceDiagram4UseCaseInteractionsIfAvailable() throws IOException {
// given
ContextMappingModel model = getOriginalResourceOfTestCML("use-case-diagram-generation-test-1.cml").getContextMappingModel();
ContextMappingModel model = getOriginalResourceOfTestCML("use-case-diagram-generation-test-1.cml")
.getContextMappingModel();

// when
IFileSystemAccess2Mock filesystem = new IFileSystemAccess2Mock();
this.generator.doGenerate(new ContextMappingModelResourceMock(model, "testmodel", "cml"), filesystem, new IGeneratorContextMock());
this.generator.doGenerate(new ContextMappingModelResourceMock(model, "testmodel", "cml"), filesystem,
new IGeneratorContextMock());

// then
assertTrue(filesystem.getGeneratedFilesSet().contains("testmodel_UseCase_Get_paid_for_car_accident_Interactions.puml"));
assertTrue(filesystem.getGeneratedFilesSet()
.contains("testmodel_UseCase_Get_paid_for_car_accident_Interactions.puml"));
}

@Test
void canCreateStakeholderDiagramsIfStakeholdersAreAvailable() throws IOException {
// given
ContextMappingModel model = getOriginalResourceOfTestCML("stakeholder-diagram-generation-test-1.cml").getContextMappingModel();

ContextMappingModel model = getOriginalResourceOfTestCML("stakeholder-diagram-generation-test-1.cml")
.getContextMappingModel();

// when
IFileSystemAccess2Mock filesystem = new IFileSystemAccess2Mock();
this.generator.doGenerate(new ContextMappingModelResourceMock(model, "testmodel", "cml"), filesystem, new IGeneratorContextMock());

this.generator.doGenerate(new ContextMappingModelResourceMock(model, "testmodel", "cml"), filesystem,
new IGeneratorContextMock());

// then
assertTrue(filesystem.getGeneratedFilesSet().contains("testmodel_BC_System-of-Interest_StakeholderMap-1.puml"));
}

@Test
void canCreateValueImpactMapDiagramsIfValueRegistersAreAvailable() throws IOException {
// given
ContextMappingModel model = getOriginalResourceOfTestCML("value-impact-map-diagram-generation-test-1.cml")
.getContextMappingModel();

// when
IFileSystemAccess2Mock filesystem = new IFileSystemAccess2Mock();
this.generator.doGenerate(new ContextMappingModelResourceMock(model, "testmodel", "cml"), filesystem,
new IGeneratorContextMock());

// then
assertTrue(
filesystem.getGeneratedFilesSet().contains("testmodel_ValueRegister_SD_Values_Value-Impact-Map.puml"));
}

@Test
void expectExceptionForEmptyResource() {
IFileSystemAccess2Mock filesystem = new IFileSystemAccess2Mock();
assertThrows(GeneratorInputException.class, () -> {
this.generator.doGenerate(new ContextMappingModelResourceMock(null, "testmodel", "cml"), filesystem, new IGeneratorContextMock());
this.generator.doGenerate(new ContextMappingModelResourceMock(null, "testmodel", "cml"), filesystem,
new IGeneratorContextMock());
});
}

Expand All @@ -220,7 +256,8 @@ void expectExceptionForEmptyContextMappingModel() {
ContextMappingModel model = ContextMappingDSLFactory.eINSTANCE.createContextMappingModel();
IFileSystemAccess2Mock filesystem = new IFileSystemAccess2Mock();
assertThrows(GeneratorInputException.class, () -> {
this.generator.doGenerate(new ContextMappingModelResourceMock(model, "testmodel", "cml"), filesystem, new IGeneratorContextMock());
this.generator.doGenerate(new ContextMappingModelResourceMock(model, "testmodel", "cml"), filesystem,
new IGeneratorContextMock());
});
}

Expand All @@ -232,7 +269,8 @@ void expectExceptionIfThereIsOnlyAnEmptyDomain() {
model.getDomains().add(emptyDomain);
IFileSystemAccess2Mock filesystem = new IFileSystemAccess2Mock();
assertThrows(GeneratorInputException.class, () -> {
this.generator.doGenerate(new ContextMappingModelResourceMock(model, "testmodel", "cml"), filesystem, new IGeneratorContextMock());
this.generator.doGenerate(new ContextMappingModelResourceMock(model, "testmodel", "cml"), filesystem,
new IGeneratorContextMock());
});
}

Expand Down
Loading

0 comments on commit 15d8b2a

Please sign in to comment.