Skip to content

Commit 9f62df5

Browse files
author
Alex Huang
committed
Fixed up the unit tests
1 parent 45d2398 commit 9f62df5

6 files changed

Lines changed: 46 additions & 17 deletions

File tree

‎client/tomcatconf/applicationContext.xml.in‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -740,6 +740,12 @@
740740
<property name="DhcpProviders" value="#{dhcpProviders.Adapters}" />
741741
</bean>
742742

743+
<bean id="ipAddressManagerImpl" class="com.cloud.network.IpAddressManagerImpl" >
744+
<property name="NetworkGurus" value="#{networkGurus.Adapters}" />
745+
<property name="NetworkElements" value="#{networkElements.Adapters}" />
746+
<property name="IpDeployers" value="#{ipDeployers.Adapters}" />
747+
<property name="DhcpProviders" value="#{dhcpProviders.Adapters}" />
748+
</bean>
743749
<bean id="networkModelImpl" class="com.cloud.network.NetworkModelImpl">
744750
<property name="NetworkElements" value="#{networkElements.Adapters}" />
745751
</bean>

‎plugins/network-elements/internal-loadbalancer/test/org/apache/cloudstack/internallbelement/ElementChildTestConfiguration.java‎

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// to you under the Apache License, Version 2.0 (the
66
// "License"); you may not use this file except in compliance
77
// with the License. You may obtain a copy of the License at
8-
//
8+
//
99
// http://www.apache.org/licenses/LICENSE-2.0
1010
//
1111
// Unless required by applicable law or agreed to in writing,
@@ -18,9 +18,6 @@
1818

1919
import java.io.IOException;
2020

21-
import org.apache.cloudstack.lb.dao.ApplicationLoadBalancerRuleDao;
22-
import org.apache.cloudstack.network.lb.InternalLoadBalancerVMManager;
23-
import org.apache.cloudstack.test.utils.SpringUtils;
2421
import org.mockito.Mockito;
2522
import org.springframework.context.annotation.Bean;
2623
import org.springframework.context.annotation.ComponentScan;
@@ -31,9 +28,13 @@
3128
import org.springframework.core.type.classreading.MetadataReaderFactory;
3229
import org.springframework.core.type.filter.TypeFilter;
3330

31+
import org.apache.cloudstack.lb.dao.ApplicationLoadBalancerRuleDao;
32+
import org.apache.cloudstack.network.lb.InternalLoadBalancerVMManager;
33+
import org.apache.cloudstack.test.utils.SpringUtils;
34+
3435
import com.cloud.configuration.ConfigurationManager;
35-
import com.cloud.dc.dao.AccountVlanMapDaoImpl;
3636
import com.cloud.dc.dao.DataCenterDao;
37+
import com.cloud.network.IpAddressManager;
3738
import com.cloud.network.NetworkManager;
3839
import com.cloud.network.NetworkModel;
3940
import com.cloud.network.dao.NetworkServiceMapDao;
@@ -53,7 +54,7 @@
5354
)
5455

