Class S3MockStarter
- java.lang.Object
-
- com.adobe.testing.s3mock.testsupport.common.S3MockStarter
-
public abstract class S3MockStarter extends java.lang.ObjectHelps configuring and starting the S3Mock app and provides a configured client for it.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classS3MockStarter.BaseBuilder<T extends S3MockStarter>
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Map<java.lang.String,java.lang.Object>propertiesprotected S3MockApplications3MockFileStore
-
Constructor Summary
Constructors Modifier Constructor Description protectedS3MockStarter(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.ClientConfigurationconfigureClientToIgnoreInvalidSslCertificates(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.AmazonS3createS3Client()Creates anAmazonS3client instance that is configured to call the started S3Mock server using HTTPS.com.amazonaws.services.s3.AmazonS3createS3Client(java.lang.String region)Creates anAmazonS3client instance that is configured to call the started S3Mock server using HTTPS for a given region.software.amazon.awssdk.services.s3.S3ClientcreateS3ClientV2()Creates anS3Clientclient 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.EndpointConfigurationgetEndpointConfiguration(java.lang.String region)intgetHttpPort()intgetPort()java.lang.StringgetServiceEndpoint()Returns endpoint URL for connecting to the mock server.voidregisterKMSKeyRef(java.lang.String keyRef)Registers a valid KMS key reference in the mock server.protected voidstart()protected voidstop()
-
-
-
Field Detail
-
s3MockFileStore
protected S3MockApplication s3MockFileStore
-
properties
protected final 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 anS3Clientclient instance that is configured to call the started S3Mock server using HTTPS.- Returns:
- The
S3Clientinstance.
-
createS3Client
public com.amazonaws.services.s3.AmazonS3 createS3Client()
Creates anAmazonS3client instance that is configured to call the started S3Mock server using HTTPS.- Returns:
- The
AmazonS3instance.
-
createS3Client
public com.amazonaws.services.s3.AmazonS3 createS3Client(java.lang.String region)
Creates anAmazonS3client 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
AmazonS3instance.
-
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- TheClientConfigurationto 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()
-
-