Class S3TestCredentials


  • public class S3TestCredentials
    extends Object
    Access to credentials to access S3 buckets during integration tests.
    • Constructor Detail

      • S3TestCredentials

        public S3TestCredentials()
    • Method Detail

      • hasStaticCredentials

        public static boolean hasStaticCredentials()
        Checks whether static access/secret keys are configured. When they are not, tests should leave credentials to the default AWS provider chain instead of pinning keys into config.
      • assumeCredentialsAvailable

        public static void assumeCredentialsAvailable()
        Checks whether an S3 test bucket is configured in the environment variables of this JVM. If not, throws an AssumptionViolatedException which causes JUnit tests to be skipped. This does not check for static access/secret keys; tests that need them should use assumeStaticCredentialsAvailable().
      • assumeStaticCredentialsAvailable

        public static void assumeStaticCredentialsAvailable()
        Checks whether static access/secret keys are available. If not, throws an AssumptionViolatedException so JUnit skips tests that specifically require static keys (e.g. credential-key forwarding tests) rather than the default AWS provider chain.
      • getTestBucketUri

        public static String getTestBucketUri()
        Gets the URI for the path under which all tests should put their data.

        This method throws an exception if the bucket was not configured. Tests should use assumeCredentialsAvailable() to skip tests when no bucket is configured.

      • getTestBucketUriWithScheme

        public static String getTestBucketUriWithScheme​(String scheme)
        Gets the URI for the path under which all tests should put their data.

        This method throws an exception if the bucket was not configured. Tests should use assumeCredentialsAvailable() to skip tests when no bucket is configured.