Skip to content

Commit

Permalink
tools - Upgrade apache velocity from 1x to 2x, drop apache commons co…
Browse files Browse the repository at this point in the history
…dec in favor of java.util (#584)

* Update hollow ui tools deps

* Update velocity api

* Optimize deps

---------

Co-authored-by: Sunjeet Singh <[email protected]>
  • Loading branch information
Sunjeet and Sunjeet authored Feb 9, 2023
1 parent d5309ac commit 9ec1c8a
Show file tree
Hide file tree
Showing 15 changed files with 143 additions and 178 deletions.
3 changes: 3 additions & 0 deletions dependencies.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{

}
2 changes: 1 addition & 1 deletion hollow-diff-ui/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ dependencies {
api project(':hollow')
api project(':hollow-ui-tools')
implementation project(':hollow-test')
implementation 'com.google.code.gson:gson:2.8.0'
implementation 'com.google.code.gson:gson:2.10.1'

implementation "javax.servlet:javax.servlet-api:4.0.1"

Expand Down
94 changes: 38 additions & 56 deletions hollow-diff-ui/dependencies.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
},
"compileClasspath": {
"com.google.code.gson:gson": {
"locked": "2.8.0"
"locked": "2.10.1"
},
"com.netflix.hollow:hollow": {
"firstLevelTransitive": [
Expand All @@ -20,28 +20,22 @@
"com.netflix.hollow:hollow-ui-tools": {
"project": true
},
"commons-codec:commons-codec": {
"firstLevelTransitive": [
"com.netflix.hollow:hollow-ui-tools"
],
"locked": "1.11"
},
"javax.servlet:javax.servlet-api": {
"locked": "4.0.1"
},
"org.apache.velocity:velocity": {
"org.apache.velocity:velocity-engine-core": {
"firstLevelTransitive": [
"com.netflix.hollow:hollow-ui-tools"
],
"locked": "1.7"
"locked": "2.3"
}
},
"runtimeClasspath": {
"com.google.code.gson:gson": {
"firstLevelTransitive": [
"com.netflix.hollow:hollow-ui-tools"
],
"locked": "2.8.0"
"locked": "2.10.1"
},
"com.netflix.hollow:hollow": {
"firstLevelTransitive": [
Expand All @@ -56,34 +50,34 @@
"com.netflix.hollow:hollow-ui-tools": {
"project": true
},
"commons-codec:commons-codec": {
"commons-io:commons-io": {
"firstLevelTransitive": [
"com.netflix.hollow:hollow-ui-tools"
],
"locked": "1.11"
"locked": "2.11.0"
},
"commons-io:commons-io": {
"javax.servlet:javax.servlet-api": {
"firstLevelTransitive": [
"com.netflix.hollow:hollow-ui-tools"
],
"locked": "2.6"
"locked": "4.0.1"
},
"javax.servlet:javax.servlet-api": {
"org.apache.commons:commons-text": {
"firstLevelTransitive": [
"com.netflix.hollow:hollow-ui-tools"
],
"locked": "4.0.1"
"locked": "1.10.0"
},
"org.apache.velocity:velocity": {
"org.apache.velocity:velocity-engine-core": {
"firstLevelTransitive": [
"com.netflix.hollow:hollow-ui-tools"
],
"locked": "1.7"
"locked": "2.3"
}
},
"testCompileClasspath": {
"com.google.code.gson:gson": {
"locked": "2.8.0"
"locked": "2.10.1"
},
"com.netflix.hollow:hollow": {
"firstLevelTransitive": [
Expand All @@ -97,31 +91,25 @@
"com.netflix.hollow:hollow-ui-tools": {
"project": true
},
"commons-codec:commons-codec": {
"firstLevelTransitive": [
"com.netflix.hollow:hollow-ui-tools"
],
"locked": "1.11"
},
"javax.servlet:javax.servlet-api": {
"locked": "4.0.1"
},
"junit:junit": {
"locked": "4.11"
},
"org.apache.velocity:velocity": {
"org.apache.velocity:velocity-engine-core": {
"firstLevelTransitive": [
"com.netflix.hollow:hollow-ui-tools"
],
"locked": "1.7"
"locked": "2.3"
}
},
"testRuntimeClasspath": {
"com.google.code.gson:gson": {
"firstLevelTransitive": [
"com.netflix.hollow:hollow-ui-tools"
],
"locked": "2.8.0"
"locked": "2.10.1"
},
"com.netflix.hollow:hollow": {
"firstLevelTransitive": [
Expand All @@ -136,17 +124,11 @@
"com.netflix.hollow:hollow-ui-tools": {
"project": true
},
"commons-codec:commons-codec": {
"firstLevelTransitive": [
"com.netflix.hollow:hollow-ui-tools"
],
"locked": "1.11"
},
"commons-io:commons-io": {
"firstLevelTransitive": [
"com.netflix.hollow:hollow-ui-tools"
],
"locked": "2.6"
"locked": "2.11.0"
},
"javax.servlet:javax.servlet-api": {
"firstLevelTransitive": [
Expand All @@ -157,16 +139,22 @@
"junit:junit": {
"locked": "4.11"
},
"org.apache.velocity:velocity": {
"org.apache.commons:commons-text": {
"firstLevelTransitive": [
"com.netflix.hollow:hollow-ui-tools"
],
"locked": "1.10.0"
},
"org.apache.velocity:velocity-engine-core": {
"firstLevelTransitive": [
"com.netflix.hollow:hollow-ui-tools"
],
"locked": "1.7"
"locked": "2.3"
}
},
"toolsCompileClasspath": {
"com.google.code.gson:gson": {
"locked": "2.8.0"
"locked": "2.10.1"
},
"com.netflix.hollow:hollow": {
"firstLevelTransitive": [
Expand All @@ -180,31 +168,25 @@
"com.netflix.hollow:hollow-ui-tools": {
"project": true
},
"commons-codec:commons-codec": {
"firstLevelTransitive": [
"com.netflix.hollow:hollow-ui-tools"
],
"locked": "1.11"
},
"javax.servlet:javax.servlet-api": {
"locked": "4.0.1"
},
"junit:junit": {
"locked": "4.11"
},
"org.apache.velocity:velocity": {
"org.apache.velocity:velocity-engine-core": {
"firstLevelTransitive": [
"com.netflix.hollow:hollow-ui-tools"
],
"locked": "1.7"
"locked": "2.3"
}
},
"toolsRuntimeClasspath": {
"com.google.code.gson:gson": {
"firstLevelTransitive": [
"com.netflix.hollow:hollow-ui-tools"
],
"locked": "2.8.0"
"locked": "2.10.1"
},
"com.netflix.hollow:hollow": {
"firstLevelTransitive": [
Expand All @@ -219,17 +201,11 @@
"com.netflix.hollow:hollow-ui-tools": {
"project": true
},
"commons-codec:commons-codec": {
"firstLevelTransitive": [
"com.netflix.hollow:hollow-ui-tools"
],
"locked": "1.11"
},
"commons-io:commons-io": {
"firstLevelTransitive": [
"com.netflix.hollow:hollow-ui-tools"
],
"locked": "2.6"
"locked": "2.11.0"
},
"javax.servlet:javax.servlet-api": {
"firstLevelTransitive": [
Expand All @@ -240,11 +216,17 @@
"junit:junit": {
"locked": "4.11"
},
"org.apache.velocity:velocity": {
"org.apache.commons:commons-text": {
"firstLevelTransitive": [
"com.netflix.hollow:hollow-ui-tools"
],
"locked": "1.10.0"
},
"org.apache.velocity:velocity-engine-core": {
"firstLevelTransitive": [
"com.netflix.hollow:hollow-ui-tools"
],
"locked": "1.7"
"locked": "2.3"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang.StringUtils;
import org.apache.velocity.app.VelocityEngine;

public class HollowDiffUI implements HollowRecordDiffUI {
Expand All @@ -63,7 +62,7 @@ public class HollowDiffUI implements HollowRecordDiffUI {

HollowDiffUI(String baseURLPath, String diffUIPath, HollowDiff diff, String fromBlobName, String toBlobName, VelocityEngine ve) {
this.baseURLPath = baseURLPath;
this.diffUIPath = StringUtils.isEmpty(diffUIPath) ? baseURLPath : baseURLPath + "/" + diffUIPath;
this.diffUIPath = (diffUIPath == null || diffUIPath.length() == 0) ? baseURLPath : baseURLPath + "/" + diffUIPath;
this.diff = diff;
this.velocity = ve;
this.fromBlobName = fromBlobName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import java.util.Collections;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.lang.StringUtils;
import org.apache.velocity.VelocityContext;

public class DiffFieldPage extends DiffPage {
Expand Down Expand Up @@ -80,9 +79,9 @@ private List<HollowObjectPairDiffScore> getObjectDiffScores(HollowTypeDiff typeD
private List<HollowDiffUIBreadcrumbs> getBreadcrumbs(HollowTypeDiff typeDiff, HollowFieldDiff fieldDiff) {
List<HollowDiffUIBreadcrumbs> breadcrumbs = new ArrayList<HollowDiffUIBreadcrumbs>();

breadcrumbs.add(new HollowDiffUIBreadcrumbs(StringUtils.isEmpty(diffUI.getDiffUIPath()) ?
breadcrumbs.add(new HollowDiffUIBreadcrumbs((diffUI.getDiffUIPath() == null || diffUI.getDiffUIPath().length() == 0) ?
"/" : diffUI.getDiffUIPath(), "Overview"));
breadcrumbs.add(new HollowDiffUIBreadcrumbs(StringUtils.isEmpty(diffUI.getDiffUIPath()) ?
breadcrumbs.add(new HollowDiffUIBreadcrumbs((diffUI.getDiffUIPath() == null || diffUI.getDiffUIPath().length() == 0) ?
"typediff?type=" + typeDiff.getTypeName() : diffUI.getDiffUIPath() + "/typediff?type=" + typeDiff.getTypeName(), typeDiff.getTypeName()));
breadcrumbs.add(new HollowDiffUIBreadcrumbs(null, fieldDiff.getFieldIdentifier().toString()));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.lang.StringUtils;
import org.apache.velocity.VelocityContext;

public class DiffObjectPage extends DiffPage {
Expand Down Expand Up @@ -63,12 +62,12 @@ private List<HollowDiffUIBreadcrumbs> getBreadcrumbs(String type, int fieldIdx,

List<HollowDiffUIBreadcrumbs> breadcrumbs = new ArrayList<HollowDiffUIBreadcrumbs>();

breadcrumbs.add(new HollowDiffUIBreadcrumbs(StringUtils.isEmpty(diffUI.getDiffUIPath()) ?
breadcrumbs.add(new HollowDiffUIBreadcrumbs((diffUI.getDiffUIPath() == null || diffUI.getDiffUIPath().length() == 0) ?
"/" : diffUI.getDiffUIPath(), "Overview"));
breadcrumbs.add(new HollowDiffUIBreadcrumbs(StringUtils.isEmpty(diffUI.getDiffUIPath()) ?
breadcrumbs.add(new HollowDiffUIBreadcrumbs((diffUI.getDiffUIPath() == null || diffUI.getDiffUIPath().length() == 0) ?
"typediff?type=" + type : diffUI.getDiffUIPath() + "/typediff?type=" + type, type));
if(fieldIdx != -1) {
breadcrumbs.add(new HollowDiffUIBreadcrumbs(StringUtils.isEmpty(diffUI.getDiffUIPath()) ?
breadcrumbs.add(new HollowDiffUIBreadcrumbs((diffUI.getDiffUIPath() == null || diffUI.getDiffUIPath().length() == 0) ?
"fielddiff?type=" + type + "&fieldIdx=" + fieldIdx : diffUI.getDiffUIPath() + "/fielddiff?type=" + type + "&fieldIdx=" + fieldIdx, typeDiff.getFieldDiffs().get(fieldIdx).getFieldIdentifier().toString()));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.lang.StringUtils;
import org.apache.velocity.VelocityContext;

public class DiffTypePage extends DiffPage {
Expand Down Expand Up @@ -199,7 +198,7 @@ private List<HollowUnmatchedObject> lazyGetUnmatchedObjects(
private List<HollowDiffUIBreadcrumbs> getBreadcrumbs(HollowTypeDiff typeDiff) {
List<HollowDiffUIBreadcrumbs> breadcrumbs = new ArrayList<HollowDiffUIBreadcrumbs>();

breadcrumbs.add(new HollowDiffUIBreadcrumbs(StringUtils.isEmpty(diffUI.getDiffUIPath()) ?
breadcrumbs.add(new HollowDiffUIBreadcrumbs((diffUI.getDiffUIPath() == null || diffUI.getDiffUIPath().length() == 0) ?
"/" : diffUI.getDiffUIPath(), "Overview"));
breadcrumbs.add(new HollowDiffUIBreadcrumbs(null, typeDiff.getTypeName()));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@
import com.netflix.hollow.core.schema.HollowObjectSchema.FieldType;
import com.netflix.hollow.diffview.effigy.HollowEffigy.Field;
import java.util.ArrayList;
import java.util.Base64;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.commons.codec.binary.Base64;

public class HollowEffigyFactory {

private final Base64 base64 = new Base64();
private final Base64.Encoder base64 = Base64.getEncoder();
private final Map<HollowEffigy.Field, HollowEffigy.Field> fieldMemoizer = new HashMap<HollowEffigy.Field, HollowEffigy.Field>();

public HollowEffigy effigy(HollowDataAccess dataAccess, String typeName, int ordinal) {
Expand Down
Loading

0 comments on commit 9ec1c8a

Please sign in to comment.