}
public static void main(String[] args) throws Exception {
Properties testProperties = loadTestProperties();
AWSCredentials awsCredentials = loadAWSCredentials(testProperties);
String filename = testProperties.getProperty("filename");
String bucketName = testProperties.getProperty("bucketName");
String contentType = testProperties.getProperty("contentType", "application/octet-stream");
String serverHostname = testProperties.getProperty("serverHostname", "s3.amazonaws.com");
String bufferSizeStr = testProperties.getProperty("bufferSize", "2048");
int byteBufferSize = Integer.parseInt(bufferSizeStr);
int port = 80;
boolean isSslEnabled;
String enableSslStr = testProperties.getProperty("enableSSL", "false");
if ("true".equalsIgnoreCase(enableSslStr)) {
isSslEnabled = true;
port = 443;
} else if ("false".equalsIgnoreCase(enableSslStr)) {
isSslEnabled = false;
} else {
throw new IllegalArgumentException("Boolean value '" + enableSslStr
+ "' for property 'enableSSL' must be 'true' or 'false' (case-insensitive)");
}
// Over-ride default server ports (80, 443) if a special port is configured.
String serverPortStr = testProperties.getProperty("serverPort", null);
if (serverPortStr != null) {
port = Integer.parseInt(serverPortStr);
}
boolean isS3AuthEnabled;
String disableS3FeaturesStr = testProperties.getProperty("disableS3Features", "false");
if ("true".equalsIgnoreCase(disableS3FeaturesStr)) {
isS3AuthEnabled = false;
} else if ("false".equalsIgnoreCase(disableS3FeaturesStr)) {
isS3AuthEnabled = true;
} else {
throw new IllegalArgumentException("Boolean value '" + disableS3FeaturesStr
+ "' for property 'disableS3Features' must be 'true' or 'false' (case-insensitive)");
}
boolean isBugBehaviourEnabled;
String enableBugBehaviourStr = testProperties.getProperty("enableBugBehaviour", "false");
if ("true".equalsIgnoreCase(enableBugBehaviourStr)) {
isBugBehaviourEnabled = true;
} else if ("false".equalsIgnoreCase(enableBugBehaviourStr)) {
isBugBehaviourEnabled = false;
} else {
throw new IllegalArgumentException("Boolean value '" + enableBugBehaviourStr
+ "' for property 'enableBugBehaviour' must be 'true' or 'false' (case-insensitive)");
}
System.out.println("AWS Access Key: " + awsCredentials.getAccessKey());
System.out.println("filename: " + filename);
System.out.println("bucketName: " + bucketName);
System.out.println("contentType: " + contentType);
System.out.println("serverHostname: " + serverHostname);
System.out.println("serverPort: " + port);