cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From h...@apache.org
Subject git commit: updated refs/heads/master to 50be9a4
Date Mon, 30 Dec 2013 08:38:43 GMT
Updated Branches:
  refs/heads/master 4e8819745 -> 50be9a447


Apply proper license header and formatting to the new contrail tests #2


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

Branch: refs/heads/master
Commit: 50be9a447aa1391308313ec89d8758834c12a9f7
Parents: 4e88197
Author: Hugo Trippaers <htrippaers@schubergphilis.com>
Authored: Mon Dec 30 09:38:10 2013 +0100
Committer: Hugo Trippaers <htrippaers@schubergphilis.com>
Committed: Mon Dec 30 09:38:10 2013 +0100

----------------------------------------------------------------------
 .../contrail/model/VirtualMachineModelTest.java | 118 +++++++++----------
 .../contrail/model/VirtualNetworkModelTest.java |  47 ++------
 2 files changed, 70 insertions(+), 95 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/50be9a44/plugins/network-elements/juniper-contrail/test/org/apache/cloudstack/network/contrail/model/VirtualMachineModelTest.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/juniper-contrail/test/org/apache/cloudstack/network/contrail/model/VirtualMachineModelTest.java
b/plugins/network-elements/juniper-contrail/test/org/apache/cloudstack/network/contrail/model/VirtualMachineModelTest.java
index 7b0a263..f85beb6 100644
--- a/plugins/network-elements/juniper-contrail/test/org/apache/cloudstack/network/contrail/model/VirtualMachineModelTest.java
+++ b/plugins/network-elements/juniper-contrail/test/org/apache/cloudstack/network/contrail/model/VirtualMachineModelTest.java
@@ -1,48 +1,44 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
 package org.apache.cloudstack.network.contrail.model;
-import java.util.UUID;
+
+import static org.mockito.Matchers.anyLong;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
 
 import java.io.IOException;
+import java.util.UUID;
 
-import org.apache.cloudstack.network.contrail.management.*;
-import org.apache.cloudstack.network.contrail.model.*;
+import junit.framework.TestCase;
+import net.juniper.contrail.api.ApiConnector;
+import net.juniper.contrail.api.ApiConnectorMock;
 
 import org.apache.log4j.Logger;
-import org.junit.runner.RunWith;
+import org.junit.Test;
 
-import static org.mockito.Mockito.*;
+import org.apache.cloudstack.network.contrail.management.ContrailManagerImpl;
+import org.apache.cloudstack.network.contrail.management.ModelDatabase;
 
 import com.cloud.network.Network;
 import com.cloud.network.dao.NetworkVO;
 import com.cloud.vm.VMInstanceVO;
 import com.cloud.vm.VirtualMachine;
 import com.cloud.vm.dao.UserVmDao;
