Search in sources :

Example 6 with BinPackedPersistentQueryMetadataImpl

use of io.confluent.ksql.util.BinPackedPersistentQueryMetadataImpl in project ksql by confluentinc.

the class QueryRegistryImplTest method shouldReplaceQueryfromOldRuntimeUsingOldRuntime.

@Test
public void shouldReplaceQueryfromOldRuntimeUsingOldRuntime() {
    // Given:
    sharedRuntimes = false;
    QueryMetadata query = givenCreate(registry, "q1", "source", Optional.of("sink1"), CREATE_AS);
    assertThat("does not use old runtime", query instanceof PersistentQueryMetadataImpl);
    // When:
    sharedRuntimes = true;
    query = givenCreate(registry, "q1", "source", Optional.of("sink1"), CREATE_AS);
    // Expect:
    assertThat("does not use old runtime", query instanceof PersistentQueryMetadataImpl);
    when(ksqlConfig.getBoolean(KsqlConfig.KSQL_SHARED_RUNTIME_ENABLED)).thenReturn(sharedRuntimes);
    query = givenCreate(registry, "q2", "source", Optional.of("sink1"), CREATE_AS);
    assertThat("does not use old runtime", query instanceof BinPackedPersistentQueryMetadataImpl);
}
Also used : TransientQueryMetadata(io.confluent.ksql.util.TransientQueryMetadata) PersistentQueryMetadata(io.confluent.ksql.util.PersistentQueryMetadata) QueryMetadata(io.confluent.ksql.util.QueryMetadata) BinPackedPersistentQueryMetadataImpl(io.confluent.ksql.util.BinPackedPersistentQueryMetadataImpl) PersistentQueryMetadataImpl(io.confluent.ksql.util.PersistentQueryMetadataImpl) BinPackedPersistentQueryMetadataImpl(io.confluent.ksql.util.BinPackedPersistentQueryMetadataImpl) Test(org.junit.Test)

Example 7 with BinPackedPersistentQueryMetadataImpl

use of io.confluent.ksql.util.BinPackedPersistentQueryMetadataImpl in project ksql by confluentinc.

the class RuntimeAssignorTest method getListOfQueries.

private Collection<PersistentQueryMetadata> getListOfQueries() {
    final Collection<PersistentQueryMetadata> queries = new ArrayList<>();
    queries.add(queryMetadata);
    for (int i = 0; i < KSQL_CONFIG.getInt(KsqlConfig.KSQL_SHARED_RUNTIMES_COUNT) + 1; i++) {
        final BinPackedPersistentQueryMetadataImpl query = mock(BinPackedPersistentQueryMetadataImpl.class);
        when(query.getQueryApplicationId()).thenReturn(runtimeAssignor.getRuntimeAndMaybeAddRuntime(new QueryId(i + "_"), sources1, KSQL_CONFIG));
        when(query.getQueryId()).thenReturn(query1);
        when(query.getSourceNames()).thenReturn(ImmutableSet.copyOf(new HashSet<>(sources1)));
        queries.add(query);
    }
    return queries;
}
Also used : QueryId(io.confluent.ksql.query.QueryId) ArrayList(java.util.ArrayList) PersistentQueryMetadata(io.confluent.ksql.util.PersistentQueryMetadata) BinPackedPersistentQueryMetadataImpl(io.confluent.ksql.util.BinPackedPersistentQueryMetadataImpl) HashSet(java.util.HashSet)

Aggregations

BinPackedPersistentQueryMetadataImpl (io.confluent.ksql.util.BinPackedPersistentQueryMetadataImpl)7 PersistentQueryMetadata (io.confluent.ksql.util.PersistentQueryMetadata)5 QueryId (io.confluent.ksql.query.QueryId)2 KsqlConfig (io.confluent.ksql.util.KsqlConfig)2 SandboxedBinPackedPersistentQueryMetadataImpl (io.confluent.ksql.util.SandboxedBinPackedPersistentQueryMetadataImpl)2 ArrayList (java.util.ArrayList)2 HashSet (java.util.HashSet)2 Test (org.junit.Test)2 SuppressFBWarnings (edu.umd.cs.findbugs.annotations.SuppressFBWarnings)1 QueryCleanupService (io.confluent.ksql.engine.QueryCleanupService)1 DdlCommand (io.confluent.ksql.execution.ddl.commands.DdlCommand)1 DropSourceCommand (io.confluent.ksql.execution.ddl.commands.DropSourceCommand)1 KsqlTopic (io.confluent.ksql.execution.ddl.commands.KsqlTopic)1 RuntimeBuildContext (io.confluent.ksql.execution.runtime.RuntimeBuildContext)1 DataSource (io.confluent.ksql.metastore.model.DataSource)1 ScalablePushRegistry (io.confluent.ksql.physical.scalablepush.ScalablePushRegistry)1 ConfiguredKsqlPlan (io.confluent.ksql.planner.plan.ConfiguredKsqlPlan)1 LogicalSchema (io.confluent.ksql.schema.ksql.LogicalSchema)1 PhysicalSchema (io.confluent.ksql.schema.ksql.PhysicalSchema)1 KeyFormat (io.confluent.ksql.serde.KeyFormat)1