use of com.bakdata.conquery.models.query.ManagedQuery 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.models.query.ManagedQuery in project conquery by bakdata.
the class QueryCleanupTaskTest method singleNamed.
@Test
void singleNamed() throws Exception {
assertThat(STORAGE.getAllExecutions()).isEmpty();
final ManagedQuery managedQuery = createManagedQuery();
managedQuery.setLabel("test");
new QueryCleanupTask(STORAGE, queryExpiration).execute(Map.of(), null);
assertThat(STORAGE.getAllExecutions()).containsExactlyInAnyOrder(managedQuery);
}
use of com.bakdata.conquery.models.query.ManagedQuery 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.models.query.ManagedQuery 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);
}
use of com.bakdata.conquery.models.query.ManagedQuery in project conquery by bakdata.
the class QueryCleanupTaskTest method reusedYoung.
@Test
void reusedYoung() throws Exception {
assertThat(STORAGE.getAllExecutions()).isEmpty();
final ManagedQuery managedQuery = createManagedQuery();
final ManagedQuery managedQueryReused = createManagedQuery();
managedQueryReused.setCreationTime(LocalDateTime.now());
managedQuery.setQuery(new ConceptQuery(new CQReusedQuery(managedQueryReused.getId())));
new QueryCleanupTask(STORAGE, queryExpiration).execute(Map.of(), null);
assertThat(STORAGE.getAllExecutions()).containsExactlyInAnyOrder(managedQueryReused);
}
Aggregations