diff --git a/.travis.yml b/.travis.yml index 2c31704e..d620772d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -54,3 +54,4 @@ after_failure: - $ISLANDORA_DIR/tests/scripts/travis_after_failure.sh notifications: irc: "irc.freenode.org#islandora" +sudo: required diff --git a/includes/admin.form.inc b/includes/admin.form.inc index 4259c956..eb975f5d 100644 --- a/includes/admin.form.inc +++ b/includes/admin.form.inc @@ -59,6 +59,21 @@ function islandora_repository_admin(array $form, array &$form_state) { ), ), ), + 'islandora_sparql_endpoint_externalized' => array( + '#type' => 'checkbox', + '#title' => t('Use an external SPARQL Query endpoint'), + '#description' => t('If an external query endpoint is used, the repository must be configured to update it.'), + '#default_value' => variable_get('islandora_sparql_endpoint_externalized', FALSE), + ), + 'islandora_sparql_endpoint' => array( + '#type' => 'textfield', + '#title' => t('SPARQL Query Endpoint'), + '#default_value' => variable_get('islandora_sparql_endpoint', ""), + '#description' => t("An external SPARQL Query endpoint to use."), + '#required' => FALSE, + '#states' => array( + 'invisible' => array(':input[name="islandora_sparql_endpoint_externalized"]' => array('checked' => FALSE))), + ), 'islandora_repository_pid' => array( '#type' => 'textfield', '#title' => t('Root Collection PID'), diff --git a/includes/tuque.inc b/includes/tuque.inc index 7aed2556..26698e02 100644 --- a/includes/tuque.inc +++ b/includes/tuque.inc @@ -65,8 +65,10 @@ class IslandoraTuque { * A Drupal user. * @param string $url * The url to the fedora instance. + * @param string $sparql_endpoint + * The URL of a SPARQL Query endpoint for this connection. */ - public function __construct($user = NULL, $url = NULL) { + public function __construct($user = NULL, $url = NULL, $sparql_endpoint = NULL) { if (!isset($user)) { global $user; } @@ -84,9 +86,18 @@ class IslandoraTuque { $url = variable_get('islandora_base_url', 'http://localhost:8080/fedora'); } + if (!isset($sparql_endpoint)) { + if (variable_get('islandora_sparql_endpoint_externalized', FALSE)) { + $sparql_endpoint = variable_get('islandora_sparql_endpoint', $url); + } + else { + $sparql_endpoint = $url; + } + } + if (self::exists()) { module_load_include('inc', 'islandora', 'includes/tuque_wrapper'); - $this->connection = new IslandoraRepositoryConnection($url, $user_string, $pass_string); + $this->connection = new IslandoraRepositoryConnection($url, $user_string, $pass_string, $sparql_endpoint); $this->connection->reuseConnection = TRUE; $this->api = new IslandoraFedoraApi($this->connection); $this->cache = new IslandoraSimpleCache(); diff --git a/tests/scripts/travis_setup.sh b/tests/scripts/travis_setup.sh index db50a52d..bdb56ebc 100755 --- a/tests/scripts/travis_setup.sh +++ b/tests/scripts/travis_setup.sh @@ -73,4 +73,12 @@ drush en --user=1 --yes islandora drush cc all # The shebang in this file is a bogeyman that is haunting the web test cases. rm /home/travis/.phpenv/rbenv.d/exec/hhvm-switcher.bash -sleep 20 + +# wait for Fedora to come up +fedoraIsUp=1 +until [ $fedoraIsUp -eq "0" ]; do + echo "Waiting for Fedora to boot..." + sleep 10 + (curl http://localhost:8080/fedora) + fedoraIsUp=$? +done