use of org.apache.samza.serializers.StringSerde in project samza by apache.
the class TestTimeSeriesStoreImpl method testGetWithNonExistentKeys.
@Test
public void testGetWithNonExistentKeys() {
TimeSeriesStore<String, byte[]> timeSeriesStore = newTimeSeriesStore(new StringSerde("UTF-8"), true);
timeSeriesStore.put("hello", "world-1".getBytes(), 1L);
// read from a non-existent key
List<TimestampedValue<byte[]>> values = readStore(timeSeriesStore, "non-existent-key", 0, Integer.MAX_VALUE);
Assert.assertEquals(0, values.size());
// read from an existing key but out of range timestamp
values = readStore(timeSeriesStore, "hello", 2, Integer.MAX_VALUE);
Assert.assertEquals(0, values.size());
}
use of org.apache.samza.serializers.StringSerde in project samza by apache.
the class TestEventHubsOutputDescriptor method testStreamDescriptorContainsKVserde.
@Test
public void testStreamDescriptorContainsKVserde() {
String systemName = "eventHub";
String streamId = "output-stream";
EventHubsSystemDescriptor systemDescriptor = new EventHubsSystemDescriptor(systemName);
EventHubsOutputDescriptor<KV<String, String>> outputDescriptor = systemDescriptor.getOutputDescriptor(streamId, "entity-namespace", "entity3", new StringSerde());
assertTrue(outputDescriptor.getSerde() instanceof KVSerde);
assertTrue(((KVSerde) outputDescriptor.getSerde()).getKeySerde() instanceof NoOpSerde);
assertTrue(((KVSerde) outputDescriptor.getSerde()).getValueSerde() instanceof StringSerde);
}
use of org.apache.samza.serializers.StringSerde in project samza by apache.
the class TestEventHubsInputDescriptor method testStreamDescriptorContainsKVserde.
@Test
public void testStreamDescriptorContainsKVserde() {
String systemName = "eventHub";
String streamId = "input-stream";
EventHubsSystemDescriptor systemDescriptor = new EventHubsSystemDescriptor(systemName);
EventHubsInputDescriptor<KV<String, String>> outputDescriptor = systemDescriptor.getInputDescriptor(streamId, "entity-namespace", "entity3", new StringSerde());
assertTrue(outputDescriptor.getSerde() instanceof KVSerde);
assertTrue(((KVSerde) outputDescriptor.getSerde()).getKeySerde() instanceof NoOpSerde);
assertTrue(((KVSerde) outputDescriptor.getSerde()).getValueSerde() instanceof StringSerde);
}
use of org.apache.samza.serializers.StringSerde in project samza by apache.
the class TestEventHubsSystemDescriptor method testWithInputOutputStreams.
@Test
public void testWithInputOutputStreams() {
String systemName = "system-name";
String streamId1 = "input-stream1";
String streamId2 = "input-stream2";
String streamId3 = "output-stream1";
String streamId4 = "output-stream2";
EventHubsSystemDescriptor systemDescriptor = new EventHubsSystemDescriptor(systemName);
systemDescriptor.getInputDescriptor(streamId1, "entity-namespace1", "entity1", new StringSerde());
systemDescriptor.getInputDescriptor(streamId2, "entity-namespace2", "entity2", new StringSerde());
systemDescriptor.getOutputDescriptor(streamId3, "entity-namespace3", "entity3", new StringSerde());
systemDescriptor.getOutputDescriptor(streamId4, "entity-namespace4", "entity4", new StringSerde());
Map<String, String> generatedConfigs = systemDescriptor.toConfig();
assertEquals("org.apache.samza.system.eventhub.EventHubSystemFactory", generatedConfigs.get(String.format("systems.%s.samza.factory", systemName)));
assertEquals(streamId1 + "," + streamId2 + "," + streamId3 + "," + streamId4, generatedConfigs.get(String.format(EventHubConfig.CONFIG_STREAM_LIST, systemName)));
assertEquals(2, generatedConfigs.size());
}
use of org.apache.samza.serializers.StringSerde in project samza by apache.
the class TestEventHubsOutputDescriptor method testWithoutEntityConnectionConfigs.
@Test
public void testWithoutEntityConnectionConfigs() {
String systemName = "eventHub";
String streamId = "output-stream";
EventHubsSystemDescriptor systemDescriptor = new EventHubsSystemDescriptor(systemName);
EventHubsOutputDescriptor<KV<String, String>> outputDescriptor = systemDescriptor.getOutputDescriptor(streamId, "entity-namespace", "entity3", new StringSerde());
Map<String, String> generatedConfigs = outputDescriptor.toConfig();
assertEquals("eventHub", generatedConfigs.get("streams.output-stream.samza.system"));
assertEquals("entity-namespace", generatedConfigs.get(String.format(EventHubConfig.CONFIG_STREAM_NAMESPACE, streamId)));
assertEquals("entity3", generatedConfigs.get(String.format(EventHubConfig.CONFIG_STREAM_ENTITYPATH, streamId)));
assertNull(generatedConfigs.get(String.format(EventHubConfig.CONFIG_STREAM_SAS_KEY_NAME, streamId)));
assertNull(generatedConfigs.get(String.format(EventHubConfig.CONFIG_STREAM_SAS_TOKEN, streamId)));
assertNull(generatedConfigs.get(String.format(EventHubConfig.CONFIG_STREAM_CONSUMER_GROUP, streamId)));
// verify that there are no other configs
assertEquals(3, generatedConfigs.size());
}
Aggregations