You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@stratos.apache.org by Anuruddha Liyanarachchi <an...@wso2.com> on 2015/06/01 06:27:55 UTC

Re: [GSoC 2015] Python CLI for Stratos : Weekly Update

Hi Milindu,


All the requests sent to Stratos needs an username and a password for
> authentications, right? I was thinking if I can create a python decorator (
> maybe as @auth ) to check if the username  and password  is known before
> sending the request.


If we use a decorator, for each api call username and password will be
checked. I think it is fine when CLI is running in  non-interactive mode.
But in interactive mode we can check username and password when starting
CLI and store those values. WDYT ?

I have to add a POM to the Python CLI component. What I should include in
> it?


You have to link CLI with Startos as a child component.  You can have look
at python agent pom.xml [1].

[1]
https://github.com/apache/stratos/blob/master/components/org.apache.stratos.python.cartridge.agent/pom.xml

On Thu, May 28, 2015 at 11:31 AM, Milindu Sanoj Kumarage <
agentmilindu@gmail.com> wrote:

> Hi,
>
> I came up with this structure after studying the needs.
>
> Main.py, CLI.py and Stratos.py would be same as of our previous
> discussions.
>
> Configs.py would hold configurations, etc. It would be like
> the CliConstants.java and  holds the default Stratos directory, Stratos
> prompt string, etc. And it is reading the environment variables, like
> username, password, etc.
>
> Logging.py would handle everything about logging. Setting the logging
> file, creating the logging file's directory if not exists, and setting
> logging level etc.
>
> Utils.py would hold the utility methods. Currently it holds codes for
> pretty printing of tables and trees.
>
> [image: Inline image 1]
>
>
> I pushed my commits to my fork. (
> https://github.com/agentmilindu/stratos/tree/python-cli/components/org.apache.stratos.python.cli/src/main/python/cli
>  )
>
> I have some questions,
>
> All the requests sent to Stratos needs an username and a password for
> authentications, right? I was thinking if I can create a python decorator (
> maybe as @auth ) to check if the username  and password  is known before
> sending the request.
>
> @auth
> def do_deploy_service(self, line , opts=None):
>   #codes of the deploy_service def
>
> where @auth checks either,
> if the opts list contains username and password,
> else if environment variables are set for username and password.
>
> Reason is, if we have to do a change in the username and password
> checking logic, then we have to change only one place.
> What you think about this approach?
> Is there any way keeping a session like, if one successfully authenticated
> request got a response, the subsequent requests need not to have to reenter
> the username/password ?
>
> I have to add a POM to the Python CLI component. What I should include in
> it?
>
> I think our foundation parts are done now. We have to start coding the
> each actions.
> I will send my first pull request once we are done with the above :)
>
>
> On Sun, May 10, 2015 at 10:32 PM, Chamila De Alwis <ch...@wso2.com>
> wrote:
>
>> Hi Milindu,
>>
>> We should always log enough information to a log file. In fact,*
>> .stratos* folder in the Java CLI is used to store the *stratos-cli.log*
>> file. INFO level logs should be used to log important messages, while DEBUG
>> level should be verbose enough to pinpoint an error.
>>
>> The other use of the* .stratos* folder is to store the command history.
>> You can verify this by checking the files in ~/.stratos folder.
>>
>>
>>
>>
>> Regards,
>> Chamila de Alwis
>> Software Engineer | WSO2 | +94772207163
>> Blog: code.chamiladealwis.com
>>
>>
>>
>> On Sun, May 10, 2015 at 9:26 PM, Milindu Sanoj Kumarage <
>> agentmilindu@gmail.com> wrote:
>>
>>> Hi,
>>>
>>> Thanks Chamila, I will update the setup.py with these info.
>>> I too taught of using 'stratos-cli' first, but doubted you wouldn't
>>> like that because the user has to type this when working with Single
>>> Command Line Mode. But if you think that would not be a problem, then
>>> let's change that as 'stratos-cli' :)
>>>
>>> Thanks Imesh, I will update the name as StratosApiClient then.
>>>
>>> I have few more questions,
>>>
>>> 1. We have to do logging, right? Log important events always ( to a
>>> file? ) or log only in debug mode ( directly to the cmd? )?
>>> 2. I saw Java CLI  creating a  dir named '.stratos', for what that dir
>>> is used to?
>>>
>>>
>>>
>>> On Sat, May 9, 2015 at 10:16 PM, Imesh Gunaratne <im...@apache.org>
>>> wrote:
>>>
>>>> Hi Milindu,
>>>>
>>>> On Sat, May 9, 2015 at 9:37 PM, Milindu Sanoj Kumarage <
>>>> agentmilindu@gmail.com> wrote:
>>>>>
>>>>>
>>>>> 1. Main.py - This contains the entry point, it does the initializing
>>>>> parts, creates a CLI instance and runs the loop and other stuffs.
>>>>>
>>>> +1
>>>>
>>>>>
>>>>> 2. CLI.py - This is the actual CLI that extends Cmd2. This contains
>>>>> the command to def mappings, argument and flag handling, printing outputs,
>>>>> etc.
>>>>>
>>>> +1
>>>>
>>>>>
>>>>> 3. Stratos.py - This contains the actual business logic, that is,
>>>>> which REST end point to call, and do what with the response, what to show,
>>>>> what not, etc. At the end, this would be like a Python API for Stratos in a
>>>>> way.
>>>>>
>>>>> IMO Stratos is too generic for a class name. Shall we rename this to
>>>> something like StratosApiClient?
>>>>
>>>> Thanks
>>>>
>>>> --
>>>> Imesh Gunaratne
>>>>
>>>> Senior Technical Lead, WSO2
>>>> Committer & PMC Member, Apache Stratos
>>>>
>>>
>>>
>>
>


-- 
*Thanks and Regards,*
Anuruddha Lanka Liyanarachchi
Software Engineer - WSO2
Mobile : +94 (0) 712762611
Tel      : +94 112 145 345
a <th...@wso2.com>nuruddhal@wso2.com

Re: [GSoC 2015] Python CLI for Stratos : Weekly Update

Posted by Milindu Sanoj Kumarage <ag...@gmail.com>.
Hi Lahiru,

It seems it is the link. Thanks for pointing out :)
Here is the working link.
https://www.youtube.com/watch?v=VjMIk5F9Bas

Thanks


On Wed, Aug 26, 2015 at 10:36 PM, Lahiru Sandaruwan <la...@wso2.com>
wrote:

> Hi Milindu,
>
> Recorded hangout seems not working now. Any clue?
>
> Thanks.
>
> On Mon, Aug 24, 2015 at 7:17 AM, Milindu Sanoj Kumarage <
> agentmilindu@gmail.com> wrote:
>
>> Hi,
>>
>> Here is the recorded Hangout :)
>>
>> https://www.youtube.com/watch?v=VjMIk5F9Ba
>>
>> And here is a small blog post I wrote on how I implemented the Stratos
>> CLI
>>
>> http://agentmilindu.com/python-cli-apache-stratos/
>>
>>
>>
>> On Wed, Aug 19, 2015 at 9:42 PM, Milindu Sanoj Kumarage <
>> agentmilindu@gmail.com> wrote:
>>
>>> Hi,
>>>
>>> Here is the link to Hangout :)
>>>
>>> https://plus.google.com/hangouts/_/hoaevent/AP36tYff-vrxKu7_Mymm8ZuD0_8hqlP_XRHSADiig8b4mhb7UK1pjA
>>>
>>>
>>> On Wed, Aug 19, 2015 at 9:38 PM, Imesh Gunaratne <im...@apache.org>
>>> wrote:
>>>
>>>> +1 Can you please share the Hangout link?
>>>>
>>>> Thanks
>>>>
>>>> On Tue, Aug 18, 2015 at 10:54 PM, Chamila De Alwis <ch...@wso2.com>
>>>> wrote:
>>>>
>>>>> +1 I can attend.
>>>>>
>>>>> (On a mobile)
>>>>> Regards,
>>>>> Chamila de Alwis
>>>>> Committer and PMC Member - Apache Stratos
>>>>> Software Engineer - WSO2
>>>>> http://code.chamiladealwis.com
>>>>> On Aug 18, 2015 12:04 PM, "Milindu Sanoj Kumarage" <
>>>>> agentmilindu@gmail.com> wrote:
>>>>>
>>>>>>  Hi, extremely sorry, the date is 19th, we are having the Hangout on
>>>>>> Air for Stratos Python CLI on 19th Au from 9:30p.m IST onward. Is this time
>>>>>> and date convenient?
>>>>>>
>>>>>> https://plus.google.com/u/0/events/c8d9682n9bris9at4ucppot9jbo
>>>>>>
>>>>>> On Tue, Aug 18, 2015 at 9:02 PM, Milindu Sanoj Kumarage <
>>>>>> agentmilindu@gmail.com> wrote:
>>>>>>
>>>>>>> Hi,
>>>>>>>
>>>>>>> We are having a Hangout on Air for Stratos Python CLI on 9:30p.m.
>>>>>>> IST :)
>>>>>>>
>>>>>>> https://plus.google.com/u/0/events/c8d9682n9bris9at4ucppot9jbo
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> On Sun, Aug 16, 2015 at 4:14 PM, Milindu Sanoj Kumarage <
>>>>>>> agentmilindu@gmail.com> wrote:
>>>>>>>
>>>>>>>> Hi,
>>>>>>>>
>>>>>>>> I have finished the  documentation except for some few commands
>>>>>>>> that I still have issues.
>>>>>>>>
>>>>>>>>
>>>>>>>> https://docs.google.com/document/d/1GEdrOyIGF-zdwVry7t6-WYFMeEC0Y_Ki3ExyZFYCXdw/edit?usp=sharing
>>>>>>>>
>>>>>>>> I did two small demonstration videos on how to use and how to
>>>>>>>> config :)
>>>>>>>>
>>>>>>>>
>>>>>>>> https://www.youtube.com/playlist?list=PL2zdjxqMDj71dlnYitq59PzEoOAG21Uhq
>>>>>>>> <https://youtu.be/dzreFlxlKKM>
>>>>>>>>
>>>>>>>> I'm working on testings and those issues I mentioned earlier.
>>>>>>>>
>>>>>>>>
>>>>>>>> On Wed, Aug 12, 2015 at 12:37 AM, Milindu Sanoj Kumarage <
>>>>>>>> agentmilindu@gmail.com> wrote:
>>>>>>>>
>>>>>>>>> Hi,
>>>>>>>>>
>>>>>>>>> I want to know which commands should output that tree-like view of
>>>>>>>>> JSON data.
>>>>>>>>>
>>>>>>>>> in list-deployment-policies what 'Accessibility' means? How i
>>>>>>>>> should retrieve it from the JSON response?
>>>>>>>>>
>>>>>>>>> +---------------------+---------------+
>>>>>>>>>
>>>>>>>>> |         Id          | Accessibility |
>>>>>>>>>
>>>>>>>>> +=====================+===============+
>>>>>>>>>
>>>>>>>>> | deployment-policy-2 | 1             |
>>>>>>>>>
>>>>>>>>> | deployment-policy-1 | 1             |
>>>>>>>>>
>>>>>>>>> +---------------------+---------------+
>>>>>>>>>
>>>>>>>>> There are couple of commands that gives me errors when I send the
>>>>>>>>> request, I have to check that too.
>>>>>>>>>
>>>>>>>>> I'd do the demo as soon as I finished the document, because I want
>>>>>>>>> to know everything is working as expected :) Few more commands to go.
>>>>>>>>>
>>>>>>>>> Hi Milindu,
>>>>>>>>>
>>>>>>>>> Great work so far! Could you mention what commands and outputs are
>>>>>>>>> less clear?
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Regards,
>>>>>>>>> Chamila de Alwis
>>>>>>>>> Committer and PMC Member - Apache Stratos
>>>>>>>>> Software Engineer | WSO2 | +94772207163
>>>>>>>>> Blog: code.chamiladealwis.com
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On Sun, Aug 9, 2015 at 1:59 PM, Milindu Sanoj Kumarage <
>>>>>>>>> agentmilindu@gmail.com> wrote:
>>>>>>>>>
>>>>>>>>>> Hi,
>>>>>>>>>>
>>>>>>>>>> I have finished implementing all the CLI commands, except very
>>>>>>>>>> few which I have some doubts ( like, how the output should be presented ) :)
>>>>>>>>>>
>>>>>>>>>>  I started writing a document explaining each and every command
>>>>>>>>>> with their expected outputs ( when correct params are given, when no params
>>>>>>>>>> are given and when wrong params are given ) I will continue writing the
>>>>>>>>>> test cases based on them.
>>>>>>>>>>
>>>>>>>>>> As discussed on Hangout, I will do a demo,  record it and share
>>>>>>>>>> soon :)
>>>>>>>>>>
>>>>>>>>>> On Wed, Jul 29, 2015 at 10:34 AM, Milindu Sanoj Kumarage <
>>>>>>>>>> agentmilindu@gmail.com> wrote:
>>>>>>>>>>
>>>>>>>>>>> Hi,
>>>>>>>>>>>
>>>>>>>>>>> I could finish most of the listing command and now working with
>>>>>>>>>>> the create and update commands. I'm running Java CLI to get an idea how the
>>>>>>>>>>> output should be presented. Had to fix some issues related to that "-"
>>>>>>>>>>> issue also, regarding auto-completion. I started writing test cases for
>>>>>>>>>>> utility methods, and will start writing test cases for Stratos specific
>>>>>>>>>>> ones this week. I'm using Tox to run my tests on different Python versions,
>>>>>>>>>>> 2.x ones and 3.z ones.
>>>>>>>>>>>
>>>>>>>>>>> On Thu, Jul 9, 2015 at 2:52 PM, Milindu Sanoj Kumarage <
>>>>>>>>>>> agentmilindu@gmail.com> wrote:
>>>>>>>>>>>
>>>>>>>>>>>> Hi,
>>>>>>>>>>>>
>>>>>>>>>>>> I invested last 2 week on some research on Testing frameworks
>>>>>>>>>>>> and Security Certificates. CA Bundles and  Pem files were something I had
>>>>>>>>>>>> no experience, therefor I studied on that. Studied Java security API and
>>>>>>>>>>>> Stratos's Java CLI's Certificate handling codes ( Keystores, etc ).
>>>>>>>>>>>>
>>>>>>>>>>>> *Testing frameworks*
>>>>>>>>>>>>
>>>>>>>>>>>> 1. Unittest ( docs.python.org/2/library/unittest.html ) [ PSF(
>>>>>>>>>>>> GPL-compatible ) ]
>>>>>>>>>>>>
>>>>>>>>>>>> Python's unit testing module since 2.7. Very similar to JUnit
>>>>>>>>>>>> for Java. Gives very descriptive outputs when found assertion errors.
>>>>>>>>>>>>
>>>>>>>>>>>> 2. Unittest2 ( pypi.python.org/pypi/unittest2 ) [ BSD ]
>>>>>>>>>>>>
>>>>>>>>>>>> unittest2 is a backport of the new features added to the
>>>>>>>>>>>> unittest testing framework in Python 2.7 and onwards. Supports back to
>>>>>>>>>>>> Python 2.4+.
>>>>>>>>>>>>
>>>>>>>>>>>> 3. PyTest ( pytest.org/ ) [ MIT ]
>>>>>>>>>>>>
>>>>>>>>>>>> Very popular unit testing tool which is an alternative to
>>>>>>>>>>>> Python’s standard unittest module. Gives very descriptive outputs when
>>>>>>>>>>>> found assertion errors. Integrates nicely with setup.py. Python 2 and 3
>>>>>>>>>>>> compatible.
>>>>>>>>>>>>
>>>>>>>>>>>> 4. Nose ( nose.readthedocs.org/en/latest ) [ LGPL ]
>>>>>>>>>>>>
>>>>>>>>>>>> Nose extends unittest to make testing easier. Same as PyTest.
>>>>>>>>>>>> Python 2 and 3 compatible.
>>>>>>>>>>>>
>>>>>>>>>>>> 5. Tox ( tox.readthedocs.org/en/latest/ ) [ MIT ]
>>>>>>>>>>>>
>>>>>>>>>>>> Tox is a generic virtualenv management and test command line
>>>>>>>>>>>> tool. We can setup several Python virtual environments and run our tests on
>>>>>>>>>>>> those environments. This is a very useful tool to ensure the compatibility
>>>>>>>>>>>> with Python 2 and Python 3 versions. PyTest,  nose and unittest modules are
>>>>>>>>>>>> compatible with tox. Able to easily integrate with continuous integration
>>>>>>>>>>>> servers like Jenkins.
>>>>>>>>>>>>
>>>>>>>>>>>> 6. Doctest ( docs.python.org/2/library/doctest.htmlt ) [ PSF(
>>>>>>>>>>>> GPL-compatible ) ]
>>>>>>>>>>>>
>>>>>>>>>>>>  Python module that checks for interactive Python sessions in
>>>>>>>>>>>> docstrings, and then executes those sessions to verify that they work
>>>>>>>>>>>> exactly as shown.
>>>>>>>>>>>>
>>>>>>>>>>>> 7. Atheist ( arco.esi.uclm.es/~david.villa/atheist/html/  ) [
>>>>>>>>>>>> GFDL ]
>>>>>>>>>>>>
>>>>>>>>>>>> A great tool for command line testing, it issues the commands
>>>>>>>>>>>> to the underlying shell and compares the output with the intended output.
>>>>>>>>>>>> Now discontinued but bug-maintained.
>>>>>>>>>>>>
>>>>>>>>>>>> 8. Prego ( bitbucket.org/arco_group/prego ) [ GPLv3+ ]
>>>>>>>>>>>>
>>>>>>>>>>>> Successor of Atheist, which provides support to run shell
>>>>>>>>>>>> commands on background, send signal to processes, set assertions on command
>>>>>>>>>>>> stdout or stderr, etc. Very suitable in CLI testing tasks.
>>>>>>>>>>>>
>>>>>>>>>>>> 9. ScriptTest ( pythonpaste.org/scripttest/ ) [  MIT-style
>>>>>>>>>>>> permissive license ]
>>>>>>>>>>>>
>>>>>>>>>>>> Something like Prego, but seems less features.
>>>>>>>>>>>>
>>>>>>>>>>>> 10. Behave ( jenisys.github.io/behave.example/ ) [ BSD ]
>>>>>>>>>>>>
>>>>>>>>>>>>  A BDD framework and a cucumber-clone for Python. Cucumber is a
>>>>>>>>>>>> nice way for feature testing where we define the features in simple English
>>>>>>>>>>>> and that will become the tests.
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> I definitely will be using Tox because it makes us test the
>>>>>>>>>>>> Python CLI on different Python versions. But Tox alone can not test the
>>>>>>>>>>>> CLI. We have to us some other testing framework on Tox. I'm wondering what
>>>>>>>>>>>> to use where. We can use PyTest for unit test Stratos.py which calls the
>>>>>>>>>>>> Stratos RESTAPI. But we have to test the CLI functionalities also, using
>>>>>>>>>>>> some kind of CLI testing tool. I think I need some advice here :)
>>>>>>>>>>>>
>>>>>>>>>>>> Meanwhile, I continued implementing other "list" CMD actions in
>>>>>>>>>>>> Python CLI. I see some repetition in error code handling stuffs, I'm
>>>>>>>>>>>> thinking of a way to write a general method for error handling and error
>>>>>>>>>>>> reporting.
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>
>>>>
>>>>
>>>> --
>>>> Imesh Gunaratne
>>>>
>>>> Senior Technical Lead, WSO2
>>>> Committer & PMC Member, Apache Stratos
>>>>
>>>
>>>
>>
>
>
> --
> --
> Lahiru Sandaruwan
> Committer and PMC member, Apache Stratos,
> Senior Software Engineer,
> WSO2 Inc., http://wso2.com
> lean.enterprise.middleware
>
> phone: +94773325954
> email: lahirus@wso2.com blog: http://lahiruwrites.blogspot.com/
> linked-in: http://lk.linkedin.com/pub/lahiru-sandaruwan/16/153/146
>
>

Re: [GSoC 2015] Python CLI for Stratos : Weekly Update

Posted by Lahiru Sandaruwan <la...@wso2.com>.
Hi Milindu,

Recorded hangout seems not working now. Any clue?

Thanks.

On Mon, Aug 24, 2015 at 7:17 AM, Milindu Sanoj Kumarage <
agentmilindu@gmail.com> wrote:

> Hi,
>
> Here is the recorded Hangout :)
>
> https://www.youtube.com/watch?v=VjMIk5F9Ba
>
> And here is a small blog post I wrote on how I implemented the Stratos CLI
>
> http://agentmilindu.com/python-cli-apache-stratos/
>
>
>
> On Wed, Aug 19, 2015 at 9:42 PM, Milindu Sanoj Kumarage <
> agentmilindu@gmail.com> wrote:
>
>> Hi,
>>
>> Here is the link to Hangout :)
>>
>> https://plus.google.com/hangouts/_/hoaevent/AP36tYff-vrxKu7_Mymm8ZuD0_8hqlP_XRHSADiig8b4mhb7UK1pjA
>>
>>
>> On Wed, Aug 19, 2015 at 9:38 PM, Imesh Gunaratne <im...@apache.org>
>> wrote:
>>
>>> +1 Can you please share the Hangout link?
>>>
>>> Thanks
>>>
>>> On Tue, Aug 18, 2015 at 10:54 PM, Chamila De Alwis <ch...@wso2.com>
>>> wrote:
>>>
>>>> +1 I can attend.
>>>>
>>>> (On a mobile)
>>>> Regards,
>>>> Chamila de Alwis
>>>> Committer and PMC Member - Apache Stratos
>>>> Software Engineer - WSO2
>>>> http://code.chamiladealwis.com
>>>> On Aug 18, 2015 12:04 PM, "Milindu Sanoj Kumarage" <
>>>> agentmilindu@gmail.com> wrote:
>>>>
>>>>>  Hi, extremely sorry, the date is 19th, we are having the Hangout on
>>>>> Air for Stratos Python CLI on 19th Au from 9:30p.m IST onward. Is this time
>>>>> and date convenient?
>>>>>
>>>>> https://plus.google.com/u/0/events/c8d9682n9bris9at4ucppot9jbo
>>>>>
>>>>> On Tue, Aug 18, 2015 at 9:02 PM, Milindu Sanoj Kumarage <
>>>>> agentmilindu@gmail.com> wrote:
>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> We are having a Hangout on Air for Stratos Python CLI on 9:30p.m. IST
>>>>>> :)
>>>>>>
>>>>>> https://plus.google.com/u/0/events/c8d9682n9bris9at4ucppot9jbo
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> On Sun, Aug 16, 2015 at 4:14 PM, Milindu Sanoj Kumarage <
>>>>>> agentmilindu@gmail.com> wrote:
>>>>>>
>>>>>>> Hi,
>>>>>>>
>>>>>>> I have finished the  documentation except for some few commands that
>>>>>>> I still have issues.
>>>>>>>
>>>>>>>
>>>>>>> https://docs.google.com/document/d/1GEdrOyIGF-zdwVry7t6-WYFMeEC0Y_Ki3ExyZFYCXdw/edit?usp=sharing
>>>>>>>
>>>>>>> I did two small demonstration videos on how to use and how to config
>>>>>>> :)
>>>>>>>
>>>>>>>
>>>>>>> https://www.youtube.com/playlist?list=PL2zdjxqMDj71dlnYitq59PzEoOAG21Uhq
>>>>>>> <https://youtu.be/dzreFlxlKKM>
>>>>>>>
>>>>>>> I'm working on testings and those issues I mentioned earlier.
>>>>>>>
>>>>>>>
>>>>>>> On Wed, Aug 12, 2015 at 12:37 AM, Milindu Sanoj Kumarage <
>>>>>>> agentmilindu@gmail.com> wrote:
>>>>>>>
>>>>>>>> Hi,
>>>>>>>>
>>>>>>>> I want to know which commands should output that tree-like view of
>>>>>>>> JSON data.
>>>>>>>>
>>>>>>>> in list-deployment-policies what 'Accessibility' means? How i
>>>>>>>> should retrieve it from the JSON response?
>>>>>>>>
>>>>>>>> +---------------------+---------------+
>>>>>>>>
>>>>>>>> |         Id          | Accessibility |
>>>>>>>>
>>>>>>>> +=====================+===============+
>>>>>>>>
>>>>>>>> | deployment-policy-2 | 1             |
>>>>>>>>
>>>>>>>> | deployment-policy-1 | 1             |
>>>>>>>>
>>>>>>>> +---------------------+---------------+
>>>>>>>>
>>>>>>>> There are couple of commands that gives me errors when I send the
>>>>>>>> request, I have to check that too.
>>>>>>>>
>>>>>>>> I'd do the demo as soon as I finished the document, because I want
>>>>>>>> to know everything is working as expected :) Few more commands to go.
>>>>>>>>
>>>>>>>> Hi Milindu,
>>>>>>>>
>>>>>>>> Great work so far! Could you mention what commands and outputs are
>>>>>>>> less clear?
>>>>>>>>
>>>>>>>>
>>>>>>>> Regards,
>>>>>>>> Chamila de Alwis
>>>>>>>> Committer and PMC Member - Apache Stratos
>>>>>>>> Software Engineer | WSO2 | +94772207163
>>>>>>>> Blog: code.chamiladealwis.com
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> On Sun, Aug 9, 2015 at 1:59 PM, Milindu Sanoj Kumarage <
>>>>>>>> agentmilindu@gmail.com> wrote:
>>>>>>>>
>>>>>>>>> Hi,
>>>>>>>>>
>>>>>>>>> I have finished implementing all the CLI commands, except very few
>>>>>>>>> which I have some doubts ( like, how the output should be presented ) :)
>>>>>>>>>
>>>>>>>>>  I started writing a document explaining each and every command
>>>>>>>>> with their expected outputs ( when correct params are given, when no params
>>>>>>>>> are given and when wrong params are given ) I will continue writing the
>>>>>>>>> test cases based on them.
>>>>>>>>>
>>>>>>>>> As discussed on Hangout, I will do a demo,  record it and share
>>>>>>>>> soon :)
>>>>>>>>>
>>>>>>>>> On Wed, Jul 29, 2015 at 10:34 AM, Milindu Sanoj Kumarage <
>>>>>>>>> agentmilindu@gmail.com> wrote:
>>>>>>>>>
>>>>>>>>>> Hi,
>>>>>>>>>>
>>>>>>>>>> I could finish most of the listing command and now working with
>>>>>>>>>> the create and update commands. I'm running Java CLI to get an idea how the
>>>>>>>>>> output should be presented. Had to fix some issues related to that "-"
>>>>>>>>>> issue also, regarding auto-completion. I started writing test cases for
>>>>>>>>>> utility methods, and will start writing test cases for Stratos specific
>>>>>>>>>> ones this week. I'm using Tox to run my tests on different Python versions,
>>>>>>>>>> 2.x ones and 3.z ones.
>>>>>>>>>>
>>>>>>>>>> On Thu, Jul 9, 2015 at 2:52 PM, Milindu Sanoj Kumarage <
>>>>>>>>>> agentmilindu@gmail.com> wrote:
>>>>>>>>>>
>>>>>>>>>>> Hi,
>>>>>>>>>>>
>>>>>>>>>>> I invested last 2 week on some research on Testing frameworks
>>>>>>>>>>> and Security Certificates. CA Bundles and  Pem files were something I had
>>>>>>>>>>> no experience, therefor I studied on that. Studied Java security API and
>>>>>>>>>>> Stratos's Java CLI's Certificate handling codes ( Keystores, etc ).
>>>>>>>>>>>
>>>>>>>>>>> *Testing frameworks*
>>>>>>>>>>>
>>>>>>>>>>> 1. Unittest ( docs.python.org/2/library/unittest.html ) [ PSF(
>>>>>>>>>>> GPL-compatible ) ]
>>>>>>>>>>>
>>>>>>>>>>> Python's unit testing module since 2.7. Very similar to JUnit
>>>>>>>>>>> for Java. Gives very descriptive outputs when found assertion errors.
>>>>>>>>>>>
>>>>>>>>>>> 2. Unittest2 ( pypi.python.org/pypi/unittest2 ) [ BSD ]
>>>>>>>>>>>
>>>>>>>>>>> unittest2 is a backport of the new features added to the
>>>>>>>>>>> unittest testing framework in Python 2.7 and onwards. Supports back to
>>>>>>>>>>> Python 2.4+.
>>>>>>>>>>>
>>>>>>>>>>> 3. PyTest ( pytest.org/ ) [ MIT ]
>>>>>>>>>>>
>>>>>>>>>>> Very popular unit testing tool which is an alternative to
>>>>>>>>>>> Python’s standard unittest module. Gives very descriptive outputs when
>>>>>>>>>>> found assertion errors. Integrates nicely with setup.py. Python 2 and 3
>>>>>>>>>>> compatible.
>>>>>>>>>>>
>>>>>>>>>>> 4. Nose ( nose.readthedocs.org/en/latest ) [ LGPL ]
>>>>>>>>>>>
>>>>>>>>>>> Nose extends unittest to make testing easier. Same as PyTest.
>>>>>>>>>>> Python 2 and 3 compatible.
>>>>>>>>>>>
>>>>>>>>>>> 5. Tox ( tox.readthedocs.org/en/latest/ ) [ MIT ]
>>>>>>>>>>>
>>>>>>>>>>> Tox is a generic virtualenv management and test command line
>>>>>>>>>>> tool. We can setup several Python virtual environments and run our tests on
>>>>>>>>>>> those environments. This is a very useful tool to ensure the compatibility
>>>>>>>>>>> with Python 2 and Python 3 versions. PyTest,  nose and unittest modules are
>>>>>>>>>>> compatible with tox. Able to easily integrate with continuous integration
>>>>>>>>>>> servers like Jenkins.
>>>>>>>>>>>
>>>>>>>>>>> 6. Doctest ( docs.python.org/2/library/doctest.htmlt ) [ PSF(
>>>>>>>>>>> GPL-compatible ) ]
>>>>>>>>>>>
>>>>>>>>>>>  Python module that checks for interactive Python sessions in
>>>>>>>>>>> docstrings, and then executes those sessions to verify that they work
>>>>>>>>>>> exactly as shown.
>>>>>>>>>>>
>>>>>>>>>>> 7. Atheist ( arco.esi.uclm.es/~david.villa/atheist/html/  ) [
>>>>>>>>>>> GFDL ]
>>>>>>>>>>>
>>>>>>>>>>> A great tool for command line testing, it issues the commands to
>>>>>>>>>>> the underlying shell and compares the output with the intended output. Now
>>>>>>>>>>> discontinued but bug-maintained.
>>>>>>>>>>>
>>>>>>>>>>> 8. Prego ( bitbucket.org/arco_group/prego ) [ GPLv3+ ]
>>>>>>>>>>>
>>>>>>>>>>> Successor of Atheist, which provides support to run shell
>>>>>>>>>>> commands on background, send signal to processes, set assertions on command
>>>>>>>>>>> stdout or stderr, etc. Very suitable in CLI testing tasks.
>>>>>>>>>>>
>>>>>>>>>>> 9. ScriptTest ( pythonpaste.org/scripttest/ ) [  MIT-style
>>>>>>>>>>> permissive license ]
>>>>>>>>>>>
>>>>>>>>>>> Something like Prego, but seems less features.
>>>>>>>>>>>
>>>>>>>>>>> 10. Behave ( jenisys.github.io/behave.example/ ) [ BSD ]
>>>>>>>>>>>
>>>>>>>>>>>  A BDD framework and a cucumber-clone for Python. Cucumber is a
>>>>>>>>>>> nice way for feature testing where we define the features in simple English
>>>>>>>>>>> and that will become the tests.
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> I definitely will be using Tox because it makes us test the
>>>>>>>>>>> Python CLI on different Python versions. But Tox alone can not test the
>>>>>>>>>>> CLI. We have to us some other testing framework on Tox. I'm wondering what
>>>>>>>>>>> to use where. We can use PyTest for unit test Stratos.py which calls the
>>>>>>>>>>> Stratos RESTAPI. But we have to test the CLI functionalities also, using
>>>>>>>>>>> some kind of CLI testing tool. I think I need some advice here :)
>>>>>>>>>>>
>>>>>>>>>>> Meanwhile, I continued implementing other "list" CMD actions in
>>>>>>>>>>> Python CLI. I see some repetition in error code handling stuffs, I'm
>>>>>>>>>>> thinking of a way to write a general method for error handling and error
>>>>>>>>>>> reporting.
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>
>>>
>>> --
>>> Imesh Gunaratne
>>>
>>> Senior Technical Lead, WSO2
>>> Committer & PMC Member, Apache Stratos
>>>
>>
>>
>


