Search in sources :

Example 11 with NodeTypeId

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

the class FromCanonical method convert.

@NonNull
public Map<String, YTNodeTemplate> convert(TNodeTemplate node, @NonNull List<TRelationshipTemplate> rTs) {
    if (Objects.isNull(node)) {
        return new LinkedHashMap<>();
    }
    Metadata meta = new Metadata();
    if (Objects.nonNull(node.getX()) && Objects.nonNull(node.getY())) {
        meta.add(org.eclipse.winery.model.converter.support.Defaults.X_COORD, node.getX());
        meta.add(org.eclipse.winery.model.converter.support.Defaults.Y_COORD, node.getY());
    }
    if (Objects.nonNull(node.getName())) {
        meta.add(org.eclipse.winery.model.converter.support.Defaults.DISPLAY_NAME, node.getName());
    }
    return Collections.singletonMap(node.getIdFromIdOrNameField(), new YTNodeTemplate.Builder(convert(node.getType(), new NodeTypeId(node.getType()))).setProperties(convert(node.getProperties())).setMetadata(meta).setRequirements(convertRequirements(node.getRequirements())).setCapabilities(convert(node.getCapabilities())).setArtifacts(convert(node.getArtifacts())).build());
}
Also used : Metadata(org.eclipse.winery.model.tosca.yaml.support.Metadata) NodeTypeId(org.eclipse.winery.model.ids.definitions.NodeTypeId) LinkedHashMap(java.util.LinkedHashMap) YTNodeTemplate(org.eclipse.winery.model.tosca.yaml.YTNodeTemplate) NonNull(org.eclipse.jdt.annotation.NonNull)

Example 12 with NodeTypeId

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

the class RepositoryResolverTest method getRepository.

@Test
public void getRepository() throws GitAPIException {
    this.setRevisionTo("1f24de8867bf3df5d26b932abf4526c625d8502f");
    Path resolverRepositoryPath = Paths.get(System.getProperty("java.io.tmpdir")).resolve("test-repository");
    try {
        GitBasedRepository resolverRepository = resolver.createRepository(resolverRepositoryPath.toFile());
        assertEquals(59, resolverRepository.getNamespaceManager().getAllNamespaces().size());
        SortedSet<NodeTypeId> allNodeTypes = resolverRepository.getAllDefinitionsChildIds(NodeTypeId.class);
        assertEquals(45, allNodeTypes.size());
    } catch (IOException | GitAPIException ex) {
        ex.getStackTrace();
    }
}
Also used : Path(java.nio.file.Path) GitAPIException(org.eclipse.jgit.api.errors.GitAPIException) NodeTypeId(org.eclipse.winery.model.ids.definitions.NodeTypeId) IOException(java.io.IOException) GitBasedRepository(org.eclipse.winery.repository.backend.filebased.GitBasedRepository) Test(org.junit.jupiter.api.Test)

Example 13 with NodeTypeId

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

the class BackendUtilsTestWithGitBackedRepository method getVersionListOfAnOldComponentVersionWhichIsEditable.

@Test
public void getVersionListOfAnOldComponentVersionWhichIsEditable() throws Exception {
    this.setRevisionTo("origin/plain");
    NodeTypeId id = new NodeTypeId("http://opentosca.org/nodetypes", "NodeTypeWithALowerReleasableManagementVersion_2-w2-wip1", false);
    // instead of creating a new NodeType, just make some changes to this element, which should create the same state
    makeSomeChanges(id);
    List<WineryVersion> versionList = WineryVersionUtils.getAllVersionsOfOneDefinition(id, repository);
    WineryVersion version = versionList.get(versionList.size() - 2);
    assertTrue(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 14 with NodeTypeId

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

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

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