Skip to content

Commit 97bad4f

Browse files
committed
Fix checkstyle and license issues
1 parent 15fa2ef commit 97bad4f

8 files changed

Lines changed: 102 additions & 34 deletions

File tree

engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@
4040
import javax.inject.Inject;
4141
import javax.naming.ConfigurationException;
4242

43+
import org.apache.log4j.Logger;
44+
4345
import org.apache.cloudstack.affinity.dao.AffinityGroupVMMapDao;
4446
import org.apache.cloudstack.context.CallContext;
4547
import org.apache.cloudstack.engine.orchestration.service.NetworkOrchestrationService;
@@ -67,7 +69,6 @@
6769
import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
6870
import org.apache.cloudstack.storage.to.VolumeObjectTO;
6971
import org.apache.cloudstack.utils.identity.ManagementServerNode;
70-
import org.apache.log4j.Logger;
7172

7273
import com.cloud.agent.AgentManager;
7374
import com.cloud.agent.Listener;
@@ -938,8 +939,8 @@ public void orchestrateStart(String vmUuid, Map<VirtualMachineProfile.Param, Obj
938939
//storing the value of overcommit in the vm_details table for doing a capacity check in case the cluster overcommit ratio is changed.
939940
if (_uservmDetailsDao.findDetail(vm.getId(), "cpuOvercommitRatio") == null &&
940941
((Float.parseFloat(cluster_detail_cpu.getValue()) > 1f || Float.parseFloat(cluster_detail_ram.getValue()) > 1f))) {
941-
_uservmDetailsDao.addDetail(vm.getId(), "cpuOvercommitRatio", cluster_detail_cpu.getValue());
942-
_uservmDetailsDao.addDetail(vm.getId(), "memoryOvercommitRatio", cluster_detail_ram.getValue());
942+
_uservmDetailsDao.addDetail(vm.getId(), "cpuOvercommitRatio", cluster_detail_cpu.getValue(), true);
943+
_uservmDetailsDao.addDetail(vm.getId(), "memoryOvercommitRatio", cluster_detail_ram.getValue(), true);
943944
} else if (_uservmDetailsDao.findDetail(vm.getId(), "cpuOvercommitRatio") != null) {
944945
_uservmDetailsDao.addDetail(vm.getId(), "cpuOvercommitRatio", cluster_detail_cpu.getValue(), true);
945946
_uservmDetailsDao.addDetail(vm.getId(), "memoryOvercommitRatio", cluster_detail_ram.getValue(), true);

framework/db/test/com/cloud/utils/db/GroupByTest.java

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,28 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
//
18+
119
package com.cloud.utils.db;
220

21+
import static org.junit.Assert.assertTrue;
22+
323
import java.util.ArrayList;
424

525
import org.junit.Test;
6-
import static org.junit.Assert.assertTrue;
726

827
import com.cloud.utils.Pair;
928
import com.cloud.utils.db.SearchCriteria.Func;

plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1956,7 +1956,6 @@ protected String networkUsage(Connection conn, final String privateIpAddress, fi
19561956

19571957
protected ExecutionResult prepareNetworkElementCommand(IpAssocCommand cmd) {
19581958
Connection conn = getConnection();
1959-
int i = 0;
19601959
String routerName = cmd.getAccessDetail(NetworkElementCommand.ROUTER_NAME);
19611960
String routerIp = cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP);
19621961

@@ -2029,8 +2028,6 @@ protected ExecutionResult prepareNetworkElementCommand(IpAssocCommand cmd) {
20292028

20302029
protected ExecutionResult cleanupNetworkElementCommand(IpAssocCommand cmd) {
20312030
Connection conn = getConnection();
2032-
String[] results = new String[cmd.getIpAddresses().length];
2033-
int i = 0;
20342031
String routerName = cmd.getAccessDetail(NetworkElementCommand.ROUTER_NAME);
20352032
String routerIp = cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP);
20362033
try {
@@ -7307,19 +7304,18 @@ protected ExecutionResult prepareNetworkElementCommand(IpAssocVpcCommand cmd) {
73077304
return new ExecutionResult(true, null);
73087305
}
73097306

7310-
protected void setNicDevIdIfCorrectVifIsNotNull(Connection conn,
7311-
IpAddressTO ip, VIF correctVif) throws InternalErrorException,
7312-
BadServerResponse, XenAPIException, XmlRpcException {
7313-
if (correctVif == null) {
7314-
if (ip.isAdd()) {
7315-
throw new InternalErrorException("Failed to find DomR VIF to associate IP with.");
7316-
} else {
7317-
s_logger.debug("VIF to deassociate IP with does not exist, return success");
7318-
}
7319-
} else {
7320-
ip.setNicDevId(Integer.valueOf(correctVif.getDevice(conn)));
7321-
}
7322-
}
7307+
protected void setNicDevIdIfCorrectVifIsNotNull(Connection conn, IpAddressTO ip, VIF correctVif) throws InternalErrorException, BadServerResponse, XenAPIException,
7308+
XmlRpcException {
7309+
if (correctVif == null) {
7310+
if (ip.isAdd()) {
7311+
throw new InternalErrorException("Failed to find DomR VIF to associate IP with.");
7312+
} else {
7313+
s_logger.debug("VIF to deassociate IP with does not exist, return success");
7314+
}
7315+
} else {
7316+
ip.setNicDevId(Integer.valueOf(correctVif.getDevice(conn)));
7317+
}
7318+
}
73237319

73247320
protected ExecutionResult prepareNetworkElementCommand(SetSourceNatCommand cmd) {
73257321
Connection conn = getConnection();

plugins/hypervisors/xen/test/com/cloud/hypervisor/xen/resource/CitrixResourceBaseTest.java

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
import static org.mockito.Mockito.times;
2727
import static org.mockito.Mockito.verify;
2828
import static org.mockito.Mockito.when;
29-
import static org.mockito.Matchers.any;
3029

3130
import java.util.HashMap;
3231
import java.util.Iterator;
@@ -46,6 +45,7 @@
4645
import com.xensource.xenapi.VIF;
4746
import com.xensource.xenapi.VM;
4847
import com.xensource.xenapi.XenAPIObject;
48+
4949
import com.cloud.agent.api.ScaleVmAnswer;
5050
import com.cloud.agent.api.ScaleVmCommand;
5151
import com.cloud.agent.api.to.IpAddressTO;
@@ -176,17 +176,15 @@ public void testScaleVMF3() throws Types.XenAPIException, XmlRpcException {
176176
}
177177

178178

179-
@Test
180-
public void testSetNicDevIdIfCorrectVifIsNotNull() throws Exception {
181-
IpAddressTO ip = mock (IpAddressTO.class);
182-
when (ip.isAdd()).thenReturn(false);
183-
VIF correctVif = null;
184-
try {
185-
_resource.setNicDevIdIfCorrectVifIsNotNull(conn, ip, correctVif);
186-
}
187-
catch (NullPointerException e)
188-
{
189-
fail("this test is meant to show that null pointer is not thrown");
190-
}
191-
}
179+
@Test
180+
public void testSetNicDevIdIfCorrectVifIsNotNull() throws Exception {
181+
IpAddressTO ip = mock(IpAddressTO.class);
182+
when(ip.isAdd()).thenReturn(false);
183+
VIF correctVif = null;
184+
try {
185+
_resource.setNicDevIdIfCorrectVifIsNotNull(conn, ip, correctVif);
186+
} catch (NullPointerException e) {
187+
fail("this test is meant to show that null pointer is not thrown");
188+
}
189+
}
192190
}

server/test/com/cloud/template/TemplateManagerImplTest.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
//
18+
119
package com.cloud.template;
220

321
import org.junit.Test;

services/console-proxy-rdp/rdpconsole/src/test/java/streamer/ByteBufferTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
package streamer;
1818

1919
import static org.junit.Assert.assertEquals;
20+
import static org.junit.Assert.assertFalse;
21+
import static org.junit.Assert.assertNotNull;
2022

2123
import java.util.ArrayList;
2224
import java.util.Collection;

services/console-proxy/server/test/com/cloud/consoleproxy/ConsoleProxyRdpClientTest.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
//
118
package com.cloud.consoleproxy;
219

320
import junit.framework.Assert;

utils/test/com/cloud/utils/UuidUtilsTest.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
//
118
package com.cloud.utils;
219

320
import static org.junit.Assert.assertFalse;

0 commit comments

Comments
 (0)