Search in sources :

Example 6 with WineryVersion

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

the class BackendUtilsTestWithGitBackedRepository method getVersionsOfOneDefinition.

@Test
public void getVersionsOfOneDefinition() throws Exception {
    this.setRevisionTo("origin/plain");
    DefinitionsChildId id = new NodeTypeId("http://opentosca.org/nodetypes", "NodeTypeWith5Versions_0.3.4-w3", false);
    List<WineryVersion> versions = WineryVersionUtils.getAllVersionsOfOneDefinition(id, repository);
    assertEquals(5, versions.size());
}
Also used : DefinitionsChildId(org.eclipse.winery.model.ids.definitions.DefinitionsChildId) NodeTypeId(org.eclipse.winery.model.ids.definitions.NodeTypeId) WineryVersion(org.eclipse.winery.common.version.WineryVersion) Test(org.junit.jupiter.api.Test)

Example 7 with WineryVersion

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

the class BackendUtilsTestWithGitBackedRepository method getVersionWithNonEditableFlag.

@Test
public void getVersionWithNonEditableFlag() throws Exception {
    this.setRevisionTo("origin/plain");
    DefinitionsChildId id = new NodeTypeId("http://opentosca.org/nodetypes", "NodeTypeWith5Versions_0.3.4-w3", false);
    List<WineryVersion> versions = WineryVersionUtils.getAllVersionsOfOneDefinition(id, repository);
    versions.forEach(wineryVersion -> assertFalse(wineryVersion.isEditable()));
}
Also used : DefinitionsChildId(org.eclipse.winery.model.ids.definitions.DefinitionsChildId) NodeTypeId(org.eclipse.winery.model.ids.definitions.NodeTypeId) WineryVersion(org.eclipse.winery.common.version.WineryVersion) Test(org.junit.jupiter.api.Test)

Example 8 with WineryVersion

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

the class BackendUtilsTestWithGitBackedRepository method detectChangesInANodeTemplate.

@Test
public void detectChangesInANodeTemplate() throws Exception {
    this.setRevisionTo("origin/plain");
    NodeTypeId newVersion = new NodeTypeId("http://plain.winery.opentosca.org/nodetypes", "NodeTypeWithThreeReqCapPairsCoveringAllReqCapVariants_w1-wip1", false);
    WineryVersion oldVersion = new WineryVersion("", 0, 0);
    ToscaDiff toscaDiff = BackendUtils.compare(newVersion, oldVersion, repository);
    ToscaDiff properties = toscaDiff.getChildrenMap().get("winerysPropertiesDefinition");
    assertEquals(VersionState.CHANGED, toscaDiff.getState());
    assertEquals(VersionState.ADDED, properties.getState());
}
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)

Example 9 with WineryVersion

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

the class VersionUtilsTest method getVersionWithNoVersionInTheName.

@Test
public void getVersionWithNoVersionInTheName() {
    WineryVersion version = VersionUtils.getVersion("myExampleComponent");
    assertEquals("", version.toString());
}
Also used : WineryVersion(org.eclipse.winery.common.version.WineryVersion) Test(org.junit.jupiter.api.Test)

Example 10 with WineryVersion

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

the class VersionUtilsTest method getVersion.

private void getVersion(String cVersion, int wVersion, int wipVersion) {
    WineryVersion wineryVersion = VersionUtils.getVersion(getComponentName("name", cVersion, wVersion, wipVersion));
    assertEquals(cVersion, wineryVersion.getComponentVersion());
    assertEquals(wVersion, wineryVersion.getWineryVersion());
    assertEquals(wipVersion, wineryVersion.getWorkInProgressVersion());
}
Also used : WineryVersion(org.eclipse.winery.common.version.WineryVersion)

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