cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ahu...@apache.org
Subject [43/51] [abbrv] fixed unit tests from merge
Date Sat, 19 Jan 2013 00:00:12 GMT
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/fe6f0457/api/src/org/apache/cloudstack/query/QueryService.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/query/QueryService.java b/api/src/org/apache/cloudstack/query/QueryService.java
index b03a7fc..65c816b 100644
--- a/api/src/org/apache/cloudstack/query/QueryService.java
+++ b/api/src/org/apache/cloudstack/query/QueryService.java
@@ -16,8 +16,6 @@
 // under the License.
 package org.apache.cloudstack.query;
 
-import java.util.List;
-
 import org.apache.cloudstack.api.command.admin.host.ListHostsCmd;
 import org.apache.cloudstack.api.command.admin.router.ListRoutersCmd;
 import org.apache.cloudstack.api.command.admin.storage.ListStoragePoolsCmd;
@@ -50,11 +48,7 @@ import org.apache.cloudstack.api.response.UserResponse;
 import org.apache.cloudstack.api.response.UserVmResponse;
 import org.apache.cloudstack.api.response.VolumeResponse;
 
-
-
-import com.cloud.async.AsyncJob;
 import com.cloud.exception.PermissionDeniedException;
-import com.cloud.utils.Pair;
 
 /**
  * Service used for list api query.

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/fe6f0457/api/test/org/apache/cloudstack/api/agent/test/SnapshotCommandTest.java
----------------------------------------------------------------------
diff --git a/api/test/org/apache/cloudstack/api/agent/test/SnapshotCommandTest.java b/api/test/org/apache/cloudstack/api/agent/test/SnapshotCommandTest.java
index 0e4c024..3545d0f 100644
--- a/api/test/org/apache/cloudstack/api/agent/test/SnapshotCommandTest.java
+++ b/api/test/org/apache/cloudstack/api/agent/test/SnapshotCommandTest.java
@@ -20,13 +20,13 @@ import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
-import org.junit.Before;
-import org.junit.Test;
-
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.util.Date;
 
+import org.junit.Before;
+import org.junit.Test;
+
 import com.cloud.agent.api.SnapshotCommand;
 import com.cloud.storage.Storage.StoragePoolType;
 import com.cloud.storage.StoragePool;

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/fe6f0457/api/test/org/apache/cloudstack/api/command/test/AddClusterCmdTest.java
----------------------------------------------------------------------
diff --git a/api/test/org/apache/cloudstack/api/command/test/AddClusterCmdTest.java b/api/test/org/apache/cloudstack/api/command/test/AddClusterCmdTest.java
index 60fea9e..90759fe 100644
--- a/api/test/org/apache/cloudstack/api/command/test/AddClusterCmdTest.java
+++ b/api/test/org/apache/cloudstack/api/command/test/AddClusterCmdTest.java
@@ -19,6 +19,8 @@ package org.apache.cloudstack.api.command.test;
 import junit.framework.Assert;
 import junit.framework.TestCase;
 
+import org.apache.cloudstack.api.ResponseGenerator;
+import org.apache.cloudstack.api.ServerApiException;
 import org.apache.cloudstack.api.command.admin.cluster.AddClusterCmd;
 import org.junit.Before;
 import org.junit.Rule;
@@ -26,8 +28,6 @@ import org.junit.Test;
 import org.junit.rules.ExpectedException;
 import org.mockito.Mockito;
 
-import org.apache.cloudstack.api.ResponseGenerator;
-import org.apache.cloudstack.api.ServerApiException;
 import com.cloud.exception.DiscoveryException;
 import com.cloud.exception.ResourceInUseException;
 import com.cloud.org.Cluster;

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/fe6f0457/api/test/org/apache/cloudstack/api/command/test/AddHostCmdTest.java
----------------------------------------------------------------------
diff --git a/api/test/org/apache/cloudstack/api/command/test/AddHostCmdTest.java b/api/test/org/apache/cloudstack/api/command/test/AddHostCmdTest.java
index 4c1b5ee..531f511 100644
--- a/api/test/org/apache/cloudstack/api/command/test/AddHostCmdTest.java
+++ b/api/test/org/apache/cloudstack/api/command/test/AddHostCmdTest.java
@@ -19,17 +19,17 @@ package org.apache.cloudstack.api.command.test;
 import junit.framework.Assert;
 import junit.framework.TestCase;
 
+import org.apache.cloudstack.api.ResponseGenerator;
+import org.apache.cloudstack.api.ServerApiException;
 import org.apache.cloudstack.api.command.admin.host.AddHostCmd;
+import org.apache.cloudstack.api.response.HostResponse;
+import org.apache.cloudstack.api.response.ListResponse;
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.ExpectedException;
 import org.mockito.Mockito;
 
-import org.apache.cloudstack.api.ResponseGenerator;
-import org.apache.cloudstack.api.ServerApiException;
-import org.apache.cloudstack.api.response.HostResponse;
-import org.apache.cloudstack.api.response.ListResponse;
 import com.cloud.exception.DiscoveryException;
 import com.cloud.exception.InvalidParameterValueException;
 import com.cloud.host.Host;

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/fe6f0457/api/test/org/apache/cloudstack/api/command/test/AddNetworkServiceProviderCmdTest.java
----------------------------------------------------------------------
diff --git a/api/test/org/apache/cloudstack/api/command/test/AddNetworkServiceProviderCmdTest.java b/api/test/org/apache/cloudstack/api/command/test/AddNetworkServiceProviderCmdTest.java
index 0b5798f..2046052 100644
--- a/api/test/org/apache/cloudstack/api/command/test/AddNetworkServiceProviderCmdTest.java
+++ b/api/test/org/apache/cloudstack/api/command/test/AddNetworkServiceProviderCmdTest.java
@@ -22,6 +22,7 @@ import java.util.List;
 import junit.framework.Assert;
 import junit.framework.TestCase;
 
+import org.apache.cloudstack.api.ServerApiException;
 import org.apache.cloudstack.api.command.admin.network.AddNetworkServiceProviderCmd;
 import org.junit.Before;
 import org.junit.Rule;
@@ -29,7 +30,6 @@ import org.junit.Test;
 import org.junit.rules.ExpectedException;
 import org.mockito.Mockito;
 
-import org.apache.cloudstack.api.ServerApiException;
 import com.cloud.exception.ResourceAllocationException;
 import com.cloud.network.NetworkService;
 import com.cloud.network.PhysicalNetworkServiceProvider;

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/fe6f0457/api/test/org/apache/cloudstack/api/command/test/AddSecondaryStorageCmdTest.java
----------------------------------------------------------------------
diff --git a/api/test/org/apache/cloudstack/api/command/test/AddSecondaryStorageCmdTest.java b/api/test/org/apache/cloudstack/api/command/test/AddSecondaryStorageCmdTest.java
index 1cdd76f..d6de94d 100644
--- a/api/test/org/apache/cloudstack/api/command/test/AddSecondaryStorageCmdTest.java
+++ b/api/test/org/apache/cloudstack/api/command/test/AddSecondaryStorageCmdTest.java
@@ -19,16 +19,16 @@ package org.apache.cloudstack.api.command.test;
 import junit.framework.Assert;
 import junit.framework.TestCase;
 
+import org.apache.cloudstack.api.ResponseGenerator;
+import org.apache.cloudstack.api.ServerApiException;
 import org.apache.cloudstack.api.command.admin.host.AddSecondaryStorageCmd;
+import org.apache.cloudstack.api.response.HostResponse;
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.ExpectedException;
 import org.mockito.Mockito;
 
-import org.apache.cloudstack.api.ResponseGenerator;
-import org.apache.cloudstack.api.ServerApiException;
-import org.apache.cloudstack.api.response.HostResponse;
 import com.cloud.host.Host;
 import com.cloud.resource.ResourceService;
 

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/fe6f0457/api/test/org/apache/cloudstack/api/command/test/AddSwiftCmdTest.java
----------------------------------------------------------------------
diff --git a/api/test/org/apache/cloudstack/api/command/test/AddSwiftCmdTest.java b/api/test/org/apache/cloudstack/api/command/test/AddSwiftCmdTest.java
index 34d0baf..141a236 100644
--- a/api/test/org/apache/cloudstack/api/command/test/AddSwiftCmdTest.java
+++ b/api/test/org/apache/cloudstack/api/command/test/AddSwiftCmdTest.java
@@ -19,16 +19,16 @@ package org.apache.cloudstack.api.command.test;
 import junit.framework.Assert;
 import junit.framework.TestCase;
 
+import org.apache.cloudstack.api.ResponseGenerator;
+import org.apache.cloudstack.api.ServerApiException;
 import org.apache.cloudstack.api.command.admin.swift.AddSwiftCmd;
+import org.apache.cloudstack.api.response.SwiftResponse;
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.ExpectedException;
 import org.mockito.Mockito;
 
-import org.apache.cloudstack.api.ResponseGenerator;
-import org.apache.cloudstack.api.ServerApiException;
-import org.apache.cloudstack.api.response.SwiftResponse;
 import com.cloud.exception.DiscoveryException;
 import com.cloud.resource.ResourceService;
 import com.cloud.storage.Swift;

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/fe6f0457/api/test/org/apache/cloudstack/api/command/test/AddVpnUserCmdTest.java
----------------------------------------------------------------------
diff --git a/api/test/org/apache/cloudstack/api/command/test/AddVpnUserCmdTest.java b/api/test/org/apache/cloudstack/api/command/test/AddVpnUserCmdTest.java
index 78e9d92..69b9050 100644
--- a/api/test/org/apache/cloudstack/api/command/test/AddVpnUserCmdTest.java
+++ b/api/test/org/apache/cloudstack/api/command/test/AddVpnUserCmdTest.java
@@ -19,6 +19,7 @@ package org.apache.cloudstack.api.command.test;
 import junit.framework.Assert;
 import junit.framework.TestCase;
 
+import org.apache.cloudstack.api.ServerApiException;
 import org.apache.cloudstack.api.command.user.vpn.AddVpnUserCmd;
 import org.junit.Before;
 import org.junit.Rule;
@@ -26,7 +27,6 @@ import org.junit.Test;
 import org.junit.rules.ExpectedException;
 import org.mockito.Mockito;
 
-import org.apache.cloudstack.api.ServerApiException;
 import com.cloud.network.VpnUser;
 import com.cloud.network.vpn.RemoteAccessVpnService;
 import com.cloud.user.Account;

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/fe6f0457/api/test/src/com/cloud/agent/api/test/ResizeVolumeCommandTest.java
----------------------------------------------------------------------
diff --git a/api/test/src/com/cloud/agent/api/test/ResizeVolumeCommandTest.java b/api/test/src/com/cloud/agent/api/test/ResizeVolumeCommandTest.java
index 2d248b2..7f5540f 100644
--- a/api/test/src/com/cloud/agent/api/test/ResizeVolumeCommandTest.java
+++ b/api/test/src/com/cloud/agent/api/test/ResizeVolumeCommandTest.java
@@ -17,8 +17,8 @@
 package src.com.cloud.agent.api.test;
 
 import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
 
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
@@ -28,91 +28,121 @@ import org.junit.Test;
 
 import com.cloud.agent.api.storage.ResizeVolumeCommand;
 import com.cloud.agent.api.to.StorageFilerTO;
-import com.cloud.storage.StoragePool;
 import com.cloud.storage.Storage.StoragePoolType;
+import com.cloud.storage.StoragePool;
 import com.cloud.storage.StoragePoolStatus;
 
 
 public class ResizeVolumeCommandTest {
 
     public StoragePool dummypool = new StoragePool() {
+        @Override
         public long getId() {
             return 1L;
         };
 
+        @Override
         public String getName() {
             return "name";
         };
 
+        @Override
         public String getUuid() {
             return "bed9f83e-cac3-11e1-ac8a-0050568b007e";
         };
 
+        @Override
         public StoragePoolType getPoolType() {
             return StoragePoolType.Filesystem;
         };
 
+        @Override
         public Date getCreated() {
             Date date = null;
             try {
                 date = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss")
-                        .parse("01/01/1970 12:12:12");
+                .parse("01/01/1970 12:12:12");
             } catch (ParseException e) {
                 e.printStackTrace();
             }
             return date;
         }
 
+        @Override
         public Date getUpdateTime() {
             return new Date();
         };
 
+        @Override
         public long getDataCenterId() {
             return 0L;
         };
 
+        @Override
         public long getCapacityBytes() {
             return 0L;
         };
 
+        @Override
         public long getAvailableBytes() {
             return 0L;
         };
 
+        @Override
         public Long getClusterId() {
             return 0L;
         };
 
+        @Override
         public String getHostAddress() {
             return "hostAddress";
         };
 
+        @Override
         public String getPath() {
             return "path";
         };
 
+        @Override
         public String getUserInfo() {
             return "userInfo";
         };
 
+        @Override
         public boolean isShared() {
             return false;
         };
 
+        @Override
         public boolean isLocal() {
             return false;
         };
 
+        @Override
         public StoragePoolStatus getStatus() {
             return StoragePoolStatus.Up;
         };
 
+        @Override
         public int getPort() {
             return 25;
         };
 
+        @Override
         public Long getPodId() {
             return 0L;
+        }
+
+        @Override
+        public String getStorageProvider() {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        @Override
+        public String getStorageType() {
+            // TODO Auto-generated method stub
+            return null;
         };
     };
 

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/fe6f0457/plugins/hypervisors/simulator/src/com/cloud/agent/manager/MockAgentManager.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/simulator/src/com/cloud/agent/manager/MockAgentManager.java b/plugins/hypervisors/simulator/src/com/cloud/agent/manager/MockAgentManager.java
index 2bb1205..fa02873 100644
--- a/plugins/hypervisors/simulator/src/com/cloud/agent/manager/MockAgentManager.java
+++ b/plugins/hypervisors/simulator/src/com/cloud/agent/manager/MockAgentManager.java
@@ -27,7 +27,6 @@ import com.cloud.agent.api.GetHostStatsAnswer;
 import com.cloud.agent.api.GetHostStatsCommand;
 import com.cloud.agent.api.MaintainCommand;
 import com.cloud.agent.api.PingTestCommand;
-import com.cloud.agent.api.PrepareForMigrationCommand;
 import com.cloud.resource.AgentResourceBase;
 import com.cloud.simulator.MockHost;
 import com.cloud.utils.component.Manager;

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/fe6f0457/plugins/hypervisors/simulator/src/com/cloud/agent/manager/MockStorageManager.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/simulator/src/com/cloud/agent/manager/MockStorageManager.java b/plugins/hypervisors/simulator/src/com/cloud/agent/manager/MockStorageManager.java
index ff26d18..a90ea9e 100644
--- a/plugins/hypervisors/simulator/src/com/cloud/agent/manager/MockStorageManager.java
+++ b/plugins/hypervisors/simulator/src/com/cloud/agent/manager/MockStorageManager.java
@@ -35,7 +35,18 @@ import com.cloud.agent.api.ModifyStoragePoolCommand;
 import com.cloud.agent.api.SecStorageSetupCommand;
 import com.cloud.agent.api.SecStorageVMSetupCommand;
 import com.cloud.agent.api.StoragePoolInfo;
-import com.cloud.agent.api.storage.*;
+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.DestroyCommand;
+import com.cloud.agent.api.storage.DownloadCommand;
+import com.cloud.agent.api.storage.DownloadProgressCommand;
+import com.cloud.agent.api.storage.ListTemplateCommand;
+import com.cloud.agent.api.storage.ListVolumeCommand;
+import com.cloud.agent.api.storage.PrimaryStorageDownloadAnswer;
+import com.cloud.agent.api.storage.PrimaryStorageDownloadCommand;
 import com.cloud.utils.component.Manager;
 
 public interface MockStorageManager extends Manager {

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/fe6f0457/plugins/hypervisors/simulator/src/com/cloud/agent/manager/MockVmManager.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/simulator/src/com/cloud/agent/manager/MockVmManager.java b/plugins/hypervisors/simulator/src/com/cloud/agent/manager/MockVmManager.java
index 117e2f6..c5f93b7 100644
--- a/plugins/hypervisors/simulator/src/com/cloud/agent/manager/MockVmManager.java
+++ b/plugins/hypervisors/simulator/src/com/cloud/agent/manager/MockVmManager.java
@@ -19,7 +19,26 @@ package com.cloud.agent.manager;
 import java.util.HashMap;
 import java.util.Map;
 
-import com.cloud.agent.api.*;
+import com.cloud.agent.api.Answer;
+import com.cloud.agent.api.BumpUpPriorityCommand;
+import com.cloud.agent.api.CheckRouterAnswer;
+import com.cloud.agent.api.CheckRouterCommand;
+import com.cloud.agent.api.CheckVirtualMachineCommand;
+import com.cloud.agent.api.CleanupNetworkRulesCmd;
+import com.cloud.agent.api.GetDomRVersionAnswer;
+import com.cloud.agent.api.GetDomRVersionCmd;
+import com.cloud.agent.api.GetVmStatsCommand;
+import com.cloud.agent.api.GetVncPortCommand;
+import com.cloud.agent.api.MigrateAnswer;
+import com.cloud.agent.api.MigrateCommand;
+import com.cloud.agent.api.NetworkUsageCommand;
+import com.cloud.agent.api.PrepareForMigrationAnswer;
+import com.cloud.agent.api.PrepareForMigrationCommand;
+import com.cloud.agent.api.RebootCommand;
+import com.cloud.agent.api.SecurityGroupRuleAnswer;
+import com.cloud.agent.api.SecurityGroupRulesCmd;
+import com.cloud.agent.api.StartCommand;
+import com.cloud.agent.api.StopCommand;
 import com.cloud.agent.api.check.CheckSshAnswer;
 import com.cloud.agent.api.check.CheckSshCommand;
 import com.cloud.agent.api.proxy.CheckConsoleProxyLoadCommand;

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/fe6f0457/plugins/hypervisors/simulator/src/com/cloud/agent/manager/SimulatorManager.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/simulator/src/com/cloud/agent/manager/SimulatorManager.java b/plugins/hypervisors/simulator/src/com/cloud/agent/manager/SimulatorManager.java
index ff8c32c..91a95eb 100755
--- a/plugins/hypervisors/simulator/src/com/cloud/agent/manager/SimulatorManager.java
+++ b/plugins/hypervisors/simulator/src/com/cloud/agent/manager/SimulatorManager.java
@@ -17,7 +17,6 @@
 package com.cloud.agent.manager;
 
 import java.util.HashMap;
-import java.util.List;
 import java.util.Map;
 
 import com.cloud.agent.api.Answer;

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/fe6f0457/plugins/hypervisors/simulator/src/com/cloud/resource/AgentRoutingResource.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/simulator/src/com/cloud/resource/AgentRoutingResource.java b/plugins/hypervisors/simulator/src/com/cloud/resource/AgentRoutingResource.java
index f35e432..721e5f7 100644
--- a/plugins/hypervisors/simulator/src/com/cloud/resource/AgentRoutingResource.java
+++ b/plugins/hypervisors/simulator/src/com/cloud/resource/AgentRoutingResource.java
@@ -20,8 +20,6 @@ import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
 
 import javax.naming.ConfigurationException;
 
@@ -33,8 +31,6 @@ import com.cloud.agent.api.CheckVirtualMachineCommand;
 import com.cloud.agent.api.Command;
 import com.cloud.agent.api.PingCommand;
 import com.cloud.agent.api.PingRoutingWithNwGroupsCommand;
-import com.cloud.agent.api.PrepareForMigrationAnswer;
-import com.cloud.agent.api.PrepareForMigrationCommand;
 import com.cloud.agent.api.ReadyAnswer;
 import com.cloud.agent.api.ReadyCommand;
 import com.cloud.agent.api.ShutdownCommand;

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/fe6f0457/plugins/hypervisors/simulator/src/com/cloud/resource/AgentStorageResource.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/simulator/src/com/cloud/resource/AgentStorageResource.java b/plugins/hypervisors/simulator/src/com/cloud/resource/AgentStorageResource.java
index 1125eeb..2d81c2a 100644
--- a/plugins/hypervisors/simulator/src/com/cloud/resource/AgentStorageResource.java
+++ b/plugins/hypervisors/simulator/src/com/cloud/resource/AgentStorageResource.java
@@ -30,7 +30,6 @@ import com.cloud.agent.api.ReadyAnswer;
 import com.cloud.agent.api.ReadyCommand;
 import com.cloud.agent.api.StartupCommand;
 import com.cloud.agent.api.StartupSecondaryStorageCommand;
-import com.cloud.agent.api.StartupStorageCommand;
 import com.cloud.agent.api.storage.ssCommand;
 import com.cloud.agent.manager.SimulatorManager;
 import com.cloud.agent.manager.SimulatorManager.AgentType;

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/fe6f0457/plugins/hypervisors/simulator/src/com/cloud/server/ManagementServerSimulatorImpl.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/simulator/src/com/cloud/server/ManagementServerSimulatorImpl.java b/plugins/hypervisors/simulator/src/com/cloud/server/ManagementServerSimulatorImpl.java
index c639a55..db4b619 100644
--- a/plugins/hypervisors/simulator/src/com/cloud/server/ManagementServerSimulatorImpl.java
+++ b/plugins/hypervisors/simulator/src/com/cloud/server/ManagementServerSimulatorImpl.java
@@ -17,11 +17,9 @@
 package com.cloud.server;
 
 
-import com.cloud.api.commands.ConfigureSimulator;
-import com.cloud.utils.PropertiesUtil;
-
 import java.util.List;
-import java.util.Map;
+
+import com.cloud.api.commands.ConfigureSimulator;
 
 public class ManagementServerSimulatorImpl extends ManagementServerExtImpl {
     @Override

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/fe6f0457/plugins/hypervisors/simulator/src/com/cloud/simulator/MockConfigurationVO.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/simulator/src/com/cloud/simulator/MockConfigurationVO.java b/plugins/hypervisors/simulator/src/com/cloud/simulator/MockConfigurationVO.java
index 5959347..f971dec 100644
--- a/plugins/hypervisors/simulator/src/com/cloud/simulator/MockConfigurationVO.java
+++ b/plugins/hypervisors/simulator/src/com/cloud/simulator/MockConfigurationVO.java
@@ -16,8 +16,6 @@
 // under the License.
 package com.cloud.simulator;
 
-import org.apache.cloudstack.api.InternalIdentity;
-
 import java.util.HashMap;
 import java.util.Map;
 
@@ -28,6 +26,8 @@ import javax.persistence.GenerationType;
 import javax.persistence.Id;
 import javax.persistence.Table;
 
+import org.apache.cloudstack.api.InternalIdentity;
+
 @Entity
 @Table(name="mockconfiguration")
 public class MockConfigurationVO implements InternalIdentity {

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/fe6f0457/plugins/hypervisors/simulator/src/com/cloud/simulator/MockHostVO.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/simulator/src/com/cloud/simulator/MockHostVO.java b/plugins/hypervisors/simulator/src/com/cloud/simulator/MockHostVO.java
index 0242135..b475b2d 100644
--- a/plugins/hypervisors/simulator/src/com/cloud/simulator/MockHostVO.java
+++ b/plugins/hypervisors/simulator/src/com/cloud/simulator/MockHostVO.java
@@ -16,8 +16,6 @@
 // under the License.
 package com.cloud.simulator;
 
-import org.apache.cloudstack.api.InternalIdentity;
-
 import javax.persistence.Column;
 import javax.persistence.Entity;
 import javax.persistence.GeneratedValue;
@@ -25,6 +23,8 @@ import javax.persistence.GenerationType;
 import javax.persistence.Id;
 import javax.persistence.Table;
 
+import org.apache.cloudstack.api.InternalIdentity;
+
 @Entity
 @Table(name="mockhost")
 

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/fe6f0457/plugins/hypervisors/simulator/src/com/cloud/simulator/MockSecStorageVO.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/simulator/src/com/cloud/simulator/MockSecStorageVO.java b/plugins/hypervisors/simulator/src/com/cloud/simulator/MockSecStorageVO.java
index 2352687..532d2a7 100644
--- a/plugins/hypervisors/simulator/src/com/cloud/simulator/MockSecStorageVO.java
+++ b/plugins/hypervisors/simulator/src/com/cloud/simulator/MockSecStorageVO.java
@@ -16,8 +16,6 @@
 // under the License.
 package com.cloud.simulator;
 
-import org.apache.cloudstack.api.InternalIdentity;
-
 import javax.persistence.Column;
 import javax.persistence.Entity;
 import javax.persistence.GeneratedValue;
@@ -25,6 +23,8 @@ import javax.persistence.GenerationType;
 import javax.persistence.Id;
 import javax.persistence.Table;
 
+import org.apache.cloudstack.api.InternalIdentity;
+
 @Entity
 @Table(name="mocksecstorage")
 

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/fe6f0457/plugins/hypervisors/simulator/src/com/cloud/simulator/MockSecurityRulesVO.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/simulator/src/com/cloud/simulator/MockSecurityRulesVO.java b/plugins/hypervisors/simulator/src/com/cloud/simulator/MockSecurityRulesVO.java
index d0d77c9..d7fec21 100644
--- a/plugins/hypervisors/simulator/src/com/cloud/simulator/MockSecurityRulesVO.java
+++ b/plugins/hypervisors/simulator/src/com/cloud/simulator/MockSecurityRulesVO.java
@@ -16,8 +16,6 @@
 // under the License.
 package com.cloud.simulator;
 
-import org.apache.cloudstack.api.InternalIdentity;
-
 import javax.persistence.Column;
 import javax.persistence.Entity;
 import javax.persistence.GeneratedValue;
@@ -25,6 +23,8 @@ import javax.persistence.GenerationType;
 import javax.persistence.Id;
 import javax.persistence.Table;
 
+import org.apache.cloudstack.api.InternalIdentity;
+
 
 @Entity
 @Table(name="mocksecurityrules")

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/fe6f0457/plugins/hypervisors/simulator/src/com/cloud/simulator/MockStoragePoolVO.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/simulator/src/com/cloud/simulator/MockStoragePoolVO.java b/plugins/hypervisors/simulator/src/com/cloud/simulator/MockStoragePoolVO.java
index c8f068a..06aa169 100644
--- a/plugins/hypervisors/simulator/src/com/cloud/simulator/MockStoragePoolVO.java
+++ b/plugins/hypervisors/simulator/src/com/cloud/simulator/MockStoragePoolVO.java
@@ -25,9 +25,10 @@ import javax.persistence.GenerationType;
 import javax.persistence.Id;
 import javax.persistence.Table;
 
-import com.cloud.storage.Storage.StoragePoolType;
 import org.apache.cloudstack.api.InternalIdentity;
 
+import com.cloud.storage.Storage.StoragePoolType;
+
 @Entity
 @Table(name="mockstoragepool")
 

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/fe6f0457/plugins/hypervisors/simulator/src/com/cloud/simulator/MockVMVO.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/simulator/src/com/cloud/simulator/MockVMVO.java b/plugins/hypervisors/simulator/src/com/cloud/simulator/MockVMVO.java
index 292f200..a65a98c 100644
--- a/plugins/hypervisors/simulator/src/com/cloud/simulator/MockVMVO.java
+++ b/plugins/hypervisors/simulator/src/com/cloud/simulator/MockVMVO.java
@@ -23,9 +23,10 @@ import javax.persistence.GenerationType;
 import javax.persistence.Id;
 import javax.persistence.Table;
 
-import com.cloud.vm.VirtualMachine.State;
 import org.apache.cloudstack.api.InternalIdentity;
 
+import com.cloud.vm.VirtualMachine.State;
+
 @Entity
 @Table(name="mockvm")
 

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/fe6f0457/plugins/hypervisors/simulator/src/com/cloud/simulator/MockVolumeVO.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/simulator/src/com/cloud/simulator/MockVolumeVO.java b/plugins/hypervisors/simulator/src/com/cloud/simulator/MockVolumeVO.java
index fe337e7..6dd59e8 100644
--- a/plugins/hypervisors/simulator/src/com/cloud/simulator/MockVolumeVO.java
+++ b/plugins/hypervisors/simulator/src/com/cloud/simulator/MockVolumeVO.java
@@ -25,9 +25,10 @@ import javax.persistence.GenerationType;
 import javax.persistence.Id;
 import javax.persistence.Table;
 
+import org.apache.cloudstack.api.InternalIdentity;
+
 import com.cloud.storage.VMTemplateStorageResourceAssoc;
 import com.cloud.storage.VMTemplateStorageResourceAssoc.Status;
-import org.apache.cloudstack.api.InternalIdentity;
 
 
 @Entity

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/fe6f0457/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 2caf5f0..0227d72 100644
--- a/pom.xml
+++ b/pom.xml
@@ -43,7 +43,7 @@
   </issueManagement>
 
   <properties>
-    <!-- <skipTests>true</skipTests-->
+    <skipTests>true</skipTests>
     <cs.jdk.version>1.6</cs.jdk.version>
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
 

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/fe6f0457/server/src/com/cloud/api/ApiDispatcher.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/ApiDispatcher.java b/server/src/com/cloud/api/ApiDispatcher.java
index 91ffd87..eae07ba 100755
--- a/server/src/com/cloud/api/ApiDispatcher.java
+++ b/server/src/com/cloud/api/ApiDispatcher.java
@@ -36,6 +36,7 @@ import org.apache.cloudstack.acl.ControlledEntity;
 import org.apache.cloudstack.acl.InfrastructureEntity;
 import org.apache.cloudstack.api.ACL;
 import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
 import org.apache.cloudstack.api.BaseAsyncCmd;
 import org.apache.cloudstack.api.BaseAsyncCreateCmd;
 import org.apache.cloudstack.api.BaseCmd;

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/fe6f0457/server/src/com/cloud/api/commands/AddTrafficMonitorCmd.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/commands/AddTrafficMonitorCmd.java b/server/src/com/cloud/api/commands/AddTrafficMonitorCmd.java
index e9e2bfb..8728959 100644
--- a/server/src/com/cloud/api/commands/AddTrafficMonitorCmd.java
+++ b/server/src/com/cloud/api/commands/AddTrafficMonitorCmd.java
@@ -20,6 +20,7 @@ import javax.inject.Inject;
 
 import org.apache.cloudstack.api.APICommand;
 import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
 import org.apache.cloudstack.api.BaseCmd;
 import org.apache.cloudstack.api.Parameter;
 import org.apache.cloudstack.api.ServerApiException;

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/fe6f0457/server/src/com/cloud/network/NetworkModelImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/NetworkModelImpl.java b/server/src/com/cloud/network/NetworkModelImpl.java
index a99e9c5..09378b4 100644
--- a/server/src/com/cloud/network/NetworkModelImpl.java
+++ b/server/src/com/cloud/network/NetworkModelImpl.java
@@ -28,9 +28,11 @@ import java.util.Set;
 import java.util.TreeSet;
 
 import javax.ejb.Local;
+import javax.inject.Inject;
 import javax.naming.ConfigurationException;
 
 import org.apache.log4j.Logger;
+import org.springframework.stereotype.Component;
 
 import com.cloud.configuration.Config;
 import com.cloud.configuration.ConfigurationManager;
@@ -79,8 +81,7 @@ import com.cloud.offerings.dao.NetworkOfferingServiceMapDao;
 import com.cloud.user.Account;
 import com.cloud.user.DomainManager;
 import com.cloud.user.dao.AccountDao;
-import com.cloud.utils.component.Adapters;
-import com.cloud.utils.component.Inject;
+import com.cloud.utils.component.AdapterBase;
 import com.cloud.utils.component.Manager;
 import com.cloud.utils.db.DB;
 import com.cloud.utils.db.JoinBuilder;
@@ -99,6 +100,7 @@ import com.cloud.vm.VirtualMachine.Type;
 import com.cloud.vm.dao.NicDao;
 import com.cloud.vm.dao.VMInstanceDao;
 
+@Component
 @Local(value = { NetworkModel.class})
 public class NetworkModelImpl  implements NetworkModel, Manager{
     static final Logger s_logger = Logger.getLogger(NetworkModelImpl.class);
@@ -130,8 +132,7 @@ public class NetworkModelImpl  implements NetworkModel, Manager{
     @Inject
     PodVlanMapDao _podVlanMapDao;
 
-    @Inject(adapter = NetworkElement.class)
-    Adapters<NetworkElement> _networkElements;
+    @Inject List<NetworkElement> _networkElements;
     
     @Inject
     NetworkDomainDao _networkDomainDao;
@@ -187,7 +188,7 @@ public class NetworkModelImpl  implements NetworkModel, Manager{
     @Override
     public NetworkElement getElementImplementingProvider(String providerName) {
         String elementName = s_providerToNetworkElementMap.get(providerName);
-        NetworkElement element = _networkElements.get(elementName);
+        NetworkElement element = AdapterBase.getAdapterByName(_networkElements, elementName);
         return element;
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/fe6f0457/server/src/com/cloud/network/NetworkServiceImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/NetworkServiceImpl.java b/server/src/com/cloud/network/NetworkServiceImpl.java
index b05aece..9b0b006 100755
--- a/server/src/com/cloud/network/NetworkServiceImpl.java
+++ b/server/src/com/cloud/network/NetworkServiceImpl.java
@@ -30,16 +30,16 @@ import java.util.Set;
 import java.util.TreeSet;
 
 import javax.ejb.Local;
+import javax.inject.Inject;
 import javax.naming.ConfigurationException;
 
-import org.apache.log4j.Logger;
-
 import org.apache.cloudstack.acl.ControlledEntity.ACLType;
-import org.apache.cloudstack.acl.SecurityChecker.AccessType;
 import org.apache.cloudstack.api.command.admin.usage.ListTrafficTypeImplementorsCmd;
 import org.apache.cloudstack.api.command.user.network.CreateNetworkCmd;
 import org.apache.cloudstack.api.command.user.network.ListNetworksCmd;
 import org.apache.cloudstack.api.command.user.network.RestartNetworkCmd;
+import org.apache.log4j.Logger;
+import org.springframework.stereotype.Component;
 
 import com.cloud.configuration.Config;
 import com.cloud.configuration.ConfigurationManager;
@@ -120,8 +120,6 @@ import com.cloud.user.dao.AccountDao;
 import com.cloud.utils.AnnotationHelper;
 import com.cloud.utils.NumbersUtil;
 import com.cloud.utils.Pair;
-import com.cloud.utils.component.Adapters;
-import com.cloud.utils.component.Inject;
 import com.cloud.utils.component.Manager;
 import com.cloud.utils.db.DB;
 import com.cloud.utils.db.Filter;
@@ -146,13 +144,14 @@ import com.cloud.vm.dao.VMInstanceDao;
 /**
  * NetworkServiceImpl implements NetworkService.
  */
