Search in sources :

Example 1 with ApplicationContainerContextFactory

use of org.apache.samza.context.ApplicationContainerContextFactory in project samza by apache.

the class TestStreamApplicationDescriptorImpl method testApplicationContainerContextFactory.

@Test
public void testApplicationContainerContextFactory() {
    ApplicationContainerContextFactory factory = mock(ApplicationContainerContextFactory.class);
    StreamApplication testApp = appDesc -> appDesc.withApplicationContainerContextFactory(factory);
    StreamApplicationDescriptorImpl appSpec = new StreamApplicationDescriptorImpl(testApp, getConfig());
    assertEquals(appSpec.getApplicationContainerContextFactory(), Optional.of(factory));
}
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) ApplicationContainerContextFactory(org.apache.samza.context.ApplicationContainerContextFactory) StreamApplication(org.apache.samza.application.StreamApplication) Test(org.junit.Test)

Example 2 with ApplicationContainerContextFactory

use of org.apache.samza.context.ApplicationContainerContextFactory in project samza by apache.

the class TestTaskApplicationDescriptorImpl method testApplicationContainerContextFactory.

@Test
public void testApplicationContainerContextFactory() {
    ApplicationContainerContextFactory factory = mock(ApplicationContainerContextFactory.class);
    TaskApplication testApp = appDesc -> appDesc.withApplicationContainerContextFactory(factory);
    TaskApplicationDescriptorImpl appSpec = new TaskApplicationDescriptorImpl(testApp, mock(Config.class));
    assertEquals(appSpec.getApplicationContainerContextFactory(), Optional.of(factory));
}
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) ApplicationContainerContextFactory(org.apache.samza.context.ApplicationContainerContextFactory) Config(org.apache.samza.config.Config) TaskApplication(org.apache.samza.application.TaskApplication) 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 Test (org.junit.Test)2 Mockito.mock (org.mockito.Mockito.mock)2 Mockito.verify (org.mockito.Mockito.verify)2 Mockito.when (org.mockito.Mockito.when)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