From a384a54231be0c44a6ccc4e9b3db8b103f3b9a69 Mon Sep 17 00:00:00 2001 From: Dustin Jenkins Date: Tue, 16 Jan 2024 20:34:57 -0800 Subject: [PATCH] Updated README and add endpoint for HiPS layer requests. --- caom2-search-server/.gitignore | 1 - caom2-search-server/CHANGELOG.md | 4 + caom2-search-server/README.md | 56 ++ caom2-search-server/README.rst | 69 -- caom2-search-server/build.gradle | 6 +- .../examples/default/Dockerfile | 19 - .../examples/default/build.gradle | 49 -- .../default/org.opencadc.search.properties | 11 - .../default/reg-resource-caps.properties | 6 - ...AbstractAdvancedSearchIntegrationTest.java | 46 -- .../integration/AbstractPreviewPage.java | 84 --- .../integration/AbstractSearchFormPage.java | 230 ------ .../integration/BookmarkBrowserTest.java | 118 --- .../CAOMObservationDetailsPage.java | 94 --- .../integration/CAOMSearchBrowserTest.java | 227 ------ .../integration/CAOMSearchFormPage.java | 236 ------ .../integration/FormInputBrowserTest.java | 148 ---- .../ResolverTooltipBrowserTest.java | 57 -- .../search/integration/SearchResultsPage.java | 292 ------- .../integration/StartDateSearchLinkTest.java | 68 -- .../integration/UnauthorizedPreviewPage.java | 87 --- .../src/main/webapp/META-INF/context.xml | 20 - .../src/main/webapp/WEB-INF/tags/c.tld | 563 -------------- .../webapp/WEB-INF/tags/cadc/checkbox.tag | 26 - .../webapp/WEB-INF/tags/cadc/formName.tag | 4 - .../webapp/WEB-INF/tags/cadc/pulldown.tag | 14 - .../src/main/webapp/WEB-INF/tags/fmt.tld | 712 ------------------ .../default/src/main/webapp/WEB-INF/web.xml | 287 ------- .../default/src/main/webapp/_page_header.jsp | 64 -- .../examples/int-test/default-ssl.conf | 36 - .../examples/int-test/default.conf | 37 - .../examples/int-test/docker-compose-ssl.yml | 53 -- .../examples/int-test/docker-compose.yml | 46 -- .../org.opencadc.search.env.properties | 1 - .../cadc/search/HiPSImageSurveyServlet.java | 44 +- .../ca/nrc/cadc/uws/SearchJobManager.java | 2 +- .../search/HiPSImageSurveyServletTest.java | 10 +- 37 files changed, 101 insertions(+), 3726 deletions(-) create mode 100644 caom2-search-server/README.md delete mode 100644 caom2-search-server/README.rst delete mode 100644 caom2-search-server/examples/default/Dockerfile delete mode 100644 caom2-search-server/examples/default/build.gradle delete mode 100644 caom2-search-server/examples/default/org.opencadc.search.properties delete mode 100644 caom2-search-server/examples/default/reg-resource-caps.properties delete mode 100644 caom2-search-server/examples/default/src/intTest/java/ca/nrc/cadc/search/integration/AbstractAdvancedSearchIntegrationTest.java delete mode 100644 caom2-search-server/examples/default/src/intTest/java/ca/nrc/cadc/search/integration/AbstractPreviewPage.java delete mode 100644 caom2-search-server/examples/default/src/intTest/java/ca/nrc/cadc/search/integration/AbstractSearchFormPage.java delete mode 100644 caom2-search-server/examples/default/src/intTest/java/ca/nrc/cadc/search/integration/BookmarkBrowserTest.java delete mode 100644 caom2-search-server/examples/default/src/intTest/java/ca/nrc/cadc/search/integration/CAOMObservationDetailsPage.java delete mode 100644 caom2-search-server/examples/default/src/intTest/java/ca/nrc/cadc/search/integration/CAOMSearchBrowserTest.java delete mode 100644 caom2-search-server/examples/default/src/intTest/java/ca/nrc/cadc/search/integration/CAOMSearchFormPage.java delete mode 100644 caom2-search-server/examples/default/src/intTest/java/ca/nrc/cadc/search/integration/FormInputBrowserTest.java delete mode 100644 caom2-search-server/examples/default/src/intTest/java/ca/nrc/cadc/search/integration/ResolverTooltipBrowserTest.java delete mode 100644 caom2-search-server/examples/default/src/intTest/java/ca/nrc/cadc/search/integration/SearchResultsPage.java delete mode 100644 caom2-search-server/examples/default/src/intTest/java/ca/nrc/cadc/search/integration/StartDateSearchLinkTest.java delete mode 100644 caom2-search-server/examples/default/src/intTest/java/ca/nrc/cadc/search/integration/UnauthorizedPreviewPage.java delete mode 100644 caom2-search-server/examples/default/src/main/webapp/META-INF/context.xml delete mode 100644 caom2-search-server/examples/default/src/main/webapp/WEB-INF/tags/c.tld delete mode 100644 caom2-search-server/examples/default/src/main/webapp/WEB-INF/tags/cadc/checkbox.tag delete mode 100644 caom2-search-server/examples/default/src/main/webapp/WEB-INF/tags/cadc/formName.tag delete mode 100644 caom2-search-server/examples/default/src/main/webapp/WEB-INF/tags/cadc/pulldown.tag delete mode 100644 caom2-search-server/examples/default/src/main/webapp/WEB-INF/tags/fmt.tld delete mode 100644 caom2-search-server/examples/default/src/main/webapp/WEB-INF/web.xml delete mode 100644 caom2-search-server/examples/default/src/main/webapp/_page_header.jsp delete mode 100644 caom2-search-server/examples/int-test/default-ssl.conf delete mode 100644 caom2-search-server/examples/int-test/default.conf delete mode 100644 caom2-search-server/examples/int-test/docker-compose-ssl.yml delete mode 100644 caom2-search-server/examples/int-test/docker-compose.yml delete mode 100644 caom2-search-server/examples/int-test/org.opencadc.search.env.properties diff --git a/caom2-search-server/.gitignore b/caom2-search-server/.gitignore index ca90175d..ef69af47 100644 --- a/caom2-search-server/.gitignore +++ b/caom2-search-server/.gitignore @@ -2,4 +2,3 @@ .gradle docker build -README.md diff --git a/caom2-search-server/CHANGELOG.md b/caom2-search-server/CHANGELOG.md index 31ebc79d..72ff2ae1 100644 --- a/caom2-search-server/CHANGELOG.md +++ b/caom2-search-server/CHANGELOG.md @@ -1,3 +1,7 @@ +## January 16, 2024 +### 2.15.3 +* Add LOTSS HiPS image survey to AladinLite Sky Viewer. + ## February 23, 2022 ### 2.13.8 * Add JWST in the Data Train order diff --git a/caom2-search-server/README.md b/caom2-search-server/README.md new file mode 100644 index 00000000..5dbafa95 --- /dev/null +++ b/caom2-search-server/README.md @@ -0,0 +1,56 @@ +# CAOM-2 Search interface Library v2.15.3 + + +This is the User Interface to perform complicated searches to a running +[TAP](http://www.ivoa.net/documents/TAP/) web service. + +## Building + +Simply run `gradle clean build` + +To have a constructed JAR file in the `build/libs` directory that can +be used to create a WAR to then be run in a Java Servlet Container. + +See the Properties File section below for properties to set, although it +is very recommended to leave them as their defaults. + +## Deployment options + +### Properties File + +Location: `config/org.opencadc.search.properties` + +Example content: +``` + # The TAP Service ID to resolve. + org.opencadc.search.tap-service-id = ivo://cadc.nrc.ca/argus + + # The endpoint for this application. + # org.opencadc.search.app-service-endpoint = /search + + # Whether to show the ObsCore tab + # org.opencadc.search.obs-core = true + + # Max row count for results + # org.opencadc.search.max-row-count = 10000 +``` + +## Running + +### In a Servlet Container + + +Simply drop the WAR into a Java Servlet Container, then point a browser +to: http://localhost:8080/search/ + +To bring up the form. By default, this will connect to the [CADC TAP +service](http://www.cadc-ccda.hia-iha.nrc-cnrc.gc.ca/tap), but can be +configured with the `org.opencadc.search.tap-service-id` system +property like so: + +``` +-Dca.nrc.cadc.reg.client.RegistryClient.host=%YOUR HOST% -Dorg.opencadc.search.tap-service-id=ivo://%YOUR DOMAIN%/tap-service +``` + +Where `%YOUR HOST%` is the location of a running TAP web service, and +the service id is made up of your Organization's service URI policy. diff --git a/caom2-search-server/README.rst b/caom2-search-server/README.rst deleted file mode 100644 index 7ea6fce9..00000000 --- a/caom2-search-server/README.rst +++ /dev/null @@ -1,69 +0,0 @@ -CAOM-2 Search interface v2.13.3 -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -This is the User Interface to perform complicated searches to a running -`TAP `__ web service. - -Building -~~~~~~~~ - -Simply run ``gradle clean build`` - -To have a constructed JAR file in the ``build/libs`` directory that can -be used to create a WAR to then be run in a Java Servlet Container. - -See the Properties File section below for properties to set, although it -is very recommended to leave them as their defaults. - -Deployment options -~~~~~~~~~~~~~~~~~~ - -Properties File -^^^^^^^^^^^^^^^ - -Location: config/org.opencadc.search.properties -''''''''''''''''''''''''''''''''''''''''''''''' - -Example content: -'''''''''''''''' - -:: - - # The TAP Service ID to resolve. - org.opencadc.search.tap-service-id = ivo://cadc.nrc.ca/argus - - # The endpoint for this application. - # org.opencadc.search.app-service-endpoint = /search - - # Whether to show the ObsCore tab - # org.opencadc.search.obs-core = true - - # Max row count for results - # org.opencadc.search.max-row-count = 10000 - - -Running -~~~~~~~ - -Running in a Servlet Container -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -Simply drop the WAR into a Java Servlet Container, then point a browser -to: http://localhost:8080/search/ - -To bring up the form. By default, this will connect to the `CADC TAP -service `__, but can be -configured with the ``org.opencadc.search.tap-service-id`` system -property like so: - -``-Dca.nrc.cadc.reg.client.RegistryClient.host=%YOUR HOST% -Dorg.opencadc.search.tap-service-id=ivo://%YOUR DOMAIN%/tap-service`` - -Where ``%YOUR HOST%`` is the location of a running TAP web service, and -the service id is made up of your Oragnization's service URI policy. - -Example implementation -^^^^^^^^^^^^^^^^^^^^^^ - -The `examples/default`_ folder contains an example implementation of the ``caom2-search-server`` library. - -.. _examples/default: examples/default \ No newline at end of file diff --git a/caom2-search-server/build.gradle b/caom2-search-server/build.gradle index 9c46a726..89e88098 100644 --- a/caom2-search-server/build.gradle +++ b/caom2-search-server/build.gradle @@ -12,7 +12,7 @@ repositories { dependencies { implementation 'com.opencsv:opencsv:[5.1,6.0)' implementation 'org.jdom:jdom2:2.0.6' - implementation 'org.json:json:20211205' + implementation 'org.json:json:20231013' implementation 'org.opencadc:cadc-registry:[1.5.6,2.0)' implementation 'org.opencadc:cadc-rest:[1.2.13,1.3)' implementation 'org.opencadc:caom2-search-lib:[2.5.1,2.6.0)' @@ -41,7 +41,7 @@ dependencies { apply from: '../opencadc.gradle' -def git_url = 'https://github.com/opencadc/caom2ui' +def git_url = 'https://github.com/opencadc/caom2ui.git' -version = '2.15.1' +version = '2.15.3' description = 'OpenCADC CAOM-2 search server library' diff --git a/caom2-search-server/examples/default/Dockerfile b/caom2-search-server/examples/default/Dockerfile deleted file mode 100644 index a8704f69..00000000 --- a/caom2-search-server/examples/default/Dockerfile +++ /dev/null @@ -1,19 +0,0 @@ -# Base Tomcat 8 JRE 8 image from CANFAR running on Alpine. -FROM opencadc/tomcat:8.5-alpine - -# Clear out the webapps directory. -RUN rm -rf webapps \ - && mkdir webapps - -# The SOURCE (first argument) is relative to this directory. The -# TARGET (second argument) is relative to the WORKDIR above. -# Absolute paths are not allowed from the SOURCE. -# -# For development purposes, pass the -v ${PATH_TO_LOCAL_BUILD_WAR_DIR}:/usr/local/tomcat/webapps to the run command -# -COPY build/libs/*.war webapps/ - -VOLUME /root/config - -COPY org.opencadc.search.properties /root/config/ -COPY reg-resource-caps.properties /root/config/ diff --git a/caom2-search-server/examples/default/build.gradle b/caom2-search-server/examples/default/build.gradle deleted file mode 100644 index aaaa81c5..00000000 --- a/caom2-search-server/examples/default/build.gradle +++ /dev/null @@ -1,49 +0,0 @@ -import org.apache.tools.ant.filters.ReplaceTokens - -plugins { - id 'maven' - id 'war' - - // IntelliJ IDEA plugin here to allow int - id 'idea' -} - -repositories { - mavenCentral() - mavenLocal() - jcenter() -} - -apply from: file('../../../int_test.gradle') - -dependencies { - compile 'org.opencadc:caom2-search-server:[2.13.2,)' - compile 'org.opencadc:cadc-uws-server:[1.2.1,)' - compile 'org.opencadc:cadc-registry:[1.5.0,)' - - testCompile 'org.opencadc:cadc-web-test:[2.1.2, )' - testCompile 'junit:junit:[4.12,)' - testCompile 'org.skyscreamer:jsonassert:[1.5.0,)' - testCompile 'org.easymock:easymock:[4.0.2,)' -} - -ext { - // Change this value to test other locations, such as Production or RC. - intTest_default_web_app_url = 'https://rc.cadc-ccda.hia-iha.nrc-cnrc.gc.ca/en/search/' - intTest_user_name = 'CADCtest' - intTest_user_password = 'sywymUL4' -} - -group = 'org.opencadc' -version = '2053' - -war { - // Trying to fix static file caching on new build. - eachFile { - if (it.name.endsWith(".jsp")) { - filter(ReplaceTokens, tokens: [version: project.version]) - } - } - - archiveName "search##" + project.version + ".war" -} diff --git a/caom2-search-server/examples/default/org.opencadc.search.properties b/caom2-search-server/examples/default/org.opencadc.search.properties deleted file mode 100644 index 6e487ec0..00000000 --- a/caom2-search-server/examples/default/org.opencadc.search.properties +++ /dev/null @@ -1,11 +0,0 @@ -# The TAP Service ID to resolve. -org.opencadc.search.tap-service-id = ivo://cadc.nrc.ca/argus - -# The endpoint for this application. -org.opencadc.search.app-service-endpoint = /search - -# Whether to show the ObsCore tab -org.opencadc.search.obs-core = false - -# Max row count for results -org.opencadc.search.max-row-count = 10000 diff --git a/caom2-search-server/examples/default/reg-resource-caps.properties b/caom2-search-server/examples/default/reg-resource-caps.properties deleted file mode 100644 index 1af2b682..00000000 --- a/caom2-search-server/examples/default/reg-resource-caps.properties +++ /dev/null @@ -1,6 +0,0 @@ -# -# This file maps resource identifiers to the location of capability -# information. -# - -ivo://cadc.nrc.ca/argus = http://www.cadc-ccda.hia-iha.nrc-cnrc.gc.ca/argus/capabilities \ No newline at end of file diff --git a/caom2-search-server/examples/default/src/intTest/java/ca/nrc/cadc/search/integration/AbstractAdvancedSearchIntegrationTest.java b/caom2-search-server/examples/default/src/intTest/java/ca/nrc/cadc/search/integration/AbstractAdvancedSearchIntegrationTest.java deleted file mode 100644 index 4af583c5..00000000 --- a/caom2-search-server/examples/default/src/intTest/java/ca/nrc/cadc/search/integration/AbstractAdvancedSearchIntegrationTest.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - ************************************************************************ - **** C A N A D I A N A S T R O N O M Y D A T A C E N T R E ***** - * - * (c) 2013. (c) 2013. - * National Research Council Conseil national de recherches - * Ottawa, Canada, K1A 0R6 Ottawa, Canada, K1A 0R6 - * All rights reserved Tous droits reserves - * - * NRC disclaims any warranties Le CNRC denie toute garantie - * expressed, implied, or statu- enoncee, implicite ou legale, - * tory, of any kind with respect de quelque nature que se soit, - * to the software, including concernant le logiciel, y com- - * without limitation any war- pris sans restriction toute - * ranty of merchantability or garantie de valeur marchande - * fitness for a particular pur- ou de pertinence pour un usage - * pose. NRC shall not be liable particulier. Le CNRC ne - * in any event for any damages, pourra en aucun cas etre tenu - * whether direct or indirect, responsable de tout dommage, - * special or general, consequen- direct ou indirect, particul- - * tial or incidental, arising ier ou general, accessoire ou - * from the use of the software. fortuit, resultant de l'utili- - * sation du logiciel. - * - * - * @author jenkinsd - * 12/13/13 - 1:44 PM - * - * - * - **** C A N A D I A N A S T R O N O M Y D A T A C E N T R E ***** - ************************************************************************ - */ - -package ca.nrc.cadc.search.integration; - - -import ca.nrc.cadc.web.selenium.AbstractWebApplicationIntegrationTest; - - -public abstract class AbstractAdvancedSearchIntegrationTest extends AbstractWebApplicationIntegrationTest { - AbstractAdvancedSearchIntegrationTest() { - super(); - setFailOnTimeout(true); - } -} diff --git a/caom2-search-server/examples/default/src/intTest/java/ca/nrc/cadc/search/integration/AbstractPreviewPage.java b/caom2-search-server/examples/default/src/intTest/java/ca/nrc/cadc/search/integration/AbstractPreviewPage.java deleted file mode 100644 index 95edf6ed..00000000 --- a/caom2-search-server/examples/default/src/intTest/java/ca/nrc/cadc/search/integration/AbstractPreviewPage.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - ************************************************************************ - ******************* CANADIAN ASTRONOMY DATA CENTRE ******************* - ************** CENTRE CANADIEN DE DONNÉES ASTRONOMIQUES ************** - * - * (c) 2017. (c) 2017. - * Government of Canada Gouvernement du Canada - * National Research Council Conseil national de recherches - * Ottawa, Canada, K1A 0R6 Ottawa, Canada, K1A 0R6 - * All rights reserved Tous droits réservés - * - * NRC disclaims any warranties, Le CNRC dénie toute garantie - * expressed, implied, or énoncée, implicite ou légale, - * statutory, of any kind with de quelque nature que ce - * respect to the software, soit, concernant le logiciel, - * including without limitation y compris sans restriction - * any warranty of merchantability toute garantie de valeur - * or fitness for a particular marchande ou de pertinence - * purpose. NRC shall not be pour un usage particulier. - * liable in any event for any Le CNRC ne pourra en aucun cas - * damages, whether direct or être tenu responsable de tout - * indirect, special or general, dommage, direct ou indirect, - * consequential or incidental, particulier ou général, - * arising from the use of the accessoire ou fortuit, résultant - * software. Neither the name de l'utilisation du logiciel. Ni - * of the National Research le nom du Conseil National de - * Council of Canada nor the Recherches du Canada ni les noms - * names of its contributors may de ses participants ne peuvent - * be used to endorse or promote être utilisés pour approuver ou - * products derived from this promouvoir les produits dérivés - * software without specific prior de ce logiciel sans autorisation - * written permission. préalable et particulière - * par écrit. - * - * This file is part of the Ce fichier fait partie du projet - * OpenCADC project. OpenCADC. - * - * OpenCADC is free software: OpenCADC est un logiciel libre ; - * you can redistribute it and/or vous pouvez le redistribuer ou le - * modify it under the terms of modifier suivant les termes de - * the GNU Affero General Public la “GNU Affero General Public - * License as published by the License” telle que publiée - * Free Software Foundation, par la Free Software Foundation - * either version 3 of the : soit la version 3 de cette - * License, or (at your option) licence, soit (à votre gré) - * any later version. toute version ultérieure. - * - * OpenCADC is distributed in the OpenCADC est distribué - * hope that it will be useful, dans l’espoir qu’il vous - * but WITHOUT ANY WARRANTY; sera utile, mais SANS AUCUNE - * without even the implied GARANTIE : sans même la garantie - * warranty of MERCHANTABILITY implicite de COMMERCIALISABILITÉ - * or FITNESS FOR A PARTICULAR ni d’ADÉQUATION À UN OBJECTIF - * PURPOSE. See the GNU Affero PARTICULIER. Consultez la Licence - * General Public License for Générale Publique GNU Affero - * more details. pour plus de détails. - * - * You should have received Vous devriez avoir reçu une - * a copy of the GNU Affero copie de la Licence Générale - * General Public License along Publique GNU Affero avec - * with OpenCADC. If not, see OpenCADC ; si ce n’est - * . pas le cas, consultez : - * . - * - * - ************************************************************************ - */ - -package ca.nrc.cadc.search.integration; - -import ca.nrc.cadc.web.selenium.AbstractTestWebPage; -import org.openqa.selenium.WebDriver; - -public abstract class AbstractPreviewPage extends AbstractTestWebPage -{ - public AbstractPreviewPage(final WebDriver driver) throws Exception - { - super(driver); - - waitForPageLoad(); - } - - abstract void waitForPageLoad() throws Exception; -} diff --git a/caom2-search-server/examples/default/src/intTest/java/ca/nrc/cadc/search/integration/AbstractSearchFormPage.java b/caom2-search-server/examples/default/src/intTest/java/ca/nrc/cadc/search/integration/AbstractSearchFormPage.java deleted file mode 100644 index 0591b299..00000000 --- a/caom2-search-server/examples/default/src/intTest/java/ca/nrc/cadc/search/integration/AbstractSearchFormPage.java +++ /dev/null @@ -1,230 +0,0 @@ -/* - ************************************************************************ - ******************* CANADIAN ASTRONOMY DATA CENTRE ******************* - ************** CENTRE CANADIEN DE DONNÉES ASTRONOMIQUES ************** - * - * (c) 2016. (c) 2016. - * Government of Canada Gouvernement du Canada - * National Research Council Conseil national de recherches - * Ottawa, Canada, K1A 0R6 Ottawa, Canada, K1A 0R6 - * All rights reserved Tous droits réservés - * - * NRC disclaims any warranties, Le CNRC dénie toute garantie - * expressed, implied, or énoncée, implicite ou légale, - * statutory, of any kind with de quelque nature que ce - * respect to the software, soit, concernant le logiciel, - * including without limitation y compris sans restriction - * any warranty of merchantability toute garantie de valeur - * or fitness for a particular marchande ou de pertinence - * purpose. NRC shall not be pour un usage particulier. - * liable in any event for any Le CNRC ne pourra en aucun cas - * damages, whether direct or être tenu responsable de tout - * indirect, special or general, dommage, direct ou indirect, - * consequential or incidental, particulier ou général, - * arising from the use of the accessoire ou fortuit, résultant - * software. Neither the name de l'utilisation du logiciel. Ni - * of the National Research le nom du Conseil National de - * Council of Canada nor the Recherches du Canada ni les noms - * names of its contributors may de ses participants ne peuvent - * be used to endorse or promote être utilisés pour approuver ou - * products derived from this promouvoir les produits dérivés - * software without specific prior de ce logiciel sans autorisation - * written permission. préalable et particulière - * par écrit. - * - * This file is part of the Ce fichier fait partie du projet - * OpenCADC project. OpenCADC. - * - * OpenCADC is free software: OpenCADC est un logiciel libre ; - * you can redistribute it and/or vous pouvez le redistribuer ou le - * modify it under the terms of modifier suivant les termes de - * the GNU Affero General Public la “GNU Affero General Public - * License as published by the License” telle que publiée - * Free Software Foundation, par la Free Software Foundation - * either version 3 of the : soit la version 3 de cette - * License, or (at your option) licence, soit (à votre gré) - * any later version. toute version ultérieure. - * - * OpenCADC is distributed in the OpenCADC est distribué - * hope that it will be useful, dans l’espoir qu’il vous - * but WITHOUT ANY WARRANTY; sera utile, mais SANS AUCUNE - * without even the implied GARANTIE : sans même la garantie - * warranty of MERCHANTABILITY implicite de COMMERCIALISABILITÉ - * or FITNESS FOR A PARTICULAR ni d’ADÉQUATION À UN OBJECTIF - * PURPOSE. See the GNU Affero PARTICULIER. Consultez la Licence - * General Public License for Générale Publique GNU Affero - * more details. pour plus de détails. - * - * You should have received Vous devriez avoir reçu une - * a copy of the GNU Affero copie de la Licence Générale - * General Public License along Publique GNU Affero avec - * with OpenCADC. If not, see OpenCADC ; si ce n’est - * . pas le cas, consultez : - * . - * - * - ************************************************************************ - */ - -package ca.nrc.cadc.search.integration; - -import ca.nrc.cadc.web.selenium.AbstractTestWebPage; -import org.openqa.selenium.By; -import org.openqa.selenium.WebDriver; -import org.openqa.selenium.WebElement; -import org.openqa.selenium.support.FindBy; -import org.openqa.selenium.support.PageFactory; - -import java.util.Objects; - - -abstract class AbstractSearchFormPage extends AbstractTestWebPage { - private static final String CONTENT_LOCATOR_XPATH = "//*[@id='%s']/summary/label/span"; - private static final By TOP_RESET_BUTTON_BY = By.xpath("//*[@id=\"queryForm\"]/div[1]/button[@type=\"reset\"]"); - - @FindBy(xpath = "//*[@id=\"queryForm\"]/div[1]/button[@type=\"submit\"]") - WebElement topSubmitButton; - - - AbstractSearchFormPage(final WebDriver driver) throws Exception { - super(driver); - - waitForElementPresent(TOP_RESET_BUTTON_BY); - waitForElementVisible(TOP_RESET_BUTTON_BY); - PageFactory.initElements(driver, this); - } - - AbstractSearchFormPage(WebDriver driver, int timeoutInSeconds) throws Exception { - super(driver, timeoutInSeconds); - - waitForElementPresent(TOP_RESET_BUTTON_BY); - waitForElementVisible(TOP_RESET_BUTTON_BY); - PageFactory.initElements(driver, this); - } - - - void enterInputValue(final WebElement inputElement, final String value) throws Exception { - final String inputID = inputElement.getAttribute("id"); - - summonTooltip(inputID); - showInputField(inputID); - waitForElementVisible(inputElement); - - for (int i = 0; i < value.length(); i++) { - inputElement.sendKeys(Character.toString(value.charAt(i))); - waitFor(150L); - } - - closeTooltip(); - } - - void clearInputValue(final String inputID) throws Exception { - final WebElement inputElement = find(By.id(inputID)); - - if (inputElement.isDisplayed()) { - sendKeys(inputElement, ""); - hideInputField(inputID); - } else { - throw new IllegalStateException("Input element " + inputID + " is not displayed."); - } - } - - void verifyFormInputError(final String inputID) throws Exception { - waitForElementPresent(By.xpath("//div[@id='" + inputID - + "_input_decorate'][contains(@class,'has-error')]")); - } - - void verifyFormInputMessage(final String inputID, final boolean errorExpected, final String expectedMessage) - throws Exception { - if (errorExpected) { - verifyFormInputError(inputID); - } - - final By contents = By.xpath(String.format(CONTENT_LOCATOR_XPATH, (inputID + "_details"))); - - if (!Objects.equals(expectedMessage, "")) { - waitForTextPresent(contents, expectedMessage); - } else { - WebElement contentEl = find(contents); - if (!contentEl.getText().equals("")) { - throw new Exception(); - } - } - } - - - void verifyFormInputMessageMatches(final String inputID, final boolean errorExpected, - final String messageRegex) throws Exception { - if (errorExpected) { - verifyFormInputError(inputID); - } - - verifyTextMatches(By.xpath(String.format(CONTENT_LOCATOR_XPATH, (inputID + "_details"))), messageRegex); - } - - void hideInputBox(final String inputID) throws Exception { - click(By.xpath(String.format(CONTENT_LOCATOR_XPATH, (inputID + "_details")))); - waitForElementInvisible(By.id(inputID)); - } - - void summonTooltip(final String baseID) throws Exception { - final By tooltipIconTriggerBy = By.xpath("//div[@id='" + baseID + "_formgroup']/div"); - - waitForElementPresent(tooltipIconTriggerBy); - waitForElementVisible(tooltipIconTriggerBy); - - click(tooltipIconTriggerBy); - - waitForElementPresent(By.xpath("//div[@id='" + baseID + "_formgroup']/div[2]")); - waitForElementVisible(By.xpath("//div[@id='" + baseID + "_formgroup']/div[2]")); - } - - void closeTooltip() throws Exception { - final By tooltipCloseLink = By.xpath("//*[contains(@class, 'glyphicon-remove-circle')]"); - waitForElementPresent(tooltipCloseLink); - final WebElement tooltipClose = find(tooltipCloseLink); - click(tooltipClose); - } - - - /** - * Ensure the field is open. - * - * @param inputID The String ID locator. - * @throws Exception Any error. - */ - void showInputField(final String inputID) throws Exception { - final WebElement element = find(By.id(inputID + "_details")); - - if (!find(By.id(inputID)).isDisplayed()) { - // show the input box - click(element); - } - } - - /** - * Ensure the field is open. - * - * @param inputID The String ID locator. - * @throws Exception Any error. - */ - void hideInputField(final String inputID) throws Exception { - final WebElement element = find(By.id(inputID + "_details")); - - if (find(By.id(inputID)).isDisplayed()) { - // show the input box - click(element); - } - } - - SearchResultsPage submitSuccess() throws Exception { - click(topSubmitButton); - - return new SearchResultsPage(driver); - } - - void reset() throws Exception { - click(TOP_RESET_BUTTON_BY); - } - -} diff --git a/caom2-search-server/examples/default/src/intTest/java/ca/nrc/cadc/search/integration/BookmarkBrowserTest.java b/caom2-search-server/examples/default/src/intTest/java/ca/nrc/cadc/search/integration/BookmarkBrowserTest.java deleted file mode 100644 index 84a8a22c..00000000 --- a/caom2-search-server/examples/default/src/intTest/java/ca/nrc/cadc/search/integration/BookmarkBrowserTest.java +++ /dev/null @@ -1,118 +0,0 @@ -/* - ************************************************************************ - **** C A N A D I A N A S T R O N O M Y D A T A C E N T R E ***** - * - * (c) 2014. (c) 2014. - * National Research Council Conseil national de recherches - * Ottawa, Canada, K1A 0R6 Ottawa, Canada, K1A 0R6 - * All rights reserved Tous droits reserves - * - * NRC disclaims any warranties Le CNRC denie toute garantie - * expressed, implied, or statu- enoncee, implicite ou legale, - * tory, of any kind with respect de quelque nature que se soit, - * to the software, including concernant le logiciel, y com- - * without limitation any war- pris sans restriction toute - * ranty of merchantability or garantie de valeur marchande - * fitness for a particular pur- ou de pertinence pour un usage - * pose. NRC shall not be liable particulier. Le CNRC ne - * in any event for any damages, pourra en aucun cas etre tenu - * whether direct or indirect, responsable de tout dommage, - * special or general, consequen- direct ou indirect, particul- - * tial or incidental, arising ier ou general, accessoire ou - * from the use of the software. fortuit, resultant de l'utili- - * sation du logiciel. - * - * - * @author jenkinsd - * 23/05/14 - 8:57 AM - * - * - * - **** C A N A D I A N A S T R O N O M Y D A T A C E N T R E ***** - ************************************************************************ - */ -package ca.nrc.cadc.search.integration; - - -import org.junit.Test; - - -public class BookmarkBrowserTest extends AbstractAdvancedSearchIntegrationTest -{ - private static final String BOOKMARK_QUERY_STRING_1 = - "Plane.position.bounds=M17#sortCol=Start%20Date&sortDir=dsc&col_1=_checkbox_selector;;;&col_2=Preview;;;&col_3=Obs.%20ID;;;&col_4=Filter;;;&col_5=RA%20(J2000.0);;;&col_6=Dec.%20(J2000.0);;;&col_7=Target%20Name;;;&col_8=Int.%20Time;;;&col_9=Collection;;;&col_10=Start%20Date;;;&col_11=IQ;;;&col_12=Instrument;;;"; - private static final String BOOKMARK_QUERY_STRING_2 = - "Observation.proposal.id=M11BU16&Observation.collection=JCMT#sortCol=Start%20Date&sortDir=dsc&col_1=_checkbox_selector;;;&col_2=Rest-frame%20Energy;;;&col_3=Target%20Name;;;&col_4=RA%20(J2000.0);;;&col_5=Dec.%20(J2000.0);;;&col_6=Proposal%20ID;;;&col_7=Start%20Date;;;&col_8=Sequence%20Number;;;&col_9=Instrument;;;&col_10=Preview;;;&col_11=Molecule;;;&col_12=Transition;;;&col_13=Filter;;;&col_14=Int.%20Time;;;&col_15=Field%20of%20View;;;&col_16=Instrument%20Keywords;;;&col_17=Obs.%20Type;;;&col_18=Intent;;;&col_19=Moving%20Target;;;&col_20=Algorithm%20Name;;;&col_21=Product%20ID;;;&col_22=Data%20Type;;;"; - - // Querying non-form input fields for Story 2107. - private static final String BOOKMARK_QUERY_STRING_3 = "Observation.proposal.project=OSSOS"; - - - public BookmarkBrowserTest() throws Exception - { - super(); - } - - //TODO: uncomment when implementation is complete - //@Test - public void bookmarkTestM17() throws Exception - { - final SearchResultsPage searchResultsPage = bookmarkSearch(BOOKMARK_QUERY_STRING_1); - - // Ensure presence. - verifyFalse(searchResultsPage.getIQColumnHeader() == null); - - searchResultsPage.queryTab(); - } - - //TODO: uncomment when implementation is complete - //@Test - public void bookmarkTestM11BU16() throws Exception - { - final SearchResultsPage searchResultsPage = bookmarkSearch(BOOKMARK_QUERY_STRING_2); - - // Ensure presence. - verifyFalse(searchResultsPage.getRestFrameEnergyColumnHeader() == null); - - searchResultsPage.queryTab(); - } - - //TODO: uncomment when implementation is complete - //@Test - public void bookmarkTestProposalProject() throws Exception - { - final SearchResultsPage searchResultsPage = bookmarkSearch(BOOKMARK_QUERY_STRING_3); - - searchResultsPage.includeHiddenColumn("caom2:Observation.proposal.project"); - searchResultsPage.confirmProposalProjectColumnHeader(); - - // Ensure presence. - - searchResultsPage.queryTab(); - } - - //TODO: uncomment when implementation is complete - //@Test - public void quickSearchTarget() throws Exception - { - final SearchResultsPage resolvedSearchResultsPage = bookmarkSearch("Plane.position.bounds=m101"); - resolvedSearchResultsPage.verifyGridHeaderLabelHasIntegerValue(true); - } - - //TODO: uncomment when implementation is complete - //@Test - public void quickSearchCollection() throws Exception - { - final SearchResultsPage collectionSearchResultsPage = bookmarkSearch("collection=IRIS"); - collectionSearchResultsPage.verifyGridHeaderLabelHasIntegerValue(true); - } - - private SearchResultsPage bookmarkSearch(final String requestQuery) throws Exception - { - final SearchResultsPage searchResultsPage = goTo(webURL, "", requestQuery, SearchResultsPage.class); - - searchResultsPage.verifyGridHeaderLabelHasIntegerValue(true); - - return searchResultsPage; - } -} diff --git a/caom2-search-server/examples/default/src/intTest/java/ca/nrc/cadc/search/integration/CAOMObservationDetailsPage.java b/caom2-search-server/examples/default/src/intTest/java/ca/nrc/cadc/search/integration/CAOMObservationDetailsPage.java deleted file mode 100644 index 68313e57..00000000 --- a/caom2-search-server/examples/default/src/intTest/java/ca/nrc/cadc/search/integration/CAOMObservationDetailsPage.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - ************************************************************************ - ******************* CANADIAN ASTRONOMY DATA CENTRE ******************* - ************** CENTRE CANADIEN DE DONNÉES ASTRONOMIQUES ************** - * - * (c) 2016. (c) 2016. - * Government of Canada Gouvernement du Canada - * National Research Council Conseil national de recherches - * Ottawa, Canada, K1A 0R6 Ottawa, Canada, K1A 0R6 - * All rights reserved Tous droits réservés - * - * NRC disclaims any warranties, Le CNRC dénie toute garantie - * expressed, implied, or énoncée, implicite ou légale, - * statutory, of any kind with de quelque nature que ce - * respect to the software, soit, concernant le logiciel, - * including without limitation y compris sans restriction - * any warranty of merchantability toute garantie de valeur - * or fitness for a particular marchande ou de pertinence - * purpose. NRC shall not be pour un usage particulier. - * liable in any event for any Le CNRC ne pourra en aucun cas - * damages, whether direct or être tenu responsable de tout - * indirect, special or general, dommage, direct ou indirect, - * consequential or incidental, particulier ou général, - * arising from the use of the accessoire ou fortuit, résultant - * software. Neither the name de l'utilisation du logiciel. Ni - * of the National Research le nom du Conseil National de - * Council of Canada nor the Recherches du Canada ni les noms - * names of its contributors may de ses participants ne peuvent - * be used to endorse or promote être utilisés pour approuver ou - * products derived from this promouvoir les produits dérivés - * software without specific prior de ce logiciel sans autorisation - * written permission. préalable et particulière - * par écrit. - * - * This file is part of the Ce fichier fait partie du projet - * OpenCADC project. OpenCADC. - * - * OpenCADC is free software: OpenCADC est un logiciel libre ; - * you can redistribute it and/or vous pouvez le redistribuer ou le - * modify it under the terms of modifier suivant les termes de - * the GNU Affero General Public la “GNU Affero General Public - * License as published by the License” telle que publiée - * Free Software Foundation, par la Free Software Foundation - * either version 3 of the : soit la version 3 de cette - * License, or (at your option) licence, soit (à votre gré) - * any later version. toute version ultérieure. - * - * OpenCADC is distributed in the OpenCADC est distribué - * hope that it will be useful, dans l’espoir qu’il vous - * but WITHOUT ANY WARRANTY; sera utile, mais SANS AUCUNE - * without even the implied GARANTIE : sans même la garantie - * warranty of MERCHANTABILITY implicite de COMMERCIALISABILITÉ - * or FITNESS FOR A PARTICULAR ni d’ADÉQUATION À UN OBJECTIF - * PURPOSE. See the GNU Affero PARTICULIER. Consultez la Licence - * General Public License for Générale Publique GNU Affero - * more details. pour plus de détails. - * - * You should have received Vous devriez avoir reçu une - * a copy of the GNU Affero copie de la Licence Générale - * General Public License along Publique GNU Affero avec - * with OpenCADC. If not, see OpenCADC ; si ce n’est - * . pas le cas, consultez : - * . - * - * - ************************************************************************ - */ - -package ca.nrc.cadc.search.integration; - -import ca.nrc.cadc.web.selenium.AbstractTestWebPage; -import org.openqa.selenium.By; -import org.openqa.selenium.WebDriver; - - -class CAOMObservationDetailsPage extends AbstractTestWebPage -{ - private static final By H1_HEADER = By.cssSelector("h1"); - private static final String WINDOW_ID = "_observation_details"; - - - CAOMObservationDetailsPage(final WebDriver driver) throws Exception - { - super(driver); - - selectWindow(WINDOW_ID); - waitForTextPresent(H1_HEADER, "Common Archive Observation Model (CAOM"); - } - - void close() throws Exception - { - closeWindow(WINDOW_ID); - } -} diff --git a/caom2-search-server/examples/default/src/intTest/java/ca/nrc/cadc/search/integration/CAOMSearchBrowserTest.java b/caom2-search-server/examples/default/src/intTest/java/ca/nrc/cadc/search/integration/CAOMSearchBrowserTest.java deleted file mode 100644 index 04867a1b..00000000 --- a/caom2-search-server/examples/default/src/intTest/java/ca/nrc/cadc/search/integration/CAOMSearchBrowserTest.java +++ /dev/null @@ -1,227 +0,0 @@ -/* - ************************************************************************ - **** C A N A D I A N A S T R O N O M Y D A T A C E N T R E ***** - * - * (c) 2014. (c) 2014. - * National Research Council Conseil national de recherches - * Ottawa, Canada, K1A 0R6 Ottawa, Canada, K1A 0R6 - * All rights reserved Tous droits reserves - * - * NRC disclaims any warranties Le CNRC denie toute garantie - * expressed, implied, or statu- enoncee, implicite ou legale, - * tory, of any kind with respect de quelque nature que se soit, - * to the software, including concernant le logiciel, y com- - * without limitation any war- pris sans restriction toute - * ranty of merchantability or garantie de valeur marchande - * fitness for a particular pur- ou de pertinence pour un usage - * pose. NRC shall not be liable particulier. Le CNRC ne - * in any event for any damages, pourra en aucun cas etre tenu - * whether direct or indirect, responsable de tout dommage, - * special or general, consequen- direct ou indirect, particul- - * tial or incidental, arising ier ou general, accessoire ou - * from the use of the software. fortuit, resultant de l'utili- - * sation du logiciel. - * - * - * @author jenkinsd - * 15/05/14 - 1:19 PM - * - * - * - **** C A N A D I A N A S T R O N O M Y D A T A C E N T R E ***** - ************************************************************************ - */ - -package ca.nrc.cadc.search.integration; - - -import org.junit.Test; -import org.openqa.selenium.By; - - -public class CAOMSearchBrowserTest extends AbstractAdvancedSearchIntegrationTest { - private static final By ONE_CLICK_DOWNLOAD_LINK_ROW_3_ID_BY = By.id("_one-click_vov_3"); - - - public CAOMSearchBrowserTest() { - super(); - } - - - @Test - public void searchCAOM() throws Exception { - CAOMSearchFormPage searchFormPage = goToMain(CAOMSearchFormPage.class); - - searchFormPage.enterObservationID("692512"); - searchFormPage.enterValidTarget("210.05 54.3"); - - searchFormPage.reset(); - - final int index = searchFormPage.findDataTrainValueIndex(By.id("Observation.instrument.name"), "SPACER", - false); - - verifyTrue(index > 0); - - // s2455 results in the viewer not showing JCMT specific columns after - // a previous search in a different archive. JB 2019.06.03 - //searchFormPage.enterTarget("M17"); - //searchFormPage.enterCollection("JCMT"); - // - //searchResultsPage = searchFormPage.submitSuccess(); - //verifyEquals(searchResultsPage.getSelectedRestFrameEnergyUnit(), "m"); - // - //searchFormPage = searchResultsPage.queryTab(); - //searchFormPage.reset(); - - searchFormPage.enterCollection("CFHTMEGAPIPE"); - SearchResultsPage searchResultsPage = searchFormPage.submitSuccess(); - - verifyEquals(searchResultsPage.getSelectIQUnit(), "Arcseconds"); - - searchFormPage = searchResultsPage.queryTab(); - searchFormPage.reset(); - - searchFormPage.enterCollection("IRIS"); - searchResultsPage = searchFormPage.submitSuccess(); - verifyTrue(searchResultsPage.getCurrentResultsRowCount() > 0); - - searchResultsPage.ensureMarkAllCheckboxVisible(); - searchResultsPage.filterOnRA("18:03..18:07"); - searchResultsPage.includeHiddenColumn("caom2:Observation.target.keywords"); - - // Nav back to query tab for next test - searchFormPage = searchResultsPage.queryTab(); - searchFormPage.reset(); - - // Do this test last as the quickSearchTarget download can tie up a TAP - // service on slower machines - searchFormPage.enterObservationID("f008h000"); - - searchResultsPage = searchFormPage.submitSuccess(); - - searchResultsPage.waitForElementPresent(ONE_CLICK_DOWNLOAD_LINK_ROW_3_ID_BY); - searchResultsPage.confirmFootprintViewer(); - - final String currentWindow = getCurrentWindowHandle(); - - final CAOMObservationDetailsPage detailsPage = searchResultsPage.openObservationDetails(1); - - detailsPage.waitForElementPresent(By.cssSelector("table.content")); - detailsPage.close(); - - selectWindow(currentWindow); - - searchResultsPage.quickSearchTarget(); - - selectWindow(currentWindow); - - System.out.println("searchCAOM test complete."); - - /* - TODO - Complete for new Page Object model going forward. - TODO - jenkinsd 2016.02.16 - */ - - /* - verifyEquals("18:03:48.78", - find(By.xpath( - "//div[@id='resultTable']/div[5]/div[3]/div/div/div[4]/span")). - getText()); - - // Dec. column - inputTextValue(DEC_FILTER_BY, "< 70:00"); - waitFor(3); - - verifyText(By.xpath("//div[@id='resultTable']/div[5]/div[3]/div/div/div[5]/span"), - "-49:59:07.6"); - - waitOneSecond(); - inputTextValue(RA_FILTER_BY, ""); - inputTextValue(DEC_FILTER_BY, ""); - waitOneSecond(); - - scrollGridHorizontally("resultTable"); - inputTextValue(FILTER_FILTER_BY, "10", true, false); - - waitFor(2); - verifyText(By.xpath("//div[@id='resultTable']/div[5]/div[3]/div/div[2]/div[10]/span"), - "IRAS-100um"); - - inputTextValue(FILTER_FILTER_BY, ""); - - click(COLUMN_MANAGER_BUTTON_BY); - - waitOneSecond(); - - click(PI_NAME_COLUMN_ADD_BY); - waitOneSecond(); - - if (!getInternetBrowserCommand().equals("*safari")) - { - hover(By.xpath("//span[@class='slick-column-name'][contains(text(), \"Collection\")]")); - } - - waitFor(2); - - verifyElementPresent(By.className("votable_link_votable")); - verifyElementPresent(By.className("votable_link_csv")); - verifyElementPresent(By.className("votable_link_tsv")); - - // Next search. - queryTab(); - resetForm(); - waitFor(2); - - // observerationID of proprietary data - inputTextValue(OBSERVATION_ID_FORM_FIELD_BY, - "Observation.observationID_details", "1692420"); - - searchAndWait(true, true); - - // data release of proprietary data - queryTab(); - resetForm(); - waitFor(2); - - // Open it. - toggleDetailsItem("Plane.dataRelease_details"); - final By publicCheckboxBy = - By.id("Plane.dataRelease@PublicTimestampFormConstraint.value"); - checkboxOn(publicCheckboxBy); - verifyFalse(find( - By.id("Plane.dataRelease")).isEnabled()); - inputTextValue(OBSERVATION_ID_FORM_FIELD_BY, - "Observation.observationID_details", "f008h000"); - - searchAndWait(true, true); - - adqlTab(); - verifyTrue(find( - By.id("query")).getText().contains("Plane.dataRelease <=")); - - // Do authenticated stuff. - - login(); - - waitFor(5); - queryTab(); - waitForElementPresent(By.id("Observation.type")); - resetForm(); - waitFor(2); - - // observationID of proprietary data - inputTextValue(OBSERVATION_ID_FORM_FIELD_BY, - "Observation.observationID_details", "1692420"); - - searchAndWait(true, true); - - click(COLUMN_MANAGER_BUTTON_BY); - waitForElementPresent( - By.id(COLUMN_PICKER_AVAILABLE_ITEMS_CONTAINER_ID)); - - waitOneSecond(); - - logout(); - */ - } -} diff --git a/caom2-search-server/examples/default/src/intTest/java/ca/nrc/cadc/search/integration/CAOMSearchFormPage.java b/caom2-search-server/examples/default/src/intTest/java/ca/nrc/cadc/search/integration/CAOMSearchFormPage.java deleted file mode 100644 index e6a28a3b..00000000 --- a/caom2-search-server/examples/default/src/intTest/java/ca/nrc/cadc/search/integration/CAOMSearchFormPage.java +++ /dev/null @@ -1,236 +0,0 @@ -/* - ************************************************************************ - ******************* CANADIAN ASTRONOMY DATA CENTRE ******************* - ************** CENTRE CANADIEN DE DONNÉES ASTRONOMIQUES ************** - * - * (c) 2016. (c) 2016. - * Government of Canada Gouvernement du Canada - * National Research Council Conseil national de recherches - * Ottawa, Canada, K1A 0R6 Ottawa, Canada, K1A 0R6 - * All rights reserved Tous droits réservés - * - * NRC disclaims any warranties, Le CNRC dénie toute garantie - * expressed, implied, or énoncée, implicite ou légale, - * statutory, of any kind with de quelque nature que ce - * respect to the software, soit, concernant le logiciel, - * including without limitation y compris sans restriction - * any warranty of merchantability toute garantie de valeur - * or fitness for a particular marchande ou de pertinence - * purpose. NRC shall not be pour un usage particulier. - * liable in any event for any Le CNRC ne pourra en aucun cas - * damages, whether direct or être tenu responsable de tout - * indirect, special or general, dommage, direct ou indirect, - * consequential or incidental, particulier ou général, - * arising from the use of the accessoire ou fortuit, résultant - * software. Neither the name de l'utilisation du logiciel. Ni - * of the National Research le nom du Conseil National de - * Council of Canada nor the Recherches du Canada ni les noms - * names of its contributors may de ses participants ne peuvent - * be used to endorse or promote être utilisés pour approuver ou - * products derived from this promouvoir les produits dérivés - * software without specific prior de ce logiciel sans autorisation - * written permission. préalable et particulière - * par écrit. - * - * This file is part of the Ce fichier fait partie du projet - * OpenCADC project. OpenCADC. - * - * OpenCADC is free software: OpenCADC est un logiciel libre ; - * you can redistribute it and/or vous pouvez le redistribuer ou le - * modify it under the terms of modifier suivant les termes de - * the GNU Affero General Public la “GNU Affero General Public - * License as published by the License” telle que publiée - * Free Software Foundation, par la Free Software Foundation - * either version 3 of the : soit la version 3 de cette - * License, or (at your option) licence, soit (à votre gré) - * any later version. toute version ultérieure. - * - * OpenCADC is distributed in the OpenCADC est distribué - * hope that it will be useful, dans l’espoir qu’il vous - * but WITHOUT ANY WARRANTY; sera utile, mais SANS AUCUNE - * without even the implied GARANTIE : sans même la garantie - * warranty of MERCHANTABILITY implicite de COMMERCIALISABILITÉ - * or FITNESS FOR A PARTICULAR ni d’ADÉQUATION À UN OBJECTIF - * PURPOSE. See the GNU Affero PARTICULIER. Consultez la Licence - * General Public License for Générale Publique GNU Affero - * more details. pour plus de détails. - * - * You should have received Vous devriez avoir reçu une - * a copy of the GNU Affero copie de la Licence Générale - * General Public License along Publique GNU Affero avec - * with OpenCADC. If not, see OpenCADC ; si ce n’est - * . pas le cas, consultez : - * . - * - * - ************************************************************************ - */ - -package ca.nrc.cadc.search.integration; - - -import org.apache.log4j.Logger; -import org.openqa.selenium.By; -import org.openqa.selenium.WebDriver; -import org.openqa.selenium.WebElement; -import org.openqa.selenium.support.FindBy; -import org.openqa.selenium.support.PageFactory; -import org.openqa.selenium.support.ui.Select; -import org.openqa.selenium.support.ui.ExpectedConditions; -import org.openqa.selenium.support.ui.WebDriverWait; - -import java.util.List; - - -public class CAOMSearchFormPage extends AbstractSearchFormPage -{ - private static final Logger LOGGER = Logger.getLogger(CAOMSearchFormPage.class); - - private static final int DEFAULT_TIMEOUT_IN_SECONDS = 25; - private static final By H1_HEADER = By.cssSelector("h1"); - - static final By COOKIE_BANNER_BUTTON = By.id("cookies_accept"); - static final By DATA_TRAIN_LOCATOR = By.id("caom2_data_train"); - static final By DATA_TRAIN_COLLECTION_MENU = By.id("Observation.collection"); - static final By DATA_TRAIN_INSTRUMENT_MENU = By.id("Observation.instrument.name"); - static final By TARGET_INPUT = By.id("Plane.position.bounds"); - static final By TARGET_FORM_GROUP = By.id("Plane.position.bounds_details"); - static final By TARGET_RESOLUTION_STATUS_ICON_BY = By.className("target_name_resolution_status"); - static final By TARGET_RESOLUTION_STATUS_GOOD_ICON_BY = By.className("target_ok"); - static final By TARGET_RESOLUTION_POPOVER_BY = By.className("resolver-popover"); - static final By SSOIS_LINK_BY = By.id("ssois_link"); - static final String SPECTRAL_COVERAGE_INPUT_ID = "Plane.energy.bounds.samples"; - static final String OBSERVATION_DATE_INPUT_ID = "Plane.time.bounds.samples"; - static final String PIXEL_SCALE_INPUT_ID = "Plane.position.sampleSize"; - static final By RESET_BUTTON_SELECTOR = By.cssSelector("button[type=\"reset\"]"); - - @FindBy(id = "caom2_data_train") - WebElement dataTrain; - - @FindBy(id = "Observation.observationID") - WebElement observationIDInput; - - @FindBy(id = "Plane.position.bounds") - WebElement targetInput; - - @FindBy(id = "Plane.energy.bounds.samples") - WebElement spectralCoverageInput; - - @FindBy(id = "Plane.time.bounds.samples") - WebElement observationDateInput; - - @FindBy(id = "ssois_link") - WebElement ssoisLink; - - /** - * Constructors need to be public for reflection to find them. - * - * @param driver WebDriver instance. - * @throws Exception Any errors. - */ - public CAOMSearchFormPage(final WebDriver driver) throws Exception - { - super(driver, DEFAULT_TIMEOUT_IN_SECONDS); - - - waitForElementPresent(TARGET_INPUT); - waitForElementPresent(By.id(SPECTRAL_COVERAGE_INPUT_ID)); - waitForElementPresent(By.id(OBSERVATION_DATE_INPUT_ID)); - waitForElementPresent(SSOIS_LINK_BY); - waitForElementPresent(By.id("Observation.observationID")); - waitForElementPresent(DATA_TRAIN_LOCATOR); - WebElement myDynamicElement = (new WebDriverWait(driver, 30)) - .until(ExpectedConditions.presenceOfElementLocated(DATA_TRAIN_COLLECTION_MENU)); - waitForElementPresent(DATA_TRAIN_COLLECTION_MENU); - - PageFactory.initElements(driver, this); - } - - void enterObservationID(final String observationIDValue) throws Exception - { - enterInputValue(observationIDInput, observationIDValue); - } - - void enterTarget(final String targetValue) throws Exception - { - enterInputValue(targetInput, targetValue); - } - - void enterValidTarget(final String targetValue) throws Exception - { - enterTarget(targetValue); - confirmResolverOK(); - } - - void confirmResolverOK() throws Exception - { - waitForElementPresent(TARGET_RESOLUTION_STATUS_ICON_BY); - waitForElementVisible(TARGET_RESOLUTION_STATUS_ICON_BY); - waitForElementPresent(TARGET_RESOLUTION_STATUS_GOOD_ICON_BY); - waitForElementVisible(TARGET_RESOLUTION_STATUS_GOOD_ICON_BY); - waitForElementPresent(TARGET_RESOLUTION_POPOVER_BY); - closeTooltip(); - } - - void enterCollection(final String collection) throws Exception - { - final Select collSelect = new Select(dataTrain.findElement(DATA_TRAIN_COLLECTION_MENU)); - - // Unselect the 'All' option - collSelect.deselectByIndex(0); - collSelect.selectByValue(collection); - } - - public void enterInstrument(final String instrumentName) { - final Select instrumentSelect = new Select(dataTrain.findElement(DATA_TRAIN_INSTRUMENT_MENU)); - - // Unselect the 'All' option - instrumentSelect.deselectByIndex(0); - instrumentSelect.selectByValue(instrumentName); - } - - int findDataTrainValueIndex(final By menuLocator, final String value, final boolean ignoreCase) - throws Exception - { - final Select selectMenu = new Select(dataTrain.findElement(menuLocator)); - final List options = selectMenu.getOptions(); - final int optionSize = options.size(); - - for (int i = 0; i < optionSize; i++) - { - final WebElement option = options.get(i); - final String optionValue = option.getAttribute("value"); - - if ((ignoreCase && optionValue.equalsIgnoreCase(value)) || optionValue.equals(value)) - { - return i; - } - } - - throw new IllegalStateException("No such element with value '" + value + "' (Case" - + (ignoreCase ? " " : " not ") + "ignored)"); - } - - void ssoisLinkLoads() throws Exception - { - click(TARGET_FORM_GROUP); - - final String curWindowTitle = getCurrentWindowHandle(); - - // click on ssois link - click(ssoisLink); - - selectWindow("ssois_window"); - waitForTextPresent(H1_HEADER, "Solar System Object Image Search"); - - // Nav back to form - selectWindow(curWindowTitle); - } - - public CAOMSearchFormPage dismissCookieBanner() throws Exception { - waitForElementClickable(COOKIE_BANNER_BUTTON); - click(COOKIE_BANNER_BUTTON); - - return new CAOMSearchFormPage(driver); - } -} diff --git a/caom2-search-server/examples/default/src/intTest/java/ca/nrc/cadc/search/integration/FormInputBrowserTest.java b/caom2-search-server/examples/default/src/intTest/java/ca/nrc/cadc/search/integration/FormInputBrowserTest.java deleted file mode 100644 index a76365b8..00000000 --- a/caom2-search-server/examples/default/src/intTest/java/ca/nrc/cadc/search/integration/FormInputBrowserTest.java +++ /dev/null @@ -1,148 +0,0 @@ -/* - ************************************************************************ - **** C A N A D I A N A S T R O N O M Y D A T A C E N T R E ***** - * - * (c) 2014. (c) 2014. - * National Research Council Conseil national de recherches - * Ottawa, Canada, K1A 0R6 Ottawa, Canada, K1A 0R6 - * All rights reserved Tous droits reserves - * - * NRC disclaims any warranties Le CNRC denie toute garantie - * expressed, implied, or statu- enoncee, implicite ou legale, - * tory, of any kind with respect de quelque nature que se soit, - * to the software, including concernant le logiciel, y com- - * without limitation any war- pris sans restriction toute - * ranty of merchantability or garantie de valeur marchande - * fitness for a particular pur- ou de pertinence pour un usage - * pose. NRC shall not be liable particulier. Le CNRC ne - * in any event for any damages, pourra en aucun cas etre tenu - * whether direct or indirect, responsable de tout dommage, - * special or general, consequen- direct ou indirect, particul- - * tial or incidental, arising ier ou general, accessoire ou - * from the use of the software. fortuit, resultant de l'utili- - * sation du logiciel. - * - * - * @author jenkinsd - * 15/05/14 - 1:05 PM - * - * - * - **** C A N A D I A N A S T R O N O M Y D A T A C E N T R E ***** - ************************************************************************ - */ - -package ca.nrc.cadc.search.integration; - -import ca.nrc.cadc.util.StringUtil; -import org.junit.Test; -import org.openqa.selenium.By; - - -/** - * Verify form inputs - */ -public class FormInputBrowserTest extends AbstractAdvancedSearchIntegrationTest { - public FormInputBrowserTest() { - super(); - } - - /** - * Ensure the form inputs put error messages into the tooltips. - * - * @throws Exception Any errors. - */ - @Test - public void verifyFormInputs() throws Exception { - final CAOMSearchFormPage caomSearchFormPage = goToMain(CAOMSearchFormPage.class); - - caomSearchFormPage.reset(); - -// Observation Date. - verifyFormInput(caomSearchFormPage, CAOMSearchFormPage.OBSERVATION_DATE_INPUT_ID, "BOG", true, - "Invalid: BOG"); - verifyFormInput(caomSearchFormPage, CAOMSearchFormPage.OBSERVATION_DATE_INPUT_ID, "", false, - ""); - - // Spectral coverage. - verifyFormInput(caomSearchFormPage, CAOMSearchFormPage.SPECTRAL_COVERAGE_INPUT_ID, "BOGUS", true, null); - verifyFormInput(caomSearchFormPage, CAOMSearchFormPage.SPECTRAL_COVERAGE_INPUT_ID, "", false, ""); - - verifyFormInput(caomSearchFormPage, CAOMSearchFormPage.PIXEL_SCALE_INPUT_ID, "aaa", true, null); - verifyFormInput(caomSearchFormPage, CAOMSearchFormPage.PIXEL_SCALE_INPUT_ID, "", false, ""); - - verifyFormInput(caomSearchFormPage, CAOMSearchFormPage.OBSERVATION_DATE_INPUT_ID, "aaa", true, null); - verifyFormInput(caomSearchFormPage, CAOMSearchFormPage.OBSERVATION_DATE_INPUT_ID, "", false, ""); - - caomSearchFormPage.showInputField(CAOMSearchFormPage.OBSERVATION_DATE_INPUT_ID); - caomSearchFormPage.select(By.id(CAOMSearchFormPage.OBSERVATION_DATE_INPUT_ID + "_PRESET"), "PAST_WEEK"); - caomSearchFormPage.verifyFormInputMessageMatches(CAOMSearchFormPage.OBSERVATION_DATE_INPUT_ID, false, "(.*)" + - "\\d\\.\\.\\d(.*)"); - - // Close it again. - caomSearchFormPage.hideInputField(CAOMSearchFormPage.OBSERVATION_DATE_INPUT_ID); - - verifyFormInput(caomSearchFormPage, CAOMSearchFormPage.SPECTRAL_COVERAGE_INPUT_ID, "aaa", true, null); - verifyFormInput(caomSearchFormPage, CAOMSearchFormPage.SPECTRAL_COVERAGE_INPUT_ID, "", false, ""); - - // Quantify the unit conversion values. - verifyFormInput(caomSearchFormPage, CAOMSearchFormPage.PIXEL_SCALE_INPUT_ID, "0.02..0.05arcmin", false, - "(1.2..3.0 arcseconds)"); - verifyFormInput(caomSearchFormPage, CAOMSearchFormPage.PIXEL_SCALE_INPUT_ID, "", false, ""); - - resetForm(CAOMSearchFormPage.RESET_BUTTON_SELECTOR); - waitFor(2); - - verifyFormInput(caomSearchFormPage, CAOMSearchFormPage.OBSERVATION_DATE_INPUT_ID, "> 2010-09-22", false, - "(>= 55461.0 MJD)"); - verifyFormInput(caomSearchFormPage, CAOMSearchFormPage.OBSERVATION_DATE_INPUT_ID, "", false, ""); - - verifyFormInput(caomSearchFormPage, "Plane.time.exposure", "2m..1h", false, - "(120.0..3600.0 seconds)"); - verifyFormInput(caomSearchFormPage, "Plane.time.exposure", "", false, ""); - - verifyFormInput(caomSearchFormPage, "Plane.time.bounds.width", "1y..2y", false, - "(365.0..730.0 days)"); - verifyFormInput(caomSearchFormPage, "Plane.time.bounds.width", "", false, ""); - - verifyFormInput(caomSearchFormPage, CAOMSearchFormPage.SPECTRAL_COVERAGE_INPUT_ID, "300..400GHz", false, - "(7.495E-4..9.993E-4 metres)"); - verifyFormInput(caomSearchFormPage, CAOMSearchFormPage.SPECTRAL_COVERAGE_INPUT_ID, "", false, ""); - - verifyFormInput(caomSearchFormPage, "Plane.energy.sampleSize", "2..3GHz", false, - "(2.0E9..3.0E9 Hz)"); - verifyFormInput(caomSearchFormPage, "Plane.energy.sampleSize", "", false, ""); - - verifyFormInput(caomSearchFormPage, "Plane.energy.bounds.width", "< 1000A", false, - "(< 1.000E-7 metres)"); - verifyFormInput(caomSearchFormPage, "Plane.energy.bounds.width", "", false, ""); - //*/ - - verifyFormInput(caomSearchFormPage, "Plane.position.sampleSize", "10..20", false, - "(10.0..20.0 arcseconds)"); - verifyFormInput(caomSearchFormPage, "Plane.position.sampleSize", "", false, ""); - } - - private void verifyFormInput(final CAOMSearchFormPage caomSearchFormPage, final String inputID, final String entry, - final boolean expectError, final String expectedLabelMessage) - throws Exception { - if (StringUtil.hasText(entry)) { - caomSearchFormPage.waitForElementPresent(By.id(inputID)); - caomSearchFormPage.enterInputValue(caomSearchFormPage.find(By.id(inputID)), entry); - } else { - caomSearchFormPage.clearInputValue(inputID); - } - - if (expectError) { - // Empty strings are valid as they represent cleared errors. - if (expectedLabelMessage != null) { - caomSearchFormPage.verifyFormInputMessage(inputID, true, expectedLabelMessage); - } else { - caomSearchFormPage.verifyFormInputError(inputID); - } - } else { - caomSearchFormPage.verifyFormInputMessage(inputID, false, expectedLabelMessage); - } - } - -} diff --git a/caom2-search-server/examples/default/src/intTest/java/ca/nrc/cadc/search/integration/ResolverTooltipBrowserTest.java b/caom2-search-server/examples/default/src/intTest/java/ca/nrc/cadc/search/integration/ResolverTooltipBrowserTest.java deleted file mode 100644 index 869122d1..00000000 --- a/caom2-search-server/examples/default/src/intTest/java/ca/nrc/cadc/search/integration/ResolverTooltipBrowserTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - ************************************************************************ - **** C A N A D I A N A S T R O N O M Y D A T A C E N T R E ***** - * - * (c) 2014. (c) 2014. - * National Research Council Conseil national de recherches - * Ottawa, Canada, K1A 0R6 Ottawa, Canada, K1A 0R6 - * All rights reserved Tous droits reserves - * - * NRC disclaims any warranties Le CNRC denie toute garantie - * expressed, implied, or statu- enoncee, implicite ou legale, - * tory, of any kind with respect de quelque nature que se soit, - * to the software, including concernant le logiciel, y com- - * without limitation any war- pris sans restriction toute - * ranty of merchantability or garantie de valeur marchande - * fitness for a particular pur- ou de pertinence pour un usage - * pose. NRC shall not be liable particulier. Le CNRC ne - * in any event for any damages, pourra en aucun cas etre tenu - * whether direct or indirect, responsable de tout dommage, - * special or general, consequen- direct ou indirect, particul- - * tial or incidental, arising ier ou general, accessoire ou - * from the use of the software. fortuit, resultant de l'utili- - * sation du logiciel. - * - * - * @author jenkinsd - * 15/05/14 - 2:17 PM - * - * - * - **** C A N A D I A N A S T R O N O M Y D A T A C E N T R E ***** - ************************************************************************ - */ - -package ca.nrc.cadc.search.integration; - -import org.junit.Test; - - -public class ResolverTooltipBrowserTest extends AbstractAdvancedSearchIntegrationTest { - public ResolverTooltipBrowserTest() { - super(); - } - - /** - * Tooltip for the Name resolver - * - * @throws Exception Any issue at all. - */ - @Test - public void resolverToolTipTest() throws Exception { - final CAOMSearchFormPage searchFormPage = goToMain(CAOMSearchFormPage.class); - - searchFormPage.enterValidTarget("m101"); - searchFormPage.resetForm(); - } -} diff --git a/caom2-search-server/examples/default/src/intTest/java/ca/nrc/cadc/search/integration/SearchResultsPage.java b/caom2-search-server/examples/default/src/intTest/java/ca/nrc/cadc/search/integration/SearchResultsPage.java deleted file mode 100644 index 4fb4b399..00000000 --- a/caom2-search-server/examples/default/src/intTest/java/ca/nrc/cadc/search/integration/SearchResultsPage.java +++ /dev/null @@ -1,292 +0,0 @@ -/* - ************************************************************************ - ******************* CANADIAN ASTRONOMY DATA CENTRE ******************* - ************** CENTRE CANADIEN DE DONNÉES ASTRONOMIQUES ************** - * - * (c) 2016. (c) 2016. - * Government of Canada Gouvernement du Canada - * National Research Council Conseil national de recherches - * Ottawa, Canada, K1A 0R6 Ottawa, Canada, K1A 0R6 - * All rights reserved Tous droits réservés - * - * NRC disclaims any warranties, Le CNRC dénie toute garantie - * expressed, implied, or énoncée, implicite ou légale, - * statutory, of any kind with de quelque nature que ce - * respect to the software, soit, concernant le logiciel, - * including without limitation y compris sans restriction - * any warranty of merchantability toute garantie de valeur - * or fitness for a particular marchande ou de pertinence - * purpose. NRC shall not be pour un usage particulier. - * liable in any event for any Le CNRC ne pourra en aucun cas - * damages, whether direct or être tenu responsable de tout - * indirect, special or general, dommage, direct ou indirect, - * consequential or incidental, particulier ou général, - * arising from the use of the accessoire ou fortuit, résultant - * software. Neither the name de l'utilisation du logiciel. Ni - * of the National Research le nom du Conseil National de - * Council of Canada nor the Recherches du Canada ni les noms - * names of its contributors may de ses participants ne peuvent - * be used to endorse or promote être utilisés pour approuver ou - * products derived from this promouvoir les produits dérivés - * software without specific prior de ce logiciel sans autorisation - * written permission. préalable et particulière - * par écrit. - * - * This file is part of the Ce fichier fait partie du projet - * OpenCADC project. OpenCADC. - * - * OpenCADC is free software: OpenCADC est un logiciel libre ; - * you can redistribute it and/or vous pouvez le redistribuer ou le - * modify it under the terms of modifier suivant les termes de - * the GNU Affero General Public la “GNU Affero General Public - * License as published by the License” telle que publiée - * Free Software Foundation, par la Free Software Foundation - * either version 3 of the : soit la version 3 de cette - * License, or (at your option) licence, soit (à votre gré) - * any later version. toute version ultérieure. - * - * OpenCADC is distributed in the OpenCADC est distribué - * hope that it will be useful, dans l’espoir qu’il vous - * but WITHOUT ANY WARRANTY; sera utile, mais SANS AUCUNE - * without even the implied GARANTIE : sans même la garantie - * warranty of MERCHANTABILITY implicite de COMMERCIALISABILITÉ - * or FITNESS FOR A PARTICULAR ni d’ADÉQUATION À UN OBJECTIF - * PURPOSE. See the GNU Affero PARTICULIER. Consultez la Licence - * General Public License for Générale Publique GNU Affero - * more details. pour plus de détails. - * - * You should have received Vous devriez avoir reçu une - * a copy of the GNU Affero copie de la Licence Générale - * General Public License along Publique GNU Affero avec - * with OpenCADC. If not, see OpenCADC ; si ce n’est - * . pas le cas, consultez : - * . - * - * - ************************************************************************ - */ - -package ca.nrc.cadc.search.integration; - - -import org.openqa.selenium.By; -import org.openqa.selenium.WebDriver; -import org.openqa.selenium.WebElement; -import org.openqa.selenium.interactions.Actions; -import org.openqa.selenium.support.FindBy; -import org.openqa.selenium.support.PageFactory; - -import ca.nrc.cadc.web.selenium.AbstractTestWebPage; -import org.openqa.selenium.support.ui.ExpectedCondition; -import org.openqa.selenium.support.ui.Select; - -import java.lang.reflect.Constructor; -import java.util.List; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - - -public class SearchResultsPage extends AbstractTestWebPage { - static final Pattern ROW_COUNT_PATTERN = Pattern.compile("\\d+"); - - static final By IQ_COLUMN_HEADER = By.cssSelector("div[id$='caom2:Plane.position.resolution']"); - static final By REST_FRAME_COLUMN_HEADER = By.cssSelector("div[id$='caom2:Plane.energy.restwav']"); - static final By PROPOSAL_PROJECT_COLUMN_HEADER = By.cssSelector("div[id$='caom2:Observation.proposal.project']"); - static final By REST_FRAME_ENERGY_UNIT_SELECT_LOCATOR = By.id("caom2:Plane.energy.restwav_unitselect"); - static final By IQ_UNIT_SELECT_LOCATOR = By.id("caom2:Plane.position.resolution_unitselect"); - private static final By FILTER_FILTER_BY = By.id("caom2:Plane.energy.bandpassName_filter"); - private static final By RA_FILTER_BY = By.id("caom2:Plane.position.bounds.cval1_filter"); - private static final By DEC_FILTER_BY = By.id("caom2:Plane.position.bounds.cval2_filter"); - private static final By CHANGE_COLUMNS_BY = By.id("change_column_button"); - private static final By CHANGE_COLUMNS_POPUP_BY = By.id("column_manager"); - private static final String CHANGE_COLUMNS_AVAILABLE_COLUMNS_LIST_ID = "cadc_columnpicker_available_items"; - private static final By CHANGE_COLUMNS_AVAILABLE_COLUMNS_LIST_BY = By.id(CHANGE_COLUMNS_AVAILABLE_COLUMNS_LIST_ID); - private static final String CHANGE_COLUMNS_SELECTED_COLUMNS_LIST_ID = "cadc_columnpicker_selected_items"; - private static final By CHANGE_COLUMNS_SELECTED_COLUMNS_LIST_BY = By.id(CHANGE_COLUMNS_SELECTED_COLUMNS_LIST_ID); - private static final By FOOTPRINT_VIEWER_TOGGLE_LINK = By.id("slick-visualize"); - private static final By FOOTPRINT_VIEWER = By.id("aladin-lite"); - private static final By MARK_ALL_CHECKBOX_BY = - By.cssSelector("div.slick-header-column-checkboxsel > span > input[type=\"checkbox\"]"); - - static final String ICON_BUSY_SRC = "cadcVOTV/images/PleaseWait-small.gif"; - static final String ICON_IDLE_SRC = "images/transparent-20.png"; - - static final By GRID_LOCATOR = By.id("resultTable"); - static final By GRID_HEADER_LOCATOR = By.id("results-grid-header"); - static final By GRID_HEADER_LABEL_LOCATOR = By.className("grid-header-label"); - static final String OBSERVATION_DETAILS_LINK_LOCATOR = "caom2:Observation.observationID_%d_observation_details"; - static final By FIRST_QUICKSEARCH_TARGET_LINK = By.cssSelector("a.quicksearch_link:nth-child(1)"); - static final By QUERY_TAB_LOCATOR = By.cssSelector("#tabList > li:nth-child(1)"); - - - // Switches between busy and transparent (idle). - static final By GRID_HEADER_ICON = By.className("grid-header-icon"); - - @FindBy(className = "grid-container") - private WebElement gridContainer; - - - public SearchResultsPage(final WebDriver driver) throws Exception { - super(driver); - - waitForGridToLoad(); - waitForElementPresent(QUERY_TAB_LOCATOR); - waitForElementVisible(QUERY_TAB_LOCATOR); - waitForElementClickable(QUERY_TAB_LOCATOR); - - PageFactory.initElements(driver, this); - } - - - void includeHiddenColumn(final String uType) throws Exception { - click(gridContainer.findElement(CHANGE_COLUMNS_BY)); - waitForElementVisible(CHANGE_COLUMNS_POPUP_BY); - waitForElementPresent(CHANGE_COLUMNS_AVAILABLE_COLUMNS_LIST_BY); - - final WebElement changeColumnsPopupElement = find(CHANGE_COLUMNS_POPUP_BY); - final WebElement availableColumnsListElement = changeColumnsPopupElement.findElement( - CHANGE_COLUMNS_AVAILABLE_COLUMNS_LIST_BY); - final WebElement selectedColumnsListElement = - changeColumnsPopupElement.findElement(CHANGE_COLUMNS_SELECTED_COLUMNS_LIST_BY); - final String listItemID = "ITEM_" + uType; - final String listItemSelector = "#" + listItemID; - - final WebElement listItem = availableColumnsListElement.findElement(By.id(listItemID)); - scrollIntoView(listItem); - waitForElementVisible(listItem); - - if (listItem == null) { - throw new RuntimeException("Unable to locate list item in change columns for " + listItemSelector); - } else { - // check that the drag-and-drop changed the ordinal of the column - (new Actions(driver)).dragAndDrop(listItem, selectedColumnsListElement).perform(); - waitForElementVisible(selectedColumnsListElement.findElement(By.id(listItemID))); - click(changeColumnsPopupElement.findElement(By.id("column_manager_close"))); - } - } - - void waitForGridToLoad() throws Exception { - waitForElementPresent(GRID_LOCATOR); - waitForElementPresent(GRID_HEADER_LOCATOR); - waitForElementPresent(GRID_HEADER_ICON); - waitForElementPresent(CHANGE_COLUMNS_BY); - - waitUntil(new ExpectedCondition() { - @Override - public Boolean apply(final WebDriver webDriver) { - final String srcAttribute = webDriver.findElement(GRID_HEADER_ICON).getAttribute("src"); - return srcAttribute.endsWith(ICON_IDLE_SRC); - } - }); - - waitForTextPresent(GRID_HEADER_LABEL_LOCATOR, "Showing"); - waitForElementPresent(FIRST_QUICKSEARCH_TARGET_LINK); - } - - SearchResultsPage quickSearchTarget() throws Exception { - click(FIRST_QUICKSEARCH_TARGET_LINK); - return new SearchResultsPage(driver); - } - - T clickPreview(final String windowName, final Class pageClass) throws Exception { - click(By.className("preview_tooltip_link")); - - final Class[] constructorArgTypes = new Class[] {WebDriver.class}; - final Constructor constructor = pageClass.getConstructor(constructorArgTypes); - return constructor.newInstance(selectWindow(windowName)); - } - - WebElement getGridHeader() throws Exception { - return gridContainer.findElement(GRID_HEADER_LOCATOR); - } - - WebElement getGrid() throws Exception { - return gridContainer.findElement(GRID_LOCATOR); - } - - String getPagerStatusText() throws Exception { - return getGridHeader().findElement(GRID_HEADER_LABEL_LOCATOR).getText(); - } - - int getCurrentResultsRowCount() throws Exception { - final Matcher matcher = ROW_COUNT_PATTERN.matcher(getPagerStatusText()); - return matcher.find() ? Integer.parseInt(matcher.group()) : -1; - } - - /** - * Will throw a NumberFormatException when no integer present. - * - * @param checkForResults Whether to check for a row count > 0. - * @throws Exception - */ - void verifyGridHeaderLabelHasIntegerValue(final boolean checkForResults) throws Exception { - final String result = getPagerStatusText(); - verifyTrue(result.startsWith("Showing ")); - verifyTrue(result.indexOf(" rows") > 0); - - final int rowCount = getCurrentResultsRowCount(); - - if (checkForResults) { - verifyTrue(rowCount > 0); - } - } - - CAOMObservationDetailsPage openObservationDetails(final int rowNumber) - throws Exception { - click(By.id(String.format(OBSERVATION_DETAILS_LINK_LOCATOR, rowNumber))); - - return new CAOMObservationDetailsPage(driver); - } - - CAOMSearchFormPage queryTab() throws Exception { - waitFor(1000L); - click(QUERY_TAB_LOCATOR); - return new CAOMSearchFormPage(driver); - } - - WebElement getIQColumnHeader() throws Exception { - return getGrid().findElement(IQ_COLUMN_HEADER); - } - - WebElement getRestFrameEnergyColumnHeader() throws Exception { - return getGrid().findElement(REST_FRAME_COLUMN_HEADER); - } - - void confirmFootprintViewer() throws Exception { - click(FOOTPRINT_VIEWER_TOGGLE_LINK); - waitForElementVisible(FOOTPRINT_VIEWER); - click(FOOTPRINT_VIEWER_TOGGLE_LINK); - waitForElementInvisible(FOOTPRINT_VIEWER); - } - - void confirmProposalProjectColumnHeader() throws Exception { - waitForElementVisible(getGrid().findElement(PROPOSAL_PROJECT_COLUMN_HEADER)); - } - - String getSelectedRestFrameEnergyUnit() throws Exception { - final Select rfUnitSelect = new Select(gridContainer.findElement(REST_FRAME_ENERGY_UNIT_SELECT_LOCATOR)); - final WebElement rfUnitSelectedOption = rfUnitSelect.getFirstSelectedOption(); - - return rfUnitSelectedOption.getText(); - } - - String getSelectIQUnit() throws Exception { - final Select iqUnitSelectElement = new Select(gridContainer.findElement( - IQ_UNIT_SELECT_LOCATOR)); - return iqUnitSelectElement.getFirstSelectedOption().getText(); - } - - void filterOnRA(final String value) throws Exception { - sendKeys(find(RA_FILTER_BY), value); - } - - void ensureMarkAllCheckboxVisible() throws Exception { - waitForElementVisible(MARK_ALL_CHECKBOX_BY); - } - - String getStartDateLink() throws Exception { - List quickSearches = driver.findElements(FIRST_QUICKSEARCH_TARGET_LINK); - return quickSearches.get(1).getAttribute("href"); - } - -} diff --git a/caom2-search-server/examples/default/src/intTest/java/ca/nrc/cadc/search/integration/StartDateSearchLinkTest.java b/caom2-search-server/examples/default/src/intTest/java/ca/nrc/cadc/search/integration/StartDateSearchLinkTest.java deleted file mode 100644 index 773d23da..00000000 --- a/caom2-search-server/examples/default/src/intTest/java/ca/nrc/cadc/search/integration/StartDateSearchLinkTest.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - ************************************************************************ - **** C A N A D I A N A S T R O N O M Y D A T A C E N T R E ***** - * - * (c) 2020. (c) 2020. - * National Research Council Conseil national de recherches - * Ottawa, Canada, K1A 0R6 Ottawa, Canada, K1A 0R6 - * All rights reserved Tous droits reserves - * - * NRC disclaims any warranties Le CNRC denie toute garantie - * expressed, implied, or statu- enoncee, implicite ou legale, - * tory, of any kind with respect de quelque nature que se soit, - * to the software, including concernant le logiciel, y com- - * without limitation any war- pris sans restriction toute - * ranty of merchantability or garantie de valeur marchande - * fitness for a particular pur- ou de pertinence pour un usage - * pose. NRC shall not be liable particulier. Le CNRC ne - * in any event for any damages, pourra en aucun cas etre tenu - * whether direct or indirect, responsable de tout dommage, - * special or general, consequen- direct ou indirect, particul- - * tial or incidental, arising ier ou general, accessoire ou - * from the use of the software. fortuit, resultant de l'utili- - * sation du logiciel. - * - * - * @author jeevesh - * 03/11/20 - - * - * - **** C A N A D I A N A S T R O N O M Y D A T A C E N T R E ***** - ************************************************************************ - */ -package ca.nrc.cadc.search.integration; - - -import java.net.URI; -import org.junit.Test; -import org.openqa.selenium.By; - - -public class StartDateSearchLinkTest extends AbstractAdvancedSearchIntegrationTest -{ - private static final String SEARCH_QUERY = "Observation.instrument.name=Newtonian%20Imager&Observation.collection=DAO&Plane.time.bounds.samples=52865..52866"; - - public StartDateSearchLinkTest() throws Exception - { - super(); - } - - @Test - public void checkStartDateSearchLink() throws Exception - { - String searchStr = "Observation.instrument.name=Newtonian%20Imager&Observation.collection=DAO&Plane.time.bounds.samples=52865..52866"; - CAOMSearchFormPage searchFormPage = goToMain(CAOMSearchFormPage.class); - - searchFormPage = searchFormPage.dismissCookieBanner(); - - // This combination usually produces only one result - searchFormPage.enterCollection("DAO"); - searchFormPage.enterTarget("m17"); - SearchResultsPage searchResultsPage = searchFormPage.submitSuccess(); - - String result = searchResultsPage.getStartDateLink(); - URI testHref = new URI(result); - verifyEquals(testHref.getRawQuery(), searchStr); - } -} diff --git a/caom2-search-server/examples/default/src/intTest/java/ca/nrc/cadc/search/integration/UnauthorizedPreviewPage.java b/caom2-search-server/examples/default/src/intTest/java/ca/nrc/cadc/search/integration/UnauthorizedPreviewPage.java deleted file mode 100644 index 803a0ddc..00000000 --- a/caom2-search-server/examples/default/src/intTest/java/ca/nrc/cadc/search/integration/UnauthorizedPreviewPage.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - ************************************************************************ - ******************* CANADIAN ASTRONOMY DATA CENTRE ******************* - ************** CENTRE CANADIEN DE DONNÉES ASTRONOMIQUES ************** - * - * (c) 2017. (c) 2017. - * Government of Canada Gouvernement du Canada - * National Research Council Conseil national de recherches - * Ottawa, Canada, K1A 0R6 Ottawa, Canada, K1A 0R6 - * All rights reserved Tous droits réservés - * - * NRC disclaims any warranties, Le CNRC dénie toute garantie - * expressed, implied, or énoncée, implicite ou légale, - * statutory, of any kind with de quelque nature que ce - * respect to the software, soit, concernant le logiciel, - * including without limitation y compris sans restriction - * any warranty of merchantability toute garantie de valeur - * or fitness for a particular marchande ou de pertinence - * purpose. NRC shall not be pour un usage particulier. - * liable in any event for any Le CNRC ne pourra en aucun cas - * damages, whether direct or être tenu responsable de tout - * indirect, special or general, dommage, direct ou indirect, - * consequential or incidental, particulier ou général, - * arising from the use of the accessoire ou fortuit, résultant - * software. Neither the name de l'utilisation du logiciel. Ni - * of the National Research le nom du Conseil National de - * Council of Canada nor the Recherches du Canada ni les noms - * names of its contributors may de ses participants ne peuvent - * be used to endorse or promote être utilisés pour approuver ou - * products derived from this promouvoir les produits dérivés - * software without specific prior de ce logiciel sans autorisation - * written permission. préalable et particulière - * par écrit. - * - * This file is part of the Ce fichier fait partie du projet - * OpenCADC project. OpenCADC. - * - * OpenCADC is free software: OpenCADC est un logiciel libre ; - * you can redistribute it and/or vous pouvez le redistribuer ou le - * modify it under the terms of modifier suivant les termes de - * the GNU Affero General Public la “GNU Affero General Public - * License as published by the License” telle que publiée - * Free Software Foundation, par la Free Software Foundation - * either version 3 of the : soit la version 3 de cette - * License, or (at your option) licence, soit (à votre gré) - * any later version. toute version ultérieure. - * - * OpenCADC is distributed in the OpenCADC est distribué - * hope that it will be useful, dans l’espoir qu’il vous - * but WITHOUT ANY WARRANTY; sera utile, mais SANS AUCUNE - * without even the implied GARANTIE : sans même la garantie - * warranty of MERCHANTABILITY implicite de COMMERCIALISABILITÉ - * or FITNESS FOR A PARTICULAR ni d’ADÉQUATION À UN OBJECTIF - * PURPOSE. See the GNU Affero PARTICULIER. Consultez la Licence - * General Public License for Générale Publique GNU Affero - * more details. pour plus de détails. - * - * You should have received Vous devriez avoir reçu une - * a copy of the GNU Affero copie de la Licence Générale - * General Public License along Publique GNU Affero avec - * with OpenCADC. If not, see OpenCADC ; si ce n’est - * . pas le cas, consultez : - * . - * - * - ************************************************************************ - */ - -package ca.nrc.cadc.search.integration; - -import org.openqa.selenium.By; -import org.openqa.selenium.WebDriver; - - -public class UnauthorizedPreviewPage extends AbstractPreviewPage -{ - public UnauthorizedPreviewPage(WebDriver driver) throws Exception - { - super(driver); - } - - @Override - void waitForPageLoad() throws Exception - { - waitForTextPresent(By.tagName("p"), "You do not have permission to view this Preview image."); - } -} diff --git a/caom2-search-server/examples/default/src/main/webapp/META-INF/context.xml b/caom2-search-server/examples/default/src/main/webapp/META-INF/context.xml deleted file mode 100644 index 948ac18b..00000000 --- a/caom2-search-server/examples/default/src/main/webapp/META-INF/context.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - WEB-INF/web.xml - - - - - diff --git a/caom2-search-server/examples/default/src/main/webapp/WEB-INF/tags/c.tld b/caom2-search-server/examples/default/src/main/webapp/WEB-INF/tags/c.tld deleted file mode 100644 index 22698c97..00000000 --- a/caom2-search-server/examples/default/src/main/webapp/WEB-INF/tags/c.tld +++ /dev/null @@ -1,563 +0,0 @@ - - - - - JSTL 1.1 core library - JSTL core - 1.1 - c - http://java.sun.com/jsp/jstl/core - - - - Provides core validation features for JSTL tags. - - - org.apache.taglibs.standard.tlv.JstlCoreTLV - - - - - - Catches any Throwable that occurs in its body and optionally - exposes it. - - catch - org.apache.taglibs.standard.tag.common.core.CatchTag - JSP - - -Name of the exported scoped variable for the -exception thrown from a nested action. The type of the -scoped variable is the type of the exception thrown. - - var - false - false - - - - - - Simple conditional tag that establishes a context for - mutually exclusive conditional operations, marked by - <when> and <otherwise> - - choose - org.apache.taglibs.standard.tag.common.core.ChooseTag - JSP - - - - - Simple conditional tag, which evalutes its body if the - supplied condition is true and optionally exposes a Boolean - scripting variable representing the evaluation of this condition - - if - org.apache.taglibs.standard.tag.rt.core.IfTag - JSP - - -The test condition that determines whether or -not the body content should be processed. - - test - true - true - boolean - - - -Name of the exported scoped variable for the -resulting value of the test condition. The type -of the scoped variable is Boolean. - - var - false - false - - - -Scope for var. - - scope - false - false - - - - - - Retrieves an absolute or relative URL and exposes its contents - to either the page, a String in 'var', or a Reader in 'varReader'. - - import - org.apache.taglibs.standard.tag.rt.core.ImportTag - org.apache.taglibs.standard.tei.ImportTEI - JSP - - -The URL of the resource to import. - - url - true - true - - - -Name of the exported scoped variable for the -resource's content. The type of the scoped -variable is String. - - var - false - false - - - -Scope for var. - - scope - false - false - - - -Name of the exported scoped variable for the -resource's content. The type of the scoped -variable is Reader. - - varReader - false - false - - - -Name of the context when accessing a relative -URL resource that belongs to a foreign -context. - - context - false - true - - - -Character encoding of the content at the input -resource. - - charEncoding - false - true - - - - - - The basic iteration tag, accepting many different - collection types and supporting subsetting and other - functionality - - forEach - org.apache.taglibs.standard.tag.rt.core.ForEachTag - org.apache.taglibs.standard.tei.ForEachTEI - JSP - - -Collection of items to iterate over. - - items - false - true - java.lang.Object - - - -If items specified: -Iteration begins at the item located at the -specified index. First item of the collection has -index 0. -If items not specified: -Iteration begins with index set at the value -specified. - - begin - false - true - int - - - -If items specified: -Iteration ends at the item located at the -specified index (inclusive). -If items not specified: -Iteration ends when index reaches the value -specified. - - end - false - true - int - - - -Iteration will only process every step items of -the collection, starting with the first one. - - step - false - true - int - - - -Name of the exported scoped variable for the -current item of the iteration. This scoped -variable has nested visibility. Its type depends -on the object of the underlying collection. - - var - false - false - - - -Name of the exported scoped variable for the -status of the iteration. Object exported is of type -javax.servlet.jsp.jstl.core.LoopTagStatus. This scoped variable has nested -visibility. - - varStatus - false - false - - - - - - Iterates over tokens, separated by the supplied delimeters - - forTokens - org.apache.taglibs.standard.tag.rt.core.ForTokensTag - JSP - - -String of tokens to iterate over. - - items - true - true - java.lang.String - - - -The set of delimiters (the characters that -separate the tokens in the string). - - delims - true - true - java.lang.String - - - -Iteration begins at the token located at the -specified index. First token has index 0. - - begin - false - true - int - - - -Iteration ends at the token located at the -specified index (inclusive). - - end - false - true - int - - - -Iteration will only process every step tokens -of the string, starting with the first one. - - step - false - true - int - - - -Name of the exported scoped variable for the -current item of the iteration. This scoped -variable has nested visibility. - - var - false - false - - - -Name of the exported scoped variable for the -status of the iteration. Object exported is of -type -javax.servlet.jsp.jstl.core.LoopTag -Status. This scoped variable has nested -visibility. - - varStatus - false - false - - - - - - Like <%= ... >, but for expressions. - - out - org.apache.taglibs.standard.tag.rt.core.OutTag - JSP - - -Expression to be evaluated. - - value - true - true - - - -Default value if the resulting value is null. - - default - false - true - - - -Determines whether characters <,>,&,'," in the -resulting string should be converted to their -corresponding character entity codes. Default value is -true. - - escapeXml - false - true - - - - - - - Subtag of <choose> that follows <when> tags - and runs only if all of the prior conditions evaluated to - 'false' - - otherwise - org.apache.taglibs.standard.tag.common.core.OtherwiseTag - JSP - - - - - Adds a parameter to a containing 'import' tag's URL. - - param - org.apache.taglibs.standard.tag.rt.core.ParamTag - JSP - - -Name of the query string parameter. - - name - true - true - - - -Value of the parameter. - - value - false - true - - - - - - Redirects to a new URL. - - redirect - org.apache.taglibs.standard.tag.rt.core.RedirectTag - JSP - - -The URL of the resource to redirect to. - - url - false - true - - - -Name of the context when redirecting to a relative URL -resource that belongs to a foreign context. - - context - false - true - - - - - - Removes a scoped variable (from a particular scope, if specified). - - remove - org.apache.taglibs.standard.tag.common.core.RemoveTag - empty - - -Name of the scoped variable to be removed. - - var - true - false - - - -Scope for var. - - scope - false - false - - - - - - Sets the result of an expression evaluation in a 'scope' - - set - org.apache.taglibs.standard.tag.rt.core.SetTag - JSP - - -Name of the exported scoped variable to hold the value -specified in the action. The type of the scoped variable is -whatever type the value expression evaluates to. - - var - false - false - - - -Expression to be evaluated. - - value - false - true - - - -Target object whose property will be set. Must evaluate to -a JavaBeans object with setter property property, or to a -java.util.Map object. - - target - false - true - - - -Name of the property to be set in the target object. - - property - false - true - - - -Scope for var. - - scope - false - false - - - - - - Creates a URL with optional query parameters. - - url - org.apache.taglibs.standard.tag.rt.core.UrlTag - JSP - - -Name of the exported scoped variable for the -processed url. The type of the scoped variable is -String. - - var - false - false - - - -Scope for var. - - scope - false - false - - - -URL to be processed. - - value - false - true - - - -Name of the context when specifying a relative URL -resource that belongs to a foreign context. - - context - false - true - - - - - - Subtag of <choose> that includes its body if its - condition evalutes to 'true' - - when - org.apache.taglibs.standard.tag.rt.core.WhenTag - JSP - - -The test condition that determines whether or not the -body content should be processed. - - test - true - true - boolean - - - - diff --git a/caom2-search-server/examples/default/src/main/webapp/WEB-INF/tags/cadc/checkbox.tag b/caom2-search-server/examples/default/src/main/webapp/WEB-INF/tags/cadc/checkbox.tag deleted file mode 100644 index 4666047f..00000000 --- a/caom2-search-server/examples/default/src/main/webapp/WEB-INF/tags/cadc/checkbox.tag +++ /dev/null @@ -1,26 +0,0 @@ -<%@ tag body-content="empty" %> -<%@ attribute name="i18nKey" required="true" %> -<%@ attribute name="checkboxName" required="true" %> -<%@ attribute name="cssClasses" required="false" %> -<%@ attribute name="disableTo" required="false" %> - -<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> -<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%> - - -
- -
- - - diff --git a/caom2-search-server/examples/default/src/main/webapp/WEB-INF/tags/cadc/formName.tag b/caom2-search-server/examples/default/src/main/webapp/WEB-INF/tags/cadc/formName.tag deleted file mode 100644 index 76a448f9..00000000 --- a/caom2-search-server/examples/default/src/main/webapp/WEB-INF/tags/cadc/formName.tag +++ /dev/null @@ -1,4 +0,0 @@ -<%@ tag body-content="empty" %> -<%@ attribute name="formName" required="true" %> - - diff --git a/caom2-search-server/examples/default/src/main/webapp/WEB-INF/tags/cadc/pulldown.tag b/caom2-search-server/examples/default/src/main/webapp/WEB-INF/tags/cadc/pulldown.tag deleted file mode 100644 index 86efbc25..00000000 --- a/caom2-search-server/examples/default/src/main/webapp/WEB-INF/tags/cadc/pulldown.tag +++ /dev/null @@ -1,14 +0,0 @@ -<%@ tag body-content="empty" %> -<%@ attribute name="utype" required="true" %> -<%@ attribute name="cssClasses" required="false" %> -<%@ attribute name="defaultOptionLabel" required="false" %> -<%@ attribute name="options" required="true" - type="java.util.Map" %> - -<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> - - diff --git a/caom2-search-server/examples/default/src/main/webapp/WEB-INF/tags/fmt.tld b/caom2-search-server/examples/default/src/main/webapp/WEB-INF/tags/fmt.tld deleted file mode 100644 index 5d783e9f..00000000 --- a/caom2-search-server/examples/default/src/main/webapp/WEB-INF/tags/fmt.tld +++ /dev/null @@ -1,712 +0,0 @@ - - - - - - JSTL 1.1 i18n-capable formatting library - JSTL fmt - 1.1 - fmt - http://java.sun.com/jsp/jstl/fmt - - - - Provides core validation features for JSTL tags. - - - org.apache.taglibs.standard.tlv.JstlFmtTLV - - - - - - Sets the request character encoding - - requestEncoding - org.apache.taglibs.standard.tag.rt.fmt.RequestEncodingTag - empty - - -Name of character encoding to be applied when -decoding request parameters. - - value - false - true - - - - - - Stores the given locale in the locale configuration variable - - setLocale - org.apache.taglibs.standard.tag.rt.fmt.SetLocaleTag - empty - - -A String value is interpreted as the -printable representation of a locale, which -must contain a two-letter (lower-case) -language code (as defined by ISO-639), -and may contain a two-letter (upper-case) -country code (as defined by ISO-3166). -Language and country codes must be -separated by hyphen (-) or underscore -(_). - - value - true - true - - - -Vendor- or browser-specific variant. -See the java.util.Locale javadocs for -more information on variants. - - variant - false - true - - - -Scope of the locale configuration variable. - - scope - false - false - - - - - - Specifies the time zone for any time formatting or parsing actions - nested in its body - - timeZone - org.apache.taglibs.standard.tag.rt.fmt.TimeZoneTag - JSP - - -The time zone. A String value is interpreted as -a time zone ID. This may be one of the time zone -IDs supported by the Java platform (such as -"America/Los_Angeles") or a custom time zone -ID (such as "GMT-8"). See -java.util.TimeZone for more information on -supported time zone formats. - - value - true - true - - - - - - Stores the given time zone in the time zone configuration variable - - setTimeZone - org.apache.taglibs.standard.tag.rt.fmt.SetTimeZoneTag - empty - - -The time zone. A String value is interpreted as -a time zone ID. This may be one of the time zone -IDs supported by the Java platform (such as -"America/Los_Angeles") or a custom time zone -ID (such as "GMT-8"). See java.util.TimeZone for -more information on supported time zone -formats. - - value - true - true - - - -Name of the exported scoped variable which -stores the time zone of type -java.util.TimeZone. - - var - false - false - - - -Scope of var or the time zone configuration -variable. - - scope - false - false - - - - - - Loads a resource bundle to be used by its tag body - - bundle - org.apache.taglibs.standard.tag.rt.fmt.BundleTag - JSP - - -Resource bundle base name. This is the bundle's -fully-qualified resource name, which has the same -form as a fully-qualified class name, that is, it uses -"." as the package component separator and does not -have any file type (such as ".class" or ".properties") -suffix. - - basename - true - true - - - -Prefix to be prepended to the value of the message -key of any nested <fmt:message> action. - - prefix - false - true - - - - - - Loads a resource bundle and stores it in the named scoped variable or - the bundle configuration variable - - setBundle - org.apache.taglibs.standard.tag.rt.fmt.SetBundleTag - empty - - -Resource bundle base name. This is the bundle's -fully-qualified resource name, which has the same -form as a fully-qualified class name, that is, it uses -"." as the package component separator and does not -have any file type (such as ".class" or ".properties") -suffix. - - basename - true - true - - - -Name of the exported scoped variable which stores -the i18n localization context of type -javax.servlet.jsp.jstl.fmt.LocalizationC -ontext. - - var - false - false - - - -Scope of var or the localization context -configuration variable. - - scope - false - false - - - - - - Maps key to localized message and performs parametric replacement - - message - org.apache.taglibs.standard.tag.rt.fmt.MessageTag - JSP - - -Message key to be looked up. - - key - false - true - - - -Localization context in whose resource -bundle the message key is looked up. - - bundle - false - true - - - -Name of the exported scoped variable -which stores the localized message. - - var - false - false - - - -Scope of var. - - scope - false - false - - - - - - Supplies an argument for parametric replacement to a containing - <message> tag - - param - org.apache.taglibs.standard.tag.rt.fmt.ParamTag - JSP - - -Argument used for parametric replacement. - - value - false - true - - - - - - Formats a numeric value as a number, currency, or percentage - - formatNumber - org.apache.taglibs.standard.tag.rt.fmt.FormatNumberTag - JSP - - -Numeric value to be formatted. - - value - false - true - - - -Specifies whether the value is to be -formatted as number, currency, or -percentage. - - type - false - true - - - -Custom formatting pattern. - - pattern - false - true - - - -ISO 4217 currency code. Applied only -when formatting currencies (i.e. if type is -equal to "currency"); ignored otherwise. - - currencyCode - false - true - - - -Currency symbol. Applied only when -formatting currencies (i.e. if type is equal -to "currency"); ignored otherwise. - - currencySymbol - false - true - - - -Specifies whether the formatted output -will contain any grouping separators. - - groupingUsed - false - true - - - -Maximum number of digits in the integer -portion of the formatted output. - - maxIntegerDigits - false - true - - - -Minimum number of digits in the integer -portion of the formatted output. - - minIntegerDigits - false - true - - - -Maximum number of digits in the -fractional portion of the formatted output. - - maxFractionDigits - false - true - - - -Minimum number of digits in the -fractional portion of the formatted output. - - minFractionDigits - false - true - - - -Name of the exported scoped variable -which stores the formatted result as a -String. - - var - false - false - - - -Scope of var. - - scope - false - false - - - - - - Parses the string representation of a number, currency, or percentage - - parseNumber - org.apache.taglibs.standard.tag.rt.fmt.ParseNumberTag - JSP - - -String to be parsed. - - value - false - true - - - -Specifies whether the string in the value -attribute should be parsed as a number, -currency, or percentage. - - type - false - true - - - -Custom formatting pattern that determines -how the string in the value attribute is to be -parsed. - - pattern - false - true - - - -Locale whose default formatting pattern (for -numbers, currencies, or percentages, -respectively) is to be used during the parse -operation, or to which the pattern specified -via the pattern attribute (if present) is -applied. - - parseLocale - false - true - - - -Specifies whether just the integer portion of -the given value should be parsed. - - integerOnly - false - true - - - -Name of the exported scoped variable which -stores the parsed result (of type -java.lang.Number). - - var - false - false - - - -Scope of var. - - scope - false - false - - - - - - Formats a date and/or time using the supplied styles and pattern - - formatDate - org.apache.taglibs.standard.tag.rt.fmt.FormatDateTag - empty - - -Date and/or time to be formatted. - - value - true - true - - - -Specifies whether the time, the date, or both -the time and date components of the given -date are to be formatted. - - type - false - true - - - -Predefined formatting style for dates. Follows -the semantics defined in class -java.text.DateFormat. Applied only -when formatting a date or both a date and -time (i.e. if type is missing or is equal to -"date" or "both"); ignored otherwise. - - dateStyle - false - true - - - -Predefined formatting style for times. Follows -the semantics defined in class -java.text.DateFormat. Applied only -when formatting a time or both a date and -time (i.e. if type is equal to "time" or "both"); -ignored otherwise. - - timeStyle - false - true - - - -Custom formatting style for dates and times. - - pattern - false - true - - - -Time zone in which to represent the formatted -time. - - timeZone - false - true - - - -Name of the exported scoped variable which -stores the formatted result as a String. - - var - false - false - - - -Scope of var. - - scope - false - false - - - - - - Parses the string representation of a date and/or time - - parseDate - org.apache.taglibs.standard.tag.rt.fmt.ParseDateTag - JSP - - -Date string to be parsed. - - value - false - true - - - -Specifies whether the date string in the -value attribute is supposed to contain a -time, a date, or both. - - type - false - true - - - -Predefined formatting style for days -which determines how the date -component of the date string is to be -parsed. Applied only when formatting a -date or both a date and time (i.e. if type -is missing or is equal to "date" or "both"); -ignored otherwise. - - dateStyle - false - true - - - -Predefined formatting styles for times -which determines how the time -component in the date string is to be -parsed. Applied only when formatting a -time or both a date and time (i.e. if type -is equal to "time" or "both"); ignored -otherwise. - - timeStyle - false - true - - - -Custom formatting pattern which -determines how the date string is to be -parsed. - - pattern - false - true - - - -Time zone in which to interpret any time -information in the date string. - - timeZone - false - true - - - -Locale whose predefined formatting styles -for dates and times are to be used during -the parse operation, or to which the -pattern specified via the pattern -attribute (if present) is applied. - - parseLocale - false - true - - - -Name of the exported scoped variable in -which the parsing result (of type -java.util.Date) is stored. - - var - false - false - - - -Scope of var. - - scope - false - false - - - - diff --git a/caom2-search-server/examples/default/src/main/webapp/WEB-INF/web.xml b/caom2-search-server/examples/default/src/main/webapp/WEB-INF/web.xml deleted file mode 100644 index db51f677..00000000 --- a/caom2-search-server/examples/default/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,287 +0,0 @@ - - - - - - - AdvancedSearch - - - WebAccessControlFilter - ca.nrc.cadc.web.WebAccessControlFilter - - - - SSIFilter - org.apache.catalina.ssi.SSIFilter - - - - WebAccessControlFilter - /* - - - - SSIFilter - *.html - - - - - logControl - ca.nrc.cadc.log.LogControlServlet - - logLevel - info - - - logLevelPackages - - ca.nrc.cadc.uws - ca.nrc.cadc.tap - ca.nrc.cadc.vosi - ca.nrc.cadc.search - ca.nrc.cadc.caom2 - ca.nrc.cadc.web - - - 1 - - - - - SearchJobServlet - ca.nrc.cadc.uws.server.JobServlet - - post - ca.nrc.cadc.uws.web.SyncPostAction - - - get - ca.nrc.cadc.uws.web.SyncGetAction - - - ca.nrc.cadc.uws.server.JobManager - ca.nrc.cadc.uws.SearchJobManager - - - - - QuickSearchServlet - ca.nrc.cadc.search.QuickSearchServlet - 2 - - - - Servlet to convert units and return the search value. - - UnitConversionServlet - ca.nrc.cadc.search.UnitConversionServlet - 1 - - - - - PreviewServlet - ca.nrc.cadc.search.PreviewServlet - 4 - - - - - DataLinkServlet - ca.nrc.cadc.search.SearchPreviewServlet - 4 - - - - - ColumnUnitServlet - ca.nrc.cadc.search.ColumnUnitServlet - 4 - - - - PackageServiceServlet - ca.nrc.cadc.search.PackageServlet - - - - - FormValidationServlet - ca.nrc.cadc.search.FormValidationServlet - 4 - - - - logControl - /logControl - - - - - doc - /doc.jsp - - - hierarchy - /hierarchy.jsp - - - hierarchyError - /hierarchyError.jsp - - - number - /number.jsp - - - text - /text.jsp - - - - - - - doc - /doc - - - hierarchy - /hierarchy - - - hierarchyError - /hierarchyError - - - number - /number - - - text - /text - - - - PreviewServlet - /preview/* - /preview - - - - DataLinkServlet - /datalink/* - /datalink - - - - ColumnUnitServlet - /columnUnit - - - - PackageServiceServlet - /package - - - - SearchJobServlet - /find/* - - - - SearchJobServlet - /find - - - - QuickSearchServlet - /quick/* - - - - QuickSearchServlet - /rapide/* - - - - UnitConversionServlet - /unitconversion/* - - - - FormValidationServlet - /validate/* - - - - - Public security role - public - - - - - http://java.sun.com/jsp/jstl/core - /WEB-INF/tags/c.tld - - - - http://java.sun.com/jsp/jstl/fmt - /WEB-INF/tags/fmt.tld - - - - - html - text/x-server-parsed-html - - - diff --git a/caom2-search-server/examples/default/src/main/webapp/_page_header.jsp b/caom2-search-server/examples/default/src/main/webapp/_page_header.jsp deleted file mode 100644 index 020bb4e0..00000000 --- a/caom2-search-server/examples/default/src/main/webapp/_page_header.jsp +++ /dev/null @@ -1,64 +0,0 @@ -<%@ page import="ca.nrc.cadc.config.ApplicationConfiguration" %> -<%@ page language="java" contentType="text/html; charset=UTF-8" session="false" - pageEncoding="UTF-8" %> -<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> -<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %> - - - - - - - - - - - CAOM-2 Search - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/caom2-search-server/examples/int-test/default-ssl.conf b/caom2-search-server/examples/int-test/default-ssl.conf deleted file mode 100644 index 2851761d..00000000 --- a/caom2-search-server/examples/int-test/default-ssl.conf +++ /dev/null @@ -1,36 +0,0 @@ -server { - listen 443 ssl; - ssl_certificate /usr/share/nginx/certs/server.crt; - ssl_certificate_key /usr/share/nginx/certs/server.key; - ssl_protocols TLSv1 TLSv1.1 TLSv1.2; - ssl_ciphers HIGH:!aNULL:!MD5; - - server_name proxy.cadc.dao.nrc.ca; - root /usr/share/nginx/html; - error_log /var/log/nginx/error.log debug; - log_subrequest on; - ssi on; - ssi_silent_errors off; - - location ~ ^/(access|cadc-target-resolver|tap|ac|caom2ops|data|reg)/ { - proxy_set_header X-Forwarded-Host $host; - proxy_set_header X-Forwarded-Server $host; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_pass http://www.cadc-ccda.hia-iha.nrc-cnrc.gc.ca; - } - - location /search { - proxy_set_header X-Forwarded-Host $host; - proxy_set_header X-Forwarded-Server $host; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_pass http://search.cadc.dao.nrc.ca:8080; - } - - location /caom2ui { - proxy_set_header X-Forwarded-Host $host; - proxy_set_header X-Forwarded-Server $host; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_pass http://caom2-meta-ui.cadc.dao.nrc.ca:8080; - } -} - diff --git a/caom2-search-server/examples/int-test/default.conf b/caom2-search-server/examples/int-test/default.conf deleted file mode 100644 index 41d6a726..00000000 --- a/caom2-search-server/examples/int-test/default.conf +++ /dev/null @@ -1,37 +0,0 @@ -server { -# listen 443 ssl; -# ssl_certificate /usr/share/nginx/certs/server.crt; -# ssl_certificate_key /usr/share/nginx/certs/server.key; -# ssl_protocols TLSv1 TLSv1.1 TLSv1.2; -# ssl_ciphers HIGH:!aNULL:!MD5; - listen 80; - - server_name proxy.cadc.dao.nrc.ca; - root /usr/share/nginx/html; - error_log /var/log/nginx/error.log debug; - log_subrequest on; - ssi on; - ssi_silent_errors off; - - location ~ ^/(access|cadc-target-resolver|tap|ac|caom2ops|data|reg)/ { - proxy_set_header X-Forwarded-Host $host; - proxy_set_header X-Forwarded-Server $host; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_pass http://www.cadc-ccda.hia-iha.nrc-cnrc.gc.ca; - } - - location /search { - proxy_set_header X-Forwarded-Host $host; - proxy_set_header X-Forwarded-Server $host; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_pass http://search.cadc.dao.nrc.ca:8080; - } - - location /caom2ui { - proxy_set_header X-Forwarded-Host $host; - proxy_set_header X-Forwarded-Server $host; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_pass http://caom2-meta-ui.cadc.dao.nrc.ca:8080; - } -} - diff --git a/caom2-search-server/examples/int-test/docker-compose-ssl.yml b/caom2-search-server/examples/int-test/docker-compose-ssl.yml deleted file mode 100644 index 577c5620..00000000 --- a/caom2-search-server/examples/int-test/docker-compose-ssl.yml +++ /dev/null @@ -1,53 +0,0 @@ -version: '3.2' -services: - proxy.cadc.dao.nrc.ca: - hostname: proxy.cadc.dao.nrc.ca - image: nginx:alpine - ports: - - '443:443' - networks: - - 'caom2search' - volumes: - - 'server_certs:/usr/share/nginx/certs' - - './default-ssl.conf:/etc/nginx/conf.d/default.conf' - depends_on: - - search.cadc.dao.nrc.ca - - caom2-meta-ui.cadc.dao.nrc.ca - selenium-firefox: - image: selenium/standalone-firefox:3 - ports: - - '4444:4444' - networks: - - 'caom2search' - depends_on: - - proxy.cadc.dao.nrc.ca - search.cadc.dao.nrc.ca: - image: opencadc/caom2-search:SNAPSHOT - networks: - - 'caom2search' - depends_on: - - uwspg.cadc.dao.nrc.ca - - caom2-meta-ui.cadc.dao.nrc.ca - env_file: - - 'org.opencadc.search.env.properties' - volumes: - - './search##2048.war:/usr/local/tomcat/webapps/search##2048.war' - uwspg.cadc.dao.nrc.ca: - image: opencadc/uws-postgres:alpine - networks: - - 'caom2search' - environment: - POSTGRES_USER: uws - POSTGRES_PASSWORD: astr0query - caom2-meta-ui.cadc.dao.nrc.ca: - image: opencadc/caom2-meta-ui:alpine - networks: - - 'caom2search' - -# Create the network 'caom2search' for which this system will run within. -networks: - caom2search: - -volumes: - server_certs: - external: true diff --git a/caom2-search-server/examples/int-test/docker-compose.yml b/caom2-search-server/examples/int-test/docker-compose.yml deleted file mode 100644 index 802ff22c..00000000 --- a/caom2-search-server/examples/int-test/docker-compose.yml +++ /dev/null @@ -1,46 +0,0 @@ -version: '3.2' -services: - proxy.cadc.dao.nrc.ca: - hostname: proxy.cadc.dao.nrc.ca - image: nginx:alpine - ports: - - '80:80' - networks: - - 'caom2search' - volumes: - - './default.conf:/etc/nginx/conf.d/default.conf' - depends_on: - - search.cadc.dao.nrc.ca - - caom2-meta-ui.cadc.dao.nrc.ca - selenium-firefox: - image: selenium/standalone-firefox:3 - ports: - - '4444:4444' - networks: - - 'caom2search' - depends_on: - - proxy.cadc.dao.nrc.ca - search.cadc.dao.nrc.ca: - image: opencadc/caom2-search:SNAPSHOT - networks: - - 'caom2search' - depends_on: - - uwspg.cadc.dao.nrc.ca - - caom2-meta-ui.cadc.dao.nrc.ca - env_file: - - 'org.opencadc.search.env.properties' - uwspg.cadc.dao.nrc.ca: - image: opencadc/uws-postgres:alpine - networks: - - 'caom2search' - environment: - POSTGRES_USER: uws - POSTGRES_PASSWORD: astr0query - caom2-meta-ui.cadc.dao.nrc.ca: - image: opencadc/caom2-meta-ui:SNAPSHOT - networks: - - 'caom2search' - -# Create the network 'caom2search' for which this system will run within. -networks: - caom2search: diff --git a/caom2-search-server/examples/int-test/org.opencadc.search.env.properties b/caom2-search-server/examples/int-test/org.opencadc.search.env.properties deleted file mode 100644 index 5b926cf1..00000000 --- a/caom2-search-server/examples/int-test/org.opencadc.search.env.properties +++ /dev/null @@ -1 +0,0 @@ -CATALINA_OPTS=-Dcaom2search.uws.maxActive=1 -Dcaom2search.uws.username=uws -Dcaom2search.uws.password=astr0query -Dcaom2search.uws.url=jdbc:postgresql://uwspg.cadc.dao.nrc.ca:5432/uws \ No newline at end of file diff --git a/caom2-search-server/src/main/java/ca/nrc/cadc/search/HiPSImageSurveyServlet.java b/caom2-search-server/src/main/java/ca/nrc/cadc/search/HiPSImageSurveyServlet.java index c620d1e5..8c8cd777 100644 --- a/caom2-search-server/src/main/java/ca/nrc/cadc/search/HiPSImageSurveyServlet.java +++ b/caom2-search-server/src/main/java/ca/nrc/cadc/search/HiPSImageSurveyServlet.java @@ -69,6 +69,7 @@ package ca.nrc.cadc.search; import ca.nrc.cadc.net.HttpGet; +import ca.nrc.cadc.util.StringUtil; import ca.nrc.cadc.web.ConfigurableServlet; import org.apache.log4j.Logger; @@ -78,26 +79,16 @@ import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.io.OutputStream; -import java.net.MalformedURLException; import java.net.URL; +import java.util.Arrays; public class HiPSImageSurveyServlet extends ConfigurableServlet { private static final Logger LOGGER = Logger.getLogger(HiPSImageSurveyServlet.class); - private static final String DEFAULT_HIPS_BASE_URL = - "https://archive-new.nrao.edu/vlass/HiPS/VLASS_Epoch1/Quicklook"; - - private final URL hipsBaseURL; - public HiPSImageSurveyServlet() { super(); - try { - this.hipsBaseURL = new URL(DEFAULT_HIPS_BASE_URL); - } catch (MalformedURLException malformedURLException) { - throw new RuntimeException(malformedURLException.getMessage(), malformedURLException); - } } /** @@ -106,7 +97,7 @@ public HiPSImageSurveyServlet() { * *