-- 
--
Lahiru Sandaruwan
Committer and PMC member, Apache Stratos,
Senior Software Engineer,
WSO2 Inc., http://wso2.com
lean.enterprise.middleware

phone: +94773325954
email: lahirus@wso2.com blog: http://lahiruwrites.blogspot.com/
linked-in: http://lk.linkedin.com/pub/lahiru-sandaruwan/16/153/146

Re: [GSoC 2015] Python CLI for Stratos : Weekly Update

Posted by Milindu Sanoj Kumarage <ag...@gmail.com>.
Hi Imesh,

Thank you for the complement, it means a lot to me :) Here is my pull
request with all the latest changes, including the changes suggested in the
public hangout. https://github.com/apache/stratos/pull/437

Definitely I will be contributing to Stratos project :)  My experience
working with the Stratos community tempts me to keep contributing.  I
really enjoyed GSoC 2015 and I really got much than the stipend.




On Mon, Aug 24, 2015 at 10:14 PM, Imesh Gunaratne <im...@apache.org> wrote:

> Hi Milindu,
>
> Thanks for all the hard work! You have done a great job completing this
> Google Summer of Code project. Please send us a pull request with your
> latest changes.
>
> Please feel free to contribute to Stratos whenever time permits.
>
> Thanks
>
> On Mon, Aug 24, 2015 at 5:47 PM, Milindu Sanoj Kumarage <
> agentmilindu@gmail.com> wrote:
>
>> Hi,
>>
>> Here is the recorded Hangout :)
>>
>> https://www.youtube.com/watch?v=VjMIk5F9Ba
>>
>> And here is a small blog post I wrote on how I implemented the Stratos
>> CLI
>>
>> http://agentmilindu.com/python-cli-apache-stratos/
>>
>>
>>
>> On Wed, Aug 19, 2015 at 9:42 PM, Milindu Sanoj Kumarage <
>> agentmilindu@gmail.com> wrote:
>>
>>> Hi,
>>>
>>> Here is the link to Hangout :)
>>>
>>> https://plus.google.com/hangouts/_/hoaevent/AP36tYff-vrxKu7_Mymm8ZuD0_8hqlP_XRHSADiig8b4mhb7UK1pjA
>>>
>>>
>>> On Wed, Aug 19, 2015 at 9:38 PM, Imesh Gunaratne <im...@apache.org>
>>> wrote:
>>>
>>>> +1 Can you please share the Hangout link?
>>>>
>>>> Thanks
>>>>
>>>> On Tue, Aug 18, 2015 at 10:54 PM, Chamila De Alwis <ch...@wso2.com>
>>>> wrote:
>>>>
>>>>> +1 I can attend.
>>>>>
>>>>> (On a mobile)
>>>>> Regards,
>>>>> Chamila de Alwis
>>>>> Committer and PMC Member - Apache Stratos
>>>>> Software Engineer - WSO2
>>>>> http://code.chamiladealwis.com
>>>>> On Aug 18, 2015 12:04 PM, "Milindu Sanoj Kumarage" <
>>>>> agentmilindu@gmail.com> wrote:
>>>>>
>>>>>>  Hi, extremely sorry, the date is 19th, we are having the Hangout on
>>>>>> Air for Stratos Python CLI on 19th Au from 9:30p.m IST onward. Is this time
>>>>>> and date convenient?
>>>>>>
>>>>>> https://plus.google.com/u/0/events/c8d9682n9bris9at4ucppot9jbo
>>>>>>
>>>>>> On Tue, Aug 18, 2015 at 9:02 PM, Milindu Sanoj Kumarage <
>>>>>> agentmilindu@gmail.com> wrote:
>>>>>>
>>>>>>> Hi,
>>>>>>>
>>>>>>> We are having a Hangout on Air for Stratos Python CLI on 9:30p.m.
>>>>>>> IST :)
>>>>>>>
>>>>>>> https://plus.google.com/u/0/events/c8d9682n9bris9at4ucppot9jbo
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> On Sun, Aug 16, 2015 at 4:14 PM, Milindu Sanoj Kumarage <
>>>>>>> agentmilindu@gmail.com> wrote:
>>>>>>>
>>>>>>>> Hi,
>>>>>>>>
>>>>>>>> I have finished the  documentation except for some few commands
>>>>>>>> that I still have issues.
>>>>>>>>
>>>>>>>>
>>>>>>>> https://docs.google.com/document/d/1GEdrOyIGF-zdwVry7t6-WYFMeEC0Y_Ki3ExyZFYCXdw/edit?usp=sharing
>>>>>>>>
>>>>>>>> I did two small demonstration videos on how to use and how to
>>>>>>>> config :)
>>>>>>>>
>>>>>>>>
>>>>>>>> https://www.youtube.com/playlist?list=PL2zdjxqMDj71dlnYitq59PzEoOAG21Uhq
>>>>>>>> <https://youtu.be/dzreFlxlKKM>
>>>>>>>>
>>>>>>>> I'm working on testings and those issues I mentioned earlier.
>>>>>>>>
>>>>>>>>
>>>>>>>> On Wed, Aug 12, 2015 at 12:37 AM, Milindu Sanoj Kumarage <
>>>>>>>> agentmilindu@gmail.com> wrote:
>>>>>>>>
>>>>>>>>> Hi,
>>>>>>>>>
>>>>>>>>> I want to know which commands should output that tree-like view of
>>>>>>>>> JSON data.
>>>>>>>>>
>>>>>>>>> in list-deployment-policies what 'Accessibility' means? How i
>>>>>>>>> should retrieve it from the JSON response?
>>>>>>>>>
>>>>>>>>> +---------------------+---------------+
>>>>>>>>>
>>>>>>>>> |         Id          | Accessibility |
>>>>>>>>>
>>>>>>>>> +=====================+===============+
>>>>>>>>>
>>>>>>>>> | deployment-policy-2 | 1             |
>>>>>>>>>
>>>>>>>>> | deployment-policy-1 | 1             |
>>>>>>>>>
>>>>>>>>> +---------------------+---------------+
>>>>>>>>>
>>>>>>>>> There are couple of commands that gives me errors when I send the
>>>>>>>>> request, I have to check that too.
>>>>>>>>>
>>>>>>>>> I'd do the demo as soon as I finished the document, because I want
>>>>>>>>> to know everything is working as expected :) Few more commands to go.
>>>>>>>>>
>>>>>>>>> Hi Milindu,
>>>>>>>>>
>>>>>>>>> Great work so far! Could you mention what commands and outputs are
>>>>>>>>> less clear?
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Regards,
>>>>>>>>> Chamila de Alwis
>>>>>>>>> Committer and PMC Member - Apache Stratos
>>>>>>>>> Software Engineer | WSO2 | +94772207163
>>>>>>>>> Blog: code.chamiladealwis.com
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On Sun, Aug 9, 2015 at 1:59 PM, Milindu Sanoj Kumarage <
>>>>>>>>> agentmilindu@gmail.com> wrote:
>>>>>>>>>
>>>>>>>>>> Hi,
>>>>>>>>>>
>>>>>>>>>> I have finished implementing all the CLI commands, except very
>>>>>>>>>> few which I have some doubts ( like, how the output should be presented ) :)
>>>>>>>>>>
>>>>>>>>>>  I started writing a document explaining each and every command
>>>>>>>>>> with their expected outputs ( when correct params are given, when no params
>>>>>>>>>> are given and when wrong params are given ) I will continue writing the
>>>>>>>>>> test cases based on them.
>>>>>>>>>>
>>>>>>>>>> As discussed on Hangout, I will do a demo,  record it and share
>>>>>>>>>> soon :)
>>>>>>>>>>
>>>>>>>>>> On Wed, Jul 29, 2015 at 10:34 AM, Milindu Sanoj Kumarage <
>>>>>>>>>> agentmilindu@gmail.com> wrote:
>>>>>>>>>>
>>>>>>>>>>> Hi,
>>>>>>>>>>>
>>>>>>>>>>> I could finish most of the listing command and now working with
>>>>>>>>>>> the create and update commands. I'm running Java CLI to get an idea how the
>>>>>>>>>>> output should be presented. Had to fix some issues related to that "-"
>>>>>>>>>>> issue also, regarding auto-completion. I started writing test cases for
>>>>>>>>>>> utility methods, and will start writing test cases for Stratos specific
>>>>>>>>>>> ones this week. I'm using Tox to run my tests on different Python versions,
>>>>>>>>>>> 2.x ones and 3.z ones.
>>>>>>>>>>>
>>>>>>>>>>> On Thu, Jul 9, 2015 at 2:52 PM, Milindu Sanoj Kumarage <
>>>>>>>>>>> agentmilindu@gmail.com> wrote:
>>>>>>>>>>>
>>>>>>>>>>>> Hi,
>>>>>>>>>>>>
>>>>>>>>>>>> I invested last 2 week on some research on Testing frameworks
>>>>>>>>>>>> and Security Certificates. CA Bundles and  Pem files were something I had
>>>>>>>>>>>> no experience, therefor I studied on that. Studied Java security API and
>>>>>>>>>>>> Stratos's Java CLI's Certificate handling codes ( Keystores, etc ).
>>>>>>>>>>>>
>>>>>>>>>>>> *Testing frameworks*
>>>>>>>>>>>>
>>>>>>>>>>>> 1. Unittest ( docs.python.org/2/library/unittest.html ) [ PSF(
>>>>>>>>>>>> GPL-compatible ) ]
>>>>>>>>>>>>
>>>>>>>>>>>> Python's unit testing module since 2.7. Very similar to JUnit
>>>>>>>>>>>> for Java. Gives very descriptive outputs when found assertion errors.
>>>>>>>>>>>>
>>>>>>>>>>>> 2. Unittest2 ( pypi.python.org/pypi/unittest2 ) [ BSD ]
>>>>>>>>>>>>
>>>>>>>>>>>> unittest2 is a backport of the new features added to the
>>>>>>>>>>>> unittest testing framework in Python 2.7 and onwards. Supports back to
>>>>>>>>>>>> Python 2.4+.
>>>>>>>>>>>>
>>>>>>>>>>>> 3. PyTest ( pytest.org/ ) [ MIT ]
>>>>>>>>>>>>
>>>>>>>>>>>> Very popular unit testing tool which is an alternative to
>>>>>>>>>>>> Python’s standard unittest module. Gives very descriptive outputs when
>>>>>>>>>>>> found assertion errors. Integrates nicely with setup.py. Python 2 and 3
>>>>>>>>>>>> compatible.
>>>>>>>>>>>>
>>>>>>>>>>>> 4. Nose ( nose.readthedocs.org/en/latest ) [ LGPL ]
>>>>>>>>>>>>
>>>>>>>>>>>> Nose extends unittest to make testing easier. Same as PyTest.
>>>>>>>>>>>> Python 2 and 3 compatible.
>>>>>>>>>>>>
>>>>>>>>>>>> 5. Tox ( tox.readthedocs.org/en/latest/ ) [ MIT ]
>>>>>>>>>>>>
>>>>>>>>>>>> Tox is a generic virtualenv management and test command line
>>>>>>>>>>>> tool. We can setup several Python virtual environments and run our tests on
>>>>>>>>>>>> those environments. This is a very useful tool to ensure the compatibility
>>>>>>>>>>>> with Python 2 and Python 3 versions. PyTest,  nose and unittest modules are
>>>>>>>>>>>> compatible with tox. Able to easily integrate with continuous integration
>>>>>>>>>>>> servers like Jenkins.
>>>>>>>>>>>>
>>>>>>>>>>>> 6. Doctest ( docs.python.org/2/library/doctest.htmlt ) [ PSF(
>>>>>>>>>>>> GPL-compatible ) ]
>>>>>>>>>>>>
>>>>>>>>>>>>  Python module that checks for interactive Python sessions in
>>>>>>>>>>>> docstrings, and then executes those sessions to verify that they work
>>>>>>>>>>>> exactly as shown.
>>>>>>>>>>>>
>>>>>>>>>>>> 7. Atheist ( arco.esi.uclm.es/~david.villa/atheist/html/  ) [
>>>>>>>>>>>> GFDL ]
>>>>>>>>>>>>
>>>>>>>>>>>> A great tool for command line testing, it issues the commands
>>>>>>>>>>>> to the underlying shell and compares the output with the intended output.
>>>>>>>>>>>> Now discontinued but bug-maintained.
>>>>>>>>>>>>
>>>>>>>>>>>> 8. Prego ( bitbucket.org/arco_group/prego ) [ GPLv3+ ]
>>>>>>>>>>>>
>>>>>>>>>>>> Successor of Atheist, which provides support to run shell
>>>>>>>>>>>> commands on background, send signal to processes, set assertions on command
>>>>>>>>>>>> stdout or stderr, etc. Very suitable in CLI testing tasks.
>>>>>>>>>>>>
>>>>>>>>>>>> 9. ScriptTest ( pythonpaste.org/scripttest/ ) [  MIT-style
>>>>>>>>>>>> permissive license ]
>>>>>>>>>>>>
>>>>>>>>>>>> Something like Prego, but seems less features.
>>>>>>>>>>>>
>>>>>>>>>>>> 10. Behave ( jenisys.github.io/behave.example/ ) [ BSD ]
>>>>>>>>>>>>
>>>>>>>>>>>>  A BDD framework and a cucumber-clone for Python. Cucumber is a
>>>>>>>>>>>> nice way for feature testing where we define the features in simple English
>>>>>>>>>>>> and that will become the tests.
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> I definitely will be using Tox because it makes us test the
>>>>>>>>>>>> Python CLI on different Python versions. But Tox alone can not test the
>>>>>>>>>>>> CLI. We have to us some other testing framework on Tox. I'm wondering what
>>>>>>>>>>>> to use where. We can use PyTest for unit test Stratos.py which calls the
>>>>>>>>>>>> Stratos RESTAPI. But we have to test the CLI functionalities also, using
>>>>>>>>>>>> some kind of CLI testing tool. I think I need some advice here :)
>>>>>>>>>>>>
>>>>>>>>>>>> Meanwhile, I continued implementing other "list" CMD actions in
>>>>>>>>>>>> Python CLI. I see some repetition in error code handling stuffs, I'm
>>>>>>>>>>>> thinking of a way to write a general method for error handling and error
>>>>>>>>>>>> reporting.
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>
>>>>
>>>>
>>>> --
>>>> Imesh Gunaratne
>>>>
>>>> Senior Technical Lead, WSO2
>>>> Committer & PMC Member, Apache Stratos
>>>>
>>>
>>>
>>
>
>
> --
> Imesh Gunaratne
>
> Senior Technical Lead, WSO2
> Committer & PMC Member, Apache Stratos
>

Re: [GSoC 2015] Python CLI for Stratos : Weekly Update

Posted by Imesh Gunaratne <im...@apache.org>.
Hi Milindu,

Thanks for all the hard work! You have done a great job completing this
Google Summer of Code project. Please send us a pull request with your
latest changes.

Please feel free to contribute to Stratos whenever time permits.

Thanks

On Mon, Aug 24, 2015 at 5:47 PM, Milindu Sanoj Kumarage <
agentmilindu@gmail.com> wrote:

