Search in sources :

Example 1 with PartitionContext

use of com.microsoft.azure.eventprocessorhost.PartitionContext in project nifi by apache.

the class TestConsumeAzureEventHub method setupProcessor.

@Before
public void setupProcessor() {
    processor = new ConsumeAzureEventHub();
    final ProcessorInitializationContext initContext = Mockito.mock(ProcessorInitializationContext.class);
    final String componentId = "componentId";
    when(initContext.getIdentifier()).thenReturn(componentId);
    MockComponentLog componentLog = new MockComponentLog(componentId, processor);
    when(initContext.getLogger()).thenReturn(componentLog);
    processor.initialize(initContext);
    final ProcessSessionFactory processSessionFactory = Mockito.mock(ProcessSessionFactory.class);
    processor.setProcessSessionFactory(processSessionFactory);
    processor.setNamespaceName("namespace");
    sharedState = new SharedSessionState(processor, new AtomicLong(0));
    processSession = new MockProcessSession(sharedState, processor);
    when(processSessionFactory.createSession()).thenReturn(processSession);
    eventProcessor = processor.new EventProcessor();
    partitionContext = Mockito.mock(PartitionContext.class);
    when(partitionContext.getEventHubPath()).thenReturn("eventhub-name");
    when(partitionContext.getPartitionId()).thenReturn("partition-id");
    when(partitionContext.getConsumerGroupName()).thenReturn("consumer-group");
}
Also used : PartitionContext(com.microsoft.azure.eventprocessorhost.PartitionContext) SharedSessionState(org.apache.nifi.util.SharedSessionState) AtomicLong(java.util.concurrent.atomic.AtomicLong) MockComponentLog(org.apache.nifi.util.MockComponentLog) ProcessSessionFactory(org.apache.nifi.processor.ProcessSessionFactory) MockProcessSession(org.apache.nifi.util.MockProcessSession) ProcessorInitializationContext(org.apache.nifi.processor.ProcessorInitializationContext) Before(org.junit.Before)

Aggregations

PartitionContext (com.microsoft.azure.eventprocessorhost.PartitionContext)1 AtomicLong (java.util.concurrent.atomic.AtomicLong)1 ProcessSessionFactory (org.apache.nifi.processor.ProcessSessionFactory)1 ProcessorInitializationContext (org.apache.nifi.processor.ProcessorInitializationContext)1 MockComponentLog (org.apache.nifi.util.MockComponentLog)1 MockProcessSession (org.apache.nifi.util.MockProcessSession)1 SharedSessionState (org.apache.nifi.util.SharedSessionState)1 Before (org.junit.Before)1