Search in sources :

Example 26 with ManagedQuery

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);
}
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 27 with ManagedQuery

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);
}
Also used : ManagedQuery(com.bakdata.conquery.models.query.ManagedQuery) Test(org.junit.jupiter.api.Test)

Example 28 with 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);
}
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 29 with 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);
}
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 30 with ManagedQuery

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

Aggregations

ManagedQuery (com.bakdata.conquery.models.query.ManagedQuery)37 ConceptQuery (com.bakdata.conquery.apiv1.query.ConceptQuery)18 Test (org.junit.jupiter.api.Test)18 CQReusedQuery (com.bakdata.conquery.apiv1.query.concept.specific.CQReusedQuery)13 User (com.bakdata.conquery.models.auth.entities.User)12 CQConcept (com.bakdata.conquery.apiv1.query.concept.specific.CQConcept)8 Dataset (com.bakdata.conquery.models.datasets.Dataset)8 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 MetaStorage (com.bakdata.conquery.io.storage.MetaStorage)5 List (java.util.List)5 Slf4j (lombok.extern.slf4j.Slf4j)5 CQExternal (com.bakdata.conquery.apiv1.query.concept.specific.external.CQExternal)4 ManagedExecutionId (com.bakdata.conquery.models.identifiable.ids.specific.ManagedExecutionId)4 PrintSettings (com.bakdata.conquery.models.query.PrintSettings)4 QueryDescription (com.bakdata.conquery.apiv1.query.QueryDescription)3 ConqueryConfig (com.bakdata.conquery.models.config.ConqueryConfig)3 I18n (com.bakdata.conquery.models.i18n.I18n)3 ResultInfo (com.bakdata.conquery.models.query.resultinfo.ResultInfo)3