> Hi,
>
> Here is the recorded Hangout :)
>
> https://www.youtube.com/watch?v=VjMIk5F9Ba
>
> And here is a small blog post I wrote on how I implemented the Stratos CLI
>
> http://agentmilindu.com/python-cli-apache-stratos/
>
>
>
> On Wed, Aug 19, 2015 at 9:42 PM, Milindu Sanoj Kumarage <
> agentmilindu@gmail.com> wrote:
>
>> Hi,
>>
>> Here is the link to Hangout :)
>>
>> https://plus.google.com/hangouts/_/hoaevent/AP36tYff-vrxKu7_Mymm8ZuD0_8hqlP_XRHSADiig8b4mhb7UK1pjA
>>
>>
>> On Wed, Aug 19, 2015 at 9:38 PM, Imesh Gunaratne <im...@apache.org>
>> wrote:
>>
>>> +1 Can you please share the Hangout link?
>>>
>>> Thanks
>>>
>>> On Tue, Aug 18, 2015 at 10:54 PM, Chamila De Alwis <ch...@wso2.com>
>>> wrote:
>>>
>>>> +1 I can attend.
>>>>
>>>> (On a mobile)
>>>> Regards,
>>>> Chamila de Alwis
>>>> Committer and PMC Member - Apache Stratos
>>>> Software Engineer - WSO2
>>>> http://code.chamiladealwis.com
>>>> On Aug 18, 2015 12:04 PM, "Milindu Sanoj Kumarage" <
>>>> agentmilindu@gmail.com> wrote:
>>>>
>>>>>  Hi, extremely sorry, the date is 19th, we are having the Hangout on
>>>>> Air for Stratos Python CLI on 19th Au from 9:30p.m IST onward. Is this time
>>>>> and date convenient?
>>>>>
>>>>> https://plus.google.com/u/0/events/c8d9682n9bris9at4ucppot9jbo
>>>>>
>>>>> On Tue, Aug 18, 2015 at 9:02 PM, Milindu Sanoj Kumarage <
>>>>> agentmilindu@gmail.com> wrote:
>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> We are having a Hangout on Air for Stratos Python CLI on 9:30p.m. IST
>>>>>> :)
>>>>>>
>>>>>> https://plus.google.com/u/0/events/c8d9682n9bris9at4ucppot9jbo
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> On Sun, Aug 16, 2015 at 4:14 PM, Milindu Sanoj Kumarage <
>>>>>> agentmilindu@gmail.com> wrote:
>>>>>>
>>>>>>> Hi,
>>>>>>>
>>>>>>> I have finished the  documentation except for some few commands that
>>>>>>> I still have issues.
>>>>>>>
>>>>>>>
>>>>>>> https://docs.google.com/document/d/1GEdrOyIGF-zdwVry7t6-WYFMeEC0Y_Ki3ExyZFYCXdw/edit?usp=sharing
>>>>>>>
>>>>>>> I did two small demonstration videos on how to use and how to config
>>>>>>> :)
>>>>>>>
>>>>>>>
>>>>>>> https://www.youtube.com/playlist?list=PL2zdjxqMDj71dlnYitq59PzEoOAG21Uhq
>>>>>>> <https://youtu.be/dzreFlxlKKM>
>>>>>>>
>>>>>>> I'm working on testings and those issues I mentioned earlier.
>>>>>>>
>>>>>>>
>>>>>>> On Wed, Aug 12, 2015 at 12:37 AM, Milindu Sanoj Kumarage <
>>>>>>> agentmilindu@gmail.com> wrote:
>>>>>>>
>>>>>>>> Hi,
>>>>>>>>
>>>>>>>> I want to know which commands should output that tree-like view of
>>>>>>>> JSON data.
>>>>>>>>
>>>>>>>> in list-deployment-policies what 'Accessibility' means? How i
>>>>>>>> should retrieve it from the JSON response?
>>>>>>>>
>>>>>>>> +---------------------+---------------+
>>>>>>>>
>>>>>>>> |         Id          | Accessibility |
>>>>>>>>
>>>>>>>> +=====================+===============+
>>>>>>>>
>>>>>>>> | deployment-policy-2 | 1             |
>>>>>>>>
>>>>>>>> | deployment-policy-1 | 1             |
>>>>>>>>
>>>>>>>> +---------------------+---------------+
>>>>>>>>
>>>>>>>> There are couple of commands that gives me errors when I send the
>>>>>>>> request, I have to check that too.
>>>>>>>>
>>>>>>>> I'd do the demo as soon as I finished the document, because I want
>>>>>>>> to know everything is working as expected :) Few more commands to go.
>>>>>>>>
>>>>>>>> Hi Milindu,
>>>>>>>>
>>>>>>>> Great work so far! Could you mention what commands and outputs are
>>>>>>>> less clear?
>>>>>>>>
>>>>>>>>
>>>>>>>> Regards,
>>>>>>>> Chamila de Alwis
>>>>>>>> Committer and PMC Member - Apache Stratos
>>>>>>>> Software Engineer | WSO2 | +94772207163
>>>>>>>> Blog: code.chamiladealwis.com
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> On Sun, Aug 9, 2015 at 1:59 PM, Milindu Sanoj Kumarage <
>>>>>>>> agentmilindu@gmail.com> wrote:
>>>>>>>>
>>>>>>>>> Hi,
>>>>>>>>>
>>>>>>>>> I have finished implementing all the CLI commands, except very few
>>>>>>>>> which I have some doubts ( like, how the output should be presented ) :)
>>>>>>>>>
>>>>>>>>>  I started writing a document explaining each and every command
>>>>>>>>> with their expected outputs ( when correct params are given, when no params
>>>>>>>>> are given and when wrong params are given ) I will continue writing the
>>>>>>>>> test cases based on them.
>>>>>>>>>
>>>>>>>>> As discussed on Hangout, I will do a demo,  record it and share
>>>>>>>>> soon :)
>>>>>>>>>
>>>>>>>>> On Wed, Jul 29, 2015 at 10:34 AM, Milindu Sanoj Kumarage <
>>>>>>>>> agentmilindu@gmail.com> wrote:
>>>>>>>>>
>>>>>>>>>> Hi,
>>>>>>>>>>
>>>>>>>>>> I could finish most of the listing command and now working with
>>>>>>>>>> the create and update commands. I'm running Java CLI to get an idea how the
>>>>>>>>>> output should be presented. Had to fix some issues related to that "-"
>>>>>>>>>> issue also, regarding auto-completion. I started writing test cases for
>>>>>>>>>> utility methods, and will start writing test cases for Stratos specific
>>>>>>>>>> ones this week. I'm using Tox to run my tests on different Python versions,
>>>>>>>>>> 2.x ones and 3.z ones.
>>>>>>>>>>
>>>>>>>>>> On Thu, Jul 9, 2015 at 2:52 PM, Milindu Sanoj Kumarage <
>>>>>>>>>> agentmilindu@gmail.com> wrote:
>>>>>>>>>>
>>>>>>>>>>> Hi,
>>>>>>>>>>>
>>>>>>>>>>> I invested last 2 week on some research on Testing frameworks
>>>>>>>>>>> and Security Certificates. CA Bundles and  Pem files were something I had
>>>>>>>>>>> no experience, therefor I studied on that. Studied Java security API and
>>>>>>>>>>> Stratos's Java CLI's Certificate handling codes ( Keystores, etc ).
>>>>>>>>>>>
>>>>>>>>>>> *Testing frameworks*
>>>>>>>>>>>
>>>>>>>>>>> 1. Unittest ( docs.python.org/2/library/unittest.html ) [ PSF(
>>>>>>>>>>> GPL-compatible ) ]
>>>>>>>>>>>
>>>>>>>>>>> Python's unit testing module since 2.7. Very similar to JUnit
>>>>>>>>>>> for Java. Gives very descriptive outputs when found assertion errors.
>>>>>>>>>>>
>>>>>>>>>>> 2. Unittest2 ( pypi.python.org/pypi/unittest2 ) [ BSD ]
>>>>>>>>>>>
>>>>>>>>>>> unittest2 is a backport of the new features added to the
>>>>>>>>>>> unittest testing framework in Python 2.7 and onwards. Supports back to
>>>>>>>>>>> Python 2.4+.
>>>>>>>>>>>
>>>>>>>>>>> 3. PyTest ( pytest.org/ ) [ MIT ]
>>>>>>>>>>>
>>>>>>>>>>> Very popular unit testing tool which is an alternative to
>>>>>>>>>>> Python’s standard unittest module. Gives very descriptive outputs when
>>>>>>>>>>> found assertion errors. Integrates nicely with setup.py. Python 2 and 3
>>>>>>>>>>> compatible.
>>>>>>>>>>>
>>>>>>>>>>> 4. Nose ( nose.readthedocs.org/en/latest ) [ LGPL ]
>>>>>>>>>>>
>>>>>>>>>>> Nose extends unittest to make testing easier. Same as PyTest.
>>>>>>>>>>> Python 2 and 3 compatible.
>>>>>>>>>>>
>>>>>>>>>>> 5. Tox ( tox.readthedocs.org/en/latest/ ) [ MIT ]
>>>>>>>>>>>
>>>>>>>>>>> Tox is a generic virtualenv management and test command line
>>>>>>>>>>> tool. We can setup several Python virtual environments and run our tests on
>>>>>>>>>>> those environments. This is a very useful tool to ensure the compatibility
>>>>>>>>>>> with Python 2 and Python 3 versions. PyTest,  nose and unittest modules are
>>>>>>>>>>> compatible with tox. Able to easily integrate with continuous integration
>>>>>>>>>>> servers like Jenkins.
>>>>>>>>>>>
>>>>>>>>>>> 6. Doctest ( docs.python.org/2/library/doctest.htmlt ) [ PSF(
>>>>>>>>>>> GPL-compatible ) ]
>>>>>>>>>>>
>>>>>>>>>>>  Python module that checks for interactive Python sessions in
>>>>>>>>>>> docstrings, and then executes those sessions to verify that they work
>>>>>>>>>>> exactly as shown.
>>>>>>>>>>>
>>>>>>>>>>> 7. Atheist ( arco.esi.uclm.es/~david.villa/atheist/html/  ) [
>>>>>>>>>>> GFDL ]
>>>>>>>>>>>
>>>>>>>>>>> A great tool for command line testing, it issues the commands to
>>>>>>>>>>> the underlying shell and compares the output with the intended output. Now
>>>>>>>>>>> discontinued but bug-maintained.
>>>>>>>>>>>
>>>>>>>>>>> 8. Prego ( bitbucket.org/arco_group/prego ) [ GPLv3+ ]
>>>>>>>>>>>
>>>>>>>>>>> Successor of Atheist, which provides support to run shell
>>>>>>>>>>> commands on background, send signal to processes, set assertions on command
>>>>>>>>>>> stdout or stderr, etc. Very suitable in CLI testing tasks.
>>>>>>>>>>>
>>>>>>>>>>> 9. ScriptTest ( pythonpaste.org/scripttest/ ) [  MIT-style
>>>>>>>>>>> permissive license ]
>>>>>>>>>>>
>>>>>>>>>>> Something like Prego, but seems less features.
>>>>>>>>>>>
>>>>>>>>>>> 10. Behave ( jenisys.github.io/behave.example/ ) [ BSD ]
>>>>>>>>>>>
>>>>>>>>>>>  A BDD framework and a cucumber-clone for Python. Cucumber is a
>>>>>>>>>>> nice way for feature testing where we define the features in simple English
>>>>>>>>>>> and that will become the tests.
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> I definitely will be using Tox because it makes us test the
>>>>>>>>>>> Python CLI on different Python versions. But Tox alone can not test the
>>>>>>>>>>> CLI. We have to us some other testing framework on Tox. I'm wondering what
>>>>>>>>>>> to use where. We can use PyTest for unit test Stratos.py which calls the
>>>>>>>>>>> Stratos RESTAPI. But we have to test the CLI functionalities also, using
>>>>>>>>>>> some kind of CLI testing tool. I think I need some advice here :)
>>>>>>>>>>>
>>>>>>>>>>> Meanwhile, I continued implementing other "list" CMD actions in
>>>>>>>>>>> Python CLI. I see some repetition in error code handling stuffs, I'm
>>>>>>>>>>> thinking of a way to write a general method for error handling and error
>>>>>>>>>>> reporting.
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>
>>>
>>> --
>>> Imesh Gunaratne
>>>
>>> Senior Technical Lead, WSO2
>>> Committer & PMC Member, Apache Stratos
>>>
>>
>>
>


-- 
Imesh Gunaratne

Senior Technical Lead, WSO2
Committer & PMC Member, Apache Stratos

Re: [GSoC 2015] Python CLI for Stratos : Weekly Update

Posted by Milindu Sanoj Kumarage <ag...@gmail.com>.
Hi,

Here is the recorded Hangout :)

https://www.youtube.com/watch?v=VjMIk5F9Ba

And here is a small blog post I wrote on how I implemented the Stratos CLI

http://agentmilindu.com/python-cli-apache-stratos/



On Wed, Aug 19, 2015 at 9:42 PM, Milindu Sanoj Kumarage <
agentmilindu@gmail.com> wrote:

> Hi,
>
> Here is the link to Hangout :)
>
> https://plus.google.com/hangouts/_/hoaevent/AP36tYff-vrxKu7_Mymm8ZuD0_8hqlP_XRHSADiig8b4mhb7UK1pjA
>
>
> On Wed, Aug 19, 2015 at 9:38 PM, Imesh Gunaratne <im...@apache.org> wrote:
>
>> +1 Can you please share the Hangout link?
>>
>> Thanks
>>
>> On Tue, Aug 18, 2015 at 10:54 PM, Chamila De Alwis <ch...@wso2.com>
>> wrote:
>>
>>> +1 I can attend.
>>>
>>> (On a mobile)
>>> Regards,
>>> Chamila de Alwis
>>> Committer and PMC Member - Apache Stratos
>>> Software Engineer - WSO2
>>> http://code.chamiladealwis.com
>>> On Aug 18, 2015 12:04 PM, "Milindu Sanoj Kumarage" <
>>> agentmilindu@gmail.com> wrote:
>>>
>>>>  Hi, extremely sorry, the date is 19th, we are having the Hangout on
>>>> Air for Stratos Python CLI on 19th Au from 9:30p.m IST onward. Is this time
>>>> and date convenient?
>>>>
>>>> https://plus.google.com/u/0/events/c8d9682n9bris9at4ucppot9jbo
>>>>
>>>> On Tue, Aug 18, 2015 at 9:02 PM, Milindu Sanoj Kumarage <
>>>> agentmilindu@gmail.com> wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> We are having a Hangout on Air for Stratos Python CLI on 9:30p.m. IST
>>>>> :)
>>>>>
>>>>> https://plus.google.com/u/0/events/c8d9682n9bris9at4ucppot9jbo
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> On Sun, Aug 16, 2015 at 4:14 PM, Milindu Sanoj Kumarage <
>>>>> agentmilindu@gmail.com> wrote:
>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> I have finished the  documentation except for some few commands that
>>>>>> I still have issues.
>>>>>>
>>>>>>
>>>>>> https://docs.google.com/document/d/1GEdrOyIGF-zdwVry7t6-WYFMeEC0Y_Ki3ExyZFYCXdw/edit?usp=sharing
>>>>>>
>>>>>> I did two small demonstration videos on how to use and how to config
>>>>>> :)
>>>>>>
>>>>>>
>>>>>> https://www.youtube.com/playlist?list=PL2zdjxqMDj71dlnYitq59PzEoOAG21Uhq
>>>>>> <https://youtu.be/dzreFlxlKKM>
>>>>>>
>>>>>> I'm working on testings and those issues I mentioned earlier.
>>>>>>
>>>>>>
>>>>>> On Wed, Aug 12, 2015 at 12:37 AM, Milindu Sanoj Kumarage <
>>>>>> agentmilindu@gmail.com> wrote:
>>>>>>
>>>>>>> Hi,
>>>>>>>
>>>>>>> I want to know which commands should output that tree-like view of
>>>>>>> JSON data.
>>>>>>>
>>>>>>> in list-deployment-policies what 'Accessibility' means? How i
>>>>>>> should retrieve it from the JSON response?
>>>>>>>
>>>>>>> +---------------------+---------------+
>>>>>>>
>>>>>>> |         Id          | Accessibility |
>>>>>>>
>>>>>>> +=====================+===============+
>>>>>>>
>>>>>>> | deployment-policy-2 | 1             |
>>>>>>>
>>>>>>> | deployment-policy-1 | 1             |
>>>>>>>
>>>>>>> +---------------------+---------------+
>>>>>>>
>>>>>>> There are couple of commands that gives me errors when I send the
>>>>>>> request, I have to check that too.
>>>>>>>
>>>>>>> I'd do the demo as soon as I finished the document, because I want
>>>>>>> to know everything is working as expected :) Few more commands to go.
>>>>>>>
>>>>>>> Hi Milindu,
>>>>>>>
>>>>>>> Great work so far! Could you mention what commands and outputs are
>>>>>>> less clear?
>>>>>>>
>>>>>>>
>>>>>>> Regards,
>>>>>>> Chamila de Alwis
>>>>>>> Committer and PMC Member - Apache Stratos
>>>>>>> Software Engineer | WSO2 | +94772207163
>>>>>>> Blog: code.chamiladealwis.com
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> On Sun, Aug 9, 2015 at 1:59 PM, Milindu Sanoj Kumarage <
>>>>>>> agentmilindu@gmail.com> wrote:
>>>>>>>
>>>>>>>> Hi,
>>>>>>>>
>>>>>>>> I have finished implementing all the CLI commands, except very few
>>>>>>>> which I have some doubts ( like, how the output should be presented ) :)
>>>>>>>>
>>>>>>>>  I started writing a document explaining each and every command
>>>>>>>> with their expected outputs ( when correct params are given, when no params
>>>>>>>> are given and when wrong params are given ) I will continue writing the
>>>>>>>> test cases based on them.
>>>>>>>>
>>>>>>>> As discussed on Hangout, I will do a demo,  record it and share
>>>>>>>> soon :)
>>>>>>>>
>>>>>>>> On Wed, Jul 29, 2015 at 10:34 AM, Milindu Sanoj Kumarage <
>>>>>>>> agentmilindu@gmail.com> wrote:
>>>>>>>>
>>>>>>>>> Hi,
>>>>>>>>>
>>>>>>>>> I could finish most of the listing command and now working with
>>>>>>>>> the create and update commands. I'm running Java CLI to get an idea how the
>>>>>>>>> output should be presented. Had to fix some issues related to that "-"
>>>>>>>>> issue also, regarding auto-completion. I started writing test cases for
>>>>>>>>> utility methods, and will start writing test cases for Stratos specific
>>>>>>>>> ones this week. I'm using Tox to run my tests on different Python versions,
>>>>>>>>> 2.x ones and 3.z ones.
>>>>>>>>>
>>>>>>>>> On Thu, Jul 9, 2015 at 2:52 PM, Milindu Sanoj Kumarage <
>>>>>>>>> agentmilindu@gmail.com> wrote:
>>>>>>>>>
>>>>>>>>>> Hi,
>>>>>>>>>>
>>>>>>>>>> I invested last 2 week on some research on Testing frameworks and
>>>>>>>>>> Security Certificates. CA Bundles and  Pem files were something I had no
>>>>>>>>>> experience, therefor I studied on that. Studied Java security API and
>>>>>>>>>> Stratos's Java CLI's Certificate handling codes ( Keystores, etc ).
>>>>>>>>>>
>>>>>>>>>> *Testing frameworks*
>>>>>>>>>>
>>>>>>>>>> 1. Unittest ( docs.python.org/2/library/unittest.html ) [ PSF(
>>>>>>>>>> GPL-compatible ) ]
>>>>>>>>>>
>>>>>>>>>> Python's unit testing module since 2.7. Very similar to JUnit for
>>>>>>>>>> Java. Gives very descriptive outputs when found assertion errors.
>>>>>>>>>>
>>>>>>>>>> 2. Unittest2 ( pypi.python.org/pypi/unittest2 ) [ BSD ]
>>>>>>>>>>
>>>>>>>>>> unittest2 is a backport of the new features added to the unittest
>>>>>>>>>> testing framework in Python 2.7 and onwards. Supports back to Python 2.4+.
>>>>>>>>>>
>>>>>>>>>> 3. PyTest ( pytest.org/ ) [ MIT ]
>>>>>>>>>>
>>>>>>>>>> Very popular unit testing tool which is an alternative to
>>>>>>>>>> Python’s standard unittest module. Gives very descriptive outputs when
>>>>>>>>>> found assertion errors. Integrates nicely with setup.py. Python 2 and 3
>>>>>>>>>> compatible.
>>>>>>>>>>
>>>>>>>>>> 4. Nose ( nose.readthedocs.org/en/latest ) [ LGPL ]
>>>>>>>>>>
>>>>>>>>>> Nose extends unittest to make testing easier. Same as PyTest.
>>>>>>>>>> Python 2 and 3 compatible.
>>>>>>>>>>
>>>>>>>>>> 5. Tox ( tox.readthedocs.org/en/latest/ ) [ MIT ]
>>>>>>>>>>
>>>>>>>>>> Tox is a generic virtualenv management and test command line
>>>>>>>>>> tool. We can setup several Python virtual environments and run our tests on
>>>>>>>>>> those environments. This is a very useful tool to ensure the compatibility
>>>>>>>>>> with Python 2 and Python 3 versions. PyTest,  nose and unittest modules are
>>>>>>>>>> compatible with tox. Able to easily integrate with continuous integration
>>>>>>>>>> servers like Jenkins.
>>>>>>>>>>
>>>>>>>>>> 6. Doctest ( docs.python.org/2/library/doctest.htmlt ) [ PSF(
>>>>>>>>>> GPL-compatible ) ]
>>>>>>>>>>
>>>>>>>>>>  Python module that checks for interactive Python sessions in
>>>>>>>>>> docstrings, and then executes those sessions to verify that they work
>>>>>>>>>> exactly as shown.
>>>>>>>>>>
>>>>>>>>>> 7. Atheist ( arco.esi.uclm.es/~david.villa/atheist/html/  ) [
>>>>>>>>>> GFDL ]
>>>>>>>>>>
>>>>>>>>>> A great tool for command line testing, it issues the commands to
>>>>>>>>>> the underlying shell and compares the output with the intended output. Now
>>>>>>>>>> discontinued but bug-maintained.
>>>>>>>>>>
>>>>>>>>>> 8. Prego ( bitbucket.org/arco_group/prego ) [ GPLv3+ ]
>>>>>>>>>>
>>>>>>>>>> Successor of Atheist, which provides support to run shell
>>>>>>>>>> commands on background, send signal to processes, set assertions on command
>>>>>>>>>> stdout or stderr, etc. Very suitable in CLI testing tasks.
>>>>>>>>>>
>>>>>>>>>> 9. ScriptTest ( pythonpaste.org/scripttest/ ) [  MIT-style
>>>>>>>>>> permissive license ]
>>>>>>>>>>
>>>>>>>>>> Something like Prego, but seems less features.
>>>>>>>>>>
>>>>>>>>>> 10. Behave ( jenisys.github.io/behave.example/ ) [ BSD ]
>>>>>>>>>>
>>>>>>>>>>  A BDD framework and a cucumber-clone for Python. Cucumber is a
>>>>>>>>>> nice way for feature testing where we define the features in simple English
>>>>>>>>>> and that will become the tests.
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> I definitely will be using Tox because it makes us test the
>>>>>>>>>> Python CLI on different Python versions. But Tox alone can not test the
>>>>>>>>>> CLI. We have to us some other testing framework on Tox. I'm wondering what
>>>>>>>>>> to use where. We can use PyTest for unit test Stratos.py which calls the
>>>>>>>>>> Stratos RESTAPI. But we have to test the CLI functionalities also, using
>>>>>>>>>> some kind of CLI testing tool. I think I need some advice here :)
>>>>>>>>>>
>>>>>>>>>> Meanwhile, I continued implementing other "list" CMD actions in
>>>>>>>>>> Python CLI. I see some repetition in error code handling stuffs, I'm
>>>>>>>>>> thinking of a way to write a general method for error handling and error
>>>>>>>>>> reporting.
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>
>>
>>
>> --
>> Imesh Gunaratne
>>
>> Senior Technical Lead, WSO2
>> Committer & PMC Member, Apache Stratos
>>
>
>

Re: [GSoC 2015] Python CLI for Stratos : Weekly Update

Posted by Milindu Sanoj Kumarage <ag...@gmail.com>.
Hi,

Here is the link to Hangout :)
https://plus.google.com/hangouts/_/hoaevent/AP36tYff-vrxKu7_Mymm8ZuD0_8hqlP_XRHSADiig8b4mhb7UK1pjA


On Wed, Aug 19, 2015 at 9:38 PM, Imesh Gunaratne <im...@apache.org> wrote:

> +1 Can you please share the Hangout link?
>
> Thanks
>
> On Tue, Aug 18, 2015 at 10:54 PM, Chamila De Alwis <ch...@wso2.com>
> wrote:
>
>> +1 I can attend.
>>
>> (On a mobile)
>> Regards,
>> Chamila de Alwis
>> Committer and PMC Member - Apache Stratos
>> Software Engineer - WSO2
>> http://code.chamiladealwis.com
>> On Aug 18, 2015 12:04 PM, "Milindu Sanoj Kumarage" <
>> agentmilindu@gmail.com> wrote:
>>
>>>  Hi, extremely sorry, the date is 19th, we are having the Hangout on
>>> Air for Stratos Python CLI on 19th Au from 9:30p.m IST onward. Is this time
>>> and date convenient?
>>>
>>> https://plus.google.com/u/0/events/c8d9682n9bris9at4ucppot9jbo
>>>
>>> On Tue, Aug 18, 2015 at 9:02 PM, Milindu Sanoj Kumarage <
>>> agentmilindu@gmail.com> wrote:
>>>
>>>> Hi,
>>>>
>>>> We are having a Hangout on Air for Stratos Python CLI on 9:30p.m. IST
>>>> :)
>>>>
>>>> https://plus.google.com/u/0/events/c8d9682n9bris9at4ucppot9jbo
>>>>
>>>>
>>>>
>>>>
>>>> On Sun, Aug 16, 2015 at 4:14 PM, Milindu Sanoj Kumarage <
>>>> agentmilindu@gmail.com> wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> I have finished the  documentation except for some few commands that I
>>>>> still have issues.
>>>>>
>>>>>
>>>>> https://docs.google.com/document/d/1GEdrOyIGF-zdwVry7t6-WYFMeEC0Y_Ki3ExyZFYCXdw/edit?usp=sharing
>>>>>
>>>>> I did two small demonstration videos on how to use and how to config :)
>>>>>
>>>>>
>>>>> https://www.youtube.com/playlist?list=PL2zdjxqMDj71dlnYitq59PzEoOAG21Uhq
>>>>> <https://youtu.be/dzreFlxlKKM>
>>>>>
>>>>> I'm working on testings and those issues I mentioned earlier.
>>>>>
>>>>>
>>>>> On Wed, Aug 12, 2015 at 12:37 AM, Milindu Sanoj Kumarage <
>>>>> agentmilindu@gmail.com> wrote:
>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> I want to know which commands should output that tree-like view of
>>>>>> JSON data.
>>>>>>
>>>>>> in list-deployment-policies what 'Accessibility' means? How i should
>>>>>> retrieve it from the JSON response?
>>>>>>
>>>>>> +---------------------+---------------+
>>>>>>
>>>>>> |         Id          | Accessibility |
>>>>>>
>>>>>> +=====================+===============+
>>>>>>
>>>>>> | deployment-policy-2 | 1             |
>>>>>>
>>>>>> | deployment-policy-1 | 1             |
>>>>>>
>>>>>> +---------------------+---------------+
>>>>>>
>>>>>> There are couple of commands that gives me errors when I send the
>>>>>> request, I have to check that too.
>>>>>>
>>>>>> I'd do the demo as soon as I finished the document, because I want to
>>>>>> know everything is working as expected :) Few more commands to go.
>>>>>>
>>>>>> Hi Milindu,
>>>>>>
>>>>>> Great work so far! Could you mention what commands and outputs are
>>>>>> less clear?
>>>>>>
>>>>>>
>>>>>> Regards,
>>>>>> Chamila de Alwis
>>>>>> Committer and PMC Member - Apache Stratos
>>>>>> Software Engineer | WSO2 | +94772207163
>>>>>> Blog: code.chamiladealwis.com
>>>>>>
>>>>>>
>>>>>>
>>>>>> On Sun, Aug 9, 2015 at 1:59 PM, Milindu Sanoj Kumarage <
>>>>>> agentmilindu@gmail.com> wrote:
>>>>>>
>>>>>>> Hi,
>>>>>>>
>>>>>>> I have finished implementing all the CLI commands, except very few
>>>>>>> which I have some doubts ( like, how the output should be presented ) :)
>>>>>>>
>>>>>>>  I started writing a document explaining each and every command with
>>>>>>> their expected outputs ( when correct params are given, when no params are
>>>>>>> given and when wrong params are given ) I will continue writing the test
>>>>>>> cases based on them.
>>>>>>>
>>>>>>> As discussed on Hangout, I will do a demo,  record it and share soon
>>>>>>> :)
>>>>>>>
>>>>>>> On Wed, Jul 29, 2015 at 10:34 AM, Milindu Sanoj Kumarage <
>>>>>>> agentmilindu@gmail.com> wrote:
>>>>>>>
>>>>>>>> Hi,
>>>>>>>>
>>>>>>>> I could finish most of the listing command and now working with the
>>>>>>>> create and update commands. I'm running Java CLI to get an idea how the
>>>>>>>> output should be presented. Had to fix some issues related to that "-"
>>>>>>>> issue also, regarding auto-completion. I started writing test cases for
>>>>>>>> utility methods, and will start writing test cases for Stratos specific
>>>>>>>> ones this week. I'm using Tox to run my tests on different Python versions,
>>>>>>>> 2.x ones and 3.z ones.
>>>>>>>>
>>>>>>>> On Thu, Jul 9, 2015 at 2:52 PM, Milindu Sanoj Kumarage <
>>>>>>>> agentmilindu@gmail.com> wrote:
>>>>>>>>
>>>>>>>>> Hi,
>>>>>>>>>
>>>>>>>>> I invested last 2 week on some research on Testing frameworks and
>>>>>>>>> Security Certificates. CA Bundles and  Pem files were something I had no
>>>>>>>>> experience, therefor I studied on that. Studied Java security API and
>>>>>>>>> Stratos's Java CLI's Certificate handling codes ( Keystores, etc ).
>>>>>>>>>
>>>>>>>>> *Testing frameworks*
>>>>>>>>>
>>>>>>>>> 1. Unittest ( docs.python.org/2/library/unittest.html ) [ PSF(
>>>>>>>>> GPL-compatible ) ]
>>>>>>>>>
>>>>>>>>> Python's unit testing module since 2.7. Very similar to JUnit for
>>>>>>>>> Java. Gives very descriptive outputs when found assertion errors.
>>>>>>>>>
>>>>>>>>> 2. Unittest2 ( pypi.python.org/pypi/unittest2 ) [ BSD ]
>>>>>>>>>
>>>>>>>>> unittest2 is a backport of the new features added to the unittest
>>>>>>>>> testing framework in Python 2.7 and onwards. Supports back to Python 2.4+.
>>>>>>>>>
>>>>>>>>> 3. PyTest ( pytest.org/ ) [ MIT ]
>>>>>>>>>
>>>>>>>>> Very popular unit testing tool which is an alternative to Python’s
>>>>>>>>> standard unittest module. Gives very descriptive outputs when found
>>>>>>>>> assertion errors. Integrates nicely with setup.py. Python 2 and 3
>>>>>>>>> compatible.
>>>>>>>>>
>>>>>>>>> 4. Nose ( nose.readthedocs.org/en/latest ) [ LGPL ]
>>>>>>>>>
>>>>>>>>> Nose extends unittest to make testing easier. Same as PyTest.
>>>>>>>>> Python 2 and 3 compatible.
>>>>>>>>>
>>>>>>>>> 5. Tox ( tox.readthedocs.org/en/latest/ ) [ MIT ]
>>>>>>>>>
>>>>>>>>> Tox is a generic virtualenv management and test command line tool.
>>>>>>>>> We can setup several Python virtual environments and run our tests on those
>>>>>>>>> environments. This is a very useful tool to ensure the compatibility with
>>>>>>>>> Python 2 and Python 3 versions. PyTest,  nose and unittest modules are
>>>>>>>>> compatible with tox. Able to easily integrate with continuous integration
>>>>>>>>> servers like Jenkins.
>>>>>>>>>
>>>>>>>>> 6. Doctest ( docs.python.org/2/library/doctest.htmlt ) [ PSF(
>>>>>>>>> GPL-compatible ) ]
>>>>>>>>>
>>>>>>>>>  Python module that checks for interactive Python sessions in
>>>>>>>>> docstrings, and then executes those sessions to verify that they work
>>>>>>>>> exactly as shown.
>>>>>>>>>
>>>>>>>>> 7. Atheist ( arco.esi.uclm.es/~david.villa/atheist/html/  ) [
>>>>>>>>> GFDL ]
>>>>>>>>>
>>>>>>>>> A great tool for command line testing, it issues the commands to
>>>>>>>>> the underlying shell and compares the output with the intended output. Now
>>>>>>>>> discontinued but bug-maintained.
>>>>>>>>>
>>>>>>>>> 8. Prego ( bitbucket.org/arco_group/prego ) [ GPLv3+ ]
>>>>>>>>>
>>>>>>>>> Successor of Atheist, which provides support to run shell commands
>>>>>>>>> on background, send signal to processes, set assertions on command stdout
>>>>>>>>> or stderr, etc. Very suitable in CLI testing tasks.
>>>>>>>>>
>>>>>>>>> 9. ScriptTest ( pythonpaste.org/scripttest/ ) [  MIT-style
>>>>>>>>> permissive license ]
>>>>>>>>>
>>>>>>>>> Something like Prego, but seems less features.
>>>>>>>>>
>>>>>>>>> 10. Behave ( jenisys.github.io/behave.example/ ) [ BSD ]
>>>>>>>>>
>>>>>>>>>  A BDD framework and a cucumber-clone for Python. Cucumber is a
>>>>>>>>> nice way for feature testing where we define the features in simple English
>>>>>>>>> and that will become the tests.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> I definitely will be using Tox because it makes us test the Python
>>>>>>>>> CLI on different Python versions. But Tox alone can not test the CLI. We
>>>>>>>>> have to us some other testing framework on Tox. I'm wondering what to use
>>>>>>>>> where. We can use PyTest for unit test Stratos.py which calls the Stratos
>>>>>>>>> RESTAPI. But we have to test the CLI functionalities also, using some kind
>>>>>>>>> of CLI testing tool. I think I need some advice here :)
>>>>>>>>>
>>>>>>>>> Meanwhile, I continued implementing other "list" CMD actions in
>>>>>>>>> Python CLI. I see some repetition in error code handling stuffs, I'm
>>>>>>>>> thinking of a way to write a general method for error handling and error
>>>>>>>>> reporting.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>
>
> --
> Imesh Gunaratne
>
> Senior Technical Lead, WSO2
> Committer & PMC Member, Apache Stratos
>

