Skip to content

Commit 9ea1a95

Browse files
author
github-actions
committed
Google Java Format
1 parent 32835d1 commit 9ea1a95

File tree

6 files changed

+67
-45
lines changed

6 files changed

+67
-45
lines changed

projects/control-service/projects/pipelines_control_service/src/integration-test/java/com/vmware/taurus/service/deploy/DataJobDeploymentCrudITV2.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,7 @@ public void testSynchronizeDataJob() throws Exception {
162162

163163
// Deletes deployment
164164
desiredJobDeploymentRepository.deleteById(testJobName);
165-
dataJobsSynchronizer.synchronizeDataJob(
166-
dataJob, null, actualDataJobDeployment, true);
165+
dataJobsSynchronizer.synchronizeDataJob(dataJob, null, actualDataJobDeployment, true);
167166
Assertions.assertFalse(deploymentService.readDeployment(testJobName).isPresent());
168167
Assertions.assertFalse(actualJobDeploymentRepository.findById(testJobName).isPresent());
169168
}

projects/control-service/projects/pipelines_control_service/src/main/java/com/vmware/taurus/datajobs/DataJobsDeploymentController.java

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ public ResponseEntity<Void> deploymentDelete(
6969
if (jobName != null) {
7070
if (dataJobDeploymentPropertiesConfig.getWriteTos().contains(WriteTo.K8S)) {
7171
deploymentService.deleteDeployment(jobName);
72-
7372
}
7473

7574
if (dataJobDeploymentPropertiesConfig.getWriteTos().contains(WriteTo.DB)) {
@@ -96,7 +95,7 @@ public ResponseEntity<Void> deploymentPatch(
9695
ToModelApiConverter.toJobDeployment(teamName, jobName, dataJobDeployment);
9796

9897
if (dataJobDeploymentPropertiesConfig.getWriteTos().contains(WriteTo.K8S)) {
99-
deploymentService.patchDeployment(job.get(), jobDeployment);
98+
deploymentService.patchDeployment(job.get(), jobDeployment);
10099
}
101100

102101
if (dataJobDeploymentPropertiesConfig.getWriteTos().contains(WriteTo.DB)) {
@@ -117,9 +116,7 @@ public ResponseEntity<List<DataJobDeploymentStatus>> deploymentList(
117116
// TODO: deploymentId and mode not implemented
118117
List<DataJobDeploymentStatus> deployments = Collections.emptyList();
119118
Optional<JobDeploymentStatus> jobDeploymentStatus = Optional.empty();
120-
if (dataJobDeploymentPropertiesConfig
121-
.getReadDataSource()
122-
.equals(ReadFrom.K8S)) {
119+
if (dataJobDeploymentPropertiesConfig.getReadDataSource().equals(ReadFrom.K8S)) {
123120
jobDeploymentStatus = deploymentService.readDeployment(jobName.toLowerCase());
124121
}
125122
if (jobDeploymentStatus.isPresent()) {
@@ -137,9 +134,7 @@ public ResponseEntity<DataJobDeploymentStatus> deploymentRead(
137134
if (jobsService.jobWithTeamExists(jobName, teamName)) {
138135
// TODO: deploymentId are not implemented.
139136
Optional<JobDeploymentStatus> jobDeploymentStatus = Optional.empty();
140-
if (dataJobDeploymentPropertiesConfig
141-
.getReadDataSource()
142-
.equals(ReadFrom.K8S)) {
137+
if (dataJobDeploymentPropertiesConfig.getReadDataSource().equals(ReadFrom.K8S)) {
143138
jobDeploymentStatus = deploymentService.readDeployment(jobName.toLowerCase());
144139
}
145140
if (jobDeploymentStatus.isPresent()) {
@@ -165,21 +160,19 @@ public ResponseEntity<Void> deploymentUpdate(
165160
var jobDeployment =
166161
ToModelApiConverter.toJobDeployment(teamName, jobName.toLowerCase(), dataJobDeployment);
167162

168-
if (dataJobDeploymentPropertiesConfig
169-
.getWriteTos()
170-
.contains(WriteTo.K8S)) {
163+
if (dataJobDeploymentPropertiesConfig.getWriteTos().contains(WriteTo.K8S)) {
171164
// TODO: Consider using a Task-oriented API approach
172165
deploymentService.updateDeployment(
173-
job.get(),
174-
jobDeployment,
175-
sendNotification,
176-
operationContext.getUser(),
177-
operationContext.getOpId());
166+
job.get(),
167+
jobDeployment,
168+
sendNotification,
169+
operationContext.getUser(),
170+
operationContext.getOpId());
178171
}
179172

180173
if (dataJobDeploymentPropertiesConfig.getWriteTos().contains(WriteTo.DB)) {
181-
deploymentServiceV2.updateDesiredDbDeployment(
182-
job.get(), jobDeployment, operationContext.getUser());
174+
deploymentServiceV2.updateDesiredDbDeployment(
175+
job.get(), jobDeployment, operationContext.getUser());
183176
}
184177

185178
return ResponseEntity.accepted().build();

projects/control-service/projects/pipelines_control_service/src/main/java/com/vmware/taurus/exception/ValidationException.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
import org.springframework.http.HttpStatus;
99

10-
1110
public class ValidationException extends DomainError implements UserFacingError {
1211
public ValidationException(String what, String why, String consequences, String countermeasures) {
1312
super(what, why, consequences, countermeasures, null);

projects/control-service/projects/pipelines_control_service/src/main/java/com/vmware/taurus/service/JobsService.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,14 @@ public JobOperationResult deleteJob(String name) {
7272
credentialsService.deleteJobCredentials(name);
7373

7474
if (dataJobDeploymentPropertiesConfig
75-
.getWriteTos()
76-
.contains(DataJobDeploymentPropertiesConfig.WriteTo.K8S)) {
75+
.getWriteTos()
76+
.contains(DataJobDeploymentPropertiesConfig.WriteTo.K8S)) {
7777
deploymentService.deleteDeployment(name);
7878
}
7979

8080
if (dataJobDeploymentPropertiesConfig
81-
.getWriteTos()
82-
.contains(DataJobDeploymentPropertiesConfig.WriteTo.DB)) {
81+
.getWriteTos()
82+
.contains(DataJobDeploymentPropertiesConfig.WriteTo.DB)) {
8383
deploymentServiceV2.deleteDesiredDeployment(name);
8484
}
8585

projects/control-service/projects/pipelines_control_service/src/main/java/com/vmware/taurus/service/deploy/DeploymentServiceV2.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,6 @@ private void handleException(
255255

256256
private boolean deploymentExistsOrInProgress(String dataJobName) {
257257
return jobImageBuilder.isBuildingJobInProgress(dataJobName)
258-
|| readDeployment(dataJobName).isPresent();
258+
|| readDeployment(dataJobName).isPresent();
259259
}
260260
}

projects/control-service/projects/pipelines_control_service/src/test/java/com/vmware/taurus/service/deploy/DataJobsSynchronizerTest.java

Lines changed: 50 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -118,60 +118,91 @@ void synchronizeDataJob_desiredDeploymentNullAndActualDeploymentNull_shouldSkipS
118118
DesiredDataJobDeployment desiredDataJobDeployment = null;
119119
ActualDataJobDeployment actualDataJobDeployment = null;
120120

121-
dataJobsSynchronizer.synchronizeDataJob(dataJob, desiredDataJobDeployment, actualDataJobDeployment, isDeploymentPresentInKubernetes);
121+
dataJobsSynchronizer.synchronizeDataJob(
122+
dataJob,
123+
desiredDataJobDeployment,
124+
actualDataJobDeployment,
125+
isDeploymentPresentInKubernetes);
122126

123127
Mockito.verify(deploymentService, Mockito.times(0))
124-
.updateDeployment(dataJob, desiredDataJobDeployment, actualDataJobDeployment, isDeploymentPresentInKubernetes);
125-
Mockito.verify(deploymentService, Mockito.times(0))
126-
.deleteActualDeployment(dataJob.getName());
128+
.updateDeployment(
129+
dataJob,
130+
desiredDataJobDeployment,
131+
actualDataJobDeployment,
132+
isDeploymentPresentInKubernetes);
133+
Mockito.verify(deploymentService, Mockito.times(0)).deleteActualDeployment(dataJob.getName());
127134
}
128135

129136
@Test
130-
void synchronizeDataJob_desiredDeploymentNullAndActualDeploymentNotNull_shouldDeleteJobDeployment() {
137+
void
138+
synchronizeDataJob_desiredDeploymentNullAndActualDeploymentNotNull_shouldDeleteJobDeployment() {
131139
DataJob dataJob = new DataJob();
132140
dataJob.setName("test-job-name");
133141
boolean isDeploymentPresentInKubernetes = true;
134142
DesiredDataJobDeployment desiredDataJobDeployment = null;
135143
ActualDataJobDeployment actualDataJobDeployment = new ActualDataJobDeployment();
136144

137-
dataJobsSynchronizer.synchronizeDataJob(dataJob, desiredDataJobDeployment, actualDataJobDeployment, isDeploymentPresentInKubernetes);
145+
dataJobsSynchronizer.synchronizeDataJob(
146+
dataJob,
147+
desiredDataJobDeployment,
148+
actualDataJobDeployment,
149+
isDeploymentPresentInKubernetes);
138150

139151
Mockito.verify(deploymentService, Mockito.times(0))
140-
.updateDeployment(dataJob, desiredDataJobDeployment, actualDataJobDeployment, isDeploymentPresentInKubernetes);
141-
Mockito.verify(deploymentService, Mockito.times(1))
142-
.deleteActualDeployment(dataJob.getName());
152+
.updateDeployment(
153+
dataJob,
154+
desiredDataJobDeployment,
155+
actualDataJobDeployment,
156+
isDeploymentPresentInKubernetes);
157+
Mockito.verify(deploymentService, Mockito.times(1)).deleteActualDeployment(dataJob.getName());
143158
}
144159

145160
@Test
146-
void synchronizeDataJob_desiredDeploymentNotNullAndActualDeploymentNotNull_shouldUpdateJobDeployment() {
161+
void
162+
synchronizeDataJob_desiredDeploymentNotNullAndActualDeploymentNotNull_shouldUpdateJobDeployment() {
147163
DataJob dataJob = new DataJob();
148164
dataJob.setName("test-job-name");
149165
boolean isDeploymentPresentInKubernetes = true;
150166
DesiredDataJobDeployment desiredDataJobDeployment = new DesiredDataJobDeployment();
151167
ActualDataJobDeployment actualDataJobDeployment = new ActualDataJobDeployment();
152168

153-
dataJobsSynchronizer.synchronizeDataJob(dataJob, desiredDataJobDeployment, actualDataJobDeployment, isDeploymentPresentInKubernetes);
169+
dataJobsSynchronizer.synchronizeDataJob(
170+
dataJob,
171+
desiredDataJobDeployment,
172+
actualDataJobDeployment,
173+
isDeploymentPresentInKubernetes);
154174

155175
Mockito.verify(deploymentService, Mockito.times(1))
156-
.updateDeployment(dataJob, desiredDataJobDeployment, actualDataJobDeployment, isDeploymentPresentInKubernetes);
157-
Mockito.verify(deploymentService, Mockito.times(0))
158-
.deleteActualDeployment(dataJob.getName());
176+
.updateDeployment(
177+
dataJob,
178+
desiredDataJobDeployment,
179+
actualDataJobDeployment,
180+
isDeploymentPresentInKubernetes);
181+
Mockito.verify(deploymentService, Mockito.times(0)).deleteActualDeployment(dataJob.getName());
159182
}
160183

161184
@Test
162-
void synchronizeDataJob_desiredDeploymentNotNullAndActualDeploymentNull_shouldUpdateJobDeployment() {
185+
void
186+
synchronizeDataJob_desiredDeploymentNotNullAndActualDeploymentNull_shouldUpdateJobDeployment() {
163187
DataJob dataJob = new DataJob();
164188
dataJob.setName("test-job-name");
165189
boolean isDeploymentPresentInKubernetes = true;
166190
DesiredDataJobDeployment desiredDataJobDeployment = new DesiredDataJobDeployment();
167191
ActualDataJobDeployment actualDataJobDeployment = null;
168192

169-
dataJobsSynchronizer.synchronizeDataJob(dataJob, desiredDataJobDeployment, actualDataJobDeployment, isDeploymentPresentInKubernetes);
193+
dataJobsSynchronizer.synchronizeDataJob(
194+
dataJob,
195+
desiredDataJobDeployment,
196+
actualDataJobDeployment,
197+
isDeploymentPresentInKubernetes);
170198

171199
Mockito.verify(deploymentService, Mockito.times(1))
172-
.updateDeployment(dataJob, desiredDataJobDeployment, actualDataJobDeployment, isDeploymentPresentInKubernetes);
173-
Mockito.verify(deploymentService, Mockito.times(0))
174-
.deleteActualDeployment(dataJob.getName());
200+
.updateDeployment(
201+
dataJob,
202+
desiredDataJobDeployment,
203+
actualDataJobDeployment,
204+
isDeploymentPresentInKubernetes);
205+
Mockito.verify(deploymentService, Mockito.times(0)).deleteActualDeployment(dataJob.getName());
175206
}
176207

177208
void enableSynchronizationProcess() {

0 commit comments

Comments
 (0)