mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-03 04:12:31 +01:00
Add Mock managers for Regio API server
This commit is contained in:
parent
f0f33bf4da
commit
c40aac0add
42
server/test/com/cloud/api/RegionTest.java
Normal file
42
server/test/com/cloud/api/RegionTest.java
Normal file
@ -0,0 +1,42 @@
|
||||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
package com.cloud.api;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.log4j.xml.DOMConfigurator;
|
||||
|
||||
import com.cloud.server.ManagementService;
|
||||
import com.cloud.utils.PropertiesUtil;
|
||||
import com.cloud.utils.component.ComponentLocator;
|
||||
|
||||
public class RegionTest {
|
||||
private static final Logger s_logger = Logger.getLogger(RegionTest.class.getName());
|
||||
|
||||
public static void main(String args[]){
|
||||
System.out.println("Starting");
|
||||
File file = PropertiesUtil.findConfigFile("log4j-cloud.xml");
|
||||
if (file != null) {
|
||||
s_logger.info("log4j configuration found at " + file.getAbsolutePath());
|
||||
DOMConfigurator.configureAndWatch(file.getAbsolutePath());
|
||||
}
|
||||
final ComponentLocator _locator = ComponentLocator.getLocator(ManagementService.Name, "components-regions.xml", "log4j-cloud");
|
||||
MockApiServer.initApiServer(new String[] { "commands.properties" });
|
||||
System.out.println("Started");
|
||||
}
|
||||
}
|
||||
230
server/test/com/cloud/configuration/RegionsComponentLibrary.java
Executable file
230
server/test/com/cloud/configuration/RegionsComponentLibrary.java
Executable file
@ -0,0 +1,230 @@
|
||||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
package com.cloud.configuration;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.cloud.alert.AlertManagerImpl;
|
||||
import com.cloud.alert.dao.AlertDaoImpl;
|
||||
import com.cloud.capacity.dao.CapacityDaoImpl;
|
||||
import com.cloud.configuration.dao.ConfigurationDaoImpl;
|
||||
import com.cloud.configuration.dao.ResourceCountDaoImpl;
|
||||
import com.cloud.configuration.dao.ResourceLimitDaoImpl;
|
||||
import com.cloud.dao.EntityManager;
|
||||
import com.cloud.dao.EntityManagerImpl;
|
||||
import com.cloud.dc.dao.AccountVlanMapDaoImpl;
|
||||
import com.cloud.dc.dao.ClusterDaoImpl;
|
||||
import com.cloud.dc.dao.DataCenterDaoImpl;
|
||||
import com.cloud.dc.dao.HostPodDaoImpl;
|
||||
import com.cloud.dc.dao.VlanDaoImpl;
|
||||
import com.cloud.domain.dao.DomainDaoImpl;
|
||||
import com.cloud.host.dao.HostDaoImpl;
|
||||
import com.cloud.network.MockNetworkManagerImpl;
|
||||
import com.cloud.network.dao.FirewallRulesCidrsDaoImpl;
|
||||
import com.cloud.network.dao.IPAddressDaoImpl;
|
||||
import com.cloud.network.dao.LoadBalancerDaoImpl;
|
||||
import com.cloud.network.dao.NetworkDaoImpl;
|
||||
import com.cloud.network.dao.NetworkDomainDaoImpl;
|
||||
import com.cloud.network.dao.NetworkRuleConfigDaoImpl;
|
||||
import com.cloud.network.dao.RemoteAccessVpnDaoImpl;
|
||||
import com.cloud.network.dao.Site2SiteCustomerGatewayDaoImpl;
|
||||
import com.cloud.network.dao.Site2SiteVpnGatewayDaoImpl;
|
||||
import com.cloud.network.dao.VpnUserDaoImpl;
|
||||
import com.cloud.network.security.MockSecurityGroupManagerImpl;
|
||||
import com.cloud.network.security.dao.SecurityGroupDaoImpl;
|
||||
import com.cloud.network.vpc.dao.VpcDaoImpl;
|
||||
import com.cloud.network.vpn.MockRemoteAccessVpnManagerImpl;
|
||||
import com.cloud.offerings.dao.NetworkOfferingDaoImpl;
|
||||
import com.cloud.projects.MockProjectManagerImpl;
|
||||
import com.cloud.projects.dao.ProjectAccountDaoImpl;
|
||||
import com.cloud.projects.dao.ProjectDaoImpl;
|
||||
import com.cloud.region.RegionManagerImpl;
|
||||
import com.cloud.region.dao.RegionDaoImpl;
|
||||
import com.cloud.resourcelimit.ResourceLimitManagerImpl;
|
||||
import com.cloud.service.dao.ServiceOfferingDaoImpl;
|
||||
import com.cloud.storage.MockStorageManagerImpl;
|
||||
import com.cloud.storage.dao.DiskOfferingDaoImpl;
|
||||
import com.cloud.storage.dao.GuestOSCategoryDaoImpl;
|
||||
import com.cloud.storage.dao.GuestOSDaoImpl;
|
||||
import com.cloud.storage.dao.LaunchPermissionDaoImpl;
|
||||
import com.cloud.storage.dao.SnapshotDaoImpl;
|
||||
import com.cloud.storage.dao.StoragePoolDaoImpl;
|
||||
import com.cloud.storage.dao.UploadDaoImpl;
|
||||
import com.cloud.storage.dao.VMTemplateDaoImpl;
|
||||
import com.cloud.storage.dao.VMTemplateDetailsDaoImpl;
|
||||
import com.cloud.storage.dao.VMTemplateHostDaoImpl;
|
||||
import com.cloud.storage.dao.VMTemplateSwiftDaoImpl;
|
||||
import com.cloud.storage.dao.VMTemplateZoneDaoImpl;
|
||||
import com.cloud.storage.dao.VolumeDaoImpl;
|
||||
import com.cloud.storage.dao.VolumeHostDaoImpl;
|
||||
import com.cloud.storage.snapshot.MockSnapshotManagerImpl;
|
||||
import com.cloud.template.MockTemplateManagerImpl;
|
||||
import com.cloud.user.AccountDetailsDaoImpl;
|
||||
import com.cloud.user.AccountManagerImpl;
|
||||
import com.cloud.user.DomainManagerImpl;
|
||||
import com.cloud.user.dao.AccountDaoImpl;
|
||||
import com.cloud.user.dao.SSHKeyPairDaoImpl;
|
||||
import com.cloud.user.dao.UserAccountDaoImpl;
|
||||
import com.cloud.user.dao.UserDaoImpl;
|
||||
import com.cloud.user.dao.UserStatisticsDaoImpl;
|
||||
import com.cloud.utils.component.Adapter;
|
||||
import com.cloud.utils.component.ComponentLibrary;
|
||||
import com.cloud.utils.component.ComponentLibraryBase;
|
||||
import com.cloud.utils.component.ComponentLocator.ComponentInfo;
|
||||
import com.cloud.utils.component.Manager;
|
||||
import com.cloud.utils.component.PluggableService;
|
||||
import com.cloud.utils.db.GenericDao;
|
||||
import com.cloud.uuididentity.dao.IdentityDaoImpl;
|
||||
import com.cloud.vm.MockUserVmManagerImpl;
|
||||
import com.cloud.vm.MockVirtualMachineManagerImpl;
|
||||
import com.cloud.vm.dao.ConsoleProxyDaoImpl;
|
||||
import com.cloud.vm.dao.DomainRouterDaoImpl;
|
||||
import com.cloud.vm.dao.InstanceGroupDaoImpl;
|
||||
import com.cloud.vm.dao.UserVmDaoImpl;
|
||||
import com.cloud.vm.dao.UserVmDetailsDaoImpl;
|
||||
import com.cloud.vm.dao.VMInstanceDaoImpl;
|
||||
import com.cloud.vpc.MockConfigurationManagerImpl;
|
||||
import com.cloud.vpc.MockResourceLimitManagerImpl;
|
||||
import com.cloud.vpc.MockSite2SiteVpnManagerImpl;
|
||||
import com.cloud.vpc.MockVpcManagerImpl;
|
||||
|
||||
|
||||
public class RegionsComponentLibrary extends ComponentLibraryBase implements ComponentLibrary {
|
||||
protected void populateDaos() {
|
||||
addDao("DomainDao", DomainDaoImpl.class);
|
||||
addDao("AccountDao", AccountDaoImpl.class);
|
||||
addDao("UserDao", UserDaoImpl.class);
|
||||
addDao("UserAccountDao", UserAccountDaoImpl.class);
|
||||
addDao("NetworkOfferingDao", NetworkOfferingDaoImpl.class);
|
||||
addDao("RegionDao", RegionDaoImpl.class);
|
||||
addDao("IdentityDao", IdentityDaoImpl.class);
|
||||
addDao("AccountVlanMapDao", AccountVlanMapDaoImpl.class);
|
||||
addDao("CapacityDao", CapacityDaoImpl.class);
|
||||
addDao("ClusterDao", ClusterDaoImpl.class);
|
||||
addDao("ServiceOfferingDao", ServiceOfferingDaoImpl.class);
|
||||
addDao("DiskOfferingDao", DiskOfferingDaoImpl.class);
|
||||
addDao("DomainRouterDao", DomainRouterDaoImpl.class);
|
||||
addDao("GuestOSDao", GuestOSDaoImpl.class);
|
||||
addDao("GuestOSCategoryDao", GuestOSCategoryDaoImpl.class);
|
||||
addDao("HostDao", HostDaoImpl.class);
|
||||
addDao("IPAddressDao", IPAddressDaoImpl.class);
|
||||
addDao("LoadBalancerDao", LoadBalancerDaoImpl.class);
|
||||
addDao("NetworkRuleConfigDao", NetworkRuleConfigDaoImpl.class);
|
||||
addDao("HostPodDao", HostPodDaoImpl.class);
|
||||
addDao("SnapshotDao", SnapshotDaoImpl.class);
|
||||
addDao("StoragePoolDao", StoragePoolDaoImpl.class);
|
||||
addDao("ConfigurationDao", ConfigurationDaoImpl.class);
|
||||
addDao("DataCenterDao", DataCenterDaoImpl.class);
|
||||
addDao("VMTemplateZoneDao", VMTemplateZoneDaoImpl.class);
|
||||
addDao("VMTemplateDetailsDao", VMTemplateDetailsDaoImpl.class);
|
||||
addDao("VMTemplateDao", VMTemplateDaoImpl.class);
|
||||
addDao("VMTemplateHostDao", VMTemplateHostDaoImpl.class);
|
||||
addDao("VMTemplateSwiftDao", VMTemplateSwiftDaoImpl.class);
|
||||
addDao("UploadDao", UploadDaoImpl.class);
|
||||
addDao("UserDao", UserDaoImpl.class);
|
||||
addDao("UserStatisticsDao", UserStatisticsDaoImpl.class);
|
||||
addDao("UserVmDao", UserVmDaoImpl.class);
|
||||
addDao("VlanDao", VlanDaoImpl.class);
|
||||
addDao("VolumeDao", VolumeDaoImpl.class);
|
||||
addDao("Site2SiteVpnGatewayDao", Site2SiteVpnGatewayDaoImpl.class);
|
||||
addDao("Site2SiteCustomerGatewayDao", Site2SiteCustomerGatewayDaoImpl.class);
|
||||
addDao("VolumeHostDao", VolumeHostDaoImpl.class);
|
||||
addDao("SecurityGroupDao", SecurityGroupDaoImpl.class);
|
||||
addDao("NetworkConfigurationDao", NetworkDaoImpl.class);
|
||||
addDao("ConsoleProxyDao", ConsoleProxyDaoImpl.class);
|
||||
addDao("FirewallRulesCidrsDao", FirewallRulesCidrsDaoImpl.class);
|
||||
addDao("VMInstanceDao", VMInstanceDaoImpl.class);
|
||||
addDao("AccountDetailsDao", AccountDetailsDaoImpl.class);
|
||||
addDao("NetworkDomainDao", NetworkDomainDaoImpl.class);
|
||||
addDao("SSHKeyPairDao", SSHKeyPairDaoImpl.class);
|
||||
addDao("UserVmDetailsDao", UserVmDetailsDaoImpl.class);
|
||||
addDao("ResourceCountDao", ResourceCountDaoImpl.class);
|
||||
addDao("InstanceGroupDao", InstanceGroupDaoImpl.class);
|
||||
addDao("RemoteAccessVpnDao", RemoteAccessVpnDaoImpl.class);
|
||||
addDao("VpnUserDao", VpnUserDaoImpl.class);
|
||||
addDao("ProjectDao", ProjectDaoImpl.class);
|
||||
addDao("ProjectAccountDao", ProjectAccountDaoImpl.class);
|
||||
addDao("LaunchPermissionDao", LaunchPermissionDaoImpl.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized Map<String, ComponentInfo<GenericDao<?, ?>>> getDaos() {
|
||||
if (_daos.size() == 0) {
|
||||
populateDaos();
|
||||
}
|
||||
return _daos;
|
||||
}
|
||||
|
||||
protected void populateManagers() {
|
||||
addManager("configuration manager", MockConfigurationManagerImpl.class);
|
||||
addManager("account manager", AccountManagerImpl.class);
|
||||
addManager("domain manager", DomainManagerImpl.class);
|
||||
addManager("Region Manager", RegionManagerImpl.class);
|
||||
addManager("ResourceLimit Manager", MockResourceLimitManagerImpl.class);
|
||||
addManager("Network Manager", MockNetworkManagerImpl.class);
|
||||
addManager("UserVm Manager", MockUserVmManagerImpl.class);
|
||||
addManager("Vm Manager", MockVirtualMachineManagerImpl.class);
|
||||
addManager("Project Manager", MockProjectManagerImpl.class);
|
||||
addManager("Vpc Manager", MockVpcManagerImpl.class);
|
||||
addManager("Site2SiteVpn Manager", MockSite2SiteVpnManagerImpl.class);
|
||||
addManager("SecurityGroup Manager", MockSecurityGroupManagerImpl.class);
|
||||
addManager("Snapshot Manager", MockSnapshotManagerImpl.class);
|
||||
addManager("Template Manager", MockTemplateManagerImpl.class);
|
||||
addManager("Storage Manager", MockStorageManagerImpl.class);
|
||||
addManager("RemoteAccessVpn Manager", MockRemoteAccessVpnManagerImpl.class);
|
||||
addManager("Entity Manager", EntityManagerImpl.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized Map<String, ComponentInfo<Manager>> getManagers() {
|
||||
if (_managers.size() == 0) {
|
||||
populateManagers();
|
||||
}
|
||||
return _managers;
|
||||
}
|
||||
|
||||
protected void populateAdapters() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized Map<String, List<ComponentInfo<Adapter>>> getAdapters() {
|
||||
if (_adapters.size() == 0) {
|
||||
populateAdapters();
|
||||
}
|
||||
return _adapters;
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized Map<Class<?>, Class<?>> getFactories() {
|
||||
HashMap<Class<?>, Class<?>> factories = new HashMap<Class<?>, Class<?>>();
|
||||
factories.put(EntityManager.class, EntityManagerImpl.class);
|
||||
return factories;
|
||||
}
|
||||
|
||||
protected void populateServices() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized Map<String, ComponentInfo<PluggableService>> getPluggableServices() {
|
||||
if (_pluggableServices.size() == 0) {
|
||||
populateServices();
|
||||
}
|
||||
return _pluggableServices;
|
||||
}
|
||||
}
|
||||
129
server/test/com/cloud/network/vpn/MockRemoteAccessVpnManagerImpl.java
Executable file
129
server/test/com/cloud/network/vpn/MockRemoteAccessVpnManagerImpl.java
Executable file
@ -0,0 +1,129 @@
|
||||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
package com.cloud.network.vpn;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.ejb.Local;
|
||||
import javax.naming.ConfigurationException;
|
||||
|
||||
import com.cloud.api.commands.ListRemoteAccessVpnsCmd;
|
||||
import com.cloud.api.commands.ListVpnUsersCmd;
|
||||
import com.cloud.exception.NetworkRuleConflictException;
|
||||
import com.cloud.exception.ResourceUnavailableException;
|
||||
import com.cloud.network.RemoteAccessVpn;
|
||||
import com.cloud.network.VpnUser;
|
||||
import com.cloud.utils.component.Manager;
|
||||
|
||||
@Local(value = RemoteAccessVpnService.class)
|
||||
public class MockRemoteAccessVpnManagerImpl implements RemoteAccessVpnService, Manager {
|
||||
|
||||
@Override
|
||||
public boolean configure(String name, Map<String, Object> params)
|
||||
throws ConfigurationException {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean start() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean stop() {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RemoteAccessVpn createRemoteAccessVpn(long vpnServerAddressId,
|
||||
String ipRange, boolean openFirewall, long networkId)
|
||||
throws NetworkRuleConflictException {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroyRemoteAccessVpn(long vpnServerAddressId)
|
||||
throws ResourceUnavailableException {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public RemoteAccessVpn startRemoteAccessVpn(long vpnServerAddressId,
|
||||
boolean openFirewall) throws ResourceUnavailableException {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public VpnUser addVpnUser(long vpnOwnerId, String userName, String password) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeVpnUser(long vpnOwnerId, String userName) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends VpnUser> listVpnUsers(long vpnOwnerId, String userName) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applyVpnUsers(long vpnOwnerId, String userName) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends RemoteAccessVpn> searchForRemoteAccessVpns(
|
||||
ListRemoteAccessVpnsCmd cmd) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends VpnUser> searchForVpnUsers(ListVpnUsersCmd cmd) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends RemoteAccessVpn> listRemoteAccessVpns(long networkId) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RemoteAccessVpn getRemoteAccessVpn(long vpnId) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
}
|
||||
483
server/test/com/cloud/server/MockManagementServerImpl.java
Executable file
483
server/test/com/cloud/server/MockManagementServerImpl.java
Executable file
@ -0,0 +1,483 @@
|
||||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
package com.cloud.server;
|
||||
|
||||
import java.net.URISyntaxException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import com.cloud.alert.Alert;
|
||||
import com.cloud.api.commands.CreateSSHKeyPairCmd;
|
||||
import com.cloud.api.commands.DeleteSSHKeyPairCmd;
|
||||
import com.cloud.api.commands.DestroySystemVmCmd;
|
||||
import com.cloud.api.commands.ExtractVolumeCmd;
|
||||
import com.cloud.api.commands.GetVMPasswordCmd;
|
||||
import com.cloud.api.commands.ListAlertsCmd;
|
||||
import com.cloud.api.commands.ListAsyncJobsCmd;
|
||||
import com.cloud.api.commands.ListCapabilitiesCmd;
|
||||
import com.cloud.api.commands.ListCapacityCmd;
|
||||
import com.cloud.api.commands.ListCfgsByCmd;
|
||||
import com.cloud.api.commands.ListClustersCmd;
|
||||
import com.cloud.api.commands.ListDiskOfferingsCmd;
|
||||
import com.cloud.api.commands.ListEventsCmd;
|
||||
import com.cloud.api.commands.ListGuestOsCategoriesCmd;
|
||||
import com.cloud.api.commands.ListGuestOsCmd;
|
||||
import com.cloud.api.commands.ListHostsCmd;
|
||||
import com.cloud.api.commands.ListIsosCmd;
|
||||
import com.cloud.api.commands.ListPodsByCmd;
|
||||
import com.cloud.api.commands.ListPublicIpAddressesCmd;
|
||||
import com.cloud.api.commands.ListRoutersCmd;
|
||||
import com.cloud.api.commands.ListSSHKeyPairsCmd;
|
||||
import com.cloud.api.commands.ListServiceOfferingsCmd;
|
||||
import com.cloud.api.commands.ListStoragePoolsCmd;
|
||||
import com.cloud.api.commands.ListSystemVMsCmd;
|
||||
import com.cloud.api.commands.ListTemplatesCmd;
|
||||
import com.cloud.api.commands.ListVMGroupsCmd;
|
||||
import com.cloud.api.commands.ListVlanIpRangesCmd;
|
||||
import com.cloud.api.commands.ListZonesByCmd;
|
||||
import com.cloud.api.commands.RebootSystemVmCmd;
|
||||
import com.cloud.api.commands.RegisterSSHKeyPairCmd;
|
||||
import com.cloud.api.commands.StopSystemVmCmd;
|
||||
import com.cloud.api.commands.UpdateHostPasswordCmd;
|
||||
import com.cloud.api.commands.UpdateIsoCmd;
|
||||
import com.cloud.api.commands.UpdateTemplateCmd;
|
||||
import com.cloud.api.commands.UpdateVMGroupCmd;
|
||||
import com.cloud.api.commands.UpgradeSystemVMCmd;
|
||||
import com.cloud.api.commands.UploadCustomCertificateCmd;
|
||||
import com.cloud.async.AsyncJob;
|
||||
import com.cloud.capacity.Capacity;
|
||||
import com.cloud.configuration.Configuration;
|
||||
import com.cloud.dc.DataCenter;
|
||||
import com.cloud.dc.Pod;
|
||||
import com.cloud.dc.Vlan;
|
||||
import com.cloud.event.Event;
|
||||
import com.cloud.event.EventVO;
|
||||
import com.cloud.exception.ConcurrentOperationException;
|
||||
import com.cloud.exception.ResourceUnavailableException;
|
||||
import com.cloud.host.Host;
|
||||
import com.cloud.host.HostVO;
|
||||
import com.cloud.hypervisor.Hypervisor.HypervisorType;
|
||||
import com.cloud.hypervisor.HypervisorCapabilities;
|
||||
import com.cloud.info.ConsoleProxyInfo;
|
||||
import com.cloud.network.IpAddress;
|
||||
import com.cloud.network.router.VirtualRouter;
|
||||
import com.cloud.offering.DiskOffering;
|
||||
import com.cloud.offering.ServiceOffering;
|
||||
import com.cloud.org.Cluster;
|
||||
import com.cloud.storage.GuestOS;
|
||||
import com.cloud.storage.GuestOSVO;
|
||||
import com.cloud.storage.GuestOsCategory;
|
||||
import com.cloud.storage.StoragePool;
|
||||
import com.cloud.storage.StoragePoolVO;
|
||||
import com.cloud.template.VirtualMachineTemplate;
|
||||
import com.cloud.user.SSHKeyPair;
|
||||
import com.cloud.utils.Pair;
|
||||
import com.cloud.vm.InstanceGroup;
|
||||
import com.cloud.vm.VirtualMachine;
|
||||
|
||||
public class MockManagementServerImpl implements ManagementServer {
|
||||
|
||||
@Override
|
||||
public List<? extends DataCenter> listDataCenters(ListZonesByCmd cmd) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends Configuration> searchForConfigurations(ListCfgsByCmd c) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends ServiceOffering> searchForServiceOfferings(
|
||||
ListServiceOfferingsCmd cmd) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends Cluster> searchForClusters(ListClustersCmd c) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends Cluster> searchForClusters(long zoneId,
|
||||
Long startIndex, Long pageSizeVal, String hypervisorType) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends Pod> searchForPods(ListPodsByCmd cmd) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends Host> searchForServers(ListHostsCmd cmd) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public VirtualMachineTemplate updateTemplate(UpdateIsoCmd cmd) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public VirtualMachineTemplate updateTemplate(UpdateTemplateCmd cmd) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends Event> searchForEvents(ListEventsCmd c) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends VirtualRouter> searchForRouters(ListRoutersCmd cmd) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends IpAddress> searchForIPAddresses(
|
||||
ListPublicIpAddressesCmd cmd) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends GuestOS> listGuestOSByCriteria(ListGuestOsCmd cmd) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends GuestOsCategory> listGuestOSCategoriesByCriteria(
|
||||
ListGuestOsCategoriesCmd cmd) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public VirtualMachine stopSystemVM(StopSystemVmCmd cmd)
|
||||
throws ResourceUnavailableException, ConcurrentOperationException {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public VirtualMachine startSystemVM(long vmId) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public VirtualMachine rebootSystemVM(RebootSystemVmCmd cmd) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public VirtualMachine destroySystemVM(DestroySystemVmCmd cmd) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public VirtualMachine upgradeSystemVM(UpgradeSystemVMCmd cmd) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends Alert> searchForAlerts(ListAlertsCmd cmd) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends Capacity> listCapacities(ListCapacityCmd cmd) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<Pair<Long, Long>> listIsos(ListIsosCmd cmd) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<Pair<Long, Long>> listTemplates(ListTemplatesCmd cmd) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends DiskOffering> searchForDiskOfferings(
|
||||
ListDiskOfferingsCmd cmd) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends StoragePool> searchForStoragePools(
|
||||
ListStoragePoolsCmd cmd) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends VirtualMachine> searchForSystemVm(ListSystemVMsCmd cmd) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<String> getCloudIdentifierResponse(long userId) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateHostPassword(UpdateHostPasswordCmd cmd) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public InstanceGroup updateVmGroup(UpdateVMGroupCmd cmd) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends InstanceGroup> searchForVmGroups(ListVMGroupsCmd cmd) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> listCapabilities(ListCapabilitiesCmd cmd) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long extractVolume(ExtractVolumeCmd cmd) throws URISyntaxException {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getHypervisors(Long zoneId) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String uploadCertificate(UploadCustomCertificateCmd cmd) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends Vlan> searchForVlans(ListVlanIpRangesCmd cmd) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends AsyncJob> searchForAsyncJobs(ListAsyncJobsCmd cmd) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String generateRandomPassword() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long saveStartedEvent(Long userId, Long accountId, String type,
|
||||
String description, long startEventId) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long saveCompletedEvent(Long userId, Long accountId, String level,
|
||||
String type, String description, long startEventId) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends SSHKeyPair> listSSHKeyPairs(ListSSHKeyPairsCmd cmd) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SSHKeyPair registerSSHKeyPair(RegisterSSHKeyPairCmd cmd) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SSHKeyPair createSSHKeyPair(CreateSSHKeyPairCmd cmd) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean deleteSSHKeyPair(DeleteSSHKeyPairCmd cmd) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getVMPassword(GetVMPasswordCmd cmd) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public com.cloud.vm.VirtualMachine.Type findSystemVMTypeById(long instanceId) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Pair<List<? extends Host>, List<? extends Host>> listHostsForMigrationOfVM(
|
||||
Long vmId, Long startIndex, Long pageSize) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] listEventTypes() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends HypervisorCapabilities> listHypervisorCapabilities(
|
||||
Long id, HypervisorType hypervisorType, String keyword,
|
||||
Long startIndex, Long pageSizeVal) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HypervisorCapabilities updateHypervisorCapabilities(Long id,
|
||||
Long maxGuestsLimit, Boolean securityGroupEnabled) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends Capacity> listTopConsumedResources(ListCapacityCmd cmd) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getId() {
|
||||
// TODO Auto-generated method stub
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getVersion() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getApiConfig() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HostVO getHostBy(long hostId) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EventVO> getEvents(long userId, long accountId, Long domainId,
|
||||
String type, String level, Date startDate, Date endDate) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConsoleProxyInfo getConsoleProxyForVm(long dataCenterId,
|
||||
long userVmId) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getConsoleAccessUrlRoot(long vmId) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public GuestOSVO getGuestOs(Long guestOsId) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Pair<String, Integer> getVncPort(VirtualMachine vm) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getMemoryOrCpuCapacityByHost(Long hostId, short capacityType) {
|
||||
// TODO Auto-generated method stub
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends StoragePoolVO> searchForStoragePools(Criteria c) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHashKey() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
}
|
||||
236
server/test/com/cloud/storage/snapshot/MockSnapshotManagerImpl.java
Executable file
236
server/test/com/cloud/storage/snapshot/MockSnapshotManagerImpl.java
Executable file
@ -0,0 +1,236 @@
|
||||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
package com.cloud.storage.snapshot;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.ejb.Local;
|
||||
import javax.naming.ConfigurationException;
|
||||
|
||||
import com.cloud.api.commands.CreateSnapshotPolicyCmd;
|
||||
import com.cloud.api.commands.DeleteSnapshotPoliciesCmd;
|
||||
import com.cloud.api.commands.ListRecurringSnapshotScheduleCmd;
|
||||
import com.cloud.api.commands.ListSnapshotPoliciesCmd;
|
||||
import com.cloud.api.commands.ListSnapshotsCmd;
|
||||
import com.cloud.exception.ResourceAllocationException;
|
||||
import com.cloud.host.HostVO;
|
||||
import com.cloud.storage.Snapshot;
|
||||
import com.cloud.storage.SnapshotPolicyVO;
|
||||
import com.cloud.storage.SnapshotVO;
|
||||
import com.cloud.storage.VolumeVO;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.utils.component.Manager;
|
||||
import com.cloud.utils.db.Filter;
|
||||
|
||||
@Local(value = { SnapshotManager.class, SnapshotService.class })
|
||||
public class MockSnapshotManagerImpl implements SnapshotManager, SnapshotService, Manager {
|
||||
|
||||
@Override
|
||||
public boolean configure(String name, Map<String, Object> params)
|
||||
throws ConfigurationException {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean start() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean stop() {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends Snapshot> listSnapshots(ListSnapshotsCmd cmd) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean deleteSnapshot(long snapshotId) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SnapshotPolicy createPolicy(CreateSnapshotPolicyCmd cmd,
|
||||
Account policyOwner) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends SnapshotSchedule> findRecurringSnapshotSchedule(
|
||||
ListRecurringSnapshotScheduleCmd cmd) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends SnapshotPolicy> listPoliciesforVolume(
|
||||
ListSnapshotPoliciesCmd cmd) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean deleteSnapshotPolicies(DeleteSnapshotPoliciesCmd cmd) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Snapshot allocSnapshot(Long volumeId, Long policyId)
|
||||
throws ResourceAllocationException {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Snapshot createSnapshot(Long volumeId, Long policyId,
|
||||
Long snapshotId, Account snapshotOwner) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean backupSnapshotToSecondaryStorage(SnapshotVO snapshot) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postCreateSnapshot(Long volumeId, Long snapshotId,
|
||||
Long policyId, boolean backedUp) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean destroySnapshot(long userId, long snapshotId, long policyId) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean deletePolicy(long userId, Long policyId) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SnapshotPolicyVO> listPoliciesforVolume(long volumeId) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SnapshotVO> listSnapsforVolume(long volumeId) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deletePoliciesForVolume(Long volumeId) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean deleteSnapshotDirsForAccount(long accountId) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SnapshotPolicyVO getPolicyForVolume(long volumeId) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean destroySnapshotBackUp(long snapshotId) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SnapshotVO createSnapshotOnPrimary(VolumeVO volume, Long polocyId,
|
||||
Long snapshotId) throws ResourceAllocationException {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SnapshotPolicyVO> listPoliciesforSnapshot(long snapshotId) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SnapshotVO> listSnapsforPolicy(long policyId, Filter filter) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void downloadSnapshotsFromSwift(SnapshotVO ss) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public HostVO getSecondaryStorageHost(SnapshotVO snapshot) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSecondaryStorageURL(SnapshotVO snapshot) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteSnapshotsForVolume(String secondaryStoragePoolUrl,
|
||||
Long dcId, Long accountId, Long volumeId) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteSnapshotsDirForVolume(String secondaryStoragePoolUrl,
|
||||
Long dcId, Long accountId, Long volumeId) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canOperateOnVolume(VolumeVO volume) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
}
|
||||
211
server/test/com/cloud/template/MockTemplateManagerImpl.java
Executable file
211
server/test/com/cloud/template/MockTemplateManagerImpl.java
Executable file
@ -0,0 +1,211 @@
|
||||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
package com.cloud.template;
|
||||
|
||||
import java.net.URISyntaxException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.ejb.Local;
|
||||
import javax.naming.ConfigurationException;
|
||||
|
||||
import com.cloud.api.commands.CopyTemplateCmd;
|
||||
import com.cloud.api.commands.DeleteIsoCmd;
|
||||
import com.cloud.api.commands.DeleteTemplateCmd;
|
||||
import com.cloud.api.commands.ExtractIsoCmd;
|
||||
import com.cloud.api.commands.ExtractTemplateCmd;
|
||||
import com.cloud.api.commands.ListTemplateOrIsoPermissionsCmd;
|
||||
import com.cloud.api.commands.RegisterIsoCmd;
|
||||
import com.cloud.api.commands.RegisterTemplateCmd;
|
||||
import com.cloud.api.commands.UpdateTemplateOrIsoPermissionsCmd;
|
||||
import com.cloud.dc.DataCenterVO;
|
||||
import com.cloud.exception.InternalErrorException;
|
||||
import com.cloud.exception.ResourceAllocationException;
|
||||
import com.cloud.exception.StorageUnavailableException;
|
||||
import com.cloud.host.HostVO;
|
||||
import com.cloud.storage.StoragePool;
|
||||
import com.cloud.storage.StoragePoolVO;
|
||||
import com.cloud.storage.VMTemplateHostVO;
|
||||
import com.cloud.storage.VMTemplateStoragePoolVO;
|
||||
import com.cloud.storage.VMTemplateVO;
|
||||
import com.cloud.utils.component.Manager;
|
||||
|
||||
|
||||
@Local(value={TemplateManager.class, TemplateService.class})
|
||||
public class MockTemplateManagerImpl implements TemplateManager, Manager, TemplateService {
|
||||
|
||||
@Override
|
||||
public VirtualMachineTemplate registerTemplate(RegisterTemplateCmd cmd)
|
||||
throws URISyntaxException, ResourceAllocationException {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public VirtualMachineTemplate registerIso(RegisterIsoCmd cmd)
|
||||
throws IllegalArgumentException, ResourceAllocationException {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public VirtualMachineTemplate copyTemplate(CopyTemplateCmd cmd)
|
||||
throws StorageUnavailableException, ResourceAllocationException {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public VirtualMachineTemplate prepareTemplate(long templateId, long zoneId) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean detachIso(long vmId) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean attachIso(long isoId, long vmId) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean deleteTemplate(DeleteTemplateCmd cmd) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean deleteIso(DeleteIsoCmd cmd) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long extract(ExtractIsoCmd cmd) throws InternalErrorException {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long extract(ExtractTemplateCmd cmd) throws InternalErrorException {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public VirtualMachineTemplate getTemplate(long templateId) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> listTemplatePermissions(
|
||||
ListTemplateOrIsoPermissionsCmd cmd) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateTemplateOrIsoPermissions(
|
||||
UpdateTemplateOrIsoPermissionsCmd cmd) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean configure(String name, Map<String, Object> params)
|
||||
throws ConfigurationException {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean start() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean stop() {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public VMTemplateStoragePoolVO prepareTemplateForCreate(
|
||||
VMTemplateVO template, StoragePool pool) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean resetTemplateDownloadStateOnPool(
|
||||
long templateStoragePoolRefId) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean copy(long userId, VMTemplateVO template, HostVO srcSecHost,
|
||||
DataCenterVO srcZone, DataCenterVO dstZone)
|
||||
throws StorageUnavailableException, ResourceAllocationException {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean delete(long userId, long templateId, Long zoneId) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<VMTemplateStoragePoolVO> getUnusedTemplatesInPool(
|
||||
StoragePoolVO pool) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void evictTemplateFromStoragePool(
|
||||
VMTemplateStoragePoolVO templatePoolVO) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean templateIsDeleteable(VMTemplateHostVO templateHostRef) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public VMTemplateHostVO prepareISOForCreate(VMTemplateVO template,
|
||||
StoragePool pool) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user