Hi all, I added a xml file to keep stub name and wsdl file name of each admin services. its structure is looks like this.
<service stub="org.wso2.carbon.statistics.stub.StatisticsAdminStub" name="StatisticsAdmin" wsdl="StatisticsAdmin" lib="StatisticsAdminLibrary"/> Then added new java method to return wsdl name and stub class name. It is like this. public static String[] getServiceInfor(String lib) { File pomfile = new File("service.xml"); String[] res; try { DocumentBuilder dBuilder = DocumentBuilderFactory.newInstance() .newDocumentBuilder(); Document doc = dBuilder.parse(pomfile); System.out.println("Root element :" + doc.getDocumentElement().getNodeName()); NodeList service = doc.getElementsByTagName("service"); for (int i = 0; i < service.getLength(); i++) { Element ele = (Element) service.item(i); if (ele.getAttribute("lib").equals(lib)) { res = new String[2]; res[0] = ele.getAttribute("stub"); res[1] = ele.getAttribute("wsdl"); return res; } } return null; } catch (Exception e) { System.out.println(e.getMessage()); return null; } } So if there are any issue in this procedure please let me know. Thanks and regards. On Sat, Jun 14, 2014 at 9:10 AM, Rukshan Chathuranga <rcruksha...@gmail.com> wrote: > Hi Dharshana, > > No. it was not the resolving the dependencies of the client. Sorry if my > mail is not much clear. :) > > I wanted to import required classes for Client that generated based on > the Stub classes. My first step was taking package information from the > POM.xml as you said. but it contain only some parent package names and also > those get mapped to the new package names(rename). Thus it was difficulty > to extract all the classes. Also some extra libraries get imported and some > required libraries not get imported. > > But using reflection it is possible to get all the operation's information > of the stub classes. Then importing required class for parameters and > return type was much easier. > > ex: > import org.wso2.carbon.service.mgt.stub.ServiceAdminStub; > import org.wso2.carbon.service.mgt.stub.types.carbon.ServiceDownloadData; > import org.wso2.carbon.service.mgt.stub.types.carbon.ServiceGroupMetaData; > > > Thanks and regards. > > > > > On Sat, Jun 14, 2014 at 12:18 AM, Dharshana Warusavitharana < > dharsha...@wso2.com> wrote: > >> Hi Rekshan, >> >> Do we really need this step. AFAICU you are trying to automate the >> dependency resolving of your client library. >> Basically, there is a limited set of dependency for external libraries >> when you are generating the client. That won't expand much over introducing >> new stubs. >> You can have general pom file which have basic dependencies which are >> common to the general stubs. >> >> And im not clear how you would identify extra libraries you need by just >> using reflection. >> >> Correct me if im wrong >> >> Thank you, >> Dharshana. >> >> >> On Fri, Jun 13, 2014 at 10:51 AM, Rukshan Chathuranga < >> rcruksha...@gmail.com> wrote: >> >>> Hi All, >>> >>> I could manage the issue occurred during Client generation from Stub. I >>> get operations from the WSDL file and used Java reflection to identify the >>> information of those operation. Then it help me to identified the required >>> Libraries and import them into generated Client libraries. Also added >>> Property file to get services host and port information. >>> >>> new version of the project can be found from here. >>> >>> https://github.com/ruks/Automated-test-case-generation-tool/tree/991e6e21927288d237c0a8d1985b7d2787f91a9b/Auto-TAF >>> >>> Thanks and regards. >>> >>> >>> On Tue, Jun 10, 2014 at 3:24 PM, Rukshan Chathuranga < >>> rcruksha...@gmail.com> wrote: >>> >>>> Hi Malintha, >>>> >>>> Generating Client from Stub is not problem with one String template >>>> file. Template file contain generic Class structure like Method, >>>> Constructor, Fields and Import library. Only difference is their name and >>>> object type. Identifying the those names and type from WSDL, it is possible >>>> to generate Different client for different Stub. >>>> >>>> Thanks and regards. >>>> >>>> >>>> On Tue, Jun 10, 2014 at 3:09 PM, Malintha Adikari <malin...@wso2.com> >>>> wrote: >>>> >>>>> Hi Rukshan, >>>>> >>>>> >>>>> >>>>> >>>>> On Tue, Jun 10, 2014 at 2:49 PM, Rukshan Chathuranga < >>>>> rcruksha...@gmail.com> wrote: >>>>> >>>>>> Hi all, >>>>>> >>>>>> These days i am working on Automatically Generating Client code. Now >>>>>> i able to generate Client Code using String Template. For That i Used >>>>>> previously Used String Template file with Some Modification. >>>>>> >>>>>> Now project can generate the Stub file and automatically generate the >>>>>> Client Based on the WSDL and Stub. >>>>>> >>>>> >>>>> I have a doubt about using single string template for generating >>>>> client code for all stubs. The purpose and the implementation of each >>>>> admin >>>>> service is different. So Can we use one string template for generating the >>>>> clients for all those different WSDLs. String template approach is better. >>>>> IMO, we have to come up with a way to treat all different admin services >>>>> through string templates. >>>>> >>>>> >>>>> >>>>>> Also generated Client can be used as Library to Robot Framework to >>>>>> implement keyword driven testing. Also it's possible to invoke Admin >>>>>> services and Assert the operation. >>>>>> >>>>>> With all of these modification i create the new Project and committed >>>>>> to the Git Repo. It is available at here. >>>>>> >>>>>> >>>>>> https://github.com/ruks/Automated-test-case-generation-tool/tree/991e6e21927288d237c0a8d1985b7d2787f91a9b/Auto-TAF >>>>>> >>>>>> Then for the next few days i'm hoping to understand the Robot >>>>>> Framework scripting in depth to verify whether we can improve Robot >>>>>> framework scripting. >>>>>> >>>>>> Yes, We have to make test writing user friendly. First we have to >>>>> find points that make test writing difficult. Then we have to come up with >>>>> a generic solution to call all those difficulties. Can you try to write >>>>> test cases for some different admin services with your existing solution. >>>>> Then you can refer those test to analyze difficulties. >>>>> >>>>> Regards, >>>>> Malintha Adikari >>>>> >>>>> >>>>> Thanks and regards. >>>>>> >>>>>> >>>>>> On Sun, Jun 8, 2014 at 12:17 AM, Rukshan Chathuranga < >>>>>> rcruksha...@gmail.com> wrote: >>>>>> >>>>>>> Hi all, >>>>>>> >>>>>>> >>>>>>> These days i am working on solving the problems that are occurred >>>>>>> during the Client Generation. These exceptions are occurred when using >>>>>>> the >>>>>>> "cxf-codegen-plugin" with wsdl2java. As a alternative solution, i >>>>>>> decided >>>>>>> to understand the existing service stub generating procedure to generate >>>>>>> Stub code. And then generate Client code that could be use as Library to >>>>>>> Robot Framework. >>>>>>> >>>>>>> For that i refereed these two >>>>>>> >>>>>>> https://svn.wso2.org/repos/wso2/carbon/kernel/trunk/service-stubs/ >>>>>>> https://svn.wso2.org/repos/wso2/carbon/platform/trunk/service-stubs/ >>>>>>> >>>>>>> repositories to generate Stub sources to support my >>>>>>> requirement. up to now i could be able to generate Stub code for WSDL >>>>>>> listed in these repositories. >>>>>>> >>>>>>> Also the main problem had earlier the "certificate Exception" >>>>>>> occurred initiating Client, could be solved by setting up certificate >>>>>>> file >>>>>>> properly in system property. >>>>>>> >>>>>>> Now Robot framework able to run test case with authenticate and >>>>>>> invoke some basic admin service that are hard coded as Library to Robot >>>>>>> framework. >>>>>>> >>>>>>> Thus my next step is to Generate this Library Classes Automatically >>>>>>> based on the WSDL file and provide to the Robot framework as Library. >>>>>>> For >>>>>>> this I decided to use my previous method that used String Template to >>>>>>> generate Library Files, with few modification. >>>>>>> >>>>>>> Thanks and regards. >>>>>>> >>>>>>> -- >>>>>>> Department Of Computer Science & Engineering, >>>>>>> Faculty Of Engineering, >>>>>>> University Of Moratuwa. >>>>>>> Sri lanka >>>>>>> WEB: http://rukspot.com/ >>>>>>> >>>>>>> >>>>>> >>>>>> >>>>>> -- >>>>>> Department Of Computer Science & Engineering, >>>>>> Faculty Of Engineering, >>>>>> University Of Moratuwa. >>>>>> Sri lanka. >>>>>> WEB: http://rukspot.com/ >>>>>> >>>>>> >>>>> >>>>> >>>>> -- >>>>> *Malintha Adikari* >>>>> Software Engineer >>>>> WSO2 Inc.; http://wso2.com >>>>> lean.enterprise.middleware >>>>> >>>>> Mobile: +94 71 2312958 >>>>> Blog: http://malinthas.blogspot.com >>>>> Page: http://about.me/malintha >>>>> >>>> >>>> >>>> >>>> -- >>>> Department Of Computer Science & Engineering, >>>> Faculty Of Engineering, >>>> University Of Moratuwa. >>>> Sri lanka. >>>> WEB: http://rukspot.com/ >>>> >>>> >>> >>> >>> -- >>> Department Of Computer Science & Engineering, >>> Faculty Of Engineering, >>> University Of Moratuwa. >>> Sri lanka. >>> WEB: http://rukspot.com/ >>> >>> >> >> >> -- >> >> Dharshana Warusavitharana >> Senior Software Engineer , Test Automation >> WSO2 Inc. http://wso2.com >> email : dharsha...@wso2.com <dharsha...@wso2.com> >> Tel : +94 11 214 5345 >> Fax :+94 11 2145300 >> cell : +94772202595 >> blog : http://dharshanaw.blogspot.com >> >> lean . enterprise . middleware >> > > > > -- > Department Of Computer Science & Engineering, > Faculty Of Engineering, > University Of Moratuwa. > Sri lanka. > WEB: http://rukspot.com/ > > -- Department Of Computer Science & Engineering, Faculty Of Engineering, University Of Moratuwa. Sri lanka. WEB: http://rukspot.com/
_______________________________________________ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev