http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/a1fdb0c2/server/src/org/apache/cloudstack/region/dao/RegionSyncDao.java ---------------------------------------------------------------------- diff --git a/server/src/org/apache/cloudstack/region/dao/RegionSyncDao.java b/server/src/org/apache/cloudstack/region/dao/RegionSyncDao.java deleted file mode 100644 index df287e5..0000000 --- a/server/src/org/apache/cloudstack/region/dao/RegionSyncDao.java +++ /dev/null @@ -1,24 +0,0 @@ -// 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 org.apache.cloudstack.region.dao; - -import org.apache.cloudstack.region.RegionSyncVO; - -import com.cloud.utils.db.GenericDao; - -public interface RegionSyncDao extends GenericDao<RegionSyncVO, Integer> { -}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/a1fdb0c2/server/src/org/apache/cloudstack/region/dao/RegionSyncDaoImpl.java ---------------------------------------------------------------------- diff --git a/server/src/org/apache/cloudstack/region/dao/RegionSyncDaoImpl.java b/server/src/org/apache/cloudstack/region/dao/RegionSyncDaoImpl.java deleted file mode 100644 index 9cd9b0d..0000000 --- a/server/src/org/apache/cloudstack/region/dao/RegionSyncDaoImpl.java +++ /dev/null @@ -1,35 +0,0 @@ -// 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 org.apache.cloudstack.region.dao; - -import javax.ejb.Local; - -import org.apache.cloudstack.region.RegionSyncVO; -import org.apache.log4j.Logger; -import org.springframework.stereotype.Component; - -import com.cloud.utils.db.GenericDaoBase; - -@Component -@Local(value={RegionSyncDao.class}) -public class RegionSyncDaoImpl extends GenericDaoBase<RegionSyncVO, Integer> implements RegionSyncDao { - private static final Logger s_logger = Logger.getLogger(RegionSyncDaoImpl.class); - - public RegionSyncDaoImpl(){ - - } -} http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/a1fdb0c2/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 8e0bb64..b637c2a 100644 --- a/server/test/com/cloud/user/MockAccountManagerImpl.java +++ b/server/test/com/cloud/user/MockAccountManagerImpl.java @@ -343,7 +343,8 @@ public class MockAccountManagerImpl extends ManagerBase implements Manager, Acco @Override public Account createAccount(String accountName, short accountType, - Long domainId, String networkDomain, Map details) { + 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/a1fdb0c2/server/test/org/apache/cloudstack/region/RegionManagerTest.java ---------------------------------------------------------------------- diff --git a/server/test/org/apache/cloudstack/region/RegionManagerTest.java b/server/test/org/apache/cloudstack/region/RegionManagerTest.java index b8bde7d..330f0b4 100644 --- a/server/test/org/apache/cloudstack/region/RegionManagerTest.java +++ b/server/test/org/apache/cloudstack/region/RegionManagerTest.java @@ -43,19 +43,32 @@ public class RegionManagerTest extends TestCase { protected void setUp() { } - + @Test public void testUniqueName() { - RegionManagerImpl regionMgr = new RegionManagerImpl(); - RegionDao regionDao = Mockito.mock(RegionDao.class); - RegionVO region = new RegionVO(2, "APAC", "", null, null); - Mockito.when(regionDao.findByName(Mockito.anyString())).thenReturn(region); - regionMgr._regionDao = regionDao; - try { - regionMgr.addRegion(2, "APAC", "", null, null); - } catch (InvalidParameterValueException e){ - Assert.assertEquals("Region with name: APAC already exists", e.getMessage()); - } + RegionManagerImpl regionMgr = new RegionManagerImpl(); + RegionDao regionDao = Mockito.mock(RegionDao.class); + RegionVO region = new RegionVO(2, "APAC", "", null, null); + Mockito.when(regionDao.findByName(Mockito.anyString())).thenReturn(region); + regionMgr._regionDao = regionDao; + try { + regionMgr.addRegion(2, "APAC", "", null, null); + } catch (InvalidParameterValueException e){ + Assert.assertEquals("Region with name: APAC already exists", e.getMessage()); + } + } + + @Test + public void testUserDelete() { + RegionManagerImpl regionMgr = new RegionManagerImpl(); + AccountDao accountDao = Mockito.mock(AccountDao.class); + Mockito.when(accountDao.findById(Mockito.anyLong())).thenReturn(null); + regionMgr._accountDao = accountDao; + try { + regionMgr.deleteUserAccount(5); + } catch (InvalidParameterValueException e){ + Assert.assertEquals("The specified account does not exist in the system", e.getMessage()); + } } } http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/a1fdb0c2/setup/db/db/schema-40to410.sql ---------------------------------------------------------------------- diff --git a/setup/db/db/schema-40to410.sql b/setup/db/db/schema-40to410.sql index 706a197..b9bfe1a 100644 --- a/setup/db/db/schema-40to410.sql +++ b/setup/db/db/schema-40to410.sql @@ -263,6 +263,7 @@ CREATE TABLE `cloud`.`region` ( PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; + INSERT INTO `cloud`.`region` values ('1','Local','http://localhost:8080/client/api','',''); ALTER TABLE `cloud`.`account` ADD COLUMN `region_id` int unsigned NOT NULL DEFAULT '1';