package org.hive2hive.core.test.flowcontrol;

import org.hive2hive.core.flowcontrol.Process;
import org.hive2hive.core.flowcontrol.ProcessState;
import org.hive2hive.core.flowcontrol.ProcessStep;
import org.hive2hive.core.test.H2HJUnitTest;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;

public class ProcessTest extends H2HJUnitTest {

	public ProcessTest() throws Exception {
		super();
	}

	@BeforeClass
	public static void initTest() throws Exception {
		testClass = ProcessTest.class;
		beforeClass();
	}

	@Test
	public void testProcessState() {
		Process process = generateProcess();
		Assert.assertEquals(ProcessState.INITIALIZING, process.getState());

		process.start();
		Assert.assertEquals(ProcessState.RUNNING, process.getState());

		process.pause();
		Assert.assertEquals(ProcessState.PAUSED, process.getState());

		process.continueProcess();
		Assert.assertEquals(ProcessState.RUNNING, process.getState());

		process.finalize();
		Assert.assertEquals(ProcessState.FINISHED, process.getState());
	}

	private Process generateProcess() {
		ProcessStep firstStep = new ProcessStep() {
			@Override
			public void start() {
				// do nothing
			}

			@Override
			public void rollBack() {
				// do nothing
			}
		};

		return new Process(null, firstStep) {
		};
	}
}

@@ -39,16 +39,54 @@
 ntrol;%0A%0A
+import net.tomp2p.futures.FutureDHT;%0A%0A
 import o
@@ -227,16 +227,92 @@
 ssStep;%0A
+import org.hive2hive.core.network.messages.direct.response.ResponseMessage;%0A
 import o
@@ -1365,16 +1365,222 @@
 ing%0A%09%09%09%7D
+%0A%0A%09%09%09@Override%0A%09%09%09protected void handleMessageReply(ResponseMessage asyncReturnMessage) %7B%0A%09%09%09%09// do nothing%0A%09%09%09%7D%0A%0A%09%09%09@Override%0A%09%09%09protected void handlePutGetResult(FutureDHT future) %7B%0A%09%09%09%09// do nothing%0A%09%09%09%7D
 %0A%09%09%7D;%0A%0A%09

Fix Process test