-
Updated relationship that Markets have with Categories. Added logic to market filters to inject categories based on the listings available to a market. If the listing contains a category, it is then returned as an "active" category. Change-Id: Icfb15058ffabd39ff65c8f575e72087fc67c1313 Signed-off-by:
Martin Lowe <martin.lowe@eclipse-foundation.org>
Updated relationship that Markets have with Categories. Added logic to market filters to inject categories based on the listings available to a market. If the listing contains a category, it is then returned as an "active" category. Change-Id: Icfb15058ffabd39ff65c8f575e72087fc67c1313 Signed-off-by:
Martin Lowe <martin.lowe@eclipse-foundation.org>
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
const axios = require('axios');
const randomWords = require('random-words');
const uuid = require('uuid');
const argv = require('yargs')
.option('c', {
description: 'Number of listings to generate',
alias: 'count',
default: 1000,
nargs: 1
})
.option('i', {
description: 'Number of installs to generate',
alias: 'installs',
default: 0,
nargs: 1
})
.option('s', {
description: 'Server address (e.g. http://localhost:8090)',
alias: 'server',
nargs: 1,
demandOption: true
}).argv;
let max = argv.c;
const lic_types = ["EPL-2.0","EPL-1.0","GPL"];
const platforms = ["windows","macos","linux"];
const eclipseVs = ["4.6","4.7","4.8","4.9","4.10","4.11","4.12"];
const javaVs = ["1.5", "1.6", "1.7", "1.8", "1.9", "1.10"];
const categoryIds = [];
for (var i=0;i<200;i++) {
categoryIds.push(uuid.v4());
}
const marketIds = [];
for (var i=0;i<5;i++) {
marketIds.push(uuid.v4());
}
createListing(0);
createCategory(0);
createMarket(0);
function shuff(arr) {
var out = Array.from(arr);
for (var i=0;i<out.length;i++) {
var curr = out[i];
var rndIdx = Math.floor(Math.random() * arr.length);
var next = out[rndIdx];
out[rndIdx] = curr;
out[i] = next;
}
return out;
}
function splice(arr) {
var out = [];
var copy = shuff(arr);
var c = Math.floor(Math.random() * arr.length - 1) + 1;
for (var i=0; i<=c;i++) {
out.push(copy[i]);
}
return out;
}
function createListing(count) {
if (count >= max) {
return;
}
console.log(`Generating listing ${count} of ${max}`);
var json = generateJSON(uuid.v4());