Search in sources :

Example 1 with ExampleSimpleSystemDescriptor

use of org.apache.samza.system.descriptors.examples.serde.ExampleSimpleSystemDescriptor in project samza by apache.

the class TestSimpleInputDescriptor method testISDObjectsWithOverrides.

@Test
public void testISDObjectsWithOverrides() {
    ExampleSimpleSystemDescriptor ssd = new ExampleSimpleSystemDescriptor("kafka-system");
    IntegerSerde streamSerde = new IntegerSerde();
    ExampleSimpleInputDescriptor<Integer> isd = ssd.getInputDescriptor("input-stream", streamSerde);
    assertEquals(streamSerde, isd.getSerde());
    assertFalse(isd.getTransformer().isPresent());
}
Also used : ExampleSimpleSystemDescriptor(org.apache.samza.system.descriptors.examples.serde.ExampleSimpleSystemDescriptor) IntegerSerde(org.apache.samza.serializers.IntegerSerde) Test(org.junit.Test)

Example 2 with ExampleSimpleSystemDescriptor

use of org.apache.samza.system.descriptors.examples.serde.ExampleSimpleSystemDescriptor in project samza by apache.

the class TestSimpleInputDescriptor method testAPIUsage.

@Test
public void testAPIUsage() {
    // does not assert anything, but acts as a compile-time check on expected descriptor type parameters
    // and validates that the method calls can be chained.
    ExampleSimpleSystemDescriptor kafkaSystem = new ExampleSimpleSystemDescriptor("kafka-system").withSystemConfigs(Collections.emptyMap());
    ExampleSimpleInputDescriptor<Integer> input1 = kafkaSystem.getInputDescriptor("input1", new IntegerSerde());
    ExampleSimpleOutputDescriptor<Integer> output1 = kafkaSystem.getOutputDescriptor("output1", new IntegerSerde());
    input1.shouldBootstrap().withOffsetDefault(SystemStreamMetadata.OffsetType.NEWEST).withPriority(1).shouldResetOffset().withStreamConfigs(Collections.emptyMap());
    output1.withStreamConfigs(Collections.emptyMap());
}
Also used : ExampleSimpleSystemDescriptor(org.apache.samza.system.descriptors.examples.serde.ExampleSimpleSystemDescriptor) IntegerSerde(org.apache.samza.serializers.IntegerSerde) Test(org.junit.Test)

Aggregations

IntegerSerde (org.apache.samza.serializers.IntegerSerde)2 ExampleSimpleSystemDescriptor (org.apache.samza.system.descriptors.examples.serde.ExampleSimpleSystemDescriptor)2 Test (org.junit.Test)2