1616import org .slf4j .LoggerFactory ;
1717
1818import static org .apache .commons .lang3 .StringUtils .isEmpty ;
19- import static org .jsmart .zerocode .core .engine .mocker .RestEndPointMocker .createWithLocalMock ;
20- import static org .jsmart .zerocode .core .engine .mocker .RestEndPointMocker .createWithVirtuosoMock ;
2119import static org .jsmart .zerocode .core .utils .SmartUtils .prettyPrintJson ;
2220
2321public class HttpApiExecutorImpl implements HttpApiExecutor {
@@ -43,16 +41,6 @@ public String execute(String httpUrl, String methodName, String requestJson) thr
4341 HashMap headers = (HashMap ) readJsonPathOrElseNull (requestJson , "$.headers" );
4442 Object bodyContent = readJsonPathOrElseNull (requestJson , "$.body" );
4543
46- /*
47- * $MOCK: Create mock endpoints supplied for this scenario
48- */
49- if (completedMockingEndPoints (httpUrl , requestJson , methodName , bodyContent )) {
50- /*
51- * All mocks done? Then return a success message
52- */
53- return "{\" status\" : 200}" ;
54- }
55-
5644 final HttpResponse serverResponse = httpClient .execute (httpUrl , methodName , headers , queryParams , bodyContent );
5745
5846 /*
@@ -99,28 +87,6 @@ private Response deriveZeroCodeResponseFrom(int responseStatus,
9987 return new Response (responseStatus , responseHeaders , jsonBody , rawBody , null );
10088 }
10189
102- private boolean completedMockingEndPoints (String httpUrl , String requestJson , String methodName , Object bodyContent ) throws java .io .IOException {
103- if (httpUrl .contains ("/$MOCK" ) && methodName .equals ("$USE.VIRTUOSO" )) {
104- LOGGER .debug ("\n #body:\n " + bodyContent );
105-
106- //read the content of the "request". This contains the complete rest API.
107- createWithVirtuosoMock (bodyContent != null ? bodyContent .toString () : null );
108-
109- LOGGER .debug ("#SUCCESS: End point simulated via virtuoso." );
110- return true ;
111- } else if (httpUrl .contains ("/$MOCK" ) && methodName .equals ("$USE.SIMULATOR" )) {
112- LOGGER .debug ("\n #body:\n " + bodyContent );
113-
114- //read the content of the "request". This contains the complete rest API.
115- createWithLocalMock (bodyContent != null ? bodyContent .toString () : null );
116-
117- LOGGER .debug ("#SUCCESS: End point simulated via local simulator." );
118-
119- return true ;
120- }
121- return false ;
122- }
123-
12490 private Object readJsonPathOrElseNull (String requestJson , String jsonPath ) {
12591 try {
12692 return JsonPath .read (requestJson , jsonPath );
0 commit comments