Skip to content

Commit

Permalink
Google Java Format
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions authored and doks5 committed Oct 27, 2023
1 parent b881ad0 commit 2e365d1
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,7 @@
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.*;
import java.util.concurrent.atomic.AtomicReference;
import java.util.function.Predicate;
import java.util.stream.Collectors;
Expand Down Expand Up @@ -212,10 +206,15 @@ private Predicate<V2DataJob> computeSearch(

private List<V2DataJob> populateDeployments(
List<V2DataJob> allDataJob, Map<String, DataJob> dataJobs) {
Map<String, JobDeploymentStatus> deploymentStatuses =
(dataJobDeploymentPropertiesConfig.getReadDataSource().equals(ReadFrom.DB))
? readJobDeploymentsFromDb()
: readJobDeploymentsFromK8s();
Map<String, JobDeploymentStatus> deploymentStatuses;

if (dataJobDeploymentPropertiesConfig.getReadDataSource().equals(ReadFrom.DB)) {
deploymentStatuses = readJobDeploymentsFromDb();
} else if (dataJobDeploymentPropertiesConfig.getReadDataSource().equals(ReadFrom.K8S)) {
deploymentStatuses = readJobDeploymentsFromK8s();
} else {
deploymentStatuses = Collections.emptyMap();
}

allDataJob.forEach(
dataJob -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public void before() {
deploymentService,
executionDataFetcher,
dataJobDeploymentPropertiesConfig,
deploymentServiceV2);
deploymentServiceV2);
findDataJobs = graphQLDataFetchers.findAllAndBuildDataJobPage();
}

Expand Down Expand Up @@ -257,7 +257,8 @@ void testPopulateDeployments() throws Exception {
void testPopulateDeployments_readFromDB() throws Exception {
when(dataJobDeploymentPropertiesConfig.getReadDataSource()).thenReturn(ReadFrom.DB);
when(jobsRepository.findAll()).thenReturn(mockListOfDataJobsWithLastExecution());
when(deploymentServiceV2.findAllActualDataJobDeployments()).thenReturn(mockMapOfActualJobDeployments());
when(deploymentServiceV2.findAllActualDataJobDeployments())
.thenReturn(mockMapOfActualJobDeployments());
when(dataFetchingEnvironment.getArgument("pageNumber")).thenReturn(1);
when(dataFetchingEnvironment.getArgument("pageSize")).thenReturn(100);
when(dataFetchingEnvironment.getSelectionSet()).thenReturn(dataFetchingFieldSelectionSet);
Expand Down Expand Up @@ -426,12 +427,11 @@ private List<DataJob> mockListOfDataJobs() {

private Map<String, ActualDataJobDeployment> mockMapOfActualJobDeployments() {
return Map.of(
"sample-job-1", mockSampleActualJobDeployment("sample-job-1", true, "3.8-secure"),
"sample-job-2", mockSampleActualJobDeployment("sample-job-2", false, "3.8-secure"),
"sample-job-3", mockSampleActualJobDeployment("sample-job-3", true, "3.9-secure"),
"sample-job-4", mockSampleActualJobDeployment("sample-job-4", false, "3.9-secure"),
"sample-job-5", mockSampleActualJobDeployment("sample-job-5", true, "3.9-secure")
);
"sample-job-1", mockSampleActualJobDeployment("sample-job-1", true, "3.8-secure"),
"sample-job-2", mockSampleActualJobDeployment("sample-job-2", false, "3.8-secure"),
"sample-job-3", mockSampleActualJobDeployment("sample-job-3", true, "3.9-secure"),
"sample-job-4", mockSampleActualJobDeployment("sample-job-4", false, "3.9-secure"),
"sample-job-5", mockSampleActualJobDeployment("sample-job-5", true, "3.9-secure"));
}

private List<DataJob> mockListOfDataJobsWithLastExecution() {
Expand Down

0 comments on commit 2e365d1

Please sign in to comment.