Class S3MockStarter


  • public abstract class S3MockStarter
    extends java.lang.Object
    Helps configuring and starting the S3Mock app and provides a configured client for it.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected S3MockStarter​(java.util.Map<java.lang.String,​java.lang.Object> properties)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      com.amazonaws.ClientConfiguration configureClientToIgnoreInvalidSslCertificates​(com.amazonaws.ClientConfiguration clientConfiguration)
      Adjusts the given client configuration to allow the communication with the mock server using HTTPS, although that one uses a self-signed SSL certificate.
      com.amazonaws.services.s3.AmazonS3 createS3Client()
      Creates an AmazonS3 client instance that is configured to call the started S3Mock server using HTTPS.
      com.amazonaws.services.s3.AmazonS3 createS3Client​(java.lang.String region)
      Creates an AmazonS3 client instance that is configured to call the started S3Mock server using HTTPS for a given region.
      software.amazon.awssdk.services.s3.S3Client createS3ClientV2()
      Creates an S3Client client instance that is configured to call the started S3Mock server using HTTPS.
      protected java.util.Map<java.lang.String,​java.lang.Object> defaultProps()  
      protected com.amazonaws.client.builder.AwsClientBuilder.EndpointConfiguration getEndpointConfiguration​(java.lang.String region)  
      int getHttpPort()  
      int getPort()  
      java.lang.String getServiceEndpoint()
      Returns endpoint URL for connecting to the mock server.
      void registerKMSKeyRef​(java.lang.String keyRef)
      Registers a valid KMS key reference in the mock server.
      protected void start()  
      protected void stop()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • properties

        protected final java.util.Map<java.lang.String,​java.lang.Object> properties
    • Constructor Detail

      • S3MockStarter

        protected S3MockStarter​(java.util.Map<java.lang.String,​java.lang.Object> properties)
    • Method Detail

      • defaultProps

        protected java.util.Map<java.lang.String,​java.lang.Object> defaultProps()
      • createS3ClientV2

        public software.amazon.awssdk.services.s3.S3Client createS3ClientV2()
        Creates an S3Client client instance that is configured to call the started S3Mock server using HTTPS.
        Returns:
        The S3Client instance.
      • createS3Client

        public com.amazonaws.services.s3.AmazonS3 createS3Client()
        Creates an AmazonS3 client instance that is configured to call the started S3Mock server using HTTPS.
        Returns:
        The AmazonS3 instance.
      • createS3Client

        public com.amazonaws.services.s3.AmazonS3 createS3Client​(java.lang.String region)
        Creates an AmazonS3 client instance that is configured to call the started S3Mock server using HTTPS for a given region.
        Parameters:
        region - Region to define regional endpoint.
        Returns:
        The AmazonS3 instance.
      • getPort

        public int getPort()
      • getHttpPort

        public int getHttpPort()
      • registerKMSKeyRef

        public void registerKMSKeyRef​(java.lang.String keyRef)
        Registers a valid KMS key reference in the mock server.
        Parameters:
        keyRef - A KMS Key Reference
      • configureClientToIgnoreInvalidSslCertificates

        public com.amazonaws.ClientConfiguration configureClientToIgnoreInvalidSslCertificates​(com.amazonaws.ClientConfiguration clientConfiguration)
        Adjusts the given client configuration to allow the communication with the mock server using HTTPS, although that one uses a self-signed SSL certificate.
        Parameters:
        clientConfiguration - The ClientConfiguration to adjust.
        Returns:
        The adjusted instance.
      • getEndpointConfiguration

        protected com.amazonaws.client.builder.AwsClientBuilder.EndpointConfiguration getEndpointConfiguration​(java.lang.String region)
      • getServiceEndpoint

        public java.lang.String getServiceEndpoint()
        Returns endpoint URL for connecting to the mock server.
        Returns:
        endpoint URL for connecting to the mock server.
      • start

        protected void start()
      • stop

        protected void stop()