Search in sources :

Example 1 with ApplicationDescriptorImpl

use of org.apache.samza.application.descriptors.ApplicationDescriptorImpl in project samza by apache.

the class TestTaskFactoryUtil method testGetTaskFactoryWithInvalidAddDescriptorImpl.

// test getTaskFactory with invalid ApplicationDescriptorImpl
@Test(expected = IllegalArgumentException.class)
public void testGetTaskFactoryWithInvalidAddDescriptorImpl() {
    ApplicationDescriptorImpl mockInvalidApp = mock(ApplicationDescriptorImpl.class);
    TaskFactoryUtil.getTaskFactory(mockInvalidApp);
}
Also used : TaskApplicationDescriptorImpl(org.apache.samza.application.descriptors.TaskApplicationDescriptorImpl) StreamApplicationDescriptorImpl(org.apache.samza.application.descriptors.StreamApplicationDescriptorImpl) ApplicationDescriptorImpl(org.apache.samza.application.descriptors.ApplicationDescriptorImpl) Test(org.junit.Test)

Example 2 with ApplicationDescriptorImpl

use of org.apache.samza.application.descriptors.ApplicationDescriptorImpl in project samza by apache.

the class TestJobPlanner method testRunIdisConfiguredForAllTypesOfApps.

@Test
public void testRunIdisConfiguredForAllTypesOfApps() {
    Map<String, String> testConfig = new HashMap<>();
    testConfig.put("app.id", "should-exist-id");
    testConfig.put("app.name", "should-exist-name");
    ApplicationDescriptorImpl applicationDescriptor = Mockito.mock(ApplicationDescriptorImpl.class);
    Mockito.when(applicationDescriptor.getConfig()).thenReturn(new MapConfig(testConfig));
    Mockito.when(applicationDescriptor.getAppClass()).thenReturn(LegacyTaskApplication.class);
    JobPlanner jobPlanner = new JobPlanner(applicationDescriptor) {

        @Override
        public List<JobConfig> prepareJobs() {
            return null;
        }
    };
    ExecutionPlan plan = jobPlanner.getExecutionPlan("custom-run-id");
    Assert.assertNotNull(plan.getApplicationConfig().getRunId(), "custom-run-id");
}
Also used : HashMap(java.util.HashMap) ApplicationDescriptorImpl(org.apache.samza.application.descriptors.ApplicationDescriptorImpl) MapConfig(org.apache.samza.config.MapConfig) JobConfig(org.apache.samza.config.JobConfig) Test(org.junit.Test)

Aggregations

ApplicationDescriptorImpl (org.apache.samza.application.descriptors.ApplicationDescriptorImpl)2 Test (org.junit.Test)2 HashMap (java.util.HashMap)1 StreamApplicationDescriptorImpl (org.apache.samza.application.descriptors.StreamApplicationDescriptorImpl)1 TaskApplicationDescriptorImpl (org.apache.samza.application.descriptors.TaskApplicationDescriptorImpl)1 JobConfig (org.apache.samza.config.JobConfig)1 MapConfig (org.apache.samza.config.MapConfig)1