use of io.confluent.kafkarest.entities.v2.SchemaPartitionProduceRequest in project kafka-rest by confluentinc.
the class AvroProducerTest method testProduceToPartition.
protected <K, V> void testProduceToPartition(List<SchemaPartitionProduceRecord> records, List<PartitionOffset> offsetResponse, Map<String, String> queryParams) {
SchemaPartitionProduceRequest payload = SchemaPartitionProduceRequest.create(records, /* keySchema= */
null, /* keySchemaId= */
null, /* valueSchema= */
valueSchemaStr, /* valueSchemaId= */
null);
Response response = request("/topics/" + topicName + "/partitions/0", queryParams).post(Entity.entity(payload, Versions.KAFKA_V2_JSON_AVRO));
assertOKResponse(response, Versions.KAFKA_V2_JSON);
final ProduceResponse poffsetResponse = TestUtils.tryReadEntityOrLog(response, ProduceResponse.class);
assertEquals(offsetResponse, poffsetResponse.getOffsets());
TestUtils.assertTopicContains(plaintextBrokerList, topicName, payload.toProduceRequest().getRecords(), 0, KafkaAvroDeserializer.class.getName(), KafkaAvroDeserializer.class.getName(), deserializerProps, false);
assertEquals((Integer) 1, poffsetResponse.getValueSchemaId());
}
Aggregations