-
Notifications
You must be signed in to change notification settings - Fork 14
US65642: log AuditEvents to predix audit service #96
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
sanjeevchopra
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Didnt have a chance to review the whole change, I have one comment though.
@anubhavi25 please review the PR
| @@ -0,0 +1,49 @@ | |||
| package com.ge.predix.audit.rest; | |||
|
|
|||
| public class PredixAuditRequest { | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please move this, response and AuditRecord classes to integration-test project if they are not used by the service.
| } catch (VcapLoadException e) { | ||
| e.printStackTrace(); | ||
| } | ||
| AuditClient auditClient = new AuditClient(sdkConfig, auditCallback()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does not look right createAuditClient needs to throw an except when it fails but here we are catching the vLoadException and still initializing the auditClient
| return auditClient; | ||
| } | ||
|
|
||
| public AuditCallback auditCallback() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If AuditCallBack class is only use for integration tests then we should move to IntegrationTest project as mentioned by Sanjeev earlier.
da71da1 to
080d980
Compare
| @Autowired | ||
| private AuditClient auditClient; | ||
| // Remove this and use configuration eventually | ||
| private static final Set<String> EXCLUSIONS = Collections.singleton("/connector"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be /v1/connector since our APIs are prefixed with the version? Also, once #103 is in develop, this should change to Collections.singleton(AcsApiUriTemplates.V1 + AcsApiUriTemplates.CONNECTOR_URL) to prevent hardcoding the URI path.
|
|
||
| private static final org.slf4j.Logger LOGGER = LoggerFactory.getLogger(ACSAuditConfiguration.class); | ||
|
|
||
| private VcapLoaderServiceImpl vcapLoaderService = new VcapLoaderServiceImpl(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make this static final since we should only need to do this once?
|
|
||
| private VcapLoaderServiceImpl vcapLoaderService = new VcapLoaderServiceImpl(); | ||
|
|
||
| private AuditConfiguration sdkConfig; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Field can be converted to a local variable in the auditClient bean below (since it's only used there)
| @Test | ||
| public void testControllerExclusions() { | ||
| AuditEvent auditEvent = Mockito.mock(AuditEvent.class); | ||
| Mockito.doReturn("http://acs.com/connector/test123").when(auditEvent).getRequestUri(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you make the change above to use /v1/connector, change this test as well
40cf437 to
226f5b0
Compare
aec460f to
65ee9c9
Compare
No description provided.