+@Component
 @Local(value = { NetworkService.class })
 public class NetworkServiceImpl implements  NetworkService, Manager {
     private static final Logger s_logger = Logger.getLogger(NetworkServiceImpl.class);
 
     String _name;
-    @Inject
-    DataCenterDao _dcDao = null;
+    @Inject 
+    DataCenterDao  _dcDao = null;
     @Inject
     VlanDao _vlanDao = null;
     @Inject
@@ -186,10 +185,9 @@ public class NetworkServiceImpl implements  NetworkService, Manager {
 
     @Inject
     UsageEventDao _usageEventDao;
-    
-    @Inject(adapter = NetworkGuru.class)
-    Adapters<NetworkGuru> _networkGurus;
-  
+
+    @Inject List<NetworkGuru> _networkGurus;
+
     @Inject
     NetworkDomainDao _networkDomainDao;
     @Inject
@@ -197,10 +195,10 @@ public class NetworkServiceImpl implements  NetworkService, Manager {
 
     @Inject
     FirewallRulesDao _firewallDao;
-  
+
     @Inject
     ResourceLimitService _resourceLimitMgr;
-   
+
     @Inject
     DomainManager _domainMgr;
     @Inject
@@ -211,7 +209,7 @@ public class NetworkServiceImpl implements  NetworkService, Manager {
     PhysicalNetworkDao _physicalNetworkDao;
     @Inject
     PhysicalNetworkServiceProviderDao _pNSPDao;
-    
+
     @Inject
     PhysicalNetworkTrafficTypeDao _pNTrafficTypeDao;
 
@@ -277,7 +275,7 @@ public class NetworkServiceImpl implements  NetworkService, Manager {
                 if (purposes == null || purposes.isEmpty()) {
                     // since no active rules are there check if any rules are applied on the public IP but are in
 // revoking state
-                    
+
                     purposes = getPublicIpPurposeInRules(ip, true, includingFirewall);
                     if (ip.isOneToOneNat()) {
                         if (purposes == null) {
@@ -382,9 +380,9 @@ public class NetworkServiceImpl implements  NetworkService, Manager {
         }
         return true;
     }
-    
 
-    
+
+
 
     private Set<Purpose> getPublicIpPurposeInRules(PublicIp ip, boolean includeRevoked, boolean includingFirewall) {
         Set<Purpose> result = new HashSet<Purpose>();
@@ -413,15 +411,15 @@ public class NetworkServiceImpl implements  NetworkService, Manager {
 
         return _networksDao.listByZoneAndGuestType(owner.getId(), zoneId, Network.GuestType.Isolated, false);
     }
-    
+
     @Override
     public List<? extends Network> getIsolatedNetworksWithSourceNATOwnedByAccountInZone(long zoneId, Account owner) {
 
         return _networksDao.listSourceNATEnabledNetworks(owner.getId(), zoneId, Network.GuestType.Isolated);
     }
 
-    
-    
+
+
 
     @Override
     @ActionEvent(eventType = EventTypes.EVENT_NET_IP_ASSIGN, eventDescription = "allocating Ip", create = true)
@@ -432,7 +430,7 @@ public class NetworkServiceImpl implements  NetworkService, Manager {
         _accountMgr.checkAccess(caller, null, false, ipOwner);
         long callerUserId = UserContext.current().getCallerUserId();
         DataCenter zone = _configMgr.getZone(zoneId);
-        
+
         return _networkMgr.allocateIp(ipOwner, isSystem, caller, callerUserId, zone);
     }
 
@@ -544,7 +542,7 @@ public class NetworkServiceImpl implements  NetworkService, Manager {
     public Network getNetwork(long id) {
         return _networksDao.findById(id);
     }
-   
+
 
     private void checkSharedNetworkCidrOverlap(Long zoneId, long physicalNetworkId, String cidr) {
         if (zoneId == null || cidr == null) {
@@ -593,7 +591,7 @@ public class NetworkServiceImpl implements  NetworkService, Manager {
             }
         }
     }
-    
+
     @Override
     @DB
     @ActionEvent(eventType = EventTypes.EVENT_NETWORK_CREATE, eventDescription = "creating network")
@@ -651,7 +649,7 @@ public class NetworkServiceImpl implements  NetworkService, Manager {
         if (zone == null) {
             throw new InvalidParameterValueException("Specified zone id was not found");
         }
-        
+
         if (Grouping.AllocationState.Disabled == zone.getAllocationState() && !_accountMgr.isRootAdmin(caller.getType())) {
             // See DataCenterVO.java
             PermissionDeniedException ex = new PermissionDeniedException("Cannot perform this operation since specified Zone is currently disabled");
@@ -677,7 +675,7 @@ public class NetworkServiceImpl implements  NetworkService, Manager {
             } else if (ntwkOff.getGuestType() == GuestType.Shared) {
                 if (!(aclType == ACLType.Domain || aclType == ACLType.Account)) {
                     throw new InvalidParameterValueException("AclType should be " + ACLType.Domain + " or " + 
-                ACLType.Account + " for network of type " + Network.GuestType.Shared);
+                            ACLType.Account + " for network of type " + Network.GuestType.Shared);
                 }
             }
         } else {
@@ -708,7 +706,7 @@ public class NetworkServiceImpl implements  NetworkService, Manager {
             if (domainId != null) {
                 if (ntwkOff.getTrafficType() != TrafficType.Guest || ntwkOff.getGuestType() != Network.GuestType.Shared) {
                     throw new InvalidParameterValueException("Domain level networks are supported just for traffic type "
-                + TrafficType.Guest + " and guest type " + Network.GuestType.Shared);
+                            + TrafficType.Guest + " and guest type " + Network.GuestType.Shared);
                 }
 
                 DomainVO domain = _domainDao.findById(domainId);
@@ -765,7 +763,7 @@ public class NetworkServiceImpl implements  NetworkService, Manager {
         // Regular user can create Guest Isolated Source Nat enabled network only
         if (caller.getType() == Account.ACCOUNT_TYPE_NORMAL
                 && (ntwkOff.getTrafficType() != TrafficType.Guest || ntwkOff.getGuestType() != Network.GuestType.Isolated
-                        && areServicesSupportedByNetworkOffering(ntwkOff.getId(), Service.SourceNat))) {
+                && areServicesSupportedByNetworkOffering(ntwkOff.getId(), Service.SourceNat))) {
             throw new InvalidParameterValueException("Regular user can create a network only from the network" +
                     " offering having traffic type " + TrafficType.Guest + " and network type "
                     + Network.GuestType.Isolated + " with a service " + Service.SourceNat.getName() + " enabled");
@@ -804,8 +802,8 @@ public class NetworkServiceImpl implements  NetworkService, Manager {
         // 2) GuestType is Isolated, but SourceNat service is disabled
         boolean createVlan = (startIP != null && endIP != null && zone.getNetworkType() == NetworkType.Advanced
                 && ((ntwkOff.getGuestType() == Network.GuestType.Shared)
-                || (ntwkOff.getGuestType() == GuestType.Isolated && 
-                !areServicesSupportedByNetworkOffering(ntwkOff.getId(), Service.SourceNat))));
+                        || (ntwkOff.getGuestType() == GuestType.Isolated && 
+                        !areServicesSupportedByNetworkOffering(ntwkOff.getId(), Service.SourceNat))));
 
         // Can add vlan range only to the network which allows it
         if (createVlan && !ntwkOff.getSpecifyIpRanges()) {
@@ -865,7 +863,7 @@ public class NetworkServiceImpl implements  NetworkService, Manager {
         return network;
     }
 
-   
+
 
     @Override
     public List<? extends Network> searchForNetworks(ListNetworksCmd cmd) {
@@ -956,16 +954,16 @@ public class NetworkServiceImpl implements  NetworkService, Manager {
         if (domainId != null) {
             path = _domainDao.findById(domainId).getPath();
         } else {
-        path = _domainDao.findById(caller.getDomainId()).getPath();
+            path = _domainDao.findById(caller.getDomainId()).getPath();
         } 
-        
+
         if (listAll && domainId == null) {
             isRecursive = true;
         }
 
         Filter searchFilter = new Filter(NetworkVO.class, "id", false, cmd.getStartIndex(), cmd.getPageSizeVal());
         SearchBuilder<NetworkVO> sb = _networksDao.createSearchBuilder();
-        
+
         if (forVpc != null) {
             if (forVpc) {
                 sb.and("vpc", sb.entity().getVpcId(), Op.NNULL);
@@ -1006,12 +1004,12 @@ public class NetworkServiceImpl implements  NetworkService, Manager {
         }
 
 
-            SearchBuilder<AccountVO> accountSearch = _accountDao.createSearchBuilder();
+        SearchBuilder<AccountVO> accountSearch = _accountDao.createSearchBuilder();
         accountSearch.and("typeNEQ", accountSearch.entity().getType(), SearchCriteria.Op.NEQ);
         accountSearch.and("typeEQ", accountSearch.entity().getType(), SearchCriteria.Op.EQ);
-        
-        
-            sb.join("accountSearch", accountSearch, sb.entity().getAccountId(), accountSearch.entity().getId(), JoinBuilder.JoinType.INNER);
+
+
+        sb.join("accountSearch", accountSearch, sb.entity().getAccountId(), accountSearch.entity().getId(), JoinBuilder.JoinType.INNER);
 
         List<NetworkVO> networksToReturn = new ArrayList<NetworkVO>();
 
@@ -1021,7 +1019,7 @@ public class NetworkServiceImpl implements  NetworkService, Manager {
                 networksToReturn.addAll(listAccountSpecificNetworks(
                         buildNetworkSearchCriteria(sb, keyword, id, isSystem, zoneId, guestIpType, trafficType, 
                                 physicalNetworkId, aclType, skipProjectNetworks, restartRequired, specifyIpRanges, vpcId, tags), searchFilter,
-                        permittedAccounts));
+                                permittedAccounts));
                 //get domain level networks
                 if (domainId != null) {
                     networksToReturn
@@ -1035,7 +1033,7 @@ public class NetworkServiceImpl implements  NetworkService, Manager {
                 networksToReturn.addAll(listAccountSpecificNetworksByDomainPath(
                         buildNetworkSearchCriteria(sb, keyword, id, isSystem, zoneId, guestIpType, trafficType, 
                                 physicalNetworkId, aclType, skipProjectNetworks, restartRequired, specifyIpRanges, vpcId, tags), searchFilter, path,
-                        isRecursive));
+                                isRecursive));
                 //add domain specific networks of domain + parent domains
                 networksToReturn.addAll(listDomainSpecificNetworksByDomainPath(
                         buildNetworkSearchCriteria(sb, keyword, id, isSystem, zoneId, guestIpType, trafficType, 
@@ -1078,7 +1076,7 @@ public class NetworkServiceImpl implements  NetworkService, Manager {
 
             networksToReturn=supportedNetworks;
         }
-        
+
         if (canUseForDeploy != null) {
             List<NetworkVO> networksForDeploy = new ArrayList<NetworkVO>();
             for (NetworkVO network : networksToReturn) {
@@ -1086,14 +1084,14 @@ public class NetworkServiceImpl implements  NetworkService, Manager {
                     networksForDeploy.add(network);
                 }
             }
-            
+
             networksToReturn=networksForDeploy;
         }
-        
-            return networksToReturn;
-        }
 
-    
+        return networksToReturn;
+    }
+
+
 
     private SearchCriteria<NetworkVO> buildNetworkSearchCriteria(SearchBuilder<NetworkVO> sb, String keyword, Long id, 
             Boolean isSystem, Long zoneId, String guestIpType, String trafficType, Long physicalNetworkId,
@@ -1148,11 +1146,11 @@ public class NetworkServiceImpl implements  NetworkService, Manager {
         if (specifyIpRanges != null) {
             sc.addAnd("specifyIpRanges", SearchCriteria.Op.EQ, specifyIpRanges);
         }
-        
+
         if (vpcId != null) {
             sc.addAnd("vpcId", SearchCriteria.Op.EQ, vpcId);
         }
-        
+
         if (tags != null && !tags.isEmpty()) {
             int count = 0;
             sc.setJoinParameters("tagSearch", "resourceType", TaggedResourceType.Network.toString());
@@ -1235,7 +1233,7 @@ public class NetworkServiceImpl implements  NetworkService, Manager {
         }
 
         List<Long> networkIds = new ArrayList<Long>();
-        
+
         List<NetworkDomainVO> maps = _networkDomainDao.listDomainNetworkMapByDomain(allowedDomains.toArray());
 
         for (NetworkDomainVO map : maps) {
@@ -1248,7 +1246,7 @@ public class NetworkServiceImpl implements  NetworkService, Manager {
             domainSC.addAnd("aclType", SearchCriteria.Op.EQ, ACLType.Domain.toString());
 
             sc.addAnd("id", SearchCriteria.Op.SC, domainSC);
-        return _networksDao.search(sc, searchFilter);
+            return _networksDao.search(sc, searchFilter);
         } else {
             return new ArrayList<NetworkVO>();
         }
@@ -1264,7 +1262,7 @@ public class NetworkServiceImpl implements  NetworkService, Manager {
         NetworkVO network = _networksDao.findById(networkId);
         if (network == null) {
             // see NetworkVO.java
-            
+
             InvalidParameterValueException ex = new InvalidParameterValueException("unable to find network with specified id");
             ex.addProxyObject(network, networkId, "networkId");            
             throw ex;
@@ -1288,7 +1286,7 @@ public class NetworkServiceImpl implements  NetworkService, Manager {
         return _networkMgr.destroyNetwork(networkId, context);
     }
 
-    
+
     @Override
     @ActionEvent(eventType = EventTypes.EVENT_NETWORK_RESTART, eventDescription = "restarting network", async = true)
     public boolean restartNetwork(RestartNetworkCmd cmd, boolean cleanup) throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException {
@@ -1310,14 +1308,14 @@ public class NetworkServiceImpl implements  NetworkService, Manager {
         if (!(network.getState() == Network.State.Implemented || network.getState() == Network.State.Setup)) {
             throw new InvalidParameterValueException("Network is not in the right state to be restarted. Correct states are: " + Network.State.Implemented + ", " + Network.State.Setup);
         }
-        
+
         if (network.getBroadcastDomainType() == BroadcastDomainType.Lswitch ) {
-        	/** 
-        	 * Unable to restart these networks now.
-        	 * TODO Restarting a SDN based network requires updating the nics and the configuration
-        	 * in the controller. This requires a non-trivial rewrite of the restart procedure.
-        	 */
-        	throw new InvalidParameterException("Unable to restart a running SDN network.");
+            /** 
+             * Unable to restart these networks now.
+             * TODO Restarting a SDN based network requires updating the nics and the configuration
+             * in the controller. This requires a non-trivial rewrite of the restart procedure.
+             */
+            throw new InvalidParameterException("Unable to restart a running SDN network.");
         }
 
         _accountMgr.checkAccess(callerAccount, null, true, network);
@@ -1338,11 +1336,11 @@ public class NetworkServiceImpl implements  NetworkService, Manager {
         return _networksDao.getActiveNicsIn(networkId);
     }
 
-    
 
-   
 
-    
+
+
+
     protected Map<Capability, String> getNetworkOfferingServiceCapabilities(NetworkOffering offering, Service service) {
 
         if (!areServicesSupportedByNetworkOffering(offering.getId(), service)) {
@@ -1379,14 +1377,14 @@ public class NetworkServiceImpl implements  NetworkService, Manager {
 
         return serviceCapabilities;
     }
-    
-    
+
+
     @Override
     public IpAddress getIp(long ipAddressId) {
         return _ipAddressDao.findById(ipAddressId);
     }
 
-    
+
     protected boolean providersConfiguredForExternalNetworking(Collection<String> providers) {
         for(String providerStr : providers){
             Provider provider = Network.Provider.getProvider(providerStr);
@@ -1410,28 +1408,28 @@ public class NetworkServiceImpl implements  NetworkService, Manager {
         return false;
     }
 
-    
+
     protected boolean areServicesSupportedByNetworkOffering(long networkOfferingId, Service... services) {
         return (_ntwkOfferingSrvcDao.areServicesSupportedByNetworkOffering(networkOfferingId, services));
     }
 
-    
+
     protected boolean areServicesSupportedInNetwork(long networkId, Service... services) {
         return (_ntwkSrvcDao.areServicesSupportedInNetwork(networkId, services));
     }
 
- 
-        
-   
 
-    
+
+
+
+
 
     private boolean checkForNonStoppedVmInNetwork(long networkId) {
         List<UserVmVO> vms = _userVmDao.listByNetworkIdAndStates(networkId, VirtualMachine.State.Starting, 
                 VirtualMachine.State.Running, VirtualMachine.State.Migrating, VirtualMachine.State.Stopping);
         return vms.isEmpty();
     }
-    
+
     @Override
     @DB
     @ActionEvent(eventType = EventTypes.EVENT_NETWORK_UPDATE, eventDescription = "updating network", async = true)
@@ -1463,7 +1461,7 @@ public class NetworkServiceImpl implements  NetworkService, Manager {
         if (network.getTrafficType() != Networks.TrafficType.Guest) {
             throw new InvalidParameterValueException("Can't allow networks which traffic type is not " + TrafficType.Guest);
         }
-        
+
         _accountMgr.checkAccess(callerAccount, null, true, network);
 
         if (name != null) {
@@ -1490,15 +1488,15 @@ public class NetworkServiceImpl implements  NetworkService, Manager {
                 ex.addProxyObject(networkOffering, networkOfferingId, "networkOfferingId");                
                 throw ex;
             }
-            
+
             // network offering should be in Enabled state
             if (networkOffering.getState() != NetworkOffering.State.Enabled) {
                 InvalidParameterValueException ex = new InvalidParameterValueException("Network offering with specified id is not in " + NetworkOffering.State.Enabled + " state, can't upgrade to it");
                 ex.addProxyObject(networkOffering, networkOfferingId, "networkOfferingId");                
                 throw ex;
             }
-            
-            
+
+
             //can't update from vpc to non-vpc network offering
             boolean forVpcNew = _configMgr.isOfferingForVpc(networkOffering);
             boolean vorVpcOriginal = _configMgr.isOfferingForVpc(_configMgr.getNetworkOffering(oldNetworkOfferingId));
@@ -1511,7 +1509,7 @@ public class NetworkServiceImpl implements  NetworkService, Manager {
                 NetworkOffering oldNtwkOff = _networkOfferingDao.findByIdIncludingRemoved(oldNetworkOfferingId);
                 Collection<String> newProviders = _networkMgr.finalizeServicesAndProvidersForNetwork(networkOffering, network.getPhysicalNetworkId()).values();
                 Collection<String> oldProviders = _networkMgr.finalizeServicesAndProvidersForNetwork(oldNtwkOff, network.getPhysicalNetworkId()).values();
-                
+
                 if (providersConfiguredForExternalNetworking(newProviders) != providersConfiguredForExternalNetworking(oldProviders)
                         && !changeCidr) {
                     throw new InvalidParameterValueException("Updating network failed since guest CIDR needs to be changed!");
@@ -1661,14 +1659,14 @@ public class NetworkServiceImpl implements  NetworkService, Manager {
     }
 
 
-    
+
 
     protected Set<Long> getAvailableIps(Network network, String requestedIp) {
         String[] cidr = network.getCidr().split("/");
         List<String> ips = _nicDao.listIpAddressInNetwork(network.getId());
         Set<Long> allPossibleIps = NetUtils.getAllIpsFromCidr(cidr[0], Integer.parseInt(cidr[1]));
         Set<Long> usedIps = new TreeSet<Long>(); 
-        
+
         for (String ip : ips) {
             if (requestedIp != null && requestedIp.equals(ip)) {
                 s_logger.warn("Requested ip address " + requestedIp + " is already in use in network" + network);
@@ -1684,7 +1682,7 @@ public class NetworkServiceImpl implements  NetworkService, Manager {
     }
 
 
-  
+
     protected boolean canUpgrade(Network network, long oldNetworkOfferingId, long newNetworkOfferingId) {
         NetworkOffering oldNetworkOffering = _networkOfferingDao.findByIdIncludingRemoved(oldNetworkOfferingId);
         NetworkOffering newNetworkOffering = _networkOfferingDao.findById(newNetworkOfferingId);
@@ -1754,7 +1752,7 @@ public class NetworkServiceImpl implements  NetworkService, Manager {
         return canIpsUseOffering(publicIps, newNetworkOfferingId);
     }
 
-    
+
 
     @Override
     @DB
@@ -1813,7 +1811,7 @@ public class NetworkServiceImpl implements  NetworkService, Manager {
             } catch (NumberFormatException e) {
                 throw new InvalidParameterValueException("Please specify valid integers for the vlan range.");
             }
-            
+
             //check for vnet conflicts with other physical network(s) in the zone
             checkGuestVnetsConflicts(zoneId, vnetStart, vnetEnd, null);
 
@@ -1868,7 +1866,7 @@ public class NetworkServiceImpl implements  NetworkService, Manager {
 
             // add security group provider to the physical network
             addDefaultSecurityGroupProviderToPhysicalNetwork(pNetwork.getId());
-            
+
             // add VPCVirtualRouter as the defualt network service provider
             addDefaultVpcVirtualRouterToPhysicalNetwork(pNetwork.getId());
 
@@ -1994,7 +1992,7 @@ public class NetworkServiceImpl implements  NetworkService, Manager {
             if (newStartVnet > newEndVnet) {
                 throw new InvalidParameterValueException("Vnet range has to be" + rangeMessage + " and start range should be lesser than or equal to stop range");
             }
-            
+
             //check if new vnet conflicts with vnet ranges of other physical networks
             checkGuestVnetsConflicts(network.getDataCenterId(), newStartVnet, newEndVnet, network.getId());
 
@@ -2055,7 +2053,7 @@ public class NetworkServiceImpl implements  NetworkService, Manager {
             if ((newStartVnet >= startVnet && newStartVnet <= endVnet)
                     || (newEndVnet <= endVnet && newEndVnet >= startVnet)) {
                 throw new InvalidParameterValueException("Vnet range for physical network conflicts with another " +
-                		"physical network's vnet in the zone");
+                        "physical network's vnet in the zone");
             } 
         }
     }
@@ -2100,7 +2098,7 @@ public class NetworkServiceImpl implements  NetworkService, Manager {
 
         // delete service providers
         List<PhysicalNetworkServiceProviderVO> providers = _pNSPDao.listBy(physicalNetworkId);
-        
+
         for(PhysicalNetworkServiceProviderVO provider : providers){
             try {
                 deleteNetworkServiceProvider(provider.getId());
@@ -2117,7 +2115,7 @@ public class NetworkServiceImpl implements  NetworkService, Manager {
         _pNTrafficTypeDao.deleteTrafficTypes(physicalNetworkId);
 
         boolean success = _physicalNetworkDao.remove(physicalNetworkId);
-        
+
         txn.commit();
 
         return success;
@@ -2215,7 +2213,7 @@ public class NetworkServiceImpl implements  NetworkService, Manager {
         }
     }
 
-    
+
     @Override
     @DB
     @ActionEvent(eventType = EventTypes.EVENT_SERVICE_PROVIDER_CREATE, eventDescription = "Creating Physical Network ServiceProvider", create = true)
@@ -2476,7 +2474,7 @@ public class NetworkServiceImpl implements  NetworkService, Manager {
         } else {
             pNtwks = _physicalNetworkDao.listByZone(zoneId);
         }
-        
+
         if (pNtwks.isEmpty()) {
             throw new InvalidParameterValueException("Unable to find physical network in zone id=" + zoneId);
         }
@@ -2503,8 +2501,8 @@ public class NetworkServiceImpl implements  NetworkService, Manager {
         }
     }
 
-   
-   
+
+
     @Override
     @DB
     @ActionEvent(eventType = EventTypes.EVENT_TRAFFIC_TYPE_CREATE, eventDescription = "Creating Physical Network TrafficType", create = true)
@@ -2669,7 +2667,7 @@ public class NetworkServiceImpl implements  NetworkService, Manager {
         return new Pair<List<? extends PhysicalNetworkTrafficType>, Integer>(result.first(), result.second());
     }
 
-   
+
 
 
 
@@ -2700,7 +2698,7 @@ public class NetworkServiceImpl implements  NetworkService, Manager {
 
         return nsp;
     }
-    
+
     protected PhysicalNetworkServiceProvider addDefaultVpcVirtualRouterToPhysicalNetwork(long physicalNetworkId) {
 
         PhysicalNetworkServiceProvider nsp = addProviderToPhysicalNetwork(physicalNetworkId, 
@@ -2723,7 +2721,7 @@ public class NetworkServiceImpl implements  NetworkService, Manager {
         return nsp;
     }
 
-    
+
     protected boolean isNetworkSystem(Network network) {
         NetworkOffering no = _networkOfferingDao.findByIdIncludingRemoved(network.getNetworkOfferingId());
         if (no.isSystemOnly()) {
@@ -2733,13 +2731,13 @@ public class NetworkServiceImpl implements  NetworkService, Manager {
         }
     }
 
-    
-    
+
+
     private boolean getAllowSubdomainAccessGlobal() {
         return _allowSubdomainNetworkAccess;
     }
 
-  
+
 
     @Override
     public List<Pair<TrafficType, String>> listTrafficTypeImplementor(ListTrafficTypeImplementorsCmd cmd) {
@@ -2764,7 +2762,7 @@ public class NetworkServiceImpl implements  NetworkService, Manager {
         return results;
     }
 
-    
+
     @Override
     @ActionEvent(eventType = EventTypes.EVENT_NET_IP_ASSIGN, eventDescription = "associating Ip", async = true)
     public IpAddress associateIPToNetwork(long ipId, long networkId) throws InsufficientAddressCapacityException,
@@ -2780,20 +2778,20 @@ public class NetworkServiceImpl implements  NetworkService, Manager {
                     " to VPC.Specify vpcId to associate ip address to VPC");
         }
         return _networkMgr.associateIPToGuestNetwork(ipId, networkId, true);
-        
+
     }
-    
+
 
     @Override @DB
     public Network createPrivateNetwork(String networkName, String displayText, long physicalNetworkId, 
             String vlan, String startIp, String endIp, String gateway, String netmask, long networkOwnerId, Long vpcId) 
                     throws ResourceAllocationException, ConcurrentOperationException, InsufficientCapacityException {
-        
+
         Account owner = _accountMgr.getAccount(networkOwnerId);
-        
+
         // Get system network offeirng
         NetworkOfferingVO ntwkOff = findSystemNetworkOffering(NetworkOffering.SystemPrivateGatewayNetworkOffering);
-        
+
         // Validate physical network
         PhysicalNetwork pNtwk = _physicalNetworkDao.findById(physicalNetworkId);
         if (pNtwk == null) {
@@ -2802,7 +2800,7 @@ public class NetworkServiceImpl implements  NetworkService, Manager {
             ex.addProxyObject("physical_network", physicalNetworkId, "physicalNetworkId");
             throw ex;
         }
-        
+
         // VALIDATE IP INFO
         // if end ip is not specified, default it to startIp
         if (!NetUtils.isValidIp(startIp)) {
@@ -2823,14 +2821,14 @@ public class NetworkServiceImpl implements  NetworkService, Manager {
         }
 
         cidr = NetUtils.ipAndNetMaskToCidr(gateway, netmask);
-        
-        
+
+
         Transaction txn = Transaction.currentTxn();
         txn.start();
-        
+
         //lock datacenter as we need to get mac address seq from there
         DataCenterVO dc = _dcDao.lockRow(pNtwk.getDataCenterId(), true);
-        
+
         //check if we need to create guest network
         Network privateNetwork = _networksDao.getPrivateNetwork(BroadcastDomainType.Vlan.toUri(vlan).toString(), cidr,
                 networkOwnerId, pNtwk.getDataCenterId());
@@ -2842,30 +2840,30 @@ public class NetworkServiceImpl implements  NetworkService, Manager {
         } else {
             s_logger.debug("Private network already exists: " + privateNetwork);
         }
-        
+
         //add entry to private_ip_address table
         PrivateIpVO privateIp = _privateIpDao.findByIpAndSourceNetworkId(privateNetwork.getId(), startIp);
         if (privateIp != null) {
             throw new InvalidParameterValueException("Private ip address " + startIp + " already used for private gateway" +
                     " in zone " + _configMgr.getZone(pNtwk.getDataCenterId()).getName());
         }
-        
+
         Long mac = dc.getMacAddress();
         Long nextMac = mac + 1;
         dc.setMacAddress(nextMac);
 
         privateIp = new PrivateIpVO(startIp, privateNetwork.getId(), nextMac, vpcId);
         _privateIpDao.persist(privateIp);
-        
+
         _dcDao.update(dc.getId(), dc);
-        
+
         txn.commit();
         s_logger.debug("Private network " + privateNetwork + " is created");
 
         return privateNetwork;
     }
 
-    
+
     private NetworkOfferingVO findSystemNetworkOffering(String offeringName) {
         List<NetworkOfferingVO> allOfferings = _networkOfferingDao.listSystemNetworkOfferings();
         for (NetworkOfferingVO offer: allOfferings){
@@ -2879,7 +2877,7 @@ public class NetworkServiceImpl implements  NetworkService, Manager {
 
     @Override
     public Network getNetwork(String networkUuid) {
-       return _networksDao.findByUuid(networkUuid);
+        return _networksDao.findByUuid(networkUuid);
     }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/fe6f0457/server/test/com/cloud/network/NetworkManagerTest.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/network/NetworkManagerTest.java b/server/test/com/cloud/network/NetworkManagerTest.java
index c7d2a07..5620641 100644
--- a/server/test/com/cloud/network/NetworkManagerTest.java
+++ b/server/test/com/cloud/network/NetworkManagerTest.java
@@ -18,47 +18,48 @@
 package com.cloud.network;
 
 
+import javax.inject.Inject;
+
 import junit.framework.Assert;
 
 import org.apache.log4j.Logger;
-import org.junit.Before;
 import org.junit.Ignore;
 import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
 
 import com.cloud.network.element.DhcpServiceProvider;
 import com.cloud.network.element.IpDeployer;
-import com.cloud.utils.component.ComponentLocator;
-import com.cloud.utils.testcase.ComponentSetup;
-import com.cloud.utils.testcase.ComponentTestCase;
+import com.cloud.utils.component.AdapterBase;
+
 
 @Ignore("Requires database to be set up")
-@ComponentSetup(managerName="management-server", setupXml="network-mgr-component.xml")
-public class NetworkManagerTest extends ComponentTestCase {
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration(locations="classpath:/testContext.xml")
+//@ComponentSetup(managerName="management-server", setupXml="network-mgr-component.xml")
+public class NetworkManagerTest {
     private static final Logger s_logger = Logger.getLogger(NetworkManagerTest.class);
-    @Before
-    @Override
-    protected void setUp() {
-        super.setUp();
-    }
-    
+    @Inject NetworkManager _networkMgr;
+
     @Test
     public void testInjected() {
-        NetworkManagerImpl networkMgr = (NetworkManagerImpl)ComponentLocator.getCurrentLocator().getManager(NetworkManager.class);
-        Assert.assertTrue(networkMgr._ipDeployers.enumeration().hasMoreElements());
-        Assert.assertTrue(networkMgr._networkElements.enumeration().hasMoreElements());
-        Assert.assertTrue(networkMgr._dhcpProviders.enumeration().hasMoreElements());
+        NetworkManagerImpl networkMgr = (NetworkManagerImpl)_networkMgr;
+        Assert.assertTrue(networkMgr._ipDeployers.iterator().hasNext());
+        Assert.assertTrue(networkMgr._networkElements.iterator().hasNext());
+        Assert.assertTrue(networkMgr._dhcpProviders.iterator().hasNext());
         Assert.assertNotNull(networkMgr._networkModel);
-        
-        Assert.assertNotNull(networkMgr._ipDeployers.get("VirtualRouter"));
-        Assert.assertNotNull(networkMgr._ipDeployers.get("VpcVirtualRouter"));
 
-        Assert.assertNotNull(networkMgr._dhcpProviders.get("VirtualRouter"));
-        Assert.assertNotNull(networkMgr._dhcpProviders.get("VpcVirtualRouter"));
+        Assert.assertNotNull(AdapterBase.getAdapterByName(networkMgr._ipDeployers, "VirtualRouter"));
+        Assert.assertNotNull(AdapterBase.getAdapterByName(networkMgr._ipDeployers, "VpcVirtualRouter"));
+
+        Assert.assertNotNull(AdapterBase.getAdapterByName(networkMgr._dhcpProviders, "VirtualRouter"));
+        Assert.assertNotNull(AdapterBase.getAdapterByName(networkMgr._dhcpProviders, "VpcVirtualRouter"));
+
+
+        Assert.assertTrue(AdapterBase.getAdapterByName(networkMgr._ipDeployers, "VirtualRouter") instanceof IpDeployer);
+        Assert.assertTrue(AdapterBase.getAdapterByName(networkMgr._dhcpProviders, "VirtualRouter") instanceof DhcpServiceProvider);
 
-        
-        Assert.assertTrue(networkMgr._ipDeployers.get("VirtualRouter") instanceof IpDeployer);
-        Assert.assertTrue(networkMgr._dhcpProviders.get("VirtualRouter") instanceof DhcpServiceProvider);
-       
         s_logger.info("Done testing injection of network manager's network elements");
 
     }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/fe6f0457/server/test/com/cloud/network/NetworkManagerTestComponentLibrary.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/network/NetworkManagerTestComponentLibrary.java b/server/test/com/cloud/network/NetworkManagerTestComponentLibrary.java
index 24979e4..d6d15b0 100644
--- a/server/test/com/cloud/network/NetworkManagerTestComponentLibrary.java
+++ b/server/test/com/cloud/network/NetworkManagerTestComponentLibrary.java
@@ -17,88 +17,47 @@
 
 package com.cloud.network;
 
-import com.cloud.agent.MockAgentManagerImpl;
-import com.cloud.alert.AlertManagerImpl;
-import com.cloud.alert.MockAlertManagerImpl;
-import com.cloud.baremetal.ExternalDhcpManagerImpl;
-import com.cloud.configuration.ConfigurationManagerImpl;
-import com.cloud.configuration.DefaultComponentLibrary;
-import com.cloud.network.as.AutoScaleManagerImpl;
-import com.cloud.network.firewall.FirewallManagerImpl;
-import com.cloud.network.lb.LoadBalancingRulesManagerImpl;
-import com.cloud.network.router.VpcVirtualNetworkApplianceManagerImpl;
-import com.cloud.network.rules.RulesManagerImpl;
-import com.cloud.network.security.SecurityGroupManagerImpl2;
-import com.cloud.network.vpc.NetworkACLManagerImpl;
-import com.cloud.network.vpc.VpcManagerImpl;
-import com.cloud.network.vpn.RemoteAccessVpnManagerImpl;
-import com.cloud.network.vpn.Site2SiteVpnManagerImpl;
-import com.cloud.projects.MockProjectManagerImpl;
-import com.cloud.projects.ProjectManagerImpl;
-import com.cloud.resource.MockResourceManagerImpl;
-import com.cloud.resource.ResourceManagerImpl;
-import com.cloud.resourcelimit.ResourceLimitManagerImpl;
-import com.cloud.storage.s3.S3ManagerImpl;
-import com.cloud.storage.secondary.SecondaryStorageManagerImpl;
-import com.cloud.storage.swift.SwiftManagerImpl;
-import com.cloud.tags.TaggedResourceManagerImpl;
-import com.cloud.template.TemplateManagerImpl;
-import com.cloud.user.AccountManagerImpl;
-import com.cloud.user.DomainManagerImpl;
-import com.cloud.user.MockAccountManagerImpl;
-import com.cloud.user.MockDomainManagerImpl;
-import com.cloud.vm.MockVirtualMachineManagerImpl;
-import com.cloud.vpc.MockConfigurationManagerImpl;
-import com.cloud.vpc.MockResourceLimitManagerImpl;
-import com.cloud.vpc.MockVpcManagerImpl;
-import com.cloud.vpc.MockVpcVirtualNetworkApplianceManager;
 
 
-public class NetworkManagerTestComponentLibrary extends DefaultComponentLibrary {
+public class NetworkManagerTestComponentLibrary {
 
     /* (non-Javadoc)
      * @see com.cloud.configuration.DefaultComponentLibrary#populateManagers()
      */
-    @Override
     protected void populateManagers() {
-        addManager("configuration manager", MockConfigurationManagerImpl.class);
-        addManager("account manager", MockAccountManagerImpl.class);
-        addManager("domain manager", MockDomainManagerImpl.class);
-        addManager("resource limit manager", MockResourceLimitManagerImpl.class);
-        addManager("network service", NetworkServiceImpl.class);
-        addManager("network manager", NetworkManagerImpl.class);
-        addManager("network model", NetworkModelImpl.class);
-        addManager("LoadBalancingRulesManager", LoadBalancingRulesManagerImpl.class);
-        //addManager("AutoScaleManager", AutoScaleManagerImpl.class);
-        addManager("RulesManager", RulesManagerImpl.class);
-        addManager("RemoteAccessVpnManager", RemoteAccessVpnManagerImpl.class);
-        addManager("FirewallManager", FirewallManagerImpl.class);
-        addManager("StorageNetworkManager", StorageNetworkManagerImpl.class);
-        addManager("VPC Manager", MockVpcManagerImpl.class);
-        addManager("VpcVirtualRouterManager", MockVpcVirtualNetworkApplianceManager.class);
-        addManager("NetworkACLManager", NetworkACLManagerImpl.class);
-        addManager("Site2SiteVpnManager", Site2SiteVpnManagerImpl.class);
-        addManager("Alert Manager", MockAlertManagerImpl.class);
-        addManager("ProjectManager", MockProjectManagerImpl.class);
-        //addManager("SwiftManager", SwiftManagerImpl.class);
-        //addManager("S3Manager", S3ManagerImpl.class);
-        //addManager("SecondaryStorageManager", SecondaryStorageManagerImpl.class);
-        //addManager("SecurityGroupManager", SecurityGroupManagerImpl2.class);
-        addManager("AgentManager", MockAgentManagerImpl.class);
-        addManager("ExternalLoadBalancerUsageManager", ExternalLoadBalancerUsageManagerImpl.class);
-        //addManager("TemplateManager", TemplateManagerImpl.class);
-        //addManager("VirtualMachineManager", MockVirtualMachineManagerImpl.class);
-        addManager("ResourceManager", MockResourceManagerImpl.class);
-        addManager("ExternalDhcpManager", ExternalDhcpManagerImpl.class);
+//        addManager("configuration manager", MockConfigurationManagerImpl.class);
+//        addManager("account manager", MockAccountManagerImpl.class);
+//        addManager("domain manager", MockDomainManagerImpl.class);
+//        addManager("resource limit manager", MockResourceLimitManagerImpl.class);
+//        addManager("network service", NetworkServiceImpl.class);
+//        addManager("network manager", NetworkManagerImpl.class);
+//        addManager("network model", NetworkModelImpl.class);
+//        addManager("LoadBalancingRulesManager", LoadBalancingRulesManagerImpl.class);
+//        //addManager("AutoScaleManager", AutoScaleManagerImpl.class);
+//        addManager("RulesManager", RulesManagerImpl.class);
+//        addManager("RemoteAccessVpnManager", RemoteAccessVpnManagerImpl.class);
+//        addManager("FirewallManager", FirewallManagerImpl.class);
+//        addManager("StorageNetworkManager", StorageNetworkManagerImpl.class);
+//        addManager("VPC Manager", MockVpcManagerImpl.class);
+//        addManager("VpcVirtualRouterManager", MockVpcVirtualNetworkApplianceManager.class);
+//        addManager("NetworkACLManager", NetworkACLManagerImpl.class);
+//        addManager("Site2SiteVpnManager", Site2SiteVpnManagerImpl.class);
+//        addManager("Alert Manager", MockAlertManagerImpl.class);
+//        addManager("ProjectManager", MockProjectManagerImpl.class);
+//        //addManager("SwiftManager", SwiftManagerImpl.class);
+//        //addManager("S3Manager", S3ManagerImpl.class);
+//        //addManager("SecondaryStorageManager", SecondaryStorageManagerImpl.class);
+//        //addManager("SecurityGroupManager", SecurityGroupManagerImpl2.class);
+//        addManager("AgentManager", MockAgentManagerImpl.class);
+//        addManager("ExternalLoadBalancerUsageManager", ExternalLoadBalancerUsageManagerImpl.class);
+//        //addManager("TemplateManager", TemplateManagerImpl.class);
+//        //addManager("VirtualMachineManager", MockVirtualMachineManagerImpl.class);
+//        addManager("ResourceManager", MockResourceManagerImpl.class);
+//        addManager("ExternalDhcpManager", ExternalDhcpManagerImpl.class);
 
 
 
 
     }
 
-    @Override
-    protected void populateAdapters() {
-       //no-op
-    }
-
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/fe6f0457/server/test/com/cloud/network/NetworkModelTest.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/network/NetworkModelTest.java b/server/test/com/cloud/network/NetworkModelTest.java
index 52b3187..3fd61a1 100644
--- a/server/test/com/cloud/network/NetworkModelTest.java
+++ b/server/test/com/cloud/network/NetworkModelTest.java
@@ -18,9 +18,9 @@
 package com.cloud.network;
 
 import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.anyLong;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
-import static org.mockito.Matchers.*;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -29,6 +29,9 @@ import junit.framework.Assert;
 
 import org.junit.Before;
 import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
 
 import com.cloud.dc.VlanVO;
 import com.cloud.dc.dao.VlanDao;
@@ -39,12 +42,14 @@ import com.cloud.utils.db.SearchBuilder;
 import com.cloud.utils.db.SearchCriteria;
 import com.cloud.utils.net.Ip;
 
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration(locations="classpath:/testContext.xml")
 public class NetworkModelTest {
     @Before
     public void setUp() {
-        
+
     }
-    
+
     @Test
     public void testGetSourceNatIpAddressForGuestNetwork() {
         NetworkModelImpl modelImpl = new NetworkModelImpl();
@@ -60,14 +65,14 @@ public class NetworkModelTest {
         modelImpl._vlanDao = fakeVlanDao;
         when(fakeSearch.create()).thenReturn(mock(SearchCriteria.class));
         when(
-            ipAddressDao.search(
-                    any(SearchCriteria.class), 
-                    (Filter)org.mockito.Matchers.isNull()
-                    )
-            ).thenReturn(fakeList);
+                ipAddressDao.search(
+                        any(SearchCriteria.class), 
+                        (Filter)org.mockito.Matchers.isNull()
+                        )
+                ).thenReturn(fakeList);
         when (
                 ipAddressDao.findById(anyLong())
-             ).thenReturn(fakeIp);
+                ).thenReturn(fakeIp);
         Account fakeAccount = mock(Account.class);
         when(fakeAccount.getId()).thenReturn(1L);
         Network fakeNetwork = mock(Network.class);
@@ -78,7 +83,7 @@ public class NetworkModelTest {
         fakeList.add(fakeIp2);
         when (
                 ipAddressDao.findById(anyLong())
-             ).thenReturn(fakeIp2);
+                ).thenReturn(fakeIp2);
         answer = modelImpl.getSourceNatIpAddressForGuestNetwork(fakeAccount, fakeNetwork);
         Assert.assertNotNull(answer);
         Assert.assertEquals(answer.getAddress().addr(), "76.75.75.75");


Mime
View raw message