@@ -0,0 +1,3451 @@
+package org.usergrid.management;%0A%0Aimport me.prettyprint.hector.testutils.EmbeddedServerHelper;%0Aimport org.junit.Test;%0Aimport org.slf4j.Logger;%0Aimport org.slf4j.LoggerFactory;%0Aimport org.springframework.beans.factory.config.AutowireCapableBeanFactory;%0Aimport org.springframework.context.support.ClassPathXmlApplicationContext;%0Aimport org.springframework.stereotype.Component;%0Aimport org.usergrid.management.cassandra.ManagementServiceImpl;%0Aimport org.usergrid.management.cassandra.ManagementTestHelperImpl;%0Aimport org.usergrid.persistence.EntityManagerFactory;%0Aimport org.usergrid.persistence.cassandra.EntityManagerFactoryImpl;%0A%0Aimport javax.mail.Message;%0Aimport java.util.List;%0Aimport java.util.Properties;%0A%0Aimport static org.junit.Assert.assertFalse;%0Aimport static org.junit.Assert.assertNotNull;%0Aimport static org.junit.Assert.assertTrue;%0A%0Apublic class SetupTest %7B%0A%0A  private static final Logger logger = LoggerFactory.getLogger(SetupTest.class);%0A%0A  @Test%0A  public void testEmail() throws Exception %7B%0A    ManagementTestHelper helper = new MyManagementTestHelperImpl();%0A    helper.setup();%0A    ManagementServiceImpl management = (ManagementServiceImpl)helper.getManagementService();%0A    Properties properties = helper.getProperties();%0A%0A    properties.setProperty(%22usergrid.sysadmin.email%22, %22test@email.com%22);%0A    properties.setProperty(%22usergrid.management.admin_users_require_confirmation%22, %22true%22);%0A    properties.setProperty(%22usergrid.management.admin_users_require_activation%22, %22true%22);%0A    properties.setProperty(%22usergrid.management.notify_admin_of_activation%22, %22true%22);%0A    properties.setProperty(%22usergrid.management.organizations_require_confirmation%22, %22false%22);%0A    properties.setProperty(%22usergrid.management.organizations_require_activation%22, %22true%22);%0A    properties.setProperty(%22usergrid.management.notify_sysadmin_of_new_organizations%22, %22false%22);%0A    properties.setProperty(%22usergrid.management.notify_sysadmin_of_new_admin_users%22, %22true%22);%0A%0A    management.setProperties(properties);%0A    management.setup();%0A%0A    String email = properties.getProperty(%22usergrid.sysadmin.email%22);%0A    List%3CMessage%3E inbox = org.jvnet.mock_javamail.Mailbox.get(email);%0A    assertFalse(inbox.isEmpty());%0A%0A    helper.teardown();%0A  %7D%0A%0A  @Component%0A  static class MyManagementTestHelperImpl extends ManagementTestHelperImpl %7B%0A%0A    @Override%0A    public void setup() throws Exception %7B%0A      // assertNotNull(client);%0A%0A      String maven_opts = System.getenv(%22MAVEN_OPTS%22);%0A      logger.info(%22Maven options: %22 + maven_opts);%0A%0A      logger.info(%22Starting Cassandra%22);%0A      EmbeddedServerHelper embedded = new EmbeddedServerHelper();%0A      embedded.setup();%0A%0A      // copy(%22/testApplicationContext.xml%22, TMP);%0A%0A      String%5B%5D locations = %7B %22usergrid-test-context.xml%22 %7D;%0A      ClassPathXmlApplicationContext ac = new ClassPathXmlApplicationContext(locations);%0A%0A      AutowireCapableBeanFactory acbf = ac.getAutowireCapableBeanFactory();%0A      acbf.autowireBeanProperties(this,%0A              AutowireCapableBeanFactory.AUTOWIRE_BY_NAME, false);%0A      acbf.initializeBean(this, %22testClient%22);%0A%0A      EntityManagerFactory emf = getEntityManagerFactory();%0A      assertNotNull(emf);%0A      assertTrue(%0A              %22EntityManagerFactory is instance of EntityManagerFactoryImpl%22,%0A              emf instanceof EntityManagerFactoryImpl);%0A%0A      emf.setup();%0A%0A      // we're overriding this class just to comment out this line...%0A//      management.setup();%0A    %7D%0A%0A  %7D%0A%7D%0A

test specific error case reported in 282