Util.initLog4jTest();
CMBControllerServlet.valueAccumulator.initializeAllCounters();
PersistenceFactory.reset();
IUserPersistence userHandler = PersistenceFactory.getUserPersistence();
AWSCredentials credentials1 = null;
AWSCredentials credentials2 = null;
AWSCredentials credentials3 = null;
if (accessKey1 != null && accessSecret1 != null) {
credentials1 = new BasicAWSCredentials(accessKey1, accessSecret1);
} else {
user1 = userHandler.getUserByName(userName1);
if (user1 == null) {
user1 = userHandler.createUser(userName1, userName1);
}
credentials1 = new BasicAWSCredentials(user1.getAccessKey(), user1.getAccessSecret());
accessKey1 = user1.getAccessKey();
accessSecret1 = user1.getAccessSecret();
}
if (accessKey2 != null && accessSecret2 != null) {
credentials2 = new BasicAWSCredentials(accessKey2, accessSecret2);
} else {
user2 = userHandler.getUserByName(userName2);
if (user2 == null) {
user2 = userHandler.createUser(userName2, userName2);
}
credentials2 = new BasicAWSCredentials(user2.getAccessKey(), user2.getAccessSecret());
accessKey2 = user2.getAccessKey();
accessSecret2 = user2.getAccessSecret();
}
if (accessKey3 != null && accessSecret3 != null) {
credentials3 = new BasicAWSCredentials(accessKey3, accessSecret3);
} else {
user3 = userHandler.getUserByName(userName3);
if (user3 == null) {
user3 = userHandler.createUser(userName3, userName3);
}
credentials3 = new BasicAWSCredentials(user3.getAccessKey(), user3.getAccessSecret());
accessKey3 = user3.getAccessKey();
accessSecret3 = user3.getAccessSecret();
}