Skip to content

Commit 9f66d3f

Browse files
author
Yavor16
committed
fix comments from ivan
1 parent b30b894 commit 9f66d3f

File tree

10 files changed

+44
-21
lines changed

10 files changed

+44
-21
lines changed

multiapps-controller-core/src/main/java/module-info.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
exports org.cloudfoundry.multiapps.controller.core.validators.parameters;
3838
exports org.cloudfoundry.multiapps.controller.core.validators.parameters.v2;
3939
exports org.cloudfoundry.multiapps.controller.core.validators.parameters.v3;
40+
exports org.cloudfoundry.multiapps.controller.core.auditlogging.model;
4041

4142
requires transitive com.sap.cloudfoundry.client.facade;
4243
requires transitive java.persistence;

multiapps-controller-core/src/main/java/org/cloudfoundry/multiapps/controller/core/auditlogging/model/AuditLogConfiguration.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package org.cloudfoundry.multiapps.controller.core.auditlogging.model;
22

3+
import java.time.LocalDateTime;
34
import java.util.ArrayList;
45
import java.util.Collections;
56
import java.util.Date;
@@ -12,11 +13,11 @@
1213

1314
public class AuditLogConfiguration implements AuditableConfiguration {
1415

15-
private static String PERFORMED_ACTION_IDENTIFIER_KEY_NAME = "performed_action";
16-
private static String TIME_IDENTIFIER_KEY_NAME = "time";
17-
private static String SPACE_ID_IDENTIFIER_KEY_NAME = "spaceId";
18-
private String userId;
19-
private String spaceId;
16+
private static final String PERFORMED_ACTION_IDENTIFIER_KEY_NAME = "performed_action";
17+
private static final String TIME_IDENTIFIER_KEY_NAME = "time";
18+
private static final String SPACE_ID_IDENTIFIER_KEY_NAME = "spaceId";
19+
private final String userId;
20+
private final String spaceId;
2021
private String performedAction;
2122
private String configuration;
2223
private Map<String, String> parameters;
@@ -62,7 +63,7 @@ public String getUserId() {
6263
}
6364

6465
public String getTimeOfPerformedAction() {
65-
return new Date().toString();
66+
return LocalDateTime.now().toString();
6667
}
6768

6869
@Override

multiapps-controller-web/src/main/java/org/cloudfoundry/multiapps/controller/web/api/impl/CsrfTokenApiServiceImpl.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,13 @@
1111
@Named
1212
public class CsrfTokenApiServiceImpl implements CsrfTokenApiService {
1313

14-
@Inject
1514
private CsrfTokenApiServiceAuditLog csrfTokenApiServiceAuditLog;
1615

16+
@Inject
17+
public CsrfTokenApiServiceImpl(CsrfTokenApiServiceAuditLog csrfTokenApiServiceAuditLog) {
18+
this.csrfTokenApiServiceAuditLog = csrfTokenApiServiceAuditLog;
19+
}
20+
1721
@Override
1822
public ResponseEntity<Void> getCsrfToken() {
1923
csrfTokenApiServiceAuditLog.logGetInfo(SecurityContextUtil.getUsername());

multiapps-controller-web/src/main/java/org/cloudfoundry/multiapps/controller/web/api/impl/FilesApiServiceImpl.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,16 @@ public class FilesApiServiceImpl implements FilesApiService {
9191
@Inject
9292
private AsyncUploadJobService uploadJobService;
9393
@Inject
94-
private FilesApiServiceAuditLog filesApiServiceAuditLog;
95-
@Inject
9694
@Named("asyncFileUploadExecutor")
9795
private ExecutorService deployFromUrlExecutor;
9896

97+
private FilesApiServiceAuditLog filesApiServiceAuditLog;
98+
99+
@Inject
100+
public FilesApiServiceImpl(FilesApiServiceAuditLog filesApiServiceAuditLog) {
101+
this.filesApiServiceAuditLog = filesApiServiceAuditLog;
102+
}
103+
99104
@Override
100105
public ResponseEntity<List<FileMetadata>> getFiles(String spaceGuid, String namespace) {
101106
try {

multiapps-controller-web/src/main/java/org/cloudfoundry/multiapps/controller/web/api/impl/InfoApiServiceImpl.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,13 @@
1313
@Named
1414
public class InfoApiServiceImpl implements InfoApiService {
1515

16-
@Inject
1716
private InfoApiServiceAuditLog infoApiServiceAuditLog;
1817

18+
@Inject
19+
public InfoApiServiceImpl(InfoApiServiceAuditLog infoApiServiceAuditLog) {
20+
this.infoApiServiceAuditLog = infoApiServiceAuditLog;
21+
}
22+
1923
@Override
2024
public ResponseEntity<Info> getInfo() {
2125
infoApiServiceAuditLog.logGetInfo(SecurityContextUtil.getUsername());

multiapps-controller-web/src/main/java/org/cloudfoundry/multiapps/controller/web/api/impl/MtasApiServiceImpl.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,18 @@ public class MtasApiServiceImpl implements MtasApiService {
3939

4040
@Inject
4141
private CloudControllerClientProvider clientProvider;
42-
43-
@Inject
44-
private MtasApiServiceAuditLog mtasApiServiceAuditLog;
4542

4643
@Inject
4744
@Qualifier("deployedMtaRequiredDataOnlyDetector")
4845
private DeployedMtaDetector deployedMtaDetector;
4946

47+
private MtasApiServiceAuditLog mtasApiServiceAuditLog;
48+
49+
@Inject
50+
public MtasApiServiceImpl(MtasApiServiceAuditLog mtasApiServiceAuditLog) {
51+
this.mtasApiServiceAuditLog = mtasApiServiceAuditLog;
52+
}
53+
5054
@Override
5155
public ResponseEntity<List<Mta>> getMtas(String spaceGuid) {
5256
mtasApiServiceAuditLog.logGetMtas(SecurityContextUtil.getUsername(), spaceGuid);
@@ -91,8 +95,7 @@ public ResponseEntity<List<Mta>> getMtas(String spaceGuid, String namespace, Str
9195
}
9296

9397
CloudControllerClient client = getCloudFoundryClient(spaceGuid);
94-
Optional<DeployedMta> optionalDeployedMta = deployedMtaDetector.detectDeployedMtaByNameAndNamespace(name, namespace,
95-
client);
98+
Optional<DeployedMta> optionalDeployedMta = deployedMtaDetector.detectDeployedMtaByNameAndNamespace(name, namespace, client);
9699
DeployedMta deployedMta = optionalDeployedMta.orElseThrow(() -> new NotFoundException(Messages.SPECIFIC_MTA_NOT_FOUND,
97100
name,
98101
namespace));

multiapps-controller-web/src/main/java/org/cloudfoundry/multiapps/controller/web/api/impl/OperationsApiServiceImpl.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@
7070
@Named
7171
public class OperationsApiServiceImpl implements OperationsApiService {
7272

73+
private static final Logger LOGGER = LoggerFactory.getLogger(OperationsApiServiceImpl.class);
7374
@Inject
7475
private CloudControllerClientFactory clientFactory;
7576
@Inject
@@ -88,10 +89,13 @@ public class OperationsApiServiceImpl implements OperationsApiService {
8889
private ProgressMessageService progressMessageService;
8990
@Inject
9091
private ProcessActionRegistry processActionRegistry;
91-
@Inject
92+
9293
private OperationsApiServiceAuditLog operationsApiServiceAuditLog;
9394

94-
private static final Logger LOGGER = LoggerFactory.getLogger(OperationsApiServiceImpl.class);
95+
@Inject
96+
public OperationsApiServiceImpl(OperationsApiServiceAuditLog operationsApiServiceAuditLog) {
97+
this.operationsApiServiceAuditLog = operationsApiServiceAuditLog;
98+
}
9599

96100
@Override
97101
public ResponseEntity<List<Operation>> getOperations(String spaceGuid, String mtaId, List<String> stateStrings, Integer last) {

multiapps-controller-web/src/test/java/org/cloudfoundry/multiapps/controller/web/api/impl/FilesApiServiceImplTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ class FilesApiServiceImplTest {
8181
@Mock
8282
private HttpClient httpClient;
8383
@InjectMocks
84-
private final FilesApiServiceImpl testedClass = new FilesApiServiceImpl() {
84+
private final FilesApiServiceImpl testedClass = new FilesApiServiceImpl(filesApiServiceAuditLog) {
8585
@Override
8686
protected HttpClient buildHttpClient(String url) {
8787
return httpClient;

multiapps-controller-web/src/test/java/org/cloudfoundry/multiapps/controller/web/api/impl/MtasApiServiceImplTest.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,12 @@ class MtasApiServiceImplTest {
5858
@Mock
5959
private DeployedMtaRequiredDataOnlyDetector deployedMtaDetector;
6060

61-
@InjectMocks
62-
private MtasApiServiceImpl testedClass;
6361
@Mock
6462
private MtasApiServiceAuditLog mtasApiServiceAuditLog;
6563

64+
@InjectMocks
65+
private MtasApiServiceImpl testedClass = new MtasApiServiceImpl(mtasApiServiceAuditLog);
66+
6667
private List<Mta> mtas;
6768

6869
private static final String USER_NAME = "someUser";

multiapps-controller-web/src/test/java/org/cloudfoundry/multiapps/controller/web/api/impl/OperationsApiServiceImplTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ class OperationsApiServiceImplTest {
8787
private OperationsApiServiceAuditLog operationsApiServiceAuditLog;
8888

8989
@InjectMocks
90-
private OperationsApiServiceImpl operationsApiService;
90+
private OperationsApiServiceImpl operationsApiService = new OperationsApiServiceImpl(operationsApiServiceAuditLog);
9191

9292
private static final String SPACE_GUID = "896e6be9-8217-4a1c-b938-09b30966157a";
9393
private static final String ORG_GUID = "0a42c085-b772-4b1e-bf4d-75c463aab5f6";

0 commit comments

Comments
 (0)