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