Re: [GSoC 2015] Python CLI for Stratos : Weekly Update

Posted by Imesh Gunaratne <im...@apache.org>.
+1 Can you please share the Hangout link?

Thanks

On Tue, Aug 18, 2015 at 10:54 PM, Chamila De Alwis <ch...@wso2.com>
wrote:

> +1 I can attend.
>
> (On a mobile)
> Regards,
> Chamila de Alwis
> Committer and PMC Member - Apache Stratos
> Software Engineer - WSO2
> http://code.chamiladealwis.com
> On Aug 18, 2015 12:04 PM, "Milindu Sanoj Kumarage" <ag...@gmail.com>
> wrote:
>
>>  Hi, extremely sorry, the date is 19th, we are having the Hangout on Air
>> for Stratos Python CLI on 19th Au from 9:30p.m IST onward. Is this time and
>> date convenient?
>>
>> https://plus.google.com/u/0/events/c8d9682n9bris9at4ucppot9jbo
>>
>> On Tue, Aug 18, 2015 at 9:02 PM, Milindu Sanoj Kumarage <
>> agentmilindu@gmail.com> wrote:
>>
>>> Hi,
>>>
>>> We are having a Hangout on Air for Stratos Python CLI on 9:30p.m. IST :)
>>>
>>> https://plus.google.com/u/0/events/c8d9682n9bris9at4ucppot9jbo
>>>
>>>
>>>
>>>
>>> On Sun, Aug 16, 2015 at 4:14 PM, Milindu Sanoj Kumarage <
>>> agentmilindu@gmail.com> wrote:
>>>
>>>> Hi,
>>>>
>>>> I have finished the  documentation except for some few commands that I
>>>> still have issues.
>>>>
>>>>
>>>> https://docs.google.com/document/d/1GEdrOyIGF-zdwVry7t6-WYFMeEC0Y_Ki3ExyZFYCXdw/edit?usp=sharing
>>>>
>>>> I did two small demonstration videos on how to use and how to config :)
>>>>
>>>> https://www.youtube.com/playlist?list=PL2zdjxqMDj71dlnYitq59PzEoOAG21Uhq
>>>> <https://youtu.be/dzreFlxlKKM>
>>>>
>>>> I'm working on testings and those issues I mentioned earlier.
>>>>
>>>>
>>>> On Wed, Aug 12, 2015 at 12:37 AM, Milindu Sanoj Kumarage <
>>>> agentmilindu@gmail.com> wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> I want to know which commands should output that tree-like view of
>>>>> JSON data.
>>>>>
>>>>> in list-deployment-policies what 'Accessibility' means? How i should
>>>>> retrieve it from the JSON response?
>>>>>
>>>>> +---------------------+---------------+
>>>>>
>>>>> |         Id          | Accessibility |
>>>>>
>>>>> +=====================+===============+
>>>>>
>>>>> | deployment-policy-2 | 1             |
>>>>>
>>>>> | deployment-policy-1 | 1             |
>>>>>
>>>>> +---------------------+---------------+
>>>>>
>>>>> There are couple of commands that gives me errors when I send the
>>>>> request, I have to check that too.
>>>>>
>>>>> I'd do the demo as soon as I finished the document, because I want to
>>>>> know everything is working as expected :) Few more commands to go.
>>>>>
>>>>> Hi Milindu,
>>>>>
>>>>> Great work so far! Could you mention what commands and outputs are
>>>>> less clear?
>>>>>
>>>>>
>>>>> Regards,
>>>>> Chamila de Alwis
>>>>> Committer and PMC Member - Apache Stratos
>>>>> Software Engineer | WSO2 | +94772207163
>>>>> Blog: code.chamiladealwis.com
>>>>>
>>>>>
>>>>>
>>>>> On Sun, Aug 9, 2015 at 1:59 PM, Milindu Sanoj Kumarage <
>>>>> agentmilindu@gmail.com> wrote:
>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> I have finished implementing all the CLI commands, except very few
>>>>>> which I have some doubts ( like, how the output should be presented ) :)
>>>>>>
>>>>>>  I started writing a document explaining each and every command with
>>>>>> their expected outputs ( when correct params are given, when no params are
>>>>>> given and when wrong params are given ) I will continue writing the test
>>>>>> cases based on them.
>>>>>>
>>>>>> As discussed on Hangout, I will do a demo,  record it and share soon
>>>>>> :)
>>>>>>
>>>>>> On Wed, Jul 29, 2015 at 10:34 AM, Milindu Sanoj Kumarage <
>>>>>> agentmilindu@gmail.com> wrote:
>>>>>>
>>>>>>> Hi,
>>>>>>>
>>>>>>> I could finish most of the listing command and now working with the
>>>>>>> create and update commands. I'm running Java CLI to get an idea how the
>>>>>>> output should be presented. Had to fix some issues related to that "-"
>>>>>>> issue also, regarding auto-completion. I started writing test cases for
>>>>>>> utility methods, and will start writing test cases for Stratos specific
>>>>>>> ones this week. I'm using Tox to run my tests on different Python versions,
>>>>>>> 2.x ones and 3.z ones.
>>>>>>>
>>>>>>> On Thu, Jul 9, 2015 at 2:52 PM, Milindu Sanoj Kumarage <
>>>>>>> agentmilindu@gmail.com> wrote:
>>>>>>>
>>>>>>>> Hi,
>>>>>>>>
>>>>>>>> I invested last 2 week on some research on Testing frameworks and
>>>>>>>> Security Certificates. CA Bundles and  Pem files were something I had no
>>>>>>>> experience, therefor I studied on that. Studied Java security API and
>>>>>>>> Stratos's Java CLI's Certificate handling codes ( Keystores, etc ).
>>>>>>>>
>>>>>>>> *Testing frameworks*
>>>>>>>>
>>>>>>>> 1. Unittest ( docs.python.org/2/library/unittest.html ) [ PSF(
>>>>>>>> GPL-compatible ) ]
>>>>>>>>
>>>>>>>> Python's unit testing module since 2.7. Very similar to JUnit for
>>>>>>>> Java. Gives very descriptive outputs when found assertion errors.
>>>>>>>>
>>>>>>>> 2. Unittest2 ( pypi.python.org/pypi/unittest2 ) [ BSD ]
>>>>>>>>
>>>>>>>> unittest2 is a backport of the new features added to the unittest
>>>>>>>> testing framework in Python 2.7 and onwards. Supports back to Python 2.4+.
>>>>>>>>
>>>>>>>> 3. PyTest ( pytest.org/ ) [ MIT ]
>>>>>>>>
>>>>>>>> Very popular unit testing tool which is an alternative to Python’s
>>>>>>>> standard unittest module. Gives very descriptive outputs when found
>>>>>>>> assertion errors. Integrates nicely with setup.py. Python 2 and 3
>>>>>>>> compatible.
>>>>>>>>
>>>>>>>> 4. Nose ( nose.readthedocs.org/en/latest ) [ LGPL ]
>>>>>>>>
>>>>>>>> Nose extends unittest to make testing easier. Same as PyTest.
>>>>>>>> Python 2 and 3 compatible.
>>>>>>>>
>>>>>>>> 5. Tox ( tox.readthedocs.org/en/latest/ ) [ MIT ]
>>>>>>>>
>>>>>>>> Tox is a generic virtualenv management and test command line tool.
>>>>>>>> We can setup several Python virtual environments and run our tests on those
>>>>>>>> environments. This is a very useful tool to ensure the compatibility with
>>>>>>>> Python 2 and Python 3 versions. PyTest,  nose and unittest modules are
>>>>>>>> compatible with tox. Able to easily integrate with continuous integration
>>>>>>>> servers like Jenkins.
>>>>>>>>
>>>>>>>> 6. Doctest ( docs.python.org/2/library/doctest.htmlt ) [ PSF(
>>>>>>>> GPL-compatible ) ]
>>>>>>>>
>>>>>>>>  Python module that checks for interactive Python sessions in
>>>>>>>> docstrings, and then executes those sessions to verify that they work
>>>>>>>> exactly as shown.
>>>>>>>>
>>>>>>>> 7. Atheist ( arco.esi.uclm.es/~david.villa/atheist/html/  ) [ GFDL
>>>>>>>> ]
>>>>>>>>
>>>>>>>> A great tool for command line testing, it issues the commands to
>>>>>>>> the underlying shell and compares the output with the intended output. Now
>>>>>>>> discontinued but bug-maintained.
>>>>>>>>
>>>>>>>> 8. Prego ( bitbucket.org/arco_group/prego ) [ GPLv3+ ]
>>>>>>>>
>>>>>>>> Successor of Atheist, which provides support to run shell commands
>>>>>>>> on background, send signal to processes, set assertions on command stdout
>>>>>>>> or stderr, etc. Very suitable in CLI testing tasks.
>>>>>>>>
>>>>>>>> 9. ScriptTest ( pythonpaste.org/scripttest/ ) [  MIT-style
>>>>>>>> permissive license ]
>>>>>>>>
>>>>>>>> Something like Prego, but seems less features.
>>>>>>>>
>>>>>>>> 10. Behave ( jenisys.github.io/behave.example/ ) [ BSD ]
>>>>>>>>
>>>>>>>>  A BDD framework and a cucumber-clone for Python. Cucumber is a
>>>>>>>> nice way for feature testing where we define the features in simple English
>>>>>>>> and that will become the tests.
>>>>>>>>
>>>>>>>>
>>>>>>>> I definitely will be using Tox because it makes us test the Python
>>>>>>>> CLI on different Python versions. But Tox alone can not test the CLI. We
>>>>>>>> have to us some other testing framework on Tox. I'm wondering what to use
>>>>>>>> where. We can use PyTest for unit test Stratos.py which calls the Stratos
>>>>>>>> RESTAPI. But we have to test the CLI functionalities also, using some kind
>>>>>>>> of CLI testing tool. I think I need some advice here :)
>>>>>>>>
>>>>>>>> Meanwhile, I continued implementing other "list" CMD actions in
>>>>>>>> Python CLI. I see some repetition in error code handling stuffs, I'm
>>>>>>>> thinking of a way to write a general method for error handling and error
>>>>>>>> reporting.
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>


-- 
Imesh Gunaratne

Senior Technical Lead, WSO2
Committer & PMC Member, Apache Stratos

Re: [GSoC 2015] Python CLI for Stratos : Weekly Update

Posted by Milindu Sanoj Kumarage <ag...@gmail.com>.
Hi,

the Hangout for Stratos Python CLI begins on 9:30 pm IST :)



On Tue, Aug 18, 2015 at 10:54 PM, Chamila De Alwis <ch...@wso2.com>
wrote:

> +1 I can attend.
>
> (On a mobile)
> Regards,
> Chamila de Alwis
> Committer and PMC Member - Apache Stratos
> Software Engineer - WSO2
> http://code.chamiladealwis.com
> On Aug 18, 2015 12:04 PM, "Milindu Sanoj Kumarage" <ag...@gmail.com>
> wrote:
>
>>  Hi, extremely sorry, the date is 19th, we are having the Hangout on Air
>> for Stratos Python CLI on 19th Au from 9:30p.m IST onward. Is this time and
>> date convenient?
>>
>> https://plus.google.com/u/0/events/c8d9682n9bris9at4ucppot9jbo
>>
>> On Tue, Aug 18, 2015 at 9:02 PM, Milindu Sanoj Kumarage <
>> agentmilindu@gmail.com> wrote:
>>
>>> Hi,
>>>
>>> We are having a Hangout on Air for Stratos Python CLI on 9:30p.m. IST :)
>>>
>>> https://plus.google.com/u/0/events/c8d9682n9bris9at4ucppot9jbo
>>>
>>>
>>>
>>>
>>> On Sun, Aug 16, 2015 at 4:14 PM, Milindu Sanoj Kumarage <
>>> agentmilindu@gmail.com> wrote:
>>>
>>>> Hi,
>>>>
>>>> I have finished the  documentation except for some few commands that I
>>>> still have issues.
>>>>
>>>>
>>>> https://docs.google.com/document/d/1GEdrOyIGF-zdwVry7t6-WYFMeEC0Y_Ki3ExyZFYCXdw/edit?usp=sharing
>>>>
>>>> I did two small demonstration videos on how to use and how to config :)
>>>>
>>>> https://www.youtube.com/playlist?list=PL2zdjxqMDj71dlnYitq59PzEoOAG21Uhq
>>>> <https://youtu.be/dzreFlxlKKM>
>>>>
>>>> I'm working on testings and those issues I mentioned earlier.
>>>>
>>>>
>>>> On Wed, Aug 12, 2015 at 12:37 AM, Milindu Sanoj Kumarage <
>>>> agentmilindu@gmail.com> wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> I want to know which commands should output that tree-like view of
>>>>> JSON data.
>>>>>
>>>>> in list-deployment-policies what 'Accessibility' means? How i should
>>>>> retrieve it from the JSON response?
>>>>>
>>>>> +---------------------+---------------+
>>>>>
>>>>> |         Id          | Accessibility |
>>>>>
>>>>> +=====================+===============+
>>>>>
>>>>> | deployment-policy-2 | 1             |
>>>>>
>>>>> | deployment-policy-1 | 1             |
>>>>>
>>>>> +---------------------+---------------+
>>>>>
>>>>> There are couple of commands that gives me errors when I send the
>>>>> request, I have to check that too.
>>>>>
>>>>> I'd do the demo as soon as I finished the document, because I want to
>>>>> know everything is working as expected :) Few more commands to go.
>>>>>
>>>>> Hi Milindu,
>>>>>
>>>>> Great work so far! Could you mention what commands and outputs are
>>>>> less clear?
>>>>>
>>>>>
>>>>> Regards,
>>>>> Chamila de Alwis
>>>>> Committer and PMC Member - Apache Stratos
>>>>> Software Engineer | WSO2 | +94772207163
>>>>> Blog: code.chamiladealwis.com
>>>>>
>>>>>
>>>>>
>>>>> On Sun, Aug 9, 2015 at 1:59 PM, Milindu Sanoj Kumarage <
>>>>> agentmilindu@gmail.com> wrote:
>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> I have finished implementing all the CLI commands, except very few
>>>>>> which I have some doubts ( like, how the output should be presented ) :)
>>>>>>
>>>>>>  I started writing a document explaining each and every command with
>>>>>> their expected outputs ( when correct params are given, when no params are
>>>>>> given and when wrong params are given ) I will continue writing the test
>>>>>> cases based on them.
>>>>>>
>>>>>> As discussed on Hangout, I will do a demo,  record it and share soon
>>>>>> :)
>>>>>>
>>>>>> On Wed, Jul 29, 2015 at 10:34 AM, Milindu Sanoj Kumarage <
>>>>>> agentmilindu@gmail.com> wrote:
>>>>>>
>>>>>>> Hi,
>>>>>>>
>>>>>>> I could finish most of the listing command and now working with the
>>>>>>> create and update commands. I'm running Java CLI to get an idea how the
>>>>>>> output should be presented. Had to fix some issues related to that "-"
>>>>>>> issue also, regarding auto-completion. I started writing test cases for
>>>>>>> utility methods, and will start writing test cases for Stratos specific
>>>>>>> ones this week. I'm using Tox to run my tests on different Python versions,
>>>>>>> 2.x ones and 3.z ones.
>>>>>>>
>>>>>>> On Thu, Jul 9, 2015 at 2:52 PM, Milindu Sanoj Kumarage <
>>>>>>> agentmilindu@gmail.com> wrote:
>>>>>>>
>>>>>>>> Hi,
>>>>>>>>
>>>>>>>> I invested last 2 week on some research on Testing frameworks and
>>>>>>>> Security Certificates. CA Bundles and  Pem files were something I had no
>>>>>>>> experience, therefor I studied on that. Studied Java security API and
>>>>>>>> Stratos's Java CLI's Certificate handling codes ( Keystores, etc ).
>>>>>>>>
>>>>>>>> *Testing frameworks*
>>>>>>>>
>>>>>>>> 1. Unittest ( docs.python.org/2/library/unittest.html ) [ PSF(
>>>>>>>> GPL-compatible ) ]
>>>>>>>>
>>>>>>>> Python's unit testing module since 2.7. Very similar to JUnit for
>>>>>>>> Java. Gives very descriptive outputs when found assertion errors.
>>>>>>>>
>>>>>>>> 2. Unittest2 ( pypi.python.org/pypi/unittest2 ) [ BSD ]
>>>>>>>>
>>>>>>>> unittest2 is a backport of the new features added to the unittest
>>>>>>>> testing framework in Python 2.7 and onwards. Supports back to Python 2.4+.
>>>>>>>>
>>>>>>>> 3. PyTest ( pytest.org/ ) [ MIT ]
>>>>>>>>
>>>>>>>> Very popular unit testing tool which is an alternative to Python’s
>>>>>>>> standard unittest module. Gives very descriptive outputs when found
>>>>>>>> assertion errors. Integrates nicely with setup.py. Python 2 and 3
>>>>>>>> compatible.
>>>>>>>>
>>>>>>>> 4. Nose ( nose.readthedocs.org/en/latest ) [ LGPL ]
>>>>>>>>
>>>>>>>> Nose extends unittest to make testing easier. Same as PyTest.
>>>>>>>> Python 2 and 3 compatible.
>>>>>>>>
>>>>>>>> 5. Tox ( tox.readthedocs.org/en/latest/ ) [ MIT ]
>>>>>>>>
>>>>>>>> Tox is a generic virtualenv management and test command line tool.
>>>>>>>> We can setup several Python virtual environments and run our tests on those
>>>>>>>> environments. This is a very useful tool to ensure the compatibility with
>>>>>>>> Python 2 and Python 3 versions. PyTest,  nose and unittest modules are
>>>>>>>> compatible with tox. Able to easily integrate with continuous integration
>>>>>>>> servers like Jenkins.
>>>>>>>>
>>>>>>>> 6. Doctest ( docs.python.org/2/library/doctest.htmlt ) [ PSF(
>>>>>>>> GPL-compatible ) ]
>>>>>>>>
>>>>>>>>  Python module that checks for interactive Python sessions in
>>>>>>>> docstrings, and then executes those sessions to verify that they work
>>>>>>>> exactly as shown.
>>>>>>>>
>>>>>>>> 7. Atheist ( arco.esi.uclm.es/~david.villa/atheist/html/  ) [ GFDL
>>>>>>>> ]
>>>>>>>>
>>>>>>>> A great tool for command line testing, it issues the commands to
>>>>>>>> the underlying shell and compares the output with the intended output. Now
>>>>>>>> discontinued but bug-maintained.
>>>>>>>>
>>>>>>>> 8. Prego ( bitbucket.org/arco_group/prego ) [ GPLv3+ ]
>>>>>>>>
>>>>>>>> Successor of Atheist, which provides support to run shell commands
>>>>>>>> on background, send signal to processes, set assertions on command stdout
>>>>>>>> or stderr, etc. Very suitable in CLI testing tasks.
>>>>>>>>
>>>>>>>> 9. ScriptTest ( pythonpaste.org/scripttest/ ) [  MIT-style
>>>>>>>> permissive license ]
>>>>>>>>
>>>>>>>> Something like Prego, but seems less features.
>>>>>>>>
>>>>>>>> 10. Behave ( jenisys.github.io/behave.example/ ) [ BSD ]
>>>>>>>>
>>>>>>>>  A BDD framework and a cucumber-clone for Python. Cucumber is a
>>>>>>>> nice way for feature testing where we define the features in simple English
>>>>>>>> and that will become the tests.
>>>>>>>>
>>>>>>>>
>>>>>>>> I definitely will be using Tox because it makes us test the Python
>>>>>>>> CLI on different Python versions. But Tox alone can not test the CLI. We
>>>>>>>> have to us some other testing framework on Tox. I'm wondering what to use
>>>>>>>> where. We can use PyTest for unit test Stratos.py which calls the Stratos
>>>>>>>> RESTAPI. But we have to test the CLI functionalities also, using some kind
>>>>>>>> of CLI testing tool. I think I need some advice here :)
>>>>>>>>
>>>>>>>> Meanwhile, I continued implementing other "list" CMD actions in
>>>>>>>> Python CLI. I see some repetition in error code handling stuffs, I'm
>>>>>>>> thinking of a way to write a general method for error handling and error
>>>>>>>> reporting.
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>

Re: [GSoC 2015] Python CLI for Stratos : Weekly Update

Posted by Chamila De Alwis <ch...@wso2.com>.
+1 I can attend.

(On a mobile)
Regards,
Chamila de Alwis
Committer and PMC Member - Apache Stratos
Software Engineer - WSO2
http://code.chamiladealwis.com
On Aug 18, 2015 12:04 PM, "Milindu Sanoj Kumarage" <ag...@gmail.com>
wrote:

