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);
}
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();
}
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;
}
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);
}
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);
}
Aggregations