use of com.bakdata.conquery.models.messages.namespaces.specific.UpdateMatchingStatsMessage in project conquery by bakdata.
the class MetadataCollectionTest method execute.
@Override
public void execute(StandaloneSupport conquery) throws Exception {
// read test sepcification
String testJson = In.resource("/tests/query/SIMPLE_TREECONCEPT_QUERY/SIMPLE_TREECONCEPT_Query.test.json").withUTF8().readAll();
DatasetId dataset = conquery.getDataset().getId();
ConqueryTestSpec test = JsonIntegrationTest.readJson(dataset, testJson);
ValidatorHelper.failOnError(log, conquery.getValidator().validate(test));
test.importRequiredData(conquery);
// ensure the metadata is collected
conquery.getNamespace().sendToAll(new UpdateMatchingStatsMessage());
conquery.waitUntilWorkDone();
TreeConcept concept = (TreeConcept) conquery.getNamespace().getStorage().getAllConcepts().iterator().next();
// check the number of matched events
assertThat(concept.getMatchingStats().countEvents()).isEqualTo(4);
assertThat(concept.getChildren()).allSatisfy(c -> {
assertThat(c.getMatchingStats().countEvents()).isEqualTo(2);
});
// check the date ranges
assertThat(concept.getMatchingStats().spanEvents()).isEqualTo(CDateRange.of(LocalDate.parse("2010-07-15"), LocalDate.parse("2013-11-10")));
assertThat(concept.getChildren().get(0).getMatchingStats().spanEvents()).isEqualTo(CDateRange.of(LocalDate.parse("2012-01-01"), LocalDate.parse("2013-11-10")));
assertThat(concept.getChildren().get(1).getMatchingStats().spanEvents()).isEqualTo(CDateRange.of(LocalDate.parse("2010-07-15"), LocalDate.parse("2012-11-11")));
}
use of com.bakdata.conquery.models.messages.namespaces.specific.UpdateMatchingStatsMessage in project conquery by bakdata.
the class JsonIntegrationTest method execute.
@Override
public void execute(StandaloneSupport conquery) throws Exception {
ValidatorHelper.failOnError(log, VALIDATOR.validate(testSpec));
testSpec.importRequiredData(conquery);
// ensure the metadata is collected
conquery.getNamespace().sendToAll(new UpdateMatchingStatsMessage());
conquery.waitUntilWorkDone();
testSpec.executeTest(conquery);
}
use of com.bakdata.conquery.models.messages.namespaces.specific.UpdateMatchingStatsMessage in project conquery by bakdata.
the class AdminDatasetProcessor method updateMatchingStats.
/**
* Issues all Shards to do an UpdateMatchingStats.
*
* @implNote This intentionally submits a SlowJob so that it will be queued after all jobs that are already in the queue (usually import jobs).
*/
public void updateMatchingStats(Dataset dataset) {
final Namespace ns = getDatasetRegistry().get(dataset.getId());
ns.getJobManager().addSlowJob(new SimpleJob("Initiate Update Matching Stats and FilterSearch", () -> {
ns.sendToAll(new UpdateMatchingStatsMessage());
FilterSearch.updateSearch(getDatasetRegistry(), Collections.singleton(ns.getDataset()), getJobManager(), config.getCsv());
}));
}
Aggregations