use of org.eclipse.winery.model.ids.definitions.DefinitionsChildId in project winery by eclipse.
the class RestUtilsWithGitBackendTest method renameDefinitionWithoutVersion.
@Test
public void renameDefinitionWithoutVersion() throws Exception {
this.setRevisionTo("origin/plain");
String oldName = "NodeTypeWithOneReqCapPairWithoutProperties";
String newName = "exampleName";
String namespace = "http://plain.winery.opentosca.org/nodetypes";
DefinitionsChildId oldId = new NodeTypeId(namespace, oldName, false);
DefinitionsChildId newId = new NodeTypeId(namespace, newName, false);
Response response = RestUtils.rename(oldId, newId).getResponse();
String expectedEntity = "http://localhost:8080/winery/nodetypes/" + EncodingUtil.URLencode(EncodingUtil.URLencode(namespace)) + "/" + newName + "/";
assertEquals(201, response.getStatus());
assertEquals(expectedEntity, response.getEntity());
}
use of org.eclipse.winery.model.ids.definitions.DefinitionsChildId in project winery by eclipse.
the class RestUtilsWithGitBackendTest method renameDefinitionNamespaceWithoutVersion.
@Test
public void renameDefinitionNamespaceWithoutVersion() throws Exception {
this.setRevisionTo("origin/plain");
String name = "NodeTypeWithOneReqCapPairWithoutProperties";
String newNamespace = "http://example.org/nodetypes";
String oldNamespace = "http://plain.winery.opentosca.org/nodetypes";
DefinitionsChildId oldId = new NodeTypeId(oldNamespace, name, false);
DefinitionsChildId newId = new NodeTypeId(newNamespace, name, false);
Response response = RestUtils.rename(oldId, newId).getResponse();
String expectedEntity = "http://localhost:8080/winery/nodetypes/" + EncodingUtil.URLencode(EncodingUtil.URLencode(newNamespace)) + "/" + name + "/";
assertEquals(201, response.getStatus());
assertEquals(expectedEntity, response.getEntity());
}
use of org.eclipse.winery.model.ids.definitions.DefinitionsChildId in project winery by eclipse.
the class RestUtilsWithGitBackendTest method renameSingleDefinitionWhichHasChanges.
@Test
public void renameSingleDefinitionWhichHasChanges() throws Exception {
this.setRevisionTo("origin/plain");
String version = "_0.3.4-w3";
String otherVersion = version + "-wip3";
String oldName = "NodeTypeWith5Versions";
String newName = "exampleName";
String namespace = "http://opentosca.org/nodetypes";
NodeTypeId oldId = new NodeTypeId(namespace, oldName + version, false);
DefinitionsChildId newId = new NodeTypeId(namespace, newName + version, false);
// required because oldId doesn't exist anymore after the rename
DefinitionsChildId otherElement = new NodeTypeId(namespace, oldName + otherVersion, false);
makeSomeChanges(oldId);
Response response = RestUtils.rename(oldId, newId).getResponse();
String expectedEntity = "http://localhost:8080/winery/nodetypes/" + EncodingUtil.URLencode(EncodingUtil.URLencode(namespace)) + "/" + newName + version + "/";
assertEquals(201, response.getStatus());
assertEquals(expectedEntity, response.getEntity());
assertEquals(4, WineryVersionUtils.getAllVersionsOfOneDefinition(otherElement, repository).size());
assertEquals(1, WineryVersionUtils.getAllVersionsOfOneDefinition(newId, repository).size());
}
use of org.eclipse.winery.model.ids.definitions.DefinitionsChildId in project winery by eclipse.
the class RestUtilsWithGitBackendTest method renameSingleDefinitionNamespaceWithVersion.
@Test
public void renameSingleDefinitionNamespaceWithVersion() throws Exception {
this.setRevisionTo("origin/plain");
String version = "_0.3.4-w3";
String name = "NodeTypeWith5Versions";
String oldNamespace = "http://opentosca.org/nodetypes";
String newNamespace = "http://example.org/nodetypes";
DefinitionsChildId oldId = new NodeTypeId(oldNamespace, name + version, false);
DefinitionsChildId newId = new NodeTypeId(newNamespace, name + version, false);
Response response = RestUtils.rename(oldId, newId).getResponse();
String expectedEntity = "http://localhost:8080/winery/nodetypes/" + EncodingUtil.URLencode(EncodingUtil.URLencode(newNamespace)) + "/" + name + version + "/";
assertEquals(201, response.getStatus());
assertEquals(expectedEntity, response.getEntity());
assertEquals(5, WineryVersionUtils.getAllVersionsOfOneDefinition(oldId, repository).size());
assertEquals(1, WineryVersionUtils.getAllVersionsOfOneDefinition(newId, repository).size());
}
use of org.eclipse.winery.model.ids.definitions.DefinitionsChildId in project winery by eclipse.
the class RestUtilsWithGitBackendTest method renameSingleDefinitionWithVersion.
@Test
public void renameSingleDefinitionWithVersion() throws Exception {
this.setRevisionTo("origin/plain");
String version = "_0.3.4-w3";
String oldName = "NodeTypeWith5Versions";
String newName = "exampleName";
String namespace = "http://opentosca.org/nodetypes";
DefinitionsChildId oldId = new NodeTypeId(namespace, oldName + version, false);
DefinitionsChildId newId = new NodeTypeId(namespace, newName + version, false);
Response response = RestUtils.rename(oldId, newId).getResponse();
String expectedEntity = "http://localhost:8080/winery/nodetypes/" + EncodingUtil.URLencode(EncodingUtil.URLencode(namespace)) + "/" + newName + version + "/";
assertEquals(201, response.getStatus());
assertEquals(expectedEntity, response.getEntity());
assertEquals(5, WineryVersionUtils.getAllVersionsOfOneDefinition(oldId, repository).size());
assertEquals(1, WineryVersionUtils.getAllVersionsOfOneDefinition(newId, repository).size());
}
Aggregations