Tabnine Logo
SoapOperation.setResponseStrategy
Code IndexAdd Tabnine to your IDE (free)

How to use
setResponseStrategy
method
in
com.castlemock.core.mock.soap.model.project.domain.SoapOperation

Best Java code snippets using com.castlemock.core.mock.soap.model.project.domain.SoapOperation.setResponseStrategy (Showing top 11 results out of 315)

origin: castlemock/castlemock

soapOperation.setHttpMethod(HttpMethod.POST);
soapOperation.setStatus(SoapOperationStatus.MOCKED);
soapOperation.setResponseStrategy(SoapResponseStrategy.RANDOM);
soapOperation.setForwardedEndpoint(address.getLocation());
soapOperation.setOriginalEndpoint(address.getLocation());
origin: castlemock/castlemock

@Test(expected = SoapException.class)
public void testMockedXpathNoMatchAndNoDefaultResponse(){
  // Input
  final HttpServletRequest httpServletRequest = getMockedHttpServletRequest(REQUEST_BODY);
  final HttpServletResponse httpServletResponse = getHttpServletResponse();
  final SoapOperation soapOperation = getSoapOperation();
  soapOperation.setResponseStrategy(SoapResponseStrategy.XPATH_INPUT);
  final IdentifySoapOperationOutput identifySoapOperationOutput = IdentifySoapOperationOutput.builder()
      .projectId(PROJECT_ID)
      .portId(SOAP_PORT_ID)
      .operationId(SOAP_OPERATION_ID)
      .operation(soapOperation)
      .build();
  when(serviceProcessor.process(any(IdentifySoapOperationInput.class))).thenReturn(identifySoapOperationOutput);
  when(httpServletRequest.getRequestURI()).thenReturn(CONTEXT + SLASH + MOCK + SLASH + SOAP + SLASH + PROJECT +
      SLASH + PROJECT_ID + SLASH + SOAP_PORT_ID);
  soapServiceController.postMethod(PROJECT_ID, httpServletRequest, httpServletResponse);
}
origin: castlemock/castlemock

@Test
public void testEcho(){
  // Input
  final HttpServletRequest httpServletRequest = getMockedHttpServletRequest(REQUEST_BODY);
  final HttpServletResponse httpServletResponse = getHttpServletResponse();
  final SoapOperation soapOperation = getSoapOperation();
  soapOperation.setResponseStrategy(SoapResponseStrategy.SEQUENCE);
  soapOperation.setStatus(SoapOperationStatus.ECHO);
  final IdentifySoapOperationOutput identifySoapOperationOutput = IdentifySoapOperationOutput.builder()
      .projectId(PROJECT_ID)
      .portId(SOAP_PORT_ID)
      .operationId(SOAP_OPERATION_ID)
      .operation(soapOperation)
      .build();
  when(serviceProcessor.process(any(IdentifySoapOperationInput.class))).thenReturn(identifySoapOperationOutput);
  when(httpServletRequest.getRequestURI()).thenReturn(CONTEXT + SLASH + MOCK + SLASH + SOAP + SLASH + PROJECT +
      SLASH + PROJECT_ID + SLASH + SOAP_PORT_ID);
  final ResponseEntity responseEntity = soapServiceController.postMethod(PROJECT_ID, httpServletRequest, httpServletResponse);
  Assert.assertEquals(REQUEST_BODY, responseEntity.getBody());
  Assert.assertEquals(HttpStatus.OK, responseEntity.getStatusCode());
  Assert.assertEquals(true, responseEntity.getHeaders().containsKey(CONTENT_TYPE_HEADER));
  Assert.assertEquals(false, responseEntity.getHeaders().containsKey(ACCEPT_HEADER));
  Assert.assertEquals(APPLICATION_XML, responseEntity.getHeaders().get(CONTENT_TYPE_HEADER).get(0));
}
origin: castlemock/castlemock

