public String execService( String service, boolean retry ) throws Exception {
    int tries = 0;
    int maxRetries = 0;
    if ( retry ) {
      maxRetries = KETTLE_CARTE_RETRIES;
    }
    while ( true ) {
      try {
        return execService( service );
      } catch ( Exception e ) {
        if ( tries >= maxRetries ) {
          throw e;
        } else {
          try {
            Thread.sleep( getDelay( tries ) );
          } catch ( InterruptedException e2 ) {
            //ignore
          }
        }
      }
      tries++;
    }
  }
@Test( expected = NullPointerException.class )
  public void testExecService() throws Exception {
    HttpGet httpGetMock = mock( HttpGet.class );
    URI uriMock = new URI( "fake" );
    doReturn( uriMock ).when( httpGetMock ).getURI();
    doReturn( httpGetMock ).when( slaveServer ).buildExecuteServiceMethod( anyString(), anyMap() );
    slaveServer.setHostname( "hostNameStub" );
    slaveServer.setUsername( "userNAmeStub" );
    slaveServer.execService( "wrong_app_name" );
    fail( "Incorrect connection details had been used, but no exception was thrown" );
  }