Skip to content

Commit

Permalink
Slightly changed the event id wording
Browse files Browse the repository at this point in the history
  • Loading branch information
rchache authored and mtdowling committed Jun 8, 2023
1 parent d971adb commit 18a7fab
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@
public final class AddedEntityBinding extends AbstractDiffEvaluator {
private static final String ADDED_RESOURCE = "AddedResourceBinding";
private static final String ADDED_OPERATION = "AddedOperationBinding";
private static final String TO_RESOURCE = ".ToResourceAdded.";
private static final String TO_SERVICE = ".ToServiceAdded.";
private static final String TO_RESOURCE = ".ToResource.";
private static final String TO_SERVICE = ".ToService.";

@Override
public List<ValidationEvent> evaluate(Differences differences) {
Expand Down Expand Up @@ -69,7 +69,7 @@ private ValidationEvent createAddedEvent(String typeOfAddition, EntityShape pare
"%s binding of `%s` was added to the %s shape, `%s`",
childType, childShape, parentEntity.getType(), parentEntity.getId());
return ValidationEvent.builder()
.id(typeOfAddition + typeOfParentShape + childShape)
.id(typeOfAddition + typeOfParentShape + childShape.getName())
.severity(Severity.NOTE)
.shape(parentEntity)
.message(message)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@
public final class RemovedEntityBinding extends AbstractDiffEvaluator {
private static final String REMOVED_RESOURCE = "RemovedResourceBinding";
private static final String REMOVED_OPERATION = "RemovedOperationBinding";
private static final String FROM_RESOURCE = ".FromResourceRemoved.";
private static final String FROM_SERVICE = ".FromServiceRemoved.";
private static final String FROM_RESOURCE = ".FromResource.";
private static final String FROM_SERVICE = ".FromService.";

@Override
public List<ValidationEvent> evaluate(Differences differences) {
Expand Down Expand Up @@ -69,7 +69,7 @@ private ValidationEvent createRemovedEvent(String typeOfRemoval, EntityShape par
"%s binding of `%s` was removed from %s shape, `%s`",
childType, childShape, parentEntity.getType(), parentEntity.getId());
return ValidationEvent.builder()
.id(typeOfRemoval + typeOfParentShape + childShape)
.id(typeOfRemoval + typeOfParentShape + childShape.getName())
.severity(Severity.ERROR)
.shape(parentEntity)
.message(message)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public void detectsAddedOperationToService() {
Model modelB = Model.assembler().addShapes(service1, o).assemble().unwrap();
List<ValidationEvent> events = ModelDiff.compare(modelA, modelB);

assertThat(TestHelper.findEvents(events, "AddedOperationBinding.ToServiceAdded.foo.baz#Operation").size(), equalTo(1));
assertThat(TestHelper.findEvents(events, "AddedOperationBinding.ToService.Operation").size(), equalTo(1));
}

@Test
Expand All @@ -53,7 +53,7 @@ public void detectsAddedOperationToResource() {
Model modelB = Model.assembler().addShapes(r1, o).assemble().unwrap();
List<ValidationEvent> events = ModelDiff.compare(modelA, modelB);

assertThat(TestHelper.findEvents(events, "AddedOperationBinding.ToResourceAdded.foo.baz#Operation").size(), equalTo(1));
assertThat(TestHelper.findEvents(events, "AddedOperationBinding.ToResource.Operation").size(), equalTo(1));
}

@Test
Expand All @@ -69,7 +69,7 @@ public void detectsAddedResourceToService() {
Model modelB = Model.assembler().addShapes(service1, r).assemble().unwrap();
List<ValidationEvent> events = ModelDiff.compare(modelA, modelB);

assertThat(TestHelper.findEvents(events, "AddedResourceBinding.ToServiceAdded.foo.baz#Resource").size(), equalTo(1));
assertThat(TestHelper.findEvents(events, "AddedResourceBinding.ToService.Resource").size(), equalTo(1));
}

@Test
Expand All @@ -81,6 +81,6 @@ public void detectsAddedResourceToResource() {
Model modelB = Model.assembler().addShapes(p1, child).assemble().unwrap();
List<ValidationEvent> events = ModelDiff.compare(modelA, modelB);

assertThat(TestHelper.findEvents(events, "AddedResourceBinding.ToResourceAdded.foo.baz#C").size(), equalTo(1));
assertThat(TestHelper.findEvents(events, "AddedResourceBinding.ToResource.C").size(), equalTo(1));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public void detectsRemovedOperationFromService() {
Model modelB = Model.assembler().addShapes(service2, o).assemble().unwrap();
List<ValidationEvent> events = ModelDiff.compare(modelA, modelB);

assertThat(TestHelper.findEvents(events, "RemovedOperationBinding.FromServiceRemoved.foo.baz#Operation").size(), equalTo(1));
assertThat(TestHelper.findEvents(events, "RemovedOperationBinding.FromService.Operation").size(), equalTo(1));
}

@Test
Expand All @@ -53,7 +53,7 @@ public void detectsRemovedOperationFromResource() {
Model modelB = Model.assembler().addShapes(r2, o).assemble().unwrap();
List<ValidationEvent> events = ModelDiff.compare(modelA, modelB);

assertThat(TestHelper.findEvents(events, "RemovedOperationBinding.FromResourceRemoved.foo.baz#Operation").size(), equalTo(1));
assertThat(TestHelper.findEvents(events, "RemovedOperationBinding.FromResource.Operation").size(), equalTo(1));
}

@Test
Expand All @@ -69,7 +69,7 @@ public void detectsRemovedResourceFromService() {
Model modelB = Model.assembler().addShapes(service2, r).assemble().unwrap();
List<ValidationEvent> events = ModelDiff.compare(modelA, modelB);

assertThat(TestHelper.findEvents(events, "RemovedResourceBinding.FromServiceRemoved.foo.baz#Resource").size(), equalTo(1));
assertThat(TestHelper.findEvents(events, "RemovedResourceBinding.FromService.Resource").size(), equalTo(1));
}

@Test
Expand All @@ -81,6 +81,6 @@ public void detectsRemovedResourceFromResource() {
Model modelB = Model.assembler().addShapes(p2, child).assemble().unwrap();
List<ValidationEvent> events = ModelDiff.compare(modelA, modelB);

assertThat(TestHelper.findEvents(events, "RemovedResourceBinding.FromResourceRemoved.foo.baz#C").size(), equalTo(1));
assertThat(TestHelper.findEvents(events, "RemovedResourceBinding.FromResource.C").size(), equalTo(1));
}
}

0 comments on commit 18a7fab

Please sign in to comment.