Search in sources :

Example 56 with NodeTypeId

use of org.eclipse.winery.model.ids.definitions.NodeTypeId in project winery by eclipse.

the class VersionUtilsTestWithGitBackedRepository method getDifferencesListWithOnlyOneChange.

@Test
public void getDifferencesListWithOnlyOneChange() throws Exception {
    this.setRevisionTo("origin/plain");
    NodeTypeId oldVersion = new NodeTypeId("http://opentosca.org/nodetypes", "NodeTypeWith5Versions_0.3.0-w2", false);
    NodeTypeId newVersion = new NodeTypeId("http://opentosca.org/nodetypes", "NodeTypeWith5Versions_0.3.4-w1", false);
    ToscaDiff toscaDiff = VersionSupport.calculateDifferences(repository.getElement(oldVersion), repository.getElement(newVersion));
    assertEquals("## Changes from version 0.3.0-w2 to 0.3.4-w1\n" + "\n" + "### Changed\n" + "- QName/localPart\n" + "  changed from \"NodeTypeWith5Versions_0.3.0-w2\" to \"NodeTypeWith5Versions_0.3.4-w1\"\n" + "- name\n" + "  changed from \"NodeTypeWith5Versions_0.3.0-w2\" to \"NodeTypeWith5Versions_0.3.4-w1\"", toscaDiff.getChangeLog());
}
Also used : ToscaDiff(org.eclipse.winery.model.version.ToscaDiff) NodeTypeId(org.eclipse.winery.model.ids.definitions.NodeTypeId) Test(org.junit.jupiter.api.Test)

Example 57 with NodeTypeId

use of org.eclipse.winery.model.ids.definitions.NodeTypeId in project winery by eclipse.

the class BackendUtilsTestWithGitBackedRepository method getVersionListOfAnOldComponentVersionWhichIsReleasable.

@Test
public void getVersionListOfAnOldComponentVersionWhichIsReleasable() throws Exception {
    this.setRevisionTo("origin/plain");
    NodeTypeId id = new NodeTypeId("http://opentosca.org/nodetypes", "NodeTypeWithALowerReleasableManagementVersion_2-w2-wip1", false);
    List<WineryVersion> versionList = WineryVersionUtils.getAllVersionsOfOneDefinition(id, repository);
    WineryVersion version = versionList.get(versionList.size() - 2);
    assertFalse(version.isEditable());
    assertTrue(version.isReleasable());
}
Also used : NodeTypeId(org.eclipse.winery.model.ids.definitions.NodeTypeId) WineryVersion(org.eclipse.winery.common.version.WineryVersion) Test(org.junit.jupiter.api.Test)

Example 58 with NodeTypeId

use of org.eclipse.winery.model.ids.definitions.NodeTypeId in project winery by eclipse.

the class BackendUtilsTestWithGitBackedRepository method getVersionWithEditableFlag.

@Test
public void getVersionWithEditableFlag() throws Exception {
    this.setRevisionTo("origin/plain");
    NodeTypeId id = new NodeTypeId("http://opentosca.org/nodetypes", "NodeTypeWith5Versions_0.3.4-w3", false);
    // Make some changes to the file
    makeSomeChanges(id);
    List<WineryVersion> versions = WineryVersionUtils.getAllVersionsOfOneDefinition(id, repository);
    assertTrue(versions.get(0).isEditable());
    List<WineryVersion> collect = versions.stream().filter(item -> !item.isEditable()).collect(Collectors.toList());
    assertEquals(4, collect.size());
}
Also used : Assertions.assertNotNull(org.junit.jupiter.api.Assertions.assertNotNull) TDefinitions(org.eclipse.winery.model.tosca.TDefinitions) RepositoryFileReference(org.eclipse.winery.repository.common.RepositoryFileReference) Assertions.assertNull(org.junit.jupiter.api.Assertions.assertNull) MediaType(org.apache.tika.mime.MediaType) Collectors(java.util.stream.Collectors) RelationshipTypeId(org.eclipse.winery.model.ids.definitions.RelationshipTypeId) LinkedHashMap(java.util.LinkedHashMap) EncodingUtil(org.eclipse.winery.model.ids.EncodingUtil) Test(org.junit.jupiter.api.Test) WineryVersion(org.eclipse.winery.common.version.WineryVersion) List(java.util.List) VersionState(org.eclipse.winery.common.version.VersionState) TestWithGitBackedRepository(org.eclipse.winery.repository.TestWithGitBackedRepository) Assertions.assertFalse(org.junit.jupiter.api.Assertions.assertFalse) ToscaDiff(org.eclipse.winery.model.version.ToscaDiff) Assertions.assertTrue(org.junit.jupiter.api.Assertions.assertTrue) ModelUtilities(org.eclipse.winery.model.tosca.utils.ModelUtilities) DefinitionsChildId(org.eclipse.winery.model.ids.definitions.DefinitionsChildId) QName(javax.xml.namespace.QName) Assertions.assertEquals(org.junit.jupiter.api.Assertions.assertEquals) PolicyTemplateId(org.eclipse.winery.model.ids.definitions.PolicyTemplateId) TPolicyTemplate(org.eclipse.winery.model.tosca.TPolicyTemplate) NodeTypeId(org.eclipse.winery.model.ids.definitions.NodeTypeId) NodeTypeId(org.eclipse.winery.model.ids.definitions.NodeTypeId) WineryVersion(org.eclipse.winery.common.version.WineryVersion) Test(org.junit.jupiter.api.Test)