>  Hi, extremely sorry, the date is 19th, we are having the Hangout on Air
> for Stratos Python CLI on 19th Au from 9:30p.m IST onward. Is this time and
> date convenient?
>
> https://plus.google.com/u/0/events/c8d9682n9bris9at4ucppot9jbo
>
> On Tue, Aug 18, 2015 at 9:02 PM, Milindu Sanoj Kumarage <
> agentmilindu@gmail.com> wrote:
>
>> Hi,
>>
>> We are having a Hangout on Air for Stratos Python CLI on 9:30p.m. IST :)
>>
>> https://plus.google.com/u/0/events/c8d9682n9bris9at4ucppot9jbo
>>
>>
>>
>>
>> On Sun, Aug 16, 2015 at 4:14 PM, Milindu Sanoj Kumarage <
>> agentmilindu@gmail.com> wrote:
>>
>>> Hi,
>>>
>>> I have finished the  documentation except for some few commands that I
>>> still have issues.
>>>
>>>
>>> https://docs.google.com/document/d/1GEdrOyIGF-zdwVry7t6-WYFMeEC0Y_Ki3ExyZFYCXdw/edit?usp=sharing
>>>
>>> I did two small demonstration videos on how to use and how to config :)
>>>
>>> https://www.youtube.com/playlist?list=PL2zdjxqMDj71dlnYitq59PzEoOAG21Uhq
>>> <https://youtu.be/dzreFlxlKKM>
>>>
>>> I'm working on testings and those issues I mentioned earlier.
>>>
>>>
>>> On Wed, Aug 12, 2015 at 12:37 AM, Milindu Sanoj Kumarage <
>>> agentmilindu@gmail.com> wrote:
>>>
>>>> Hi,
>>>>
>>>> I want to know which commands should output that tree-like view of JSON
>>>> data.
>>>>
>>>> in list-deployment-policies what 'Accessibility' means? How i should
>>>> retrieve it from the JSON response?
>>>>
>>>> +---------------------+---------------+
>>>>
>>>> |         Id          | Accessibility |
>>>>
>>>> +=====================+===============+
>>>>
>>>> | deployment-policy-2 | 1             |
>>>>
>>>> | deployment-policy-1 | 1             |
>>>>
>>>> +---------------------+---------------+
>>>>
>>>> There are couple of commands that gives me errors when I send the
>>>> request, I have to check that too.
>>>>
>>>> I'd do the demo as soon as I finished the document, because I want to
>>>> know everything is working as expected :) Few more commands to go.
>>>>
>>>> Hi Milindu,
>>>>
>>>> Great work so far! Could you mention what commands and outputs are less
>>>> clear?
>>>>
>>>>
>>>> Regards,
>>>> Chamila de Alwis
>>>> Committer and PMC Member - Apache Stratos
>>>> Software Engineer | WSO2 | +94772207163
>>>> Blog: code.chamiladealwis.com
>>>>
>>>>
>>>>
>>>> On Sun, Aug 9, 2015 at 1:59 PM, Milindu Sanoj Kumarage <
>>>> agentmilindu@gmail.com> wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> I have finished implementing all the CLI commands, except very few
>>>>> which I have some doubts ( like, how the output should be presented ) :)
>>>>>
>>>>>  I started writing a document explaining each and every command with
>>>>> their expected outputs ( when correct params are given, when no params are
>>>>> given and when wrong params are given ) I will continue writing the test
>>>>> cases based on them.
>>>>>
>>>>> As discussed on Hangout, I will do a demo,  record it and share soon
>>>>> :)
>>>>>
>>>>> On Wed, Jul 29, 2015 at 10:34 AM, Milindu Sanoj Kumarage <
>>>>> agentmilindu@gmail.com> wrote:
>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> I could finish most of the listing command and now working with the
>>>>>> create and update commands. I'm running Java CLI to get an idea how the
>>>>>> output should be presented. Had to fix some issues related to that "-"
>>>>>> issue also, regarding auto-completion. I started writing test cases for
>>>>>> utility methods, and will start writing test cases for Stratos specific
>>>>>> ones this week. I'm using Tox to run my tests on different Python versions,
>>>>>> 2.x ones and 3.z ones.
>>>>>>
>>>>>> On Thu, Jul 9, 2015 at 2:52 PM, Milindu Sanoj Kumarage <
>>>>>> agentmilindu@gmail.com> wrote:
>>>>>>
>>>>>>> Hi,
>>>>>>>
>>>>>>> I invested last 2 week on some research on Testing frameworks and
>>>>>>> Security Certificates. CA Bundles and  Pem files were something I had no
>>>>>>> experience, therefor I studied on that. Studied Java security API and
>>>>>>> Stratos's Java CLI's Certificate handling codes ( Keystores, etc ).
>>>>>>>
>>>>>>> *Testing frameworks*
>>>>>>>
>>>>>>> 1. Unittest ( docs.python.org/2/library/unittest.html ) [ PSF(
>>>>>>> GPL-compatible ) ]
>>>>>>>
>>>>>>> Python's unit testing module since 2.7. Very similar to JUnit for
>>>>>>> Java. Gives very descriptive outputs when found assertion errors.
>>>>>>>
>>>>>>> 2. Unittest2 ( pypi.python.org/pypi/unittest2 ) [ BSD ]
>>>>>>>
>>>>>>> unittest2 is a backport of the new features added to the unittest
>>>>>>> testing framework in Python 2.7 and onwards. Supports back to Python 2.4+.
>>>>>>>
>>>>>>> 3. PyTest ( pytest.org/ ) [ MIT ]
>>>>>>>
>>>>>>> Very popular unit testing tool which is an alternative to Python’s
>>>>>>> standard unittest module. Gives very descriptive outputs when found
>>>>>>> assertion errors. Integrates nicely with setup.py. Python 2 and 3
>>>>>>> compatible.
>>>>>>>
>>>>>>> 4. Nose ( nose.readthedocs.org/en/latest ) [ LGPL ]
>>>>>>>
>>>>>>> Nose extends unittest to make testing easier. Same as PyTest.
>>>>>>> Python 2 and 3 compatible.
>>>>>>>
>>>>>>> 5. Tox ( tox.readthedocs.org/en/latest/ ) [ MIT ]
>>>>>>>
>>>>>>> Tox is a generic virtualenv management and test command line tool.
>>>>>>> We can setup several Python virtual environments and run our tests on those
>>>>>>> environments. This is a very useful tool to ensure the compatibility with
>>>>>>> Python 2 and Python 3 versions. PyTest,  nose and unittest modules are
>>>>>>> compatible with tox. Able to easily integrate with continuous integration
>>>>>>> servers like Jenkins.
>>>>>>>
>>>>>>> 6. Doctest ( docs.python.org/2/library/doctest.htmlt ) [ PSF(
>>>>>>> GPL-compatible ) ]
>>>>>>>
>>>>>>>  Python module that checks for interactive Python sessions in
>>>>>>> docstrings, and then executes those sessions to verify that they work
>>>>>>> exactly as shown.
>>>>>>>
>>>>>>> 7. Atheist ( arco.esi.uclm.es/~david.villa/atheist/html/  ) [ GFDL ]
>>>>>>>
>>>>>>> A great tool for command line testing, it issues the commands to the
>>>>>>> underlying shell and compares the output with the intended output. Now
>>>>>>> discontinued but bug-maintained.
>>>>>>>
>>>>>>> 8. Prego ( bitbucket.org/arco_group/prego ) [ GPLv3+ ]
>>>>>>>
>>>>>>> Successor of Atheist, which provides support to run shell commands
>>>>>>> on background, send signal to processes, set assertions on command stdout
>>>>>>> or stderr, etc. Very suitable in CLI testing tasks.
>>>>>>>
>>>>>>> 9. ScriptTest ( pythonpaste.org/scripttest/ ) [  MIT-style
>>>>>>> permissive license ]
>>>>>>>
>>>>>>> Something like Prego, but seems less features.
>>>>>>>
>>>>>>> 10. Behave ( jenisys.github.io/behave.example/ ) [ BSD ]
>>>>>>>
>>>>>>>  A BDD framework and a cucumber-clone for Python. Cucumber is a nice
>>>>>>> way for feature testing where we define the features in simple English and
>>>>>>> that will become the tests.
>>>>>>>
>>>>>>>
>>>>>>> I definitely will be using Tox because it makes us test the Python
>>>>>>> CLI on different Python versions. But Tox alone can not test the CLI. We
>>>>>>> have to us some other testing framework on Tox. I'm wondering what to use
>>>>>>> where. We can use PyTest for unit test Stratos.py which calls the Stratos
>>>>>>> RESTAPI. But we have to test the CLI functionalities also, using some kind
>>>>>>> of CLI testing tool. I think I need some advice here :)
>>>>>>>
>>>>>>> Meanwhile, I continued implementing other "list" CMD actions in
>>>>>>> Python CLI. I see some repetition in error code handling stuffs, I'm
>>>>>>> thinking of a way to write a general method for error handling and error
>>>>>>> reporting.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>
>

Re: [GSoC 2015] Python CLI for Stratos : Weekly Update

Posted by Milindu Sanoj Kumarage <ag...@gmail.com>.
 Hi, extremely sorry, the date is 19th, we are having the Hangout on Air
for Stratos Python CLI on 19th Au from 9:30p.m IST onward. Is this time and
date convenient?

https://plus.google.com/u/0/events/c8d9682n9bris9at4ucppot9jbo

On Tue, Aug 18, 2015 at 9:02 PM, Milindu Sanoj Kumarage <
agentmilindu@gmail.com> wrote:

> Hi,
>
> We are having a Hangout on Air for Stratos Python CLI on 9:30p.m. IST :)
>
> https://plus.google.com/u/0/events/c8d9682n9bris9at4ucppot9jbo
>
>
>
>
> On Sun, Aug 16, 2015 at 4:14 PM, Milindu Sanoj Kumarage <
> agentmilindu@gmail.com> wrote:
>
>> Hi,
>>
>> I have finished the  documentation except for some few commands that I
>> still have issues.
>>
>>
>> https://docs.google.com/document/d/1GEdrOyIGF-zdwVry7t6-WYFMeEC0Y_Ki3ExyZFYCXdw/edit?usp=sharing
>>
>> I did two small demonstration videos on how to use and how to config :)
>>
>> https://www.youtube.com/playlist?list=PL2zdjxqMDj71dlnYitq59PzEoOAG21Uhq
>> <https://youtu.be/dzreFlxlKKM>
>>
>> I'm working on testings and those issues I mentioned earlier.
>>
>>
>> On Wed, Aug 12, 2015 at 12:37 AM, Milindu Sanoj Kumarage <
>> agentmilindu@gmail.com> wrote:
>>
>>> Hi,
>>>
>>> I want to know which commands should output that tree-like view of JSON
>>> data.
>>>
>>> in list-deployment-policies what 'Accessibility' means? How i should
>>> retrieve it from the JSON response?
>>>
>>> +---------------------+---------------+
>>>
>>> |         Id          | Accessibility |
>>>
>>> +=====================+===============+
>>>
>>> | deployment-policy-2 | 1             |
>>>
>>> | deployment-policy-1 | 1             |
>>>
>>> +---------------------+---------------+
>>>
>>> There are couple of commands that gives me errors when I send the
>>> request, I have to check that too.
>>>
>>> I'd do the demo as soon as I finished the document, because I want to
>>> know everything is working as expected :) Few more commands to go.
>>>
>>> Hi Milindu,
>>>
>>> Great work so far! Could you mention what commands and outputs are less
>>> clear?
>>>
>>>
>>> Regards,
>>> Chamila de Alwis
>>> Committer and PMC Member - Apache Stratos
>>> Software Engineer | WSO2 | +94772207163
>>> Blog: code.chamiladealwis.com
>>>
>>>
>>>
>>> On Sun, Aug 9, 2015 at 1:59 PM, Milindu Sanoj Kumarage <
>>> agentmilindu@gmail.com> wrote:
>>>
>>>> Hi,
>>>>
>>>> I have finished implementing all the CLI commands, except very few
>>>> which I have some doubts ( like, how the output should be presented ) :)
>>>>
>>>>  I started writing a document explaining each and every command with
>>>> their expected outputs ( when correct params are given, when no params are
>>>> given and when wrong params are given ) I will continue writing the test
>>>> cases based on them.
>>>>
>>>> As discussed on Hangout, I will do a demo,  record it and share soon :)
>>>>
>>>> On Wed, Jul 29, 2015 at 10:34 AM, Milindu Sanoj Kumarage <
>>>> agentmilindu@gmail.com> wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> I could finish most of the listing command and now working with the
>>>>> create and update commands. I'm running Java CLI to get an idea how the
>>>>> output should be presented. Had to fix some issues related to that "-"
>>>>> issue also, regarding auto-completion. I started writing test cases for
>>>>> utility methods, and will start writing test cases for Stratos specific
>>>>> ones this week. I'm using Tox to run my tests on different Python versions,
>>>>> 2.x ones and 3.z ones.
>>>>>
>>>>> On Thu, Jul 9, 2015 at 2:52 PM, Milindu Sanoj Kumarage <
>>>>> agentmilindu@gmail.com> wrote:
>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> I invested last 2 week on some research on Testing frameworks and
>>>>>> Security Certificates. CA Bundles and  Pem files were something I had no
>>>>>> experience, therefor I studied on that. Studied Java security API and
>>>>>> Stratos's Java CLI's Certificate handling codes ( Keystores, etc ).
>>>>>>
>>>>>> *Testing frameworks*
>>>>>>
>>>>>> 1. Unittest ( docs.python.org/2/library/unittest.html ) [ PSF(
>>>>>> GPL-compatible ) ]
>>>>>>
>>>>>> Python's unit testing module since 2.7. Very similar to JUnit for
>>>>>> Java. Gives very descriptive outputs when found assertion errors.
>>>>>>
>>>>>> 2. Unittest2 ( pypi.python.org/pypi/unittest2 ) [ BSD ]
>>>>>>
>>>>>> unittest2 is a backport of the new features added to the unittest
>>>>>> testing framework in Python 2.7 and onwards. Supports back to Python 2.4+.
>>>>>>
>>>>>> 3. PyTest ( pytest.org/ ) [ MIT ]
>>>>>>
>>>>>> Very popular unit testing tool which is an alternative to Python’s
>>>>>> standard unittest module. Gives very descriptive outputs when found
>>>>>> assertion errors. Integrates nicely with setup.py. Python 2 and 3
>>>>>> compatible.
>>>>>>
>>>>>> 4. Nose ( nose.readthedocs.org/en/latest ) [ LGPL ]
>>>>>>
>>>>>> Nose extends unittest to make testing easier. Same as PyTest.
>>>>>> Python 2 and 3 compatible.
>>>>>>
>>>>>> 5. Tox ( tox.readthedocs.org/en/latest/ ) [ MIT ]
>>>>>>
>>>>>> Tox is a generic virtualenv management and test command line tool. We
>>>>>> can setup several Python virtual environments and run our tests on those
>>>>>> environments. This is a very useful tool to ensure the compatibility with
>>>>>> Python 2 and Python 3 versions. PyTest,  nose and unittest modules are
>>>>>> compatible with tox. Able to easily integrate with continuous integration
>>>>>> servers like Jenkins.
>>>>>>
>>>>>> 6. Doctest ( docs.python.org/2/library/doctest.htmlt ) [ PSF(
>>>>>> GPL-compatible ) ]
>>>>>>
>>>>>>  Python module that checks for interactive Python sessions in
>>>>>> docstrings, and then executes those sessions to verify that they work
>>>>>> exactly as shown.
>>>>>>
>>>>>> 7. Atheist ( arco.esi.uclm.es/~david.villa/atheist/html/  ) [ GFDL ]
>>>>>>
>>>>>> A great tool for command line testing, it issues the commands to the
>>>>>> underlying shell and compares the output with the intended output. Now
>>>>>> discontinued but bug-maintained.
>>>>>>
>>>>>> 8. Prego ( bitbucket.org/arco_group/prego ) [ GPLv3+ ]
>>>>>>
>>>>>> Successor of Atheist, which provides support to run shell commands on
>>>>>> background, send signal to processes, set assertions on command stdout or
>>>>>> stderr, etc. Very suitable in CLI testing tasks.
>>>>>>
>>>>>> 9. ScriptTest ( pythonpaste.org/scripttest/ ) [  MIT-style
>>>>>> permissive license ]
>>>>>>
>>>>>> Something like Prego, but seems less features.
>>>>>>
>>>>>> 10. Behave ( jenisys.github.io/behave.example/ ) [ BSD ]
>>>>>>
>>>>>>  A BDD framework and a cucumber-clone for Python. Cucumber is a nice
>>>>>> way for feature testing where we define the features in simple English and
>>>>>> that will become the tests.
>>>>>>
>>>>>>
>>>>>> I definitely will be using Tox because it makes us test the Python
>>>>>> CLI on different Python versions. But Tox alone can not test the CLI. We
>>>>>> have to us some other testing framework on Tox. I'm wondering what to use
>>>>>> where. We can use PyTest for unit test Stratos.py which calls the Stratos
>>>>>> RESTAPI. But we have to test the CLI functionalities also, using some kind
>>>>>> of CLI testing tool. I think I need some advice here :)
>>>>>>
>>>>>> Meanwhile, I continued implementing other "list" CMD actions in
>>>>>> Python CLI. I see some repetition in error code handling stuffs, I'm
>>>>>> thinking of a way to write a general method for error handling and error
>>>>>> reporting.
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>
>

Re: [GSoC 2015] Python CLI for Stratos : Weekly Update

Posted by Milindu Sanoj Kumarage <ag...@gmail.com>.
Hi,

We are having a Hangout on Air for Stratos Python CLI on 9:30p.m. IST :)

https://plus.google.com/u/0/events/c8d9682n9bris9at4ucppot9jbo




On Sun, Aug 16, 2015 at 4:14 PM, Milindu Sanoj Kumarage <
agentmilindu@gmail.com> wrote:

> Hi,
>
> I have finished the  documentation except for some few commands that I
> still have issues.
>
>
> https://docs.google.com/document/d/1GEdrOyIGF-zdwVry7t6-WYFMeEC0Y_Ki3ExyZFYCXdw/edit?usp=sharing
>
> I did two small demonstration videos on how to use and how to config :)
>
> https://www.youtube.com/playlist?list=PL2zdjxqMDj71dlnYitq59PzEoOAG21Uhq
> <https://youtu.be/dzreFlxlKKM>
>
> I'm working on testings and those issues I mentioned earlier.
>
>
> On Wed, Aug 12, 2015 at 12:37 AM, Milindu Sanoj Kumarage <
> agentmilindu@gmail.com> wrote:
>
>> Hi,
>>
>> I want to know which commands should output that tree-like view of JSON
>> data.
>>
>> in list-deployment-policies what 'Accessibility' means? How i should
>> retrieve it from the JSON response?
>>
>> +---------------------+---------------+
>>
>> |         Id          | Accessibility |
>>
>> +=====================+===============+
>>
>> | deployment-policy-2 | 1             |
>>
>> | deployment-policy-1 | 1             |
>>
>> +---------------------+---------------+
>>
>> There are couple of commands that gives me errors when I send the
>> request, I have to check that too.
>>
>> I'd do the demo as soon as I finished the document, because I want to
>> know everything is working as expected :) Few more commands to go.
>>
>> Hi Milindu,
>>
>> Great work so far! Could you mention what commands and outputs are less
>> clear?
>>
>>
>> Regards,
>> Chamila de Alwis
>> Committer and PMC Member - Apache Stratos
>> Software Engineer | WSO2 | +94772207163
>> Blog: code.chamiladealwis.com
>>
>>
>>
>> On Sun, Aug 9, 2015 at 1:59 PM, Milindu Sanoj Kumarage <
>> agentmilindu@gmail.com> wrote:
>>
>>> Hi,
>>>
>>> I have finished implementing all the CLI commands, except very few which
>>> I have some doubts ( like, how the output should be presented ) :)
>>>
>>>  I started writing a document explaining each and every command with
>>> their expected outputs ( when correct params are given, when no params are
>>> given and when wrong params are given ) I will continue writing the test
>>> cases based on them.
>>>
>>> As discussed on Hangout, I will do a demo,  record it and share soon :)
>>>
>>> On Wed, Jul 29, 2015 at 10:34 AM, Milindu Sanoj Kumarage <
>>> agentmilindu@gmail.com> wrote:
>>>
>>>> Hi,
>>>>
>>>> I could finish most of the listing command and now working with the
>>>> create and update commands. I'm running Java CLI to get an idea how the
>>>> output should be presented. Had to fix some issues related to that "-"
>>>> issue also, regarding auto-completion. I started writing test cases for
>>>> utility methods, and will start writing test cases for Stratos specific
>>>> ones this week. I'm using Tox to run my tests on different Python versions,
>>>> 2.x ones and 3.z ones.
>>>>
>>>> On Thu, Jul 9, 2015 at 2:52 PM, Milindu Sanoj Kumarage <
>>>> agentmilindu@gmail.com> wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> I invested last 2 week on some research on Testing frameworks and
>>>>> Security Certificates. CA Bundles and  Pem files were something I had no
>>>>> experience, therefor I studied on that. Studied Java security API and
>>>>> Stratos's Java CLI's Certificate handling codes ( Keystores, etc ).
>>>>>
>>>>> *Testing frameworks*
>>>>>
>>>>> 1. Unittest ( docs.python.org/2/library/unittest.html ) [ PSF(
>>>>> GPL-compatible ) ]
>>>>>
>>>>> Python's unit testing module since 2.7. Very similar to JUnit for
>>>>> Java. Gives very descriptive outputs when found assertion errors.
>>>>>
>>>>> 2. Unittest2 ( pypi.python.org/pypi/unittest2 ) [ BSD ]
>>>>>
>>>>> unittest2 is a backport of the new features added to the unittest
>>>>> testing framework in Python 2.7 and onwards. Supports back to Python 2.4+.
>>>>>
>>>>> 3. PyTest ( pytest.org/ ) [ MIT ]
>>>>>
>>>>> Very popular unit testing tool which is an alternative to Python’s
>>>>> standard unittest module. Gives very descriptive outputs when found
>>>>> assertion errors. Integrates nicely with setup.py. Python 2 and 3
>>>>> compatible.
>>>>>
>>>>> 4. Nose ( nose.readthedocs.org/en/latest ) [ LGPL ]
>>>>>
>>>>> Nose extends unittest to make testing easier. Same as PyTest.
>>>>> Python 2 and 3 compatible.
>>>>>
>>>>> 5. Tox ( tox.readthedocs.org/en/latest/ ) [ MIT ]
>>>>>
>>>>> Tox is a generic virtualenv management and test command line tool. We
>>>>> can setup several Python virtual environments and run our tests on those
>>>>> environments. This is a very useful tool to ensure the compatibility with
>>>>> Python 2 and Python 3 versions. PyTest,  nose and unittest modules are
>>>>> compatible with tox. Able to easily integrate with continuous integration
>>>>> servers like Jenkins.
>>>>>
>>>>> 6. Doctest ( docs.python.org/2/library/doctest.htmlt ) [ PSF(
>>>>> GPL-compatible ) ]
>>>>>
>>>>>  Python module that checks for interactive Python sessions in
>>>>> docstrings, and then executes those sessions to verify that they work
>>>>> exactly as shown.
>>>>>
>>>>> 7. Atheist ( arco.esi.uclm.es/~david.villa/atheist/html/  ) [ GFDL ]
>>>>>
>>>>> A great tool for command line testing, it issues the commands to the
>>>>> underlying shell and compares the output with the intended output. Now
>>>>> discontinued but bug-maintained.
>>>>>
>>>>> 8. Prego ( bitbucket.org/arco_group/prego ) [ GPLv3+ ]
>>>>>
>>>>> Successor of Atheist, which provides support to run shell commands on
>>>>> background, send signal to processes, set assertions on command stdout or
>>>>> stderr, etc. Very suitable in CLI testing tasks.
>>>>>
>>>>> 9. ScriptTest ( pythonpaste.org/scripttest/ ) [  MIT-style permissive
>>>>> license ]
>>>>>
>>>>> Something like Prego, but seems less features.
>>>>>
>>>>> 10. Behave ( jenisys.github.io/behave.example/ ) [ BSD ]
>>>>>
>>>>>  A BDD framework and a cucumber-clone for Python. Cucumber is a nice
>>>>> way for feature testing where we define the features in simple English and
>>>>> that will become the tests.
>>>>>
>>>>>
>>>>> I definitely will be using Tox because it makes us test the Python CLI
>>>>> on different Python versions. But Tox alone can not test the CLI. We have
>>>>> to us some other testing framework on Tox. I'm wondering what to use where.
>>>>> We can use PyTest for unit test Stratos.py which calls the Stratos RESTAPI.
>>>>> But we have to test the CLI functionalities also, using some kind of CLI
>>>>> testing tool. I think I need some advice here :)
>>>>>
>>>>> Meanwhile, I continued implementing other "list" CMD actions in Python
>>>>> CLI. I see some repetition in error code handling stuffs, I'm thinking of a
>>>>> way to write a general method for error handling and error reporting.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>
>>
>

Re: [GSoC 2015] Python CLI for Stratos : Weekly Update

Posted by Milindu Sanoj Kumarage <ag...@gmail.com>.
Hi,

I have finished the  documentation except for some few commands that I
still have issues.

https://docs.google.com/document/d/1GEdrOyIGF-zdwVry7t6-WYFMeEC0Y_Ki3ExyZFYCXdw/edit?usp=sharing

I did two small demonstration videos on how to use and how to config :)

https://www.youtube.com/playlist?list=PL2zdjxqMDj71dlnYitq59PzEoOAG21Uhq
<https://youtu.be/dzreFlxlKKM>

I'm working on testings and those issues I mentioned earlier.


On Wed, Aug 12, 2015 at 12:37 AM, Milindu Sanoj Kumarage <
agentmilindu@gmail.com> wrote:

> Hi,
>
> I want to know which commands should output that tree-like view of JSON
> data.
>
> in list-deployment-policies what 'Accessibility' means? How i should
> retrieve it from the JSON response?
>
> +---------------------+---------------+
>
> |         Id          | Accessibility |
>
> +=====================+===============+
>
> | deployment-policy-2 | 1             |
>
> | deployment-policy-1 | 1             |
>
> +---------------------+---------------+
>
> There are couple of commands that gives me errors when I send the request,
> I have to check that too.
>
> I'd do the demo as soon as I finished the document, because I want to know
> everything is working as expected :) Few more commands to go.
>
> Hi Milindu,
>
> Great work so far! Could you mention what commands and outputs are less
> clear?
>
>
> Regards,
> Chamila de Alwis
> Committer and PMC Member - Apache Stratos
> Software Engineer | WSO2 | +94772207163
> Blog: code.chamiladealwis.com
>
>
>
> On Sun, Aug 9, 2015 at 1:59 PM, Milindu Sanoj Kumarage <
> agentmilindu@gmail.com> wrote:
>
>> Hi,
>>
>> I have finished implementing all the CLI commands, except very few which
>> I have some doubts ( like, how the output should be presented ) :)
>>
>>  I started writing a document explaining each and every command with
>> their expected outputs ( when correct params are given, when no params are
>> given and when wrong params are given ) I will continue writing the test
>> cases based on them.
>>
>> As discussed on Hangout, I will do a demo,  record it and share soon :)
>>
>> On Wed, Jul 29, 2015 at 10:34 AM, Milindu Sanoj Kumarage <
>> agentmilindu@gmail.com> wrote:
>>
>>> Hi,
>>>
>>> I could finish most of the listing command and now working with the
>>> create and update commands. I'm running Java CLI to get an idea how the
>>> output should be presented. Had to fix some issues related to that "-"
>>> issue also, regarding auto-completion. I started writing test cases for
>>> utility methods, and will start writing test cases for Stratos specific
>>> ones this week. I'm using Tox to run my tests on different Python versions,
>>> 2.x ones and 3.z ones.
>>>
>>> On Thu, Jul 9, 2015 at 2:52 PM, Milindu Sanoj Kumarage <
>>> agentmilindu@gmail.com> wrote:
>>>
>>>> Hi,
>>>>
>>>> I invested last 2 week on some research on Testing frameworks and
>>>> Security Certificates. CA Bundles and  Pem files were something I had no
>>>> experience, therefor I studied on that. Studied Java security API and
>>>> Stratos's Java CLI's Certificate handling codes ( Keystores, etc ).
>>>>
>>>> *Testing frameworks*
>>>>
>>>> 1. Unittest ( docs.python.org/2/library/unittest.html ) [ PSF(
>>>> GPL-compatible ) ]
>>>>
>>>> Python's unit testing module since 2.7. Very similar to JUnit for
>>>> Java. Gives very descriptive outputs when found assertion errors.
>>>>
>>>> 2. Unittest2 ( pypi.python.org/pypi/unittest2 ) [ BSD ]
>>>>
>>>> unittest2 is a backport of the new features added to the unittest
>>>> testing framework in Python 2.7 and onwards. Supports back to Python 2.4+.
>>>>
>>>> 3. PyTest ( pytest.org/ ) [ MIT ]
>>>>
>>>> Very popular unit testing tool which is an alternative to Python’s
>>>> standard unittest module. Gives very descriptive outputs when found
>>>> assertion errors. Integrates nicely with setup.py. Python 2 and 3
>>>> compatible.
>>>>
>>>> 4. Nose ( nose.readthedocs.org/en/latest ) [ LGPL ]
>>>>
>>>> Nose extends unittest to make testing easier. Same as PyTest.
>>>> Python 2 and 3 compatible.
>>>>
>>>> 5. Tox ( tox.readthedocs.org/en/latest/ ) [ MIT ]
>>>>
>>>> Tox is a generic virtualenv management and test command line tool. We
>>>> can setup several Python virtual environments and run our tests on those
>>>> environments. This is a very useful tool to ensure the compatibility with
>>>> Python 2 and Python 3 versions. PyTest,  nose and unittest modules are
>>>> compatible with tox. Able to easily integrate with continuous integration
>>>> servers like Jenkins.
>>>>
>>>> 6. Doctest ( docs.python.org/2/library/doctest.htmlt ) [ PSF(
>>>> GPL-compatible ) ]
>>>>
>>>>  Python module that checks for interactive Python sessions in
>>>> docstrings, and then executes those sessions to verify that they work
>>>> exactly as shown.
>>>>
>>>> 7. Atheist ( arco.esi.uclm.es/~david.villa/atheist/html/  ) [ GFDL ]
>>>>
>>>> A great tool for command line testing, it issues the commands to the
>>>> underlying shell and compares the output with the intended output. Now
>>>> discontinued but bug-maintained.
>>>>
>>>> 8. Prego ( bitbucket.org/arco_group/prego ) [ GPLv3+ ]
>>>>
>>>> Successor of Atheist, which provides support to run shell commands on
>>>> background, send signal to processes, set assertions on command stdout or
>>>> stderr, etc. Very suitable in CLI testing tasks.
>>>>
>>>> 9. ScriptTest ( pythonpaste.org/scripttest/ ) [  MIT-style permissive
>>>> license ]
>>>>
>>>> Something like Prego, but seems less features.
>>>>
>>>> 10. Behave ( jenisys.github.io/behave.example/ ) [ BSD ]
>>>>
>>>>  A BDD framework and a cucumber-clone for Python. Cucumber is a nice
>>>> way for feature testing where we define the features in simple English and
>>>> that will become the tests.
>>>>
>>>>
>>>> I definitely will be using Tox because it makes us test the Python CLI
>>>> on different Python versions. But Tox alone can not test the CLI. We have
>>>> to us some other testing framework on Tox. I'm wondering what to use where.
>>>> We can use PyTest for unit test Stratos.py which calls the Stratos RESTAPI.
>>>> But we have to test the CLI functionalities also, using some kind of CLI
>>>> testing tool. I think I need some advice here :)
>>>>
>>>> Meanwhile, I continued implementing other "list" CMD actions in Python
>>>> CLI. I see some repetition in error code handling stuffs, I'm thinking of a
>>>> way to write a general method for error handling and error reporting.
>>>>
>>>>
>>>>
>>>>
>>>>
>>>
>>
>

