[ 
https://issues.apache.org/jira/browse/STRATOS-1628?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15020465#comment-15020465
 ] 

ASF GitHub Bot commented on STRATOS-1628:
-----------------------------------------

Github user lahirus commented on a diff in the pull request:

    https://github.com/apache/stratos/pull/492#discussion_r45546039
  
    --- Diff: 
components/org.apache.stratos.mock.iaas.client/src/main/java/org/apache/stratos/mock/iaas/client/MockIaasApiClient.java
 ---
    @@ -48,6 +49,20 @@ public MockIaasApiClient(String endpoint) {
             this.endpoint = endpoint;
         }
     
    +    public boolean isMockIaaSReady() {
    +        try {
    +            URI uri = new URIBuilder(endpoint + INIT_CONTEXT).build();
    +            HttpResponse response = restClient.doGet(uri);
    +            if (response != null) {
    +                return response.getStatusCode() == 200;
    +            }
    +            throw new RuntimeException("An unknown error occurred");
    +        } catch (Exception e) {
    +            String message = "Could not check whether mock-iaas is active";
    +            throw new RuntimeException(message, e);
    --- End diff --
    
    Let's use custom exceptions instead of RuntimeException.


> Improve the way intergration test determines whether the server is ready or 
> not
> -------------------------------------------------------------------------------
>
>                 Key: STRATOS-1628
>                 URL: https://issues.apache.org/jira/browse/STRATOS-1628
>             Project: Stratos
>          Issue Type: Improvement
>          Components: Integration Framework, Mock IaaS
>            Reporter: Rajkumar Rajaratnam
>            Assignee: Rajkumar Rajaratnam
>
> Currently, integrations test is looking at specific log messages to determine 
> whether the stratos server is ready to handle request or not. Proper way 
> would be to check with an API whether the server is ready or not. I propose 
> we need to handle this in the following way.
> a) exposing an API in mock API to check whether mock iaas is activated or not.
> b) integration tests should be started after getting a positive response from 
> the above API.
> As per our component start up order, the above solution will make sure that 
> every component is ready to handle requests.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to