Search in sources :

Example 1 with SpringContextService

use of com.thinkbiganalytics.nifi.core.api.spring.SpringContextService in project kylo by Teradata.

the class JmsCleanupEventServiceTest method setUp.

/**
 * Initialize instance variables.
 */
@Before
public void setUp() throws Exception {
    // Setup controllers
    final SpringContextService springService = new MockSpringContextService();
    // Setup test runner
    runner.addControllerService(CLEANUP_SERVICE_IDENTIFIER, cleanupService);
    runner.addControllerService(SPRING_SERVICE_IDENTIFIER, springService);
    runner.setProperty(CLEANUP_SERVICE_PROPERTY, CLEANUP_SERVICE_IDENTIFIER);
    runner.setProperty(cleanupService, JmsCleanupEventService.SPRING_SERVICE, SPRING_SERVICE_IDENTIFIER);
    runner.enableControllerService(cleanupService);
    runner.enableControllerService(springService);
}
Also used : SpringContextService(com.thinkbiganalytics.nifi.core.api.spring.SpringContextService) Before(org.junit.Before)

Example 2 with SpringContextService

use of com.thinkbiganalytics.nifi.core.api.spring.SpringContextService in project kylo by Teradata.

the class TriggerSavepointTest method setup.

@Before
public void setup() throws InitializationException {
    runner = TestRunners.newTestRunner(TriggerSavepoint.class);
    final SpringContextService springService = new MockSpringContextService();
    DistributedMapCacheClient client = new MockDistributedMapCacheClient();
    final Map<String, String> clientProperties = new HashMap<>();
    runner.addControllerService("client", client, clientProperties);
    runner.enableControllerService(client);
    DistributedSavepointController service = new DistributedSavepointController();
    final Map<String, String> serviceProperties = new HashMap<>();
    serviceProperties.put("distributed-cache-service", "client");
    runner.addControllerService("service", service, serviceProperties);
    runner.addControllerService(SPRING_SERVICE_IDENTIFIER, springService);
    runner.setProperty(service, DistributedSavepointController.SPRING_SERVICE, SPRING_SERVICE_IDENTIFIER);
    runner.enableControllerService(springService);
    runner.enableControllerService(service);
    runner.setProperty(SetSavepoint.SAVEPOINT_SERVICE, "service");
    runner.setProperty(TriggerSavepoint.SAVEPOINT_ID, "${savepointid}");
    runner.setProperty(TriggerSavepoint.BEHAVIOR, TriggerSavepoint.RETRY);
    this.provider = service.getProvider();
}
Also used : DistributedMapCacheClient(org.apache.nifi.distributed.cache.client.DistributedMapCacheClient) HashMap(java.util.HashMap) SpringContextService(com.thinkbiganalytics.nifi.core.api.spring.SpringContextService) DistributedSavepointController(com.thinkbiganalytics.nifi.v2.core.savepoint.DistributedSavepointController) Before(org.junit.Before)

Example 3 with SpringContextService

use of com.thinkbiganalytics.nifi.core.api.spring.SpringContextService in project kylo by Teradata.

the class SetSavepointTest method setup.

@Before
public void setup() throws InitializationException {
    runner = TestRunners.newTestRunner(SetSavepoint.class);
    final SpringContextService springService = new MockSpringContextService();
    DistributedMapCacheClient client = new MockDistributedMapCacheClient();
    final Map<String, String> clientProperties = new HashMap<>();
    runner.addControllerService("client", client, clientProperties);
    runner.enableControllerService(client);
    DistributedSavepointController service = new DistributedSavepointController();
    final Map<String, String> serviceProperties = new HashMap<>();
    serviceProperties.put("distributed-cache-service", "client");
    runner.addControllerService("service", service, serviceProperties);
    runner.addControllerService(SPRING_SERVICE_IDENTIFIER, springService);
    runner.setProperty(service, DistributedSavepointController.SPRING_SERVICE, SPRING_SERVICE_IDENTIFIER);
    runner.enableControllerService(springService);
    runner.enableControllerService(service);
    runner.setProperty(SetSavepoint.SAVEPOINT_SERVICE, "service");
    runner.setProperty(SetSavepoint.EXPIRATION_DURATION, "24h");
    runner.setProperty(SetSavepoint.SAVEPOINT_ID, "${savepointid}");
    this.savepointId = "sp1";
    runner.setThreadCount(1);
    // Setup existing cache entry.
    provider = service.getProvider();
}
Also used : DistributedMapCacheClient(org.apache.nifi.distributed.cache.client.DistributedMapCacheClient) HashMap(java.util.HashMap) SpringContextService(com.thinkbiganalytics.nifi.core.api.spring.SpringContextService) DistributedSavepointController(com.thinkbiganalytics.nifi.v2.core.savepoint.DistributedSavepointController) Before(org.junit.Before)

Aggregations

SpringContextService (com.thinkbiganalytics.nifi.core.api.spring.SpringContextService)3 Before (org.junit.Before)3 DistributedSavepointController (com.thinkbiganalytics.nifi.v2.core.savepoint.DistributedSavepointController)2 HashMap (java.util.HashMap)2 DistributedMapCacheClient (org.apache.nifi.distributed.cache.client.DistributedMapCacheClient)2