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:22 UTC

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

Fix checkstyle and license issues


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

Branch: refs/heads/master
Commit: 97bad4f9b39702a780d8f1ab757817f23b0cf0b8
Parents: 15fa2ef
Author: Hugo Trippaers <ht...@schubergphilis.com>
Authored: Fri Feb 14 16:54:36 2014 +0100
Committer: Hugo Trippaers <ht...@schubergphilis.com>
Committed: Fri Feb 14 18:37:47 2014 +0100

----------------------------------------------------------------------
 .../com/cloud/vm/VirtualMachineManagerImpl.java |  7 ++---
 .../db/test/com/cloud/utils/db/GroupByTest.java | 21 ++++++++++++++-
 .../xen/resource/CitrixResourceBase.java        | 28 +++++++++-----------
 .../xen/resource/CitrixResourceBaseTest.java    | 26 +++++++++---------
 .../cloud/template/TemplateManagerImplTest.java | 18 +++++++++++++
 .../src/test/java/streamer/ByteBufferTest.java  |  2 ++
 .../consoleproxy/ConsoleProxyRdpClientTest.java | 17 ++++++++++++
 utils/test/com/cloud/utils/UuidUtilsTest.java   | 17 ++++++++++++
 8 files changed, 102 insertions(+), 34 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/97bad4f9/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
----------------------------------------------------------------------
diff --git a/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java b/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
index 9513bd7..888c750 100755
--- a/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
+++ b/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
@@ -40,6 +40,8 @@ import javax.ejb.Local;
 import javax.inject.Inject;
 import javax.naming.ConfigurationException;
 
+import org.apache.log4j.Logger;
+
 import org.apache.cloudstack.affinity.dao.AffinityGroupVMMapDao;
 import org.apache.cloudstack.context.CallContext;
 import org.apache.cloudstack.engine.orchestration.service.NetworkOrchestrationService;
@@ -67,7 +69,6 @@ import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
 import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
 import org.apache.cloudstack.storage.to.VolumeObjectTO;
 import org.apache.cloudstack.utils.identity.ManagementServerNode;
-import org.apache.log4j.Logger;
 
 import com.cloud.agent.AgentManager;
 import com.cloud.agent.Listener;
