Skip to content

Commit 2981953

Browse files
committed
adding instructions about how to run the unit tests
1 parent 0641ada commit 2981953

1 file changed

Lines changed: 24 additions & 9 deletions

File tree

src/test/java/org/jpc/examples/osm/OsmTestSuite.java

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,42 @@
33
import static org.jpc.engine.provider.PrologEngineProviderManager.setPrologEngine;
44

55
import org.jpc.engine.prolog.PrologEngine;
6-
import org.jpc.engine.prolog.PrologEngines;
76
import org.junit.BeforeClass;
87
import org.junit.runner.RunWith;
98
import org.junit.runners.Suite;
9+
import org.slf4j.Logger;
10+
import org.slf4j.LoggerFactory;
1011

1112
/**
13+
* The tests in this test suite are commented out since in order to be executed a Prolog engine driver needs to be configured first.
14+
* In order to execute the unit tests follow these instructions:
15+
* - Uncomment the tests in the SuiteClasses annotation.
16+
* - Initialize a prologEngine according to one of the driver configurations defined in the jpc.settings file (see examples commented out below).
17+
* - Add a dependency in the POM to the selected driver (e.g., the artifact "jpc-jpl" for the jpl-based driver, or "jpc-drivers" for all the known jpc drivers).
18+
* To use other drivers than the jpl-based one, refer to the JPC installation guide.
19+
*
1220
* @author sergioc
13-
*
1421
*/
1522
@RunWith(Suite.class)
16-
@Suite.SuiteClasses({OsmTest.class})
23+
@Suite.SuiteClasses({/*OsmTest.class*/})
1724
public class OsmTestSuite {
25+
26+
public static final Logger logger = LoggerFactory.getLogger(OsmTestSuite.class);
27+
1828
@BeforeClass
1929
public static void oneTimeSetUp() {
20-
PrologEngine prologEngine = PrologEngines.getPrologEngineById("swi_jpl");
30+
PrologEngine prologEngine = null;
31+
//PrologEngine prologEngine = PrologEngines.getPrologEngineById("swi_jpl");
32+
//PrologEngine prologEngine = PrologEngines.getPrologEngineById("yap_jpl");
2133
//PrologEngine prologEngine = PrologEngines.getPrologEngineById("swi_pdt");
2234
//PrologEngine prologEngine = PrologEngines.getPrologEngineById("xsb_interprolog");
23-
setPrologEngine(prologEngine);
24-
if(!MapQuery.loadAll()) //load logic files
25-
throw new RuntimeException();
26-
MapQuery.importData(); //import data to the logic database from text file
27-
//prologEngine.query("map::load_osm(file('/Users/sergioc/Documents/workspaces/heal/mapquery/src/main/resources/org/jpc/examples/osm/brussels_center_filtered.osm'))").oneSolutionOrThrow();
35+
if(prologEngine != null) {
36+
setPrologEngine(prologEngine);
37+
if(!MapQuery.loadAll()) //load logic files
38+
throw new RuntimeException();
39+
MapQuery.importData(); //import data to the logic database from text file
40+
//prologEngine.query("map::load_osm(file('/Users/sergioc/Documents/workspaces/heal/mapquery/src/main/resources/org/jpc/examples/osm/brussels_center_filtered.osm'))").oneSolutionOrThrow();
41+
} else
42+
logger.warn("No JPC driver has been configured. Skipping tests.");
2843
}
2944
}

0 commit comments

Comments
 (0)