Skip to content

Commit 90dec0a

Browse files
committed
removed hard limit on number of prefixes in rdfxml.py, added oslc_config as pre-known prefix for gcm, set default oslc query page size to 0
1 parent 40bf077 commit 90dec0a

33 files changed

+1960
-1766
lines changed

elmclient/_gcm.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232

3333
#################################################################################################
3434

35-
# hook to adapt OSLC query parameters needed for GC - no orderBy, prefixes must NOT include dcterms
35+
# hook to adapt OSLC query parameters needed for GC - no orderBy, prefixes must NOT include dcterms or oslc_config
3636
def _hook_beforequery(querydetails):
3737
# remove orderby
3838
if 'orderBy' in querydetails:
@@ -41,7 +41,7 @@ def _hook_beforequery(querydetails):
4141
if 'dcterms=' in querydetails.get('oslc.prefix',"") or 'oslc' in querydetails.get('oslc.prefix',"") or 'rdf' in querydetails.get('oslc.prefix',""):
4242
oldprefix = querydetails['oslc.prefix']
4343
prefixes = oldprefix.split(",")
44-
newprefixes = [p for p in prefixes if not p.startswith("dcterms=") and not p.startswith("oslc=") and not p.startswith("rdf=")]
44+
newprefixes = [p for p in prefixes if not p.startswith("dcterms=") and not p.startswith("oslc=") and not p.startswith("rdf=") and not p.startswith("oslc_config=")]
4545
querydetails['oslc.prefix'] = ",".join(newprefixes)
4646
newprefix = querydetails['oslc.prefix']
4747
return querydetails

elmclient/examples/oslcquery.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ def do_oslc_query(inputargs=None):
105105
# various options
106106
parser.add_argument('--nresults', default=-1, type=int, help="Number of results expected - used for regression testing - use `--nresults -1` to disable checking")
107107
parser.add_argument('--compareresults', default=None, help="TESTING UNFINISHED: saved CSV file to compare results with")
108-
parser.add_argument('--pagesize', default=200, type=int, help="Page size for OSLC query (default 200) use 0 to suppress paging (server may still page)")
108+
parser.add_argument('--pagesize', default=0, type=int, help="Page size for OSLC query (default 0) use 0 to suppress paging (server may still page)")
109109
parser.add_argument('--typesystemreport', default=None, help="Load the specified project/configuration and then produce a simple HTML type system report of resource shapes/properties/enumerations to this file" )
110110
parser.add_argument('--cachedays', default=7,type=int, help="The number of days for caching received data, default 7. To disable caching use -WW. To keep using a non-default cache period you must specify this value every time" )
111111
parser.add_argument('--saverawresults', default=None, help="Save the raw results as XML to this path/file prefix - pages are numbered starting from 0000" )
@@ -535,7 +535,7 @@ def thread_fn(i,queryon,configuri):
535535
print( f"Added external component {queryon=} for {compuri}" )
536536
else:
537537
raise Exception( "Component {compuri} not found in current project - maybe you need to use --crossproject?" )
538-
# check the comonent is accessible (may have been achived!)
538+
# check the comonent is accessible (may have been archived!)
539539
if not app.is_accessible( compuri ):
540540
print( f"**** Archived component {compuri} !")
541541
continue

elmclient/httpops.py

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -463,23 +463,6 @@ def get_auth_path(self, request_url, response):
463463
auth_app_context = form_auth_path[0] if len(form_auth_path) == 1 else request_url_parsed.path.split('/')[1]
464464
return auth_app_context
465465

466-
467-
def tidy_cookies(self):
468-
'''
469-
LQE 7.0.2SR1 and 7.0.3 has the unpleasant habit of including double-quotes in the auth cookie path so it looks like "/lqe" (which includes the quotation marks in the path) rather than /lqe, and then the path is never matched so authentication is lost
470-
This code cleans up the path on all cookies on the session
471-
# return True if any cookie changed
472-
'''
473-
result = False
474-
for cookie in self._session.cookies:
475-
if cookie.path.startswith('%22'):
476-
oldvalue = cookie.path
477-
cookie.path = cookie.path.replace("%22","")
478-
logger.debug( f"REVISED cookie {cookie.name} path {oldvalue} to {cookie.path=}" )
479-
result = True
480-
return result
481-
482-
483466
# execute a request once, except:
484467
# 1. if the response indicates login is required then login and try the request again
485468
# 2. if request is rejected for various reasons retry with the CSRF header applied

elmclient/oslcqueryapi.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -825,7 +825,6 @@ def _execute_vanilla_oslc_query(self, querycapabilityuri, query_params, orderby=
825825
#
826826

827827
themembers = list(desc)
828-
# print( f"{len(themembers)=}" )
829828
# now scan its children - these are the select results
830829
for ent in themembers:
831830
# first make sure this level is stored in the results, if it has a URI
@@ -898,8 +897,8 @@ def _execute_vanilla_oslc_query(self, querycapabilityuri, query_params, orderby=
898897
result[about][place] = [value]
899898
logger.debug( f"Saving1 {about} {place} {value}" )
900899
else:
901-
# print( f"desc is none {about}" )
902-
raise Exception( f"desc is none {about}" )
900+
print( f"WARNING query results reference {about} but this isn't included in the results!" )
901+
# raise Exception( f"desc is none {about}" )
903902

904903
return result
905904

elmclient/rdfxml.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,13 +272,15 @@ def uri_to_prefixed_tag(uri, uri_to_prefix_map=None, default_map=None,oktocreate
272272
logger.debug( f"Creating new prefix {ns_uri=}" )
273273
prefixok=False
274274
if oktocreate:
275-
# create a new prefix
276-
for i in range(1000):
275+
# create a new and unique prefix
276+
i = 0
277+
while True:
277278
prefix = 'rp' + str(i)
278279
if prefix not in list(uri_to_prefix_map.values()) and prefix not in default_map.keys():
279280
prefixok = True
280281
logger.debug( f"New prefix {prefix}" )
281282
break
283+
i += 1
282284

283285
if prefixok:
284286
uri_to_prefix_map[ns_uri] = prefix

elmclient/tests/results/ccm301.html

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,46 @@ <H2>Project Queryable Resource Types, short name and URI</H2>
1212
<TD>https://jazz.ibm.com:9443/ccm/oslc/contexts/_GzoSIFEfEe2WNNAD5CjSHA/deliverables</TD>
1313
</TR>
1414
</TABLE>
15+
<H2>Project Factory Resource Types, short name and URI</H2>
16+
<TABLE><THEADING>
17+
<TH>Short Name</TH><TH>URI</TH><TH>Query Capability URI</TH></THEADING>
18+
<TR> <TD>ChangeRequest (default)</TD>
19+
<TD>http://open-services.net/ns/cm#ChangeRequest</TD>
20+
<TD>https://jazz.ibm.com:9443/ccm/oslc/contexts/_GzoSIFEfEe2WNNAD5CjSHA/drafts/workitems</TD>
21+
</TR>
22+
<TR> <TD>https://jazz.ibm.com:9443/ccm/oslc/types/_GzoSIFEfEe2WNNAD5CjSHA/com.ibm.team.apt.workItemType.epic</TD>
23+
<TD>https://jazz.ibm.com:9443/ccm/oslc/types/_GzoSIFEfEe2WNNAD5CjSHA/com.ibm.team.apt.workItemType.epic</TD>
24+
<TD>https://jazz.ibm.com:9443/ccm/oslc/contexts/_GzoSIFEfEe2WNNAD5CjSHA/workitems/com.ibm.team.apt.workItemType.epic</TD>
25+
</TR>
26+
<TR> <TD>https://jazz.ibm.com:9443/ccm/oslc/types/_GzoSIFEfEe2WNNAD5CjSHA/com.ibm.team.apt.workItemType.story</TD>
27+
<TD>https://jazz.ibm.com:9443/ccm/oslc/types/_GzoSIFEfEe2WNNAD5CjSHA/com.ibm.team.apt.workItemType.story</TD>
28+
<TD>https://jazz.ibm.com:9443/ccm/oslc/contexts/_GzoSIFEfEe2WNNAD5CjSHA/workitems/com.ibm.team.apt.workItemType.story</TD>
29+
</TR>
30+
<TR> <TD>https://jazz.ibm.com:9443/ccm/oslc/types/_GzoSIFEfEe2WNNAD5CjSHA/com.ibm.team.workItemType.adoption</TD>
31+
<TD>https://jazz.ibm.com:9443/ccm/oslc/types/_GzoSIFEfEe2WNNAD5CjSHA/com.ibm.team.workItemType.adoption</TD>
32+
<TD>https://jazz.ibm.com:9443/ccm/oslc/contexts/_GzoSIFEfEe2WNNAD5CjSHA/workitems/com.ibm.team.workItemType.adoption</TD>
33+
</TR>
34+
<TR> <TD>https://jazz.ibm.com:9443/ccm/oslc/types/_GzoSIFEfEe2WNNAD5CjSHA/com.ibm.team.workItemType.buildtrackingitem</TD>
35+
<TD>https://jazz.ibm.com:9443/ccm/oslc/types/_GzoSIFEfEe2WNNAD5CjSHA/com.ibm.team.workItemType.buildtrackingitem</TD>
36+
<TD>https://jazz.ibm.com:9443/ccm/oslc/contexts/_GzoSIFEfEe2WNNAD5CjSHA/workitems/com.ibm.team.workItemType.buildtrackingitem</TD>
37+
</TR>
38+
<TR> <TD>https://jazz.ibm.com:9443/ccm/oslc/types/_GzoSIFEfEe2WNNAD5CjSHA/com.ibm.team.workitem.workItemType.impediment</TD>
39+
<TD>https://jazz.ibm.com:9443/ccm/oslc/types/_GzoSIFEfEe2WNNAD5CjSHA/com.ibm.team.workitem.workItemType.impediment</TD>
40+
<TD>https://jazz.ibm.com:9443/ccm/oslc/contexts/_GzoSIFEfEe2WNNAD5CjSHA/workitems/com.ibm.team.workitem.workItemType.impediment</TD>
41+
</TR>
42+
<TR> <TD>https://jazz.ibm.com:9443/ccm/oslc/types/_GzoSIFEfEe2WNNAD5CjSHA/com.ibm.team.workitem.workItemType.retrospective</TD>
43+
<TD>https://jazz.ibm.com:9443/ccm/oslc/types/_GzoSIFEfEe2WNNAD5CjSHA/com.ibm.team.workitem.workItemType.retrospective</TD>
44+
<TD>https://jazz.ibm.com:9443/ccm/oslc/contexts/_GzoSIFEfEe2WNNAD5CjSHA/workitems/com.ibm.team.workitem.workItemType.retrospective</TD>
45+
</TR>
46+
<TR> <TD>https://jazz.ibm.com:9443/ccm/oslc/types/_GzoSIFEfEe2WNNAD5CjSHA/defect</TD>
47+
<TD>https://jazz.ibm.com:9443/ccm/oslc/types/_GzoSIFEfEe2WNNAD5CjSHA/defect</TD>
48+
<TD>https://jazz.ibm.com:9443/ccm/oslc/contexts/_GzoSIFEfEe2WNNAD5CjSHA/workitems/defect</TD>
49+
</TR>
50+
<TR> <TD>https://jazz.ibm.com:9443/ccm/oslc/types/_GzoSIFEfEe2WNNAD5CjSHA/task</TD>
51+
<TD>https://jazz.ibm.com:9443/ccm/oslc/types/_GzoSIFEfEe2WNNAD5CjSHA/task</TD>
52+
<TD>https://jazz.ibm.com:9443/ccm/oslc/contexts/_GzoSIFEfEe2WNNAD5CjSHA/workitems/task</TD>
53+
</TR>
54+
</TABLE>
1555
<h2>Shapes<h2>
1656

1757
<TABLE><THEADING>
@@ -7878,6 +7918,9 @@ <H2>Prefixes</H2>
78787918
<TR> <TD>acp</TD>
78797919
<TD>http://jazz.net/ns/acp#</TD>
78807920
</TR>
7921+
<TR> <TD>atom</TD>
7922+
<TD>http://www.w3.org/2005/Atom</TD>
7923+
</TR>
78817924
<TR> <TD>component</TD>
78827925
<TD>https://jazz.ibm.com:9443/gc/component/</TD>
78837926
</TR>
@@ -7974,6 +8017,9 @@ <H2>Prefixes</H2>
79748017
<TR> <TD>public_rm_10</TD>
79758018
<TD>http://www.ibm.com/xmlns/rm/public/1.0/</TD>
79768019
</TR>
8020+
<TR> <TD>qm_ns2</TD>
8021+
<TD>http://jazz.net/xmlns/alm/qm/v0.1/</TD>
8022+
</TR>
79778023
<TR> <TD>qm_rqm</TD>
79788024
<TD>http://jazz.net/ns/qm/rqm#</TD>
79798025
</TR>

0 commit comments

Comments
 (0)