Search in sources :

Example 36 with WineryVersion

use of org.eclipse.winery.common.version.WineryVersion in project winery by eclipse.

the class BackendUtilsTestWithGitBackedRepository method getVersionWithEditableFlagFromComponentWithoutAVersion.

@Test
public void getVersionWithEditableFlagFromComponentWithoutAVersion() throws Exception {
    this.setRevisionTo("origin/plain");
    PolicyTemplateId policyTemplateId = new PolicyTemplateId("http://plain.winery.opentosca.org/policytemplates", "PolicyTemplateWithoutProperties", false);
    List<WineryVersion> versions = WineryVersionUtils.getAllVersionsOfOneDefinition(policyTemplateId, repository);
    // For convenience, we accept editing already existing components without versions
    assertTrue(versions.get(0).isEditable());
}
Also used : PolicyTemplateId(org.eclipse.winery.model.ids.definitions.PolicyTemplateId) WineryVersion(org.eclipse.winery.common.version.WineryVersion) Test(org.junit.jupiter.api.Test)

Example 37 with WineryVersion

use of org.eclipse.winery.common.version.WineryVersion in project winery by eclipse.

the class BackendUtilsTestWithGitBackedRepository method detectPropertyChangesInANodeTemplate.

@Test
public void detectPropertyChangesInANodeTemplate() throws Exception {
    this.setRevisionTo("origin/plain");
    NodeTypeId newVersion = new NodeTypeId("http://plain.winery.opentosca.org/nodetypes", "NodeTypeWithThreeReqCapPairsCoveringAllReqCapVariants_w1-wip2", false);
    WineryVersion oldVersion = new WineryVersion("", 1, 1);
    ToscaDiff toscaDiff = BackendUtils.compare(newVersion, oldVersion, repository);
    ToscaDiff properties = toscaDiff.getChildrenMap().get("winerysPropertiesDefinition").getChildrenMap().get("propertyDefinitions");
    assertEquals(VersionState.CHANGED, toscaDiff.getState());
    assertEquals(VersionState.CHANGED, properties.getState());
    assertEquals(3, properties.getChildren().size());
}
Also used : ToscaDiff(org.eclipse.winery.model.version.ToscaDiff) NodeTypeId(org.eclipse.winery.model.ids.definitions.NodeTypeId) WineryVersion(org.eclipse.winery.common.version.WineryVersion) Test(org.junit.jupiter.api.Test)

Aggregations

WineryVersion (org.eclipse.winery.common.version.WineryVersion)37 Test (org.junit.jupiter.api.Test)19 NodeTypeId (org.eclipse.winery.model.ids.definitions.NodeTypeId)14 DefinitionsChildId (org.eclipse.winery.model.ids.definitions.DefinitionsChildId)12 Produces (javax.ws.rs.Produces)8 IRepository (org.eclipse.winery.repository.backend.IRepository)8 IOException (java.io.IOException)7 POST (javax.ws.rs.POST)7 Path (javax.ws.rs.Path)7 ArrayList (java.util.ArrayList)6 List (java.util.List)6 QName (javax.xml.namespace.QName)6 ServiceTemplateId (org.eclipse.winery.model.ids.definitions.ServiceTemplateId)6 ResourceResult (org.eclipse.winery.repository.rest.resources._support.ResourceResult)6 QNameApiData (org.eclipse.winery.repository.rest.resources.apiData.QNameApiData)6 LinkedHashMap (java.util.LinkedHashMap)5 Response (javax.ws.rs.core.Response)5 Map (java.util.Map)4 Collectors (java.util.stream.Collectors)4 TNodeTemplate (org.eclipse.winery.model.tosca.TNodeTemplate)4