Search in sources :

Example 1 with ProcessorLifecycleListenerFactory

use of org.apache.samza.runtime.ProcessorLifecycleListenerFactory in project samza by apache.

the class TestTaskApplicationDescriptorImpl method testProcessorLifecycleListener.

@Test
public void testProcessorLifecycleListener() {
    ProcessorLifecycleListenerFactory mockFactory = mock(ProcessorLifecycleListenerFactory.class);
    TaskApplication testApp = appDesc -> {
        appDesc.withProcessorLifecycleListenerFactory(mockFactory);
    };
    TaskApplicationDescriptorImpl appDesc = new TaskApplicationDescriptorImpl(testApp, config);
    assertEquals(appDesc.getProcessorLifecycleListenerFactory(), mockFactory);
}
Also used : InputDescriptor(org.apache.samza.system.descriptors.InputDescriptor) ApplicationContainerContextFactory(org.apache.samza.context.ApplicationContainerContextFactory) SystemDescriptor(org.apache.samza.system.descriptors.SystemDescriptor) TaskApplication(org.apache.samza.application.TaskApplication) TableDescriptor(org.apache.samza.table.descriptors.TableDescriptor) Set(java.util.Set) Test(org.junit.Test) TaskFactory(org.apache.samza.task.TaskFactory) Mockito.when(org.mockito.Mockito.when) ApplicationTaskContextFactory(org.apache.samza.context.ApplicationTaskContextFactory) ArrayList(java.util.ArrayList) Mockito.verify(org.mockito.Mockito.verify) HashSet(java.util.HashSet) List(java.util.List) BaseTableDescriptor(org.apache.samza.table.descriptors.BaseTableDescriptor) Optional(java.util.Optional) ProcessorLifecycleListenerFactory(org.apache.samza.runtime.ProcessorLifecycleListenerFactory) Config(org.apache.samza.config.Config) OutputDescriptor(org.apache.samza.system.descriptors.OutputDescriptor) Assert.assertEquals(org.junit.Assert.assertEquals) Before(org.junit.Before) Mockito.mock(org.mockito.Mockito.mock) ProcessorLifecycleListenerFactory(org.apache.samza.runtime.ProcessorLifecycleListenerFactory) TaskApplication(org.apache.samza.application.TaskApplication) Test(org.junit.Test)

Example 2 with ProcessorLifecycleListenerFactory

use of org.apache.samza.runtime.ProcessorLifecycleListenerFactory in project samza by apache.

the class TestStreamApplicationDescriptorImpl method testProcessorLifecycleListenerFactory.

@Test
public void testProcessorLifecycleListenerFactory() {
    ProcessorLifecycleListenerFactory mockFactory = mock(ProcessorLifecycleListenerFactory.class);
    StreamApplication testApp = appSpec -> appSpec.withProcessorLifecycleListenerFactory(mockFactory);
    StreamApplicationDescriptorImpl appDesc = new StreamApplicationDescriptorImpl(testApp, getConfig());
    assertEquals(appDesc.getProcessorLifecycleListenerFactory(), mockFactory);
}
Also used : SystemDescriptor(org.apache.samza.system.descriptors.SystemDescriptor) GenericSystemDescriptor(org.apache.samza.system.descriptors.GenericSystemDescriptor) IntermediateMessageStreamImpl(org.apache.samza.operators.stream.IntermediateMessageStreamImpl) HashMap(java.util.HashMap) Serde(org.apache.samza.serializers.Serde) GenericInputDescriptor(org.apache.samza.system.descriptors.GenericInputDescriptor) AtomicReference(java.util.concurrent.atomic.AtomicReference) TableImpl(org.apache.samza.operators.TableImpl) ArrayList(java.util.ArrayList) OutputStreamImpl(org.apache.samza.operators.spec.OutputStreamImpl) OperatorSpec(org.apache.samza.operators.spec.OperatorSpec) BaseTableDescriptor(org.apache.samza.table.descriptors.BaseTableDescriptor) ImmutableList(com.google.common.collect.ImmutableList) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) ApplicationConfig(org.apache.samza.config.ApplicationConfig) InputTransformer(org.apache.samza.system.descriptors.InputTransformer) ProcessorLifecycleListenerFactory(org.apache.samza.runtime.ProcessorLifecycleListenerFactory) Assert.fail(org.junit.Assert.fail) MapConfig(org.apache.samza.config.MapConfig) IntegerSerde(org.apache.samza.serializers.IntegerSerde) NoOpSerde(org.apache.samza.serializers.NoOpSerde) Mockito.doReturn(org.mockito.Mockito.doReturn) TestMessageEnvelope(org.apache.samza.operators.data.TestMessageEnvelope) OpCode(org.apache.samza.operators.spec.OperatorSpec.OpCode) InputDescriptor(org.apache.samza.system.descriptors.InputDescriptor) ApplicationContainerContextFactory(org.apache.samza.context.ApplicationContainerContextFactory) GenericOutputDescriptor(org.apache.samza.system.descriptors.GenericOutputDescriptor) Assert.assertTrue(org.junit.Assert.assertTrue) Test(org.junit.Test) Mockito.when(org.mockito.Mockito.when) TransformingInputDescriptorProvider(org.apache.samza.system.descriptors.TransformingInputDescriptorProvider) SamzaException(org.apache.samza.SamzaException) ApplicationTaskContextFactory(org.apache.samza.context.ApplicationTaskContextFactory) ExpandingInputDescriptorProvider(org.apache.samza.system.descriptors.ExpandingInputDescriptorProvider) StreamExpander(org.apache.samza.system.descriptors.StreamExpander) Mockito.verify(org.mockito.Mockito.verify) List(java.util.List) Assert.assertFalse(org.junit.Assert.assertFalse) Optional(java.util.Optional) Config(org.apache.samza.config.Config) KVSerde(org.apache.samza.serializers.KVSerde) StreamApplication(org.apache.samza.application.StreamApplication) Assert.assertEquals(org.junit.Assert.assertEquals) InputOperatorSpec(org.apache.samza.operators.spec.InputOperatorSpec) Mockito.mock(org.mockito.Mockito.mock) StreamApplication(org.apache.samza.application.StreamApplication) ProcessorLifecycleListenerFactory(org.apache.samza.runtime.ProcessorLifecycleListenerFactory) Test(org.junit.Test)

Aggregations

ArrayList (java.util.ArrayList)2 List (java.util.List)2 Optional (java.util.Optional)2 Config (org.apache.samza.config.Config)2 ApplicationContainerContextFactory (org.apache.samza.context.ApplicationContainerContextFactory)2 ApplicationTaskContextFactory (org.apache.samza.context.ApplicationTaskContextFactory)2 ProcessorLifecycleListenerFactory (org.apache.samza.runtime.ProcessorLifecycleListenerFactory)2 InputDescriptor (org.apache.samza.system.descriptors.InputDescriptor)2 SystemDescriptor (org.apache.samza.system.descriptors.SystemDescriptor)2 BaseTableDescriptor (org.apache.samza.table.descriptors.BaseTableDescriptor)2 Assert.assertEquals (org.junit.Assert.assertEquals)2 ImmutableList (com.google.common.collect.ImmutableList)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 Set (java.util.Set)1 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1 AtomicReference (java.util.concurrent.atomic.AtomicReference)1 SamzaException (org.apache.samza.SamzaException)1 StreamApplication (org.apache.samza.application.StreamApplication)1 TaskApplication (org.apache.samza.application.TaskApplication)1