Class OpenSearchCoreTests
java.lang.Object
org.opengis.cite.cat30.CommonFixture
org.opengis.cite.cat30.opensearch.OpenSearchCoreTests
Verifies behavior of the SUT when processing queries that contain one or more core
OpenSearch parameters. The relevant query parameter bindings are shown in the following
table.
Parameter name | Parameter value template | Description |
---|---|---|
q | {searchTerms} | A comma-separated list of terms used to search across all text fields. The value must be URL-encoded. |
startPosition | {startIndex?} | Integer value specifying first search result desired by the client. |
maxRecords | {count?} | Non-negative integer value specifying the number of search results (per page) desired by the client. |
Sources
- [OGC-12-176r5] OGC Catalogue Services 3.0 Specification – HTTP Protocol Binding, Table 6: KVP encoding for query constraints
- OpenSearch 1.1 Draft 5
-
Field Summary
Fields inherited from class org.opengis.cite.cat30.CommonFixture
atomSchema, client, cswCapabilities, cswSchema, request, response, ROOT_PKG_PATH, SCHEMATRON_ATOM
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Executes example queries specified in the OpenSearch description document.void
initOpenSearchCoreTestsFixture
(org.testng.ITestContext testContext) Initializes the test fixture.(package private) NodeList
invokeQuery
(Element qryTemplate, Map<QName, String> parameters) Invokes the query defined by the given OpenSearch template.void
[Test] Submits a keyword search where the searchTerms value is a randomly generated sequence of 5-14 characters in the range [a-z].void
[Test] Submits a keyword search request where the {searchTerms} value contains two terms (URL-encoded).(package private) String
randomlySelectTitleWord
(List<String> titles) Returns a word from a randomly selected title in the given list.(package private) void
setSearchTerm
(String searchTerm) void
[Test] Submits a keyword search where the {searchTerms} value is a title word (URL-encoded) that occurs in at least one catalog record.void
[Test] Submits a query that contains thecount
andstartIndex
parameters.Methods inherited from class org.opengis.cite.cat30.CommonFixture
buildGetRequest, clearMessages, getResponseEntityAsDocument, initCommonFixture
-
Constructor Details
-
OpenSearchCoreTests
public OpenSearchCoreTests()
-
-
Method Details
-
setSearchTerm
- Parameters:
searchTerm
-
-
initOpenSearchCoreTestsFixture
@BeforeClass public void initOpenSearchCoreTestsFixture(org.testng.ITestContext testContext) Initializes the test fixture. A Document representing an OpenSearch description document is obtained from the test context and the URL templates it contains are extracted.- Parameters:
testContext
- The test context containing various suite attributes.
-
keywordSearch_emptyResultSet
public void keywordSearch_emptyResultSet()[Test] Submits a keyword search where the searchTerms value is a randomly generated sequence of 5-14 characters in the range [a-z]. The result set is expected to be empty; that is, there are no matching entries (os:totalResults = 0). -
singleKeywordSearch
public void singleKeywordSearch()[Test] Submits a keyword search where the {searchTerms} value is a title word (URL-encoded) that occurs in at least one catalog record. The result set must not be empty. -
multipleKeywordSearch
public void multipleKeywordSearch()[Test] Submits a keyword search request where the {searchTerms} value contains two terms (URL-encoded). The result set must not be empty. -
sliceResults
public void sliceResults()[Test] Submits a query that contains thecount
andstartIndex
parameters. The response entity must contain the requested 'slice' of the result set in accord with its content model:- atom:feed (with OpenSearch response elements)
- csw:GetRecordsResponse/csw:SearchResults
-
executeExampleQueries
public void executeExampleQueries()Executes example queries specified in the OpenSearch description document. It is recommended that the document contains at least one query having role="example" in order to allow testing or demonstration of the search service. -
invokeQuery
Invokes the query defined by the given OpenSearch template. The supplied parameters replace the corresponding substitution variables in the template.- Parameters:
qryTemplate
- An Element representing an OpenSearch query template (osd:Url).parameters
- A Map containing the actual query parameters.- Returns:
- A NodeList containing the records extracted from the response.
-
randomlySelectTitleWord
Returns a word from a randomly selected title in the given list.- Parameters:
titles
- A list of record titles.- Returns:
- A word (the last) occurring in some title.
-