Skip to content
This repository was archived by the owner on May 14, 2025. It is now read-only.

Commit 9e79970

Browse files
oodamienghillert
authored andcommitted
Jobs Service / Tasks Service refactoring
Moved parser code from the API services to the models Added unit tests for Job/Task models Resolves #796
1 parent 427c52f commit 9e79970

18 files changed

+418
-470
lines changed

ui/src/app/jobs/jobs.service.spec.ts

Lines changed: 0 additions & 183 deletions
Original file line numberDiff line numberDiff line change
@@ -91,187 +91,4 @@ describe('JobsService', () => {
9191
});
9292
});
9393

94-
/*
95-
TODO: function deleted
96-
describe('extractData', () => {
97-
it('should call the jobs service to extract data from json', () => {
98-
const response = new MockResponse();
99-
response.body = JOB_EXECUTIONS_WITH_PAGINATION ;
100-
this.jobsService.jobExecutions = new Page<JobExecution>();
101-
const jobExecutions = this.jobsService.extractData(response);
102-
expect(jobExecutions.pageNumber).toBe(0);
103-
expect(jobExecutions.pageSize).toBe(10);
104-
expect(jobExecutions.totalElements).toBe(2);
105-
expect(jobExecutions.totalPages).toBe(1);
106-
107-
expect(jobExecutions.items[0].name).toBe('job2');
108-
expect(jobExecutions.items[1].name).toBe('job1');
109-
expect(jobExecutions.items[0].startTime.toISOString()).toBe('2017-09-06T00:54:46.000Z');
110-
expect(jobExecutions.items[0].stepExecutionCount).toBe(1);
111-
expect(jobExecutions.items[0].status).toBe('COMPLETED');
112-
expect(jobExecutions.items[0].jobExecutionId).toBe(2);
113-
expect(jobExecutions.items[0].taskExecutionId).toBe(95);
114-
expect(jobExecutions.items[0].jobInstanceId).toBe(2);
115-
expect(jobExecutions.items[0].restartable).toBe(false);
116-
expect(jobExecutions.items[0].abandonable).toBe(false);
117-
expect(jobExecutions.items[0].stoppable).toBe(false);
118-
expect(jobExecutions.items[0].defined).toBe(false);
119-
120-
});
121-
});*/
122-
123-
/*
124-
TODO: function deleted
125-
describe('extractStepExecutionProgressData', () => {
126-
it('should call the jobs service to parse progress from json', () => {
127-
const response = new MockResponse();
128-
response.body = JOBS_EXECUTIONS_1_STEPS_1_PROGRESS;
129-
const stepExecutionProgress = this.jobsService.extractStepExecutionProgressData(response);
130-
131-
expect(stepExecutionProgress.stepExecution.name).toBe('job1step1');
132-
expect(stepExecutionProgress.stepExecution.executionContext.dirty).toBe(true);
133-
expect(stepExecutionProgress.percentageComplete).toBe(1);
134-
expect(stepExecutionProgress.finished).toBe(true);
135-
expect(stepExecutionProgress.duration).toBe(13);
136-
137-
expect(stepExecutionProgress.stepExecution.id).toBe(1);
138-
expect(stepExecutionProgress.stepExecution.status).toBe('COMPLETED');
139-
expect(stepExecutionProgress.stepExecution.readCount).toBe(0);
140-
expect(stepExecutionProgress.stepExecution.writeCount).toBe(0);
141-
expect(stepExecutionProgress.stepExecution.commitCount).toBe(1);
142-
expect(stepExecutionProgress.stepExecution.writeCount).toBe(0);
143-
expect(stepExecutionProgress.stepExecution.rollbackCount).toBe(0);
144-
expect(stepExecutionProgress.stepExecution.readSkipCount).toBe(0);
145-
expect(stepExecutionProgress.stepExecution.processSkipCount).toBe(0);
146-
expect(stepExecutionProgress.stepExecution.writeSkipCount).toBe(0);
147-
expect(stepExecutionProgress.stepExecution.skipCount).toBe(0);
148-
expect(stepExecutionProgress.stepExecution.startTime.toISOString()).toBe('2017-08-21T07:25:05.028Z');
149-
expect(stepExecutionProgress.stepExecution.endTime.toISOString()).toBe('2017-08-21T07:25:05.041Z');
150-
expect(stepExecutionProgress.stepExecution.exitCode).toBe('COMPLETED');
151-
expect(stepExecutionProgress.stepExecution.exitMessage).toBe('');
152-
153-
expect(stepExecutionProgress.stepExecutionHistory.stepName).toBe('job1step1');
154-
expect(stepExecutionProgress.stepExecutionHistory.count).toBe(1);
155-
156-
expect(stepExecutionProgress.stepExecutionHistory.commitCount.count).toBe(1);
157-
expect(stepExecutionProgress.stepExecutionHistory.commitCount.min).toBe(1);
158-
expect(stepExecutionProgress.stepExecutionHistory.commitCount.max).toBe(1);
159-
expect(stepExecutionProgress.stepExecutionHistory.commitCount.mean).toBe(1);
160-
expect(stepExecutionProgress.stepExecutionHistory.commitCount.standardDeviation).toBe(0);
161-
expect(stepExecutionProgress.stepExecutionHistory.rollbackCount.count).toBe(1);
162-
expect(stepExecutionProgress.stepExecutionHistory.rollbackCount.min).toBe(0);
163-
expect(stepExecutionProgress.stepExecutionHistory.rollbackCount.max).toBe(0);
164-
expect(stepExecutionProgress.stepExecutionHistory.rollbackCount.mean).toBe(0);
165-
expect(stepExecutionProgress.stepExecutionHistory.rollbackCount.standardDeviation).toBe(0);
166-
expect(stepExecutionProgress.stepExecutionHistory.readCount.count).toBe(1);
167-
expect(stepExecutionProgress.stepExecutionHistory.readCount.min).toBe(0);
168-
expect(stepExecutionProgress.stepExecutionHistory.readCount.max).toBe(0);
169-
expect(stepExecutionProgress.stepExecutionHistory.readCount.mean).toBe(0);
170-
expect(stepExecutionProgress.stepExecutionHistory.readCount.standardDeviation).toBe(0);
171-
expect(stepExecutionProgress.stepExecutionHistory.writeCount.count).toBe(1);
172-
expect(stepExecutionProgress.stepExecutionHistory.writeCount.min).toBe(0);
173-
expect(stepExecutionProgress.stepExecutionHistory.writeCount.max).toBe(0);
174-
expect(stepExecutionProgress.stepExecutionHistory.writeCount.mean).toBe(0);
175-
expect(stepExecutionProgress.stepExecutionHistory.writeCount.standardDeviation).toBe(0);
176-
expect(stepExecutionProgress.stepExecutionHistory.filterCount.count).toBe(1);
177-
expect(stepExecutionProgress.stepExecutionHistory.filterCount.min).toBe(0);
178-
expect(stepExecutionProgress.stepExecutionHistory.filterCount.max).toBe(0);
179-
expect(stepExecutionProgress.stepExecutionHistory.filterCount.mean).toBe(0);
180-
expect(stepExecutionProgress.stepExecutionHistory.filterCount.standardDeviation).toBe(0);
181-
expect(stepExecutionProgress.stepExecutionHistory.readSkipCount.count).toBe(1);
182-
expect(stepExecutionProgress.stepExecutionHistory.readSkipCount.min).toBe(0);
183-
expect(stepExecutionProgress.stepExecutionHistory.readSkipCount.max).toBe(0);
184-
expect(stepExecutionProgress.stepExecutionHistory.readSkipCount.mean).toBe(0);
185-
expect(stepExecutionProgress.stepExecutionHistory.readSkipCount.standardDeviation).toBe(0);
186-
expect(stepExecutionProgress.stepExecutionHistory.writeSkipCount.count).toBe(1);
187-
expect(stepExecutionProgress.stepExecutionHistory.writeSkipCount.min).toBe(0);
188-
expect(stepExecutionProgress.stepExecutionHistory.writeSkipCount.max).toBe(0);
189-
expect(stepExecutionProgress.stepExecutionHistory.writeSkipCount.mean).toBe(0);
190-
expect(stepExecutionProgress.stepExecutionHistory.writeSkipCount.standardDeviation).toBe(0);
191-
expect(stepExecutionProgress.stepExecutionHistory.processSkipCount.count).toBe(1);
192-
expect(stepExecutionProgress.stepExecutionHistory.processSkipCount.min).toBe(0);
193-
expect(stepExecutionProgress.stepExecutionHistory.processSkipCount.max).toBe(0);
194-
expect(stepExecutionProgress.stepExecutionHistory.processSkipCount.mean).toBe(0);
195-
expect(stepExecutionProgress.stepExecutionHistory.processSkipCount.standardDeviation).toBe(0);
196-
expect(stepExecutionProgress.stepExecutionHistory.duration.count).toBe(1);
197-
expect(stepExecutionProgress.stepExecutionHistory.duration.min).toBe(13);
198-
expect(stepExecutionProgress.stepExecutionHistory.duration.max).toBe(13);
199-
expect(stepExecutionProgress.stepExecutionHistory.duration.mean).toBe(13);
200-
expect(stepExecutionProgress.stepExecutionHistory.duration.standardDeviation).toBe(0);
201-
expect(stepExecutionProgress.stepExecutionHistory.durationPerRead.count).toBe(0);
202-
expect(stepExecutionProgress.stepExecutionHistory.durationPerRead.min).toBe(0);
203-
expect(stepExecutionProgress.stepExecutionHistory.durationPerRead.max).toBe(0);
204-
expect(stepExecutionProgress.stepExecutionHistory.durationPerRead.mean).toBe(0);
205-
expect(stepExecutionProgress.stepExecutionHistory.durationPerRead.standardDeviation).toBe(0);
206-
207-
});
208-
});*/
209-
210-
/*
211-
TODO: function deleted
212-
describe('extractStepExecutionData', () => {
213-
it('should call the jobs service to parse step execution from json', () => {
214-
const response = new MockResponse();
215-
response.body = JOBS_EXECUTIONS_1_STEPS_1;
216-
const stepExecutionResource = this.jobsService.extractStepExecutionData(response);
217-
218-
expect(stepExecutionResource.stepExecution.id).toBe(1);
219-
expect(stepExecutionResource.stepExecution.name).toBe('job1step1');
220-
expect(stepExecutionResource.stepExecution.executionContext.dirty).toBe(true);
221-
expect(stepExecutionResource.stepExecution.status).toBe('COMPLETED');
222-
expect(stepExecutionResource.stepExecution.readCount).toBe(0);
223-
expect(stepExecutionResource.stepExecution.writeCount).toBe(0);
224-
expect(stepExecutionResource.stepExecution.commitCount).toBe(1);
225-
expect(stepExecutionResource.stepExecution.rollbackCount).toBe(0);
226-
expect(stepExecutionResource.stepExecution.readSkipCount).toBe(0);
227-
expect(stepExecutionResource.stepExecution.processSkipCount).toBe(0);
228-
expect(stepExecutionResource.stepExecution.writeSkipCount).toBe(0);
229-
expect(stepExecutionResource.stepExecution.filterCount).toBe(0);
230-
expect(stepExecutionResource.stepExecution.skipCount).toBe(0);
231-
expect(stepExecutionResource.stepExecution.startTime.toISOString()).toBe('2017-08-11T06:15:50.046Z');
232-
expect(stepExecutionResource.stepExecution.endTime.toISOString()).toBe('2017-08-11T06:15:50.064Z');
233-
});
234-
});*/
235-
236-
/*
237-
TODO: function deleted
238-
describe('extractJobExecutionData', () => {
239-
it('should call the jobs service to parse job execution from json', () => {
240-
const response = new MockResponse();
241-
response.body = JOBS_EXECUTIONS_1;
242-
const jobExecution = this.jobsService.extractJobExecutionData(response);
243-
244-
expect(jobExecution.name).toBe('job1');
245-
expect(jobExecution.startTime.toISOString()).toBe('2017-08-11T06:15:50.027Z');
246-
expect(jobExecution.endTime.toISOString()).toBe('2017-08-11T06:15:50.067Z');
247-
expect(jobExecution.stepExecutionCount).toBe(1);
248-
expect(jobExecution.status).toBe('COMPLETED');
249-
expect(jobExecution.exitCode).toBe('COMPLETED');
250-
expect(jobExecution.exitMessage).toBe('');
251-
expect(jobExecution.jobExecutionId).toBe(1);
252-
expect(jobExecution.taskExecutionId).toBe(2);
253-
expect(jobExecution.jobInstanceId).toBe(1);
254-
expect(jobExecution.jobParametersString).toBe('--spring.cloud.task.executionid=2');
255-
expect(jobExecution.restartable).toBe(false);
256-
expect(jobExecution.abandonable).toBe(false);
257-
expect(jobExecution.stoppable).toBe(false);
258-
expect(jobExecution.defined).toBe(true);
259-
260-
expect(jobExecution.stepExecutions[0].id).toBe(1);
261-
expect(jobExecution.stepExecutions[0].name).toBe('job1step1');
262-
expect(jobExecution.stepExecutions[0].readCount).toBe(0);
263-
expect(jobExecution.stepExecutions[0].writeCount).toBe(0);
264-
expect(jobExecution.stepExecutions[0].commitCount).toBe(1);
265-
expect(jobExecution.stepExecutions[0].rollbackCount).toBe(0);
266-
expect(jobExecution.stepExecutions[0].readSkipCount).toBe(0);
267-
expect(jobExecution.stepExecutions[0].processSkipCount).toBe(0);
268-
expect(jobExecution.stepExecutions[0].writeSkipCount).toBe(0);
269-
expect(jobExecution.stepExecutions[0].filterCount).toBe(0);
270-
expect(jobExecution.stepExecutions[0].skipCount).toBe(0);
271-
expect(jobExecution.stepExecutions[0].startTime.toISOString()).toBe('2017-08-11T06:15:50.046Z');
272-
expect(jobExecution.stepExecutions[0].endTime.toISOString()).toBe('2017-08-11T06:15:50.064Z');
273-
expect(jobExecution.stepExecutions[0].status).toBe('COMPLETED');
274-
});
275-
});*/
276-
27794
});

0 commit comments

Comments
 (0)