Commit bd592f7d authored by Lubomir Bulej's avatar Lubomir Bulej

src-test: Refactored test code to eliminate the insane code duplication.

parent 3e25064a
package ch.usi.dag.disl.test.suite;
import java.io.IOException;
import org.junit.After;
import org.junit.Test;
import ch.usi.dag.disl.test.utils.Runner;
public abstract class BaseTest {
private final Runner __runner = _createRunner ();
protected abstract Runner _createRunner ();
//
@Test
public void test () throws Exception {
__runner.start ();
__runner.waitFor ();
//
__runner.assertIsFinished ();
if (Boolean.getBoolean ("disl.test.verbose")) {
__runner.destroyIfRunningAndDumpOutputs ();
}
__runner.assertIsSuccessful ();
//
_checkOutErr (__runner);
__runner.assertRestOutErrNull ();
}
protected abstract void _checkOutErr (Runner runner) throws IOException;
//
@After
public void cleanup () {
__runner.destroy ();
}
}
package ch.usi.dag.disl.test.suite;
import java.io.IOException;
import ch.usi.dag.disl.test.utils.ClientServerRunner;
import ch.usi.dag.disl.test.utils.Runner;
public abstract class DislOnlyTest extends BaseTest {
@Override
protected Runner _createRunner () {
return new ClientServerRunner (this.getClass ());
}
@Override
protected final void _checkOutErr (final Runner runner) throws IOException {
_checkOutErr ((ClientServerRunner) runner);
}
protected void _checkOutErr (final ClientServerRunner runner) throws IOException {
runner.assertClientOut ("client.out.resource");
}
}
package ch.usi.dag.disl.test.suite;
import java.io.IOException;
import ch.usi.dag.disl.test.utils.ClientServerEvaluationRunner;
import ch.usi.dag.disl.test.utils.Runner;
public abstract class ShadowVmTest extends BaseTest {
@Override
protected Runner _createRunner () {
return new ClientServerEvaluationRunner (this.getClass ());
}
@Override
protected final void _checkOutErr (final Runner runner) throws IOException {
_checkOutErr ((ClientServerEvaluationRunner) runner);
}
protected void _checkOutErr (
final ClientServerEvaluationRunner runner
) throws IOException {
runner.assertClientOut ("client.out.resource");
runner.assertShadowOut ("evaluation.out.resource");
}
}
package ch.usi.dag.disl.test.suite.after.junit;
import org.junit.After;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import ch.usi.dag.disl.test.utils.ClientServerRunner;
import ch.usi.dag.disl.test.suite.DislOnlyTest;
@RunWith (JUnit4.class)
public class AfterTest {
public class AfterTest extends DislOnlyTest {
ClientServerRunner r = new ClientServerRunner (this.getClass ());
@Test
public void test ()
throws Exception {
r.start ();
r.waitFor ();
r.assertIsFinished ();
if (Boolean.parseBoolean (System.getProperty ("disl.test.verbose"))) {
r.destroyIfRunningAndFlushOutputs ();
}
r.assertIsSuccessful ();
r.assertClientOut ("client.out.resource");
r.assertRestOutErrNull ();
}
@After
public void cleanup () {
r.destroy ();
}
}
package ch.usi.dag.disl.test.suite.after2.junit;
import org.junit.After;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import ch.usi.dag.disl.test.utils.*;
import ch.usi.dag.disl.test.suite.DislOnlyTest;
@RunWith(JUnit4.class)
public class After2Test {
ClientServerRunner r = new ClientServerRunner(this.getClass());
@RunWith (JUnit4.class)
public class After2Test extends DislOnlyTest {
@Test
public void test()
throws Exception {
r.start();
r.waitFor();
r.assertIsFinished();
if(Boolean.parseBoolean(System.getProperty("disl.test.verbose"))) { r.destroyIfRunningAndFlushOutputs(); }
r.assertIsSuccessful();
r.assertClientOut("client.out.resource");
r.assertClientErrNull();
r.assertServerOutNull();
r.assertServerErrNull();
}
@After
public void cleanup() {
r.destroy();
}
}
package ch.usi.dag.disl.test.suite.after3.junit;
import org.junit.After;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import ch.usi.dag.disl.test.utils.*;
import ch.usi.dag.disl.test.suite.DislOnlyTest;
@RunWith(JUnit4.class)
public class After3Test {
ClientServerRunner r = new ClientServerRunner(this.getClass());
@RunWith (JUnit4.class)
public class After3Test extends DislOnlyTest {
@Test
public void test()
throws Exception {
r.start();
r.waitFor();
r.assertIsFinished();
if(Boolean.parseBoolean(System.getProperty("disl.test.verbose"))) { r.destroyIfRunningAndFlushOutputs(); }
r.assertIsSuccessful();
r.assertClientOut("client.out.resource");
r.assertClientErrNull();
r.assertServerOutNull();
r.assertServerErrNull();
}
@After
public void cleanup() {
r.destroy();
}
}
package ch.usi.dag.disl.test.suite.afterinit.junit;
import org.junit.After;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import ch.usi.dag.disl.test.utils.*;
import ch.usi.dag.disl.test.suite.DislOnlyTest;
@RunWith(JUnit4.class)
public class AfterInitTest {
ClientServerRunner r = new ClientServerRunner(this.getClass());
@RunWith (JUnit4.class)
public class AfterInitTest extends DislOnlyTest {
@Test
public void test()
throws Exception {
r.start();
r.waitFor();
r.assertIsFinished();
if(Boolean.parseBoolean(System.getProperty("disl.test.verbose"))) { r.destroyIfRunningAndFlushOutputs(); }
r.assertIsSuccessful();
r.assertClientOut("client.out.resource");
r.assertClientErrNull();
r.assertServerOutNull();
r.assertServerErrNull();
}
@After
public void cleanup() {
r.destroy();
}
}
package ch.usi.dag.disl.test.suite.args.junit;
import org.junit.After;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import ch.usi.dag.disl.test.utils.*;
import ch.usi.dag.disl.test.suite.DislOnlyTest;
@RunWith(JUnit4.class)
public class ArgsTest {
ClientServerRunner r = new ClientServerRunner(this.getClass());
@RunWith (JUnit4.class)
public class ArgsTest extends DislOnlyTest {
@Test
public void test()
throws Exception {
r.start();
r.waitFor();
r.assertIsFinished();
if(Boolean.parseBoolean(System.getProperty("disl.test.verbose"))) { r.destroyIfRunningAndFlushOutputs(); }
r.assertIsSuccessful();
r.assertClientOut("client.out.resource");
r.assertClientErrNull();
r.assertServerOutNull();
r.assertServerErrNull();
}
@After
public void cleanup() {
r.destroy();
}
}
package ch.usi.dag.disl.test.suite.bbmarker.junit;
import org.junit.After;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import ch.usi.dag.disl.test.utils.*;
import ch.usi.dag.disl.test.suite.DislOnlyTest;
@RunWith(JUnit4.class)
public class BBMarkerTest {
ClientServerRunner r = new ClientServerRunner(this.getClass());
@RunWith (JUnit4.class)
public class BBMarkerTest extends DislOnlyTest {
@Test
public void test()
throws Exception {
r.start();
r.waitFor();
r.assertIsFinished();
if(Boolean.parseBoolean(System.getProperty("disl.test.verbose"))) { r.destroyIfRunningAndFlushOutputs(); }
r.assertIsSuccessful();
r.assertClientOut("client.out.resource");
r.assertClientErrNull();
r.assertServerOutNull();
r.assertServerErrNull();
}
@After
public void cleanup() {
r.destroy();
}
}
package ch.usi.dag.disl.test.suite.bodymarker.junit;
import org.junit.After;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import ch.usi.dag.disl.test.utils.*;
import ch.usi.dag.disl.test.suite.DislOnlyTest;
@RunWith(JUnit4.class)
public class BodyMarkerTest {
ClientServerRunner r = new ClientServerRunner(this.getClass());
@RunWith (JUnit4.class)
public class BodyMarkerTest extends DislOnlyTest {
@Test
public void test()
throws Exception {
r.start();
r.waitFor();
r.assertIsFinished();
if(Boolean.parseBoolean(System.getProperty("disl.test.verbose"))) { r.destroyIfRunningAndFlushOutputs(); }
r.assertIsSuccessful();
r.assertClientOut("client.out.resource");
r.assertClientErrNull();
r.assertServerOutNull();
r.assertServerErrNull();
}
@After
public void cleanup() {
r.destroy();
}
}
package ch.usi.dag.disl.test.suite.bytecodemarker.junit;
import org.junit.After;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import ch.usi.dag.disl.test.utils.*;
import ch.usi.dag.disl.test.suite.DislOnlyTest;
@RunWith(JUnit4.class)
public class ByteCodeMarkerTest {
ClientServerRunner r = new ClientServerRunner(this.getClass());
@RunWith (JUnit4.class)
public class ByteCodeMarkerTest extends DislOnlyTest {
@Test
public void test()
throws Exception {
r.start();
r.waitFor();
r.assertIsFinished();
if(Boolean.parseBoolean(System.getProperty("disl.test.verbose"))) { r.destroyIfRunningAndFlushOutputs(); }
r.assertIsSuccessful();
r.assertClientOut("client.out.resource");
r.assertClientErrNull();
r.assertServerOutNull();
r.assertServerErrNull();
}
@After
public void cleanup() {
r.destroy();
}
}
package ch.usi.dag.disl.test.suite.cflow.junit;
import org.junit.After;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import ch.usi.dag.disl.test.utils.*;
import ch.usi.dag.disl.test.suite.DislOnlyTest;
@RunWith(JUnit4.class)
public class CFlowTest {
public class CFlowTest extends DislOnlyTest {
ClientServerRunner r = new ClientServerRunner(this.getClass());
@Test
public void test()
throws Exception {
r.start();
r.waitFor();
r.assertIsFinished();
if(Boolean.parseBoolean(System.getProperty("disl.test.verbose"))) { r.destroyIfRunningAndFlushOutputs(); }
r.assertIsSuccessful();
r.assertClientOut("client.out.resource");
r.assertClientErrNull();
r.assertServerOutNull();
r.assertServerErrNull();
}
@After
public void cleanup() {
r.destroy();
}
}
package ch.usi.dag.disl.test.suite.classinfo.junit;
import org.junit.After;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import ch.usi.dag.disl.test.utils.*;
import ch.usi.dag.disl.test.suite.DislOnlyTest;
@RunWith(JUnit4.class)
public class ClassInfoTest {
ClientServerRunner r = new ClientServerRunner(this.getClass());
@RunWith (JUnit4.class)
public class ClassInfoTest extends DislOnlyTest {
@Test
public void test()
throws Exception {
r.start();
r.waitFor();
r.assertIsFinished();
if(Boolean.parseBoolean(System.getProperty("disl.test.verbose"))) { r.destroyIfRunningAndFlushOutputs(); }
r.assertIsSuccessful();
r.assertClientOut("client.out.resource");
r.assertClientErrNull();
r.assertServerOutNull();
r.assertServerErrNull();
}
@After
public void cleanup() {
r.destroy();
}
}
package ch.usi.dag.disl.test.suite.dispatch.junit;
import org.junit.After;
import org.junit.Test;
import java.io.IOException;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import ch.usi.dag.disl.test.suite.ShadowVmTest;
import ch.usi.dag.disl.test.utils.ClientServerEvaluationRunner;
@RunWith (JUnit4.class)
public class DispatchTest {
ClientServerEvaluationRunner r = new ClientServerEvaluationRunner (
this.getClass ());
public class DispatchTest extends ShadowVmTest {
@Test
public void test ()
throws Exception {
r.start ();
r.waitFor ();
r.assertIsFinished ();
if (Boolean.parseBoolean (System.getProperty ("disl.test.verbose"))) {
r.destroyIfRunningAndFlushOutputs ();
}
r.assertIsSuccessful ();
r.assertShadowOut ("evaluation.out.resource");
r.assertRestOutErrNull ();
@Override
protected void _checkOutErr (
final ClientServerEvaluationRunner runner
) throws IOException {
runner.assertShadowOut ("evaluation.out.resource");
}
@After
public void cleanup () {
r.destroy ();
}
}
package ch.usi.dag.disl.test.suite.dispatch2.junit;
import org.junit.After;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import ch.usi.dag.disl.test.utils.ClientServerEvaluationRunner;
import ch.usi.dag.disl.test.suite.ShadowVmTest;
@RunWith (JUnit4.class)
public class Dispatch2Test {
public class Dispatch2Test extends ShadowVmTest {
ClientServerEvaluationRunner r = new ClientServerEvaluationRunner (
this.getClass ());
@Test
public void test ()
throws Exception {
r.start ();
r.waitFor ();
r.assertIsFinished ();
if (Boolean.parseBoolean (System.getProperty ("disl.test.verbose"))) {
r.destroyIfRunningAndFlushOutputs ();
}
r.assertIsSuccessful ();
r.assertClientOut ("client.out.resource");
r.assertShadowOut ("evaluation.out.resource");
r.assertRestOutErrNull ();
}
@After
public void cleanup () {
r.destroy ();
}
}
package ch.usi.dag.disl.test.suite.dispatchmp.junit;
import org.junit.After;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import ch.usi.dag.disl.test.utils.ClientServerEvaluationRunner;
import ch.usi.dag.disl.test.suite.ShadowVmTest;
@RunWith (JUnit4.class)
public class DispatchMPTest {
public class DispatchMPTest extends ShadowVmTest {
ClientServerEvaluationRunner r = new ClientServerEvaluationRunner (
this.getClass ());
@Test
public void test ()
throws Exception {
r.start ();
r.waitFor ();
r.assertIsFinished ();
if (Boolean.parseBoolean (System.getProperty ("disl.test.verbose"))) {
r.destroyIfRunningAndFlushOutputs ();
}
r.assertIsSuccessful ();
r.assertClientOut ("client.out.resource");
r.assertShadowOut ("evaluation.out.resource");
r.assertRestOutErrNull ();
}
@After
public void cleanup () {
r.destroy ();
}
}
package ch.usi.dag.disl.test.suite.dynamiccontext.junit;
import org.junit.After;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import ch.usi.dag.disl.test.utils.ClientServerRunner;
import ch.usi.dag.disl.test.suite.DislOnlyTest;
@RunWith(JUnit4.class)
public class DynamicContextTest {
ClientServerRunner r = new ClientServerRunner(this.getClass());
@RunWith (JUnit4.class)
public class DynamicContextTest extends DislOnlyTest {
@Test
public void test()
throws Exception {
r.start();
r.waitFor();
r.assertIsFinished();
if(Boolean.parseBoolean(System.getProperty("disl.test.verbose"))) { r.destroyIfRunningAndFlushOutputs(); }
r.assertIsSuccessful();
r.assertClientOut("client.out.resource");
r.assertClientErrNull();
r.assertServerOutNull();
r.assertServerErrNull();
}
@After
public void cleanup() {
r.destroy();
}
}
package ch.usi.dag.disl.test.suite.dynamicinfo.junit;
import org.junit.After;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import ch.usi.dag.disl.test.utils.*;
import ch.usi.dag.disl.test.suite.DislOnlyTest;
@RunWith(JUnit4.class)
public class DynamicInfoTest {
ClientServerRunner r = new ClientServerRunner(this.getClass());
@RunWith (JUnit4.class)
public class DynamicInfoTest extends DislOnlyTest {
@Test
public void test()
throws Exception {
r.start();
r.waitFor();
r.assertIsFinished();
if(Boolean.parseBoolean(System.getProperty("disl.test.verbose"))) { r.destroyIfRunningAndFlushOutputs(); }
r.assertIsSuccessful();