Example 59 with NodeTypeId

use of org.eclipse.winery.model.ids.definitions.NodeTypeId in project winery by eclipse.

the class BackendUtilsTestWithGitBackedRepository method getVersionWithEditableFlagAndChangesInAFileWhichIsNotTheToscaFile.

@Test
public void getVersionWithEditableFlagAndChangesInAFileWhichIsNotTheToscaFile() throws Exception {
    this.setRevisionTo("origin/plain");
    NodeTypeId id = new NodeTypeId("http://opentosca.org/nodetypes", "NodeTypeWith5Versions_0.3.4-w3", false);
    // Make some changes to an associated file
    RepositoryFileReference ref = new RepositoryFileReference(id, EncodingUtil.URLdecode("README.md"));
    RepositoryFactory.getRepository().putContentToFile(ref, "someUnguessableContent", MediaType.TEXT_PLAIN);
    List<WineryVersion> versions = WineryVersionUtils.getAllVersionsOfOneDefinition(id, repository);
    assertTrue(versions.get(0).isEditable());
    List<WineryVersion> collect = versions.stream().filter(item -> !item.isEditable()).collect(Collectors.toList());
    assertEquals(4, collect.size());
}
Also used : Assertions.assertNotNull(org.junit.jupiter.api.Assertions.assertNotNull) TDefinitions(org.eclipse.winery.model.tosca.TDefinitions) RepositoryFileReference(org.eclipse.winery.repository.common.RepositoryFileReference) Assertions.assertNull(org.junit.jupiter.api.Assertions.assertNull) MediaType(org.apache.tika.mime.MediaType) Collectors(java.util.stream.Collectors) RelationshipTypeId(org.eclipse.winery.model.ids.definitions.RelationshipTypeId) LinkedHashMap(java.util.LinkedHashMap) EncodingUtil(org.eclipse.winery.model.ids.EncodingUtil) Test(org.junit.jupiter.api.Test) WineryVersion(org.eclipse.winery.common.version.WineryVersion) List(java.util.List) VersionState(org.eclipse.winery.common.version.VersionState) TestWithGitBackedRepository(org.eclipse.winery.repository.TestWithGitBackedRepository) Assertions.assertFalse(org.junit.jupiter.api.Assertions.assertFalse) ToscaDiff(org.eclipse.winery.model.version.ToscaDiff) Assertions.assertTrue(org.junit.jupiter.api.Assertions.assertTrue) ModelUtilities(org.eclipse.winery.model.tosca.utils.ModelUtilities) DefinitionsChildId(org.eclipse.winery.model.ids.definitions.DefinitionsChildId) QName(javax.xml.namespace.QName) Assertions.assertEquals(org.junit.jupiter.api.Assertions.assertEquals) PolicyTemplateId(org.eclipse.winery.model.ids.definitions.PolicyTemplateId) TPolicyTemplate(org.eclipse.winery.model.tosca.TPolicyTemplate) NodeTypeId(org.eclipse.winery.model.ids.definitions.NodeTypeId) RepositoryFileReference(org.eclipse.winery.repository.common.RepositoryFileReference) NodeTypeId(org.eclipse.winery.model.ids.definitions.NodeTypeId) WineryVersion(org.eclipse.winery.common.version.WineryVersion) Test(org.junit.jupiter.api.Test)

Example 60 with NodeTypeId

use of org.eclipse.winery.model.ids.definitions.NodeTypeId 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

NodeTypeId (org.eclipse.winery.model.ids.definitions.NodeTypeId)67 TNodeType (org.eclipse.winery.model.tosca.TNodeType)36 TNodeTemplate (org.eclipse.winery.model.tosca.TNodeTemplate)28 Test (org.junit.jupiter.api.Test)27 DefinitionsChildId (org.eclipse.winery.model.ids.definitions.DefinitionsChildId)23 QName (javax.xml.namespace.QName)21 IRepository (org.eclipse.winery.repository.backend.IRepository)20 RelationshipTypeId (org.eclipse.winery.model.ids.definitions.RelationshipTypeId)15 TTopologyTemplate (org.eclipse.winery.model.tosca.TTopologyTemplate)15 WineryVersion (org.eclipse.winery.common.version.WineryVersion)14 Response (javax.ws.rs.core.Response)13 IOException (java.io.IOException)12 LinkedHashMap (java.util.LinkedHashMap)12 ServiceTemplateId (org.eclipse.winery.model.ids.definitions.ServiceTemplateId)11 TServiceTemplate (org.eclipse.winery.model.tosca.TServiceTemplate)11 ArtifactTemplateId (org.eclipse.winery.model.ids.definitions.ArtifactTemplateId)10 TRelationshipTemplate (org.eclipse.winery.model.tosca.TRelationshipTemplate)10 ArrayList (java.util.ArrayList)9 TDefinitions (org.eclipse.winery.model.tosca.TDefinitions)9 TEntityTemplate (org.eclipse.winery.model.tosca.TEntityTemplate)9