cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kelv...@apache.org
Subject [7/50] [abbrv] Added Mock ApiServer, Regions API calls with api keys
Date Fri, 01 Feb 2013 19:38:12 GMT
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/f0f33bf4/server/test/com/cloud/network/security/MockSecurityGroupManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/network/security/MockSecurityGroupManagerImpl.java b/server/test/com/cloud/network/security/MockSecurityGroupManagerImpl.java
new file mode 100755
index 0000000..9c71c62
--- /dev/null
+++ b/server/test/com/cloud/network/security/MockSecurityGroupManagerImpl.java
@@ -0,0 +1,198 @@
+// 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.security;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.ejb.Local;
+import javax.naming.ConfigurationException;
+
+import com.cloud.api.commands.AuthorizeSecurityGroupEgressCmd;
+import com.cloud.api.commands.AuthorizeSecurityGroupIngressCmd;
+import com.cloud.api.commands.CreateSecurityGroupCmd;
+import com.cloud.api.commands.DeleteSecurityGroupCmd;
+import com.cloud.api.commands.ListSecurityGroupsCmd;
+import com.cloud.api.commands.RevokeSecurityGroupEgressCmd;
+import com.cloud.api.commands.RevokeSecurityGroupIngressCmd;
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.exception.PermissionDeniedException;
+import com.cloud.exception.ResourceInUseException;
+import com.cloud.utils.Pair;
+import com.cloud.utils.component.Manager;
+import com.cloud.utils.fsm.StateListener;
+import com.cloud.vm.VirtualMachine;
+import com.cloud.vm.VirtualMachine.Event;
+import com.cloud.vm.VirtualMachine.State;
+
+@Local(value = { SecurityGroupManager.class, SecurityGroupService.class })
+public class MockSecurityGroupManagerImpl implements SecurityGroupManager, SecurityGroupService,
Manager, StateListener<State, VirtualMachine.Event, VirtualMachine> {
+
+	@Override
+	public boolean preStateTransitionEvent(State oldState, Event event,
+			State newState, VirtualMachine vo, boolean status, Object opaque) {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	@Override
+	public boolean postStateTransitionEvent(State oldState, Event event,
+			State newState, VirtualMachine vo, boolean status, Object opaque) {
+		// 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 SecurityGroup createSecurityGroup(CreateSecurityGroupCmd command)
+			throws PermissionDeniedException, InvalidParameterValueException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public boolean revokeSecurityGroupIngress(RevokeSecurityGroupIngressCmd cmd) {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	@Override
+	public boolean revokeSecurityGroupEgress(RevokeSecurityGroupEgressCmd cmd) {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	@Override
+	public boolean deleteSecurityGroup(DeleteSecurityGroupCmd cmd)
+			throws ResourceInUseException {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	@Override
+	public List<? extends SecurityGroupRules> searchForSecurityGroupRules(
+			ListSecurityGroupsCmd cmd) throws PermissionDeniedException,
+			InvalidParameterValueException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public List<? extends SecurityRule> authorizeSecurityGroupIngress(
+			AuthorizeSecurityGroupIngressCmd cmd) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public List<? extends SecurityRule> authorizeSecurityGroupEgress(
+			AuthorizeSecurityGroupEgressCmd cmd) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public SecurityGroupVO createSecurityGroup(String name, String description,
+			Long domainId, Long accountId, String accountName) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public SecurityGroupVO createDefaultSecurityGroup(Long accountId) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public boolean addInstanceToGroups(Long userVmId, List<Long> groups) {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	@Override
+	public void removeInstanceFromGroups(long userVmId) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	@Override
+	public void fullSync(long agentId,
+			HashMap<String, Pair<Long, Long>> newGroupStates) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	@Override
+	public String getSecurityGroupsNamesForVm(long vmId) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public List<SecurityGroupVO> getSecurityGroupsForVm(long vmId) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public boolean isVmSecurityGroupEnabled(Long vmId) {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	@Override
+	public SecurityGroup getDefaultSecurityGroup(long accountId) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public SecurityGroup getSecurityGroup(String name, long accountId) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public boolean isVmMappedToDefaultSecurityGroup(long vmId) {
+		// TODO Auto-generated method stub
+		return false;
+	}
+   }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/f0f33bf4/server/test/com/cloud/storage/MockStorageManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/storage/MockStorageManagerImpl.java b/server/test/com/cloud/storage/MockStorageManagerImpl.java
new file mode 100755
index 0000000..6273489
--- /dev/null
+++ b/server/test/com/cloud/storage/MockStorageManagerImpl.java
@@ -0,0 +1,679 @@
+// 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;
+
+import java.math.BigDecimal;
+import java.net.Inet6Address;
+import java.net.InetAddress;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.UnknownHostException;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Date;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Random;
+import java.util.Set;
+import java.util.UUID;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.TimeUnit;
+
+import javax.ejb.Local;
+import javax.naming.ConfigurationException;
+
+import org.apache.log4j.Logger;
+
+import com.cloud.agent.AgentManager;
+import com.cloud.agent.api.Answer;
+import com.cloud.agent.api.BackupSnapshotCommand;
+import com.cloud.agent.api.CleanupSnapshotBackupCommand;
+import com.cloud.agent.api.Command;
+import com.cloud.agent.api.CreateStoragePoolCommand;
+import com.cloud.agent.api.CreateVolumeFromSnapshotAnswer;
+import com.cloud.agent.api.CreateVolumeFromSnapshotCommand;
+import com.cloud.agent.api.DeleteStoragePoolCommand;
+import com.cloud.agent.api.ManageSnapshotCommand;
+import com.cloud.agent.api.ModifyStoragePoolAnswer;
+import com.cloud.agent.api.ModifyStoragePoolCommand;
+import com.cloud.agent.api.UpgradeSnapshotCommand;
+import com.cloud.agent.api.storage.CopyVolumeAnswer;
+import com.cloud.agent.api.storage.CopyVolumeCommand;
+import com.cloud.agent.api.storage.CreateAnswer;
+import com.cloud.agent.api.storage.CreateCommand;
+import com.cloud.agent.api.storage.DeleteTemplateCommand;
+import com.cloud.agent.api.storage.DeleteVolumeCommand;
+import com.cloud.agent.api.storage.DestroyCommand;
+import com.cloud.agent.api.to.StorageFilerTO;
+import com.cloud.agent.api.to.VolumeTO;
+import com.cloud.agent.manager.Commands;
+import com.cloud.alert.AlertManager;
+import com.cloud.api.ApiDBUtils;
+import com.cloud.api.commands.CancelPrimaryStorageMaintenanceCmd;
+import com.cloud.api.commands.CreateStoragePoolCmd;
+import com.cloud.api.commands.CreateVolumeCmd;
+import com.cloud.api.commands.DeletePoolCmd;
+import com.cloud.api.commands.ListVolumesCmd;
+import com.cloud.api.commands.UpdateStoragePoolCmd;
+import com.cloud.api.commands.UploadVolumeCmd;
+import com.cloud.async.AsyncJobManager;
+import com.cloud.capacity.Capacity;
+import com.cloud.capacity.CapacityManager;
+import com.cloud.capacity.CapacityState;
+import com.cloud.capacity.CapacityVO;
+import com.cloud.capacity.dao.CapacityDao;
+import com.cloud.cluster.CheckPointManager;
+import com.cloud.cluster.ClusterManagerListener;
+import com.cloud.cluster.ManagementServerHostVO;
+import com.cloud.configuration.Config;
+import com.cloud.configuration.ConfigurationManager;
+import com.cloud.configuration.Resource.ResourceType;
+import com.cloud.configuration.dao.ConfigurationDao;
+import com.cloud.consoleproxy.ConsoleProxyManager;
+import com.cloud.dc.ClusterVO;
+import com.cloud.dc.DataCenterVO;
+import com.cloud.dc.HostPodVO;
+import com.cloud.dc.Pod;
+import com.cloud.dc.dao.ClusterDao;
+import com.cloud.dc.dao.DataCenterDao;
+import com.cloud.dc.dao.HostPodDao;
+import com.cloud.deploy.DeployDestination;
+import com.cloud.domain.Domain;
+import com.cloud.domain.dao.DomainDao;
+import com.cloud.event.ActionEvent;
+import com.cloud.event.EventTypes;
+import com.cloud.event.UsageEventVO;
+import com.cloud.event.dao.EventDao;
+import com.cloud.event.dao.UsageEventDao;
+import com.cloud.exception.AgentUnavailableException;
+import com.cloud.exception.ConcurrentOperationException;
+import com.cloud.exception.DiscoveryException;
+import com.cloud.exception.InsufficientCapacityException;
+import com.cloud.exception.InsufficientStorageCapacityException;
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.exception.OperationTimedoutException;
+import com.cloud.exception.PermissionDeniedException;
+import com.cloud.exception.ResourceAllocationException;
+import com.cloud.exception.ResourceInUseException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.exception.StorageUnavailableException;
+import com.cloud.host.Host;
+import com.cloud.host.HostVO;
+import com.cloud.host.Status;
+import com.cloud.host.dao.HostDao;
+import com.cloud.hypervisor.Hypervisor.HypervisorType;
+import com.cloud.hypervisor.HypervisorGuruManager;
+import com.cloud.network.NetworkManager;
+import com.cloud.offering.ServiceOffering;
+import com.cloud.org.Grouping;
+import com.cloud.org.Grouping.AllocationState;
+import com.cloud.projects.Project.ListProjectResourcesCriteria;
+import com.cloud.resource.ResourceManager;
+import com.cloud.resource.ResourceState;
+import com.cloud.server.ManagementServer;
+import com.cloud.server.ResourceTag.TaggedResourceType;
+import com.cloud.server.StatsCollector;
+import com.cloud.service.ServiceOfferingVO;
+import com.cloud.service.dao.ServiceOfferingDao;
+import com.cloud.storage.Storage.ImageFormat;
+import com.cloud.storage.Storage.StoragePoolType;
+import com.cloud.storage.Volume.Event;
+import com.cloud.storage.Volume.Type;
+import com.cloud.storage.allocator.StoragePoolAllocator;
+import com.cloud.storage.dao.DiskOfferingDao;
+import com.cloud.storage.dao.SnapshotDao;
+import com.cloud.storage.dao.SnapshotPolicyDao;
+import com.cloud.storage.dao.StoragePoolDao;
+import com.cloud.storage.dao.StoragePoolHostDao;
+import com.cloud.storage.dao.StoragePoolWorkDao;
+import com.cloud.storage.dao.VMTemplateDao;
+import com.cloud.storage.dao.VMTemplateHostDao;
+import com.cloud.storage.dao.VMTemplatePoolDao;
+import com.cloud.storage.dao.VMTemplateSwiftDao;
+import com.cloud.storage.dao.VolumeDao;
+import com.cloud.storage.dao.VolumeHostDao;
+import com.cloud.storage.download.DownloadMonitor;
+import com.cloud.storage.listener.StoragePoolMonitor;
+import com.cloud.storage.secondary.SecondaryStorageVmManager;
+import com.cloud.storage.snapshot.SnapshotManager;
+import com.cloud.storage.snapshot.SnapshotScheduler;
+import com.cloud.tags.ResourceTagVO;
+import com.cloud.tags.dao.ResourceTagDao;
+import com.cloud.template.TemplateManager;
+import com.cloud.user.Account;
+import com.cloud.user.AccountManager;
+import com.cloud.user.ResourceLimitService;
+import com.cloud.user.User;
+import com.cloud.user.UserContext;
+import com.cloud.user.dao.AccountDao;
+import com.cloud.user.dao.UserDao;
+import com.cloud.uservm.UserVm;
+import com.cloud.utils.EnumUtils;
+import com.cloud.utils.NumbersUtil;
+import com.cloud.utils.Pair;
+import com.cloud.utils.Ternary;
+import com.cloud.utils.UriUtils;
+import com.cloud.utils.component.Adapters;
+import com.cloud.utils.component.ComponentLocator;
+import com.cloud.utils.component.Inject;
+import com.cloud.utils.component.Manager;
+import com.cloud.utils.concurrency.NamedThreadFactory;
+import com.cloud.utils.db.DB;
+import com.cloud.utils.db.Filter;
+import com.cloud.utils.db.GenericSearchBuilder;
+import com.cloud.utils.db.GlobalLock;
+import com.cloud.utils.db.JoinBuilder;
+import com.cloud.utils.db.JoinBuilder.JoinType;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+import com.cloud.utils.db.SearchCriteria.Op;
+import com.cloud.utils.db.Transaction;
+import com.cloud.utils.exception.CloudRuntimeException;
+import com.cloud.utils.exception.ExecutionException;
+import com.cloud.utils.fsm.NoTransitionException;
+import com.cloud.utils.fsm.StateMachine2;
+import com.cloud.vm.ConsoleProxyVO;
+import com.cloud.vm.DiskProfile;
+import com.cloud.vm.DomainRouterVO;
+import com.cloud.vm.SecondaryStorageVmVO;
+import com.cloud.vm.UserVmManager;
+import com.cloud.vm.UserVmVO;
+import com.cloud.vm.VMInstanceVO;
+import com.cloud.vm.VirtualMachine;
+import com.cloud.vm.VirtualMachine.State;
+import com.cloud.vm.VirtualMachineManager;
+import com.cloud.vm.VirtualMachineProfile;
+import com.cloud.vm.VirtualMachineProfileImpl;
+import com.cloud.vm.dao.ConsoleProxyDao;
+import com.cloud.vm.dao.DomainRouterDao;
+import com.cloud.vm.dao.SecondaryStorageVmDao;
+import com.cloud.vm.dao.UserVmDao;
+import com.cloud.vm.dao.VMInstanceDao;
+
+@Local(value = { StorageManager.class, StorageService.class })
+public class MockStorageManagerImpl implements StorageManager, Manager, ClusterManagerListener
{
+
+	@Override
+	public StoragePool createPool(CreateStoragePoolCmd cmd)
+			throws ResourceInUseException, IllegalArgumentException,
+			UnknownHostException, ResourceUnavailableException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public Volume allocVolume(CreateVolumeCmd cmd)
+			throws ResourceAllocationException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public Volume createVolume(CreateVolumeCmd cmd) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public boolean deleteVolume(long volumeId)
+			throws ConcurrentOperationException {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	@Override
+	public boolean deletePool(DeletePoolCmd cmd) {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	@Override
+	public StoragePool preparePrimaryStorageForMaintenance(Long primaryStorageId)
+			throws ResourceUnavailableException, InsufficientCapacityException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public StoragePool cancelPrimaryStorageForMaintenance(
+			CancelPrimaryStorageMaintenanceCmd cmd)
+			throws ResourceUnavailableException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public StoragePool updateStoragePool(UpdateStoragePoolCmd cmd)
+			throws IllegalArgumentException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public StoragePool getStoragePool(long id) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public Volume migrateVolume(Long volumeId, Long storagePoolId)
+			throws ConcurrentOperationException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public List<? extends Volume> searchForVolumes(ListVolumesCmd cmd) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public Volume uploadVolume(UploadVolumeCmd cmd)
+			throws ResourceAllocationException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public void onManagementNodeJoined(List<ManagementServerHostVO> nodeList,
+			long selfNodeId) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	@Override
+	public void onManagementNodeLeft(List<ManagementServerHostVO> nodeList,
+			long selfNodeId) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	@Override
+	public void onManagementNodeIsolated() {
+		// TODO Auto-generated method stub
+		
+	}
+
+	@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 boolean canVmRestartOnAnotherServer(long vmId) {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	@Override
+	public Pair<String, String> getAbsoluteIsoPath(long templateId,
+			long dataCenterId) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public String getSecondaryStorageURL(long zoneId) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public String getStoragePoolTags(long poolId) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public HostVO getSecondaryStorageHost(long zoneId) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public VMTemplateHostVO findVmTemplateHost(long templateId, StoragePool pool) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public VolumeVO moveVolume(VolumeVO volume, long destPoolDcId,
+			Long destPoolPodId, Long destPoolClusterId,
+			HypervisorType dataDiskHyperType)
+			throws ConcurrentOperationException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public VolumeVO createVolume(VolumeVO volume, VMInstanceVO vm,
+			VMTemplateVO template, DataCenterVO dc, HostPodVO pod,
+			Long clusterId, ServiceOfferingVO offering,
+			DiskOfferingVO diskOffering, List<StoragePoolVO> avoids, long size,
+			HypervisorType hyperType) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public boolean destroyVolume(VolumeVO volume)
+			throws ConcurrentOperationException {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	@Override
+	public void createCapacityEntry(StoragePoolVO storagePool) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	@Override
+	public boolean volumeOnSharedStoragePool(VolumeVO volume) {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	@Override
+	public Answer sendToPool(long poolId, Command cmd)
+			throws StorageUnavailableException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public Answer sendToPool(StoragePool pool, Command cmd)
+			throws StorageUnavailableException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public Answer[] sendToPool(long poolId, Commands cmd)
+			throws StorageUnavailableException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public Answer[] sendToPool(StoragePool pool, Commands cmds)
+			throws StorageUnavailableException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public Pair<Long, Answer[]> sendToPool(StoragePool pool,
+			long[] hostIdsToTryFirst, List<Long> hostIdsToAvoid, Commands cmds)
+			throws StorageUnavailableException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public Pair<Long, Answer> sendToPool(StoragePool pool,
+			long[] hostIdsToTryFirst, List<Long> hostIdsToAvoid, Command cmd)
+			throws StorageUnavailableException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public boolean volumeInactive(VolumeVO volume) {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	@Override
+	public String getVmNameOnVolume(VolumeVO volume) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public boolean isLocalStorageActiveOnHost(Host host) {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	@Override
+	public void cleanupStorage(boolean recurring) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	@Override
+	public String getPrimaryStorageNameLabel(VolumeVO volume) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public <T extends VMInstanceVO> DiskProfile allocateRawVolume(Type type,
+			String name, DiskOfferingVO offering, Long size, T vm, Account owner) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public <T extends VMInstanceVO> DiskProfile allocateTemplatedVolume(
+			Type type, String name, DiskOfferingVO offering,
+			VMTemplateVO template, T vm, Account owner) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public void createCapacityEntry(StoragePoolVO storagePool,
+			short capacityType, long allocated) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	@Override
+	public void prepare(VirtualMachineProfile<? extends VirtualMachine> vm,
+			DeployDestination dest) throws StorageUnavailableException,
+			InsufficientStorageCapacityException, ConcurrentOperationException {
+		// TODO Auto-generated method stub
+		
+	}
+
+	@Override
+	public void release(VirtualMachineProfile<? extends VMInstanceVO> profile) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	@Override
+	public void cleanupVolumes(long vmId) throws ConcurrentOperationException {
+		// TODO Auto-generated method stub
+		
+	}
+
+	@Override
+	public void prepareForMigration(
+			VirtualMachineProfile<? extends VirtualMachine> vm,
+			DeployDestination dest) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	@Override
+	public Answer sendToPool(StoragePool pool, long[] hostIdsToTryFirst,
+			Command cmd) throws StorageUnavailableException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public CapacityVO getSecondaryStorageUsedStats(Long hostId, Long zoneId) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public CapacityVO getStoragePoolUsedStats(Long poolId, Long clusterId,
+			Long podId, Long zoneId) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public boolean createStoragePool(long hostId, StoragePoolVO pool) {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	@Override
+	public boolean delPoolFromHost(long hostId) {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	@Override
+	public HostVO getSecondaryStorageHost(long zoneId, long tmpltId) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public List<HostVO> getSecondaryStorageHosts(long zoneId) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public List<StoragePoolVO> ListByDataCenterHypervisor(long datacenterId,
+			HypervisorType type) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public List<VMInstanceVO> listByStoragePool(long storagePoolId) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public StoragePoolVO findLocalStorageOnHost(long hostId) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public VMTemplateHostVO getTemplateHostRef(long zoneId, long tmpltId,
+			boolean readyOnly) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public boolean StorageMigration(
+			VirtualMachineProfile<? extends VirtualMachine> vm,
+			StoragePool destPool) throws ConcurrentOperationException {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	@Override
+	public boolean stateTransitTo(Volume vol, Event event)
+			throws NoTransitionException {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	@Override
+	public VolumeVO allocateDuplicateVolume(VolumeVO oldVol, Long templateId) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public Host updateSecondaryStorage(long secStorageId, String newUrl) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public List<Long> getUpHostsInPool(long poolId) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public void cleanupSecondaryStorage(boolean recurring) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	@Override
+	public VolumeVO copyVolumeFromSecToPrimary(VolumeVO volume,
+			VMInstanceVO vm, VMTemplateVO template, DataCenterVO dc,
+			HostPodVO pod, Long clusterId, ServiceOfferingVO offering,
+			DiskOfferingVO diskOffering, List<StoragePoolVO> avoids, long size,
+			HypervisorType hyperType) throws NoTransitionException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public String getSupportedImageFormatForCluster(Long clusterId) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public HypervisorType getHypervisorTypeFromFormat(ImageFormat format) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public boolean storagePoolHasEnoughSpace(List<Volume> volume,
+			StoragePool pool) {
+		// TODO Auto-generated method stub
+		return false;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/f0f33bf4/server/test/com/cloud/user/MockAccountManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/user/MockAccountManagerImpl.java b/server/test/com/cloud/user/MockAccountManagerImpl.java
index 0d15cd7..c4c2e6b 100644
--- a/server/test/com/cloud/user/MockAccountManagerImpl.java
+++ b/server/test/com/cloud/user/MockAccountManagerImpl.java
@@ -207,12 +207,6 @@ public class MockAccountManagerImpl implements Manager, AccountManager,
AccountS
     }
 
     @Override
-    public UserVO createUser(String userName, String password, String firstName, String lastName,
String email, String timeZone, String accountName, Long domainId) {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    @Override
     public Long checkAccessAndSpecifyAuthority(Account caller, Long zoneId) {
         // TODO Auto-generated method stub
         return null;
@@ -280,23 +274,6 @@ public class MockAccountManagerImpl implements Manager, AccountManager,
AccountS
         return true;
     }
 
-
-	@Override
-	public UserAccount createUserAccount(String userName, String password,
-			String firstName, String lastName, String email, String timezone,
-			String accountName, short accountType, Long domainId,
-			String networkDomain, Map<String, String> details) {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	@Override
-	public Account createAccount(String accountName, short accountType,
-			Long domainId, String networkDomain, Map details) {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
     @Override
     public List<? extends Account> searchForAccounts(ListAccountsCmd cmd) {
         // TODO Auto-generated method stub
@@ -343,4 +320,42 @@ public class MockAccountManagerImpl implements Manager, AccountManager,
AccountS
         return null;
     }
 
+	@Override
+	public UserAccount createUserAccount(String userName, String password,
+			String firstName, String lastName, String email, String timezone,
+			String accountName, short accountType, Long domainId,
+			String networkDomain, Map<String, String> details,
+			String accountUUID, String userUUID, Integer regionId) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public User createUser(String userName, String password, String firstName,
+			String lastName, String email, String timeZone, String accountName,
+			Long domainId, String userUUID, Integer regionId) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public User findUser(String username, Long domainId) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public Account findAccount(Long id) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public Account createAccount(String accountName, short accountType,
+			Long domainId, String networkDomain, Map details, String uuid,
+			int regionId) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/f0f33bf4/server/test/com/cloud/user/MockDomainManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/user/MockDomainManagerImpl.java b/server/test/com/cloud/user/MockDomainManagerImpl.java
index e99e4d9..2927526 100644
--- a/server/test/com/cloud/user/MockDomainManagerImpl.java
+++ b/server/test/com/cloud/user/MockDomainManagerImpl.java
@@ -25,6 +25,7 @@ import javax.naming.ConfigurationException;
 
 import com.cloud.api.commands.ListDomainChildrenCmd;
 import com.cloud.api.commands.ListDomainsCmd;
+import com.cloud.api.commands.UpdateDomainCmd;
 import com.cloud.domain.Domain;
 import com.cloud.domain.DomainVO;
 import com.cloud.exception.PermissionDeniedException;
@@ -34,12 +35,6 @@ import com.cloud.utils.component.Manager;
 public class MockDomainManagerImpl implements  Manager, DomainManager {
 
     @Override
-    public Domain createDomain(String name, Long parentId, String networkDomain) {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    @Override
     public Domain getDomain(long id) {
         // TODO Auto-generated method stub
         return null;
@@ -78,13 +73,6 @@ public class MockDomainManagerImpl implements  Manager, DomainManager {
     }
 
     @Override
-    public Domain createDomain(String name, Long parentId, Long ownerId,
-            String networkDomain) {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    @Override
     public DomainVO findDomainByPath(String domainPath) {
         // TODO Auto-generated method stub
         return null;
@@ -138,4 +126,24 @@ public class MockDomainManagerImpl implements  Manager, DomainManager
{
         return null;
     }
 
+	@Override
+	public Domain createDomain(String name, Long parentId,
+			String networkDomain, String domainUUID, Integer regionId) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public Domain updateDomain(UpdateDomainCmd cmd) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public Domain createDomain(String name, Long parentId, Long ownerId,
+			String networkDomain, String domainUUID, Integer regionId) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/f0f33bf4/server/test/com/cloud/vm/MockUserVmManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/vm/MockUserVmManagerImpl.java b/server/test/com/cloud/vm/MockUserVmManagerImpl.java
index efc6916..1baf34a 100644
--- a/server/test/com/cloud/vm/MockUserVmManagerImpl.java
+++ b/server/test/com/cloud/vm/MockUserVmManagerImpl.java
@@ -16,6 +16,7 @@
 // under the License.
 package com.cloud.vm;
 
+import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -194,7 +195,7 @@ public class MockUserVmManagerImpl implements UserVmManager, UserVmService,
Mana
     @Override
     public List<UserVmVO> searchForUserVMs(Criteria c, Account caller, Long domainId,
boolean isRecursive, List<Long> permittedAccounts, boolean listAll, ListProjectResourcesCriteria
listProjectResourcesCriteria, Map<String, String> tags) {
         // TODO Auto-generated method stub
-        return null;
+        return new ArrayList<UserVmVO>();
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/f0f33bf4/server/test/com/cloud/vpc/MockConfigurationManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/vpc/MockConfigurationManagerImpl.java b/server/test/com/cloud/vpc/MockConfigurationManagerImpl.java
index 2a25886..6fa3123 100644
--- a/server/test/com/cloud/vpc/MockConfigurationManagerImpl.java
+++ b/server/test/com/cloud/vpc/MockConfigurationManagerImpl.java
@@ -321,8 +321,7 @@ public class MockConfigurationManagerImpl implements ConfigurationManager,
Confi
      */
     @Override
     public Long getDefaultPageSize() {
-        // TODO Auto-generated method stub
-        return null;
+        return 500L;
     }
 
     /* (non-Javadoc)

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/f0f33bf4/setup/db/create-schema.sql
----------------------------------------------------------------------
diff --git a/setup/db/create-schema.sql b/setup/db/create-schema.sql
index bdaecb0..695dc44 100755
--- a/setup/db/create-schema.sql
+++ b/setup/db/create-schema.sql
@@ -891,7 +891,7 @@ CREATE TABLE  `cloud`.`user` (
   `timezone` varchar(30) default NULL,
   `registration_token` varchar(255) default NULL,
   `is_registered` tinyint NOT NULL DEFAULT 0 COMMENT '1: yes, 0: no',
-  `region_id` bigint unsigned,
+  `region_id` int unsigned,
   `incorrect_login_attempts` integer unsigned NOT NULL DEFAULT 0,
   PRIMARY KEY  (`id`),
   INDEX `i_user__removed`(`removed`),
@@ -1241,7 +1241,7 @@ CREATE TABLE  `cloud`.`domain` (
   `state` char(32) NOT NULL default 'Active' COMMENT 'state of the domain',
   `network_domain` varchar(255),
   `type` varchar(255) NOT NULL DEFAULT 'Normal' COMMENT 'type of the domain - can be Normal
or Project',
-  `region_id` bigint unsigned,  
+  `region_id` int unsigned,  
   PRIMARY KEY  (`id`),
   UNIQUE (parent, name, removed),
   INDEX `i_domain__path`(`path`),
@@ -1260,7 +1260,7 @@ CREATE TABLE  `cloud`.`account` (
   `cleanup_needed` tinyint(1) NOT NULL default '0',
   `network_domain` varchar(255),
   `default_zone_id` bigint unsigned,
-  `region_id` bigint unsigned,  
+  `region_id` int unsigned,  
   PRIMARY KEY  (`id`),
   INDEX i_account__removed(`removed`),
   CONSTRAINT `fk_account__default_zone_id` FOREIGN KEY `fk_account__default_zone_id`(`default_zone_id`)
REFERENCES `data_center`(`id`) ON DELETE CASCADE,
@@ -2214,10 +2214,11 @@ CREATE TABLE  `cloud`.`netscaler_pod_ref` (
 
 
 CREATE TABLE  `cloud`.`region` (
-  `id` bigint unsigned NOT NULL UNIQUE,
-  `name` varchar(255),
-  `end_point` varchar(255),
-  `status` varchar(32) NOT NULL,
+  `id` int unsigned NOT NULL UNIQUE,
+  `name` varchar(255) NOT NULL,
+  `end_point` varchar(255) NOT NULL,
+  `api_key` varchar(255),
+  `secret_key` varchar(255),
   `removed` datetime COMMENT 'date removed if not null',
   PRIMARY KEY  (`id`)
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/f0f33bf4/utils/conf/db.properties
----------------------------------------------------------------------
diff --git a/utils/conf/db.properties b/utils/conf/db.properties
index 6bdb6d6..caf9003 100644
--- a/utils/conf/db.properties
+++ b/utils/conf/db.properties
@@ -20,6 +20,7 @@
 # in which the management server(Tomcat) is running
 cluster.node.IP=127.0.0.1
 cluster.servlet.port=9090
+region.id=1
 
 # CloudStack database settings
 db.cloud.username=cloud

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/f0f33bf4/utils/src/com/cloud/utils/db/GenericDao.java
----------------------------------------------------------------------
diff --git a/utils/src/com/cloud/utils/db/GenericDao.java b/utils/src/com/cloud/utils/db/GenericDao.java
index 3ab319e..ca4c21a 100755
--- a/utils/src/com/cloud/utils/db/GenericDao.java
+++ b/utils/src/com/cloud/utils/db/GenericDao.java
@@ -260,4 +260,6 @@ public interface GenericDao<T, ID extends Serializable> {
      * @return
      */
     Class<T> getEntityBeanType();
+    
+    public int getRegionId();
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/f0f33bf4/utils/src/com/cloud/utils/db/GenericDaoBase.java
----------------------------------------------------------------------
diff --git a/utils/src/com/cloud/utils/db/GenericDaoBase.java b/utils/src/com/cloud/utils/db/GenericDaoBase.java
index 3df8374..271cec5 100755
--- a/utils/src/com/cloud/utils/db/GenericDaoBase.java
+++ b/utils/src/com/cloud/utils/db/GenericDaoBase.java
@@ -1769,4 +1769,9 @@ public abstract class GenericDaoBase<T, ID extends Serializable>
implements Gene
         factory.setCallback(0, sc);
         return sc;
     }
+    
+    @Override
+    public int getRegionId(){
+    	return Transaction.s_region_id;
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/f0f33bf4/utils/src/com/cloud/utils/db/Transaction.java
----------------------------------------------------------------------
diff --git a/utils/src/com/cloud/utils/db/Transaction.java b/utils/src/com/cloud/utils/db/Transaction.java
index bcf7ae1..f05d263 100755
--- a/utils/src/com/cloud/utils/db/Transaction.java
+++ b/utils/src/com/cloud/utils/db/Transaction.java
@@ -82,6 +82,7 @@ public class Transaction {
     public static final short AWSAPI_DB = 2;
     public static final short SIMULATOR_DB = 3;
     public static final short CONNECTED_DB = -1;
+    public static int s_region_id;
 
     private static AtomicLong s_id = new AtomicLong();
     private static final TransactionMBeanImpl s_mbean = new TransactionMBeanImpl();
@@ -1057,6 +1058,12 @@ public class Transaction {
                 System.setProperty("javax.net.ssl.trustStorePassword", dbProps.getProperty("db.cloud.trustStorePassword"));
             }
 
+            String regionId = dbProps.getProperty("region.id");
+            if(regionId == null){
+            	s_region_id = 1;
+            } else {
+            	s_region_id = Integer.parseInt(regionId);
+            }
             final GenericObjectPool cloudConnectionPool = new GenericObjectPool(null, cloudMaxActive,
GenericObjectPool.DEFAULT_WHEN_EXHAUSTED_ACTION,
                     cloudMaxWait, cloudMaxIdle, cloudTestOnBorrow, false, cloudTimeBtwEvictionRunsMillis,
1, cloudMinEvcitableIdleTimeMillis, cloudTestWhileIdle);
             final ConnectionFactory cloudConnectionFactory = new DriverManagerConnectionFactory("jdbc:mysql://"+cloudHost
+ ":" + cloudPort + "/" + cloudDbName +


Mime
View raw message