You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by hu...@apache.org on 2014/02/14 18:38:05 UTC

[05/22] git commit: updated refs/heads/master to 443acac

Findbugs : A map can't retrieve an object by index, so get(0) would
return null. Changed to retrieve the first entry in the map.

Removed the ExecutionException try catch, this would prevent the
unittest from giving accurate information on exceptions. Avoid catching
checked exceptions in a unittest, use expected keyword on @Test instead.


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/9b841af5
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/9b841af5
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/9b841af5

Branch: refs/heads/master
Commit: 9b841af529707e7c57adce0ed14a03be054833fc
Parents: d4d4957
Author: Hugo Trippaers <ht...@schubergphilis.com>
Authored: Wed Feb 12 11:46:12 2014 +0100
Committer: Hugo Trippaers <ht...@schubergphilis.com>
Committed: Fri Feb 14 18:37:45 2014 +0100

----------------------------------------------------------------------
 .../network/cisco/CiscoVnmcConnectionTest.java  | 209 +++++--------------
 1 file changed, 58 insertions(+), 151 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9b841af5/plugins/network-elements/cisco-vnmc/test/com/cloud/network/cisco/CiscoVnmcConnectionTest.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/cisco-vnmc/test/com/cloud/network/cisco/CiscoVnmcConnectionTest.java b/plugins/network-elements/cisco-vnmc/test/com/cloud/network/cisco/CiscoVnmcConnectionTest.java
index f5fca0a..46e18a0 100644
--- a/plugins/network-elements/cisco-vnmc/test/com/cloud/network/cisco/CiscoVnmcConnectionTest.java
+++ b/plugins/network-elements/cisco-vnmc/test/com/cloud/network/cisco/CiscoVnmcConnectionTest.java
@@ -35,207 +35,114 @@ public class CiscoVnmcConnectionTest {
     @BeforeClass
     public static void setUpClass() throws Exception {
         connection = new CiscoVnmcConnectionImpl("10.223.56.5", "admin", "C1sco123");
-        try {
-            boolean response = connection.login();
-            assertTrue(response);
-        } catch (ExecutionException e) {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
-        }
+        boolean response = connection.login();
+        assertTrue(response);
     }
 
     @Test
-    public void testLogin() {
-        //fail("Not yet implemented");
-        try {
-            boolean response = connection.login();
-            assertTrue(response);
-        } catch (ExecutionException e) {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
-        }
+    public void testLogin() throws ExecutionException {
+        boolean response = connection.login();
+        assertTrue(response);
     }
 
     @Test
-    public void testCreateTenant() {
-        //fail("Not yet implemented");
-        try {
-            boolean response = connection.createTenant(tenantName);
-            assertTrue(response);
-        } catch (ExecutionException e) {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
-        }
+    public void testCreateTenant() throws ExecutionException {
+        boolean response = connection.createTenant(tenantName);
+        assertTrue(response);
     }
 
     @Test
-    public void testCreateTenantVDC() {
-        //fail("Not yet implemented");
-        try {
-            boolean response = connection.createTenantVDC(tenantName);
-            assertTrue(response);
-        } catch (ExecutionException e) {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
-        }
+    public void testCreateTenantVDC() throws ExecutionException {
+        boolean response = connection.createTenantVDC(tenantName);
+        assertTrue(response);
     }
 
     @Test
-    public void testCreateTenantVDCEdgeDeviceProfile() {
-        //fail("Not yet implemented");
-        try {
-            boolean response = connection.createTenantVDCEdgeDeviceProfile(tenantName);
-            assertTrue(response);
-        } catch (ExecutionException e) {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
-        }
+    public void testCreateTenantVDCEdgeDeviceProfile() throws ExecutionException {
+        boolean response = connection.createTenantVDCEdgeDeviceProfile(tenantName);
+        assertTrue(response);
     }
 
     @Test
-    public void testCreateTenantVDCEdgeDeviceRoutePolicy() {
-        try {
-            boolean response = connection.createTenantVDCEdgeStaticRoutePolicy(tenantName);
-            assertTrue(response);
-        } catch (ExecutionException e) {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
-        }
+    public void testCreateTenantVDCEdgeDeviceRoutePolicy() throws ExecutionException {
+        boolean response = connection.createTenantVDCEdgeStaticRoutePolicy(tenantName);
+        assertTrue(response);
     }
 
     @Test
-    public void testCreateTenantVDCEdgeDeviceRoute() {
-        try {
-            boolean response = connection.createTenantVDCEdgeStaticRoute(tenantName, "10.223.136.1", "0.0.0.0", "0.0.0.0");
-            assertTrue(response);
-        } catch (ExecutionException e) {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
-        }
+    public void testCreateTenantVDCEdgeDeviceRoute() throws ExecutionException {
+        boolean response = connection.createTenantVDCEdgeStaticRoute(tenantName, "10.223.136.1", "0.0.0.0", "0.0.0.0");
+        assertTrue(response);
     }
 
     @Test
-    public void testAssociateRoutePolicyWithEdgeProfile() {
-        try {
-            boolean response = connection.associateTenantVDCEdgeStaticRoutePolicy(tenantName);
-            assertTrue(response);
-        } catch (ExecutionException e) {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
-        }
+    public void testAssociateRoutePolicyWithEdgeProfile() throws ExecutionException {
+        boolean response = connection.associateTenantVDCEdgeStaticRoutePolicy(tenantName);
+        assertTrue(response);
     }
 
     @Test
-    public void testAssociateTenantVDCEdgeDhcpPolicy() {
-        try {
-            boolean response = connection.associateTenantVDCEdgeDhcpPolicy(tenantName, "Edge_Inside");
-            assertTrue(response);
-        } catch (ExecutionException e) {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
-        }
+    public void testAssociateTenantVDCEdgeDhcpPolicy() throws ExecutionException {
+        boolean response = connection.associateTenantVDCEdgeDhcpPolicy(tenantName, "Edge_Inside");
+        assertTrue(response);
     }
 
     @Test
-    public void testCreateTenantVDCEdgeDhcpPolicy() {
-        try {
-            boolean response = connection.createTenantVDCEdgeDhcpPolicy(tenantName, "10.1.1.2", "10.1.1.254", "255.255.255.0", "4.4.4.4", tenantName + ".net");
-            assertTrue(response);
-        } catch (ExecutionException e) {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
-        }
+    public void testCreateTenantVDCEdgeDhcpPolicy() throws ExecutionException {
+        boolean response = connection.createTenantVDCEdgeDhcpPolicy(tenantName, "10.1.1.2", "10.1.1.254", "255.255.255.0", "4.4.4.4", tenantName + ".net");
+        assertTrue(response);
     }
 
     @Test
-    public void testCreateTenantVDCEdgeSecurityProfile() {
-        try {
-            boolean response = connection.createTenantVDCEdgeSecurityProfile(tenantName);
-            assertTrue(response);
-        } catch (ExecutionException e) {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
-        }
+    public void testCreateTenantVDCEdgeSecurityProfile() throws ExecutionException {
+        boolean response = connection.createTenantVDCEdgeSecurityProfile(tenantName);
+        assertTrue(response);
     }
 
     @Test
-    public void testCreateTenantVDCSourceNatIpPool() {
-        try {
-            boolean response = connection.createTenantVDCSourceNatIpPool(tenantName, "1", "10.223.136.10");
-            assertTrue(response);
-        } catch (ExecutionException e) {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
-        }
+    public void testCreateTenantVDCSourceNatIpPool() throws ExecutionException {
+        boolean response = connection.createTenantVDCSourceNatIpPool(tenantName, "1", "10.223.136.10");
+        assertTrue(response);
     }
 
     @Test
-    public void testCreateTenantVDCSourceNatPolicy() {
-        try {
-            boolean response = connection.createTenantVDCSourceNatPolicy(tenantName, "1");
-            assertTrue(response);
-            response = connection.createTenantVDCSourceNatPolicyRef(tenantName, "1");
-            assertTrue(response);
-            response = connection.createTenantVDCSourceNatRule(tenantName, "1", "10.1.1.2", "10.1.1.254");
-            assertTrue(response);
-        } catch (ExecutionException e) {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
-        }
+    public void testCreateTenantVDCSourceNatPolicy() throws ExecutionException {
+        boolean response = connection.createTenantVDCSourceNatPolicy(tenantName, "1");
+        assertTrue(response);
+        response = connection.createTenantVDCSourceNatPolicyRef(tenantName, "1");
+        assertTrue(response);
+        response = connection.createTenantVDCSourceNatRule(tenantName, "1", "10.1.1.2", "10.1.1.254");
+        assertTrue(response);
     }
 
     @Test
-    public void testCreateTenantVDCNatPolicySet() {
-        try {
-            boolean response = connection.createTenantVDCNatPolicySet(tenantName);
-            assertTrue(response);
-        } catch (ExecutionException e) {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
-        }
+    public void testCreateTenantVDCNatPolicySet() throws ExecutionException {
+        boolean response = connection.createTenantVDCNatPolicySet(tenantName);
+        assertTrue(response);
     }
 
     @Test
-    public void testAssociateNatPolicySet() {
-        try {
-            boolean response = connection.associateNatPolicySet(tenantName);
-            assertTrue(response);
-        } catch (ExecutionException e) {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
-        }
+    public void testAssociateNatPolicySet() throws ExecutionException {
+        boolean response = connection.associateNatPolicySet(tenantName);
+        assertTrue(response);
     }
 
     @Test
-    public void testCreateEdgeFirewall() {
-        try {
-            boolean response = connection.createEdgeFirewall(tenantName, "44.44.44.44", "192.168.1.1", "255.255.255.0", "255.255.255.192");
-            assertTrue(response);
-        } catch (ExecutionException e) {
-            e.printStackTrace();
-        }
+    public void testCreateEdgeFirewall() throws ExecutionException {
+        boolean response = connection.createEdgeFirewall(tenantName, "44.44.44.44", "192.168.1.1", "255.255.255.0", "255.255.255.192");
+        assertTrue(response);
     }
 
     @Test
-    public void testListUnassocAsa1000v() {
-        try {
-            Map<String, String> response = connection.listUnAssocAsa1000v();
-            assertTrue(response.size() >= 0);
-            fwDns = response;
-        } catch (ExecutionException e) {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
-        }
+    public void testListUnassocAsa1000v() throws ExecutionException {
+        Map<String, String> response = connection.listUnAssocAsa1000v();
+        assertTrue(response.size() >= 0);
+        fwDns = response;
     }
 
     @Test
-    public void assocAsa1000v() {
-        try {
-            boolean result = connection.assignAsa1000v(tenantName, fwDns.get(0));
-            assertTrue(result);
-        } catch (ExecutionException e) {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
-        }
+    public void assocAsa1000v() throws ExecutionException {
+        boolean result = connection.assignAsa1000v(tenantName, fwDns.entrySet().iterator().next().getValue());
+        assertTrue(result);
     }
 }