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