Skip to content

Commit 62e8d39

Browse files
Vlad Aramabhufmann
Vlad Arama
authored andcommitted
implement identifier service
Signed-off-by: Vlad Arama <vlad.arama@ericsson.com>
1 parent 039612e commit 62e8d39

File tree

5 files changed

+92
-0
lines changed

5 files changed

+92
-0
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"version": "0.9.1",
3+
"buildTime": "202408051810",
4+
"os": "Windows 10",
5+
"osArch": "amd64",
6+
"osVersion": "10.0",
7+
"cpuCount": 8,
8+
"maxMemory": 8552185856,
9+
"launcherName": "Tracecompass-serverc",
10+
"productId": "org.eclipse.tracecompass.incubator.trace.server.jersey.rest.core.id"
11+
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/**
2+
* Model of the identifier
3+
*/
4+
export interface Identifier {
5+
/**
6+
* Version in the format Major.Minor.Micro
7+
*/
8+
version: string;
9+
10+
/**
11+
* Build time or qualifier of the server version, if available
12+
*/
13+
buildTime: string;
14+
15+
/**
16+
* Operating system name
17+
*/
18+
os: string;
19+
20+
/**
21+
* Architecture of the operating system
22+
*/
23+
osArch: string;
24+
25+
/**
26+
* Operating system version
27+
*/
28+
osVersion: string;
29+
30+
/**
31+
* Number of CPUs available
32+
*/
33+
cpuCount: string;
34+
35+
/**
36+
* Maximum memory available to the JVM in bytes
37+
*/
38+
maxMemory: string;
39+
40+
/**
41+
* Name of the launcher used, if available
42+
*/
43+
launcherName: string;
44+
45+
/**
46+
* Product identifier
47+
*/
48+
productId: string;
49+
}

tsp-typescript-client/src/protocol/http-tsp-client.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { DataTreeEntry } from "../models/data-tree";
88
import { Entry, EntryModel } from "../models/entry";
99
import { Experiment } from "../models/experiment";
1010
import { HealthStatus } from "../models/health";
11+
import { Identifier } from "../models/identifier";
1112
import { MarkerSet } from "../models/markerset";
1213
import { OutputDescriptor } from "../models/output-descriptor";
1314
import { Query } from "../models/query/query";
@@ -519,6 +520,15 @@ export class HttpTspClient implements ITspClient {
519520
return RestClient.get(url);
520521
}
521522

523+
/**
524+
* Fetch the identifier service
525+
* @returns Important information regarding the trace server and the system it is running on
526+
*/
527+
public async fetchIdentifier(): Promise<TspClientResponse<Identifier>> {
528+
const url = this.baseUrl + "/identifier";
529+
return RestClient.get(url);
530+
}
531+
522532
/**
523533
* Fetch all configuration source types
524534
* @returns Generic response with the model

tsp-typescript-client/src/protocol/tsp-client.test.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,21 @@ describe('HttpTspClient Deserialization', () => {
178178
}
179179
});
180180

181+
it('fetchIdentifier' , async () => {
182+
httpRequestMock.mockReturnValueOnce(fixtures.asResponse('fetch-identifier-0.json'));
183+
const response = await client.fetchIdentifier();
184+
const identifier = response.getModel()!;
185+
186+
expect(response.getStatusCode()).toEqual(200);
187+
expect(identifier.version).toBeDefined();
188+
expect(identifier.os).toBeDefined();
189+
expect(identifier.osArch).toBeDefined();
190+
expect(identifier.osVersion).toBeDefined();
191+
expect(identifier.cpuCount).toBeDefined();
192+
expect(identifier.maxMemory).toBeDefined();
193+
expect(identifier.productId).toBeDefined();
194+
});
195+
181196
it('fetchMarkerSets', async () => {
182197
httpRequestMock.mockReturnValueOnce(fixtures.asResponse('fetch-marker-sets-0.json'));
183198
const response = await client.fetchMarkerSets('not-relevant');

tsp-typescript-client/src/protocol/tsp-client.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import { MarkerSet } from "../models/markerset";
2222
import { DataTreeEntry } from "../models/data-tree";
2323
import { ConfigurationSourceType } from "../models/configuration-source";
2424
import { Configuration } from "../models/configuration";
25+
import { Identifier } from "../models/identifier";
2526

2627
export {
2728
/** @deprecated */ HttpTspClient as TspClient,
@@ -297,6 +298,12 @@ export interface ITspClient {
297298
*/
298299
checkHealth(): Promise<TspClientResponse<HealthStatus>>;
299300

301+
/**
302+
* Fetch the identifier service
303+
* @returns Important information regarding the trace server and the system it is running on
304+
*/
305+
fetchIdentifier(): Promise<TspClientResponse<Identifier>>;
306+
300307
/**
301308
* Fetch all configuration source types
302309
* @returns Generic response with the model

0 commit comments

Comments
 (0)