String logPrefix = "----- MOCK_CONFIGURATION - MOCK_7 - start: "; def SERVER7mock def runner try { SERVER7mock = context.mockService.project.getRestMockServiceByName("SERVER-7_REST_MOCK") } catch(Exception e){ log.warn logPrefix + "Return catch exception SERVER7mock: " + e.getMessage() requestContext.myResponse = "Exception SERVER7mock: " + e.getMessage() return "error" } try { //runner = SERVER7mock.getMockRunner().isRunning() runner = SERVER7mock.getMockRunner() } catch(Exception e){ log.warn logPrefix + "Return catch exception runner: " + e.getMessage() requestContext.myResponse = "Exception runner: " + e.getMessage() return "error" } // is runnign? then skip this.. if (runner != null) { log.info logPrefix + "MOCK A_REST_MOCK is UP = skip starting."; return "OK"; } if (SERVER7mock == null){ log.warn logPrefix + "ERROR: MOCK A_REST_MOCK not found!" requestContext.myResponse = "ERROR: MOCK A_REST_MOCK not found!" return "error" } else{ SERVER7mock.start(); //context.mockRunner = SERVER7mock log.info logPrefix + "was started." return "OK" }