Search in sources :

Example 1 with DefaultInterceptorLibrary

use of com.cloud.configuration.DefaultInterceptorLibrary in project CloudStack-archive by CloudStack-extras.

the class CheckPointManagerTest method setUp.

@Override
@Before
public void setUp() {
    MockComponentLocator locator = new MockComponentLocator("management-server");
    locator.addDao("StackMaidDao", StackMaidDaoImpl.class);
    locator.addDao("ConfigurationDao", ConfigurationDaoImpl.class);
    locator.addManager("ClusterManager", MockClusterManager.class);
    locator.makeActive(new DefaultInterceptorLibrary());
    MockMaid.map.clear();
    s_logger.info("Cleaning up the database");
    Connection conn = Transaction.getStandaloneConnection();
    try {
        conn.setAutoCommit(true);
        PreparedStatement stmt = conn.prepareStatement("DELETE FROM stack_maid");
        stmt.executeUpdate();
        stmt.close();
        conn.close();
    } catch (SQLException e) {
        throw new CloudRuntimeException("Unable to setup database", e);
    }
}
Also used : MockComponentLocator(com.cloud.utils.component.MockComponentLocator) SQLException(java.sql.SQLException) DefaultInterceptorLibrary(com.cloud.configuration.DefaultInterceptorLibrary) CloudRuntimeException(com.cloud.utils.exception.CloudRuntimeException) Connection(java.sql.Connection) PreparedStatement(java.sql.PreparedStatement) Before(org.junit.Before)

Example 2 with DefaultInterceptorLibrary

use of com.cloud.configuration.DefaultInterceptorLibrary in project CloudStack-archive by CloudStack-extras.

the class SecurityGroupManagerImpl2Test method setUp.

@Before
@Override
public void setUp() {
    MockComponentLocator locator = new MockComponentLocator("management-server");
    locator.addDao("ConfigurationDao", ConfigurationDaoImpl.class);
    locator.addDao("SecurityGroupDao", SecurityGroupDaoImpl.class);
    //locator.addDao("IngressRuleDao", IngressRuleDaoImpl.class);
    locator.addDao("SecurityGroupVMMapDao", SecurityGroupVMMapDaoImpl.class);
    locator.addDao("SecurityGroupRulesDao", SecurityGroupRulesDaoImpl.class);
    locator.addDao("UserVmDao", UserVmDaoImpl.class);
    locator.addDao("AccountDao", AccountDaoImpl.class);
    locator.addDao("ConfigurationDao", ConfigurationDaoImpl.class);
    locator.addDao("SecurityGroupWorkDao", SecurityGroupWorkDaoImpl.class);
    locator.addDao("VmRulesetLogDao", VmRulesetLogDaoImpl.class);
    locator.addDao("VMInstanceDao", VMInstanceDaoImpl.class);
    locator.addDao("DomainDao", DomainDaoImpl.class);
    locator.addManager("AgentManager", MockAgentManagerImpl.class);
    locator.addManager("VirtualMachineManager", MockVirtualMachineManagerImpl.class);
    locator.addManager("UserVmManager", MockUserVmManagerImpl.class);
    locator.addManager("NetworkManager", MockNetworkManagerImpl.class);
    locator.addManager("AccountManager", MockAccountManagerImpl.class);
    locator.makeActive(new DefaultInterceptorLibrary());
    _sgMgr = ComponentLocator.inject(SecurityGroupManagerImpl2.class);
}
Also used : MockComponentLocator(com.cloud.utils.component.MockComponentLocator) DefaultInterceptorLibrary(com.cloud.configuration.DefaultInterceptorLibrary) Before(org.junit.Before)

Aggregations

DefaultInterceptorLibrary (com.cloud.configuration.DefaultInterceptorLibrary)2 MockComponentLocator (com.cloud.utils.component.MockComponentLocator)2 Before (org.junit.Before)2 CloudRuntimeException (com.cloud.utils.exception.CloudRuntimeException)1 Connection (java.sql.Connection)1 PreparedStatement (java.sql.PreparedStatement)1 SQLException (java.sql.SQLException)1