<commit_before>package org.deeplearning4j.scaleout.actor;

import static org.junit.Assert.*;

import akka.actor.ActorSystem;
import akka.actor.Props;
import org.deeplearning4j.scaleout.actor.core.actor.WorkerActor;
import org.deeplearning4j.scaleout.conf.Configuration;
import org.deeplearning4j.scaleout.conf.DeepLearningConfigurable;
import org.deeplearning4j.scaleout.job.Job;
import org.deeplearning4j.scaleout.api.statetracker.StateTracker;
import org.deeplearning4j.scaleout.statetracker.hazelcast.HazelCastStateTracker;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;

/**
 * Created by agibsonccc on 11/27/14.
 */
public class WorkerActorTest implements DeepLearningConfigurable {

    private StateTracker stateTracker;
    private ActorSystem testSystem;
    private Props test;
    private Configuration conf;
    private TestPerformer testPerformer;

    @Before
    public void before() throws Exception {
        stateTracker = new HazelCastStateTracker();
        testSystem = ActorSystem.create();
        conf = new Configuration();
        testPerformer = new TestPerformer();
        test = WorkerActor.propsFor(conf, stateTracker,testPerformer);


    }

    @After
    public void after() {
        if(stateTracker != null)
            stateTracker.finish();
        if(testSystem != null)
            testSystem.shutdown();
    }


    @Test
    public void testActor() throws Exception {
        testSystem.actorOf(test);
        Thread.sleep(10000);
        assertTrue(!stateTracker.workers().isEmpty());
        String id = stateTracker.workers().get(0);
        Job testJob = new Job("hello",id);
        stateTracker.addJobToCurrent(testJob);
        while(!testPerformer.isPerformCalled()) {
            Thread.sleep(10000);
        }<commit_msg>shutdown state tracker for test<commit_after>package org.deeplearning4j.scaleout.actor;

import static org.junit.Assert.*;

import akka.actor.ActorSystem;
import akka.actor.Props;
import org.deeplearning4j.scaleout.actor.core.actor.WorkerActor;
import org.deeplearning4j.scaleout.conf.Configuration;
import org.deeplearning4j.scaleout.conf.DeepLearningConfigurable;
import org.deeplearning4j.scaleout.job.Job;
import org.deeplearning4j.scaleout.api.statetracker.StateTracker;
import org.deeplearning4j.scaleout.statetracker.hazelcast.HazelCastStateTracker;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;

/**
 * Created by agibsonccc on 11/27/14.
 */
public class WorkerActorTest implements DeepLearningConfigurable {

    private StateTracker stateTracker;
    private ActorSystem testSystem;
    private Props test;
    private Configuration conf;
    private TestPerformer testPerformer;

    @Before
    public void before() throws Exception {
        stateTracker = new HazelCastStateTracker();
        if(testSystem == null)
            testSystem = ActorSystem.create();
        conf = new Configuration();
        testPerformer = new TestPerformer();
        test = WorkerActor.propsFor(conf, stateTracker,testPerformer);


    }

    @After
    public void after() {
        if(stateTracker != null) {
            stateTracker.finish();
            stateTracker.shutdown();
        }
        if(testSystem != null)
            testSystem.shutdown();
    }


    @Test
    public void testActor() throws Exception {
        testSystem.actorOf(test);
        Thread.sleep(10000);
        assertTrue(!stateTracker.workers().isEmpty());
        String id = stateTracker.workers().get(0);
        Job testJob = new Job("hello",id);
        stateTracker.addJobToCurrent(testJob);
        while(!testPerformer.isPerformCalled()) {
            Thread.sleep(10000);
        }
{'fraction_non_alphanumeric': 0.09951325040562466, 'fraction_numerical': 0.012979989183342347, 'mean_word_length': 3.3620283018867925, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6278587', 'n_tokens_mistral': 1078, 'n_tokens_neox': 1027, 'n_words': 209}