Search in sources :

Example 1 with EventSerializer

use of org.apache.druid.testing.utils.EventSerializer in project druid by druid-io.

the class ITAutoCompactionLockContentionTest method setup.

@BeforeMethod
public void setup() throws Exception {
    generatedTestConfig = new GeneratedTestConfig(Specs.PARSER_TYPE, getResourceAsString(Specs.INPUT_FORMAT_PATH));
    fullDatasourceName = generatedTestConfig.getFullDatasourceName();
    final EventSerializer serializer = jsonMapper.readValue(getResourceAsStream(Specs.SERIALIZER_PATH), EventSerializer.class);
    streamGenerator = new WikipediaStreamEventStreamGenerator(serializer, 6, 100);
}
Also used : WikipediaStreamEventStreamGenerator(org.apache.druid.testing.utils.WikipediaStreamEventStreamGenerator) EventSerializer(org.apache.druid.testing.utils.EventSerializer) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 2 with EventSerializer

use of org.apache.druid.testing.utils.EventSerializer in project druid by druid-io.

the class AbstractStreamIndexingTest method doTestIndexDataStableState.

protected void doTestIndexDataStableState(@Nullable Boolean transactionEnabled, String serializerPath, String parserType, String specPath) throws Exception {
    final EventSerializer serializer = jsonMapper.readValue(getResourceAsStream(serializerPath), EventSerializer.class);
    final StreamGenerator streamGenerator = new WikipediaStreamEventStreamGenerator(serializer, EVENTS_PER_SECOND, CYCLE_PADDING_MS);
    final GeneratedTestConfig generatedTestConfig = new GeneratedTestConfig(parserType, getResourceAsString(specPath));
    try (final Closeable closer = createResourceCloser(generatedTestConfig);
        final StreamEventWriter streamEventWriter = createStreamEventWriter(config, transactionEnabled)) {
        final String taskSpec = generatedTestConfig.getStreamIngestionPropsTransform().apply(getResourceAsString(SUPERVISOR_SPEC_TEMPLATE_PATH));
        LOG.info("supervisorSpec: [%s]\n", taskSpec);
        // Start supervisor
        generatedTestConfig.setSupervisorId(indexer.submitSupervisor(taskSpec));
        LOG.info("Submitted supervisor");
        // Start data generator
        final long numWritten = streamGenerator.run(generatedTestConfig.getStreamName(), streamEventWriter, TOTAL_NUMBER_OF_SECOND, FIRST_EVENT_TIME);
        verifyIngestedData(generatedTestConfig, numWritten);
    }
}
Also used : WikipediaStreamEventStreamGenerator(org.apache.druid.testing.utils.WikipediaStreamEventStreamGenerator) Closeable(java.io.Closeable) StreamEventWriter(org.apache.druid.testing.utils.StreamEventWriter) StreamGenerator(org.apache.druid.testing.utils.StreamGenerator) WikipediaStreamEventStreamGenerator(org.apache.druid.testing.utils.WikipediaStreamEventStreamGenerator) EventSerializer(org.apache.druid.testing.utils.EventSerializer) JsonEventSerializer(org.apache.druid.testing.utils.JsonEventSerializer)

Aggregations

EventSerializer (org.apache.druid.testing.utils.EventSerializer)2 WikipediaStreamEventStreamGenerator (org.apache.druid.testing.utils.WikipediaStreamEventStreamGenerator)2 Closeable (java.io.Closeable)1 JsonEventSerializer (org.apache.druid.testing.utils.JsonEventSerializer)1 StreamEventWriter (org.apache.druid.testing.utils.StreamEventWriter)1 StreamGenerator (org.apache.druid.testing.utils.StreamGenerator)1 BeforeMethod (org.testng.annotations.BeforeMethod)1