Search in sources :

Example 1 with MockComponentLocator

use of com.cloud.utils.component.MockComponentLocator in project CloudStack-archive by CloudStack-extras.

the class ResourceManagerTest method setUp.

@Override
@Before
public void setUp() throws Exception {
    _locator = new MockComponentLocator("management-server");
    _locator.addDao("StackMaidDao", StackMaidDaoImpl.class);
    _locator.addDao("VMTemplateZoneDao", VMTemplateZoneDaoImpl.class);
    _locator.addDao("DomainRouterDao", DomainRouterDaoImpl.class);
    _locator.addDao("HostDao", HostDaoImpl.class);
    _locator.addDao("VMInstanceDao", VMInstanceDaoImpl.class);
    _locator.addDao("UserVmDao", UserVmDaoImpl.class);
    ComponentInfo<? extends GenericDao<?, ? extends Serializable>> info = _locator.addDao("ServiceOfferingDao", ServiceOfferingDaoImpl.class);
    info.addParameter("cache.size", "50");
    info.addParameter("cache.time.to.live", "600");
    info = _locator.addDao("DiskOfferingDao", DiskOfferingDaoImpl.class);
    info.addParameter("cache.size", "50");
    info.addParameter("cache.time.to.live", "600");
    info = _locator.addDao("DataCenterDao", DataCenterDaoImpl.class);
    info.addParameter("cache.size", "50");
    info.addParameter("cache.time.to.live", "600");
    info = _locator.addDao("HostPodDao", HostPodDaoImpl.class);
    info.addParameter("cache.size", "50");
    info.addParameter("cache.time.to.live", "600");
    _locator.addDao("IPAddressDao", IPAddressDaoImpl.class);
    info = _locator.addDao("VlanDao", VlanDaoImpl.class);
    info.addParameter("cache.size", "30");
    info.addParameter("cache.time.to.live", "3600");
    _locator.addDao("PodVlanMapDao", PodVlanMapDaoImpl.class);
    _locator.addDao("AccountVlanMapDao", AccountVlanMapDaoImpl.class);
    _locator.addDao("VolumeDao", VolumeDaoImpl.class);
    _locator.addDao("EventDao", EventDaoImpl.class);
    info = _locator.addDao("UserDao", UserDaoImpl.class);
    info.addParameter("cache.size", "5000");
    info.addParameter("cache.time.to.live", "300");
    _locator.addDao("UserStatisticsDao", UserStatisticsDaoImpl.class);
    _locator.addDao("FirewallRulesDao", FirewallRulesDaoImpl.class);
    _locator.addDao("LoadBalancerDao", LoadBalancerDaoImpl.class);
    _locator.addDao("NetworkRuleConfigDao", NetworkRuleConfigDaoImpl.class);
    _locator.addDao("LoadBalancerVMMapDao", LoadBalancerVMMapDaoImpl.class);
    _locator.addDao("DataCenterIpAddressDao", DataCenterIpAddressDaoImpl.class);
    _locator.addDao("SecurityGroupDao", SecurityGroupDaoImpl.class);
    //_locator.addDao("IngressRuleDao", IngressRuleDaoImpl.class);
    _locator.addDao("SecurityGroupVMMapDao", SecurityGroupVMMapDaoImpl.class);
    _locator.addDao("SecurityGroupRulesDao", SecurityGroupRulesDaoImpl.class);
    _locator.addDao("SecurityGroupWorkDao", SecurityGroupWorkDaoImpl.class);
    _locator.addDao("VmRulesetLogDao", VmRulesetLogDaoImpl.class);
    _locator.addDao("AlertDao", AlertDaoImpl.class);
    _locator.addDao("CapacityDao", CapacityDaoImpl.class);
    _locator.addDao("DomainDao", DomainDaoImpl.class);
    _locator.addDao("AccountDao", AccountDaoImpl.class);
    _locator.addDao("ResourceLimitDao", ResourceLimitDaoImpl.class);
    _locator.addDao("ResourceCountDao", ResourceCountDaoImpl.class);
    _locator.addDao("UserAccountDao", UserAccountDaoImpl.class);
    _locator.addDao("VMTemplateHostDao", VMTemplateHostDaoImpl.class);
    _locator.addDao("UploadDao", UploadDaoImpl.class);
    _locator.addDao("VMTemplatePoolDao", VMTemplatePoolDaoImpl.class);
    _locator.addDao("LaunchPermissionDao", LaunchPermissionDaoImpl.class);
    _locator.addDao("ConfigurationDao", ConfigurationDaoImpl.class);
    info = _locator.addDao("VMTemplateDao", VMTemplateDaoImpl.class);
    info.addParameter("cache.size", "100");
    info.addParameter("cache.time.to.live", "600");
    info.addParameter("routing.uniquename", "routing");
    _locator.addDao("HighAvailabilityDao", HighAvailabilityDaoImpl.class);
    _locator.addDao("ConsoleProxyDao", ConsoleProxyDaoImpl.class);
    _locator.addDao("SecondaryStorageVmDao", SecondaryStorageVmDaoImpl.class);
    _locator.addDao("ManagementServerHostDao", ManagementServerHostDaoImpl.class);
    _locator.addDao("AgentUpgradeDao", AgentUpgradeDaoImpl.class);
    _locator.addDao("SnapshotDao", SnapshotDaoImpl.class);
    _locator.addDao("AsyncJobDao", AsyncJobDaoImpl.class);
    _locator.addDao("SyncQueueDao", SyncQueueDaoImpl.class);
    _locator.addDao("SyncQueueItemDao", SyncQueueItemDaoImpl.class);
    _locator.addDao("GuestOSDao", GuestOSDaoImpl.class);
    _locator.addDao("GuestOSCategoryDao", GuestOSCategoryDaoImpl.class);
    _locator.addDao("StoragePoolDao", StoragePoolDaoImpl.class);
    _locator.addDao("StoragePoolHostDao", StoragePoolHostDaoImpl.class);
    _locator.addDao("DetailsDao", HostDetailsDaoImpl.class);
    _locator.addDao("SnapshotPolicyDao", SnapshotPolicyDaoImpl.class);
    _locator.addDao("SnapshotScheduleDao", SnapshotScheduleDaoImpl.class);
    _locator.addDao("ClusterDao", ClusterDaoImpl.class);
    _locator.addDao("CertificateDao", CertificateDaoImpl.class);
    _locator.addDao("NetworkConfigurationDao", NetworkDaoImpl.class);
    _locator.addDao("NetworkOfferingDao", NetworkOfferingDaoImpl.class);
    _locator.addDao("NicDao", NicDaoImpl.class);
    _locator.addDao("InstanceGroupDao", InstanceGroupDaoImpl.class);
    _locator.addDao("InstanceGroupVMMapDao", InstanceGroupVMMapDaoImpl.class);
    _locator.addDao("RemoteAccessVpnDao", RemoteAccessVpnDaoImpl.class);
    _locator.addDao("VpnUserDao", VpnUserDaoImpl.class);
    _locator.addDao("ItWorkDao", ItWorkDaoImpl.class);
    _locator.addDao("FirewallRulesDao", FirewallRulesDaoImpl.class);
    _locator.addDao("PortForwardingRulesDao", PortForwardingRulesDaoImpl.class);
    _locator.addDao("FirewallRulesCidrsDao", FirewallRulesCidrsDaoImpl.class);
    _locator.addDao("SSHKeyPairDao", SSHKeyPairDaoImpl.class);
    _locator.addDao("UsageEventDao", UsageEventDaoImpl.class);
    _locator.addDao("ClusterDetailsDao", ClusterDetailsDaoImpl.class);
    _locator.addDao("UserVmDetailsDao", UserVmDetailsDaoImpl.class);
    _locator.addDao("StoragePoolWorkDao", StoragePoolWorkDaoImpl.class);
    _locator.addDao("HostTagsDao", HostTagsDaoImpl.class);
    _locator.addDao("NetworkDomainDao", NetworkDomainDaoImpl.class);
    _locator.addDao("KeystoreDao", KeystoreDaoImpl.class);
    _locator.addDao("DcDetailsDao", DcDetailsDaoImpl.class);
    _locator.addDao("SwiftDao", SwiftDaoImpl.class);
    _locator.addDao("AgentTransferMapDao", HostTransferMapDaoImpl.class);
    _locator.addDao("ProjectDao", ProjectDaoImpl.class);
    _locator.addDao("InlineLoadBalancerNicMapDao", InlineLoadBalancerNicMapDaoImpl.class);
    _locator.addDao("ElasticLbVmMap", ElasticLbVmMapDaoImpl.class);
    _locator.addDao("ProjectsAccountDao", ProjectAccountDaoImpl.class);
    info = _locator.addDao("HypervisorCapabilitiesDao", HypervisorCapabilitiesDaoImpl.class);
    info.addParameter("cache.size", "100");
    info.addParameter("cache.time.to.live", "600");
    _locator.addManager("StackMaidManager", CheckPointManagerImpl.class);
    _locator.addManager("account manager", AccountManagerImpl.class);
    _locator.addManager("domain manager", DomainManagerImpl.class);
    _locator.addManager("resource limit manager", ResourceLimitManagerImpl.class);
    _locator.addManager("configuration manager", ConfigurationManagerImpl.class);
    _locator.addManager("network manager", NetworkManagerImpl.class);
    _locator.addManager("download manager", DownloadMonitorImpl.class);
    _locator.addManager("upload manager", UploadMonitorImpl.class);
    _locator.addManager("keystore manager", KeystoreManagerImpl.class);
    _locator.addManager("secondary storage vm manager", SecondaryStorageManagerImpl.class);
    _locator.addManager("vm manager", UserVmManagerImpl.class);
    _locator.addManager("upgrade manager", UpgradeManagerImpl.class);
    _locator.addManager("StorageManager", StorageManagerImpl.class);
    _locator.addManager("SyncQueueManager", SyncQueueManagerImpl.class);
    _locator.addManager("AsyncJobManager", AsyncJobManagerImpl.class);
    _locator.addManager("AsyncJobExecutorContext", AsyncJobExecutorContextImpl.class);
    _locator.addManager("HA Manager", HighAvailabilityManagerImpl.class);
    _locator.addManager("Alert Manager", AlertManagerImpl.class);
    _locator.addManager("Template Manager", TemplateManagerImpl.class);
    _locator.addManager("Snapshot Manager", SnapshotManagerImpl.class);
    _locator.addManager("SnapshotScheduler", SnapshotSchedulerImpl.class);
    _locator.addManager("SecurityGroupManager", SecurityGroupManagerImpl2.class);
    _locator.addManager("DomainRouterManager", VirtualNetworkApplianceManagerImpl.class);
    _locator.addManager("EntityManager", EntityManagerImpl.class);
    _locator.addManager("LoadBalancingRulesManager", LoadBalancingRulesManagerImpl.class);
    _locator.addManager("RulesManager", RulesManagerImpl.class);
    _locator.addManager("RemoteAccessVpnManager", RemoteAccessVpnManagerImpl.class);
    _locator.addManager("OvsTunnelManager", OvsTunnelManagerImpl.class);
    _locator.addManager("Capacity Manager", CapacityManagerImpl.class);
    _locator.addManager("Cluster Manager", ClusterManagerImpl.class);
    _locator.addManager("VirtualMachineManager", ClusteredVirtualMachineManagerImpl.class);
    _locator.addManager("HypervisorGuruManager", HypervisorGuruManagerImpl.class);
    _locator.addManager("ClusterFenceManager", ClusterFenceManagerImpl.class);
    _locator.addManager("ResourceManager", ResourceManagerImpl.class);
    _locator.addManager("OCFS2Manager", OCFS2ManagerImpl.class);
    _locator.addManager("FirewallManager", FirewallManagerImpl.class);
    ComponentInfo<? extends Manager> info1 = _locator.addManager("ConsoleProxyManager", ConsoleProxyManagerImpl.class);
    info1.addParameter("consoleproxy.sslEnabled", "true");
    _locator.addManager("ClusteredAgentManager", ClusteredAgentManagerImpl.class);
    _locator.addManager("ProjectManager", ProjectManagerImpl.class);
    _locator.addManager("ElasticLoadBalancerManager", ElasticLoadBalancerManagerImpl.class);
    _locator.makeActive(null);
    _configService = ComponentLocator.inject(ConfigurationManagerImpl.class);
}
Also used : MockComponentLocator(com.cloud.utils.component.MockComponentLocator) HypervisorCapabilitiesDaoImpl(com.cloud.hypervisor.dao.HypervisorCapabilitiesDaoImpl) VlanDaoImpl(com.cloud.dc.dao.VlanDaoImpl) HostPodDaoImpl(com.cloud.dc.dao.HostPodDaoImpl) VMTemplateDaoImpl(com.cloud.storage.dao.VMTemplateDaoImpl) UserDaoImpl(com.cloud.user.dao.UserDaoImpl) VpnUserDaoImpl(com.cloud.network.dao.VpnUserDaoImpl) DataCenterDaoImpl(com.cloud.dc.dao.DataCenterDaoImpl) ConfigurationManagerImpl(com.cloud.configuration.ConfigurationManagerImpl) DiskOfferingDaoImpl(com.cloud.storage.dao.DiskOfferingDaoImpl) Before(org.junit.Before)

