Search in sources :

Example 6 with ConceptQuery

use of com.bakdata.conquery.apiv1.query.ConceptQuery in project conquery by bakdata.

the class DefaultLabelTest method autoLabelComplexQuery.

@ParameterizedTest
@CsvSource({ "de,Hochgeladene-Liste Anfrage Concept1 Concept2 und weitere", "en,Uploaded-List Query Concept1 Concept2 and further" })
void autoLabelComplexQuery(Locale locale, String autoLabel) {
    I18n.LOCALE.set(locale);
    final ManagedQuery managedQuery = new ManagedQuery(null, null, DATASET);
    managedQuery.setQueryId(UUID.randomUUID());
    CQAnd and = new CQAnd();
    CQConcept concept1 = makeCQConcept("Concept1");
    CQConcept concept2 = makeCQConcept("Concept2");
    CQConcept concept3 = makeCQConcept("Concept3veryveryveryveryveryveryveryverylooooooooooooooooooooonglabel");
    and.setChildren(List.of(new CQExternal(List.of(), new String[0][0]), new CQReusedQuery(managedQuery.getId()), concept1, concept2, concept3));
    ConceptQuery cq = new ConceptQuery(and);
    ManagedQuery mQuery = cq.toManagedExecution(user, DATASET);
    mQuery.setLabel(mQuery.makeAutoLabel(getPrintSettings(locale)));
    assertThat(mQuery.getLabel()).isEqualTo(autoLabel + AUTO_LABEL_SUFFIX);
    assertThat(mQuery.getLabelWithoutAutoLabelSuffix()).isEqualTo(autoLabel);
}
Also used : CQReusedQuery(com.bakdata.conquery.apiv1.query.concept.specific.CQReusedQuery) CQConcept(com.bakdata.conquery.apiv1.query.concept.specific.CQConcept) CQExternal(com.bakdata.conquery.apiv1.query.concept.specific.external.CQExternal) ManagedQuery(com.bakdata.conquery.models.query.ManagedQuery) CQAnd(com.bakdata.conquery.apiv1.query.concept.specific.CQAnd) ConceptQuery(com.bakdata.conquery.apiv1.query.ConceptQuery) CsvSource(org.junit.jupiter.params.provider.CsvSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 7 with ConceptQuery

use of com.bakdata.conquery.apiv1.query.ConceptQuery in project conquery by bakdata.

the class QueryCleanupTaskTest method reusedNoNames.

@Test
void reusedNoNames() throws Exception {
    assertThat(STORAGE.getAllExecutions()).isEmpty();
    final ManagedQuery managedQuery = createManagedQuery();
    final ManagedQuery managedQueryReused = createManagedQuery();
    managedQuery.setQuery(new ConceptQuery(new CQReusedQuery(managedQueryReused.getId())));
    new QueryCleanupTask(STORAGE, queryExpiration).execute(Map.of(), null);
    assertThat(STORAGE.getAllExecutions()).isEmpty();
}
Also used : CQReusedQuery(com.bakdata.conquery.apiv1.query.concept.specific.CQReusedQuery) ManagedQuery(com.bakdata.conquery.models.query.ManagedQuery) ConceptQuery(com.bakdata.conquery.apiv1.query.ConceptQuery) Test(org.junit.jupiter.api.Test)

Example 8 with ConceptQuery

use of com.bakdata.conquery.apiv1.query.ConceptQuery in project conquery by bakdata.

the class QueryCleanupTaskTest method createManagedQuery.

private ManagedQuery createManagedQuery() {
    final CQAnd root = new CQAnd();
    root.setChildren(new ArrayList<>());
    ConceptQuery query = new ConceptQuery(root);
    final ManagedQuery managedQuery = new ManagedQuery(query, null, new Dataset("test"));
    managedQuery.setCreationTime(LocalDateTime.now().minus(queryExpiration).minusDays(1));
    STORAGE.addExecution(managedQuery);
    return managedQuery;
}
Also used : Dataset(com.bakdata.conquery.models.datasets.Dataset) ManagedQuery(com.bakdata.conquery.models.query.ManagedQuery) CQAnd(com.bakdata.conquery.apiv1.query.concept.specific.CQAnd) ConceptQuery(com.bakdata.conquery.apiv1.query.ConceptQuery)

Example 9 with ConceptQuery

use of com.bakdata.conquery.apiv1.query.ConceptQuery in project conquery by bakdata.

the class DefaultLabelTest method autoLabelReusedQuery.

@ParameterizedTest
@CsvSource({ "de,Anfrage", "en,Query" })
void autoLabelReusedQuery(Locale locale, String autoLabel) {
    I18n.LOCALE.set(locale);
    final ManagedQuery managedQuery = new ManagedQuery(null, null, DATASET);
    managedQuery.setQueryId(UUID.randomUUID());
    CQReusedQuery reused = new CQReusedQuery(managedQuery.getId());
    ConceptQuery cq = new ConceptQuery(reused);
    ManagedQuery mQuery = cq.toManagedExecution(user, DATASET);
    mQuery.setLabel(mQuery.makeAutoLabel(getPrintSettings(locale)));
    assertThat(mQuery.getLabel()).isEqualTo(autoLabel + AUTO_LABEL_SUFFIX);
    assertThat(mQuery.getLabelWithoutAutoLabelSuffix()).isEqualTo(autoLabel);
}
Also used : CQReusedQuery(com.bakdata.conquery.apiv1.query.concept.specific.CQReusedQuery) ManagedQuery(com.bakdata.conquery.models.query.ManagedQuery) ConceptQuery(com.bakdata.conquery.apiv1.query.ConceptQuery) CsvSource(org.junit.jupiter.params.provider.CsvSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 10 with ConceptQuery

use of com.bakdata.conquery.apiv1.query.ConceptQuery in project conquery by bakdata.

the class DefaultLabelTest method autoLabelConceptQuery.

@ParameterizedTest
@CsvSource({ "de,Concept", "en,Concept" })
void autoLabelConceptQuery(Locale locale, String autoLabel) {
    I18n.LOCALE.set(locale);
    CQConcept concept = makeCQConcept("Concept");
    ConceptQuery cq = new ConceptQuery(concept);
    ManagedQuery mQuery = cq.toManagedExecution(user, DATASET);
    mQuery.setLabel(mQuery.makeAutoLabel(getPrintSettings(locale)));
    assertThat(mQuery.getLabel()).isEqualTo(autoLabel + AUTO_LABEL_SUFFIX);
    assertThat(mQuery.getLabelWithoutAutoLabelSuffix()).isEqualTo(autoLabel);
}
Also used : CQConcept(com.bakdata.conquery.apiv1.query.concept.specific.CQConcept) ManagedQuery(com.bakdata.conquery.models.query.ManagedQuery) ConceptQuery(com.bakdata.conquery.apiv1.query.ConceptQuery) CsvSource(org.junit.jupiter.params.provider.CsvSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Aggregations

ConceptQuery (com.bakdata.conquery.apiv1.query.ConceptQuery)20 ManagedQuery (com.bakdata.conquery.models.query.ManagedQuery)16 CQReusedQuery (com.bakdata.conquery.apiv1.query.concept.specific.CQReusedQuery)10 CQConcept (com.bakdata.conquery.apiv1.query.concept.specific.CQConcept)8 Test (org.junit.jupiter.api.Test)7 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)6 CsvSource (org.junit.jupiter.params.provider.CsvSource)6 CQAnd (com.bakdata.conquery.apiv1.query.concept.specific.CQAnd)5 CQExternal (com.bakdata.conquery.apiv1.query.concept.specific.external.CQExternal)5 CQTable (com.bakdata.conquery.apiv1.query.concept.filter.CQTable)4 Dataset (com.bakdata.conquery.models.datasets.Dataset)4 ArrayConceptQuery (com.bakdata.conquery.apiv1.query.ArrayConceptQuery)2 FilterValue (com.bakdata.conquery.apiv1.query.concept.filter.FilterValue)2 Table (com.bakdata.conquery.models.datasets.Table)2 CentralRegistry (com.bakdata.conquery.models.identifiable.CentralRegistry)2 UUID (java.util.UUID)2 FullExecutionStatus (com.bakdata.conquery.apiv1.FullExecutionStatus)1 FeatureGroup (com.bakdata.conquery.apiv1.forms.FeatureGroup)1 ExternalUploadResult (com.bakdata.conquery.apiv1.query.ExternalUploadResult)1 Query (com.bakdata.conquery.apiv1.query.Query)1