@Test
public void testMockedSequence(){
  // Input
  final HttpServletRequest httpServletRequest = getMockedHttpServletRequest(REQUEST_BODY);
  final HttpServletResponse httpServletResponse = getHttpServletResponse();
  final SoapOperation soapOperation = getSoapOperation();
  soapOperation.setResponseStrategy(SoapResponseStrategy.SEQUENCE);
  final IdentifySoapOperationOutput identifySoapOperationOutput = IdentifySoapOperationOutput.builder()
      .projectId(PROJECT_ID)
      .portId(SOAP_PORT_ID)
      .operationId(SOAP_OPERATION_ID)
      .operation(soapOperation)
      .build();
  when(serviceProcessor.process(any(IdentifySoapOperationInput.class))).thenReturn(identifySoapOperationOutput);
  when(httpServletRequest.getRequestURI()).thenReturn(CONTEXT + SLASH + MOCK + SLASH + SOAP + SLASH + PROJECT +
      SLASH + PROJECT_ID + SLASH + SOAP_PORT_ID);
  final ResponseEntity responseEntity = soapServiceController.postMethod(PROJECT_ID, httpServletRequest, httpServletResponse);
  Assert.assertEquals(RESPONSE_BODY, responseEntity.getBody());
  Assert.assertEquals(HttpStatus.OK, responseEntity.getStatusCode());
  Assert.assertEquals(true, responseEntity.getHeaders().containsKey(CONTENT_TYPE_HEADER));
  Assert.assertEquals(true, responseEntity.getHeaders().containsKey(ACCEPT_HEADER));
  Assert.assertEquals(APPLICATION_XML, responseEntity.getHeaders().get(CONTENT_TYPE_HEADER).get(0));
  Assert.assertEquals(APPLICATION_XML, responseEntity.getHeaders().get(ACCEPT_HEADER).get(0));
}
origin: castlemock/castlemock

@Test
public void testMockedXpathMatch(){
  // Input
  final HttpServletRequest httpServletRequest = getMockedHttpServletRequest(REQUEST_BODY);
  final HttpServletResponse httpServletResponse = getHttpServletResponse();
  final SoapXPathExpression xPathExpression = new SoapXPathExpression();
  xPathExpression.setExpression("//ServiceName/value[text()='Input']");
  final SoapOperation soapOperation = getSoapOperation();
  soapOperation.getMockResponses().get(0).getXpathExpressions().add(xPathExpression);
  soapOperation.setResponseStrategy(SoapResponseStrategy.XPATH_INPUT);
  final IdentifySoapOperationOutput identifySoapOperationOutput = IdentifySoapOperationOutput.builder()
      .projectId(PROJECT_ID)
      .portId(SOAP_PORT_ID)
      .operationId(SOAP_OPERATION_ID)
      .operation(soapOperation)
      .build();
  when(serviceProcessor.process(any(IdentifySoapOperationInput.class))).thenReturn(identifySoapOperationOutput);
  when(httpServletRequest.getRequestURI()).thenReturn(CONTEXT + SLASH + MOCK + SLASH + SOAP + SLASH + PROJECT +
      SLASH + PROJECT_ID + SLASH + SOAP_PORT_ID);
  final ResponseEntity responseEntity = soapServiceController.postMethod(PROJECT_ID, httpServletRequest, httpServletResponse);
  Assert.assertEquals(RESPONSE_BODY, responseEntity.getBody());
  Assert.assertEquals(HttpStatus.OK, responseEntity.getStatusCode());
  Assert.assertEquals(true, responseEntity.getHeaders().containsKey(CONTENT_TYPE_HEADER));
  Assert.assertEquals(true, responseEntity.getHeaders().containsKey(ACCEPT_HEADER));
  Assert.assertEquals(APPLICATION_XML, responseEntity.getHeaders().get(CONTENT_TYPE_HEADER).get(0));
  Assert.assertEquals(APPLICATION_XML, responseEntity.getHeaders().get(ACCEPT_HEADER).get(0));
}
origin: castlemock/castlemock