@@ -938,8 +939,8 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
                 //storing the value of overcommit in the vm_details table for doing a capacity check in case the cluster overcommit ratio is changed.
                 if (_uservmDetailsDao.findDetail(vm.getId(), "cpuOvercommitRatio") == null &&
                         ((Float.parseFloat(cluster_detail_cpu.getValue()) > 1f || Float.parseFloat(cluster_detail_ram.getValue()) > 1f))) {
-                    _uservmDetailsDao.addDetail(vm.getId(), "cpuOvercommitRatio", cluster_detail_cpu.getValue());
-                    _uservmDetailsDao.addDetail(vm.getId(), "memoryOvercommitRatio", cluster_detail_ram.getValue());
+                    _uservmDetailsDao.addDetail(vm.getId(), "cpuOvercommitRatio", cluster_detail_cpu.getValue(), true);
+                    _uservmDetailsDao.addDetail(vm.getId(), "memoryOvercommitRatio", cluster_detail_ram.getValue(), true);
                 } else if (_uservmDetailsDao.findDetail(vm.getId(), "cpuOvercommitRatio") != null) {
                     _uservmDetailsDao.addDetail(vm.getId(), "cpuOvercommitRatio", cluster_detail_cpu.getValue(), true);
                     _uservmDetailsDao.addDetail(vm.getId(), "memoryOvercommitRatio", cluster_detail_ram.getValue(), true);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/97bad4f9/framework/db/test/com/cloud/utils/db/GroupByTest.java
----------------------------------------------------------------------
diff --git a/framework/db/test/com/cloud/utils/db/GroupByTest.java b/framework/db/test/com/cloud/utils/db/GroupByTest.java
index e0087ea..d394c73 100644
--- a/framework/db/test/com/cloud/utils/db/GroupByTest.java
+++ b/framework/db/test/com/cloud/utils/db/GroupByTest.java
@@ -1,9 +1,28 @@
+// 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 com.cloud.utils.db;
 
+import static org.junit.Assert.assertTrue;
+
 import java.util.ArrayList;
 
 import org.junit.Test;
-import static org.junit.Assert.assertTrue;
 
 import com.cloud.utils.Pair;
 import com.cloud.utils.db.SearchCriteria.Func;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/97bad4f9/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
index 788e70d..2cabc58 100644
--- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
+++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
@@ -1956,7 +1956,6 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
 
     protected ExecutionResult prepareNetworkElementCommand(IpAssocCommand cmd) {
         Connection conn = getConnection();
-        int i = 0;
         String routerName = cmd.getAccessDetail(NetworkElementCommand.ROUTER_NAME);
         String routerIp = cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP);
 
@@ -2029,8 +2028,6 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
 
     protected ExecutionResult cleanupNetworkElementCommand(IpAssocCommand cmd) {
         Connection conn = getConnection();
-        String[] results = new String[cmd.getIpAddresses().length];
-        int i = 0;
         String routerName = cmd.getAccessDetail(NetworkElementCommand.ROUTER_NAME);
         String routerIp = cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP);
         try {
@@ -7307,19 +7304,18 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
         return new ExecutionResult(true, null);
     }
 
-	protected void setNicDevIdIfCorrectVifIsNotNull(Connection conn,
-			IpAddressTO ip, VIF correctVif) throws InternalErrorException,
-			BadServerResponse, XenAPIException, XmlRpcException {
-		if (correctVif == null) {
-		    if (ip.isAdd()) {
-		        throw new InternalErrorException("Failed to find DomR VIF to associate IP with.");
-		    } else {
-		        s_logger.debug("VIF to deassociate IP with does not exist, return success");
-		    }
-		} else {
-         ip.setNicDevId(Integer.valueOf(correctVif.getDevice(conn)));
-		}
-	}
+    protected void setNicDevIdIfCorrectVifIsNotNull(Connection conn, IpAddressTO ip, VIF correctVif) throws InternalErrorException, BadServerResponse, XenAPIException,
+    XmlRpcException {
+        if (correctVif == null) {
+            if (ip.isAdd()) {
+                throw new InternalErrorException("Failed to find DomR VIF to associate IP with.");
+            } else {
+                s_logger.debug("VIF to deassociate IP with does not exist, return success");
+            }
+        } else {
+            ip.setNicDevId(Integer.valueOf(correctVif.getDevice(conn)));
+        }
+    }
 
     protected ExecutionResult prepareNetworkElementCommand(SetSourceNatCommand cmd) {
         Connection conn = getConnection();

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/97bad4f9/plugins/hypervisors/xen/test/com/cloud/hypervisor/xen/resource/CitrixResourceBaseTest.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xen/test/com/cloud/hypervisor/xen/resource/CitrixResourceBaseTest.java b/plugins/hypervisors/xen/test/com/cloud/hypervisor/xen/resource/CitrixResourceBaseTest.java
index b54a21c..0920c7f 100644
--- a/plugins/hypervisors/xen/test/com/cloud/hypervisor/xen/resource/CitrixResourceBaseTest.java
+++ b/plugins/hypervisors/xen/test/com/cloud/hypervisor/xen/resource/CitrixResourceBaseTest.java
@@ -26,7 +26,6 @@ import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.times;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
-import static org.mockito.Matchers.any;
 
 import java.util.HashMap;
 import java.util.Iterator;
@@ -46,6 +45,7 @@ import com.xensource.xenapi.Types;
 import com.xensource.xenapi.VIF;
 import com.xensource.xenapi.VM;
 import com.xensource.xenapi.XenAPIObject;
+
 import com.cloud.agent.api.ScaleVmAnswer;
 import com.cloud.agent.api.ScaleVmCommand;
 import com.cloud.agent.api.to.IpAddressTO;
@@ -176,17 +176,15 @@ public class CitrixResourceBaseTest {
     }
 
 
-	@Test
-	public void testSetNicDevIdIfCorrectVifIsNotNull() throws Exception {
-		IpAddressTO ip = mock (IpAddressTO.class);
-		when (ip.isAdd()).thenReturn(false);
-		VIF correctVif = null;
-		try {
-			_resource.setNicDevIdIfCorrectVifIsNotNull(conn, ip, correctVif);
-		} 
-		catch (NullPointerException e)
-		{
-			fail("this test is meant to show that null pointer is not thrown");
-		}
-	}
+    @Test
+    public void testSetNicDevIdIfCorrectVifIsNotNull() throws Exception {
+        IpAddressTO ip = mock(IpAddressTO.class);
+        when(ip.isAdd()).thenReturn(false);
+        VIF correctVif = null;
+        try {
+            _resource.setNicDevIdIfCorrectVifIsNotNull(conn, ip, correctVif);
+        } catch (NullPointerException e) {
+            fail("this test is meant to show that null pointer is not thrown");
+        }
+    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/97bad4f9/server/test/com/cloud/template/TemplateManagerImplTest.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/template/TemplateManagerImplTest.java b/server/test/com/cloud/template/TemplateManagerImplTest.java
index 3788393..bcbc323 100644
--- a/server/test/com/cloud/template/TemplateManagerImplTest.java
+++ b/server/test/com/cloud/template/TemplateManagerImplTest.java
@@ -1,3 +1,21 @@
+// 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 com.cloud.template;
 
 import org.junit.Test;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/97bad4f9/services/console-proxy-rdp/rdpconsole/src/test/java/streamer/ByteBufferTest.java
----------------------------------------------------------------------
diff --git a/services/console-proxy-rdp/rdpconsole/src/test/java/streamer/ByteBufferTest.java b/services/console-proxy-rdp/rdpconsole/src/test/java/streamer/ByteBufferTest.java
index 8dbeba2..6bcfed9 100644
--- a/services/console-proxy-rdp/rdpconsole/src/test/java/streamer/ByteBufferTest.java
+++ b/services/console-proxy-rdp/rdpconsole/src/test/java/streamer/ByteBufferTest.java
@@ -17,6 +17,8 @@
 package streamer;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
 
 import java.util.ArrayList;
 import java.util.Collection;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/97bad4f9/services/console-proxy/server/test/com/cloud/consoleproxy/ConsoleProxyRdpClientTest.java
----------------------------------------------------------------------
diff --git a/services/console-proxy/server/test/com/cloud/consoleproxy/ConsoleProxyRdpClientTest.java b/services/console-proxy/server/test/com/cloud/consoleproxy/ConsoleProxyRdpClientTest.java
index 038f438..80bf5bc 100644
--- a/services/console-proxy/server/test/com/cloud/consoleproxy/ConsoleProxyRdpClientTest.java
+++ b/services/console-proxy/server/test/com/cloud/consoleproxy/ConsoleProxyRdpClientTest.java
@@ -1,3 +1,20 @@
+// 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 com.cloud.consoleproxy;
 
 import junit.framework.Assert;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/97bad4f9/utils/test/com/cloud/utils/UuidUtilsTest.java
----------------------------------------------------------------------
diff --git a/utils/test/com/cloud/utils/UuidUtilsTest.java b/utils/test/com/cloud/utils/UuidUtilsTest.java
index 299e247..a39eae7 100644
--- a/utils/test/com/cloud/utils/UuidUtilsTest.java
+++ b/utils/test/com/cloud/utils/UuidUtilsTest.java
@@ -1,3 +1,20 @@
+// 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 com.cloud.utils;
 
 import static org.junit.Assert.assertFalse;