Search in sources :

Example 1 with TestElasticJobListener

use of com.dangdang.ddframe.job.lite.api.listener.fixture.TestElasticJobListener in project elastic-job by dangdangdotcom.

the class LiteJobFacadeTest method setUp.

@Before
public void setUp() throws NoSuchFieldException {
    MockitoAnnotations.initMocks(this);
    liteJobFacade = new LiteJobFacade(null, "test_job", Collections.<ElasticJobListener>singletonList(new TestElasticJobListener(caller)), eventBus);
    ReflectionUtils.setFieldValue(liteJobFacade, "configService", configService);
    ReflectionUtils.setFieldValue(liteJobFacade, "serverService", serverService);
    ReflectionUtils.setFieldValue(liteJobFacade, "shardingService", shardingService);
    ReflectionUtils.setFieldValue(liteJobFacade, "executionContextService", executionContextService);
    ReflectionUtils.setFieldValue(liteJobFacade, "executionService", executionService);
    ReflectionUtils.setFieldValue(liteJobFacade, "failoverService", failoverService);
}
Also used : ElasticJobListener(com.dangdang.ddframe.job.lite.api.listener.ElasticJobListener) TestElasticJobListener(com.dangdang.ddframe.job.lite.api.listener.fixture.TestElasticJobListener) TestElasticJobListener(com.dangdang.ddframe.job.lite.api.listener.fixture.TestElasticJobListener) Before(org.junit.Before)

Example 2 with TestElasticJobListener

use of com.dangdang.ddframe.job.lite.api.listener.fixture.TestElasticJobListener in project elastic-job by dangdangdotcom.

the class JobExecutorTest method assertNew.

@Test
public void assertNew() throws NoSuchFieldException {
    TestDistributeOnceElasticJobListener testDistributeOnceElasticJobListener = new TestDistributeOnceElasticJobListener(caller);
    assertNull(ReflectionUtils.getFieldValue(testDistributeOnceElasticJobListener, ReflectionUtils.getFieldWithName(AbstractDistributeOnceElasticJobListener.class, "guaranteeService", false)));
    new JobExecutor(null, liteJobConfig, new TestElasticJobListener(caller), testDistributeOnceElasticJobListener);
    assertNotNull(ReflectionUtils.getFieldValue(testDistributeOnceElasticJobListener, ReflectionUtils.getFieldWithName(AbstractDistributeOnceElasticJobListener.class, "guaranteeService", false)));
}
Also used : TestDistributeOnceElasticJobListener(com.dangdang.ddframe.job.lite.api.listener.fixture.TestDistributeOnceElasticJobListener) TestElasticJobListener(com.dangdang.ddframe.job.lite.api.listener.fixture.TestElasticJobListener) Test(org.junit.Test)

Aggregations

TestElasticJobListener (com.dangdang.ddframe.job.lite.api.listener.fixture.TestElasticJobListener)2 ElasticJobListener (com.dangdang.ddframe.job.lite.api.listener.ElasticJobListener)1 TestDistributeOnceElasticJobListener (com.dangdang.ddframe.job.lite.api.listener.fixture.TestDistributeOnceElasticJobListener)1 Before (org.junit.Before)1 Test (org.junit.Test)1