5556
public class ElementChildTestConfiguration {
56-
public static class Library implements TypeFilter {
57+
public static class Library implements TypeFilter {
5758
@Bean
5859
public AccountManager accountManager() {
5960
return Mockito.mock(AccountManager.class);
@@ -81,6 +82,10 @@ public NetworkManager networkManager() {
8182
return Mockito.mock(NetworkManager.class);
8283
}
8384

85+
@Bean
86+
public IpAddressManager ipAddressManager() {
87+
return Mockito.mock(IpAddressManager.class);
88+
}
8489

8590
@Bean
8691
public PhysicalNetworkServiceProviderDao physicalNetworkServiceProviderDao() {

‎plugins/network-elements/internal-loadbalancer/test/org/apache/cloudstack/internallbvmmgr/LbChildTestConfiguration.java‎

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// to you under the Apache License, Version 2.0 (the
66
// "License"); you may not use this file except in compliance
77
// with the License. You may obtain a copy of the License at
8-
//
8+
//
99
// http://www.apache.org/licenses/LICENSE-2.0
1010
//
1111
// Unless required by applicable law or agreed to in writing,
@@ -18,10 +18,6 @@
1818

1919
import java.io.IOException;
2020

21-
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
22-
import org.apache.cloudstack.lb.dao.ApplicationLoadBalancerRuleDao;
23-
import org.apache.cloudstack.test.utils.SpringUtils;
24-
2521
import org.mockito.Mockito;
2622
import org.springframework.context.annotation.Bean;
2723
import org.springframework.context.annotation.ComponentScan;
@@ -32,9 +28,13 @@
3228
import org.springframework.core.type.classreading.MetadataReaderFactory;
3329
import org.springframework.core.type.filter.TypeFilter;
3430

31+
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
32+
import org.apache.cloudstack.lb.dao.ApplicationLoadBalancerRuleDao;
33+
import org.apache.cloudstack.test.utils.SpringUtils;
34+
3535
import com.cloud.agent.AgentManager;
36-
import com.cloud.dc.dao.AccountVlanMapDaoImpl;
3736
import com.cloud.dc.dao.DataCenterDao;
37+
import com.cloud.network.IpAddressManager;
3838
import com.cloud.network.NetworkManager;
3939
import com.cloud.network.NetworkModel;
4040
import com.cloud.network.dao.NetworkDao;
@@ -47,11 +47,11 @@
4747
import com.cloud.service.dao.ServiceOfferingDao;
4848
import com.cloud.storage.dao.VMTemplateDao;
4949
import com.cloud.user.AccountManager;
50+
import com.cloud.user.dao.AccountDao;
5051
import com.cloud.utils.net.NetUtils;
5152
import com.cloud.vm.VirtualMachineManager;
5253
import com.cloud.vm.dao.DomainRouterDao;
5354
import com.cloud.vm.dao.NicDao;
54-
import com.cloud.user.dao.AccountDao;
5555

5656

5757
@Configuration
@@ -124,6 +124,11 @@ public NetworkManager networkManager() {
124124
}
125125

126126
@Bean
127+
public IpAddressManager ipAddressManager() {
128+
return Mockito.mock(IpAddressManager.class);
129+
}
130+
131+
@Bean
127132
public ServiceOfferingDao serviceOfferingDao() {
128133
return Mockito.mock(ServiceOfferingDao.class);
129134
}

‎server/test/com/cloud/configuration/ConfigurationManagerTest.java‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ public void setup() throws Exception {
107107
configurationMgr._publicIpAddressDao = _publicIpAddressDao;
108108
configurationMgr._zoneDao = _zoneDao;
109109
configurationMgr._firewallDao = _firewallDao;
110+
configurationMgr._ipAddrMgr = _ipAddrMgr;
110111

111112
Account account = new AccountVO("testaccount", 1, "networkdomain", (short) 0, UUID.randomUUID().toString());
112113
when(configurationMgr._accountMgr.getAccount(anyLong())).thenReturn(account);

‎server/test/org/apache/cloudstack/lb/ChildTestConfiguration.java‎

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// to you under the Apache License, Version 2.0 (the
66
// "License"); you may not use this file except in compliance
77
// with the License. You may obtain a copy of the License at
8-
//
8+
//
99
// http://www.apache.org/licenses/LICENSE-2.0
1010
//
1111
// Unless required by applicable law or agreed to in writing,
@@ -18,8 +18,6 @@
1818

1919
import java.io.IOException;
2020

21-
import org.apache.cloudstack.lb.dao.ApplicationLoadBalancerRuleDao;
22-
import org.apache.cloudstack.test.utils.SpringUtils;
2321
import org.mockito.Mockito;
2422
import org.springframework.context.annotation.Bean;
2523
import org.springframework.context.annotation.ComponentScan;
@@ -30,8 +28,11 @@
3028
import org.springframework.core.type.classreading.MetadataReaderFactory;
3129
import org.springframework.core.type.filter.TypeFilter;
3230

33-
import com.cloud.dc.dao.AccountVlanMapDaoImpl;
31+
import org.apache.cloudstack.lb.dao.ApplicationLoadBalancerRuleDao;
32+
import org.apache.cloudstack.test.utils.SpringUtils;
33+
3434
import com.cloud.event.dao.UsageEventDao;
35+
import com.cloud.network.IpAddressManager;
3536
import com.cloud.network.NetworkManager;
3637
import com.cloud.network.NetworkModel;
3738
import com.cloud.network.dao.FirewallRulesDao;
@@ -59,6 +60,11 @@ public ApplicationLoadBalancerRuleDao applicationLoadBalancerDao() {
5960
return Mockito.mock(ApplicationLoadBalancerRuleDao.class);
6061
}
6162

63+
@Bean
64+
IpAddressManager ipAddressManager() {
65+
return Mockito.mock(IpAddressManager.class);
66+
}
67+
6268
@Bean
6369
public NetworkModel networkModel() {
6470
return Mockito.mock(NetworkModel.class);

‎server/test/org/apache/cloudstack/networkoffering/ChildTestConfiguration.java‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
import com.cloud.host.dao.HostDaoImpl;
6363
import com.cloud.host.dao.HostDetailsDaoImpl;
6464
import com.cloud.host.dao.HostTagsDaoImpl;
65+
import com.cloud.network.IpAddressManager;
6566
import com.cloud.network.Ipv6AddressManager;
6667
import com.cloud.network.NetworkManager;
6768
import com.cloud.network.NetworkModel;
@@ -308,6 +309,11 @@ public NetworkManager networkManager() {
308309
return Mockito.mock(NetworkManager.class);
309310
}
310311

312+
@Bean
313+
public IpAddressManager ipAddressManager() {
314+
return Mockito.mock(IpAddressManager.class);
315+
}
316+
311317
@Bean
312318
public NetworkOfferingDao networkOfferingDao() {
313319
return Mockito.mock(NetworkOfferingDao.class);

0 commit comments

Comments
 (0)