use of org.apache.kafka.streams.ThreadMetadata in project kafka by apache.
the class StreamThreadTest method shouldAlwaysUpdateTasksMetadataAfterChangingState.
@Test
public void shouldAlwaysUpdateTasksMetadataAfterChangingState() {
final StreamThread thread = createStreamThread(CLIENT_ID, config, false);
ThreadMetadata metadata = thread.threadMetadata();
assertEquals(StreamThread.State.CREATED.name(), metadata.threadState());
thread.setState(StreamThread.State.STARTING);
thread.setState(StreamThread.State.PARTITIONS_REVOKED);
thread.setState(StreamThread.State.PARTITIONS_ASSIGNED);
thread.setState(StreamThread.State.RUNNING);
metadata = thread.threadMetadata();
assertEquals(StreamThread.State.RUNNING.name(), metadata.threadState());
}
use of org.apache.kafka.streams.ThreadMetadata in project kafka by apache.
the class ThreadMetadataImplTest method shouldNotBeEqualIfDifferInActiveTasks.
@Test
public void shouldNotBeEqualIfDifferInActiveTasks() {
final ThreadMetadata differActiveTasks = new ThreadMetadataImpl(THREAD_NAME, THREAD_STATE, MAIN_CONSUMER_CLIENT_ID, RESTORE_CONSUMER_CLIENT_ID, PRODUCER_CLIENT_IDS, ADMIN_CLIENT_ID, mkSet(TM_0), STANDBY_TASKS);
assertThat(threadMetadata, not(equalTo(differActiveTasks)));
assertThat(threadMetadata.hashCode(), not(equalTo(differActiveTasks.hashCode())));
}
use of org.apache.kafka.streams.ThreadMetadata in project kafka by apache.
the class ThreadMetadataImplTest method shouldNotBeEqualIfDifferInClientId.
@Test
public void shouldNotBeEqualIfDifferInClientId() {
final ThreadMetadata differMainConsumerClientId = new ThreadMetadataImpl(THREAD_NAME, THREAD_STATE, "different", RESTORE_CONSUMER_CLIENT_ID, PRODUCER_CLIENT_IDS, ADMIN_CLIENT_ID, ACTIVE_TASKS, STANDBY_TASKS);
assertThat(threadMetadata, not(equalTo(differMainConsumerClientId)));
assertThat(threadMetadata.hashCode(), not(equalTo(differMainConsumerClientId.hashCode())));
}
use of org.apache.kafka.streams.ThreadMetadata in project kafka by apache.
the class ThreadMetadataImplTest method shouldNotBeEqualIfDifferInAdminClientId.
@Test
public void shouldNotBeEqualIfDifferInAdminClientId() {
final ThreadMetadata differAdminClientId = new ThreadMetadataImpl(THREAD_NAME, THREAD_STATE, MAIN_CONSUMER_CLIENT_ID, RESTORE_CONSUMER_CLIENT_ID, PRODUCER_CLIENT_IDS, "different", ACTIVE_TASKS, STANDBY_TASKS);
assertThat(threadMetadata, not(equalTo(differAdminClientId)));
assertThat(threadMetadata.hashCode(), not(equalTo(differAdminClientId.hashCode())));
}
use of org.apache.kafka.streams.ThreadMetadata in project kafka by apache.
the class ThreadMetadataImplTest method shouldNotBeEqualIfDifferInThreadState.
@Test
public void shouldNotBeEqualIfDifferInThreadState() {
final ThreadMetadata differThreadState = new ThreadMetadataImpl(THREAD_NAME, "different", MAIN_CONSUMER_CLIENT_ID, RESTORE_CONSUMER_CLIENT_ID, PRODUCER_CLIENT_IDS, ADMIN_CLIENT_ID, ACTIVE_TASKS, STANDBY_TASKS);
assertThat(threadMetadata, not(equalTo(differThreadState)));
assertThat(threadMetadata.hashCode(), not(equalTo(differThreadState.hashCode())));
}
Aggregations