diff --git a/server/test/org/apache/cloudstack/networkoffering/CreateNetworkOfferingTest.java b/server/test/org/apache/cloudstack/networkoffering/CreateNetworkOfferingTest.java
index 135395980c5..67fae3349c1 100644
--- a/server/test/org/apache/cloudstack/networkoffering/CreateNetworkOfferingTest.java
+++ b/server/test/org/apache/cloudstack/networkoffering/CreateNetworkOfferingTest.java
@@ -46,7 +46,12 @@ import com.cloud.offerings.NetworkOfferingServiceMapVO;
import com.cloud.offerings.NetworkOfferingVO;
import com.cloud.offerings.dao.NetworkOfferingDao;
import com.cloud.offerings.dao.NetworkOfferingServiceMapDao;
+import com.cloud.user.AccountManager;
+import com.cloud.user.AccountVO;
+import com.cloud.user.UserContext;
import com.cloud.user.UserContextInitializer;
+import com.cloud.user.UserVO;
+import com.cloud.utils.component.ComponentContext;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations="classpath:/createNetworkOffering.xml")
@@ -63,18 +68,24 @@ public class CreateNetworkOfferingTest extends TestCase{
NetworkOfferingDao offDao;
@Inject
- UserContextInitializer usrCtxInit;
+ NetworkOfferingServiceMapDao mapDao;
@Inject
- NetworkOfferingServiceMapDao mapDao;
+ AccountManager accountMgr;
@Before
public void setUp() {
+ 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));
+ Mockito.when(accountMgr.getSystemAccount()).thenReturn(new AccountVO(2));
+
+ UserContext.registerContext(accountMgr.getSystemUser().getId(), accountMgr.getSystemAccount(), null, false);
}
//Test Shared network offerings
diff --git a/server/test/resources/CloneSettingDaoTestContext.xml b/server/test/resources/CloneSettingDaoTestContext.xml
index 1d13500a2e9..cb350041214 100644
--- a/server/test/resources/CloneSettingDaoTestContext.xml
+++ b/server/test/resources/CloneSettingDaoTestContext.xml
@@ -23,17 +23,19 @@
-
-
-
-
-
-
-
-
+
-
+
+
+
+
+
+
+
+
+
+
diff --git a/server/test/resources/SecurityGroupManagerTestContext.xml b/server/test/resources/SecurityGroupManagerTestContext.xml
index b36599e2987..7ff2976dd6b 100644
--- a/server/test/resources/SecurityGroupManagerTestContext.xml
+++ b/server/test/resources/SecurityGroupManagerTestContext.xml
@@ -23,17 +23,16 @@
-
-
-
-
-
-
-
-
-
+
-
+
+
+
+
+
+
+
+
diff --git a/server/test/resources/SnapshotDaoTestContext.xml b/server/test/resources/SnapshotDaoTestContext.xml
index e479e2ebf39..3b87888c3ac 100644
--- a/server/test/resources/SnapshotDaoTestContext.xml
+++ b/server/test/resources/SnapshotDaoTestContext.xml
@@ -23,17 +23,19 @@
-
-
-
-
-
-
-
-
+
-
+
+
+
+
+
+
+
+
+
+
diff --git a/server/test/resources/StoragePoolDaoTestContext.xml b/server/test/resources/StoragePoolDaoTestContext.xml
index 4936a83b361..345827e9965 100644
--- a/server/test/resources/StoragePoolDaoTestContext.xml
+++ b/server/test/resources/StoragePoolDaoTestContext.xml
@@ -23,17 +23,19 @@
-
-
-
-
-
-
-
-
+
-
+
+
+
+
+
+
+
+
+
+
diff --git a/server/test/resources/VpcApiUnitTestContext.xml b/server/test/resources/VpcApiUnitTestContext.xml
index d9330229383..1dc11227601 100644
--- a/server/test/resources/VpcApiUnitTestContext.xml
+++ b/server/test/resources/VpcApiUnitTestContext.xml
@@ -24,17 +24,19 @@
-
-
-
-
-
-
-
-
+
-
+
+
+
+
+
+
+
+
+
+
diff --git a/server/test/resources/VpcTestContext.xml b/server/test/resources/VpcTestContext.xml
index 7ed5f570bb3..530373620d0 100644
--- a/server/test/resources/VpcTestContext.xml
+++ b/server/test/resources/VpcTestContext.xml
@@ -21,15 +21,20 @@
http://www.springframework.org/schema/context/spring-context-3.0.xsd">
+
-
-
-
+
-
-
-
-
+
+
+
+
+
+
+
+
+
+
-
-
-
+
+
-
-
-
-
+
+
+
+
+
+
+
+
+
+
@@ -38,7 +43,4 @@
-
-
-
diff --git a/server/test/resources/testContext.xml b/server/test/resources/testContext.xml
index b2603867828..6a211981c6d 100644
--- a/server/test/resources/testContext.xml
+++ b/server/test/resources/testContext.xml
@@ -37,26 +37,19 @@
-
-
-
-
-
-
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+