From 5d54af2638a53721b414a41356a93686a9616272 Mon Sep 17 00:00:00 2001 From: RncLsn Date: Tue, 19 May 2015 13:35:52 +0100 Subject: Backup before changes in MyQueryReasoner. --- .../ox/cs/pagoda/global_tests/TestPagodaUOBM.java | 45 +++++++++++++--------- 1 file changed, 27 insertions(+), 18 deletions(-) (limited to 'test/uk/ac/ox/cs/pagoda/global_tests/TestPagodaUOBM.java') diff --git a/test/uk/ac/ox/cs/pagoda/global_tests/TestPagodaUOBM.java b/test/uk/ac/ox/cs/pagoda/global_tests/TestPagodaUOBM.java index 61235d3..23d79ab 100644 --- a/test/uk/ac/ox/cs/pagoda/global_tests/TestPagodaUOBM.java +++ b/test/uk/ac/ox/cs/pagoda/global_tests/TestPagodaUOBM.java @@ -6,48 +6,57 @@ import uk.ac.ox.cs.pagoda.Pagoda; import uk.ac.ox.cs.pagoda.tester.PagodaTester; import uk.ac.ox.cs.pagoda.util.TestUtil; +import java.io.File; import java.io.IOException; +import java.nio.file.Path; import java.nio.file.Paths; import static uk.ac.ox.cs.pagoda.util.TestUtil.combinePaths; public class TestPagodaUOBM { - public void test(int number) throws IOException { + + private static final int N_1 = 1; + private static final int N_2 = 10; + + @DataProvider(name = "uobmNumbers") + public static Object[][] uobmNumbers() { + Integer[][] integers = new Integer[N_2 - N_1 + 1][1]; + for(int i = 0; i < N_2 - N_1 + 1; i++) + integers[i][0] = N_1 + i; + return integers; + } + + public void answersCorrectness(int number) throws IOException { String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); + Path computedAnswers = Paths.get(File.createTempFile("answers", ".json").getAbsolutePath()); + new File(computedAnswers.toString()).deleteOnExit(); + Pagoda pagoda = Pagoda.builder() .ontology(Paths.get(ontoDir, "uobm/univ-bench-dl.owl")) .data(Paths.get(ontoDir, "uobm/data/uobm" + number + ".ttl")) .query(Paths.get(ontoDir, "uobm/queries/test.sparql")) + .answer(computedAnswers) .classify(true) .hermit(true) .build(); - CheckAnswersOverDataset.check(pagoda, - Paths.get(ontoDir, "uobm/uobm" + number + ".json")); - } + pagoda.run(); - @Test - public void test_1() throws IOException { - test(1); + String given_answers = "uobm/uobm" + number + ".json"; + CheckAnswers.assertSameAnswers(computedAnswers, Paths.get(ontoDir, given_answers)); } - private static final int N_1 = 1; - private static final int N_2 = 10; - - @DataProvider(name = "uobmNumbers") - public static Object[][] uobmNumbers() { - Integer[][] integers = new Integer[N_2 - N_1 + 1][1]; - for (int i = 0; i < N_2 - N_1 + 1; i++) - integers[i][0]= N_1 + i; - return integers; + @Test(groups = {"light"}) + public void answersCorrectness_1() throws IOException { + answersCorrectness(1); } - @Test(dataProvider = "uobmNumbers") + @Test(groups = {"heavy"}, dataProvider = "uobmNumbers") public void justExecute(int number) { String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); PagodaTester.main(combinePaths(ontoDir, "uobm/univ-bench-dl.owl"), combinePaths(ontoDir, "uobm/data/uobm" + number + ".ttl"), - combinePaths(ontoDir, "uobm/queries/test.sparql")); + combinePaths(ontoDir, "uobm/queries/answersCorrectness.sparql")); } } -- cgit v1.2.3