/** * Returns producer user to use. {@link this#resolve()} must be called before. * * @return Producer user instance */ public USER resolverProducer() { if (producerRoleContainer.getMode() == RoleContainer.RoleMode.EXISTING_USER) { return userFactory.getUserByUsername(producerRoleContainer.getIdentifier()); } else if (producerRoleContainer.getMode() == RoleContainer.RoleMode.ANONYMOUS) { return null; } else { return producer; } }
private void initializeProducer() { if (producerRoleContainer.getMode() == RoleContainer.RoleMode.SET_USER_ROLE) { producer = userFactory.createUser( userFactory.getRandomUsername(), "Test", "Producer", producerRoleContainer.getRole(), LoginRole.PRODUCER); } else if (producerRoleContainer.getMode() == RoleContainer.RoleMode.EXISTING_USER) { // Do nothing, resolved in getter } else if (producerRoleContainer.getMode() == RoleContainer.RoleMode.ANONYMOUS) { // Do nothing, consumer is not used } else { throw new IllegalArgumentException( "Invalid producer consumer mode: " + producerRoleContainer.getMode()); } }