Search in sources :

Example 1 with DistributedSavepointController

use of com.thinkbiganalytics.nifi.v2.core.savepoint.DistributedSavepointController 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 2 with DistributedSavepointController

use of com.thinkbiganalytics.nifi.v2.core.savepoint.DistributedSavepointController 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)2 DistributedSavepointController (com.thinkbiganalytics.nifi.v2.core.savepoint.DistributedSavepointController)2 HashMap (java.util.HashMap)2 DistributedMapCacheClient (org.apache.nifi.distributed.cache.client.DistributedMapCacheClient)2 Before (org.junit.Before)2