Skip to content

Commit be71354

Browse files
author
github-actions
committed
Google Java Format
1 parent bc6c3dc commit be71354

File tree

4 files changed

+69
-39
lines changed

4 files changed

+69
-39
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
@@ -161,8 +161,7 @@ public void testSynchronizeDataJob() throws Exception {
161161

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

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

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,13 @@ public ResponseEntity<Void> deploymentDelete(
6464
// TODO: deploymentId not implemented
6565
if (jobName != null) {
6666
if (dataJobDeploymentPropertiesConfig
67-
.getWriteTos()
68-
.contains(DataJobDeploymentPropertiesConfig.WriteTo.K8S)) {
67+
.getWriteTos()
68+
.contains(DataJobDeploymentPropertiesConfig.WriteTo.K8S)) {
6969
deploymentService.deleteDeployment(jobName);
7070
return ResponseEntity.accepted().build();
7171
} else if (dataJobDeploymentPropertiesConfig
72-
.getWriteTos()
73-
.contains(DataJobDeploymentPropertiesConfig.WriteTo.DB)) {
72+
.getWriteTos()
73+
.contains(DataJobDeploymentPropertiesConfig.WriteTo.DB)) {
7474
deploymentServiceV2.deleteDesiredDeployment(jobName);
7575
return ResponseEntity.accepted().build();
7676
}
@@ -92,8 +92,8 @@ public ResponseEntity<Void> deploymentPatch(
9292
var jobDeployment =
9393
ToModelApiConverter.toJobDeployment(teamName, jobName, dataJobDeployment);
9494
if (dataJobDeploymentPropertiesConfig
95-
.getWriteTos()
96-
.contains(DataJobDeploymentPropertiesConfig.WriteTo.K8S)) {
95+
.getWriteTos()
96+
.contains(DataJobDeploymentPropertiesConfig.WriteTo.K8S)) {
9797
deploymentService.patchDeployment(job.get(), jobDeployment);
9898
return ResponseEntity.accepted().build();
9999
}
@@ -110,8 +110,8 @@ public ResponseEntity<List<DataJobDeploymentStatus>> deploymentList(
110110
List<DataJobDeploymentStatus> deployments = Collections.emptyList();
111111
Optional<JobDeploymentStatus> jobDeploymentStatus = Optional.empty();
112112
if (dataJobDeploymentPropertiesConfig
113-
.getReadDataSource()
114-
.equals(DataJobDeploymentPropertiesConfig.ReadFrom.K8S)) {
113+
.getReadDataSource()
114+
.equals(DataJobDeploymentPropertiesConfig.ReadFrom.K8S)) {
115115
jobDeploymentStatus = deploymentService.readDeployment(jobName.toLowerCase());
116116
}
117117
if (jobDeploymentStatus.isPresent()) {
@@ -130,8 +130,8 @@ public ResponseEntity<DataJobDeploymentStatus> deploymentRead(
130130
// TODO: deploymentId are not implemented.
131131
Optional<JobDeploymentStatus> jobDeploymentStatus = Optional.empty();
132132
if (dataJobDeploymentPropertiesConfig
133-
.getReadDataSource()
134-
.equals(DataJobDeploymentPropertiesConfig.ReadFrom.K8S)) {
133+
.getReadDataSource()
134+
.equals(DataJobDeploymentPropertiesConfig.ReadFrom.K8S)) {
135135
jobDeploymentStatus = deploymentService.readDeployment(jobName.toLowerCase());
136136
}
137137
if (jobDeploymentStatus.isPresent()) {
@@ -156,15 +156,15 @@ public ResponseEntity<Void> deploymentUpdate(
156156
var jobDeployment =
157157
ToModelApiConverter.toJobDeployment(teamName, jobName.toLowerCase(), dataJobDeployment);
158158
if (dataJobDeploymentPropertiesConfig
159-
.getWriteTos()
160-
.contains(DataJobDeploymentPropertiesConfig.WriteTo.K8S)) {
159+
.getWriteTos()
160+
.contains(DataJobDeploymentPropertiesConfig.WriteTo.K8S)) {
161161
// TODO: Consider using a Task-oriented API approach
162162
deploymentService.updateDeployment(
163-
job.get(),
164-
jobDeployment,
165-
sendNotification,
166-
operationContext.getUser(),
167-
operationContext.getOpId());
163+
job.get(),
164+
jobDeployment,
165+
sendNotification,
166+
operationContext.getUser(),
167+
operationContext.getOpId());
168168
}
169169

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

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
@@ -197,6 +197,6 @@ private void handleException(
197197

198198
private boolean deploymentExistsOrInProgress(String dataJobName) {
199199
return jobImageBuilder.isBuildingJobInProgress(dataJobName)
200-
|| readDeployment(dataJobName).isPresent();
200+
|| readDeployment(dataJobName).isPresent();
201201
}
202202
}

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)