Since Eclipse automatically compiles classes when the associated Java source files are saved, there is no need to recompile the service for this step. If you are not using Eclipse, run the following command to rebuild the service, including the QueryRunner test class:
Once compiled, the QueryRunner can be invoked.
- In Eclipse, right-click the QueryRunner class file, and select Run As -> Run... to bring up the Run dialog.
- Click the New Launch Configuration icon in the upper right. The names of the run configuration, project, and Main class are automatically populated.
- Change to the Arguments tab to specify the command line arguments which will be passed to the QueryRunner's main method.
- In the Program arguments text field, enter the following line, without quotes These 2 elements must be separated by a single space:
- This is the URL of the tutorial grid service, as deployed in the local Tomcat installation.
- If the container's port is different than the default, change 8443 to match it.
- This is the CQL query from earlier in the tutorial. It will be executed by the data service.
- Finally, click the Run button to save this configuration and execute the QueryRunner class.
As the class executes, any messages from it will be printed to the console. When complete, the console should appear similar to the following:
These results indicate the data service retrieved a single Suit instance matching the query criteria. Changing the CQL query passed to the QueryRunner will change the output as the data service locates different objects.