Example 2 with MockComponentLocator

use of com.cloud.utils.component.MockComponentLocator 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 3 with MockComponentLocator

use of com.cloud.utils.component.MockComponentLocator 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

MockComponentLocator (com.cloud.utils.component.MockComponentLocator)3 Before (org.junit.Before)3 DefaultInterceptorLibrary (com.cloud.configuration.DefaultInterceptorLibrary)2 ConfigurationManagerImpl (com.cloud.configuration.ConfigurationManagerImpl)1 DataCenterDaoImpl (com.cloud.dc.dao.DataCenterDaoImpl)1 HostPodDaoImpl (com.cloud.dc.dao.HostPodDaoImpl)1 VlanDaoImpl (com.cloud.dc.dao.VlanDaoImpl)1 HypervisorCapabilitiesDaoImpl (com.cloud.hypervisor.dao.HypervisorCapabilitiesDaoImpl)1 VpnUserDaoImpl (com.cloud.network.dao.VpnUserDaoImpl)1 DiskOfferingDaoImpl (com.cloud.storage.dao.DiskOfferingDaoImpl)1 VMTemplateDaoImpl (com.cloud.storage.dao.VMTemplateDaoImpl)1 UserDaoImpl (com.cloud.user.dao.UserDaoImpl)1 CloudRuntimeException (com.cloud.utils.exception.CloudRuntimeException)1 Connection (java.sql.Connection)1 PreparedStatement (java.sql.PreparedStatement)1 SQLException (java.sql.SQLException)1