Conversation
| final List<T> list = new ArrayList<>(); | ||
| iterator.forEachRemaining(list::add); | ||
| return list; | ||
| } |
There was a problem hiding this comment.
Instead of hateful stateful mutability inside closures i'd recommend to use more functional style (thought more verbose):
StreamSupport.stream(Spliterators.spliteratorUnknownSize(iterator, Spliterator.ORDERED), false)
.collect(Collectors.toCollection(ArrayList::new));with static imports looks a bit better:
stream(spliteratorUnknownSize(iterator, ORDERED), false)
.collect(toCollection(ArrayList::new));also, stream(spliteratorUnknownSize(iterator, ORDERED), false) could be carried out to util method to be reused in other methods
| } | ||
| } | ||
| return ofNullable(latestVersion); | ||
| } |
There was a problem hiding this comment.
return ourFancyUtilSpliteratorStreamMethod(originalRoot.fieldNames())
.reduce((first, second) -> second);There was a problem hiding this comment.
@andrii-kovalenko-ct unneeded null check removed: a75d76c
lojzatran
left a comment
There was a problem hiding this comment.
One more thing: I see in travis, you have things like GRGIT_USER with encrypted value. Where do we get the value if sth happens to travis? You can consider saving them as encrypted files in the repo itself, like here: https://github.com/commercetools/commercetools-paypal-plus-integration/tree/master/travis-build
| public class BenchmarkUtils { | ||
| private static final String BENCHMARK_RESULTS_FILE_NAME = "benchmarks.json"; | ||
| private static final String BENCHMARK_RESULTS_FILE_DIR = ofNullable(System.getenv("TRAVIS_BUILD_DIR")) | ||
| .map(path -> path + "/tmp_git_dir/benchmarks/").orElse(""); |
There was a problem hiding this comment.
Not sure if it's ok to pass empty String in that case. Maybe it's better to throw exception because you expect in benchmarkCommit above this structure and if it's not there, it won't work.
There was a problem hiding this comment.
I need it for when I am running the benchmarks locally, I don't want an exception to be thrown. On the other hand, If this directory struc. is not there for some reason while running the benchmarks, benchmarkCommit would fail.
| static final String CREATES_ONLY = "createsOnly"; | ||
| static final String UPDATES_ONLY = "updatesOnly"; | ||
| static final String CREATES_AND_UPDATES = "mix"; | ||
| static double THRESHOLD = 120000; //120 seconds in milliseconds |
There was a problem hiding this comment.
and why it's double (isn't int enough)?
|
|
||
| public class BenchmarkUtils { | ||
| private static final String BENCHMARK_RESULTS_FILE_NAME = "benchmarks.json"; | ||
| private static final String BENCHMARK_RESULTS_FILE_DIR = ofNullable(System.getenv("TRAVIS_BUILD_DIR")) |
There was a problem hiding this comment.
Hardcoding CI specific names (TRAVIS_BUILD_DIR) doesn't look flexible.
Better to use our own env name (for instance, BUILD_DIR, or CI_BUILD_DIR) and assign them in CI configuration
|
@lojzatran regarding encrypting secrets; an issue is created for improvement: #247 |
Codecov Report
@@ Coverage Diff @@
## master #240 +/- ##
=========================================
Coverage 93.35% 93.35%
Complexity 832 832
=========================================
Files 69 69
Lines 2153 2153
Branches 127 127
=========================================
Hits 2010 2010
Misses 124 124
Partials 19 19
Continue to review full report at Codecov.
|
This pr addresses #155 to product benchmark tests for the library on every release. The resulting charts look like this: https://commercetools.github.io/commercetools-sync-java/benchmarks/
Benchmark Setup:
Add
benchmarkas a new source set in the project just like main, test and integration test.When benchmarks are run, first checkout the
gh-pagesbranch of the repo in a temp directory: 'tmp_git_dir/', then run the benchmarks.Commit the results of the benchmarks (in this file:
benchmarks/benchmarks.json) to this directory and push..Use Travis' new feature of stages to have 5 different stages which runs the benchmarks and pushes the results to the gh-pages branch: https://github.com/commercetools/commercetools-sync-java/pull/240/files#diff-354f30a63fb0907d4ad57269548329e3R7
This kind of build will only be triggered on every release:
if: tag IS present. This is how it looks on travis.Add benchmark tests for ProductSync, InventorySync (still not complete and skeleton for CategorySync
In the gh-pages, the chart-render.js uses the output results of
benchmarks/benchmarks.jsonto display the results in this bar chart graph.Related to benchmarks:
benchmarksdirectory on javadocs publishing.Boy-scout-changes:
Remove unneeded
oracle-java8-installerfrom travis configuration.Rename gradle task from
setReleaseVersiontosetLibraryVersion: task | usage | in execution order script.Rename gradle script file
set-release-versiontoset-library-version: file itself | in build.gradle | in comment in SyncSolutionInfoTODO: