Class SoapServiceRule

java.lang.Object
org.junit.rules.ExternalResource
com.github.skjolber.mockito.soap.SoapServiceRule
All Implemented Interfaces:
org.junit.rules.TestRule
Direct Known Subclasses:
SoapEndpointRule, SoapServerRule

public abstract class SoapServiceRule extends org.junit.rules.ExternalResource
Rule for mocking SOAP services.
Author:
thomas.skjolberg@gmail.com
  • Constructor Details

    • SoapServiceRule

      public SoapServiceRule()
  • Method Details

    • newInstance

      public static SoapServiceRule newInstance()
    • newInstance

      public static SoapEndpointRule newInstance(String... portNames)
    • newInstance

      public static SoapEndpointRule newInstance(int portRangeStart, int portRangeEnd, String... portNames)
    • proxy

      public <T> void proxy(T target, Class<T> port, String address, String wsdlLocation, List<String> schemaLocations)
      Create (and start) an endpoint.
      Type Parameters:
      T - the type of the mocked class
      Parameters:
      target - instance calls are forwarded to
      port - service class
      address - address, i.e. http://localhost:1234
      wsdlLocation - wsdl location, or null
      schemaLocations - schema locations, or null
    • proxy

      public abstract <T> void proxy(T target, Class<T> port, String address, String wsdlLocation, List<String> schemaLocations, Map<String,Object> properties)
      Create (and start) an endpoint with the given properties.
      Type Parameters:
      T - the type of the mocked class
      Parameters:
      target - instance calls are forwarded to
      port - service class
      address - address, i.e. http://localhost:1234
      wsdlLocation - wsdl location, or null
      schemaLocations - schema locations, or null
      properties - additional properties, like mtom-enabled etc.
    • mock

      public <T> T mock(Class<T> port, String address)
      Create (and start) service endpoint with mock delegate. No schema validation.
      Type Parameters:
      T - class to be mocked
      Parameters:
      port - service class
      address - address, i.e. http://localhost:1234
      Returns:
      the mockito mock to which server calls are delegated
    • mock

      public <T> T mock(Class<T> port, String address, Map<String,Object> properties)
      Create (and start) service endpoint with mock delegate. No schema validation.
      Type Parameters:
      T - class to be mocked
      Parameters:
      port - service class
      address - address, i.e. http://localhost:1234
      properties - additional properties, like mtom-enabled etc.
      Returns:
      the mockito mock to which server calls are delegated
    • mock

      public <T> T mock(Class<T> port, String address, String wsdlLocation)
      Create (and start) service endpoint with mock delegate.
      Type Parameters:
      T - class to be mocked
      Parameters:
      port - service class
      address - address, i.e. http://localhost:1234
      wsdlLocation - wsdl location
      Returns:
      the mockito mock to which server calls are delegated
    • mock

      public <T> T mock(Class<T> port, String address, String wsdlLocation, Map<String,Object> properties)
      Create (and start) service endpoint with mock delegate.
      Type Parameters:
      T - class to be mocked
      Parameters:
      port - service class
      address - address, i.e. http://localhost:1234
      wsdlLocation - wsdl location
      properties - additional properties, like mtom-enabled etc.
      Returns:
      the mockito mock to which server calls are delegated
    • mock

      public <T> T mock(Class<T> port, String address, List<String> schemaLocations)
      Create (and start) service endpoint with mock delegate.
      Type Parameters:
      T - class to be mocked
      Parameters:
      port - service class
      address - address, i.e. http://localhost:1234
      schemaLocations - schema locations
      Returns:
      the mockito mock to which server calls are delegated
    • mock

      public <T> T mock(Class<T> port, String address, List<String> schemaLocations, Map<String,Object> properties)
      Create (and start) service with mock delegate and additional properties.
      Type Parameters:
      T - class to be mocked
      Parameters:
      port - service class
      address - address, i.e. http://localhost:1234
      schemaLocations - schema locations
      properties - additional properties, like mtom-enabled and so
      Returns:
      the mockito mock to which server calls are delegated
    • assertValidParams

      protected <T> void assertValidParams(T target, Class<T> port, String address)
    • assertValidAddress

      protected void assertValidAddress(String address)
    • parsePort

      protected int parsePort(String address)
    • processProperties

      protected Map<String,Object> processProperties(Map<String,Object> properties, String wsdlLocation, List<String> schemaLocations)
    • properties

      public static Map<String,Object> properties(Object... properties)
    • verifyProperties

      protected static void verifyProperties(Object... properties)
    • stop

      public abstract void stop()
      Stop services.
    • start

      public abstract void start()
      (Re)start services.