use of org.eclipse.winery.model.version.ToscaDiff in project winery by eclipse.
the class VersionUtilsTestWithGitBackedRepository method noDifferencesInRelationshipTemplates.
@Test
public void noDifferencesInRelationshipTemplates() throws Exception {
this.setRevisionTo("origin/plain");
ServiceTemplateId oldVersion = new ServiceTemplateId("http://plain.winery.opentosca.org/servicetemplates", "ServiceTemplateWithFourPolicies_w1-wip1", false);
ServiceTemplateId newVersion = new ServiceTemplateId("http://plain.winery.opentosca.org/servicetemplates", "ServiceTemplateWithFourPolicies_w1-wip1", false);
ToscaDiff diffNode = VersionSupport.calculateDifferences(repository.getElement(oldVersion).getTopologyTemplate().getRelationshipTemplate("con_129"), repository.getElement(newVersion).getTopologyTemplate().getRelationshipTemplate("con_129"));
assertEquals(VersionState.UNCHANGED, diffNode.getState());
}
use of org.eclipse.winery.model.version.ToscaDiff in project winery by eclipse.
the class VersionUtilsTestWithGitBackedRepository method ensureRelationshipTemplatesAreNotChangedWhenSourceOrTargetElementIsChanged.
@Test
public void ensureRelationshipTemplatesAreNotChangedWhenSourceOrTargetElementIsChanged() throws Exception {
this.setRevisionTo("origin/plain");
ServiceTemplateId oldVersion = new ServiceTemplateId("http://plain.winery.opentosca.org/servicetemplates", "ServiceTemplateWithTwoNodeTemplates_w2-wip1", false);
ServiceTemplateId newVersion = new ServiceTemplateId("http://plain.winery.opentosca.org/servicetemplates", "ServiceTemplateWithTwoNodeTemplates_w2-wip2", false);
ToscaDiff toscaDiff = VersionSupport.calculateDifferences(repository.getElement(oldVersion), repository.getElement(newVersion));
assertEquals("## Changes from version w2-wip1 to w2-wip2\n" + "\n" + "### Changed\n" + "- id\n" + " changed from \"ServiceTemplateWithTwoNodeTemplates_w2-wip1\" to \"ServiceTemplateWithTwoNodeTemplates_w2-wip2\"\n" + "- name\n" + " changed from \"ServiceTemplateWithTwoNodeTemplates_w2-wip1\" to \"ServiceTemplateWithTwoNodeTemplates_w2-wip2\"\n" + "- topologyTemplate/nodeTemplates/NodeTypeWithTwoKVProperties/properties/KVProperties/{key1}\n" + " changed from \"\" to \"MyKeyElement\"", toscaDiff.getChangeLog());
}
use of org.eclipse.winery.model.version.ToscaDiff in project winery by eclipse.
the class VersionUtilsTestWithGitBackedRepository method noDifferencesInServiceTemplatesWithOnlyOneNodeTemplate.
@Test
public void noDifferencesInServiceTemplatesWithOnlyOneNodeTemplate() throws Exception {
this.setRevisionTo("origin/plain");
ServiceTemplateId oldVersion = new ServiceTemplateId("http://plain.winery.opentosca.org/servicetemplates", "ServiceTemplateWithOneNodeTemplate_w1-wip1", false);
ServiceTemplateId newVersion = new ServiceTemplateId("http://plain.winery.opentosca.org/servicetemplates", "ServiceTemplateWithOneNodeTemplate_w1-wip1", false);
ToscaDiff diffNode = VersionSupport.calculateDifferences(repository.getElement(oldVersion), repository.getElement(newVersion));
assertEquals(VersionState.UNCHANGED, diffNode.getState());
}
use of org.eclipse.winery.model.version.ToscaDiff in project winery by eclipse.
the class VersionUtilsTestWithGitBackedRepository method differencesInServiceTemplatesWithTwoNodeTemplatesAndOneDifferentNodeTemplate.
@Test
public void differencesInServiceTemplatesWithTwoNodeTemplatesAndOneDifferentNodeTemplate() throws Exception {
this.setRevisionTo("origin/plain");
ServiceTemplateId oldVersion = new ServiceTemplateId("http://plain.winery.opentosca.org/servicetemplates", "ServiceTemplateWithTwoNodeTemplates_w1-wip1", false);
ServiceTemplateId newVersion = new ServiceTemplateId("http://plain.winery.opentosca.org/servicetemplates", "ServiceTemplateWithTwoNodeTemplates_w1-wip2", false);
ToscaDiff diffNode = VersionSupport.calculateDifferences(repository.getElement(oldVersion), repository.getElement(newVersion));
Map<String, ToscaDiff> nodeTemplateDiff = diffNode.getChildrenMap().get("topologyTemplate").getChildrenMap().get("nodeTemplates").getChildrenMap();
ToscaDiff element1 = nodeTemplateDiff.get("0");
ToscaDiff element2 = nodeTemplateDiff.get("1");
assertEquals(VersionState.CHANGED, diffNode.getState());
assertEquals("NodeTypeWithXmlElementProperty", element1.getElement());
assertEquals(VersionState.ADDED, element1.getState());
assertEquals("NodeTypeWithOneReqCapPairWithoutProperties", element2.getElement());
assertEquals(VersionState.REMOVED, element2.getState());
}
use of org.eclipse.winery.model.version.ToscaDiff in project winery by eclipse.
the class VersionUtilsTestWithGitBackedRepository method getDifferencesInKVPropertiesAsChangeLog.
@Test
public void getDifferencesInKVPropertiesAsChangeLog() throws Exception {
this.setRevisionTo("origin/plain");
ServiceTemplateId oldVersion = new ServiceTemplateId("http://plain.winery.opentosca.org/servicetemplates", "ServiceTemplateMinimalExampleWithAllPropertyVariants", false);
ServiceTemplateId newVersion = new ServiceTemplateId("http://plain.winery.opentosca.org/servicetemplates", "ServiceTemplateMinimalExampleWithAllPropertyVariants_w1-wip1", false);
ToscaDiff toscaDiff = VersionSupport.calculateDifferences(repository.getElement(oldVersion), repository.getElement(newVersion));
assertEquals("## Changes from version to w1-wip1\n" + "\n" + "### Added\n" + "- topologyTemplate/relationshipTemplates/NodeTypeWithoutProperties_RelationshipTypeWithoutProperties_NodeTypeWithTwoKVProperties\n" + "- topologyTemplate/relationshipTemplates/NodeTypeWithoutProperties_RelationshipTypeWithTwoKvPropertie_NodeTypeWithXmlElementProperty\n" + "- topologyTemplate/relationshipTemplates/NodeTypeWithTwoKVProperties_RelationshipTypeWithXmlElementProperty_NodeTypeWithXmlElementProperty\n" + "\n" + "### Changed\n" + "- id\n" + " changed from \"ServiceTemplateMinimalExampleWithAllPropertyVariants\" to \"ServiceTemplateMinimalExampleWithAllPropertyVariants_w1-wip1\"\n" + "- name\n" + " changed from \"ServiceTemplateMinimalExampleWithAllPropertyVariants\" to \"ServiceTemplateMinimalExampleWithAllPropertyVariants_w1-wip1\"\n" + "- topologyTemplate/nodeTemplates/NodeTypeWithoutProperties/otherAttributes/{{http://www.opentosca.org/winery/extensions/tosca/2013/02/12}location}\n" + " changed from \"undefined\" to \"\"\n" + "- topologyTemplate/nodeTemplates/NodeTypeWithXmlElementProperty/otherAttributes/{{http://www.opentosca.org/winery/extensions/tosca/2013/02/12}location}\n" + " changed from \"undefined\" to \"\"\n" + "- topologyTemplate/nodeTemplates/NodeTypeWithTwoKVProperties/otherAttributes/{{http://www.opentosca.org/winery/extensions/tosca/2013/02/12}location}\n" + " changed from \"undefined\" to \"\"\n" + "- topologyTemplate/nodeTemplates/NodeTypeWithTwoKVProperties/properties/KVProperties/{key1}\n" + " changed from \"value\" to \"testValue\"\n" + "\n" + "### Removed\n" + "- topologyTemplate/relationshipTemplates/con_16\n" + "- topologyTemplate/relationshipTemplates/con_28\n" + "- topologyTemplate/relationshipTemplates/con_40", toscaDiff.getChangeLog());
}
Aggregations