Commit 462684e2 authored by Martti Käärik's avatar Martti Käärik
Browse files

TRI changes implemented.

parent cfbabad6
Loading
Loading
Loading
Loading
+14 −11
Original line number Diff line number Diff line
@@ -767,7 +767,7 @@ public class JUnitTestGenerator extends Renderer {
		}
		append("catch (RuntimeException e)");
		blockOpen();
		line(REPORTER_FIELD + ".runtimeError(e);");
		line(REPORTER_FIELD + ".runtimeError(" + COMPONENT_FIELD + ".getTesterComponent().getName(), " + "e);");
		line("throw e;");
		blockClose();

@@ -1119,15 +1119,6 @@ public class JUnitTestGenerator extends Renderer {
			}

		}
		if (writeAfter) {
			writeNotification(b, false);
			writeObjective(b);

			newLine();
			exceptionalBehaviours.forEach(eb -> {
				line(COMPONENT_FIELD + ".removeExceptionalBehaviour(" + eb + ");");
			});
		}

		if (futures == null) {
			if (!myFutures.isEmpty()) {
@@ -1215,6 +1206,16 @@ public class JUnitTestGenerator extends Renderer {
			// XXX handle futures in caller (e.g. alt)
		}
		
		if (writeAfter) {
			writeNotification(b, false);
			writeObjective(b);

			newLine();
			exceptionalBehaviours.forEach(eb -> {
				line(COMPONENT_FIELD + ".removeExceptionalBehaviour(" + eb + ");");
			});
		}

	}

	private FutureInfo writeTesterInput(Behaviour b, Map<DataUse, String> dataUseVariables, boolean autoSubmit,
@@ -2159,7 +2160,7 @@ public class JUnitTestGenerator extends Renderer {
			append("/* ");
			line(c.getBody());
			line("*/ ");
			line(REPORTER_FIELD + ".comment(\"" + c.getBody() + "\");");
			line(REPORTER_FIELD + ".comment(" + COMPONENT_FIELD + ".getTesterComponent().getName(), " + "\"" + c.getBody() + "\");");
		});
	}

@@ -2167,6 +2168,7 @@ public class JUnitTestGenerator extends Renderer {
		// TODO multiple URIs
		b.getTestObjective().forEach(to -> {
			append(REPORTER_FIELD + ".testObjectiveReached(");
			append(COMPONENT_FIELD + ".getTesterComponent().getName(), ");
			append("\"" + to.getObjectiveURI() + "\", ");
			append("\"" + to.getDescription() + "\"");
			line(");");
@@ -2178,6 +2180,7 @@ public class JUnitTestGenerator extends Renderer {
			append(REPORTER_FIELD + ".");
			append(started ? "behaviourStarted" : "behaviourCompleted");
			append("(");
			append(COMPONENT_FIELD + ".getTesterComponent().getName(), ");
			if (started)
				append("\"" + b.eClass().getName() + "\", ");
			append("\"" + getQName(b) + "\"");
+10 −10
Original line number Diff line number Diff line
@@ -18,33 +18,33 @@ public class DefaultAdapter implements Validator, Reporter {
	}

	@Override
	public void comment(String body) {
	public void comment(String tester, String body) {
		// TODO Auto-generated method stub
		System.out.println(body);
		System.out.println("[" + tester + "] " + body);
	}

	@Override
	public void testObjectiveReached(String uri, String description) {
	public void testObjectiveReached(String tester, String uri, String description) {
		// TODO Auto-generated method stub
		System.out.println("Reached: " + uri + " | " + description);
		System.out.println("[" + tester + "] Reached: " + uri + " | " + description);
	}

	@Override
	public void behaviourStarted(String kind, String id, Object... properties) {
	public void behaviourStarted(String tester, String kind, String id, Object... properties) {
		// TODO Auto-generated method stub
		System.out.println("Started: " + kind + " | id = " + id);
		System.out.println("[" + tester + "] Started: " + kind + " | id = " + id);
	}

	@Override
	public void behaviourCompleted(String id) {
	public void behaviourCompleted(String tester, String id) {
		// TODO Auto-generated method stub
		System.out.println("Completed: id = " + id);
		System.out.println("[" + tester + "] Completed: id = " + id);
	}

	@Override
	public void runtimeError(Throwable t) {
	public void runtimeError(String tester, Throwable t) {
		// TODO Auto-generated method stub
		System.err.println(t);
		System.err.println("[" + tester + "] " + t);
	}

	@Override