Re: [GSoC 2015] Python CLI for Stratos : Weekly Update

Posted by Milindu Sanoj Kumarage <ag...@gmail.com>.
Hi,

I want to know which commands should output that tree-like view of JSON
data.

in list-deployment-policies what 'Accessibility' means? How i should
retrieve it from the JSON response?

+---------------------+---------------+

|         Id          | Accessibility |

+=====================+===============+

| deployment-policy-2 | 1             |

| deployment-policy-1 | 1             |

+---------------------+---------------+

There are couple of commands that gives me errors when I send the request,
I have to check that too.

I'd do the demo as soon as I finished the document, because I want to know
everything is working as expected :) Few more commands to go.

Hi Milindu,

Great work so far! Could you mention what commands and outputs are less
clear?


Regards,
Chamila de Alwis
Committer and PMC Member - Apache Stratos
Software Engineer | WSO2 | +94772207163
Blog: code.chamiladealwis.com



On Sun, Aug 9, 2015 at 1:59 PM, Milindu Sanoj Kumarage <
agentmilindu@gmail.com> wrote:

> Hi,
>
> I have finished implementing all the CLI commands, except very few which I
> have some doubts ( like, how the output should be presented ) :)
>
>  I started writing a document explaining each and every command with their
> expected outputs ( when correct params are given, when no params are given
> and when wrong params are given ) I will continue writing the test cases
> based on them.
>
> As discussed on Hangout, I will do a demo,  record it and share soon :)
>
> On Wed, Jul 29, 2015 at 10:34 AM, Milindu Sanoj Kumarage <
> agentmilindu@gmail.com> wrote:
>
>> Hi,
>>
>> I could finish most of the listing command and now working with the
>> create and update commands. I'm running Java CLI to get an idea how the
>> output should be presented. Had to fix some issues related to that "-"
>> issue also, regarding auto-completion. I started writing test cases for
>> utility methods, and will start writing test cases for Stratos specific
>> ones this week. I'm using Tox to run my tests on different Python versions,
>> 2.x ones and 3.z ones.
>>
>> On Thu, Jul 9, 2015 at 2:52 PM, Milindu Sanoj Kumarage <
>> agentmilindu@gmail.com> wrote:
>>
>>> Hi,
>>>
>>> I invested last 2 week on some research on Testing frameworks and
>>> Security Certificates. CA Bundles and  Pem files were something I had no
>>> experience, therefor I studied on that. Studied Java security API and
>>> Stratos's Java CLI's Certificate handling codes ( Keystores, etc ).
>>>
>>> *Testing frameworks*
>>>
>>> 1. Unittest ( docs.python.org/2/library/unittest.html ) [ PSF(
>>> GPL-compatible ) ]
>>>
>>> Python's unit testing module since 2.7. Very similar to JUnit for
>>> Java. Gives very descriptive outputs when found assertion errors.
>>>
>>> 2. Unittest2 ( pypi.python.org/pypi/unittest2 ) [ BSD ]
>>>
>>> unittest2 is a backport of the new features added to the unittest
>>> testing framework in Python 2.7 and onwards. Supports back to Python 2.4+.
>>>
>>> 3. PyTest ( pytest.org/ ) [ MIT ]
>>>
>>> Very popular unit testing tool which is an alternative to Python’s
>>> standard unittest module. Gives very descriptive outputs when found
>>> assertion errors. Integrates nicely with setup.py. Python 2 and 3
>>> compatible.
>>>
>>> 4. Nose ( nose.readthedocs.org/en/latest ) [ LGPL ]
>>>
>>> Nose extends unittest to make testing easier. Same as PyTest.
>>> Python 2 and 3 compatible.
>>>
>>> 5. Tox ( tox.readthedocs.org/en/latest/ ) [ MIT ]
>>>
>>> Tox is a generic virtualenv management and test command line tool. We
>>> can setup several Python virtual environments and run our tests on those
>>> environments. This is a very useful tool to ensure the compatibility with
>>> Python 2 and Python 3 versions. PyTest,  nose and unittest modules are
>>> compatible with tox. Able to easily integrate with continuous integration
>>> servers like Jenkins.
>>>
>>> 6. Doctest ( docs.python.org/2/library/doctest.htmlt ) [ PSF(
>>> GPL-compatible ) ]
>>>
>>>  Python module that checks for interactive Python sessions in
>>> docstrings, and then executes those sessions to verify that they work
>>> exactly as shown.
>>>
>>> 7. Atheist ( arco.esi.uclm.es/~david.villa/atheist/html/  ) [ GFDL ]
>>>
>>> A great tool for command line testing, it issues the commands to the
>>> underlying shell and compares the output with the intended output. Now
>>> discontinued but bug-maintained.
>>>
>>> 8. Prego ( bitbucket.org/arco_group/prego ) [ GPLv3+ ]
>>>
>>> Successor of Atheist, which provides support to run shell commands on
>>> background, send signal to processes, set assertions on command stdout or
>>> stderr, etc. Very suitable in CLI testing tasks.
>>>
>>> 9. ScriptTest ( pythonpaste.org/scripttest/ ) [  MIT-style permissive
>>> license ]
>>>
>>> Something like Prego, but seems less features.
>>>
>>> 10. Behave ( jenisys.github.io/behave.example/ ) [ BSD ]
>>>
>>>  A BDD framework and a cucumber-clone for Python. Cucumber is a nice way
>>> for feature testing where we define the features in simple English and that
>>> will become the tests.
>>>
>>>
>>> I definitely will be using Tox because it makes us test the Python CLI
>>> on different Python versions. But Tox alone can not test the CLI. We have
>>> to us some other testing framework on Tox. I'm wondering what to use where.
>>> We can use PyTest for unit test Stratos.py which calls the Stratos RESTAPI.
>>> But we have to test the CLI functionalities also, using some kind of CLI
>>> testing tool. I think I need some advice here :)
>>>
>>> Meanwhile, I continued implementing other "list" CMD actions in Python
>>> CLI. I see some repetition in error code handling stuffs, I'm thinking of a
>>> way to write a general method for error handling and error reporting.
>>>
>>>
>>>
>>>
>>>
>>
>

Re: [GSoC 2015] Python CLI for Stratos : Weekly Update

Posted by Imesh Gunaratne <im...@apache.org>.
Hi Milindu,

Great! Please arrange a public Google Hangout and do a demo. We will also
need to do a code review.

Thanks

On Mon, Aug 10, 2015 at 12:14 AM, Chamila De Alwis <ch...@wso2.com>
wrote:

> Hi Milindu,
>
> Great work so far! Could you mention what commands and outputs are less
> clear?
>
>
> Regards,
> Chamila de Alwis
> Committer and PMC Member - Apache Stratos
> Software Engineer | WSO2 | +94772207163
> Blog: code.chamiladealwis.com
>
>
>
> On Sun, Aug 9, 2015 at 1:59 PM, Milindu Sanoj Kumarage <
> agentmilindu@gmail.com> wrote:
>
>> Hi,
>>
>> I have finished implementing all the CLI commands, except very few which
>> I have some doubts ( like, how the output should be presented ) :)
>>
>>  I started writing a document explaining each and every command with
>> their expected outputs ( when correct params are given, when no params are
>> given and when wrong params are given ) I will continue writing the test
>> cases based on them.
>>
>> As discussed on Hangout, I will do a demo,  record it and share soon :)
>>
>> On Wed, Jul 29, 2015 at 10:34 AM, Milindu Sanoj Kumarage <
>> agentmilindu@gmail.com> wrote:
>>
>>> Hi,
>>>
>>> I could finish most of the listing command and now working with the
>>> create and update commands. I'm running Java CLI to get an idea how the
>>> output should be presented. Had to fix some issues related to that "-"
>>> issue also, regarding auto-completion. I started writing test cases for
>>> utility methods, and will start writing test cases for Stratos specific
>>> ones this week. I'm using Tox to run my tests on different Python versions,
>>> 2.x ones and 3.z ones.
>>>
>>> On Thu, Jul 9, 2015 at 2:52 PM, Milindu Sanoj Kumarage <
>>> agentmilindu@gmail.com> wrote:
>>>
>>>> Hi,
>>>>
>>>> I invested last 2 week on some research on Testing frameworks and
>>>> Security Certificates. CA Bundles and  Pem files were something I had no
>>>> experience, therefor I studied on that. Studied Java security API and
>>>> Stratos's Java CLI's Certificate handling codes ( Keystores, etc ).
>>>>
>>>> *Testing frameworks*
>>>>
>>>> 1. Unittest ( docs.python.org/2/library/unittest.html ) [ PSF(
>>>> GPL-compatible ) ]
>>>>
>>>> Python's unit testing module since 2.7. Very similar to JUnit for
>>>> Java. Gives very descriptive outputs when found assertion errors.
>>>>
>>>> 2. Unittest2 ( pypi.python.org/pypi/unittest2 ) [ BSD ]
>>>>
>>>> unittest2 is a backport of the new features added to the unittest
>>>> testing framework in Python 2.7 and onwards. Supports back to Python 2.4+.
>>>>
>>>> 3. PyTest ( pytest.org/ ) [ MIT ]
>>>>
>>>> Very popular unit testing tool which is an alternative to Python’s
>>>> standard unittest module. Gives very descriptive outputs when found
>>>> assertion errors. Integrates nicely with setup.py. Python 2 and 3
>>>> compatible.
>>>>
>>>> 4. Nose ( nose.readthedocs.org/en/latest ) [ LGPL ]
>>>>
>>>> Nose extends unittest to make testing easier. Same as PyTest.
>>>> Python 2 and 3 compatible.
>>>>
>>>> 5. Tox ( tox.readthedocs.org/en/latest/ ) [ MIT ]
>>>>
>>>> Tox is a generic virtualenv management and test command line tool. We
>>>> can setup several Python virtual environments and run our tests on those
>>>> environments. This is a very useful tool to ensure the compatibility with
>>>> Python 2 and Python 3 versions. PyTest,  nose and unittest modules are
>>>> compatible with tox. Able to easily integrate with continuous integration
>>>> servers like Jenkins.
>>>>
>>>> 6. Doctest ( docs.python.org/2/library/doctest.htmlt ) [ PSF(
>>>> GPL-compatible ) ]
>>>>
>>>>  Python module that checks for interactive Python sessions in
>>>> docstrings, and then executes those sessions to verify that they work
>>>> exactly as shown.
>>>>
>>>> 7. Atheist ( arco.esi.uclm.es/~david.villa/atheist/html/  ) [ GFDL ]
>>>>
>>>> A great tool for command line testing, it issues the commands to the
>>>> underlying shell and compares the output with the intended output. Now
>>>> discontinued but bug-maintained.
>>>>
>>>> 8. Prego ( bitbucket.org/arco_group/prego ) [ GPLv3+ ]
>>>>
>>>> Successor of Atheist, which provides support to run shell commands on
>>>> background, send signal to processes, set assertions on command stdout or
>>>> stderr, etc. Very suitable in CLI testing tasks.
>>>>
>>>> 9. ScriptTest ( pythonpaste.org/scripttest/ ) [  MIT-style permissive
>>>> license ]
>>>>
>>>> Something like Prego, but seems less features.
>>>>
>>>> 10. Behave ( jenisys.github.io/behave.example/ ) [ BSD ]
>>>>
>>>>  A BDD framework and a cucumber-clone for Python. Cucumber is a nice
>>>> way for feature testing where we define the features in simple English and
>>>> that will become the tests.
>>>>
>>>>
>>>> I definitely will be using Tox because it makes us test the Python CLI
>>>> on different Python versions. But Tox alone can not test the CLI. We have
>>>> to us some other testing framework on Tox. I'm wondering what to use where.
>>>> We can use PyTest for unit test Stratos.py which calls the Stratos RESTAPI.
>>>> But we have to test the CLI functionalities also, using some kind of CLI
>>>> testing tool. I think I need some advice here :)
>>>>
>>>> Meanwhile, I continued implementing other "list" CMD actions in Python
>>>> CLI. I see some repetition in error code handling stuffs, I'm thinking of a
>>>> way to write a general method for error handling and error reporting.
>>>>
>>>>
>>>>
>>>>
>>>>
>>>
>>
>


-- 
Imesh Gunaratne

Senior Technical Lead, WSO2
Committer & PMC Member, Apache Stratos

Re: [GSoC 2015] Python CLI for Stratos : Weekly Update

Posted by Chamila De Alwis <ch...@wso2.com>.
Hi Milindu,

Great work so far! Could you mention what commands and outputs are less
clear?


Regards,
Chamila de Alwis
Committer and PMC Member - Apache Stratos
Software Engineer | WSO2 | +94772207163
Blog: code.chamiladealwis.com



On Sun, Aug 9, 2015 at 1:59 PM, Milindu Sanoj Kumarage <
agentmilindu@gmail.com> wrote:

> Hi,
>
> I have finished implementing all the CLI commands, except very few which I
> have some doubts ( like, how the output should be presented ) :)
>
>  I started writing a document explaining each and every command with their
> expected outputs ( when correct params are given, when no params are given
> and when wrong params are given ) I will continue writing the test cases
> based on them.
>
> As discussed on Hangout, I will do a demo,  record it and share soon :)
>
> On Wed, Jul 29, 2015 at 10:34 AM, Milindu Sanoj Kumarage <
> agentmilindu@gmail.com> wrote:
>
>> Hi,
>>
>> I could finish most of the listing command and now working with the
>> create and update commands. I'm running Java CLI to get an idea how the
>> output should be presented. Had to fix some issues related to that "-"
>> issue also, regarding auto-completion. I started writing test cases for
>> utility methods, and will start writing test cases for Stratos specific
>> ones this week. I'm using Tox to run my tests on different Python versions,
>> 2.x ones and 3.z ones.
>>
>> On Thu, Jul 9, 2015 at 2:52 PM, Milindu Sanoj Kumarage <
>> agentmilindu@gmail.com> wrote:
>>
>>> Hi,
>>>
>>> I invested last 2 week on some research on Testing frameworks and
>>> Security Certificates. CA Bundles and  Pem files were something I had no
>>> experience, therefor I studied on that. Studied Java security API and
>>> Stratos's Java CLI's Certificate handling codes ( Keystores, etc ).
>>>
>>> *Testing frameworks*
>>>
>>> 1. Unittest ( docs.python.org/2/library/unittest.html ) [ PSF(
>>> GPL-compatible ) ]
>>>
>>> Python's unit testing module since 2.7. Very similar to JUnit for
>>> Java. Gives very descriptive outputs when found assertion errors.
>>>
>>> 2. Unittest2 ( pypi.python.org/pypi/unittest2 ) [ BSD ]
>>>
>>> unittest2 is a backport of the new features added to the unittest
>>> testing framework in Python 2.7 and onwards. Supports back to Python 2.4+.
>>>
>>> 3. PyTest ( pytest.org/ ) [ MIT ]
>>>
>>> Very popular unit testing tool which is an alternative to Python’s
>>> standard unittest module. Gives very descriptive outputs when found
>>> assertion errors. Integrates nicely with setup.py. Python 2 and 3
>>> compatible.
>>>
>>> 4. Nose ( nose.readthedocs.org/en/latest ) [ LGPL ]
>>>
>>> Nose extends unittest to make testing easier. Same as PyTest.
>>> Python 2 and 3 compatible.
>>>
>>> 5. Tox ( tox.readthedocs.org/en/latest/ ) [ MIT ]
>>>
>>> Tox is a generic virtualenv management and test command line tool. We
>>> can setup several Python virtual environments and run our tests on those
>>> environments. This is a very useful tool to ensure the compatibility with
>>> Python 2 and Python 3 versions. PyTest,  nose and unittest modules are
>>> compatible with tox. Able to easily integrate with continuous integration
>>> servers like Jenkins.
>>>
>>> 6. Doctest ( docs.python.org/2/library/doctest.htmlt ) [ PSF(
>>> GPL-compatible ) ]
>>>
>>>  Python module that checks for interactive Python sessions in
>>> docstrings, and then executes those sessions to verify that they work
>>> exactly as shown.
>>>
>>> 7. Atheist ( arco.esi.uclm.es/~david.villa/atheist/html/  ) [ GFDL ]
>>>
>>> A great tool for command line testing, it issues the commands to the
>>> underlying shell and compares the output with the intended output. Now
>>> discontinued but bug-maintained.
>>>
>>> 8. Prego ( bitbucket.org/arco_group/prego ) [ GPLv3+ ]
>>>
>>> Successor of Atheist, which provides support to run shell commands on
>>> background, send signal to processes, set assertions on command stdout or
>>> stderr, etc. Very suitable in CLI testing tasks.
>>>
>>> 9. ScriptTest ( pythonpaste.org/scripttest/ ) [  MIT-style permissive
>>> license ]
>>>
>>> Something like Prego, but seems less features.
>>>
>>> 10. Behave ( jenisys.github.io/behave.example/ ) [ BSD ]
>>>
>>>  A BDD framework and a cucumber-clone for Python. Cucumber is a nice way
>>> for feature testing where we define the features in simple English and that
>>> will become the tests.
>>>
>>>
>>> I definitely will be using Tox because it makes us test the Python CLI
>>> on different Python versions. But Tox alone can not test the CLI. We have
>>> to us some other testing framework on Tox. I'm wondering what to use where.
>>> We can use PyTest for unit test Stratos.py which calls the Stratos RESTAPI.
>>> But we have to test the CLI functionalities also, using some kind of CLI
>>> testing tool. I think I need some advice here :)
>>>
>>> Meanwhile, I continued implementing other "list" CMD actions in Python
>>> CLI. I see some repetition in error code handling stuffs, I'm thinking of a
>>> way to write a general method for error handling and error reporting.
>>>
>>>
>>>
>>>
>>>
>>
>

Re: [GSoC 2015] Python CLI for Stratos : Weekly Update

Posted by Milindu Sanoj Kumarage <ag...@gmail.com>.
Hi,

I have finished implementing all the CLI commands, except very few which I
have some doubts ( like, how the output should be presented ) :)

 I started writing a document explaining each and every command with their
expected outputs ( when correct params are given, when no params are given
and when wrong params are given ) I will continue writing the test cases
based on them.

As discussed on Hangout, I will do a demo,  record it and share soon :)

On Wed, Jul 29, 2015 at 10:34 AM, Milindu Sanoj Kumarage <
agentmilindu@gmail.com> wrote:

> Hi,
>
> I could finish most of the listing command and now working with the create
> and update commands. I'm running Java CLI to get an idea how the output
> should be presented. Had to fix some issues related to that "-" issue also,
> regarding auto-completion. I started writing test cases for utility
> methods, and will start writing test cases for Stratos specific ones this
> week. I'm using Tox to run my tests on different Python versions, 2.x ones
> and 3.z ones.
>
> On Thu, Jul 9, 2015 at 2:52 PM, Milindu Sanoj Kumarage <
> agentmilindu@gmail.com> wrote:
>
>> Hi,
>>
>> I invested last 2 week on some research on Testing frameworks and
>> Security Certificates. CA Bundles and  Pem files were something I had no
>> experience, therefor I studied on that. Studied Java security API and
>> Stratos's Java CLI's Certificate handling codes ( Keystores, etc ).
>>
>> *Testing frameworks*
>>
>> 1. Unittest ( docs.python.org/2/library/unittest.html ) [ PSF(
>> GPL-compatible ) ]
>>
>> Python's unit testing module since 2.7. Very similar to JUnit for
>> Java. Gives very descriptive outputs when found assertion errors.
>>
>> 2. Unittest2 ( pypi.python.org/pypi/unittest2 ) [ BSD ]
>>
>> unittest2 is a backport of the new features added to the unittest testing
>> framework in Python 2.7 and onwards. Supports back to Python 2.4+.
>>
>> 3. PyTest ( pytest.org/ ) [ MIT ]
>>
>> Very popular unit testing tool which is an alternative to Python’s
>> standard unittest module. Gives very descriptive outputs when found
>> assertion errors. Integrates nicely with setup.py. Python 2 and 3
>> compatible.
>>
>> 4. Nose ( nose.readthedocs.org/en/latest ) [ LGPL ]
>>
>> Nose extends unittest to make testing easier. Same as PyTest.
>> Python 2 and 3 compatible.
>>
>> 5. Tox ( tox.readthedocs.org/en/latest/ ) [ MIT ]
>>
>> Tox is a generic virtualenv management and test command line tool. We can
>> setup several Python virtual environments and run our tests on those
>> environments. This is a very useful tool to ensure the compatibility with
>> Python 2 and Python 3 versions. PyTest,  nose and unittest modules are
>> compatible with tox. Able to easily integrate with continuous integration
>> servers like Jenkins.
>>
>> 6. Doctest ( docs.python.org/2/library/doctest.htmlt ) [ PSF(
>> GPL-compatible ) ]
>>
>>  Python module that checks for interactive Python sessions in docstrings,
>> and then executes those sessions to verify that they work exactly as shown.
>>
>> 7. Atheist ( arco.esi.uclm.es/~david.villa/atheist/html/  ) [ GFDL ]
>>
>> A great tool for command line testing, it issues the commands to the
>> underlying shell and compares the output with the intended output. Now
>> discontinued but bug-maintained.
>>
>> 8. Prego ( bitbucket.org/arco_group/prego ) [ GPLv3+ ]
>>
>> Successor of Atheist, which provides support to run shell commands on
>> background, send signal to processes, set assertions on command stdout or
>> stderr, etc. Very suitable in CLI testing tasks.
>>
>> 9. ScriptTest ( pythonpaste.org/scripttest/ ) [  MIT-style permissive
>> license ]
>>
>> Something like Prego, but seems less features.
>>
>> 10. Behave ( jenisys.github.io/behave.example/ ) [ BSD ]
>>
>>  A BDD framework and a cucumber-clone for Python. Cucumber is a nice way
>> for feature testing where we define the features in simple English and that
>> will become the tests.
>>
>>
>> I definitely will be using Tox because it makes us test the Python CLI on
>> different Python versions. But Tox alone can not test the CLI. We have to
>> us some other testing framework on Tox. I'm wondering what to use where. We
>> can use PyTest for unit test Stratos.py which calls the Stratos RESTAPI.
>> But we have to test the CLI functionalities also, using some kind of CLI
>> testing tool. I think I need some advice here :)
>>
>> Meanwhile, I continued implementing other "list" CMD actions in Python
>> CLI. I see some repetition in error code handling stuffs, I'm thinking of a
>> way to write a general method for error handling and error reporting.
>>
>>
>>
>>
>>
>

Re: [GSoC 2015] Python CLI for Stratos : Weekly Update

Posted by Milindu Sanoj Kumarage <ag...@gmail.com>.
Hi,

I could finish most of the listing command and now working with the create
and update commands. I'm running Java CLI to get an idea how the output
should be presented. Had to fix some issues related to that "-" issue also,
regarding auto-completion. I started writing test cases for utility
methods, and will start writing test cases for Stratos specific ones this
week. I'm using Tox to run my tests on different Python versions, 2.x ones
and 3.z ones.

On Thu, Jul 9, 2015 at 2:52 PM, Milindu Sanoj Kumarage <
agentmilindu@gmail.com> wrote:

