Search in sources :

Example 6 with ToscaDiff

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());
}
Also used : ToscaDiff(org.eclipse.winery.model.version.ToscaDiff) ServiceTemplateId(org.eclipse.winery.model.ids.definitions.ServiceTemplateId) Test(org.junit.jupiter.api.Test)

Example 7 with ToscaDiff

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());
}
Also used : ToscaDiff(org.eclipse.winery.model.version.ToscaDiff) ServiceTemplateId(org.eclipse.winery.model.ids.definitions.ServiceTemplateId) Test(org.junit.jupiter.api.Test)

Example 8 with ToscaDiff

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());
}
Also used : ToscaDiff(org.eclipse.winery.model.version.ToscaDiff) ServiceTemplateId(org.eclipse.winery.model.ids.definitions.ServiceTemplateId) Test(org.junit.jupiter.api.Test)

Example 9 with ToscaDiff

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());
}
Also used : ToscaDiff(org.eclipse.winery.model.version.ToscaDiff) ServiceTemplateId(org.eclipse.winery.model.ids.definitions.ServiceTemplateId) Test(org.junit.jupiter.api.Test)

Example 10 with ToscaDiff

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());
}
Also used : ToscaDiff(org.eclipse.winery.model.version.ToscaDiff) ServiceTemplateId(org.eclipse.winery.model.ids.definitions.ServiceTemplateId) Test(org.junit.jupiter.api.Test)

Aggregations

ToscaDiff (org.eclipse.winery.model.version.ToscaDiff)15 Test (org.junit.jupiter.api.Test)14 ServiceTemplateId (org.eclipse.winery.model.ids.definitions.ServiceTemplateId)11 WineryVersion (org.eclipse.winery.common.version.WineryVersion)3 NodeTypeId (org.eclipse.winery.model.ids.definitions.NodeTypeId)3 IOException (java.io.IOException)1 GET (javax.ws.rs.GET)1 NotFoundException (javax.ws.rs.NotFoundException)1 Produces (javax.ws.rs.Produces)1 WebApplicationException (javax.ws.rs.WebApplicationException)1 JAXBException (javax.xml.bind.JAXBException)1 QNameWithTypeApiData (org.eclipse.winery.repository.rest.resources.apiData.QNameWithTypeApiData)1 SAXException (org.xml.sax.SAXException)1