@Test
public void testMockedXpathDefaultResponse(){
  // Input
  final HttpServletRequest httpServletRequest = getMockedHttpServletRequest(REQUEST_BODY);
  final HttpServletResponse httpServletResponse = getHttpServletResponse();
  final SoapOperation soapOperation = getSoapOperation();
  soapOperation.setDefaultResponseName("Mocked response");
  soapOperation.setDefaultMockResponseId("MockResponseId");
  soapOperation.setResponseStrategy(SoapResponseStrategy.XPATH_INPUT);
  final IdentifySoapOperationOutput identifySoapOperationOutput = IdentifySoapOperationOutput.builder()
      .projectId(PROJECT_ID)
      .portId(SOAP_PORT_ID)
      .operationId(SOAP_OPERATION_ID)
      .operation(soapOperation)
      .build();
  when(serviceProcessor.process(any(IdentifySoapOperationInput.class))).thenReturn(identifySoapOperationOutput);
  when(httpServletRequest.getRequestURI()).thenReturn(CONTEXT + SLASH + MOCK + SLASH + SOAP + SLASH + PROJECT +
      SLASH + PROJECT_ID + SLASH + SOAP_PORT_ID);
  final ResponseEntity responseEntity = soapServiceController.postMethod(PROJECT_ID, httpServletRequest, httpServletResponse);
  Assert.assertEquals(RESPONSE_BODY, responseEntity.getBody());
  Assert.assertEquals(HttpStatus.OK, responseEntity.getStatusCode());
  Assert.assertEquals(true, responseEntity.getHeaders().containsKey(CONTENT_TYPE_HEADER));
  Assert.assertEquals(true, responseEntity.getHeaders().containsKey(ACCEPT_HEADER));
  Assert.assertEquals(APPLICATION_XML, responseEntity.getHeaders().get(CONTENT_TYPE_HEADER).get(0));
  Assert.assertEquals(APPLICATION_XML, responseEntity.getHeaders().get(ACCEPT_HEADER).get(0));
}
origin: castlemock/castlemock

@Test
public void testMockedRandom(){
  // Input
  final HttpServletRequest httpServletRequest = getMockedHttpServletRequest(REQUEST_BODY);
  final HttpServletResponse httpServletResponse = getHttpServletResponse();
  final SoapOperation soapOperation = getSoapOperation();
  soapOperation.setResponseStrategy(SoapResponseStrategy.RANDOM);
  final IdentifySoapOperationOutput identifySoapOperationOutput = IdentifySoapOperationOutput.builder()
      .projectId(PROJECT_ID)
      .portId(SOAP_PORT_ID)
      .operationId(SOAP_OPERATION_ID)
      .operation(soapOperation)
      .build();
  when(serviceProcessor.process(any(IdentifySoapOperationInput.class))).thenReturn(identifySoapOperationOutput);
  when(httpServletRequest.getRequestURI()).thenReturn(CONTEXT + SLASH + MOCK + SLASH + SOAP + SLASH + PROJECT +
      SLASH + PROJECT_ID + SLASH + SOAP_PORT_ID);
  final ResponseEntity responseEntity = soapServiceController.postMethod(PROJECT_ID, httpServletRequest, httpServletResponse);
  Assert.assertEquals(RESPONSE_BODY, responseEntity.getBody());
  Assert.assertEquals(HttpStatus.OK, responseEntity.getStatusCode());
  Assert.assertEquals(true, responseEntity.getHeaders().containsKey(CONTENT_TYPE_HEADER));
  Assert.assertEquals(true, responseEntity.getHeaders().containsKey(ACCEPT_HEADER));
  Assert.assertEquals(APPLICATION_XML, responseEntity.getHeaders().get(CONTENT_TYPE_HEADER).get(0));
  Assert.assertEquals(APPLICATION_XML, responseEntity.getHeaders().get(ACCEPT_HEADER).get(0));
}
origin: castlemock/castlemock

@Test
public void testMTOM() throws IOException {
  // Input
  final HttpServletRequest httpServletRequest = getMockedMultipartHttpServletRequest(REQUEST_MTOM_BODY);
  final HttpServletResponse httpServletResponse = getHttpServletResponse();
  final SoapOperation soapOperation = getSoapOperation();
  soapOperation.setResponseStrategy(SoapResponseStrategy.SEQUENCE);
  final IdentifySoapOperationOutput identifySoapOperationOutput = IdentifySoapOperationOutput.builder()
      .projectId(PROJECT_ID)
      .portId(SOAP_PORT_ID)
      .operationId(SOAP_OPERATION_ID)
      .operation(soapOperation)
      .build();
  when(serviceProcessor.process(any(IdentifySoapOperationInput.class))).thenReturn(identifySoapOperationOutput);
  when(httpServletRequest.getRequestURI()).thenReturn(CONTEXT + SLASH + MOCK + SLASH + SOAP + SLASH + PROJECT +
      SLASH + PROJECT_ID + SLASH + SOAP_PORT_ID);
  final ResponseEntity responseEntity = soapServiceController.postMethod(PROJECT_ID, httpServletRequest, httpServletResponse);
  Assert.assertEquals(RESPONSE_BODY, responseEntity.getBody());
  Assert.assertEquals(HttpStatus.OK, responseEntity.getStatusCode());
  Assert.assertEquals(true, responseEntity.getHeaders().containsKey(CONTENT_TYPE_HEADER));
  Assert.assertEquals(true, responseEntity.getHeaders().containsKey(ACCEPT_HEADER));
  Assert.assertEquals(APPLICATION_XML, responseEntity.getHeaders().get(CONTENT_TYPE_HEADER).get(0));
  Assert.assertEquals(APPLICATION_XML, responseEntity.getHeaders().get(ACCEPT_HEADER).get(0));
}
origin: castlemock/castlemock

soapOperation.setName("SOAP operation name");
soapOperation.setNetworkDelay(0L);
soapOperation.setResponseStrategy(SoapResponseStrategy.SEQUENCE);
soapOperation.setSimulateNetworkDelay(false);
soapOperation.setStatus(SoapOperationStatus.MOCKED);
origin: castlemock/castlemock

  /**
   * The process message is responsible for processing an incoming serviceTask and generate
   * a response based on the incoming serviceTask input
   * @param serviceTask The serviceTask that will be processed by the service
   * @return A result based on the processed incoming serviceTask
   * @see ServiceTask
   * @see ServiceResult
   */
  @Override
  public ServiceResult<UpdateSoapOperationOutput> process(final ServiceTask<UpdateSoapOperationInput> serviceTask) {
    final UpdateSoapOperationInput input = serviceTask.getInput();
    final SoapOperation updated = input.getOperation();
    final SoapOperation soapOperation = this.operationRepository.findOne(input.getOperationId());

    soapOperation.setStatus(updated.getStatus());
    soapOperation.setForwardedEndpoint(updated.getForwardedEndpoint());
    soapOperation.setResponseStrategy(updated.getResponseStrategy());
    soapOperation.setSimulateNetworkDelay(updated.getSimulateNetworkDelay());
    soapOperation.setNetworkDelay(updated.getNetworkDelay());
    soapOperation.setDefaultMockResponseId(updated.getDefaultMockResponseId());
    soapOperation.setMockOnFailure(updated.getMockOnFailure());
    soapOperation.setIdentifyStrategy(updated.getIdentifyStrategy());

    final SoapOperation updatedSoapOperation = this.operationRepository.update(input.getOperationId(), soapOperation);
    return createServiceResult(UpdateSoapOperationOutput.builder()
        .operation(updatedSoapOperation)
        .build());
  }
}
origin: castlemock/castlemock

operation.setId(operationV1.getId());
operation.setName(operationV1.getName());
operation.setResponseStrategy(operationV1.getResponseStrategy());
operation.setStatus(operationV1.getStatus());
operation.setHttpMethod(operationV1.getHttpMethod());
com.castlemock.core.mock.soap.model.project.domainSoapOperationsetResponseStrategy

Popular methods of SoapOperation

  • <init>
  • setHttpMethod
  • setName
  • getMockResponses
  • setCurrentResponseSequenceIndex
  • setForwardedEndpoint
  • setSoapVersion
  • setStatus
  • getId
  • getName
  • setDefaultBody
  • setId
  • setDefaultBody,
  • setId,
  • setIdentifyStrategy,
  • setInvokeAddress,
  • setMockResponses,
  • setNetworkDelay,
  • setOriginalEndpoint,
  • setPortId,
  • setSimulateNetworkDelay

Popular in Java

  • Parsing JSON documents to java classes using gson
  • setScale (BigDecimal)
  • getSupportFragmentManager (FragmentActivity)
  • runOnUiThread (Activity)
  • File (java.io)
    An "abstract" representation of a file system entity identified by a pathname. The pathname may be a
  • Socket (java.net)
    Provides a client-side TCP socket.
  • Connection (java.sql)
    A connection represents a link from a Java application to a database. All SQL statements and results
  • DateFormat (java.text)
    Formats or parses dates and times.This class provides factories for obtaining instances configured f
  • ImageIO (javax.imageio)
  • Table (org.hibernate.mapping)
    A relational table
  • From CI to AI: The AI layer in your organization
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now