Hi,

Here are some important improvements that you can do to boost your
development productivity and stability of the tool.

1. Develop a set of Unit tests with an embedded web container to mock the
PPaaS API.

 - I've already done this as a demo for you to take as a reference guide at
[1]. I've used Jetty web container as an embedded server in my JUnit test
case to mock the API. I've hosted partition list API in my test server and
assert whether artifact loader reads the partition list correctly.

Advantage of this approach is that when you build your tool, it will
compile the code, test and validate the functionality and package. You
don't need to test the tool manually which is very time consuming. You may
have to refactor/re-organize stuff I've developed to make things clean.

2. Create a class ArtifactConverterRestClient as a wrapper around
HttpClient library and use it to fetch resources from Stratos API. You can
create methods like getPartitionList, getAutoscalePolicyList etc. in this.
Decouple your conversion logic from data transfer layer much as possible.
This will make it easy for you to write tests.


3. Always use HTTPS if you are sending/receiving sensitive information. In
current implementation the tool is passing authentication credentials to
the server, therefore transport should be secure.

4. Make user input parameters configurable via configuration files.
Currently the tool expects username, password, url etc. as user inputs.
Make it read these values from a properties file and prompt only if those
values are missing.

[1] https://github.com/nishadi/product-private-paas/pull/1

Thanks.

On Mon, Dec 7, 2015 at 12:19 PM, Nishadi Kirielle <nish...@wso2.com> wrote:

> Hi,
>
> Thank you for the feedback.
>
> @Imesh:
> I have updated the README file[1] in mark down text format and will start
> writing the Wiki page.
>
> @Gayan:
> In the initial version, we have used sample json files as templates and
> used them to be default values. But as it has some conflicts, we have
> removed the use of template files. The current approach is to fetch the
> artifacts from the PPaaS 4.0.0 and convert it to PPaaS 4.1.0 without using
> any default values. I have updated the READ ME file [1]
>
> @Isuru:
> I will take the approach proposed to handle exceptions in
> OldArtifactLoader by wrapping them in a custom exception and update it. I
> will update the log4j properties file to be in the conf directory.
>
> [1]
> https://github.com/nishadi/product-private-paas/blob/master/tools/migration/ppaas-artifact-converter/README
>
> Thank you,
> Nishadi
>
> On Sun, Dec 6, 2015 at 9:28 AM, Isuru Haththotuwa <isu...@wso2.com> wrote:
>
>> Hi Malmee and Nishadi,
>>
>> Good progress in a short time!
>>
>> Had a glance at the code, couple of things I noticed:
>>
>>    1. log4j.properties file is available under conf directory as well as
>>    the resources directory. Ideally should be in conf directory.
>>    2. In the class OldArtifactLoader [1], the methods are throwing
>>    IOException in an error scenario. A better approach would be to wrap that
>>    with a custom exception (ex.: ArtifactLoadingException, etc.) and throw 
>> it.
>>    WDYT? In the class Transformation [2], this approach is followed.
>>
>> [1].
>> https://github.com/nishadi/product-private-paas/blob/master/tools/migration/ppaas-artifact-converter/src/main/java/org/wso2/ppaas/tools/artifactmigration/loader/OldArtifactLoader.java
>>
>> [2].
>> https://github.com/nishadi/product-private-paas/blob/master/tools/migration/ppaas-artifact-converter/src/main/java/org/wso2/ppaas/tools/artifactmigration/Transformation.java
>>
>> On Sat, Dec 5, 2015 at 10:25 PM, Gayan Gunarathne <gay...@wso2.com>
>> wrote:
>>
>>> Great stuff. This is a really important tool in the case of Private PaaS
>>> migration.
>>>
>>> As per the README[1] it mention as "Add the default values to the
>>> templates folder, if needed".I am not clear on that? Are we packing the
>>> 4.1.0 artifacts templates with the artifact migration tool? So user need to
>>> put the default values for those artifacts?
>>>
>>> [1]
>>> https://github.com/nishadi/product-private-paas/blob/master/tools/migration/ppaas-artifact-converter/README
>>>
>>> Thanks,
>>> Gayan
>>>
>>> On Fri, Dec 4, 2015 at 2:51 PM, Nishadi Kirielle <nish...@wso2.com>
>>> wrote:
>>>
>>>> Hi All,
>>>>
>>>> Currently,we are engaged in developing an artifact migration tool to be
>>>> used to fetch the artifact json files from PPaaS 4.0.0 REST API endpoints
>>>> and convert them to be compatible with PPaaS 4.1.0. [1]
>>>>
>>>> We have implemented the conversions for the following artifacts ;
>>>>    - auto scale policy artifacts
>>>>    - network partition list artifacts
>>>>    - deployment policy artifacts
>>>>    - cartridge artifacts
>>>>
>>>> Now we are implementing the conversion of cartridge subscription
>>>> artifacts to application signups and domain mapping subscriptions.
>>>>
>>>> Please raise if there are any concerns regarding this work.
>>>>
>>>> [1]
>>>> https://github.com/nishadi/product-private-paas/tree/master/tools/migration/ppaas-artifact-converter
>>>>
>>>> Thanks
>>>> Nishadi
>>>>
>>>> --
>>>> Nishadi Kirielle
>>>> *Software Engineering Intern*
>>>> Mobile : +94 (0) 714722148
>>>> nish...@wso2.com
>>>>
>>>> _______________________________________________
>>>> Dev mailing list
>>>> Dev@wso2.org
>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>>
>>>>
>>>
>>>
>>> --
>>>
>>> Gayan Gunarathne
>>> Technical Lead, WSO2 Inc. (http://wso2.com)
>>> Committer & PMC Member, Apache Stratos
>>> email : gay...@wso2.com  | mobile : +94 775030545 <%2B94%20766819985>
>>>
>>>
>>>
>>> _______________________________________________
>>> Dev mailing list
>>> Dev@wso2.org
>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>
>>>
>>
>>
>> --
>> Thanks and Regards,
>>
>> Isuru H.
>> +94 716 358 048* <http://wso2.com/>*
>>
>>
>>
>
>
> --
> Nishadi Kirielle
> *Software Engineering Intern*
> Mobile : +94 (0) 714722148
> nish...@wso2.com
>
> _______________________________________________
> Dev mailing list
> Dev@wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 
Akila Ravihansa Perera
WSO2 Inc.;  http://wso2.com/

Blog: http://ravihansa3000.blogspot.com
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to