|
3 | 3 | import static org.jpc.engine.provider.PrologEngineProviderManager.setPrologEngine; |
4 | 4 |
|
5 | 5 | import org.jpc.engine.prolog.PrologEngine; |
6 | | -import org.jpc.engine.prolog.PrologEngines; |
7 | 6 | import org.junit.BeforeClass; |
8 | 7 | import org.junit.runner.RunWith; |
9 | 8 | import org.junit.runners.Suite; |
| 9 | +import org.slf4j.Logger; |
| 10 | +import org.slf4j.LoggerFactory; |
10 | 11 |
|
11 | 12 | /** |
| 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 | + * |
12 | 20 | * @author sergioc |
13 | | - * |
14 | 21 | */ |
15 | 22 | @RunWith(Suite.class) |
16 | | -@Suite.SuiteClasses({OsmTest.class}) |
| 23 | +@Suite.SuiteClasses({/*OsmTest.class*/}) |
17 | 24 | public class OsmTestSuite { |
| 25 | + |
| 26 | + public static final Logger logger = LoggerFactory.getLogger(OsmTestSuite.class); |
| 27 | + |
18 | 28 | @BeforeClass |
19 | 29 | 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"); |
21 | 33 | //PrologEngine prologEngine = PrologEngines.getPrologEngineById("swi_pdt"); |
22 | 34 | //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."); |
28 | 43 | } |
29 | 44 | } |
0 commit comments