> Hi,
>
> I invested last 2 week on some research on Testing frameworks and Security
> Certificates. CA Bundles and  Pem files were something I had no experience,
> therefor I studied on that. Studied Java security API and Stratos's Java
> CLI's Certificate handling codes ( Keystores, etc ).
>
> *Testing frameworks*
>
> 1. Unittest ( docs.python.org/2/library/unittest.html ) [ PSF(
> GPL-compatible ) ]
>
> Python's unit testing module since 2.7. Very similar to JUnit for
> Java. Gives very descriptive outputs when found assertion errors.
>
> 2. Unittest2 ( pypi.python.org/pypi/unittest2 ) [ BSD ]
>
> unittest2 is a backport of the new features added to the unittest testing
> framework in Python 2.7 and onwards. Supports back to Python 2.4+.
>
> 3. PyTest ( pytest.org/ ) [ MIT ]
>
> Very popular unit testing tool which is an alternative to Python’s
> standard unittest module. Gives very descriptive outputs when found
> assertion errors. Integrates nicely with setup.py. Python 2 and 3
> compatible.
>
> 4. Nose ( nose.readthedocs.org/en/latest ) [ LGPL ]
>
> Nose extends unittest to make testing easier. Same as PyTest.
> Python 2 and 3 compatible.
>
> 5. Tox ( tox.readthedocs.org/en/latest/ ) [ MIT ]
>
> Tox is a generic virtualenv management and test command line tool. We can
> setup several Python virtual environments and run our tests on those
> environments. This is a very useful tool to ensure the compatibility with
> Python 2 and Python 3 versions. PyTest,  nose and unittest modules are
> compatible with tox. Able to easily integrate with continuous integration
> servers like Jenkins.
>
> 6. Doctest ( docs.python.org/2/library/doctest.htmlt ) [ PSF(
> GPL-compatible ) ]
>
>  Python module that checks for interactive Python sessions in docstrings,
> and then executes those sessions to verify that they work exactly as shown.
>
> 7. Atheist ( arco.esi.uclm.es/~david.villa/atheist/html/  ) [ GFDL ]
>
> A great tool for command line testing, it issues the commands to the
> underlying shell and compares the output with the intended output. Now
> discontinued but bug-maintained.
>
> 8. Prego ( bitbucket.org/arco_group/prego ) [ GPLv3+ ]
>
> Successor of Atheist, which provides support to run shell commands on
> background, send signal to processes, set assertions on command stdout or
> stderr, etc. Very suitable in CLI testing tasks.
>
> 9. ScriptTest ( pythonpaste.org/scripttest/ ) [  MIT-style permissive
> license ]
>
> Something like Prego, but seems less features.
>
> 10. Behave ( jenisys.github.io/behave.example/ ) [ BSD ]
>
>  A BDD framework and a cucumber-clone for Python. Cucumber is a nice way
> for feature testing where we define the features in simple English and that
> will become the tests.
>
>
> I definitely will be using Tox because it makes us test the Python CLI on
> different Python versions. But Tox alone can not test the CLI. We have to
> us some other testing framework on Tox. I'm wondering what to use where. We
> can use PyTest for unit test Stratos.py which calls the Stratos RESTAPI.
> But we have to test the CLI functionalities also, using some kind of CLI
> testing tool. I think I need some advice here :)
>
> Meanwhile, I continued implementing other "list" CMD actions in Python
> CLI. I see some repetition in error code handling stuffs, I'm thinking of a
> way to write a general method for error handling and error reporting.
>
>
>
>
>

Re: [GSoC 2015] Python CLI for Stratos : Weekly Update

Posted by Milindu Sanoj Kumarage <ag...@gmail.com>.
Hi,

I invested last 2 week on some research on Testing frameworks and Security
Certificates. CA Bundles and  Pem files were something I had no experience,
therefor I studied on that. Studied Java security API and Stratos's Java
CLI's Certificate handling codes ( Keystores, etc ).

*Testing frameworks*

1. Unittest ( docs.python.org/2/library/unittest.html ) [ PSF(
GPL-compatible ) ]

Python's unit testing module since 2.7. Very similar to JUnit for
Java. Gives very descriptive outputs when found assertion errors.

2. Unittest2 ( pypi.python.org/pypi/unittest2 ) [ BSD ]

unittest2 is a backport of the new features added to the unittest testing
framework in Python 2.7 and onwards. Supports back to Python 2.4+.

3. PyTest ( pytest.org/ ) [ MIT ]

Very popular unit testing tool which is an alternative to Python’s standard
unittest module. Gives very descriptive outputs when found assertion
errors. Integrates nicely with setup.py. Python 2 and 3 compatible.

4. Nose ( nose.readthedocs.org/en/latest ) [ LGPL ]

Nose extends unittest to make testing easier. Same as PyTest.
Python 2 and 3 compatible.

5. Tox ( tox.readthedocs.org/en/latest/ ) [ MIT ]

Tox is a generic virtualenv management and test command line tool. We can
setup several Python virtual environments and run our tests on those
environments. This is a very useful tool to ensure the compatibility with
Python 2 and Python 3 versions. PyTest,  nose and unittest modules are
compatible with tox. Able to easily integrate with continuous integration
servers like Jenkins.

6. Doctest ( docs.python.org/2/library/doctest.htmlt ) [ PSF(
GPL-compatible ) ]

 Python module that checks for interactive Python sessions in docstrings,
and then executes those sessions to verify that they work exactly as shown.

7. Atheist ( arco.esi.uclm.es/~david.villa/atheist/html/  ) [ GFDL ]

A great tool for command line testing, it issues the commands to the
underlying shell and compares the output with the intended output. Now
discontinued but bug-maintained.

8. Prego ( bitbucket.org/arco_group/prego ) [ GPLv3+ ]

Successor of Atheist, which provides support to run shell commands on
background, send signal to processes, set assertions on command stdout or
stderr, etc. Very suitable in CLI testing tasks.

9. ScriptTest ( pythonpaste.org/scripttest/ ) [  MIT-style permissive
license ]

Something like Prego, but seems less features.

10. Behave ( jenisys.github.io/behave.example/ ) [ BSD ]

 A BDD framework and a cucumber-clone for Python. Cucumber is a nice way
for feature testing where we define the features in simple English and that
will become the tests.


I definitely will be using Tox because it makes us test the Python CLI on
different Python versions. But Tox alone can not test the CLI. We have to
us some other testing framework on Tox. I'm wondering what to use where. We
can use PyTest for unit test Stratos.py which calls the Stratos RESTAPI.
But we have to test the CLI functionalities also, using some kind of CLI
testing tool. I think I need some advice here :)

Meanwhile, I continued implementing other "list" CMD actions in Python CLI.
I see some repetition in error code handling stuffs, I'm thinking of a way
to write a general method for error handling and error reporting.

Re: [GSoC 2015] Python CLI for Stratos : Weekly Update

Posted by Imesh Gunaratne <im...@apache.org>.
That's great Milindu! Thanks for the update!

On Sun, Jun 21, 2015 at 8:38 AM, Milindu Sanoj Kumarage <
agentmilindu@gmail.com> wrote:

> Hi Imesh,
>
> Yes, it is a generic method which can parse any given JSON object. I have
> tested it with several different types of JSON objects and it seems working
> well with them too :)
>
>
> On Sun, Jun 21, 2015 at 8:01 AM, Imesh Gunaratne <im...@apache.org> wrote:
>
>> Hi Milindu,
>>
>> The tree structure output looks great! Do we have a generic method which
>> can parse any given JSON object and generate this or is it specifically
>> written for Network Partitions?
>>
>> Thanks
>>
>> On Sat, Jun 20, 2015 at 9:04 PM, Milindu Sanoj Kumarage <
>> agentmilindu@gmail.com> wrote:
>>
>>> Hi,
>>>
>>> I could implement the "List Network Partitions" action where we have to
>>> print a tree and it went well. ( I was not sure what to put as properties
>>> when creating the partitions, sorry for the funny properties I have added
>>> O:) )
>>>
>>> [image: Inline image 1]
>>>
>>>
>>> I think implementing the rest of the CLI actions would be straight
>>> forward.
>>> I'm on the process of generalizing the HTTP response handling and
>>> exception raising.
>>>
>>>
>>> I'm getting an SSL error when the Python HTTP library is making requests
>>> to the REST API. This is because the self-signed certificate is not trusted
>>> by the Python HTTP library. Currently I'm setting validate=False which is
>>> not a good practice at all, but this is just for testing.
>>>
>>> 'Requests <http://docs.python-requests.org/en/latest/#>' ( the Python
>>> library we use for sending HTTP requests ) has a method to attach a CA
>>> bundle file, then the HTTPS requests will be validated with it. I'm working
>>> on it, but having some troubles there. I still get a SSL error even if I
>>> linked a CA bundle. I'm not very sure if I'm giving it the correct Certs.
>>> Hope I can get this issue solved this week.
>>>
>>> We had several Google Hangouts to discuss on progress and issues I face
>>> when developing.
>>>
>>> On Fri, Jun 12, 2015 at 7:52 PM, Chamila De Alwis <ch...@wso2.com>
>>> wrote:
>>>
>>>> Hi Milindu,
>>>>
>>>> It's great to see a complete workflow being executed! The format the
>>>> data is displayed in looks good. Let's continue to add the commands one by
>>>> one.
>>>>
>>>> Py.Test is a great framework to do Python unit testing. Let us know the
>>>> results of the research on test frameworks. There might be better
>>>> frameworks suited to test command line apps as a whole.
>>>>
>>>>
>>>> Regards,
>>>> Chamila de Alwis
>>>> Committer and PMC Member - Apache Stratos
>>>> Software Engineer | WSO2 | +94772207163
>>>> Blog: code.chamiladealwis.com
>>>>
>>>>
>>>>
>>>> On Thu, Jun 11, 2015 at 3:50 PM, Milindu Sanoj Kumarage <
>>>> agentmilindu@gmail.com> wrote:
>>>>
>>>>> Hi everyone,
>>>>>
>>>>> We had a Google Hangout yesterday to discuss the progress. Since we
>>>>> have finished the foundation of the CLI, we thought of moving to calling
>>>>> Stratos REST API parts. I'm currently working with Mock IaaS. As a test
>>>>> run, I tried to list the available users and show on the terminal as a
>>>>> table. It went well and here is a snapshot :)
>>>>>
>>>>> I will continue this, with action names as of Java CLI ( eg;-
>>>>> list-users, etc ).
>>>>>
>>>>>
>>>>> [image: Inline image 1]
>>>>>
>>>>> We discussed to use PyTest( http://pytest.org ) for testing, I will
>>>>> try to write some test for the codes we have this far :) Meanwhile, I will
>>>>> research other options also.
>>>>>
>>>>>
>>>>>
>>>>> On Tue, Jun 9, 2015 at 6:46 PM, Manula Thantriwatte <
>>>>> manulachathurika@gmail.com> wrote:
>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> +1 for the non-interactive mode behaviour.
>>>>>>
>>>>>> On Tue, Jun 9, 2015 at 12:08 AM, Milindu Sanoj Kumarage <
>>>>>> agentmilindu@gmail.com> wrote:
>>>>>>
>>>>>>> Hi,
>>>>>>>
>>>>>>> When the CLI is used in the non-interactive mode, it is most likely
>>>>>>>> included in a (ex: Bash) script. In that case it should notify of the error
>>>>>>>> and continue, rather than hang up and wait for user input (thus the name
>>>>>>>> "non-interactive" :) ). WDYT?
>>>>>>>
>>>>>>>
>>>>>>>   I too agree. Like to know others' ideas too :)
>>>>>>>
>>>>>>> Just a minor point on the source code.
>>>>>>>> [image: Inline image 1]
>>>>>>>> In Configs.py I noticed that "~" symbol is used. Is this portable
>>>>>>>> to Windows? If not let's keep that in mind and test only in Linux for now.
>>>>>>>> We will have to make it portable to Windows as well.
>>>>>>>>
>>>>>>>
>>>>>>>   In Logging.py I'm using following code to get the path of the
>>>>>>> Stratos's dir( ".stratos" ) inside the user's home dir( "~/" ) , in
>>>>>>>  platform independent manner.
>>>>>>>
>>>>>>> stratos_dir_path = os.path.expanduser(Configs.stratos_dir)
>>>>>>>
>>>>>>> But it seems it is better to add this part too to Configs.py :)
>>>>>>> Let's change that :)
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Regards,
>>>>>> Manula Chathurika Thantriwatte
>>>>>> phone : (+65) 91306970
>>>>>> email : manulachathurika@gmail.com
>>>>>> Linkedin : *http://lk.linkedin.com/in/manulachathurika
>>>>>> <http://lk.linkedin.com/in/manulachathurika>*
>>>>>> blog : http://manulachathurika.blogspot.com/
>>>>>>
>>>>>
>>>>>
>>>>
>>>
>>
>>
>> --
>> Imesh Gunaratne
>>
>> Senior Technical Lead, WSO2
>> Committer & PMC Member, Apache Stratos
>>
>
>


-- 
Imesh Gunaratne

Senior Technical Lead, WSO2
Committer & PMC Member, Apache Stratos

Re: [GSoC 2015] Python CLI for Stratos : Weekly Update

Posted by Milindu Sanoj Kumarage <ag...@gmail.com>.
Hi Imesh,

Yes, it is a generic method which can parse any given JSON object. I have
tested it with several different types of JSON objects and it seems working
well with them too :)


On Sun, Jun 21, 2015 at 8:01 AM, Imesh Gunaratne <im...@apache.org> wrote:

> Hi Milindu,
>
> The tree structure output looks great! Do we have a generic method which
> can parse any given JSON object and generate this or is it specifically
> written for Network Partitions?
>
> Thanks
>
> On Sat, Jun 20, 2015 at 9:04 PM, Milindu Sanoj Kumarage <
> agentmilindu@gmail.com> wrote:
>
>> Hi,
>>
>> I could implement the "List Network Partitions" action where we have to
>> print a tree and it went well. ( I was not sure what to put as properties
>> when creating the partitions, sorry for the funny properties I have added
>> O:) )
>>
>> [image: Inline image 1]
>>
>>
>> I think implementing the rest of the CLI actions would be straight
>> forward.
>> I'm on the process of generalizing the HTTP response handling and
>> exception raising.
>>
>>
>> I'm getting an SSL error when the Python HTTP library is making requests
>> to the REST API. This is because the self-signed certificate is not trusted
>> by the Python HTTP library. Currently I'm setting validate=False which is
>> not a good practice at all, but this is just for testing.
>>
>> 'Requests <http://docs.python-requests.org/en/latest/#>' ( the Python
>> library we use for sending HTTP requests ) has a method to attach a CA
>> bundle file, then the HTTPS requests will be validated with it. I'm working
>> on it, but having some troubles there. I still get a SSL error even if I
>> linked a CA bundle. I'm not very sure if I'm giving it the correct Certs.
>> Hope I can get this issue solved this week.
>>
>> We had several Google Hangouts to discuss on progress and issues I face
>> when developing.
>>
>> On Fri, Jun 12, 2015 at 7:52 PM, Chamila De Alwis <ch...@wso2.com>
>> wrote:
>>
>>> Hi Milindu,
>>>
>>> It's great to see a complete workflow being executed! The format the
>>> data is displayed in looks good. Let's continue to add the commands one by
>>> one.
>>>
>>> Py.Test is a great framework to do Python unit testing. Let us know the
>>> results of the research on test frameworks. There might be better
>>> frameworks suited to test command line apps as a whole.
>>>
>>>
>>> Regards,
>>> Chamila de Alwis
>>> Committer and PMC Member - Apache Stratos
>>> Software Engineer | WSO2 | +94772207163
>>> Blog: code.chamiladealwis.com
>>>
>>>
>>>
>>> On Thu, Jun 11, 2015 at 3:50 PM, Milindu Sanoj Kumarage <
>>> agentmilindu@gmail.com> wrote:
>>>
>>>> Hi everyone,
>>>>
>>>> We had a Google Hangout yesterday to discuss the progress. Since we
>>>> have finished the foundation of the CLI, we thought of moving to calling
>>>> Stratos REST API parts. I'm currently working with Mock IaaS. As a test
>>>> run, I tried to list the available users and show on the terminal as a
>>>> table. It went well and here is a snapshot :)
>>>>
>>>> I will continue this, with action names as of Java CLI ( eg;-
>>>> list-users, etc ).
>>>>
>>>>
>>>> [image: Inline image 1]
>>>>
>>>> We discussed to use PyTest( http://pytest.org ) for testing, I will
>>>> try to write some test for the codes we have this far :) Meanwhile, I will
>>>> research other options also.
>>>>
>>>>
>>>>
>>>> On Tue, Jun 9, 2015 at 6:46 PM, Manula Thantriwatte <
>>>> manulachathurika@gmail.com> wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> +1 for the non-interactive mode behaviour.
>>>>>
>>>>> On Tue, Jun 9, 2015 at 12:08 AM, Milindu Sanoj Kumarage <
>>>>> agentmilindu@gmail.com> wrote:
>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> When the CLI is used in the non-interactive mode, it is most likely
>>>>>>> included in a (ex: Bash) script. In that case it should notify of the error
>>>>>>> and continue, rather than hang up and wait for user input (thus the name
>>>>>>> "non-interactive" :) ). WDYT?
>>>>>>
>>>>>>
>>>>>>   I too agree. Like to know others' ideas too :)
>>>>>>
>>>>>> Just a minor point on the source code.
>>>>>>> [image: Inline image 1]
>>>>>>> In Configs.py I noticed that "~" symbol is used. Is this portable to
>>>>>>> Windows? If not let's keep that in mind and test only in Linux for now. We
>>>>>>> will have to make it portable to Windows as well.
>>>>>>>
>>>>>>
>>>>>>   In Logging.py I'm using following code to get the path of the
>>>>>> Stratos's dir( ".stratos" ) inside the user's home dir( "~/" ) , in
>>>>>>  platform independent manner.
>>>>>>
>>>>>> stratos_dir_path = os.path.expanduser(Configs.stratos_dir)
>>>>>>
>>>>>> But it seems it is better to add this part too to Configs.py :)
>>>>>> Let's change that :)
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Regards,
>>>>> Manula Chathurika Thantriwatte
>>>>> phone : (+65) 91306970
>>>>> email : manulachathurika@gmail.com
>>>>> Linkedin : *http://lk.linkedin.com/in/manulachathurika
>>>>> <http://lk.linkedin.com/in/manulachathurika>*
>>>>> blog : http://manulachathurika.blogspot.com/
>>>>>
>>>>
>>>>
>>>
>>
>
>
> --
> Imesh Gunaratne
>
> Senior Technical Lead, WSO2
> Committer & PMC Member, Apache Stratos
>

Re: [GSoC 2015] Python CLI for Stratos : Weekly Update

Posted by Imesh Gunaratne <im...@apache.org>.
Hi Milindu,

The tree structure output looks great! Do we have a generic method which
can parse any given JSON object and generate this or is it specifically
written for Network Partitions?

Thanks

On Sat, Jun 20, 2015 at 9:04 PM, Milindu Sanoj Kumarage <
agentmilindu@gmail.com> wrote:

> Hi,
>
> I could implement the "List Network Partitions" action where we have to
> print a tree and it went well. ( I was not sure what to put as properties
> when creating the partitions, sorry for the funny properties I have added
> O:) )
>
> [image: Inline image 1]
>
>
> I think implementing the rest of the CLI actions would be straight forward.
> I'm on the process of generalizing the HTTP response handling and
> exception raising.
>
>
> I'm getting an SSL error when the Python HTTP library is making requests
> to the REST API. This is because the self-signed certificate is not trusted
> by the Python HTTP library. Currently I'm setting validate=False which is
> not a good practice at all, but this is just for testing.
>
> 'Requests <http://docs.python-requests.org/en/latest/#>' ( the Python
> library we use for sending HTTP requests ) has a method to attach a CA
> bundle file, then the HTTPS requests will be validated with it. I'm working
> on it, but having some troubles there. I still get a SSL error even if I
> linked a CA bundle. I'm not very sure if I'm giving it the correct Certs.
> Hope I can get this issue solved this week.
>
> We had several Google Hangouts to discuss on progress and issues I face
> when developing.
>
> On Fri, Jun 12, 2015 at 7:52 PM, Chamila De Alwis <ch...@wso2.com>
> wrote:
>
>> Hi Milindu,
>>
>> It's great to see a complete workflow being executed! The format the data
>> is displayed in looks good. Let's continue to add the commands one by one.
>>
>> Py.Test is a great framework to do Python unit testing. Let us know the
>> results of the research on test frameworks. There might be better
>> frameworks suited to test command line apps as a whole.
>>
>>
>> Regards,
>> Chamila de Alwis
>> Committer and PMC Member - Apache Stratos
>> Software Engineer | WSO2 | +94772207163
>> Blog: code.chamiladealwis.com
>>
>>
>>
>> On Thu, Jun 11, 2015 at 3:50 PM, Milindu Sanoj Kumarage <
>> agentmilindu@gmail.com> wrote:
>>
>>> Hi everyone,
>>>
>>> We had a Google Hangout yesterday to discuss the progress. Since we have
>>> finished the foundation of the CLI, we thought of moving to calling Stratos
>>> REST API parts. I'm currently working with Mock IaaS. As a test run, I
>>> tried to list the available users and show on the terminal as a table. It
>>> went well and here is a snapshot :)
>>>
>>> I will continue this, with action names as of Java CLI ( eg;-
>>> list-users, etc ).
>>>
>>>
>>> [image: Inline image 1]
>>>
>>> We discussed to use PyTest( http://pytest.org ) for testing, I will try
>>> to write some test for the codes we have this far :) Meanwhile, I will
>>> research other options also.
>>>
>>>
>>>
>>> On Tue, Jun 9, 2015 at 6:46 PM, Manula Thantriwatte <
>>> manulachathurika@gmail.com> wrote:
>>>
>>>> Hi,
>>>>
>>>> +1 for the non-interactive mode behaviour.
>>>>
>>>> On Tue, Jun 9, 2015 at 12:08 AM, Milindu Sanoj Kumarage <
>>>> agentmilindu@gmail.com> wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> When the CLI is used in the non-interactive mode, it is most likely
>>>>>> included in a (ex: Bash) script. In that case it should notify of the error
>>>>>> and continue, rather than hang up and wait for user input (thus the name
>>>>>> "non-interactive" :) ). WDYT?
>>>>>
>>>>>
>>>>>   I too agree. Like to know others' ideas too :)
>>>>>
>>>>> Just a minor point on the source code.
>>>>>> [image: Inline image 1]
>>>>>> In Configs.py I noticed that "~" symbol is used. Is this portable to
>>>>>> Windows? If not let's keep that in mind and test only in Linux for now. We
>>>>>> will have to make it portable to Windows as well.
>>>>>>
>>>>>
>>>>>   In Logging.py I'm using following code to get the path of the
>>>>> Stratos's dir( ".stratos" ) inside the user's home dir( "~/" ) , in
>>>>>  platform independent manner.
>>>>>
>>>>> stratos_dir_path = os.path.expanduser(Configs.stratos_dir)
>>>>>
>>>>> But it seems it is better to add this part too to Configs.py :) Let's
>>>>> change that :)
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>> Regards,
>>>> Manula Chathurika Thantriwatte
>>>> phone : (+65) 91306970
>>>> email : manulachathurika@gmail.com
>>>> Linkedin : *http://lk.linkedin.com/in/manulachathurika
>>>> <http://lk.linkedin.com/in/manulachathurika>*
>>>> blog : http://manulachathurika.blogspot.com/
>>>>
>>>
>>>
>>
>


-- 
Imesh Gunaratne

Senior Technical Lead, WSO2
Committer & PMC Member, Apache Stratos

Re: [GSoC 2015] Python CLI for Stratos : Weekly Update

Posted by Milindu Sanoj Kumarage <ag...@gmail.com>.
Hi,

I could implement the "List Network Partitions" action where we have to
print a tree and it went well. ( I was not sure what to put as properties
when creating the partitions, sorry for the funny properties I have added
O:) )

[image: Inline image 1]


I think implementing the rest of the CLI actions would be straight forward.
I'm on the process of generalizing the HTTP response handling and exception
raising.


I'm getting an SSL error when the Python HTTP library is making requests to
the REST API. This is because the self-signed certificate is not trusted by
the Python HTTP library. Currently I'm setting validate=False which is not
a good practice at all, but this is just for testing.

'Requests <http://docs.python-requests.org/en/latest/#>' ( the Python
library we use for sending HTTP requests ) has a method to attach a CA
bundle file, then the HTTPS requests will be validated with it. I'm working
on it, but having some troubles there. I still get a SSL error even if I
linked a CA bundle. I'm not very sure if I'm giving it the correct Certs.
Hope I can get this issue solved this week.

We had several Google Hangouts to discuss on progress and issues I face
when developing.

On Fri, Jun 12, 2015 at 7:52 PM, Chamila De Alwis <ch...@wso2.com> wrote:

> Hi Milindu,
>
> It's great to see a complete workflow being executed! The format the data
> is displayed in looks good. Let's continue to add the commands one by one.
>
> Py.Test is a great framework to do Python unit testing. Let us know the
> results of the research on test frameworks. There might be better
> frameworks suited to test command line apps as a whole.
>
>
> Regards,
> Chamila de Alwis
> Committer and PMC Member - Apache Stratos
> Software Engineer | WSO2 | +94772207163
> Blog: code.chamiladealwis.com
>
>
>
> On Thu, Jun 11, 2015 at 3:50 PM, Milindu Sanoj Kumarage <
> agentmilindu@gmail.com> wrote:
>
>> Hi everyone,
>>
>> We had a Google Hangout yesterday to discuss the progress. Since we have
>> finished the foundation of the CLI, we thought of moving to calling Stratos
>> REST API parts. I'm currently working with Mock IaaS. As a test run, I
>> tried to list the available users and show on the terminal as a table. It
>> went well and here is a snapshot :)
>>
>> I will continue this, with action names as of Java CLI ( eg;- list-users,
>> etc ).
>>
>>
>> [image: Inline image 1]
>>
>> We discussed to use PyTest( http://pytest.org ) for testing, I will try
>> to write some test for the codes we have this far :) Meanwhile, I will
>> research other options also.
>>
>>
>>
>> On Tue, Jun 9, 2015 at 6:46 PM, Manula Thantriwatte <
>> manulachathurika@gmail.com> wrote:
>>
>>> Hi,
>>>
>>> +1 for the non-interactive mode behaviour.
>>>
>>> On Tue, Jun 9, 2015 at 12:08 AM, Milindu Sanoj Kumarage <
>>> agentmilindu@gmail.com> wrote:
>>>
>>>> Hi,
>>>>
>>>> When the CLI is used in the non-interactive mode, it is most likely
>>>>> included in a (ex: Bash) script. In that case it should notify of the error
>>>>> and continue, rather than hang up and wait for user input (thus the name
>>>>> "non-interactive" :) ). WDYT?
>>>>
>>>>
>>>>   I too agree. Like to know others' ideas too :)
>>>>
>>>> Just a minor point on the source code.
>>>>> [image: Inline image 1]
>>>>> In Configs.py I noticed that "~" symbol is used. Is this portable to
>>>>> Windows? If not let's keep that in mind and test only in Linux for now. We
>>>>> will have to make it portable to Windows as well.
>>>>>
>>>>
>>>>   In Logging.py I'm using following code to get the path of the
>>>> Stratos's dir( ".stratos" ) inside the user's home dir( "~/" ) , in
>>>>  platform independent manner.
>>>>
>>>> stratos_dir_path = os.path.expanduser(Configs.stratos_dir)
>>>>
>>>> But it seems it is better to add this part too to Configs.py :) Let's
>>>> change that :)
>>>>
>>>>
>>>>
>>>
>>>
>>> --
>>> Regards,
>>> Manula Chathurika Thantriwatte
>>> phone : (+65) 91306970
>>> email : manulachathurika@gmail.com
>>> Linkedin : *http://lk.linkedin.com/in/manulachathurika
>>> <http://lk.linkedin.com/in/manulachathurika>*
>>> blog : http://manulachathurika.blogspot.com/
>>>
>>
>>
>

