Hi Charitha,

First of all, very sorry for the lack of information on that doc. That's
only a high-level picture of what the API looks like and there are zero
examples of it.

This is the same as,
http://publib.boulder.ibm.com/infocenter/sr/v6r3/topic/com.ibm.sr.doc/twsr_mansrvce_searchandquery03.html.
This is a cut-down version of all of XPath, to map into our search model
and the only issue with this is that it is not documented yet. I can't
complete the documentation this week but I probably can do by end of next.
But, I know it's too late for QA. Also, as in other vendors (ex:- IBM) this
will not cover all possible XPath functions and all, so its hard for you to
experiment and learn. So, please do drop an e-mail and I will clarify any
issues with this. I believe that it'll be the easiest, because if I do a
brain dump of this, it might not be the exact scenarios you guys are
planning to test, :-).

For *SEARCH CRITERIA, you can have, all the 13 different names mentioned in
[1].*
*
*
*Ex:- *//web[@author = 'senaka'], //web[@author = 'senaka' and @updator !=
'admin']. These should give services created by senaka and for the second
it will also check whether admin updated.

You can have "and" and "or" in between predicates, and you can have "=" and
"!=" for those that accept negation (author, updator, mediaType, created,
updated). You can also do <, >, <=, >=, for property values.

Ex:- //web[@foo <= 10]. This will give services having a property "foo"
with value less than or equal to 10.

Next, if the returned result is a collection and not a resource, you can do
search inside it.

Ex:- *//config[*@author = 'wso2.system.user']/users. This gives me the
users resource or collection inside the config collection created by the
wso2.system.user.

You also can retrieve associations or dependencies.

Ex:- //web[@author = 'senaka']/depends will return dependencies of the
services created by senaka.

Please do try these out and also let me know if there are any further
clarifications, and I will try my best to promptly respond to them.
*
*
*[1] *
http://wso2.org/project/registry/4.0.0/docs/apidocs/admin/org/wso2/carbon/registry/admin/api/search/ISearchService.html

Thanks,
Senaka.

On Wed, Jul 11, 2012 at 5:42 AM, Charitha Kankanamge <[email protected]>wrote:

> Hi Senaka,
>
> Given below is all we have as a reference to plan/execute tests on Xpath
> query feature in G-reg. (Taken from:
> https://docs.google.com/a/wso2.com/document/d/1XdEHku1zdYz2_4oYIBg_YZ0bGIZgk0SGgoyHxAedng4/edit
> )
>
>
> ==========================================================================================================================================
> *Can pass Xapth expressions to executeQuery method (i.e can search for
> services /policies from xpath expressions)
> i.e
> //<HUMAN_READABLE_NAME>
> //<HUMAN_READABLE_NAME>[<SEARCH CRITERIA>]
> //<HUMAN_READABLE_NAME>/<ASSOCIATION_NAME OR CHILD RESOURCE OR COLLECTION
> NAME>
> //<HUMAN_READABLE_NAME>[<SEARCH CRITERIA>]/<ASSOCIATION_NAME OR CHILD
> RESOURCE OR COLLECTION NAME>
> //<HUMAN_READABLE_NAME>[<SEARCH CRITERIA>]/<ASSOCIATION_NAME OR CHILD
> RESOURCE OR COLLECTION NAME>[<SEARCH CRITERIA>]
> //<HUMAN_READABLE_NAME>[<SEARCH CRITERIA>]/<ASSOCIATION_NAME OR CHILD
> RESOURCE OR COLLECTION NAME>[<SEARCH CRITERIA>]/<ASSOCIATION_NAME OR CHILD
> RESOURCE OR COLLECTION NAME>[<SEARCH CRITERIA>]
> /<RESOURCE_OR_COLLECTION_NAME_UNDER_ROOT>/...
> //<ANY_RESOURCE_OR_COLLECTION_NAME>/...*
>
>
> =================================================================================================================================================
>
> Can anyone get any idea by looking at the above? We had to spend time
> unnecessarily to go through code to figure out what you actually meant by
> above key words.
>
> We did the following test first.
>
> 1. "Assuming" the above *HUMAN_READABLE_NAME refers to *human readable
> media types*, defined a new human readable media type in mime.mappings
> file
> e.g:-
> application/vnd.wso2-service+xml    web
>
> 2. Ran the following test
>
>    public void testXpathQuery() throws RegistryException {
>
>         Map parameters = new HashMap();
>         parameters.put("query", "//web");
>         parameters.put("mediaType", "application/vnd.wso2.xpath.query");
>
>         Resource result = registry.executeQuery(null, parameters);
>         System.out.println(result.getId());
>
>         String[] paths = (String[]) result.getContent();
>         for (String path : paths) {
>             System.out.println("path is " + path);
>         }
>     }
> *
> This returned all services.
> e.g:-
> /_system/governance/trunk/services/org/wso2/carbon/service/Axis2Service
>
> We are stuck after this test. How should we proceed with SEARCH CRITERIA
> and other options? We tried a lot of Xpath combinations but still unable to
> figure out and not sure what we are observing is the expected behavior.
>
> We cannot test anything based on assumptions. I'm sorry, but hours of our
> time would have been saved if you gave at least a simple example at first
> place. I do not think anybody can get any idea by looking at what you have
> given above. We are badly running out of time and we need to move into the
> other product testing soon. We do not have time to play around any trial'n
> error scenarios.
>
> Please send us an example ASAP.
>
> Thanks!
> Charitha
>
>
>
>
>


-- 
*Senaka Fernando*
Member - Integration Technologies Management Committee;
Technical Lead; WSO2 Inc.; http://wso2.com*
Member; Apache Software Foundation; http://apache.org

E-mail: senaka AT wso2.com
**P: +1 408 754 7388; ext: 51736*; *M: +94 77 322 1818
Linked-In: http://linkedin.com/in/senakafernando

*Lean . Enterprise . Middleware
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to