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());
}
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();
}
}
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());
}
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());
}
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()));
}
Aggregations