-import com.cloud.uservm.UserVm;
-
-import net.juniper.contrail.api.ApiConnectorMock;
-import net.juniper.contrail.api.ApiConnectorFactory;
-import net.juniper.contrail.api.ApiObjectBase;
-import net.juniper.contrail.api.types.Domain;
-import net.juniper.contrail.api.types.InstanceIp;
-import net.juniper.contrail.api.types.NetworkIpam;
-import net.juniper.contrail.api.types.SubnetType;
-import net.juniper.contrail.api.types.VirtualMachineInterface;
-import net.juniper.contrail.api.types.VirtualNetwork;
-import net.juniper.contrail.api.types.VnSubnetsType;
-import net.juniper.contrail.api.types.NetworkPolicy;
-import net.juniper.contrail.api.types.Project;
-import net.juniper.contrail.api.types.FloatingIp;
-import net.juniper.contrail.api.types.VnSubnetsType;
-import net.juniper.contrail.api.types.ServiceInstance;
-import net.juniper.contrail.api.ApiConnector;
-
-import org.junit.runner.RunWith;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.AfterClass;
-import org.junit.Ignore;
-import org.junit.Test;
-import junit.framework.TestCase;
 
 public class VirtualMachineModelTest extends TestCase {
     private static final Logger s_logger =
@@ -78,35 +74,35 @@ public class VirtualMachineModelTest extends TestCase {
     public void testCreateVirtualMachine() throws IOException {
 
         String uuid = UUID.randomUUID().toString();
-		ContrailManagerImpl contrailMgr = mock(ContrailManagerImpl.class);
-		ModelController controller      = mock(ModelController.class);
+        ContrailManagerImpl contrailMgr = mock(ContrailManagerImpl.class);
+        ModelController controller      = mock(ModelController.class);
         ApiConnector api = new ApiConnectorMock(null, 0);
-		when(controller.getManager()).thenReturn(contrailMgr);
-		when(controller.getApiAccessor()).thenReturn(api);
+        when(controller.getManager()).thenReturn(contrailMgr);
+        when(controller.getApiAccessor()).thenReturn(api);
 
-		// Create Virtual-Network (VN)
+        // Create Virtual-Network (VN)
         NetworkVO network = mock(NetworkVO.class);
-		when(network.getName()).thenReturn("testnetwork");
-		when(network.getState()).thenReturn(Network.State.Allocated);
-		when(network.getGateway()).thenReturn("10.1.1.1");
-		when(network.getCidr()).thenReturn("10.1.1.0/24");
-		when(network.getPhysicalNetworkId()).thenReturn(42L);
-		when(network.getDomainId()).thenReturn(10L);
-		when(network.getAccountId()).thenReturn(42L);
-
-		when(contrailMgr.getCanonicalName(network)).thenReturn("testnetwork");
-		when(contrailMgr.getProjectId(network.getDomainId(), network.getAccountId())).thenReturn("testProjectId");
-
-		// Create Virtual-Machine (VM)
+        when(network.getName()).thenReturn("testnetwork");
+        when(network.getState()).thenReturn(Network.State.Allocated);
+        when(network.getGateway()).thenReturn("10.1.1.1");
+        when(network.getCidr()).thenReturn("10.1.1.0/24");
+        when(network.getPhysicalNetworkId()).thenReturn(42L);
+        when(network.getDomainId()).thenReturn(10L);
+        when(network.getAccountId()).thenReturn(42L);
+
+        when(contrailMgr.getCanonicalName(network)).thenReturn("testnetwork");
+        when(contrailMgr.getProjectId(network.getDomainId(), network.getAccountId())).thenReturn("testProjectId");
+
+        // Create Virtual-Machine (VM)
         VMInstanceVO vm = mock(VMInstanceVO.class);
-		when(vm.getInstanceName()).thenReturn("testVM1");
-		when(vm.getState()).thenReturn(VirtualMachine.State.Starting);
-		when(vm.getDomainId()).thenReturn(10L);
-		when(vm.getAccountId()).thenReturn(42L);
+        when(vm.getInstanceName()).thenReturn("testVM1");
+        when(vm.getState()).thenReturn(VirtualMachine.State.Starting);
+        when(vm.getDomainId()).thenReturn(10L);
+        when(vm.getAccountId()).thenReturn(42L);
 
-		UserVmDao VmDao      = mock(UserVmDao.class);
-		when(VmDao.findById(anyLong())).thenReturn(null);
-		when(controller.getVmDao()).thenReturn(VmDao);
+        UserVmDao VmDao      = mock(UserVmDao.class);
+        when(VmDao.findById(anyLong())).thenReturn(null);
+        when(controller.getVmDao()).thenReturn(VmDao);
 
         VirtualMachineModel vmModel = new VirtualMachineModel(vm, uuid);
 
@@ -114,13 +110,13 @@ public class VirtualMachineModelTest extends TestCase {
         assertEquals(vmModel.getUuid(), uuid);
 
         vmModel.build(controller, vm);
-		try {
+        try {
             vmModel.update(controller);
-		} catch (Exception ex) {
-			fail("virtual-network update failed ");
-		}
+        } catch (Exception ex) {
+            fail("virtual-network update failed ");
+        }
 
-		//verify
+        //verify
         assertTrue(vmModel.verify(controller));
 
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/50be9a44/plugins/network-elements/juniper-contrail/test/org/apache/cloudstack/network/contrail/model/VirtualNetworkModelTest.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/juniper-contrail/test/org/apache/cloudstack/network/contrail/model/VirtualNetworkModelTest.java
b/plugins/network-elements/juniper-contrail/test/org/apache/cloudstack/network/contrail/model/VirtualNetworkModelTest.java
index 16949a4..b1b5ae1 100644
--- a/plugins/network-elements/juniper-contrail/test/org/apache/cloudstack/network/contrail/model/VirtualNetworkModelTest.java
+++ b/plugins/network-elements/juniper-contrail/test/org/apache/cloudstack/network/contrail/model/VirtualNetworkModelTest.java
@@ -17,47 +17,26 @@
 
 package org.apache.cloudstack.network.contrail.model;
 
-import java.util.UUID;
-
-import junit.framework.TestCase;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
 
-import javax.inject.Inject;
 import java.io.IOException;
+import java.util.UUID;
 
-import org.apache.cloudstack.network.contrail.management.*;
-import org.apache.log4j.Logger;
-
-import net.juniper.contrail.api.ApiConnectorMock;
-import net.juniper.contrail.api.ApiConnectorFactory;
-import net.juniper.contrail.api.ApiObjectBase;
-import net.juniper.contrail.api.types.Domain;
-import net.juniper.contrail.api.types.InstanceIp;
-import net.juniper.contrail.api.types.NetworkIpam;
-import net.juniper.contrail.api.types.SubnetType;
-import net.juniper.contrail.api.types.VirtualMachine;
-import net.juniper.contrail.api.types.VirtualMachineInterface;
-import net.juniper.contrail.api.types.VirtualNetwork;
-import net.juniper.contrail.api.types.VnSubnetsType;
-import net.juniper.contrail.api.types.NetworkPolicy;
-import net.juniper.contrail.api.types.Project;
-import net.juniper.contrail.api.types.FloatingIp;
-import net.juniper.contrail.api.types.VnSubnetsType;
-import net.juniper.contrail.api.types.ServiceInstance;
+import junit.framework.TestCase;
 import net.juniper.contrail.api.ApiConnector;
+import net.juniper.contrail.api.ApiConnectorMock;
 
-import org.junit.runner.RunWith;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.AfterClass;
-import org.junit.Ignore;
+import org.apache.log4j.Logger;
 import org.junit.Test;
 
-import static org.mockito.Mockito.*;
-import com.cloud.network.Networks.TrafficType;
+import org.apache.cloudstack.network.contrail.management.ContrailManager;
+import org.apache.cloudstack.network.contrail.management.ContrailManagerImpl;
+import org.apache.cloudstack.network.contrail.management.ModelDatabase;
+
 import com.cloud.network.Network.State;
+import com.cloud.network.Networks.TrafficType;
 import com.cloud.network.dao.NetworkVO;
-import com.cloud.utils.component.ComponentContext;
 
 public class VirtualNetworkModelTest extends TestCase {
     private static final Logger s_logger = Logger.getLogger(VirtualNetworkModelTest.class);
@@ -89,7 +68,7 @@ public class VirtualNetworkModelTest extends TestCase {
         String uuid = UUID.randomUUID().toString();
         ContrailManagerImpl contrailMgr = mock(ContrailManagerImpl.class);
         ModelController controller      = mock(ModelController.class);
-        ApiConnector api 				= new ApiConnectorMock(null, 0);
+        ApiConnector api = new ApiConnectorMock(null, 0);
         when(controller.getManager()).thenReturn(contrailMgr);
         when(controller.getApiAccessor()).thenReturn(api);
 
@@ -118,6 +97,6 @@ public class VirtualNetworkModelTest extends TestCase {
             fail("virtual-network update failed ");
         }
         assertTrue(vnModel.verify(controller));
-}
+    }
 
 }


Mime
View raw message