Overriding this method to support a GET request also * automatically supports an HTTP HEAD request. A HEAD - * request is a GET request that returns no body in the + * request is a GET request that returns an empty body in the * response, only the request header fields. * *

When overriding this method, read the request data, @@ -165,13 +156,23 @@ protected void doGet(final HttpServletRequest req, final HttpServletResponse res throws ServletException, IOException { LOGGER.debug("doGet()"); final OutputStream outputStream = resp.getOutputStream(); - final String baseURLString = hipsBaseURL.toExternalForm() + "%s"; - final URL endpoint = new URL(String.format(baseURLString, req.getPathInfo())); - LOGGER.debug(String.format("Proxying request to %s", endpoint.toExternalForm())); - write(endpoint, outputStream); + final URL hipsURL = getHipsURL(req); + LOGGER.debug(String.format("Proxying request to %s", hipsURL.toExternalForm())); + write(hipsURL, outputStream); LOGGER.debug("doGet() complete"); } + private URL getHipsURL(final HttpServletRequest request) throws IOException { + final String pathInfo = request.getPathInfo(); + final String[] pathElements = Arrays.stream(pathInfo.split("/")) + .filter(StringUtil::hasText) + .toArray(String[]::new); + final SurveyImageBackend surveyImageBackend = SurveyImageBackend.valueOf(pathElements[0].toUpperCase()); + final String[] relevantPathItems = Arrays.copyOfRange(pathElements, 1, pathElements.length); + final String relevantPath = String.join("/", relevantPathItems); + return new URL(surveyImageBackend.tileEndpoint + "/" + relevantPath); + } + private void write(final URL endpoint, final OutputStream outputStream) throws IOException { final HttpGet httpGet = createHttpGet(endpoint, outputStream); httpGet.run(); @@ -181,4 +182,15 @@ private void write(final URL endpoint, final OutputStream outputStream) throws I HttpGet createHttpGet(final URL url, final OutputStream outputStream) { return new HttpGet(url, outputStream); } + + private enum SurveyImageBackend { + VLASS("https://archive-new.nrao.edu/vlass/HiPS/VLASS_Epoch1/Quicklook"), + LOTSS("https://hips.astron.nl/ASTRON/P/lotss_dr2_high"); + + private final String tileEndpoint; + + SurveyImageBackend(String tileEndpoint) { + this.tileEndpoint = tileEndpoint; + } + } } diff --git a/caom2-search-server/src/main/java/ca/nrc/cadc/uws/SearchJobManager.java b/caom2-search-server/src/main/java/ca/nrc/cadc/uws/SearchJobManager.java index b5e708e0..e529418d 100644 --- a/caom2-search-server/src/main/java/ca/nrc/cadc/uws/SearchJobManager.java +++ b/caom2-search-server/src/main/java/ca/nrc/cadc/uws/SearchJobManager.java @@ -1,7 +1,7 @@ package ca.nrc.cadc.uws; -import ca.nrc.cadc.auth.ACIdentityManager; +import ca.nrc.cadc.ac.ACIdentityManager; import ca.nrc.cadc.auth.IdentityManager; import ca.nrc.cadc.uws.server.DatabaseJobPersistence; import ca.nrc.cadc.uws.server.JobExecutor; diff --git a/caom2-search-server/src/test/java/ca/nrc/cadc/search/HiPSImageSurveyServletTest.java b/caom2-search-server/src/test/java/ca/nrc/cadc/search/HiPSImageSurveyServletTest.java index 6cbfeab7..17015cb7 100644 --- a/caom2-search-server/src/test/java/ca/nrc/cadc/search/HiPSImageSurveyServletTest.java +++ b/caom2-search-server/src/test/java/ca/nrc/cadc/search/HiPSImageSurveyServletTest.java @@ -70,6 +70,7 @@ import ca.nrc.cadc.AbstractUnitTest; import ca.nrc.cadc.net.HttpGet; +import org.junit.Assert; import org.junit.Test; import javax.servlet.ServletOutputStream; @@ -89,14 +90,20 @@ public void testGET() throws Exception { final HttpServletRequest mockRequest = createMock(HttpServletRequest.class); final HttpServletResponse mockResponse = createMock(HttpServletResponse.class); final ServletOutputStream mockServletOutputStream = createMock(ServletOutputStream.class); + final URL expectedURL = + new URL("https://archive-new.nrao.edu/vlass/HiPS/VLASS_Epoch1/Quicklook/mypath/3"); final HttpGet mockHTTPGet = createMock(HttpGet.class); mockHTTPGet.run(); expectLastCall().once(); + final boolean[] callsMade = new boolean[] { false }; + this.testSubject = new HiPSImageSurveyServlet() { @Override HttpGet createHttpGet(URL url, OutputStream outputStream) { + Assert.assertEquals("Wrong URL.", expectedURL, url); + callsMade[0] = true; return mockHTTPGet; } }; @@ -105,10 +112,11 @@ HttpGet createHttpGet(URL url, OutputStream outputStream) { expectLastCall().once(); expect(mockResponse.getOutputStream()).andReturn(mockServletOutputStream).once(); - expect(mockRequest.getPathInfo()).andReturn("/mypath"); + expect(mockRequest.getPathInfo()).andReturn("/vlass/mypath/3"); replay(mockHTTPGet, mockRequest, mockResponse, mockServletOutputStream); this.testSubject.doGet(mockRequest, mockResponse); + Assert.assertTrue("Call was not made.", callsMade[0]); verify(mockHTTPGet, mockRequest, mockResponse, mockServletOutputStream); } }