Re: [GSoC 2015] Python CLI for Stratos : Weekly Update

Posted by Chamila De Alwis <ch...@wso2.com>.
Hi Milindu,

It's great to see a complete workflow being executed! The format the data
is displayed in looks good. Let's continue to add the commands one by one.

Py.Test is a great framework to do Python unit testing. Let us know the
results of the research on test frameworks. There might be better
frameworks suited to test command line apps as a whole.


Regards,
Chamila de Alwis
Committer and PMC Member - Apache Stratos
Software Engineer | WSO2 | +94772207163
Blog: code.chamiladealwis.com



On Thu, Jun 11, 2015 at 3:50 PM, Milindu Sanoj Kumarage <
agentmilindu@gmail.com> wrote:

> Hi everyone,
>
> We had a Google Hangout yesterday to discuss the progress. Since we have
> finished the foundation of the CLI, we thought of moving to calling Stratos
> REST API parts. I'm currently working with Mock IaaS. As a test run, I
> tried to list the available users and show on the terminal as a table. It
> went well and here is a snapshot :)
>
> I will continue this, with action names as of Java CLI ( eg;- list-users,
> etc ).
>
>
> [image: Inline image 1]
>
> We discussed to use PyTest( http://pytest.org ) for testing, I will try
> to write some test for the codes we have this far :) Meanwhile, I will
> research other options also.
>
>
>
> On Tue, Jun 9, 2015 at 6:46 PM, Manula Thantriwatte <
> manulachathurika@gmail.com> wrote:
>
>> Hi,
>>
>> +1 for the non-interactive mode behaviour.
>>
>> On Tue, Jun 9, 2015 at 12:08 AM, Milindu Sanoj Kumarage <
>> agentmilindu@gmail.com> wrote:
>>
>>> Hi,
>>>
>>> When the CLI is used in the non-interactive mode, it is most likely
>>>> included in a (ex: Bash) script. In that case it should notify of the error
>>>> and continue, rather than hang up and wait for user input (thus the name
>>>> "non-interactive" :) ). WDYT?
>>>
>>>
>>>   I too agree. Like to know others' ideas too :)
>>>
>>> Just a minor point on the source code.
>>>> [image: Inline image 1]
>>>> In Configs.py I noticed that "~" symbol is used. Is this portable to
>>>> Windows? If not let's keep that in mind and test only in Linux for now. We
>>>> will have to make it portable to Windows as well.
>>>>
>>>
>>>   In Logging.py I'm using following code to get the path of the
>>> Stratos's dir( ".stratos" ) inside the user's home dir( "~/" ) , in
>>>  platform independent manner.
>>>
>>> stratos_dir_path = os.path.expanduser(Configs.stratos_dir)
>>>
>>> But it seems it is better to add this part too to Configs.py :) Let's
>>> change that :)
>>>
>>>
>>>
>>
>>
>> --
>> Regards,
>> Manula Chathurika Thantriwatte
>> phone : (+65) 91306970
>> email : manulachathurika@gmail.com
>> Linkedin : *http://lk.linkedin.com/in/manulachathurika
>> <http://lk.linkedin.com/in/manulachathurika>*
>> blog : http://manulachathurika.blogspot.com/
>>
>
>

Re: [GSoC 2015] Python CLI for Stratos : Weekly Update

Posted by Milindu Sanoj Kumarage <ag...@gmail.com>.
Hi everyone,

We had a Google Hangout yesterday to discuss the progress. Since we have
finished the foundation of the CLI, we thought of moving to calling Stratos
REST API parts. I'm currently working with Mock IaaS. As a test run, I
tried to list the available users and show on the terminal as a table. It
went well and here is a snapshot :)

I will continue this, with action names as of Java CLI ( eg;- list-users,
etc ).


[image: Inline image 1]

We discussed to use PyTest( http://pytest.org ) for testing, I will try to
write some test for the codes we have this far :) Meanwhile, I will
research other options also.



On Tue, Jun 9, 2015 at 6:46 PM, Manula Thantriwatte <
manulachathurika@gmail.com> wrote:

> Hi,
>
> +1 for the non-interactive mode behaviour.
>
> On Tue, Jun 9, 2015 at 12:08 AM, Milindu Sanoj Kumarage <
> agentmilindu@gmail.com> wrote:
>
>> Hi,
>>
>> When the CLI is used in the non-interactive mode, it is most likely
>>> included in a (ex: Bash) script. In that case it should notify of the error
>>> and continue, rather than hang up and wait for user input (thus the name
>>> "non-interactive" :) ). WDYT?
>>
>>
>>   I too agree. Like to know others' ideas too :)
>>
>> Just a minor point on the source code.
>>> [image: Inline image 1]
>>> In Configs.py I noticed that "~" symbol is used. Is this portable to
>>> Windows? If not let's keep that in mind and test only in Linux for now. We
>>> will have to make it portable to Windows as well.
>>>
>>
>>   In Logging.py I'm using following code to get the path of the
>> Stratos's dir( ".stratos" ) inside the user's home dir( "~/" ) , in
>>  platform independent manner.
>>
>> stratos_dir_path = os.path.expanduser(Configs.stratos_dir)
>>
>> But it seems it is better to add this part too to Configs.py :) Let's
>> change that :)
>>
>>
>>
>
>
> --
> Regards,
> Manula Chathurika Thantriwatte
> phone : (+65) 91306970
> email : manulachathurika@gmail.com
> Linkedin : *http://lk.linkedin.com/in/manulachathurika
> <http://lk.linkedin.com/in/manulachathurika>*
> blog : http://manulachathurika.blogspot.com/
>

Re: [GSoC 2015] Python CLI for Stratos : Weekly Update

Posted by Manula Thantriwatte <ma...@gmail.com>.
Hi,

+1 for the non-interactive mode behaviour.

On Tue, Jun 9, 2015 at 12:08 AM, Milindu Sanoj Kumarage <
agentmilindu@gmail.com> wrote:

> Hi,
>
> When the CLI is used in the non-interactive mode, it is most likely
>> included in a (ex: Bash) script. In that case it should notify of the error
>> and continue, rather than hang up and wait for user input (thus the name
>> "non-interactive" :) ). WDYT?
>
>
>   I too agree. Like to know others' ideas too :)
>
> Just a minor point on the source code.
>> [image: Inline image 1]
>> In Configs.py I noticed that "~" symbol is used. Is this portable to
>> Windows? If not let's keep that in mind and test only in Linux for now. We
>> will have to make it portable to Windows as well.
>>
>
>   In Logging.py I'm using following code to get the path of the Stratos's
> dir( ".stratos" ) inside the user's home dir( "~/" ) , in  platform
> independent manner.
>
> stratos_dir_path = os.path.expanduser(Configs.stratos_dir)
>
> But it seems it is better to add this part too to Configs.py :) Let's
> change that :)
>
>
>


-- 
Regards,
Manula Chathurika Thantriwatte
phone : (+65) 91306970
email : manulachathurika@gmail.com
Linkedin : *http://lk.linkedin.com/in/manulachathurika
<http://lk.linkedin.com/in/manulachathurika>*
blog : http://manulachathurika.blogspot.com/

Re: [GSoC 2015] Python CLI for Stratos : Weekly Update

Posted by Milindu Sanoj Kumarage <ag...@gmail.com>.
Hi,

When the CLI is used in the non-interactive mode, it is most likely
> included in a (ex: Bash) script. In that case it should notify of the error
> and continue, rather than hang up and wait for user input (thus the name
> "non-interactive" :) ). WDYT?


  I too agree. Like to know others' ideas too :)

Just a minor point on the source code.
> [image: Inline image 1]
> In Configs.py I noticed that "~" symbol is used. Is this portable to
> Windows? If not let's keep that in mind and test only in Linux for now. We
> will have to make it portable to Windows as well.
>

  In Logging.py I'm using following code to get the path of the Stratos's
dir( ".stratos" ) inside the user's home dir( "~/" ) , in  platform
independent manner.

stratos_dir_path = os.path.expanduser(Configs.stratos_dir)

But it seems it is better to add this part too to Configs.py :) Let's
change that :)

Re: [GSoC 2015] Python CLI for Stratos : Weekly Update

Posted by Chamila De Alwis <ch...@wso2.com>.
Hi Milindu,

On Sun, Jun 7, 2015 at 11:14 PM, Milindu Sanoj Kumarage <
agentmilindu@gmail.com> wrote:

>
> I added a POM to my module dir, much like Python Agent's one, but without
> some dependencies and plugins which seems not relevant to Python CLI. Now
> Python CLI would be treated as a child component :)
>

Great!  The dependencies and the plugins in the PCA POM are for the Java
integration test that was written to test the PCA. Therefore you would not
need those entries in the Python CLI POM unless you're writing a Java test
for it as well.

>
> I finished the @auth decorator as we discussed in previous discussions.
> Now working well in Single Command Mode ( Non-Interactive Mode ) and
>  Interactive Mode mode.
>
> When starting in the Interactive Mode, I prompt for username and password.
> I'm using 'getpass' built-in module here, to get the password without
> echoing to bash, like how it happens in Git, etc.
>

+1

>
> When in Single Command Mode ( Non-Interactive Mode ), when the user has
> not given an username and a password as flags and they are not even set as
> Environment Variables, then we should prompt for username and password? Or
> just notify the user and terminate?
>

The Java CLI behavior is to prompt for the username and the password in
case they are not provided. However, IMO the CLI should only notify the
user and terminate. When the CLI is used in the non-interactive mode, it is
most likely included in a (ex: Bash) script. In that case it should notify
of the error and continue, rather than hang up and wait for user input
(thus the name "non-interactive" :) ). WDYT?

>
> I'm working on defining Exception types, like NotAuthorizedException
> NoEnoughPermissionsException, etc. I'm going to raise these exceptions
> looking at the response codes and response messages of the Stratos REST
> API.
>
> What are the other possible exceptions? And I need  your  ideas and
> suggestions here :)
>

+1. Basing the exceptions on the HTTP status codes would be granular
enough.

>
> I want to know few more things,
>
> 1. Are there any CLI actions that does not need an username and a
> password?
>

AFAIK  all the CLI actions require authentication.

>
> 2. Because we are having a POM, we have to do something with it, right?
> Shall we build the binary distributions when in build phase? And run Python
> CLI specific tests in test phase? But it seems there are no Maven modules
> for Python, it seems we have to use Maven Exec  plugin here. What you
> think? :)
>

+1. We should build an artifact that can be distributed. For the PCA, an
archive is created when building the project. In the Python CLI case, you
can prepare a uploadable PIP package in the package phase. Also +1 for
using Exec Maven plugin to run the Python tests. You can map the executions
to the Maven test phase.

Just a minor point on the source code.
[image: Inline image 1]
In Configs.py I noticed that "~" symbol is used. Is this portable to
Windows? If not let's keep that in mind and test only in Linux for now. We
will have to make it portable to Windows as well.



Regards,
Chamila de Alwis
Committer and PMC Member - Apache Stratos
Software Engineer | WSO2 | +94772207163
Blog: code.chamiladealwis.com

Re: [GSoC 2015] Python CLI for Stratos : Weekly Update

Posted by Milindu Sanoj Kumarage <ag...@gmail.com>.
Hi,

I added a POM to my module dir, much like Python Agent's one, but without
some dependencies and plugins which seems not relevant to Python CLI. Now
Python CLI would be treated as a child component :)

I finished the @auth decorator as we discussed in previous discussions. Now
working well in Single Command Mode ( Non-Interactive Mode ) and
 Interactive Mode mode.

When starting in the Interactive Mode, I prompt for username and password.
I'm using 'getpass' built-in module here, to get the password without
echoing to bash, like how it happens in Git, etc.

When in Single Command Mode ( Non-Interactive Mode ), when the user has not
given an username and a password as flags and they are not even set as
Environment Variables, then we should prompt for username and password? Or
just notify the user and terminate?

I'm working on defining Exception types, like NotAuthorizedException
NoEnoughPermissionsException, etc. I'm going to raise these exceptions
looking at the response codes and response messages of the Stratos REST
API.

What are the other possible exceptions? And I need  your  ideas and
suggestions here :)

I want to know few more things,

1. Are there any CLI actions that does not need an username and a password?

2. Because we are having a POM, we have to do something with it, right?
Shall we build the binary distributions when in build phase? And run Python
CLI specific tests in test phase? But it seems there are no Maven modules
for Python, it seems we have to use Maven Exec  plugin here. What you
think? :)



On Mon, Jun 1, 2015 at 10:21 PM, Milindu Sanoj Kumarage <
agentmilindu@gmail.com> wrote:

> Hi,
>
> Yes :) , and the check sequence would be,
>  First check username and password variables that's in memory,
>  If they are not set, then check the arguments passed.
>  If  username and password are not passed as arguments, then check the
> environment variables.
>  If they are not found, then,
>     if in interactive mode, prompt to enter the username and password, and
> then store them in username and password variables.
>     If not in interactive mode, then show an error message.
>
>
>
> You have to link CLI with Startos as a child component.  You can have look
>> at python agent pom.xml [1].
>
>
>     Thanks, I will check that :)
>
>
>
> On Mon, Jun 1, 2015 at 9:57 AM, Anuruddha Liyanarachchi <
> anuruddhal@wso2.com> wrote:
>
>> Hi Milindu,
>>
>>
>> All the requests sent to Stratos needs an username and a password for
>>> authentications, right? I was thinking if I can create a python decorator (
>>> maybe as @auth ) to check if the username  and password  is known before
>>> sending the request.
>>
>>
>> If we use a decorator, for each api call username and password will be
>> checked. I think it is fine when CLI is running in  non-interactive mode.
>> But in interactive mode we can check username and password when starting
>> CLI and store those values. WDYT ?
>>
>> I have to add a POM to the Python CLI component. What I should include in
>>> it?
>>
>>
>> You have to link CLI with Startos as a child component.  You can have
>> look at python agent pom.xml [1].
>>
>> [1]
>> https://github.com/apache/stratos/blob/master/components/org.apache.stratos.python.cartridge.agent/pom.xml
>>
>> On Thu, May 28, 2015 at 11:31 AM, Milindu Sanoj Kumarage <
>> agentmilindu@gmail.com> wrote:
>>
>>> Hi,
>>>
>>> I came up with this structure after studying the needs.
>>>
>>> Main.py, CLI.py and Stratos.py would be same as of our previous
>>> discussions.
>>>
>>> Configs.py would hold configurations, etc. It would be like
>>> the CliConstants.java and  holds the default Stratos directory, Stratos
>>> prompt string, etc. And it is reading the environment variables, like
>>> username, password, etc.
>>>
>>> Logging.py would handle everything about logging. Setting the logging
>>> file, creating the logging file's directory if not exists, and setting
>>> logging level etc.
>>>
>>> Utils.py would hold the utility methods. Currently it holds codes for
>>> pretty printing of tables and trees.
>>>
>>> [image: Inline image 1]
>>>
>>>
>>> I pushed my commits to my fork. (
>>> https://github.com/agentmilindu/stratos/tree/python-cli/components/org.apache.stratos.python.cli/src/main/python/cli
>>>  )
>>>
>>> I have some questions,
>>>
>>> All the requests sent to Stratos needs an username and a password for
>>> authentications, right? I was thinking if I can create a python decorator (
>>> maybe as @auth ) to check if the username  and password  is known before
>>> sending the request.
>>>
>>> @auth
>>> def do_deploy_service(self, line , opts=None):
>>>   #codes of the deploy_service def
>>>
>>> where @auth checks either,
>>> if the opts list contains username and password,
>>> else if environment variables are set for username and password.
>>>
>>> Reason is, if we have to do a change in the username and password
>>> checking logic, then we have to change only one place.
>>> What you think about this approach?
>>> Is there any way keeping a session like, if one successfully
>>> authenticated request got a response, the subsequent requests need not to
>>> have to reenter the username/password ?
>>>
>>> I have to add a POM to the Python CLI component. What I should include
>>> in it?
>>>
>>> I think our foundation parts are done now. We have to start coding the
>>> each actions.
>>> I will send my first pull request once we are done with the above :)
>>>
>>>
>>> On Sun, May 10, 2015 at 10:32 PM, Chamila De Alwis <ch...@wso2.com>
>>> wrote:
>>>
>>>> Hi Milindu,
>>>>
>>>> We should always log enough information to a log file. In fact,*
>>>> .stratos* folder in the Java CLI is used to store the *stratos-cli.log*
>>>> file. INFO level logs should be used to log important messages, while DEBUG
>>>> level should be verbose enough to pinpoint an error.
>>>>
>>>> The other use of the* .stratos* folder is to store the command
>>>> history. You can verify this by checking the files in ~/.stratos folder.
>>>>
>>>>
>>>>
>>>>
>>>> Regards,
>>>> Chamila de Alwis
>>>> Software Engineer | WSO2 | +94772207163
>>>> Blog: code.chamiladealwis.com
>>>>
>>>>
>>>>
>>>> On Sun, May 10, 2015 at 9:26 PM, Milindu Sanoj Kumarage <
>>>> agentmilindu@gmail.com> wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> Thanks Chamila, I will update the setup.py with these info.
>>>>> I too taught of using 'stratos-cli' first, but doubted you wouldn't
>>>>> like that because the user has to type this when working with Single
>>>>> Command Line Mode. But if you think that would not be a problem, then
>>>>> let's change that as 'stratos-cli' :)
>>>>>
>>>>> Thanks Imesh, I will update the name as StratosApiClient then.
>>>>>
>>>>> I have few more questions,
>>>>>
>>>>> 1. We have to do logging, right? Log important events always ( to a
>>>>> file? ) or log only in debug mode ( directly to the cmd? )?
>>>>> 2. I saw Java CLI  creating a  dir named '.stratos', for what that
>>>>> dir is used to?
>>>>>
>>>>>
>>>>>
>>>>> On Sat, May 9, 2015 at 10:16 PM, Imesh Gunaratne <im...@apache.org>
>>>>> wrote:
>>>>>
>>>>>> Hi Milindu,
>>>>>>
>>>>>> On Sat, May 9, 2015 at 9:37 PM, Milindu Sanoj Kumarage <
>>>>>> agentmilindu@gmail.com> wrote:
>>>>>>>
>>>>>>>
>>>>>>> 1. Main.py - This contains the entry point, it does the initializing
>>>>>>> parts, creates a CLI instance and runs the loop and other stuffs.
>>>>>>>
>>>>>> +1
>>>>>>
>>>>>>>
>>>>>>> 2. CLI.py - This is the actual CLI that extends Cmd2. This contains
>>>>>>> the command to def mappings, argument and flag handling, printing outputs,
>>>>>>> etc.
>>>>>>>
>>>>>> +1
>>>>>>
>>>>>>>
>>>>>>> 3. Stratos.py - This contains the actual business logic, that is,
>>>>>>> which REST end point to call, and do what with the response, what to show,
>>>>>>> what not, etc. At the end, this would be like a Python API for Stratos in a
>>>>>>> way.
>>>>>>>
>>>>>>> IMO Stratos is too generic for a class name. Shall we rename this to
>>>>>> something like StratosApiClient?
>>>>>>
>>>>>> Thanks
>>>>>>
>>>>>> --
>>>>>> Imesh Gunaratne
>>>>>>
>>>>>> Senior Technical Lead, WSO2
>>>>>> Committer & PMC Member, Apache Stratos
>>>>>>
>>>>>
>>>>>
>>>>
>>>
>>
>>
>> --
>> *Thanks and Regards,*
>> Anuruddha Lanka Liyanarachchi
>> Software Engineer - WSO2
>> Mobile : +94 (0) 712762611
>> Tel      : +94 112 145 345
>> a <th...@wso2.com>nuruddhal@wso2.com
>>
>
>

Re: [GSoC 2015] Python CLI for Stratos : Weekly Update

Posted by Milindu Sanoj Kumarage <ag...@gmail.com>.
Hi,

Yes :) , and the check sequence would be,
 First check username and password variables that's in memory,
 If they are not set, then check the arguments passed.
 If  username and password are not passed as arguments, then check the
environment variables.
 If they are not found, then,
    if in interactive mode, prompt to enter the username and password, and
then store them in username and password variables.
    If not in interactive mode, then show an error message.



You have to link CLI with Startos as a child component.  You can have look
> at python agent pom.xml [1].


    Thanks, I will check that :)



On Mon, Jun 1, 2015 at 9:57 AM, Anuruddha Liyanarachchi <anuruddhal@wso2.com
> wrote:

> Hi Milindu,
>
>
> All the requests sent to Stratos needs an username and a password for
>> authentications, right? I was thinking if I can create a python decorator (
>> maybe as @auth ) to check if the username  and password  is known before
>> sending the request.
>
>
> If we use a decorator, for each api call username and password will be
> checked. I think it is fine when CLI is running in  non-interactive mode.
> But in interactive mode we can check username and password when starting
> CLI and store those values. WDYT ?
>
> I have to add a POM to the Python CLI component. What I should include in
>> it?
>
>
> You have to link CLI with Startos as a child component.  You can have look
> at python agent pom.xml [1].
>
> [1]
> https://github.com/apache/stratos/blob/master/components/org.apache.stratos.python.cartridge.agent/pom.xml
>
> On Thu, May 28, 2015 at 11:31 AM, Milindu Sanoj Kumarage <
> agentmilindu@gmail.com> wrote:
>
>> Hi,
>>
>> I came up with this structure after studying the needs.
>>
>> Main.py, CLI.py and Stratos.py would be same as of our previous
>> discussions.
>>
>> Configs.py would hold configurations, etc. It would be like
>> the CliConstants.java and  holds the default Stratos directory, Stratos
>> prompt string, etc. And it is reading the environment variables, like
>> username, password, etc.
>>
>> Logging.py would handle everything about logging. Setting the logging
>> file, creating the logging file's directory if not exists, and setting
>> logging level etc.
>>
>> Utils.py would hold the utility methods. Currently it holds codes for
>> pretty printing of tables and trees.
>>
>> [image: Inline image 1]
>>
>>
>> I pushed my commits to my fork. (
>> https://github.com/agentmilindu/stratos/tree/python-cli/components/org.apache.stratos.python.cli/src/main/python/cli
>>  )
>>
>> I have some questions,
>>
>> All the requests sent to Stratos needs an username and a password for
>> authentications, right? I was thinking if I can create a python decorator (
>> maybe as @auth ) to check if the username  and password  is known before
>> sending the request.
>>
>> @auth
>> def do_deploy_service(self, line , opts=None):
>>   #codes of the deploy_service def
>>
>> where @auth checks either,
>> if the opts list contains username and password,
>> else if environment variables are set for username and password.
>>
>> Reason is, if we have to do a change in the username and password
>> checking logic, then we have to change only one place.
>> What you think about this approach?
>> Is there any way keeping a session like, if one successfully
>> authenticated request got a response, the subsequent requests need not to
>> have to reenter the username/password ?
>>
>> I have to add a POM to the Python CLI component. What I should include in
>> it?
>>
>> I think our foundation parts are done now. We have to start coding the
>> each actions.
>> I will send my first pull request once we are done with the above :)
>>
>>
>> On Sun, May 10, 2015 at 10:32 PM, Chamila De Alwis <ch...@wso2.com>
>> wrote:
>>
>>> Hi Milindu,
>>>
>>> We should always log enough information to a log file. In fact,*
>>> .stratos* folder in the Java CLI is used to store the *stratos-cli.log*
>>> file. INFO level logs should be used to log important messages, while DEBUG
>>> level should be verbose enough to pinpoint an error.
>>>
>>> The other use of the* .stratos* folder is to store the command history.
>>> You can verify this by checking the files in ~/.stratos folder.
>>>
>>>
>>>
>>>
>>> Regards,
>>> Chamila de Alwis
>>> Software Engineer | WSO2 | +94772207163
>>> Blog: code.chamiladealwis.com
>>>
>>>
>>>
>>> On Sun, May 10, 2015 at 9:26 PM, Milindu Sanoj Kumarage <
>>> agentmilindu@gmail.com> wrote:
>>>
>>>> Hi,
>>>>
>>>> Thanks Chamila, I will update the setup.py with these info.
>>>> I too taught of using 'stratos-cli' first, but doubted you wouldn't
>>>> like that because the user has to type this when working with Single
>>>> Command Line Mode. But if you think that would not be a problem, then
>>>> let's change that as 'stratos-cli' :)
>>>>
>>>> Thanks Imesh, I will update the name as StratosApiClient then.
>>>>
>>>> I have few more questions,
>>>>
>>>> 1. We have to do logging, right? Log important events always ( to a
>>>> file? ) or log only in debug mode ( directly to the cmd? )?
>>>> 2. I saw Java CLI  creating a  dir named '.stratos', for what that dir
>>>> is used to?
>>>>
>>>>
>>>>
>>>> On Sat, May 9, 2015 at 10:16 PM, Imesh Gunaratne <im...@apache.org>
>>>> wrote:
>>>>
>>>>> Hi Milindu,
>>>>>
>>>>> On Sat, May 9, 2015 at 9:37 PM, Milindu Sanoj Kumarage <
>>>>> agentmilindu@gmail.com> wrote:
>>>>>>
>>>>>>
>>>>>> 1. Main.py - This contains the entry point, it does the initializing
>>>>>> parts, creates a CLI instance and runs the loop and other stuffs.
>>>>>>
>>>>> +1
>>>>>
>>>>>>
>>>>>> 2. CLI.py - This is the actual CLI that extends Cmd2. This contains
>>>>>> the command to def mappings, argument and flag handling, printing outputs,
>>>>>> etc.
>>>>>>
>>>>> +1
>>>>>
>>>>>>
>>>>>> 3. Stratos.py - This contains the actual business logic, that is,
>>>>>> which REST end point to call, and do what with the response, what to show,
>>>>>> what not, etc. At the end, this would be like a Python API for Stratos in a
>>>>>> way.
>>>>>>
>>>>>> IMO Stratos is too generic for a class name. Shall we rename this to
>>>>> something like StratosApiClient?
>>>>>
>>>>> Thanks
>>>>>
>>>>> --
>>>>> Imesh Gunaratne
>>>>>
>>>>> Senior Technical Lead, WSO2
>>>>> Committer & PMC Member, Apache Stratos
>>>>>
>>>>
>>>>
>>>
>>
>
>
> --
> *Thanks and Regards,*
> Anuruddha Lanka Liyanarachchi
> Software Engineer - WSO2
> Mobile : +94 (0) 712762611
> Tel      : +94 112 145 345
> a <th...@wso2.com>nuruddhal@wso2.com
>