-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #50 from dixudx/development
doc and tests for saved queries
- Loading branch information
Showing
8 changed files
with
308 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -53,3 +53,7 @@ Models | |
|
||
.. autoclass:: rtcclient.models.Comment | ||
:members: | ||
|
||
|
||
.. autoclass:: rtcclient.models.SavedQuery | ||
:members: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -244,9 +244,46 @@ will be fetched. | |
# below query string means: query all the workitems with title "use case 1" | ||
>>> myquerystr = 'dc:title="use case 1"' | ||
>>> returned_prop = "dc:title,dc:identifier,rtc_cm:state,rtc_cm:ownedBy" | ||
>>> queried_wis = myquery.queryWorkitems(query_str=myquerystr, | ||
>>> queried_wis = myquery.queryWorkitems(myquerystr, | ||
projectarea_name=projectarea_name, | ||
returned_properties=returned_prop) | ||
|
||
More detailed and advanced syntax on querying, please refer to | ||
:ref:`query syntax <query_syntax>`. | ||
|
||
|
||
Query Workitems by Saved Query | ||
------------------------------ | ||
|
||
You may have created several customized queries through RTC Web GUI or got | ||
some saved queries created by other team members. Using these saved queries | ||
|
||
>>> myquery = myclient.query # query class | ||
>>> saved_query_url = 'http://test.url:9443/jazz/xxxxxxxx&id=xxxxx' | ||
>>> projectarea_name = "my_projectarea_name" | ||
# get all saved queries | ||
# WARNING: now the RTC server cannot correctly list all the saved queries | ||
# It seems to be a bug of RTC. Recommend using `runSavedQueryByUrl` to | ||
# query all the workitems if the query is saved. | ||
>>> allsavedqueries = myquery.getAllSavedQueries(projectarea_name=projectarea_name) | ||
# saved queries created by [email protected] | ||
>>> allsavedqueries = myquery.getAllSavedQueries(projectarea_name=projectarea_name, | ||
creator="[email protected]") | ||
# my saved queries | ||
>>> mysavedqueries = myquery.getMySavedQueries(projectarea_name=projectarea_name) | ||
>>> mysavedquery = mysavedqueries[0] | ||
>>> returned_prop = "dc:title,dc:identifier,rtc_cm:state,rtc_cm:ownedBy" | ||
>>> queried_wis = myquery.runSavedQuery(mysavedquery, | ||
returned_properties=returned_prop) | ||
|
||
|
||
Query Workitems by Saved Query Url | ||
---------------------------------- | ||
|
||
You can also query all the workitems directly using your saved query's url. | ||
|
||
>>> myquery = myclient.query # query class | ||
>>> saved_query_url = 'http://test.url:9443/jazz/xxxxxxxx&id=xxxxx' | ||
>>> returned_prop = "dc:title,dc:identifier,rtc_cm:state,rtc_cm:ownedBy" | ||
>>> queried_wis = myquery.runSavedQueryByUrl(saved_query_url, | ||
returned_properties=returned_prop) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,6 @@ def rtcclient(mocker): | |
mocked_headers.return_value = mock_resp | ||
|
||
return RTCClient(url="http://test.url:9443/jazz", | ||
username="user", | ||
username="[email protected]", | ||
password="password", | ||
searchpath=_search_path) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<oslc_cm:Collection xmlns:oslc_cm="http://open-services.net/xmlns/cm/1.0/" xmlns:dc="http://purl.org/dc/terms/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rtc_cm="http://jazz.net/xmlns/prod/jazz/rtc/cm/1.0/" oslc_cm:totalCount="3"> | ||
<rtc_cm:Query rdf:resource="http://test.url:9443/jazz/resource/itemOid/com.ibm.team.workitem.query.QueryDescriptor/_1CR5MMfiEd6yW_0tvNlbrw"> | ||
<dc:identifier/> | ||
<dc:title>Closed created by me</dc:title> | ||
<rtc_cm:projectArea rdf:resource="http://test.url:9443/jazz/oslc/projectareas/_0qMJUMfiEd6yW_0tvNlbrw"/> | ||
<dc:description>Work items I have created which have been resolved</dc:description> | ||
<rtc_cm:results oslc_cm:collref="http://test.url:9443/jazz/oslc/queries/_1CR5MMfiEd6yW_0tvNlbrw/rtc_cm:results"/> | ||
<dc:creator rdf:resource="http://test.url:9443/jts/users/tester1%40email.com"/> | ||
<dc:modified>2014-02-22T01:23:47.490Z</dc:modified> | ||
<rtc_cm:modifiedBy rdf:resource="http://test.url:9443/jts/users/ADMIN"/> | ||
</rtc_cm:Query> | ||
<rtc_cm:Query rdf:resource="http://test.url:9443/jazz/resource/itemOid/com.ibm.team.workitem.query.QueryDescriptor/_1CTHUMfiEd6yW_0tvNlbrw"> | ||
<dc:identifier/> | ||
<dc:title>Open Track Build Items</dc:title> | ||
<rtc_cm:projectArea rdf:resource="http://test.url:9443/jazz/oslc/projectareas/_0qMJUMfiEd6yW_0tvNlbrw"/> | ||
<dc:description>All unresolved Track Build Items</dc:description> | ||
<rtc_cm:results oslc_cm:collref="http://test.url:9443/jazz/oslc/queries/_1CTHUMfiEd6yW_0tvNlbrw/rtc_cm:results"/> | ||
<dc:creator rdf:resource="http://test.url:9443/jts/users/tester2%40email.com"/> | ||
<dc:modified>2014-02-22T01:23:47.495Z</dc:modified> | ||
<rtc_cm:modifiedBy rdf:resource="http://test.url:9443/jts/users/ADMIN"/> | ||
</rtc_cm:Query> | ||
<rtc_cm:Query rdf:resource="http://test.url:9443/jazz/resource/itemOid/com.ibm.team.workitem.query.QueryDescriptor/_1CU8gMfiEd6yW_0tvNlbrw"> | ||
<dc:identifier/> | ||
<dc:title>Open Adoptions</dc:title> | ||
<rtc_cm:projectArea rdf:resource="http://test.url:9443/jazz/oslc/projectareas/_CuZu0HUwEeKicpXBddtqNA"/> | ||
<dc:description/> | ||
<rtc_cm:results oslc_cm:collref="http://test.url:9443/jazz/oslc/queries/_1CU8gMfiEd6yW_0tvNlbrw/rtc_cm:results"/> | ||
<dc:creator rdf:resource="http://test.url:9443/jts/users/tester2%40email.com"/> | ||
<dc:modified>2014-02-22T01:23:47.499Z</dc:modified> | ||
<rtc_cm:modifiedBy rdf:resource="http://test.url:9443/jts/users/ADMIN"/> | ||
</rtc_cm:Query> | ||
</oslc_cm:Collection> |
Oops, something went wrong.