use of org.apache.kafka.common.serialization.IntegerSerializer in project AD482-apps by RedHatTraining.
the class StreamTopologyBuilderTest method setup.
@BeforeEach
public void setup() {
// TODO: create the test driver
StreamTopologyBuilder builder = new StreamTopologyBuilder();
testDriver = new TopologyTestDriver(builder.buildTopology());
// TODO: Create test topics
wattsStream = testDriver.createInputTopic("turbine-generated-watts", new IntegerSerializer(), new IntegerSerializer());
ObjectMapperSerde<MWattsMeasurement> measurementSerde = new ObjectMapperSerde<>(MWattsMeasurement.class);
measurementsStream = testDriver.createOutputTopic("turbine-generated-mwatts", new IntegerDeserializer(), measurementSerde.deserializer());
}
use of org.apache.kafka.common.serialization.IntegerSerializer in project AD482-apps by RedHatTraining.
the class MovementTrackerTopologyTest method setup.
@BeforeEach
public void setup() {
// TODO: pass the VehicleMovementTracker topology to the test driver
tracker = new VehicleMovementTracker();
testDriver = new TopologyTestDriver(tracker.buildTopology());
// TODO: Create test input topics
vehicleRegisteredSerde = new ObjectMapperSerde<>(VehicleRegistered.class);
vehicleMovedSerde = new ObjectMapperSerde<>(VehicleMoved.class);
vehicleRegisteredTopic = testDriver.createInputTopic("vehicle-registered", new IntegerSerializer(), vehicleRegisteredSerde.serializer());
vehicleMovedTopic = testDriver.createInputTopic("vehicle-moved", new IntegerSerializer(), vehicleMovedSerde.serializer());
// TODO: Create test stores
vehiclesStore = testDriver.getKeyValueStore("vehicles-store");
vehicleMetricsStore = testDriver.getKeyValueStore("vehicle-metrics-store");
// TODO: Create test output topic
vehicleStatusSerde = new ObjectMapperSerde<>(VehicleStatus.class);
vehicleStatusTopic = testDriver.createOutputTopic("vehicle-status", new IntegerDeserializer(), vehicleStatusSerde.deserializer());
}
use of org.apache.kafka.common.serialization.IntegerSerializer in project quarkus-quickstarts by quarkusio.
the class AggregatorTest method setUp.
@BeforeEach
public void setUp() {
temperatureProducer = new KafkaProducer(producerProps(), new IntegerSerializer(), new StringSerializer());
weatherStationsProducer = new KafkaProducer(producerProps(), new IntegerSerializer(), new ObjectMapperSerializer());
weatherStationsConsumer = new KafkaConsumer(consumerProps(), new IntegerDeserializer(), new ObjectMapperDeserializer<>(Aggregation.class));
}
use of org.apache.kafka.common.serialization.IntegerSerializer in project apache-kafka-on-k8s by banzaicloud.
the class GlobalStateTaskTest method shouldProcessRecordsForOtherTopic.
@Test
public void shouldProcessRecordsForOtherTopic() {
final byte[] integerBytes = new IntegerSerializer().serialize("foo", 1);
globalStateTask.initialize();
globalStateTask.update(new ConsumerRecord<>(topic2, 1, 1, integerBytes, integerBytes));
assertEquals(1, sourceTwo.numReceived);
assertEquals(0, sourceOne.numReceived);
}
use of org.apache.kafka.common.serialization.IntegerSerializer in project apache-kafka-on-k8s by banzaicloud.
the class GlobalStateTaskTest method shouldThrowStreamsExceptionWhenKeyDeserializationFails.
@Test
public void shouldThrowStreamsExceptionWhenKeyDeserializationFails() throws Exception {
final byte[] key = new LongSerializer().serialize(topic2, 1L);
final byte[] recordValue = new IntegerSerializer().serialize(topic2, 10);
maybeDeserialize(globalStateTask, key, recordValue, true);
}
Aggregations