Search in sources :

Example 1 with UpdateMatchingStatsMessage

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")));
}
Also used : UpdateMatchingStatsMessage(com.bakdata.conquery.models.messages.namespaces.specific.UpdateMatchingStatsMessage) TreeConcept(com.bakdata.conquery.models.datasets.concepts.tree.TreeConcept) ConqueryTestSpec(com.bakdata.conquery.integration.json.ConqueryTestSpec) DatasetId(com.bakdata.conquery.models.identifiable.ids.specific.DatasetId)

Example 2 with UpdateMatchingStatsMessage

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);
}
Also used : UpdateMatchingStatsMessage(com.bakdata.conquery.models.messages.namespaces.specific.UpdateMatchingStatsMessage)

Example 3 with UpdateMatchingStatsMessage

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());
    }));
}
Also used : UpdateMatchingStatsMessage(com.bakdata.conquery.models.messages.namespaces.specific.UpdateMatchingStatsMessage) SimpleJob(com.bakdata.conquery.models.jobs.SimpleJob) Namespace(com.bakdata.conquery.models.worker.Namespace)

Aggregations

UpdateMatchingStatsMessage (com.bakdata.conquery.models.messages.namespaces.specific.UpdateMatchingStatsMessage)3 ConqueryTestSpec (com.bakdata.conquery.integration.json.ConqueryTestSpec)1 TreeConcept (com.bakdata.conquery.models.datasets.concepts.tree.TreeConcept)1 DatasetId (com.bakdata.conquery.models.identifiable.ids.specific.DatasetId)1 SimpleJob (com.bakdata.conquery.models.jobs.SimpleJob)1 Namespace (com.bakdata.conquery.models.worker.Namespace)1