use of com.bakdata.conquery.apiv1.query.concept.specific.CQReusedQuery in project conquery by bakdata.
the class DefaultLabelTest method autoLabelComplexQueryNullLabels.
@ParameterizedTest
@CsvSource({ "de,Hochgeladene-Liste Anfrage Default-Concept Concept2 Concept3", "en,Uploaded-List Query Default-Concept Concept2 Concept3" })
void autoLabelComplexQueryNullLabels(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 = new CQConcept();
concept1.setLabel(null);
concept1.setElements(List.of(CONCEPT));
CQConcept concept2 = makeCQConcept("Concept2");
CQConcept concept3 = makeCQConcept("Concept3");
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.concept.specific.CQReusedQuery in project conquery by bakdata.
the class QueryCleanupTaskTest method reusedNames.
@Test
void reusedNames() throws Exception {
assertThat(STORAGE.getAllExecutions()).isEmpty();
final ManagedQuery managedQuery = createManagedQuery();
final ManagedQuery managedQueryReused = createManagedQuery();
managedQueryReused.setLabel("test2");
managedQuery.setQuery(new ConceptQuery(new CQReusedQuery(managedQueryReused.getId())));
new QueryCleanupTask(STORAGE, queryExpiration).execute(Map.of(), null);
assertThat(STORAGE.getAllExecutions()).containsExactlyInAnyOrder(managedQueryReused);
}
use of com.bakdata.conquery.apiv1.query.concept.specific.CQReusedQuery in project conquery by bakdata.
the class QueryCleanupTaskTest method reusedTagged.
@Test
void reusedTagged() throws Exception {
assertThat(STORAGE.getAllExecutions()).isEmpty();
final ManagedQuery managedQuery = createManagedQuery();
final ManagedQuery managedQueryReused = createManagedQuery();
managedQueryReused.setTags(new String[] { "tag" });
managedQuery.setQuery(new ConceptQuery(new CQReusedQuery(managedQueryReused.getId())));
new QueryCleanupTask(STORAGE, queryExpiration).execute(Map.of(), null);
assertThat(STORAGE.getAllExecutions()).containsExactlyInAnyOrder(managedQueryReused);
}
use of com.bakdata.conquery.apiv1.query.concept.specific.CQReusedQuery in project conquery by bakdata.
the class QueryCleanupTaskTest method reusedOtherName.
@Test
void reusedOtherName() throws Exception {
assertThat(STORAGE.getAllExecutions()).isEmpty();
final ManagedQuery managedQuery = createManagedQuery();
managedQuery.setLabel("test2");
final ManagedQuery managedQueryReused = createManagedQuery();
managedQuery.setQuery(new ConceptQuery(new CQReusedQuery(managedQueryReused.getId())));
new QueryCleanupTask(STORAGE, queryExpiration).execute(Map.of(), null);
assertThat(STORAGE.getAllExecutions()).containsExactlyInAnyOrder(managedQueryReused, managedQuery);
}
use of com.bakdata.conquery.apiv1.query.concept.specific.CQReusedQuery in project conquery by bakdata.
the class QueryCleanupTaskTest method reusedBothNames.
@Test
void reusedBothNames() throws Exception {
assertThat(STORAGE.getAllExecutions()).isEmpty();
final ManagedQuery managedQuery = createManagedQuery();
managedQuery.setLabel("test1");
final ManagedQuery managedQueryReused = createManagedQuery();
managedQueryReused.setLabel("test2");
managedQuery.setQuery(new ConceptQuery(new CQReusedQuery(managedQueryReused.getId())));
new QueryCleanupTask(STORAGE, queryExpiration).execute(Map.of(), null);
assertThat(STORAGE.getAllExecutions()).containsExactlyInAnyOrder(managedQuery, managedQueryReused);
}
Aggregations