org.gcube.dir.master.stubs.test
Class RSGenerator

java.lang.Object
  extended by org.gcube.dir.master.stubs.test.RSGenerator

public class RSGenerator
extends java.lang.Object

Creates and serialises to file the locator of a ResultSet WS-Resource that contains the simulated output of a given full-text query executed against a given collection. The WS-Resource is then suitable as input of merging functionality offered by WS-Resources of the DIR Master service.

The test requires the following command-line inputs:

(1) The identifier of the collection. (2) A comma-separated list of query terms.
(3) The size of the resultset.
(4) The host name and port of a gHN node which runs the ResultService.
(5) The scope in which the WS-Resource resource ought to be created.
(6) The name of the file where the locator to the ResultSet WS-Resource should be created.

Author:
Fabio Simeoni (University of Strathclyde)

Constructor Summary
RSGenerator()
           
 
Method Summary
static ResultElementBase generateResult(java.lang.String[] queryTerms, java.lang.String collectionURI)
          Generates a simulated result of executing a given query against a given collection.
static RSLocator generateResultSet(java.lang.String[] queryTerms, java.lang.String collectionID, int size, java.lang.String host, GCUBEScope scope)
          Generates a Resultset that simulates the result of executing a full-text query against the contant of a collection.
static void main(java.lang.String[] args)
          Run tests and logs any exception.
static RSLocator run(java.lang.String[] args)
          Run test.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RSGenerator

public RSGenerator()
Method Detail

main

public static void main(java.lang.String[] args)
Run tests and logs any exception.

Parameters:
args - the test arguments as documented above.

run

public static RSLocator run(java.lang.String[] args)
                     throws java.lang.Exception
Run test.

Parameters:
args - test arguments.
Throws:
java.lang.Exception - if the test did not complete successfully.

generateResultSet

public static RSLocator generateResultSet(java.lang.String[] queryTerms,
                                          java.lang.String collectionID,
                                          int size,
                                          java.lang.String host,
                                          GCUBEScope scope)
                                   throws java.lang.Exception
Generates a Resultset that simulates the result of executing a full-text query against the contant of a collection.

Parameters:
queryTerms - the query terms.
collectionID - the collection identifier.
Returns:
the Resultset locator.
Throws:
java.lang.Exception - if the ResultSet could not be generated.

generateResult

public static ResultElementBase generateResult(java.lang.String[] queryTerms,
                                               java.lang.String collectionURI)
                                        throws java.lang.Exception
Generates a simulated result of executing a given query against a given collection.

Parameters:
queryTerms - the query terms.
collectionURI - the collection identifiers
Returns:
the result
Throws:
java.lang.Exception - if the result could not be generated.