Apply audit log functions to portal using audit-log module#5008
Apply audit log functions to portal using audit-log module#5008Anilople merged 8 commits intoapolloconfig:masterfrom
Conversation
Add patch of dealing with collection-type arg when AOP capturing input parameter for "AnyMatched".
Codecov Report
@@ Coverage Diff @@
## master #5008 +/- ##
============================================
+ Coverage 49.27% 49.61% +0.34%
- Complexity 1889 1908 +19
============================================
Files 372 372
Lines 11538 11553 +15
Branches 1123 1127 +4
============================================
+ Hits 5685 5732 +47
+ Misses 5513 5479 -34
- Partials 340 342 +2
|
|
Some bug happened when create namespace and cluster |
1 similar comment
|
Some bug happened when create namespace and cluster |
| // if arg is a collection | ||
| if (arg instanceof Collection) { | ||
| for (Object o : ((Collection<?>) arg).toArray()) { | ||
| String matchedValue = String.valueOf(o); |
There was a problem hiding this comment.
Add some test for those code?
| package com.ctrip.framework.apollo.portal.spi.defaultimpl; | ||
|
|
||
| import com.ctrip.framework.apollo.audit.annotation.ApolloAuditLog; | ||
| import com.ctrip.framework.apollo.audit.annotation.OpType; |
There was a problem hiding this comment.
please remove those import
| package com.ctrip.framework.apollo.portal.spi.defaultimpl; | ||
|
|
||
| import com.ctrip.framework.apollo.audit.annotation.ApolloAuditLog; | ||
| import com.ctrip.framework.apollo.audit.annotation.OpType; |
There was a problem hiding this comment.
please remove those import
|
It seems great only use annotation to collect the audit log! |
| } | ||
| } | ||
| auditDataInfluenceArg(pjp); | ||
| return pjp.proceed(); |
There was a problem hiding this comment.
Only record the audit log after method executed success,
so auditDataInfluenceArg should after pjp.proceed()?
| return; | ||
| } | ||
|
|
||
| Collection<Object> parsedList = new ArrayList<>(Collections.emptyList()); |
There was a problem hiding this comment.
Suggest that iterate arg directly without create a new ArrayList
| public void mockAuditMethod( | ||
| @ApolloAuditLogDataInfluence | ||
| @ApolloAuditLogDataInfluenceTable(tableName = "App") | ||
| @ApolloAuditLogDataInfluenceTableField(fieldName = "Name") Object val1, |
There was a problem hiding this comment.
add a test case when arg is a collection?
There was a problem hiding this comment.
add a test case when arg is a collection?
There is a method to parsing arg, and a test method too, see testParseArgAndAppendCaseCollectionTypeArg at ApolloAuditSpanAspectTest

What's the purpose of this PR
Apply audit log functions to portal using audit-log module's annotations
Which issue(s) this PR fixes:
Fixes ##3505
Brief changelog
add audit-log annotations to Portal for applying audit log functions.
Follow this checklist to help us incorporate your contribution quickly and easily:
mvn clean testto make sure this pull request doesn't break anything.CHANGESlog.