Update unit test configuraitons to new custom Spring AOP
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/cb4ac1f9 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/cb4ac1f9 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/cb4ac1f9 Branch: refs/heads/marvin_refactor Commit: cb4ac1f93ded093a03f3feb944670f9a7ee51f27 Parents: 8165465 Author: Kelven Yang <[email protected]> Authored: Fri Mar 29 11:01:40 2013 -0700 Committer: Prasanna Santhanam <[email protected]> Committed: Sun Mar 31 22:18:52 2013 +0530 ---------------------------------------------------------------------- .../networkoffering/CreateNetworkOfferingTest.java | 40 +++--- .../resources/SecurityGroupManagerTestContext.xml | 18 ++-- server/test/resources/SnapshotDaoTestContext.xml | 22 ++-- .../test/resources/StoragePoolDaoTestContext.xml | 22 ++-- server/test/resources/VpcApiUnitTestContext.xml | 22 ++-- server/test/resources/VpcTestContext.xml | 24 ++-- server/test/resources/createNetworkOffering.xml | 92 +++++++------- server/test/resources/testContext.xml | 20 ++-- 8 files changed, 130 insertions(+), 130 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cb4ac1f9/server/test/org/apache/cloudstack/networkoffering/CreateNetworkOfferingTest.java ---------------------------------------------------------------------- diff --git a/server/test/org/apache/cloudstack/networkoffering/CreateNetworkOfferingTest.java b/server/test/org/apache/cloudstack/networkoffering/CreateNetworkOfferingTest.java index 67fae33..5b236a5 100644 --- a/server/test/org/apache/cloudstack/networkoffering/CreateNetworkOfferingTest.java +++ b/server/test/org/apache/cloudstack/networkoffering/CreateNetworkOfferingTest.java @@ -57,29 +57,29 @@ import com.cloud.utils.component.ComponentContext; @ContextConfiguration(locations="classpath:/createNetworkOffering.xml") public class CreateNetworkOfferingTest extends TestCase{ - + @Inject ConfigurationManager configMgr; - + @Inject ConfigurationDao configDao; - + @Inject NetworkOfferingDao offDao; - + @Inject NetworkOfferingServiceMapDao mapDao; - + @Inject AccountManager accountMgr; - + @Before public void setUp() { - ComponentContext.initComponentsLifeCycle(); - + ComponentContext.initComponentsLifeCycle(); + ConfigurationVO configVO = new ConfigurationVO("200", "200","200","200","200","200"); Mockito.when(configDao.findByName(Mockito.anyString())).thenReturn(configVO); - + Mockito.when(offDao.persist(Mockito.any(NetworkOfferingVO.class))).thenReturn(new NetworkOfferingVO()); Mockito.when(mapDao.persist(Mockito.any(NetworkOfferingServiceMapVO.class))).thenReturn(new NetworkOfferingServiceMapVO()); Mockito.when(accountMgr.getSystemUser()).thenReturn(new UserVO(1)); @@ -96,7 +96,7 @@ public class CreateNetworkOfferingTest extends TestCase{ null, false, null, true, false); assertNotNull("Shared network offering with specifyVlan=true failed to create ", off); } - + @Test public void createSharedNtwkOffWithNoVlan() { try { @@ -107,16 +107,16 @@ public class CreateNetworkOfferingTest extends TestCase{ } catch (InvalidParameterValueException ex) { } } - + @Test public void createSharedNtwkOffWithSpecifyIpRanges() { NetworkOfferingVO off = configMgr.createNetworkOffering("shared", "shared", TrafficType.Guest, null, true, Availability.Optional, 200, null, false, Network.GuestType.Shared, false, null, false, null, true, false); - + assertNotNull("Shared network offering with specifyIpRanges=true failed to create ", off); } - + @Test public void createSharedNtwkOffWithoutSpecifyIpRanges() { try { @@ -138,10 +138,10 @@ public class CreateNetworkOfferingTest extends TestCase{ NetworkOfferingVO off = configMgr.createNetworkOffering("isolated", "isolated", TrafficType.Guest, null, false, Availability.Optional, 200, serviceProviderMap, false, Network.GuestType.Isolated, false, null, false, null, false, false); - + assertNotNull("Isolated network offering with specifyIpRanges=false failed to create ", off); } - + @Test public void createIsolatedNtwkOffWithVlan() { Map<Service, Set<Provider>> serviceProviderMap = new HashMap<Network.Service, Set<Network.Provider>>(); @@ -152,9 +152,9 @@ public class CreateNetworkOfferingTest extends TestCase{ Availability.Optional, 200, serviceProviderMap, false, Network.GuestType.Isolated, false, null, false, null, false, false); assertNotNull("Isolated network offering with specifyVlan=true wasn't created", off); - + } - + @Test public void createIsolatedNtwkOffWithSpecifyIpRangesAndSourceNat() { try { @@ -169,16 +169,16 @@ public class CreateNetworkOfferingTest extends TestCase{ } catch (InvalidParameterValueException ex) { } } - + @Test public void createIsolatedNtwkOffWithSpecifyIpRangesAndNoSourceNat() { - + Map<Service, Set<Provider>> serviceProviderMap = new HashMap<Network.Service, Set<Network.Provider>>(); Set<Network.Provider> vrProvider = new HashSet<Network.Provider>(); NetworkOfferingVO off = configMgr.createNetworkOffering("isolated", "isolated", TrafficType.Guest, null, false, Availability.Optional, 200, serviceProviderMap, false, Network.GuestType.Isolated, false, null, false, null, true, false); assertNotNull("Isolated network offering with specifyIpRanges=true and with no sourceNatService, failed to create", off); - + } } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cb4ac1f9/server/test/resources/SecurityGroupManagerTestContext.xml ---------------------------------------------------------------------- diff --git a/server/test/resources/SecurityGroupManagerTestContext.xml b/server/test/resources/SecurityGroupManagerTestContext.xml index 7ff2976..fc4b23e 100644 --- a/server/test/resources/SecurityGroupManagerTestContext.xml +++ b/server/test/resources/SecurityGroupManagerTestContext.xml @@ -23,16 +23,16 @@ <context:annotation-config /> <!-- @DB support --> - <bean id="componentContext" class="com.cloud.utils.component.ComponentContext" /> + <bean id="componentContext" class="com.cloud.utils.component.ComponentContext" /> <bean id="transactionContextBuilder" class="com.cloud.utils.db.TransactionContextBuilder" /> - <bean id="instantiatePostProcessor" class="com.cloud.utils.component.ComponentInstantiationPostProcessor"> - <property name="Interceptors"> - <list> - <ref bean="transactionContextBuilder" /> - </list> - </property> - </bean> - + <bean id="instantiatePostProcessor" class="com.cloud.utils.component.ComponentInstantiationPostProcessor"> + <property name="Interceptors"> + <list> + <ref bean="transactionContextBuilder" /> + </list> + </property> + </bean> + <bean id="TestConfiguration" class="com.cloud.network.security.SecurityGroupManagerTestConfiguration" /> <bean class="org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor"> http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cb4ac1f9/server/test/resources/SnapshotDaoTestContext.xml ---------------------------------------------------------------------- diff --git a/server/test/resources/SnapshotDaoTestContext.xml b/server/test/resources/SnapshotDaoTestContext.xml index 3b87888..ac7c8a1 100644 --- a/server/test/resources/SnapshotDaoTestContext.xml +++ b/server/test/resources/SnapshotDaoTestContext.xml @@ -23,19 +23,19 @@ <context:annotation-config /> <!-- @DB support --> - <bean id="componentContext" class="com.cloud.utils.component.ComponentContext" /> + <bean id="componentContext" class="com.cloud.utils.component.ComponentContext" /> <bean id="transactionContextBuilder" class="com.cloud.utils.db.TransactionContextBuilder" /> - <bean id="actionEventInterceptor" class="com.cloud.event.ActionEventInterceptor" /> - <bean id="instantiatePostProcessor" class="com.cloud.utils.component.ComponentInstantiationPostProcessor"> - <property name="Interceptors"> - <list> - <ref bean="transactionContextBuilder" /> - <ref bean="actionEventInterceptor" /> - </list> - </property> - </bean> - + <bean id="actionEventInterceptor" class="com.cloud.event.ActionEventInterceptor" /> + <bean id="instantiatePostProcessor" class="com.cloud.utils.component.ComponentInstantiationPostProcessor"> + <property name="Interceptors"> + <list> + <ref bean="transactionContextBuilder" /> + <ref bean="actionEventInterceptor" /> + </list> + </property> + </bean> + <bean id="TestConfiguration" class="com.cloud.snapshot.SnapshotDaoTestConfiguration" /> <bean class="org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor" > http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cb4ac1f9/server/test/resources/StoragePoolDaoTestContext.xml ---------------------------------------------------------------------- diff --git a/server/test/resources/StoragePoolDaoTestContext.xml b/server/test/resources/StoragePoolDaoTestContext.xml index 345827e..55d9623 100644 --- a/server/test/resources/StoragePoolDaoTestContext.xml +++ b/server/test/resources/StoragePoolDaoTestContext.xml @@ -23,19 +23,19 @@ <context:annotation-config /> <!-- @DB support --> - <bean id="componentContext" class="com.cloud.utils.component.ComponentContext" /> + <bean id="componentContext" class="com.cloud.utils.component.ComponentContext" /> <bean id="transactionContextBuilder" class="com.cloud.utils.db.TransactionContextBuilder" /> - <bean id="actionEventInterceptor" class="com.cloud.event.ActionEventInterceptor" /> - <bean id="instantiatePostProcessor" class="com.cloud.utils.component.ComponentInstantiationPostProcessor"> - <property name="Interceptors"> - <list> - <ref bean="transactionContextBuilder" /> - <ref bean="actionEventInterceptor" /> - </list> - </property> - </bean> - + <bean id="actionEventInterceptor" class="com.cloud.event.ActionEventInterceptor" /> + <bean id="instantiatePostProcessor" class="com.cloud.utils.component.ComponentInstantiationPostProcessor"> + <property name="Interceptors"> + <list> + <ref bean="transactionContextBuilder" /> + <ref bean="actionEventInterceptor" /> + </list> + </property> + </bean> + <bean id="TestConfiguration" class="com.cloud.storage.dao.StoragePoolDaoTestConfiguration" /> <bean class="org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor" > http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cb4ac1f9/server/test/resources/VpcApiUnitTestContext.xml ---------------------------------------------------------------------- diff --git a/server/test/resources/VpcApiUnitTestContext.xml b/server/test/resources/VpcApiUnitTestContext.xml index 1dc1122..c9dda1a 100644 --- a/server/test/resources/VpcApiUnitTestContext.xml +++ b/server/test/resources/VpcApiUnitTestContext.xml @@ -24,19 +24,19 @@ <context:component-scan base-package="org.apache.cloudstack, com.cloud" /> <!-- @DB support --> - <bean id="componentContext" class="com.cloud.utils.component.ComponentContext" /> + <bean id="componentContext" class="com.cloud.utils.component.ComponentContext" /> <bean id="transactionContextBuilder" class="com.cloud.utils.db.TransactionContextBuilder" /> - <bean id="actionEventInterceptor" class="com.cloud.event.ActionEventInterceptor" /> - <bean id="instantiatePostProcessor" class="com.cloud.utils.component.ComponentInstantiationPostProcessor"> - <property name="Interceptors"> - <list> - <ref bean="transactionContextBuilder" /> - <ref bean="actionEventInterceptor" /> - </list> - </property> - </bean> - + <bean id="actionEventInterceptor" class="com.cloud.event.ActionEventInterceptor" /> + <bean id="instantiatePostProcessor" class="com.cloud.utils.component.ComponentInstantiationPostProcessor"> + <property name="Interceptors"> + <list> + <ref bean="transactionContextBuilder" /> + <ref bean="actionEventInterceptor" /> + </list> + </property> + </bean> + <bean class="org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor"> <property name="requiredParameterValue" value="false" /> </bean> http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cb4ac1f9/server/test/resources/VpcTestContext.xml ---------------------------------------------------------------------- diff --git a/server/test/resources/VpcTestContext.xml b/server/test/resources/VpcTestContext.xml index 5303736..2a52ae3 100644 --- a/server/test/resources/VpcTestContext.xml +++ b/server/test/resources/VpcTestContext.xml @@ -22,19 +22,19 @@ <context:annotation-config /> - <!-- @DB support --> - <bean id="componentContext" class="com.cloud.utils.component.ComponentContext" /> + <!-- @DB support --> + <bean id="componentContext" class="com.cloud.utils.component.ComponentContext" /> - <bean id="transactionContextBuilder" class="com.cloud.utils.db.TransactionContextBuilder" /> - <bean id="actionEventInterceptor" class="com.cloud.event.ActionEventInterceptor" /> - <bean id="instantiatePostProcessor" class="com.cloud.utils.component.ComponentInstantiationPostProcessor"> - <property name="Interceptors"> - <list> - <ref bean="transactionContextBuilder" /> - <ref bean="actionEventInterceptor" /> - </list> - </property> - </bean> + <bean id="transactionContextBuilder" class="com.cloud.utils.db.TransactionContextBuilder" /> + <bean id="actionEventInterceptor" class="com.cloud.event.ActionEventInterceptor" /> + <bean id="instantiatePostProcessor" class="com.cloud.utils.component.ComponentInstantiationPostProcessor"> + <property name="Interceptors"> + <list> + <ref bean="transactionContextBuilder" /> + <ref bean="actionEventInterceptor" /> + </list> + </property> + </bean> <!-- Network Elements http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cb4ac1f9/server/test/resources/createNetworkOffering.xml ---------------------------------------------------------------------- diff --git a/server/test/resources/createNetworkOffering.xml b/server/test/resources/createNetworkOffering.xml index 90342c5..1f31205 100644 --- a/server/test/resources/createNetworkOffering.xml +++ b/server/test/resources/createNetworkOffering.xml @@ -1,46 +1,46 @@ -<!-- 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. --> -<beans xmlns="http://www.springframework.org/schema/beans" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" - xmlns:tx="http://www.springframework.org/schema/tx" xmlns:aop="http://www.springframework.org/schema/aop" - xsi:schemaLocation="http://www.springframework.org/schema/beans - http://www.springframework.org/schema/beans/spring-beans-3.0.xsd - http://www.springframework.org/schema/tx - http://www.springframework.org/schema/tx/spring-tx-3.0.xsd - http://www.springframework.org/schema/aop - http://www.springframework.org/schema/aop/spring-aop-3.0.xsd - http://www.springframework.org/schema/context - http://www.springframework.org/schema/context/spring-context-3.0.xsd"> - - <context:annotation-config /> - - <!-- @DB support --> - - <bean id="componentContext" class="com.cloud.utils.component.ComponentContext" /> - - <bean id="transactionContextBuilder" class="com.cloud.utils.db.TransactionContextBuilder" /> - <bean id="actionEventInterceptor" class="com.cloud.event.ActionEventInterceptor" /> - <bean id="instantiatePostProcessor" class="com.cloud.utils.component.ComponentInstantiationPostProcessor"> - <property name="Interceptors"> - <list> - <ref bean="transactionContextBuilder" /> - <ref bean="actionEventInterceptor" /> - </list> - </property> - </bean> - - <bean id="ConfigurationManager" class="com.cloud.configuration.ConfigurationManagerImpl"> - <property name="name" value="ConfigurationManager"/> - </bean> - - <bean class="org.apache.cloudstack.networkoffering.ChildTestConfiguration" /> - -</beans> +<!-- 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. --> +<beans xmlns="http://www.springframework.org/schema/beans" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" + xmlns:tx="http://www.springframework.org/schema/tx" xmlns:aop="http://www.springframework.org/schema/aop" + xsi:schemaLocation="http://www.springframework.org/schema/beans + http://www.springframework.org/schema/beans/spring-beans-3.0.xsd + http://www.springframework.org/schema/tx + http://www.springframework.org/schema/tx/spring-tx-3.0.xsd + http://www.springframework.org/schema/aop + http://www.springframework.org/schema/aop/spring-aop-3.0.xsd + http://www.springframework.org/schema/context + http://www.springframework.org/schema/context/spring-context-3.0.xsd"> + + <context:annotation-config /> + + <!-- @DB support --> + + <bean id="componentContext" class="com.cloud.utils.component.ComponentContext" /> + + <bean id="transactionContextBuilder" class="com.cloud.utils.db.TransactionContextBuilder" /> + <bean id="actionEventInterceptor" class="com.cloud.event.ActionEventInterceptor" /> + <bean id="instantiatePostProcessor" class="com.cloud.utils.component.ComponentInstantiationPostProcessor"> + <property name="Interceptors"> + <list> + <ref bean="transactionContextBuilder" /> + <ref bean="actionEventInterceptor" /> + </list> + </property> + </bean> + + <bean id="ConfigurationManager" class="com.cloud.configuration.ConfigurationManagerImpl"> + <property name="name" value="ConfigurationManager"/> + </bean> + + <bean class="org.apache.cloudstack.networkoffering.ChildTestConfiguration" /> + +</beans> http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cb4ac1f9/server/test/resources/testContext.xml ---------------------------------------------------------------------- diff --git a/server/test/resources/testContext.xml b/server/test/resources/testContext.xml index 6a21198..c363955 100644 --- a/server/test/resources/testContext.xml +++ b/server/test/resources/testContext.xml @@ -37,19 +37,19 @@ <!-- @DB support --> - <bean id="componentContext" class="com.cloud.utils.component.ComponentContext" /> + <bean id="componentContext" class="com.cloud.utils.component.ComponentContext" /> <bean id="transactionContextBuilder" class="com.cloud.utils.db.TransactionContextBuilder" /> <bean id="actionEventInterceptor" class="com.cloud.event.ActionEventInterceptor" /> - <bean id="instantiatePostProcessor" class="com.cloud.utils.component.ComponentInstantiationPostProcessor"> - <property name="Interceptors"> - <list> - <ref bean="transactionContextBuilder" /> - <ref bean="actionEventInterceptor" /> - </list> - </property> - </bean> - + <bean id="instantiatePostProcessor" class="com.cloud.utils.component.ComponentInstantiationPostProcessor"> + <property name="Interceptors"> + <list> + <ref bean="transactionContextBuilder" /> + <ref bean="actionEventInterceptor" /> + </list> + </property> + </bean> + <bean class="com.cloud.network.security.SecurityGroupManagerTestConfiguration" /> <!--
