@Then("^I check status of nodes '(.+?)' using environment variable '(.+?)'(,'(.+?)')? in less than '(\\d+?)' seconds, checking each '(\\d+?)' seconds, I send a '(.+?)' request to '(.+?)' checking status '(.+?)' of nodes$")
    public void checkProxyNodesStatus(String role, String envVar, String foo, String envVar2, Integer timeout, Integer wait, String requestType, String endPoint, String status) throws Exception {

        String estadoNodo = "";

        RestSpec restspec = new RestSpec(commonspec);

        //datanodes
        selectElements(role, "pbd", "name");
        String[] dataNodes = ThreadProperty.get("elementsConstraint").split("\"\"");

        //Si tenemos algún DataNode caído, chequeamos los datanodeSlave de ese dataNode
        if (role.contains("datanode_slave") && envVar2 != null) {

            for (int i = 0; i < dataNodes.length; i++) {

                if (dataNodes[i].split("_")[1].contains(ThreadProperty.get(envVar2).split("_")[1])) {
                    estadoNodo = status;
                } else {
                    estadoNodo = "RUNNING";
                }
                restspec.sendRequestTimeout(timeout, wait, requestType, endPoint, dataNodes[i], "", "\"" + dataNodes[i] + "\",\"role\":\"" + role + "\",\"status\":\"" + estadoNodo + "\"");
            }

        } else {
            for (int i = 0; i < dataNodes.length; i++) {
                if (dataNodes[i].contains(ThreadProperty.get(envVar)) && !ThreadProperty.get(envVar).isEmpty()) {
                    estadoNodo = status;
                } else {
                    estadoNodo = "RUNNING";
                }
                restspec.sendRequestTimeout(timeout, wait, requestType, endPoint, dataNodes[i], "", "\"" + dataNodes[i] + "\",\"role\":\"" + role + "\",\"status\":\"" + estadoNodo + "\"");
            }
        }


    }
@ Then ( "^I check status of nodes '(.+?)' using environment variable '(.+?)'(,'(.+?)')? in less than '(\\d+?)' seconds, checking each '(\\d+?)' seconds, I send a '(.+?)' request to '(.+?)' checking status '(.+?)' of nodes$" ) public void checkProxyNodesStatus ( String role , String envVar , String foo , String envVar2 , Integer timeout , Integer wait , String requestType , String endPoint , String status ) throws Exception { String estadoNodo = "" ; RestSpec restspec = new RestSpec ( commonspec ) ; selectElements ( role , "pbd" , "name" ) ; String [ ] dataNodes = ThreadProperty . get ( "elementsConstraint" ) . split ( "\"\"" ) ; if ( role . contains ( "datanode_slave" ) && envVar2 != null ) { for ( int i = 0 ; i < dataNodes . length ; i ++ ) { if ( dataNodes [ i ] . split ( "_" ) [ 1 ] . contains ( ThreadProperty . get ( envVar2 ) . split ( "_" ) [ 1 ] ) ) { estadoNodo = status ; } else { estadoNodo = "RUNNING" ; } restspec . sendRequestTimeout ( timeout , wait , requestType , endPoint , dataNodes [ i ] , "" , "\"" + dataNodes [ i ] + "\",\"role\":\"" + role + "\",\"status\":\"" + estadoNodo + "\"" ) ; } } else { for ( int i = 0 ; i < dataNodes . length ; i ++ ) { if ( dataNodes [ i ] . contains ( ThreadProperty . get ( envVar ) ) && ! ThreadProperty . get ( envVar ) . isEmpty ( ) ) { estadoNodo = status ; } else { estadoNodo = "RUNNING" ; } restspec . sendRequestTimeout ( timeout , wait , requestType , endPoint , dataNodes [ i ] , "" , "\"" + dataNodes [ i ] + "\",\"role\":\"" + role + "\",\"status\":\"" + estadoNodo + "\"" ) ; } } }
@param role        name of role of a service
@param envVar      environment variable where before you save nodes
@param foo         parameter generated by cucumber because of the optional expression
@param envVar2     environment variable when you want to check slave nodes
@param timeout     Same RestSpec.sendRequest
@param wait        Same RestSpec.sendRequest
@param requestType Same RestSpec.sendRequest
@param endPoint    Same RestSpec.sendRequest
@param status      Same RestSpec.sendRequest
@throws Exception