aboutsummaryrefslogtreecommitdiff
path: root/test/uk/ac/ox/cs/pagoda/test_units/PagodaLUBM.java
blob: f40e41b1ce4c8080e07f370eae64522d9ca1f607 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
package uk.ac.ox.cs.pagoda.test_units;

import org.testng.Assert;
import org.testng.annotations.Test;
import uk.ac.ox.cs.pagoda.tester.PagodaTester;
import uk.ac.ox.cs.pagoda.tester.Statistics;
import uk.ac.ox.cs.pagoda.util.Utility;

import java.io.FileInputStream;
import java.io.IOException;
import java.util.Properties;

public class PagodaLUBM {

	public static final String CONFIG_FILE = "config/test.properties";

	private static boolean isInit = false;
	private static String ontoDir;

	private static void init() {
		if(isInit) return;
		isInit = true;

		Properties config = new Properties();

		try(FileInputStream in = new FileInputStream(CONFIG_FILE)) {
			config.load(in);
			in.close();
		} catch (IOException e) {
			e.printStackTrace();
		}

		ontoDir = config.getProperty("ontoDir");
	}

	private void test_all(int number) {
		init();
		PagodaTester.main(
				Utility.combinePaths(ontoDir, "lubm/univ-bench.owl"),
				Utility.combinePaths(ontoDir, "lubm/data/lubm" + number + ".ttl"),
				Utility.combinePaths(ontoDir, "lubm/queries/test.sparql")
		);

//		assertTrue(false);
//		AllTests.copy("log4j.log", "output/jair/lubm" + number + ".out");
	}

	@Test
	public void test1() {
		test_all(1);
	}

//	@Test
//	public void test() {
//		int number = 100;
//		test_all(number);
//	}
	
	private void check(int number) throws IOException {
		Statistics stat = new Statistics("output/log4j.log");
		// TODO insert proper file
		String diff = stat.diff("results-backup/benchmark/lubm" + number + ".out");
		Utility.copyFile("output/log4j.log", "results-backup/current/lubm" + number + ".out");
		if (!diff.isEmpty())
			Assert.fail(diff);
	}
	
}