package tests.pikater.core.ontology.subtrees.batchDescription;

import java.io.FileNotFoundException;

import org.pikater.core.ontology.subtrees.batchDescription.ComputationDescription;
import org.pikater.core.ontology.subtrees.batchDescription.examples.SearchOnly;
import org.pikater.core.ontology.subtrees.batchDescription.examples.SimpleTraining;
import org.pikater.shared.experiment.universalformat.UniversalComputationDescription;

import xmlGenerator.Input01;
import xmlGenerator.Input04;
import xmlGenerator.Input03;
import xmlGenerator.Input05;
import xmlGenerator.Input10;

public class TestBatchDescription {

	public static void test() {

		testComputatingDescription(
				SimpleTraining.createDescription(),
				"SimpleTraining");

		testComputatingDescription(
				SearchOnly.createDescription(),
				"SearchOnly");

		testComputatingDescription(
				Input01.createDescription(),
				"Input01");

		testComputatingDescription(
				Input04.createDescription(),
				"Input02");

		testComputatingDescription(
				Input03.createDescription(),
				"Input03");

		testComputatingDescription(
				Input04.createDescription(),
				"Input04");
		
		testComputatingDescription(
				Input05.createDescription(),
				"Input05");

		testComputatingDescription(
				Input10.createDescription(),
				"Input10");
//*/
	}

	private static void testComputatingDescription(
			ComputationDescription comDescription, String note) {
		
		comDescription.generateIDs();
		
		UniversalComputationDescription udescriptinSimpleTraining =
				comDescription.exportUniversalComputationDescription();
		
		ComputationDescription comDescription2 =
				ComputationDescription.importUniversalComputationDescription(
						udescriptinSimpleTraining);

		String xml1 = comDescription.exportXML();
		String xml2 = comDescription2.exportXML();
		
		try {
			comDescription.exportXML("comDescription.xml");
			comDescription2.exportXML("comDescription2.xml");
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		}
//*/
		if (xml1.equals(xml2)) {
			System.out.println("OK - " + note);
		} else {
			System.out.println("Error - " + note);
		}
	}

}

@@ -459,16 +459,45 @@
 nput01;%0A
+import xmlGenerator.Input02;%0A
 import x
@@ -964,33 +964,33 @@
 tion(%0A%09%09%09%09Input0
-4
+2
 .createDescripti
@@ -1844,18 +1844,18 @@
 tXML();%0A
-%09%09
+/*
 %0A%09%09try %7B

Test bug fix