Exchanging endpoints from v2 to v3

This commit is contained in:
piotrpekala7 2021-04-28 01:18:52 +02:00
parent d73f65dc70
commit 64b814acd7
27 changed files with 85 additions and 85 deletions

View File

@ -77,6 +77,6 @@ export class SymbolsComponent implements OnInit {
}
getImageSourceForTemplate(symbol: string) {
return `${this.server.protocol}//${this.server.host}:${this.server.port}/v2/symbols/${symbol}/raw`;
return `${this.server.protocol}//${this.server.host}:${this.server.port}/v3/symbols/${symbol}/raw`;
}
}

View File

@ -149,6 +149,6 @@ export class ImportApplianceComponent implements OnInit {
}
private getUploadPath(server: Server, emulator: string, filename: string) {
return `${server.protocol}//${server.host}:${server.port}/v2/${emulator}/images/${filename}`;
return `${server.protocol}//${server.host}:${server.port}/v3/${emulator}/images/${filename}`;
}
}

View File

@ -234,7 +234,7 @@ export class ProjectMapComponent implements OnInit, OnDestroy {
this.nodesDataSource.changes.subscribe((nodes: Node[]) => {
if (!this.server) return;
nodes.forEach(async (node: Node) => {
node.symbol_url = `${this.server.protocol}//${this.server.host}:${this.server.port}/v2/symbols/${node.symbol}/raw`;
node.symbol_url = `${this.server.protocol}//${this.server.host}:${this.server.port}/v3/symbols/${node.symbol}/raw`;
if (node.width == 0 && node.height == 0) {
let symbolDimensions = await this.symbolService.getDimensions(this.server, node.symbol).toPromise();

View File

@ -47,11 +47,11 @@ export class MockedProjectService {
}
getUploadPath(server: Server, uuid: string, project_name: string) {
return `http://${server.host}:${server.port}/v2/projects/${uuid}/import?name=${project_name}`;
return `http://${server.host}:${server.port}/v3/projects/${uuid}/import?name=${project_name}`;
}
getExportPath(server: Server, project: Project) {
return `http://${server.host}:${server.port}/v2/projects/${project.project_id}/export`;
return `http://${server.host}:${server.port}/v3/projects/${project.project_id}/export`;
}
}

View File

@ -128,7 +128,7 @@ export class TemplateComponent implements OnInit, OnDestroy {
}
getImageSourceForTemplate(template: Template) {
return `${this.server.protocol}//${this.server.host}:${this.server.port}/v2/symbols/${template.symbol}/raw`;
return `${this.server.protocol}//${this.server.host}:${this.server.port}/v3/symbols/${template.symbol}/raw`;
}
ngOnDestroy() {

View File

@ -17,7 +17,7 @@ export class ApplianceService {
}
getUploadPath(server: Server, emulator: string, filename: string) {
return `${server.protocol}//${server.host}:${server.port}/v2/compute/${emulator}/images/${filename}`;
return `${server.protocol}//${server.host}:${server.port}/v3/compute/${emulator}/images/${filename}`;
}
updateAppliances(server: Server): Observable<Appliance[]> {

View File

@ -51,7 +51,7 @@ describe('BuiltInTemplatesService', () => {
service.saveTemplate(server, cloudtemplate).subscribe();
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v2/templates/1');
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/templates/1');
expect(req.request.method).toEqual('PUT');
expect(req.request.body).toEqual(cloudtemplate);
}));
@ -71,7 +71,7 @@ describe('BuiltInTemplatesService', () => {
service.saveTemplate(server, ethernethubtemplate).subscribe();
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v2/templates/2');
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/templates/2');
expect(req.request.method).toEqual('PUT');
expect(req.request.body).toEqual(ethernethubtemplate);
}));
@ -91,7 +91,7 @@ describe('BuiltInTemplatesService', () => {
service.saveTemplate(server, ethernetswitchtemplate).subscribe();
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v2/templates/3');
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/templates/3');
expect(req.request.method).toEqual('PUT');
expect(req.request.body).toEqual(ethernetswitchtemplate);
}));
@ -112,7 +112,7 @@ describe('BuiltInTemplatesService', () => {
service.addTemplate(server, cloudtemplate).subscribe();
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v2/templates');
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/templates');
expect(req.request.method).toEqual('POST');
expect(req.request.body).toEqual(cloudtemplate);
}));
@ -132,7 +132,7 @@ describe('BuiltInTemplatesService', () => {
service.addTemplate(server, ethernethubtemplate).subscribe();
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v2/templates');
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/templates');
expect(req.request.method).toEqual('POST');
expect(req.request.body).toEqual(ethernethubtemplate);
}));
@ -152,7 +152,7 @@ describe('BuiltInTemplatesService', () => {
service.addTemplate(server, ethernetswitchtemplate).subscribe();
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v2/templates');
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/templates');
expect(req.request.method).toEqual('POST');
expect(req.request.body).toEqual(ethernetswitchtemplate);
}));

View File

@ -14,7 +14,7 @@ export class ComputeService {
}
getUploadPath(server: Server, emulator: string, filename: string) {
return `${server.protocol}//${server.host}:${server.port}/v2/${emulator}/images/${filename}`;
return `${server.protocol}//${server.host}:${server.port}/v3/${emulator}/images/${filename}`;
}
getStatistics(server: Server): Observable<ComputeStatistics[]> {

View File

@ -44,7 +44,7 @@ describe('DrawingService', () => {
service.updatePosition(server, project, drawing, 10, 20).subscribe();
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v2/projects/myproject/drawings/id');
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/projects/myproject/drawings/id');
expect(req.request.method).toEqual('PUT');
expect(req.request.body).toEqual({
x: 10,
@ -59,7 +59,7 @@ describe('DrawingService', () => {
service.updatePosition(server, project, drawing, 10.1, 20.6).subscribe();
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v2/projects/myproject/drawings/id');
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/projects/myproject/drawings/id');
expect(req.request.method).toEqual('PUT');
expect(req.request.body).toEqual({
x: 10,
@ -75,7 +75,7 @@ describe('DrawingService', () => {
service.updateSizeAndPosition(server, drawing, 100, 100, svgSample).subscribe();
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v2/projects/myproject/drawings/id');
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/projects/myproject/drawings/id');
expect(req.request.method).toEqual('PUT');
expect(req.request.body).toEqual({
x: 100,
@ -94,7 +94,7 @@ describe('DrawingService', () => {
service.updateSizeAndPosition(server, drawing, 100.1, 100.6, svgSample).subscribe();
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v2/projects/myproject/drawings/id');
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/projects/myproject/drawings/id');
expect(req.request.method).toEqual('PUT');
expect(req.request.body).toEqual({
x: 100,
@ -117,7 +117,7 @@ describe('DrawingService', () => {
service.update(server, drawing).subscribe();
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v2/projects/myproject/drawings/id');
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/projects/myproject/drawings/id');
expect(req.request.method).toEqual('PUT');
expect(req.request.body).toEqual({
x: 10,
@ -136,7 +136,7 @@ describe('DrawingService', () => {
service.delete(server, drawing).subscribe();
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v2/projects/myproject/drawings/id');
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/projects/myproject/drawings/id');
expect(req.request.method).toEqual('DELETE');
}));
@ -153,7 +153,7 @@ describe('DrawingService', () => {
service.duplicate(server, drawing.project_id, drawing).subscribe();
const req = httpTestingController.expectOne(`http://127.0.0.1:3080/v2/projects/${drawing.project_id}/drawings`);
const req = httpTestingController.expectOne(`http://127.0.0.1:3080/v3/projects/${drawing.project_id}/drawings`);
expect(req.request.method).toEqual('POST');
expect(req.request.body).toEqual({
svg: drawing.svg,

View File

@ -76,7 +76,7 @@ describe('HttpServer', () => {
it('should make GET query for get method', () => {
service.get(server, '/test').subscribe();
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v2/test');
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/test');
expect(req.request.method).toEqual('GET');
expect(req.request.responseType).toEqual('json');
});
@ -89,7 +89,7 @@ describe('HttpServer', () => {
expect(data).toEqual(testData);
});
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v2/test');
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/test');
expect(req.request.method).toEqual('GET');
expect(req.request.responseType).toEqual('json');
@ -115,7 +115,7 @@ describe('HttpServer', () => {
it('should make GET query for getText method', () => {
service.getText(server, '/test').subscribe();
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v2/test');
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/test');
expect(req.request.method).toEqual('GET');
expect(req.request.responseType).toEqual('text');
});
@ -130,7 +130,7 @@ describe('HttpServer', () => {
})
.subscribe();
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v2/test');
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/test');
expect(req.request.method).toEqual('GET');
expect(req.request.responseType).toEqual('text');
});
@ -138,7 +138,7 @@ describe('HttpServer', () => {
it('should make POST query for post method', () => {
service.post(server, '/test', { test: '1' }).subscribe();
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v2/test');
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/test');
expect(req.request.method).toEqual('POST');
expect(req.request.responseType).toEqual('json');
});
@ -146,7 +146,7 @@ describe('HttpServer', () => {
it('should make PUT query for put method', () => {
service.put(server, '/test', { test: '1' }).subscribe();
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v2/test');
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/test');
expect(req.request.method).toEqual('PUT');
expect(req.request.responseType).toEqual('json');
});
@ -154,7 +154,7 @@ describe('HttpServer', () => {
it('should make DELETE query for delete method', () => {
service.delete(server, '/test').subscribe();
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v2/test');
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/test');
expect(req.request.method).toEqual('DELETE');
expect(req.request.responseType).toEqual('json');
});
@ -162,7 +162,7 @@ describe('HttpServer', () => {
it('should make PATCH query for patch method', () => {
service.patch(server, '/test', { test: '1' }).subscribe();
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v2/test');
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/test');
expect(req.request.method).toEqual('PATCH');
expect(req.request.responseType).toEqual('json');
});
@ -170,7 +170,7 @@ describe('HttpServer', () => {
it('should make HEAD query for head method', () => {
service.head(server, '/test').subscribe();
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v2/test');
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/test');
expect(req.request.method).toEqual('HEAD');
expect(req.request.responseType).toEqual('json');
});
@ -178,7 +178,7 @@ describe('HttpServer', () => {
it('should make OPTIONS query for options method', () => {
service.options(server, '/test').subscribe();
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v2/test');
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/test');
expect(req.request.method).toEqual('OPTIONS');
expect(req.request.responseType).toEqual('json');
});
@ -190,7 +190,7 @@ describe('HttpServer', () => {
service.get(server, '/test').subscribe();
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v2/test');
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/test');
expect(req.request.method).toEqual('GET');
expect(req.request.responseType).toEqual('json');
expect(req.request.headers.get('Authorization')).toEqual('Basic bG9naW46cGFzc3dvcmQ=');
@ -209,7 +209,7 @@ describe('HttpServer', () => {
})
.subscribe();
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v2/test');
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/test');
expect(req.request.method).toEqual('GET');
expect(req.request.responseType).toEqual('json');
expect(req.request.headers.get('Authorization')).toEqual('Basic bG9naW46cGFzc3dvcmQ=');
@ -228,7 +228,7 @@ describe('HttpServer', () => {
})
.subscribe();
const req = httpTestingController.expectOne('/v2/test');
expect(req.request.url).toBe('/v2/test');
const req = httpTestingController.expectOne('/v3/test');
expect(req.request.url).toBe('/v3/test');
});
});

View File

@ -14,7 +14,7 @@ export class IosService {
}
getImagePath(server: Server, filename: string): string {
return `${server.protocol}//${server.host}:${server.port}/v2/compute/dynamips/images/${filename}`;
return `${server.protocol}//${server.host}:${server.port}/v3/compute/dynamips/images/${filename}`;
}
getTemplates(server: Server): Observable<IosTemplate[]> {

View File

@ -22,7 +22,7 @@ export class IouService {
}
getImagePath(server: Server, filename: string): string {
return `${server.protocol}//${server.host}:${server.port}/v2/compute/iou/images/${filename}`;
return `${server.protocol}//${server.host}:${server.port}/v3/compute/iou/images/${filename}`;
}
addTemplate(server: Server, iouTemplate: any): Observable<any> {

View File

@ -53,7 +53,7 @@ describe('LinkService', () => {
service.createLink(server, sourceNode, sourcePort, targetNode, targetPort, 0, 0, 10, 10).subscribe();
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v2/projects/myproject/links');
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/projects/myproject/links');
expect(req.request.method).toEqual('POST');
expect(req.request.body).toEqual({
nodes: [

View File

@ -46,7 +46,7 @@ describe('NodeService', () => {
service.start(server, node).subscribe();
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v2/projects/myproject/nodes/id/start');
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/projects/myproject/nodes/id/start');
expect(req.request.method).toEqual('POST');
expect(req.request.body).toEqual({});
}));
@ -58,7 +58,7 @@ describe('NodeService', () => {
service.stop(server, node).subscribe();
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v2/projects/myproject/nodes/id/stop');
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/projects/myproject/nodes/id/stop');
expect(req.request.method).toEqual('POST');
expect(req.request.body).toEqual({});
}));
@ -70,7 +70,7 @@ describe('NodeService', () => {
service.suspend(server, node).subscribe();
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v2/projects/myproject/nodes/id/suspend');
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/projects/myproject/nodes/id/suspend');
expect(req.request.method).toEqual('POST');
expect(req.request.body).toEqual({});
}));
@ -82,7 +82,7 @@ describe('NodeService', () => {
service.reload(server, node).subscribe();
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v2/projects/myproject/nodes/id/reload');
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/projects/myproject/nodes/id/reload');
expect(req.request.method).toEqual('POST');
expect(req.request.body).toEqual({});
}));
@ -94,7 +94,7 @@ describe('NodeService', () => {
service.startAll(server, project).subscribe();
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v2/projects/1/nodes/start');
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/projects/1/nodes/start');
expect(req.request.method).toEqual('POST');
expect(req.request.body).toEqual({});
}));
@ -106,7 +106,7 @@ describe('NodeService', () => {
service.stopAll(server, project).subscribe();
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v2/projects/1/nodes/stop');
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/projects/1/nodes/stop');
expect(req.request.method).toEqual('POST');
expect(req.request.body).toEqual({});
}));
@ -118,7 +118,7 @@ describe('NodeService', () => {
service.suspendAll(server, project).subscribe();
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v2/projects/1/nodes/suspend');
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/projects/1/nodes/suspend');
expect(req.request.method).toEqual('POST');
expect(req.request.body).toEqual({});
}));
@ -130,7 +130,7 @@ describe('NodeService', () => {
service.reloadAll(server, project).subscribe();
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v2/projects/1/nodes/reload');
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/projects/1/nodes/reload');
expect(req.request.method).toEqual('POST');
expect(req.request.body).toEqual({});
}));
@ -143,7 +143,7 @@ describe('NodeService', () => {
service.createFromTemplate(server, project, template, 10, 20, 'compute').subscribe();
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v2/projects/myproject/templates/mytemplate');
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/projects/myproject/templates/mytemplate');
expect(req.request.method).toEqual('POST');
expect(req.request.body).toEqual({
x: 10,
@ -162,7 +162,7 @@ describe('NodeService', () => {
service.updatePosition(server, project, node, 10, 20).subscribe();
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v2/projects/myproject/nodes/id');
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/projects/myproject/nodes/id');
expect(req.request.method).toEqual('PUT');
expect(req.request.body).toEqual({
x: 10,
@ -180,7 +180,7 @@ describe('NodeService', () => {
service.updatePosition(server, project, node, 10.1, 20.6).subscribe();
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v2/projects/myproject/nodes/id');
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/projects/myproject/nodes/id');
expect(req.request.method).toEqual('PUT');
expect(req.request.body).toEqual({
x: 10,
@ -202,7 +202,7 @@ describe('NodeService', () => {
service.updateLabel(server, node, label).subscribe();
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v2/projects/myproject/nodes/id');
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/projects/myproject/nodes/id');
expect(req.request.method).toEqual('PUT');
expect(req.request.body).toEqual({
label: {
@ -225,7 +225,7 @@ describe('NodeService', () => {
service.update(server, node).subscribe();
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v2/projects/myproject/nodes/id');
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/projects/myproject/nodes/id');
expect(req.request.method).toEqual('PUT');
expect(req.request.body).toEqual({
x: 10,
@ -241,7 +241,7 @@ describe('NodeService', () => {
service.delete(server, node).subscribe();
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v2/projects/myproject/nodes/id');
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/projects/myproject/nodes/id');
expect(req.request.method).toEqual('DELETE');
}));
@ -253,7 +253,7 @@ describe('NodeService', () => {
service.duplicate(server, node).subscribe();
const req = httpTestingController.expectOne(
`http://127.0.0.1:3080/v2/projects/${node.project_id}/nodes/${node.node_id}/duplicate`
`http://127.0.0.1:3080/v3/projects/${node.project_id}/nodes/${node.node_id}/duplicate`
);
expect(req.request.method).toEqual('POST');
}));

View File

@ -63,7 +63,7 @@ export class NodeConsoleService {
protocol = "wss"
}
return `${protocol}://${server.host}:${server.port}/v2/projects/${node.project_id}/nodes/${node.node_id}/console/ws`
return `${protocol}://${server.host}:${server.port}/v3/projects/${node.project_id}/nodes/${node.node_id}/console/ws`
}
}

View File

@ -9,7 +9,7 @@ export class NotificationService {
protocol = "wss"
}
return `${protocol}://${server.host}:${server.port}/v2/notifications/ws`;
return `${protocol}://${server.host}:${server.port}/v3/notifications/ws`;
}
@ -19,6 +19,6 @@ export class NotificationService {
protocol = "wss"
}
return `${protocol}://${server.host}:${server.port}/v2/projects/${project_id}/notifications/ws`;
return `${protocol}://${server.host}:${server.port}/v3/projects/${project_id}/notifications/ws`;
}
}

View File

@ -90,14 +90,14 @@ describe('ProjectService', () => {
it('should get the project', () => {
service.get(server, 'myproject').subscribe();
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v2/projects/myproject');
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/projects/myproject');
expect(req.request.method).toEqual('GET');
});
it('should open the project', () => {
service.open(server, 'myproject').subscribe();
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v2/projects/myproject/open');
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/projects/myproject/open');
expect(req.request.method).toEqual('POST');
expect(req.request.body).toEqual({});
});
@ -105,7 +105,7 @@ describe('ProjectService', () => {
it('should close the project', () => {
service.close(server, 'myproject').subscribe();
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v2/projects/myproject/close');
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/projects/myproject/close');
expect(req.request.method).toEqual('POST');
expect(req.request.body).toEqual({});
});
@ -113,42 +113,42 @@ describe('ProjectService', () => {
it('should list projects', () => {
service.list(server).subscribe();
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v2/projects');
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/projects');
expect(req.request.method).toEqual('GET');
});
it('should get nodes of project', () => {
service.nodes(server, 'myproject').subscribe();
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v2/projects/myproject/nodes');
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/projects/myproject/nodes');
expect(req.request.method).toEqual('GET');
});
it('should get links of project', () => {
service.links(server, 'myproject').subscribe();
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v2/projects/myproject/links');
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/projects/myproject/links');
expect(req.request.method).toEqual('GET');
});
it('should get drawings of project', () => {
service.drawings(server, 'myproject').subscribe();
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v2/projects/myproject/drawings');
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/projects/myproject/drawings');
expect(req.request.method).toEqual('GET');
});
it('should delete the project', () => {
service.delete(server, 'myproject').subscribe();
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v2/projects/myproject');
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/projects/myproject');
expect(req.request.method).toEqual('DELETE');
});
it('should duplicate the project', () => {
service.duplicate(server, 'projectId', 'projectName').subscribe();
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v2/projects/projectId/duplicate');
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/projects/projectId/duplicate');
expect(req.request.method).toEqual('POST');
});

View File

@ -83,11 +83,11 @@ export class ProjectService {
}
getUploadPath(server: Server, uuid: string, project_name: string) {
return `${server.protocol}//${server.host}:${server.port}/v2/projects/${uuid}/import?name=${project_name}`;
return `${server.protocol}//${server.host}:${server.port}/v3/projects/${uuid}/import?name=${project_name}`;
}
getExportPath(server: Server, project: Project) {
return `${server.protocol}//${server.host}:${server.port}/v2/projects/${project.project_id}/export`;
return `${server.protocol}//${server.host}:${server.port}/v3/projects/${project.project_id}/export`;
}
export(server: Server, project_id: string): Observable<any> {

View File

@ -82,7 +82,7 @@ describe('QemuService', () => {
service.saveTemplate(server, template).subscribe();
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v2/templates/1');
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/templates/1');
expect(req.request.method).toEqual('PUT');
expect(req.request.body).toEqual(template);
}));
@ -135,7 +135,7 @@ describe('QemuService', () => {
service.addTemplate(server, template).subscribe();
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v2/templates');
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/templates');
expect(req.request.method).toEqual('POST');
expect(req.request.body).toEqual(template);
}));

View File

@ -20,7 +20,7 @@ export class QemuService {
}
getImagePath(server: Server, filename: string): string {
return `${server.protocol}//${server.host}:${server.port}/v2/compute/qemu/images/${filename}`;
return `${server.protocol}//${server.host}:${server.port}/v3/compute/qemu/images/${filename}`;
}
getBinaries(server: Server): Observable<QemuBinary[]> {

View File

@ -40,7 +40,7 @@ describe('SnapshotService', () => {
const snapshot = new Snapshot();
service.create(server, 'myproject', snapshot).subscribe();
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v2/projects/myproject/snapshots');
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/projects/myproject/snapshots');
expect(req.request.method).toEqual('POST');
expect(req.request.body).toEqual(snapshot);
}));
@ -48,7 +48,7 @@ describe('SnapshotService', () => {
it('should list snapshots', inject([SnapshotService], (service: SnapshotService) => {
service.list(server, 'myproject').subscribe();
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v2/projects/myproject/snapshots');
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/projects/myproject/snapshots');
expect(req.request.method).toEqual('GET');
}));
});

View File

@ -38,14 +38,14 @@ describe('SymbolService', () => {
it('should list symbols', inject([SymbolService], (service: SymbolService) => {
service.list(server).subscribe();
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v2/symbols');
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/symbols');
expect(req.request.method).toEqual('GET');
}));
it('should get raw symbol', inject([SymbolService], (service: SymbolService) => {
service.raw(server, ':my/tested.png').subscribe();
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v2/symbols/:my/tested.png/raw');
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/symbols/:my/tested.png/raw');
expect(req.request.method).toEqual('GET');
}));

View File

@ -34,7 +34,7 @@ describe('TemplateService', () => {
service.list(server).subscribe(() => {});
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v2/templates');
expect(req.request.url).toBe('http://127.0.0.1:3080/v2/templates');
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/templates');
expect(req.request.url).toBe('http://127.0.0.1:3080/v3/templates');
});
});

View File

@ -47,7 +47,7 @@ describe('VersionService', () => {
it('should get version', inject([VersionService], (service: VersionService) => {
service.get(server).subscribe();
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v2/version');
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/version');
expect(req.request.method).toEqual('GET');
}));
});

View File

@ -63,7 +63,7 @@ describe('VirtualBoxService', () => {
service.saveTemplate(server, template).subscribe();
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v2/templates/1');
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/templates/1');
expect(req.request.method).toEqual('PUT');
expect(req.request.body).toEqual(template);
}));
@ -97,7 +97,7 @@ describe('VirtualBoxService', () => {
service.addTemplate(server, template).subscribe();
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v2/templates');
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/templates');
expect(req.request.method).toEqual('POST');
expect(req.request.body).toEqual(template);
}));
@ -105,7 +105,7 @@ describe('VirtualBoxService', () => {
it('should get available virtual machines', inject([VirtualBoxService], (service: VirtualBoxService) => {
service.getVirtualMachines(server).subscribe();
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v2/compute/virtualbox/vms');
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/compute/virtualbox/vms');
expect(req.request.method).toEqual('GET');
}));
});

View File

@ -62,7 +62,7 @@ describe('VmwareService', () => {
service.saveTemplate(server, template).subscribe();
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v2/templates/1');
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/templates/1');
expect(req.request.method).toEqual('PUT');
expect(req.request.body).toEqual(template);
}));
@ -95,7 +95,7 @@ describe('VmwareService', () => {
service.addTemplate(server, template).subscribe();
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v2/templates');
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/templates');
expect(req.request.method).toEqual('POST');
expect(req.request.body).toEqual(template);
}));
@ -103,7 +103,7 @@ describe('VmwareService', () => {
it('should get available virtual machines', inject([VmwareService], (service: VmwareService) => {
service.getVirtualMachines(server).subscribe();
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v2/compute/vmware/vms');
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/compute/vmware/vms');
expect(req.request.method).toEqual('GET');
}));
});

View File

@ -51,7 +51,7 @@ describe('VpcsService', () => {
service.saveTemplate(server, template).subscribe();
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v2/templates/1');
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/templates/1');
expect(req.request.method).toEqual('PUT');
expect(req.request.body).toEqual(template);
}));
@ -73,7 +73,7 @@ describe('VpcsService', () => {
service.addTemplate(server, template).subscribe();
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v2/templates');
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v3/templates');
expect(req.request.method).toEqual('POST');
expect(req.request.body).toEqual(template);
}));