cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ahu...@apache.org
Subject [21/48] All Checkstyle problems corrected
Date Thu, 12 Dec 2013 21:01:21 GMT
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/be5e5cc6/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/SnapshotTestWithFakeData.java
----------------------------------------------------------------------
diff --git a/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/SnapshotTestWithFakeData.java b/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/SnapshotTestWithFakeData.java
index 88fd54d..fcac783 100644
--- a/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/SnapshotTestWithFakeData.java
+++ b/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/SnapshotTestWithFakeData.java
@@ -43,7 +43,6 @@ import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.Matchers;
-import org.mockito.Mockito;
 import org.springframework.test.context.ContextConfiguration;
 import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
 
@@ -208,7 +207,7 @@ public class SnapshotTestWithFakeData {
         Snapshot.Type snapshotType = Snapshot.Type.RECURRING;
         SnapshotVO snapshotVO =
             new SnapshotVO(dcId, 2, 1, 1L, 1L, UUID.randomUUID().toString(), (short)snapshotType.ordinal(), snapshotType.name(), 100, Hypervisor.HypervisorType.XenServer);
-        return this.snapshotDao.persist(snapshotVO);
+        return snapshotDao.persist(snapshotVO);
     }
 
     private SnapshotVO createSnapshotInDb(Long volumeId) {
@@ -216,7 +215,7 @@ public class SnapshotTestWithFakeData {
         SnapshotVO snapshotVO =
             new SnapshotVO(dcId, 2, 1, volumeId, 1L, UUID.randomUUID().toString(), (short)snapshotType.ordinal(), snapshotType.name(), 100,
                 Hypervisor.HypervisorType.XenServer);
-        return this.snapshotDao.persist(snapshotVO);
+        return snapshotDao.persist(snapshotVO);
     }
 
     private VolumeInfo createVolume(Long templateId, DataStore store) {
@@ -246,8 +245,8 @@ public class SnapshotTestWithFakeData {
         pool.setPodId(podId);
         pool.setScope(ScopeType.CLUSTER);
         pool.setStorageProviderName(DataStoreProvider.DEFAULT_PRIMARY);
-        pool = this.primaryDataStoreDao.persist(pool);
-        DataStore store = this.dataStoreManager.getPrimaryDataStore(pool.getId());
+        pool = primaryDataStoreDao.persist(pool);
+        DataStore store = dataStoreManager.getPrimaryDataStore(pool.getId());
         return store;
     }
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/be5e5cc6/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/VolumeServiceTest.java
----------------------------------------------------------------------
diff --git a/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/VolumeServiceTest.java b/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/VolumeServiceTest.java
new file mode 100644
index 0000000..2f5b18b
--- /dev/null
+++ b/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/VolumeServiceTest.java
@@ -0,0 +1,470 @@
+/*
+ * 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.storage.test;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+import java.util.concurrent.ExecutionException;
+
+import javax.inject.Inject;
+
+import org.mockito.Matchers;
+import org.mockito.Mockito;
+import org.springframework.test.context.ContextConfiguration;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+import org.apache.cloudstack.engine.subsystem.api.storage.ClusterScope;
+import org.apache.cloudstack.engine.subsystem.api.storage.DataObject;
+import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
+import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreLifeCycle;
+import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreProvider;
+import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreProviderManager;
+import org.apache.cloudstack.engine.subsystem.api.storage.EndPoint;
+import org.apache.cloudstack.engine.subsystem.api.storage.EndPointSelector;
+import org.apache.cloudstack.engine.subsystem.api.storage.TemplateDataFactory;
+import org.apache.cloudstack.engine.subsystem.api.storage.TemplateInfo;
+import org.apache.cloudstack.engine.subsystem.api.storage.TemplateService;
+import org.apache.cloudstack.engine.subsystem.api.storage.VolumeDataFactory;
+import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo;
+import org.apache.cloudstack.engine.subsystem.api.storage.VolumeService;
+import org.apache.cloudstack.engine.subsystem.api.storage.VolumeService.VolumeApiResult;
+import org.apache.cloudstack.framework.async.AsyncCallFuture;
+import org.apache.cloudstack.storage.RemoteHostEndPoint;
+import org.apache.cloudstack.storage.datastore.db.ImageStoreDao;
+import org.apache.cloudstack.storage.datastore.db.ImageStoreVO;
+import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
+import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
+
+import com.cloud.agent.AgentManager;
+import com.cloud.dc.ClusterVO;
+import com.cloud.dc.DataCenter.NetworkType;
+import com.cloud.dc.DataCenterVO;
+import com.cloud.dc.HostPodVO;
+import com.cloud.dc.dao.ClusterDao;
+import com.cloud.dc.dao.DataCenterDao;
+import com.cloud.dc.dao.HostPodDao;
+import com.cloud.host.Host;
+import com.cloud.host.HostVO;
+import com.cloud.host.dao.HostDao;
+import com.cloud.hypervisor.Hypervisor.HypervisorType;
+import com.cloud.org.Cluster.ClusterType;
+import com.cloud.org.Managed.ManagedState;
+import com.cloud.resource.ResourceState;
+import com.cloud.storage.DataStoreRole;
+import com.cloud.storage.ScopeType;
+import com.cloud.storage.Storage;
+import com.cloud.storage.Storage.StoragePoolType;
+import com.cloud.storage.Storage.TemplateType;
+import com.cloud.storage.VMTemplateVO;
+import com.cloud.storage.Volume;
+import com.cloud.storage.VolumeVO;
+import com.cloud.storage.dao.VMTemplateDao;
+import com.cloud.storage.dao.VolumeDao;
+import com.cloud.utils.component.ComponentContext;
+
+@ContextConfiguration(locations = {"classpath:/storageContext.xml"})
+public class VolumeServiceTest extends CloudStackTestNGBase {
+    // @Inject
+    // ImageDataStoreProviderManager imageProviderMgr;
+    @Inject
+    TemplateService imageService;
+    @Inject
+    VolumeService volumeService;
+    @Inject
+    VMTemplateDao imageDataDao;
+    @Inject
+    VolumeDao volumeDao;
+    @Inject
+    HostDao hostDao;
+    @Inject
+    HostPodDao podDao;
+    @Inject
+    ClusterDao clusterDao;
+    @Inject
+    DataCenterDao dcDao;
+    @Inject
+    PrimaryDataStoreDao primaryStoreDao;
+    @Inject
+    DataStoreProviderManager dataStoreProviderMgr;
+    @Inject
+    AgentManager agentMgr;
+    @Inject
+    EndPointSelector selector;
+    @Inject
+    TemplateDataFactory imageDataFactory;
+    @Inject
+    VolumeDataFactory volumeFactory;
+    @Inject
+    ImageStoreDao imageStoreDao;
+    ImageStoreVO imageStore;
+    Long dcId;
+    Long clusterId;
+    Long podId;
+    HostVO host;
+    String primaryName = "my primary data store";
+    DataStore primaryStore;
+
+    @Test(priority = -1)
+    public void setUp() {
+        ComponentContext.initComponentsLifeCycle();
+
+        host = hostDao.findByGuid(this.getHostGuid());
+        if (host != null) {
+            dcId = host.getDataCenterId();
+            clusterId = host.getClusterId();
+            podId = host.getPodId();
+            return;
+        }
+        // create data center
+        DataCenterVO dc =
+            new DataCenterVO(UUID.randomUUID().toString(), "test", "8.8.8.8", null, "10.0.0.1", null, "10.0.0.1/24", null, null, NetworkType.Basic, null, null, true,
+                true, null, null);
+        dc = dcDao.persist(dc);
+        dcId = dc.getId();
+        // create pod
+
+        HostPodVO pod = new HostPodVO(UUID.randomUUID().toString(), dc.getId(), this.getHostGateway(), this.getHostCidr(), 8, "test");
+        pod = podDao.persist(pod);
+        podId = pod.getId();
+        // create xen cluster
+        ClusterVO cluster = new ClusterVO(dc.getId(), pod.getId(), "devcloud cluster");
+        cluster.setHypervisorType(HypervisorType.XenServer.toString());
+        cluster.setClusterType(ClusterType.CloudManaged);
+        cluster.setManagedState(ManagedState.Managed);
+        cluster = clusterDao.persist(cluster);
+        clusterId = cluster.getId();
+        // create xen host
+
+        host = new HostVO(this.getHostGuid());
+        host.setName("devcloud xen host");
+        host.setType(Host.Type.Routing);
+        host.setPrivateIpAddress(this.getHostIp());
+        host.setDataCenterId(dc.getId());
+        host.setVersion("6.0.1");
+        host.setAvailable(true);
+        host.setSetup(true);
+        host.setPodId(podId);
+        host.setLastPinged(0);
+        host.setResourceState(ResourceState.Enabled);
+        host.setHypervisorType(HypervisorType.XenServer);
+        host.setClusterId(cluster.getId());
+
+        host = hostDao.persist(host);
+
+        imageStore = new ImageStoreVO();
+        imageStore.setName("test");
+        imageStore.setDataCenterId(dcId);
+        imageStore.setProviderName("CloudStack ImageStore Provider");
+        imageStore.setRole(DataStoreRole.Image);
+        imageStore.setUrl(this.getSecondaryStorage());
+        imageStore.setUuid(UUID.randomUUID().toString());
+        imageStore = imageStoreDao.persist(imageStore);
+
+    }
+
+    @Override
+    protected void injectMockito() {
+        if (host == null) {
+            return;
+        }
+        List<HostVO> results = new ArrayList<HostVO>();
+        results.add(host);
+        Mockito.when(hostDao.listAll()).thenReturn(results);
+        Mockito.when(hostDao.findById(Matchers.anyLong())).thenReturn(host);
+        Mockito.when(hostDao.findHypervisorHostInCluster(Matchers.anyLong())).thenReturn(results);
+        List<EndPoint> eps = new ArrayList<EndPoint>();
+        eps.add(RemoteHostEndPoint.getHypervisorHostEndPoint(host.getId(), host.getPrivateIpAddress(), host.getPublicIpAddress()));
+        Mockito.when(selector.selectAll(Matchers.any(DataStore.class))).thenReturn(eps);
+        Mockito.when(selector.select(Matchers.any(DataObject.class))).thenReturn(eps.get(0));
+        Mockito.when(selector.select(Matchers.any(DataObject.class), Matchers.any(DataObject.class))).thenReturn(eps.get(0));
+    }
+
+    private VMTemplateVO createImageData() {
+        VMTemplateVO image = new VMTemplateVO();
+        image.setTemplateType(TemplateType.USER);
+        image.setUrl(this.getTemplateUrl());
+        image.setUniqueName(UUID.randomUUID().toString());
+        image.setName(UUID.randomUUID().toString());
+        image.setPublicTemplate(true);
+        image.setFeatured(true);
+        image.setRequiresHvm(true);
+        image.setBits(64);
+        image.setFormat(Storage.ImageFormat.VHD);
+        image.setEnablePassword(true);
+        image.setEnableSshKey(true);
+        image.setGuestOSId(1);
+        image.setBootable(true);
+        image.setPrepopulate(true);
+        image.setCrossZones(true);
+        image.setExtractable(true);
+
+        // image.setImageDataStoreId(storeId);
+        image = imageDataDao.persist(image);
+
+        return image;
+    }
+
+    private TemplateInfo createTemplate() {
+        try {
+            DataStore store = createImageStore();
+            VMTemplateVO image = createImageData();
+            TemplateInfo template = imageDataFactory.getTemplate(image.getId(), store);
+            // AsyncCallFuture<TemplateApiResult> future =
+            // imageService.createTemplateAsync(template, store);
+            // future.get();
+            template = imageDataFactory.getTemplate(image.getId(), store);
+            /*
+             * imageProviderMgr.configure("image Provider", new HashMap<String,
+             * Object>()); VMTemplateVO image = createImageData();
+             * ImageDataStoreProvider defaultProvider =
+             * imageProviderMgr.getProvider("DefaultProvider");
+             * ImageDataStoreLifeCycle lifeCycle =
+             * defaultProvider.getLifeCycle(); ImageDataStore store =
+             * lifeCycle.registerDataStore("defaultHttpStore", new
+             * HashMap<String, String>());
+             * imageService.registerTemplate(image.getId(),
+             * store.getImageDataStoreId()); TemplateEntity te =
+             * imageService.getTemplateEntity(image.getId()); return te;
+             */
+            return template;
+        } catch (Exception e) {
+            Assert.fail("failed", e);
+            return null;
+        }
+    }
+
+    // @Test
+    public void createTemplateTest() {
+        createTemplate();
+    }
+
+    @Test
+    public void testCreatePrimaryStorage() {
+        DataStoreProvider provider = dataStoreProviderMgr.getDataStoreProvider("sample primary data store provider");
+        Map<String, Object> params = new HashMap<String, Object>();
+        URI uri = null;
+        try {
+            uri = new URI(this.getPrimaryStorageUrl());
+        } catch (URISyntaxException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+        params.put("url", this.getPrimaryStorageUrl());
+        params.put("server", uri.getHost());
+        params.put("path", uri.getPath());
+        params.put("protocol", StoragePoolType.NetworkFilesystem);
+        params.put("dcId", dcId.toString());
+        params.put("clusterId", clusterId.toString());
+        params.put("name", this.primaryName);
+        params.put("port", "1");
+        params.put("roles", DataStoreRole.Primary.toString());
+        params.put("uuid", UUID.nameUUIDFromBytes(this.getPrimaryStorageUrl().getBytes()).toString());
+        params.put("providerName", String.valueOf(provider.getName()));
+
+        DataStoreLifeCycle lifeCycle = provider.getDataStoreLifeCycle();
+        this.primaryStore = lifeCycle.initialize(params);
+        ClusterScope scope = new ClusterScope(clusterId, podId, dcId);
+        lifeCycle.attachCluster(this.primaryStore, scope);
+    }
+
+    private DataStore createImageStore() {
+        DataStoreProvider provider = dataStoreProviderMgr.getDataStoreProvider("sample image data store provider");
+        Map<String, Object> params = new HashMap<String, Object>();
+        String name = UUID.randomUUID().toString();
+        params.put("name", name);
+        params.put("uuid", name);
+        params.put("protocol", "http");
+        params.put("scope", ScopeType.GLOBAL.toString());
+        params.put("providerName", name);
+        DataStoreLifeCycle lifeCycle = provider.getDataStoreLifeCycle();
+        DataStore store = lifeCycle.initialize(params);
+        return store;
+    }
+
+    // @Test
+    public void testcreateImageStore() {
+        createImageStore();
+    }
+
+    public DataStore createPrimaryDataStore() {
+        try {
+            DataStoreProvider provider = dataStoreProviderMgr.getDataStoreProvider("sample primary data store provider");
+            Map<String, Object> params = new HashMap<String, Object>();
+            URI uri = new URI(this.getPrimaryStorageUrl());
+            params.put("url", this.getPrimaryStorageUrl());
+            params.put("server", uri.getHost());
+            params.put("path", uri.getPath());
+            params.put("protocol", Storage.StoragePoolType.NetworkFilesystem);
+            params.put("dcId", dcId.toString());
+            params.put("clusterId", clusterId.toString());
+            params.put("name", this.primaryName);
+            params.put("port", "1");
+            params.put("roles", DataStoreRole.Primary.toString());
+            params.put("uuid", UUID.nameUUIDFromBytes(this.getPrimaryStorageUrl().getBytes()).toString());
+            params.put("providerName", String.valueOf(provider.getName()));
+
+            DataStoreLifeCycle lifeCycle = provider.getDataStoreLifeCycle();
+            DataStore store = lifeCycle.initialize(params);
+            ClusterScope scope = new ClusterScope(clusterId, podId, dcId);
+            lifeCycle.attachCluster(store, scope);
+
+            /*
+             * PrimaryDataStoreProvider provider =
+             * primaryDataStoreProviderMgr.getDataStoreProvider
+             * ("sample primary data store provider");
+             * primaryDataStoreProviderMgr.configure("primary data store mgr",
+             * new HashMap<String, Object>());
+             *
+             * List<PrimaryDataStoreVO> ds =
+             * primaryStoreDao.findPoolByName(this.primaryName); if (ds.size()
+             * >= 1) { PrimaryDataStoreVO store = ds.get(0); if
+             * (store.getRemoved() == null) { return
+             * provider.getDataStore(store.getId()); } }
+             *
+             *
+             * Map<String, String> params = new HashMap<String, String>();
+             * params.put("url", this.getPrimaryStorageUrl());
+             * params.put("dcId", dcId.toString()); params.put("clusterId",
+             * clusterId.toString()); params.put("name", this.primaryName);
+             * PrimaryDataStoreInfo primaryDataStoreInfo =
+             * provider.registerDataStore(params); PrimaryDataStoreLifeCycle lc
+             * = primaryDataStoreInfo.getLifeCycle(); ClusterScope scope = new
+             * ClusterScope(clusterId, podId, dcId); lc.attachCluster(scope);
+             * return primaryDataStoreInfo;
+             */
+            return store;
+        } catch (Exception e) {
+            return null;
+        }
+    }
+
+    private VolumeVO createVolume(Long templateId, long dataStoreId) {
+        VolumeVO volume = new VolumeVO(Volume.Type.DATADISK, UUID.randomUUID().toString(), this.dcId, 1L, 1L, 1L, 1000, 0L, 0L, "");
+        volume.setPoolId(dataStoreId);
+        volume = volumeDao.persist(volume);
+        return volume;
+    }
+
+    @Test(priority = 2)
+    public void createVolumeFromTemplate() {
+        DataStore primaryStore = this.primaryStore;
+        TemplateInfo te = createTemplate();
+        VolumeVO volume = createVolume(te.getId(), primaryStore.getId());
+        VolumeInfo vol = volumeFactory.getVolume(volume.getId(), primaryStore);
+        // ve.createVolumeFromTemplate(primaryStore.getId(), new VHD(), te);
+        AsyncCallFuture<VolumeApiResult> future = volumeService.createVolumeFromTemplateAsync(vol, primaryStore.getId(), te);
+        try {
+            future.get();
+        } catch (InterruptedException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        } catch (ExecutionException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+    }
+
+    // @Test(priority=3)
+    public void createDataDisk() {
+        DataStore primaryStore = this.primaryStore;
+        VolumeVO volume = createVolume(null, primaryStore.getId());
+        VolumeInfo vol = volumeFactory.getVolume(volume.getId(), primaryStore);
+        AsyncCallFuture<VolumeApiResult> future = volumeService.createVolumeAsync(vol, primaryStore);
+        try {
+            future.get();
+        } catch (InterruptedException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        } catch (ExecutionException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+    }
+
+    // @Test(priority=3)
+    public void createAndDeleteDataDisk() {
+        DataStore primaryStore = this.primaryStore;
+        VolumeVO volume = createVolume(null, primaryStore.getId());
+        VolumeInfo vol = volumeFactory.getVolume(volume.getId(), primaryStore);
+        AsyncCallFuture<VolumeApiResult> future = volumeService.createVolumeAsync(vol, primaryStore);
+        try {
+            future.get();
+        } catch (InterruptedException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        } catch (ExecutionException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+
+        // delete the volume
+        vol = volumeFactory.getVolume(volume.getId(), primaryStore);
+        future = volumeService.expungeVolumeAsync(vol);
+        try {
+            future.get();
+        } catch (InterruptedException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        } catch (ExecutionException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+    }
+
+    // @Test(priority=3)
+    public void tearDown() {
+        List<StoragePoolVO> ds = primaryStoreDao.findPoolByName(this.primaryName);
+        for (int i = 0; i < ds.size(); i++) {
+            StoragePoolVO store = ds.get(i);
+            store.setUuid(null);
+            primaryStoreDao.remove(ds.get(i).getId());
+            primaryStoreDao.expunge(ds.get(i).getId());
+        }
+    }
+
+    // @Test
+    // @Test
+    public void test1() {
+        /*
+         * System.out.println(VolumeTypeHelper.getType("Root"));
+         * System.out.println(VolumeDiskTypeHelper.getDiskType("vmdk"));
+         * System.out.println(ImageFormatHelper.getFormat("ova"));
+         * AssertJUnit.assertFalse(new VMDK().equals(new VHD())); VMDK vmdk =
+         * new VMDK(); AssertJUnit.assertTrue(vmdk.equals(vmdk)); VMDK newvmdk =
+         * new VMDK(); AssertJUnit.assertTrue(vmdk.equals(newvmdk));
+         *
+         * ImageFormat ova = new OVA(); ImageFormat iso = new ISO();
+         * AssertJUnit.assertTrue(ova.equals(new OVA()));
+         * AssertJUnit.assertFalse(ova.equals(iso));
+         * AssertJUnit.assertTrue(ImageFormatHelper.getFormat("test").equals(new
+         * Unknown()));
+         *
+         * VolumeDiskType qcow2 = new QCOW2(); ImageFormat qcow2format = new
+         * org.apache.cloudstack.storage.image.format.QCOW2();
+         * AssertJUnit.assertFalse(qcow2.equals(qcow2format));
+         */
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/be5e5cc6/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/volumeServiceTest.java
----------------------------------------------------------------------
diff --git a/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/volumeServiceTest.java b/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/volumeServiceTest.java
deleted file mode 100644
index 167dd52..0000000
--- a/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/volumeServiceTest.java
+++ /dev/null
@@ -1,470 +0,0 @@
-/*
- * 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.storage.test;
-
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
-import java.util.concurrent.ExecutionException;
-
-import javax.inject.Inject;
-
-import org.mockito.Matchers;
-import org.mockito.Mockito;
-import org.springframework.test.context.ContextConfiguration;
-import org.testng.Assert;
-import org.testng.annotations.Test;
-
-import org.apache.cloudstack.engine.subsystem.api.storage.ClusterScope;
-import org.apache.cloudstack.engine.subsystem.api.storage.DataObject;
-import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
-import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreLifeCycle;
-import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreProvider;
-import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreProviderManager;
-import org.apache.cloudstack.engine.subsystem.api.storage.EndPoint;
-import org.apache.cloudstack.engine.subsystem.api.storage.EndPointSelector;
-import org.apache.cloudstack.engine.subsystem.api.storage.TemplateDataFactory;
-import org.apache.cloudstack.engine.subsystem.api.storage.TemplateInfo;
-import org.apache.cloudstack.engine.subsystem.api.storage.TemplateService;
-import org.apache.cloudstack.engine.subsystem.api.storage.VolumeDataFactory;
-import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo;
-import org.apache.cloudstack.engine.subsystem.api.storage.VolumeService;
-import org.apache.cloudstack.engine.subsystem.api.storage.VolumeService.VolumeApiResult;
-import org.apache.cloudstack.framework.async.AsyncCallFuture;
-import org.apache.cloudstack.storage.RemoteHostEndPoint;
-import org.apache.cloudstack.storage.datastore.db.ImageStoreDao;
-import org.apache.cloudstack.storage.datastore.db.ImageStoreVO;
-import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
-import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
-
-import com.cloud.agent.AgentManager;
-import com.cloud.dc.ClusterVO;
-import com.cloud.dc.DataCenter.NetworkType;
-import com.cloud.dc.DataCenterVO;
-import com.cloud.dc.HostPodVO;
-import com.cloud.dc.dao.ClusterDao;
-import com.cloud.dc.dao.DataCenterDao;
-import com.cloud.dc.dao.HostPodDao;
-import com.cloud.host.Host;
-import com.cloud.host.HostVO;
-import com.cloud.host.dao.HostDao;
-import com.cloud.hypervisor.Hypervisor.HypervisorType;
-import com.cloud.org.Cluster.ClusterType;
-import com.cloud.org.Managed.ManagedState;
-import com.cloud.resource.ResourceState;
-import com.cloud.storage.DataStoreRole;
-import com.cloud.storage.ScopeType;
-import com.cloud.storage.Storage;
-import com.cloud.storage.Storage.StoragePoolType;
-import com.cloud.storage.Storage.TemplateType;
-import com.cloud.storage.VMTemplateVO;
-import com.cloud.storage.Volume;
-import com.cloud.storage.VolumeVO;
-import com.cloud.storage.dao.VMTemplateDao;
-import com.cloud.storage.dao.VolumeDao;
-import com.cloud.utils.component.ComponentContext;
-
-@ContextConfiguration(locations = {"classpath:/storageContext.xml"})
-public class volumeServiceTest extends CloudStackTestNGBase {
-    // @Inject
-    // ImageDataStoreProviderManager imageProviderMgr;
-    @Inject
-    TemplateService imageService;
-    @Inject
-    VolumeService volumeService;
-    @Inject
-    VMTemplateDao imageDataDao;
-    @Inject
-    VolumeDao volumeDao;
-    @Inject
-    HostDao hostDao;
-    @Inject
-    HostPodDao podDao;
-    @Inject
-    ClusterDao clusterDao;
-    @Inject
-    DataCenterDao dcDao;
-    @Inject
-    PrimaryDataStoreDao primaryStoreDao;
-    @Inject
-    DataStoreProviderManager dataStoreProviderMgr;
-    @Inject
-    AgentManager agentMgr;
-    @Inject
-    EndPointSelector selector;
-    @Inject
-    TemplateDataFactory imageDataFactory;
-    @Inject
-    VolumeDataFactory volumeFactory;
-    @Inject
-    ImageStoreDao imageStoreDao;
-    ImageStoreVO imageStore;
-    Long dcId;
-    Long clusterId;
-    Long podId;
-    HostVO host;
-    String primaryName = "my primary data store";
-    DataStore primaryStore;
-
-    @Test(priority = -1)
-    public void setUp() {
-        ComponentContext.initComponentsLifeCycle();
-
-        host = hostDao.findByGuid(this.getHostGuid());
-        if (host != null) {
-            dcId = host.getDataCenterId();
-            clusterId = host.getClusterId();
-            podId = host.getPodId();
-            return;
-        }
-        // create data center
-        DataCenterVO dc =
-            new DataCenterVO(UUID.randomUUID().toString(), "test", "8.8.8.8", null, "10.0.0.1", null, "10.0.0.1/24", null, null, NetworkType.Basic, null, null, true,
-                true, null, null);
-        dc = dcDao.persist(dc);
-        dcId = dc.getId();
-        // create pod
-
-        HostPodVO pod = new HostPodVO(UUID.randomUUID().toString(), dc.getId(), this.getHostGateway(), this.getHostCidr(), 8, "test");
-        pod = podDao.persist(pod);
-        podId = pod.getId();
-        // create xen cluster
-        ClusterVO cluster = new ClusterVO(dc.getId(), pod.getId(), "devcloud cluster");
-        cluster.setHypervisorType(HypervisorType.XenServer.toString());
-        cluster.setClusterType(ClusterType.CloudManaged);
-        cluster.setManagedState(ManagedState.Managed);
-        cluster = clusterDao.persist(cluster);
-        clusterId = cluster.getId();
-        // create xen host
-
-        host = new HostVO(this.getHostGuid());
-        host.setName("devcloud xen host");
-        host.setType(Host.Type.Routing);
-        host.setPrivateIpAddress(this.getHostIp());
-        host.setDataCenterId(dc.getId());
-        host.setVersion("6.0.1");
-        host.setAvailable(true);
-        host.setSetup(true);
-        host.setPodId(podId);
-        host.setLastPinged(0);
-        host.setResourceState(ResourceState.Enabled);
-        host.setHypervisorType(HypervisorType.XenServer);
-        host.setClusterId(cluster.getId());
-
-        host = hostDao.persist(host);
-
-        imageStore = new ImageStoreVO();
-        imageStore.setName("test");
-        imageStore.setDataCenterId(dcId);
-        imageStore.setProviderName("CloudStack ImageStore Provider");
-        imageStore.setRole(DataStoreRole.Image);
-        imageStore.setUrl(this.getSecondaryStorage());
-        imageStore.setUuid(UUID.randomUUID().toString());
-        imageStore = imageStoreDao.persist(imageStore);
-
-    }
-
-    @Override
-    protected void injectMockito() {
-        if (host == null) {
-            return;
-        }
-        List<HostVO> results = new ArrayList<HostVO>();
-        results.add(host);
-        Mockito.when(hostDao.listAll()).thenReturn(results);
-        Mockito.when(hostDao.findById(Matchers.anyLong())).thenReturn(host);
-        Mockito.when(hostDao.findHypervisorHostInCluster(Matchers.anyLong())).thenReturn(results);
-        List<EndPoint> eps = new ArrayList<EndPoint>();
-        eps.add(RemoteHostEndPoint.getHypervisorHostEndPoint(host.getId(), host.getPrivateIpAddress(), host.getPublicIpAddress()));
-        Mockito.when(selector.selectAll(Matchers.any(DataStore.class))).thenReturn(eps);
-        Mockito.when(selector.select(Matchers.any(DataObject.class))).thenReturn(eps.get(0));
-        Mockito.when(selector.select(Matchers.any(DataObject.class), Matchers.any(DataObject.class))).thenReturn(eps.get(0));
-    }
-
-    private VMTemplateVO createImageData() {
-        VMTemplateVO image = new VMTemplateVO();
-        image.setTemplateType(TemplateType.USER);
-        image.setUrl(this.getTemplateUrl());
-        image.setUniqueName(UUID.randomUUID().toString());
-        image.setName(UUID.randomUUID().toString());
-        image.setPublicTemplate(true);
-        image.setFeatured(true);
-        image.setRequiresHvm(true);
-        image.setBits(64);
-        image.setFormat(Storage.ImageFormat.VHD);
-        image.setEnablePassword(true);
-        image.setEnableSshKey(true);
-        image.setGuestOSId(1);
-        image.setBootable(true);
-        image.setPrepopulate(true);
-        image.setCrossZones(true);
-        image.setExtractable(true);
-
-        // image.setImageDataStoreId(storeId);
-        image = imageDataDao.persist(image);
-
-        return image;
-    }
-
-    private TemplateInfo createTemplate() {
-        try {
-            DataStore store = createImageStore();
-            VMTemplateVO image = createImageData();
-            TemplateInfo template = imageDataFactory.getTemplate(image.getId(), store);
-            // AsyncCallFuture<TemplateApiResult> future =
-            // imageService.createTemplateAsync(template, store);
-            // future.get();
-            template = imageDataFactory.getTemplate(image.getId(), store);
-            /*
-             * imageProviderMgr.configure("image Provider", new HashMap<String,
-             * Object>()); VMTemplateVO image = createImageData();
-             * ImageDataStoreProvider defaultProvider =
-             * imageProviderMgr.getProvider("DefaultProvider");
-             * ImageDataStoreLifeCycle lifeCycle =
-             * defaultProvider.getLifeCycle(); ImageDataStore store =
-             * lifeCycle.registerDataStore("defaultHttpStore", new
-             * HashMap<String, String>());
-             * imageService.registerTemplate(image.getId(),
-             * store.getImageDataStoreId()); TemplateEntity te =
-             * imageService.getTemplateEntity(image.getId()); return te;
-             */
-            return template;
-        } catch (Exception e) {
-            Assert.fail("failed", e);
-            return null;
-        }
-    }
-
-    // @Test
-    public void createTemplateTest() {
-        createTemplate();
-    }
-
-    @Test
-    public void testCreatePrimaryStorage() {
-        DataStoreProvider provider = dataStoreProviderMgr.getDataStoreProvider("sample primary data store provider");
-        Map<String, Object> params = new HashMap<String, Object>();
-        URI uri = null;
-        try {
-            uri = new URI(this.getPrimaryStorageUrl());
-        } catch (URISyntaxException e) {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
-        }
-        params.put("url", this.getPrimaryStorageUrl());
-        params.put("server", uri.getHost());
-        params.put("path", uri.getPath());
-        params.put("protocol", StoragePoolType.NetworkFilesystem);
-        params.put("dcId", dcId.toString());
-        params.put("clusterId", clusterId.toString());
-        params.put("name", this.primaryName);
-        params.put("port", "1");
-        params.put("roles", DataStoreRole.Primary.toString());
-        params.put("uuid", UUID.nameUUIDFromBytes(this.getPrimaryStorageUrl().getBytes()).toString());
-        params.put("providerName", String.valueOf(provider.getName()));
-
-        DataStoreLifeCycle lifeCycle = provider.getDataStoreLifeCycle();
-        this.primaryStore = lifeCycle.initialize(params);
-        ClusterScope scope = new ClusterScope(clusterId, podId, dcId);
-        lifeCycle.attachCluster(this.primaryStore, scope);
-    }
-
-    private DataStore createImageStore() {
-        DataStoreProvider provider = dataStoreProviderMgr.getDataStoreProvider("sample image data store provider");
-        Map<String, Object> params = new HashMap<String, Object>();
-        String name = UUID.randomUUID().toString();
-        params.put("name", name);
-        params.put("uuid", name);
-        params.put("protocol", "http");
-        params.put("scope", ScopeType.GLOBAL.toString());
-        params.put("providerName", name);
-        DataStoreLifeCycle lifeCycle = provider.getDataStoreLifeCycle();
-        DataStore store = lifeCycle.initialize(params);
-        return store;
-    }
-
-    // @Test
-    public void testcreateImageStore() {
-        createImageStore();
-    }
-
-    public DataStore createPrimaryDataStore() {
-        try {
-            DataStoreProvider provider = dataStoreProviderMgr.getDataStoreProvider("sample primary data store provider");
-            Map<String, Object> params = new HashMap<String, Object>();
-            URI uri = new URI(this.getPrimaryStorageUrl());
-            params.put("url", this.getPrimaryStorageUrl());
-            params.put("server", uri.getHost());
-            params.put("path", uri.getPath());
-            params.put("protocol", Storage.StoragePoolType.NetworkFilesystem);
-            params.put("dcId", dcId.toString());
-            params.put("clusterId", clusterId.toString());
-            params.put("name", this.primaryName);
-            params.put("port", "1");
-            params.put("roles", DataStoreRole.Primary.toString());
-            params.put("uuid", UUID.nameUUIDFromBytes(this.getPrimaryStorageUrl().getBytes()).toString());
-            params.put("providerName", String.valueOf(provider.getName()));
-
-            DataStoreLifeCycle lifeCycle = provider.getDataStoreLifeCycle();
-            DataStore store = lifeCycle.initialize(params);
-            ClusterScope scope = new ClusterScope(clusterId, podId, dcId);
-            lifeCycle.attachCluster(store, scope);
-
-            /*
-             * PrimaryDataStoreProvider provider =
-             * primaryDataStoreProviderMgr.getDataStoreProvider
-             * ("sample primary data store provider");
-             * primaryDataStoreProviderMgr.configure("primary data store mgr",
-             * new HashMap<String, Object>());
-             *
-             * List<PrimaryDataStoreVO> ds =
-             * primaryStoreDao.findPoolByName(this.primaryName); if (ds.size()
-             * >= 1) { PrimaryDataStoreVO store = ds.get(0); if
-             * (store.getRemoved() == null) { return
-             * provider.getDataStore(store.getId()); } }
-             *
-             *
-             * Map<String, String> params = new HashMap<String, String>();
-             * params.put("url", this.getPrimaryStorageUrl());
-             * params.put("dcId", dcId.toString()); params.put("clusterId",
-             * clusterId.toString()); params.put("name", this.primaryName);
-             * PrimaryDataStoreInfo primaryDataStoreInfo =
-             * provider.registerDataStore(params); PrimaryDataStoreLifeCycle lc
-             * = primaryDataStoreInfo.getLifeCycle(); ClusterScope scope = new
-             * ClusterScope(clusterId, podId, dcId); lc.attachCluster(scope);
-             * return primaryDataStoreInfo;
-             */
-            return store;
-        } catch (Exception e) {
-            return null;
-        }
-    }
-
-    private VolumeVO createVolume(Long templateId, long dataStoreId) {
-        VolumeVO volume = new VolumeVO(Volume.Type.DATADISK, UUID.randomUUID().toString(), this.dcId, 1L, 1L, 1L, 1000, 0L, 0L, "");
-        volume.setPoolId(dataStoreId);
-        volume = volumeDao.persist(volume);
-        return volume;
-    }
-
-    @Test(priority = 2)
-    public void createVolumeFromTemplate() {
-        DataStore primaryStore = this.primaryStore;
-        TemplateInfo te = createTemplate();
-        VolumeVO volume = createVolume(te.getId(), primaryStore.getId());
-        VolumeInfo vol = volumeFactory.getVolume(volume.getId(), primaryStore);
-        // ve.createVolumeFromTemplate(primaryStore.getId(), new VHD(), te);
-        AsyncCallFuture<VolumeApiResult> future = volumeService.createVolumeFromTemplateAsync(vol, primaryStore.getId(), te);
-        try {
-            future.get();
-        } catch (InterruptedException e) {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
-        } catch (ExecutionException e) {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
-        }
-    }
-
-    // @Test(priority=3)
-    public void createDataDisk() {
-        DataStore primaryStore = this.primaryStore;
-        VolumeVO volume = createVolume(null, primaryStore.getId());
-        VolumeInfo vol = volumeFactory.getVolume(volume.getId(), primaryStore);
-        AsyncCallFuture<VolumeApiResult> future = volumeService.createVolumeAsync(vol, primaryStore);
-        try {
-            future.get();
-        } catch (InterruptedException e) {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
-        } catch (ExecutionException e) {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
-        }
-    }
-
-    // @Test(priority=3)
-    public void createAndDeleteDataDisk() {
-        DataStore primaryStore = this.primaryStore;
-        VolumeVO volume = createVolume(null, primaryStore.getId());
-        VolumeInfo vol = volumeFactory.getVolume(volume.getId(), primaryStore);
-        AsyncCallFuture<VolumeApiResult> future = volumeService.createVolumeAsync(vol, primaryStore);
-        try {
-            future.get();
-        } catch (InterruptedException e) {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
-        } catch (ExecutionException e) {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
-        }
-
-        // delete the volume
-        vol = volumeFactory.getVolume(volume.getId(), primaryStore);
-        future = volumeService.expungeVolumeAsync(vol);
-        try {
-            future.get();
-        } catch (InterruptedException e) {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
-        } catch (ExecutionException e) {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
-        }
-    }
-
-    // @Test(priority=3)
-    public void tearDown() {
-        List<StoragePoolVO> ds = primaryStoreDao.findPoolByName(this.primaryName);
-        for (int i = 0; i < ds.size(); i++) {
-            StoragePoolVO store = ds.get(i);
-            store.setUuid(null);
-            primaryStoreDao.remove(ds.get(i).getId());
-            primaryStoreDao.expunge(ds.get(i).getId());
-        }
-    }
-
-    // @Test
-    // @Test
-    public void test1() {
-        /*
-         * System.out.println(VolumeTypeHelper.getType("Root"));
-         * System.out.println(VolumeDiskTypeHelper.getDiskType("vmdk"));
-         * System.out.println(ImageFormatHelper.getFormat("ova"));
-         * AssertJUnit.assertFalse(new VMDK().equals(new VHD())); VMDK vmdk =
-         * new VMDK(); AssertJUnit.assertTrue(vmdk.equals(vmdk)); VMDK newvmdk =
-         * new VMDK(); AssertJUnit.assertTrue(vmdk.equals(newvmdk));
-         *
-         * ImageFormat ova = new OVA(); ImageFormat iso = new ISO();
-         * AssertJUnit.assertTrue(ova.equals(new OVA()));
-         * AssertJUnit.assertFalse(ova.equals(iso));
-         * AssertJUnit.assertTrue(ImageFormatHelper.getFormat("test").equals(new
-         * Unknown()));
-         *
-         * VolumeDiskType qcow2 = new QCOW2(); ImageFormat qcow2format = new
-         * org.apache.cloudstack.storage.image.format.QCOW2();
-         * AssertJUnit.assertFalse(qcow2.equals(qcow2format));
-         */
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/be5e5cc6/engine/storage/integration-test/test/resources/StorageAllocatorTestContext.xml
----------------------------------------------------------------------
diff --git a/engine/storage/integration-test/test/resources/StorageAllocatorTestContext.xml b/engine/storage/integration-test/test/resources/StorageAllocatorTestContext.xml
index 1f5aa58..72e5c84 100644
--- a/engine/storage/integration-test/test/resources/StorageAllocatorTestContext.xml
+++ b/engine/storage/integration-test/test/resources/StorageAllocatorTestContext.xml
@@ -1,17 +1,16 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!-- 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. -->
-<beans xmlns="http://www.springframework.org/schema/beans"
-  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
-  xmlns:tx="http://www.springframework.org/schema/tx" xmlns:aop="http://www.springframework.org/schema/aop"
+  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. -->
+<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx"
+  xmlns:aop="http://www.springframework.org/schema/aop"
   xsi:schemaLocation="http://www.springframework.org/schema/beans
                       http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
                       http://www.springframework.org/schema/tx 
@@ -22,10 +21,10 @@
                       http://www.springframework.org/schema/context/spring-context-3.0.xsd">
 
   <context:annotation-config />
-	<context:component-scan base-package="org.apache.cloudstack.storage" />
+  <context:component-scan base-package="org.apache.cloudstack.storage" />
 
 
-	<!-- @DB support -->
+  <!-- @DB support -->
   <aop:config proxy-target-class="true">
     <aop:aspect id="dbContextBuilder" ref="transactionContextBuilder">
       <aop:pointcut id="captureAnyMethod" expression="execution(* *(..))" />
@@ -36,10 +35,11 @@
   </aop:config>
 
   <bean id="transactionContextBuilder" class="com.cloud.utils.db.TransactionContextBuilder" />
-  <bean id="componentContext" class="com.cloud.utils.component.ComponentContext"/>
+  <bean id="componentContext" class="com.cloud.utils.component.ComponentContext" />
   <bean class="org.apache.cloudstack.storage.test.ChildTestConfiguration" />
 
-  <bean class="org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor">
+  <bean
+    class="org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor">
     <property name="requiredParameterValue" value="false" />
   </bean>
 </beans>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/be5e5cc6/engine/storage/snapshot/src/org/apache/cloudstack/storage/vmsnapshot/DefaultVMSnapshotStrategy.java
----------------------------------------------------------------------
diff --git a/engine/storage/snapshot/src/org/apache/cloudstack/storage/vmsnapshot/DefaultVMSnapshotStrategy.java b/engine/storage/snapshot/src/org/apache/cloudstack/storage/vmsnapshot/DefaultVMSnapshotStrategy.java
index 42bef7e..e86bd23 100644
--- a/engine/storage/snapshot/src/org/apache/cloudstack/storage/vmsnapshot/DefaultVMSnapshotStrategy.java
+++ b/engine/storage/snapshot/src/org/apache/cloudstack/storage/vmsnapshot/DefaultVMSnapshotStrategy.java
@@ -236,9 +236,9 @@ public class DefaultVMSnapshotStrategy extends ManagerBase implements VMSnapshot
         }
     }
 
-    protected void finalizeDelete(VMSnapshotVO vmSnapshot, List<VolumeObjectTO> VolumeTOs) {
+    protected void finalizeDelete(VMSnapshotVO vmSnapshot, List<VolumeObjectTO> volumeTOs) {
         // update volumes path
-        updateVolumePath(VolumeTOs);
+        updateVolumePath(volumeTOs);
 
         // update children's parent snapshots
         List<VMSnapshotVO> children = vmSnapshotDao.listByParent(vmSnapshot.getId());
@@ -258,9 +258,9 @@ public class DefaultVMSnapshotStrategy extends ManagerBase implements VMSnapshot
         vmSnapshotDao.persist(vmSnapshot);
     }
 
-    protected void finalizeCreate(VMSnapshotVO vmSnapshot, List<VolumeObjectTO> VolumeTOs) {
+    protected void finalizeCreate(VMSnapshotVO vmSnapshot, List<VolumeObjectTO> volumeTOs) {
         // update volumes path
-        updateVolumePath(VolumeTOs);
+        updateVolumePath(volumeTOs);
 
         vmSnapshot.setCurrent(true);
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/be5e5cc6/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java
----------------------------------------------------------------------
diff --git a/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java b/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java
index 37e5bb4..c9d7fab 100644
--- a/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java
+++ b/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java
@@ -1204,7 +1204,8 @@ public class VolumeServiceImpl implements VolumeService {
                                             com.cloud.configuration.Resource.ResourceType.secondary_storage, volInfo.getSize() - volInfo.getPhysicalSize());
                                     } catch (ResourceAllocationException e) {
                                         s_logger.warn(e.getMessage());
-                                        _alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_RESOURCE_LIMIT_EXCEEDED, volume.getDataCenterId(), volume.getPodId(), e.getMessage(),
+                                        _alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_RESOURCE_LIMIT_EXCEEDED, volume.getDataCenterId(), volume.getPodId(),
+                                            e.getMessage(),
                                             e.getMessage());
                                     } finally {
                                         _resourceLimitMgr.recalculateResourceCount(volume.getAccountId(), volume.getDomainId(),

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/be5e5cc6/framework/cluster/src/com/cloud/cluster/ClusterManagerImpl.java
----------------------------------------------------------------------
diff --git a/framework/cluster/src/com/cloud/cluster/ClusterManagerImpl.java b/framework/cluster/src/com/cloud/cluster/ClusterManagerImpl.java
index 1058da3..c7c3710 100644
--- a/framework/cluster/src/com/cloud/cluster/ClusterManagerImpl.java
+++ b/framework/cluster/src/com/cloud/cluster/ClusterManagerImpl.java
@@ -255,15 +255,15 @@ public class ClusterManagerImpl extends ManagerBase implements ClusterManager, C
                         try {
                             if (s_logger.isDebugEnabled()) {
                                 s_logger.debug("Cluster PDU " + getSelfPeerName() + " -> " + pdu.getDestPeer() + ". agent: " + pdu.getAgentId() + ", pdu seq: " +
-                                        pdu.getSequenceId() + ", pdu ack seq: " + pdu.getAckSequenceId() + ", json: " + pdu.getJsonPackage());
+                                    pdu.getSequenceId() + ", pdu ack seq: " + pdu.getAckSequenceId() + ", json: " + pdu.getJsonPackage());
                             }
 
                             long startTick = System.currentTimeMillis();
                             String strResult = peerService.execute(pdu);
                             if (s_logger.isDebugEnabled()) {
                                 s_logger.debug("Cluster PDU " + getSelfPeerName() + " -> " + pdu.getDestPeer() + " completed. time: " +
-                                        (System.currentTimeMillis() - startTick) + "ms. agent: " + pdu.getAgentId() + ", pdu seq: " + pdu.getSequenceId() +
-                                        ", pdu ack seq: " + pdu.getAckSequenceId() + ", json: " + pdu.getJsonPackage());
+                                    (System.currentTimeMillis() - startTick) + "ms. agent: " + pdu.getAgentId() + ", pdu seq: " + pdu.getSequenceId() +
+                                    ", pdu ack seq: " + pdu.getAckSequenceId() + ", json: " + pdu.getJsonPackage());
                             }
 
                             if ("true".equals(strResult))
@@ -273,7 +273,7 @@ public class ClusterManagerImpl extends ManagerBase implements ClusterManager, C
                             invalidatePeerService(pdu.getDestPeer());
                             if (s_logger.isInfoEnabled()) {
                                 s_logger.info("Exception on remote execution, peer: " + pdu.getDestPeer() + ", iteration: " + i + ", exception message :" +
-                                        e.getMessage());
+                                    e.getMessage());
                             }
                         }
                     }
@@ -563,7 +563,7 @@ public class ClusterManagerImpl extends ManagerBase implements ClusterManager, C
                         if (profiler.getDuration() >= HeartbeatInterval.value()) {
                             if (s_logger.isDebugEnabled())
                                 s_logger.debug("Management server heartbeat takes too long to finish. profiler: " + profiler.toString() + ", profilerHeartbeatUpdate: " +
-                                        profilerHeartbeatUpdate.toString() + ", profilerPeerScan: " + profilerPeerScan.toString());
+                                    profilerHeartbeatUpdate.toString() + ", profilerPeerScan: " + profilerPeerScan.toString());
                         }
                     }
 
@@ -721,7 +721,7 @@ public class ClusterManagerImpl extends ManagerBase implements ClusterManager, C
                     }
                 }
             }
-            break;
+                break;
 
             case nodeRemoved: {
                 List<ManagementServerHostVO> l = msg.getNodes();
@@ -731,7 +731,7 @@ public class ClusterManagerImpl extends ManagerBase implements ClusterManager, C
                     }
                 }
             }
-            break;
+                break;
 
             default:
                 break;
@@ -772,7 +772,7 @@ public class ClusterManagerImpl extends ManagerBase implements ClusterManager, C
                 s_logger.info("Found " + inactiveList.size() + " inactive management server node based on timestamp");
                 for (ManagementServerHostVO host : inactiveList)
                     s_logger.info("management server node msid: " + host.getMsid() + ", name: " + host.getName() + ", service ip: " + host.getServiceIP() +
-                            ", version: " + host.getVersion());
+                        ", version: " + host.getVersion());
             }
 
             List<ManagementServerHostVO> downHostList = new ArrayList<ManagementServerHostVO>();
@@ -810,7 +810,7 @@ public class ClusterManagerImpl extends ManagerBase implements ClusterManager, C
 
             if (_mshostPeerDao.countStateSeenInPeers(_mshostId, _runId, ManagementServerHost.State.Down) > 0) {
                 String msg =
-                        "We have detected that at least one management server peer reports that this management server is down, perform active fencing to avoid split-brain situation";
+                    "We have detected that at least one management server peer reports that this management server is down, perform active fencing to avoid split-brain situation";
                 s_logger.error(msg);
                 throw new ActiveFencingException(msg);
             }
@@ -831,7 +831,7 @@ public class ClusterManagerImpl extends ManagerBase implements ClusterManager, C
                         if (entry.getKey().longValue() != _mshostId.longValue()) {
                             if (s_logger.isDebugEnabled()) {
                                 s_logger.debug("Detected management node left because of invalidated session, id:" + entry.getKey() + ", nodeIP:" +
-                                        entry.getValue().getServiceIP());
+                                    entry.getValue().getServiceIP());
                             }
                             invalidatedNodeList.add(entry.getValue());
                         }
@@ -918,8 +918,8 @@ public class ClusterManagerImpl extends ManagerBase implements ClusterManager, C
         if (profiler.getDuration() >= HeartbeatInterval.value()) {
             if (s_logger.isDebugEnabled())
                 s_logger.debug("Peer scan takes too long to finish. profiler: " + profiler.toString() + ", profilerQueryActiveList: " +
-                        profilerQueryActiveList.toString() + ", profilerSyncClusterInfo: " + profilerSyncClusterInfo.toString() + ", profilerInvalidatedNodeList: " +
-                        profilerInvalidatedNodeList.toString() + ", profilerRemovedList: " + profilerRemovedList.toString());
+                    profilerQueryActiveList.toString() + ", profilerSyncClusterInfo: " + profilerSyncClusterInfo.toString() + ", profilerInvalidatedNodeList: " +
+                    profilerInvalidatedNodeList.toString() + ", profilerRemovedList: " + profilerRemovedList.toString());
         }
     }
 
@@ -970,7 +970,7 @@ public class ClusterManagerImpl extends ManagerBase implements ClusterManager, C
                     }
 
                     _mshostDao.update(mshost.getId(), getCurrentRunId(), NetUtils.getHostName(), version, _clusterNodeIP, _currentServiceAdapter.getServicePort(),
-                            DateUtil.currentGMTTime());
+                        DateUtil.currentGMTTime());
                 }
 
                 return mshost;
@@ -1165,19 +1165,19 @@ public class ClusterManagerImpl extends ManagerBase implements ClusterManager, C
                         throw new ConfigurationException(msg);
                     } else {
                         String msg =
-                                "Detected another management node with localhost IP is considered as running in DB, however it is not pingable, we will continue cluster initialization with this management server node";
+                            "Detected another management node with localhost IP is considered as running in DB, however it is not pingable, we will continue cluster initialization with this management server node";
                         s_logger.info(msg);
                     }
                 } else {
                     if (pingManagementNode(peer.getMsid())) {
                         String msg =
-                                "Detected that another management node with the same IP " + peer.getServiceIP() +
+                            "Detected that another management node with the same IP " + peer.getServiceIP() +
                                 " is already running, please check your cluster configuration";
                         s_logger.error(msg);
                         throw new ConfigurationException(msg);
                     } else {
                         String msg =
-                                "Detected that another management node with the same IP " + peer.getServiceIP() +
+                            "Detected that another management node with the same IP " + peer.getServiceIP() +
                                 " is considered as running in DB, however it is not pingable, we will continue cluster initialization with this management server node";
                         s_logger.info(msg);
                     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/be5e5cc6/framework/cluster/src/com/cloud/cluster/dao/ManagementServerHostDaoImpl.java
----------------------------------------------------------------------
diff --git a/framework/cluster/src/com/cloud/cluster/dao/ManagementServerHostDaoImpl.java b/framework/cluster/src/com/cloud/cluster/dao/ManagementServerHostDaoImpl.java
index 2287ca7..3d0c3f5 100644
--- a/framework/cluster/src/com/cloud/cluster/dao/ManagementServerHostDaoImpl.java
+++ b/framework/cluster/src/com/cloud/cluster/dao/ManagementServerHostDaoImpl.java
@@ -44,48 +44,48 @@ import com.cloud.utils.exception.CloudRuntimeException;
 @Local(value = {ManagementServerHostDao.class})
 public class ManagementServerHostDaoImpl extends GenericDaoBase<ManagementServerHostVO, Long> implements ManagementServerHostDao {
     private static final Logger s_logger = Logger.getLogger(ManagementServerHostDaoImpl.class);
-    
+
     private final SearchBuilder<ManagementServerHostVO> MsIdSearch;
     private final SearchBuilder<ManagementServerHostVO> ActiveSearch;
     private final SearchBuilder<ManagementServerHostVO> InactiveSearch;
     private final SearchBuilder<ManagementServerHostVO> StateSearch;
 
-	@Override
+    @Override
     public void invalidateRunSession(long id, long runid) {
-	    TransactionLegacy txn = TransactionLegacy.currentTxn();
+        TransactionLegacy txn = TransactionLegacy.currentTxn();
         PreparedStatement pstmt = null;
         try {
             pstmt = txn.prepareAutoCloseStatement("update mshost set runid=0, state='Down' where id=? and runid=?");
             pstmt.setLong(1, id);
             pstmt.setLong(2, runid);
-            
+
             pstmt.executeUpdate();
         } catch (SQLException e) {
-        	throw new CloudRuntimeException("DB exception on " + pstmt.toString(), e);
+            throw new CloudRuntimeException("DB exception on " + pstmt.toString(), e);
         }
-	}
-	
-	@Override
+    }
+
+    @Override
     public ManagementServerHostVO findByMsid(long msid) {
         SearchCriteria<ManagementServerHostVO> sc = MsIdSearch.create();
         sc.setParameters("msid", msid);
-		
-		List<ManagementServerHostVO> l = listIncludingRemovedBy(sc);
+
+        List<ManagementServerHostVO> l = listIncludingRemovedBy(sc);
         if (l != null && l.size() > 0) {
             return l.get(0);
         }
-		 
-		return null;
-	}
-	
-	@Override
+
+        return null;
+    }
+
+    @Override
     @DB
-	public void update(long id, long runid, String name, String version, String serviceIP, int servicePort, Date lastUpdate) {
+    public void update(long id, long runid, String name, String version, String serviceIP, int servicePort, Date lastUpdate) {
         TransactionLegacy txn = TransactionLegacy.currentTxn();
         PreparedStatement pstmt = null;
         try {
             txn.start();
-            
+
             pstmt =
                 txn.prepareAutoCloseStatement("update mshost set name=?, version=?, service_ip=?, service_port=?, last_update=?, removed=null, alert_count=0, runid=?, state=? where id=?");
             pstmt.setString(1, name);
@@ -96,48 +96,48 @@ public class ManagementServerHostDaoImpl extends GenericDaoBase<ManagementServer
             pstmt.setLong(6, runid);
             pstmt.setString(7, ManagementServerHost.State.Up.toString());
             pstmt.setLong(8, id);
-            
+
             pstmt.executeUpdate();
             txn.commit();
         } catch (Exception e) {
             s_logger.warn("Unexpected exception, ", e);
             throw new RuntimeException(e.getMessage(), e);
         }
-	}
-	
-	@Override
+    }
+
+    @Override
     @DB
     public boolean remove(Long id) {
         TransactionLegacy txn = TransactionLegacy.currentTxn();
-    
+
         try {
-        	txn.start();
-        	
-        	ManagementServerHostVO msHost = findById(id);
-        	msHost.setState(ManagementServerHost.State.Down);
-        	super.remove(id);
-        	
-        	txn.commit();
-        	return true;
+            txn.start();
+
+            ManagementServerHostVO msHost = findById(id);
+            msHost.setState(ManagementServerHost.State.Down);
+            super.remove(id);
+
+            txn.commit();
+            return true;
         } catch (Exception e) {
             s_logger.warn("Unexpected exception, ", e);
             throw new RuntimeException(e.getMessage(), e);
         }
     }
 
-	@Override
+    @Override
     @DB
-	public void update(long id, long runid, Date lastUpdate) {
+    public void update(long id, long runid, Date lastUpdate) {
         TransactionLegacy txn = TransactionLegacy.currentTxn();
         PreparedStatement pstmt = null;
         try {
             txn.start();
-            
+
             pstmt = txn.prepareAutoCloseStatement("update mshost set last_update=?, removed=null, alert_count=0 where id=? and runid=?");
             pstmt.setString(1, DateUtil.getDateDisplayString(TimeZone.getTimeZone("GMT"), lastUpdate));
             pstmt.setLong(2, id);
             pstmt.setLong(3, runid);
-            
+
             int count = pstmt.executeUpdate();
             txn.commit();
 
@@ -148,69 +148,69 @@ public class ManagementServerHostDaoImpl extends GenericDaoBase<ManagementServer
             s_logger.warn("Unexpected exception, ", e);
             throw new RuntimeException(e.getMessage(), e);
         }
-	}
-	
-	@Override
+    }
+
+    @Override
     public List<ManagementServerHostVO> getActiveList(Date cutTime) {
-	    SearchCriteria<ManagementServerHostVO> sc = ActiveSearch.create();
-	    sc.setParameters("lastUpdateTime", cutTime);
-	    
-	    return listIncludingRemovedBy(sc);
-	}
+        SearchCriteria<ManagementServerHostVO> sc = ActiveSearch.create();
+        sc.setParameters("lastUpdateTime", cutTime);
 
-	@Override
+        return listIncludingRemovedBy(sc);
+    }
+
+    @Override
     public List<ManagementServerHostVO> getInactiveList(Date cutTime) {
-	    SearchCriteria<ManagementServerHostVO> sc = InactiveSearch.create();
-	    sc.setParameters("lastUpdateTime", cutTime);
-	    
-	    return listIncludingRemovedBy(sc);
-	}
-	
-	@Override
+        SearchCriteria<ManagementServerHostVO> sc = InactiveSearch.create();
+        sc.setParameters("lastUpdateTime", cutTime);
+
+        return listIncludingRemovedBy(sc);
+    }
+
+    @Override
     @DB
-	public int increaseAlertCount(long id) {
+    public int increaseAlertCount(long id) {
         TransactionLegacy txn = TransactionLegacy.currentTxn();
         PreparedStatement pstmt = null;
         int changedRows = 0;
         try {
             txn.start();
-            
+
             pstmt = txn.prepareAutoCloseStatement("update mshost set alert_count=alert_count+1 where id=? and alert_count=0");
             pstmt.setLong(1, id);
-            
+
             changedRows = pstmt.executeUpdate();
             txn.commit();
         } catch (Exception e) {
             s_logger.warn("Unexpected exception, ", e);
             throw new RuntimeException(e.getMessage(), e);
         }
-        
+
         return changedRows;
-	}
-	
-	protected ManagementServerHostDaoImpl() {
-		MsIdSearch = createSearchBuilder();
-		MsIdSearch.and("msid",  MsIdSearch.entity().getMsid(), SearchCriteria.Op.EQ);
-		MsIdSearch.done();
-		
-	    ActiveSearch = createSearchBuilder();
-	    ActiveSearch.and("lastUpdateTime", ActiveSearch.entity().getLastUpdateTime(),  SearchCriteria.Op.GT);
-	    ActiveSearch.and("removed", ActiveSearch.entity().getRemoved(), SearchCriteria.Op.NULL);
-	    ActiveSearch.done();
-
-	    InactiveSearch = createSearchBuilder();
-	    InactiveSearch.and("lastUpdateTime", InactiveSearch.entity().getLastUpdateTime(),  SearchCriteria.Op.LTEQ);
-	    InactiveSearch.and("removed", InactiveSearch.entity().getRemoved(), SearchCriteria.Op.NULL);
-	    InactiveSearch.done();
-	    
-	    StateSearch = createSearchBuilder();
-	    StateSearch.and("state", StateSearch.entity().getState(), SearchCriteria.Op.IN);
-	    StateSearch.done();
-	}
-	
-	@Override
+    }
+
+    protected ManagementServerHostDaoImpl() {
+        MsIdSearch = createSearchBuilder();
+        MsIdSearch.and("msid", MsIdSearch.entity().getMsid(), SearchCriteria.Op.EQ);
+        MsIdSearch.done();
+
+        ActiveSearch = createSearchBuilder();
+        ActiveSearch.and("lastUpdateTime", ActiveSearch.entity().getLastUpdateTime(), SearchCriteria.Op.GT);
+        ActiveSearch.and("removed", ActiveSearch.entity().getRemoved(), SearchCriteria.Op.NULL);
+        ActiveSearch.done();
+
+        InactiveSearch = createSearchBuilder();
+        InactiveSearch.and("lastUpdateTime", InactiveSearch.entity().getLastUpdateTime(), SearchCriteria.Op.LTEQ);
+        InactiveSearch.and("removed", InactiveSearch.entity().getRemoved(), SearchCriteria.Op.NULL);
+        InactiveSearch.done();
+
+        StateSearch = createSearchBuilder();
+        StateSearch.and("state", StateSearch.entity().getState(), SearchCriteria.Op.IN);
+        StateSearch.done();
+    }
+
+    @Override
     public void update(long id, long runId, State state, Date lastUpdate) {
-	    TransactionLegacy txn = TransactionLegacy.currentTxn();
+        TransactionLegacy txn = TransactionLegacy.currentTxn();
         PreparedStatement pstmt = null;
         try {
             pstmt = txn.prepareAutoCloseStatement("update mshost set state=?, last_update=? where id=? and runid=?");
@@ -218,9 +218,9 @@ public class ManagementServerHostDaoImpl extends GenericDaoBase<ManagementServer
             pstmt.setString(2, DateUtil.getDateDisplayString(TimeZone.getTimeZone("GMT"), lastUpdate));
             pstmt.setLong(3, id);
             pstmt.setLong(4, runId);
-            
+
             int count = pstmt.executeUpdate();
-            
+
             if (count < 1) {
                 throw new CloudRuntimeException("Invalid cluster session detected", new ClusterInvalidSessionException("runid " + runId + " is no longer valid"));
             }
@@ -228,21 +228,21 @@ public class ManagementServerHostDaoImpl extends GenericDaoBase<ManagementServer
             throw new CloudRuntimeException("DB exception on " + pstmt.toString(), e);
         }
     }
-	
-	@Override
+
+    @Override
     public List<ManagementServerHostVO> listBy(ManagementServerHost.State... states) {
-	    SearchCriteria<ManagementServerHostVO> sc = StateSearch.create();
+        SearchCriteria<ManagementServerHostVO> sc = StateSearch.create();
 
         sc.setParameters("state", (Object[])states);
-        
+
         return listBy(sc);
-	}
-	
-	@Override
-	public List<Long> listOrphanMsids() {
-		List<Long> orphanList = new ArrayList<Long>();
-		
-	    TransactionLegacy txn = TransactionLegacy.currentTxn();
+    }
+
+    @Override
+    public List<Long> listOrphanMsids() {
+        List<Long> orphanList = new ArrayList<Long>();
+
+        TransactionLegacy txn = TransactionLegacy.currentTxn();
         PreparedStatement pstmt = null;
         try {
             pstmt =
@@ -250,26 +250,26 @@ public class ManagementServerHostDaoImpl extends GenericDaoBase<ManagementServer
 
             ResultSet rs = pstmt.executeQuery();
             while (rs.next()) {
-            	orphanList.add(rs.getLong(1));
+                orphanList.add(rs.getLong(1));
             }
         } catch (SQLException e) {
             throw new CloudRuntimeException("DB exception on " + pstmt.toString(), e);
         }
-        
+
         return orphanList;
-	}
+    }
 
-	@Override
-	public ManagementServerHostVO findOneInUpState(Filter filter) {
-	    SearchCriteria<ManagementServerHostVO> sc = StateSearch.create();
+    @Override
+    public ManagementServerHostVO findOneInUpState(Filter filter) {
+        SearchCriteria<ManagementServerHostVO> sc = StateSearch.create();
 
         sc.setParameters("state", ManagementServerHost.State.Up);
-        
-        List<ManagementServerHostVO> mshosts =  listBy(sc, filter);
+
+        List<ManagementServerHostVO> mshosts = listBy(sc, filter);
         if (mshosts != null && mshosts.size() > 0) {
-        	return mshosts.get(0);	
+            return mshosts.get(0);
         }
         return null;
-	}
-	
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/be5e5cc6/framework/config/test/org/apache/cloudstack/framework/config/impl/ConfigDepotAdminTest.java
----------------------------------------------------------------------
diff --git a/framework/config/test/org/apache/cloudstack/framework/config/impl/ConfigDepotAdminTest.java b/framework/config/test/org/apache/cloudstack/framework/config/impl/ConfigDepotAdminTest.java
index 245e9a6..da76804 100644
--- a/framework/config/test/org/apache/cloudstack/framework/config/impl/ConfigDepotAdminTest.java
+++ b/framework/config/test/org/apache/cloudstack/framework/config/impl/ConfigDepotAdminTest.java
@@ -39,8 +39,8 @@ import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
 import com.cloud.utils.db.EntityManager;
 
 public class ConfigDepotAdminTest extends TestCase {
-    private final ConfigKey<Integer> DynamicIntCK = new ConfigKey<Integer>(Integer.class, "dynIntKey", "Advance", "10", "Test Key", true);
-    private final ConfigKey<Integer> StaticIntCK = new ConfigKey<Integer>(Integer.class, "statIntKey", "Advance", "10", "Test Key", false);
+    private final static ConfigKey<Integer> DynamicIntCK = new ConfigKey<Integer>(Integer.class, "dynIntKey", "Advance", "10", "Test Key", true);
+    private final static ConfigKey<Integer> StaticIntCK = new ConfigKey<Integer>(Integer.class, "statIntKey", "Advance", "10", "Test Key", false);
 
     @Mock
     Configurable _configurable;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/be5e5cc6/framework/db/src/com/cloud/utils/db/GenericDao.java
----------------------------------------------------------------------
diff --git a/framework/db/src/com/cloud/utils/db/GenericDao.java b/framework/db/src/com/cloud/utils/db/GenericDao.java
index 14169ff..cb401cd 100755
--- a/framework/db/src/com/cloud/utils/db/GenericDao.java
+++ b/framework/db/src/com/cloud/utils/db/GenericDao.java
@@ -160,14 +160,14 @@ public interface GenericDao<T, ID extends Serializable> {
      * Search for the entity beans using the sql SQL_CACHE option
      * @param sc
      * @param filter
-     * @param enable_query_cache
+     * @param enableQueryCache
      * @return list of entity beans.
      */
-    List<T> search(SearchCriteria<T> sc, Filter filter, final boolean enable_query_cache);
+    List<T> search(SearchCriteria<T> sc, Filter filter, final boolean enableQueryCache);
 
     List<T> searchIncludingRemoved(SearchCriteria<T> sc, final Filter filter, final Boolean lock, final boolean cache);
 
-    List<T> searchIncludingRemoved(SearchCriteria<T> sc, final Filter filter, final Boolean lock, final boolean cache, final boolean enable_query_cache);
+    List<T> searchIncludingRemoved(SearchCriteria<T> sc, final Filter filter, final Boolean lock, final boolean cache, final boolean enableQueryCache);
 
     /**
      * Customized search with SearchCritiria

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/be5e5cc6/framework/db/src/com/cloud/utils/db/GenericDaoBase.java
----------------------------------------------------------------------
diff --git a/framework/db/src/com/cloud/utils/db/GenericDaoBase.java b/framework/db/src/com/cloud/utils/db/GenericDaoBase.java
index 8e6f6a4..503d759 100755
--- a/framework/db/src/com/cloud/utils/db/GenericDaoBase.java
+++ b/framework/db/src/com/cloud/utils/db/GenericDaoBase.java
@@ -346,14 +346,14 @@ public abstract class GenericDaoBase<T, ID extends Serializable> extends Compone
     }
 
     @DB()
-    protected List<T> search(SearchCriteria<T> sc, final Filter filter, final Boolean lock, final boolean cache, final boolean enable_query_cache) {
+    protected List<T> search(SearchCriteria<T> sc, final Filter filter, final Boolean lock, final boolean cache, final boolean enableQueryCache) {
         if (_removed != null) {
             if (sc == null) {
                 sc = createSearchCriteria();
             }
             sc.addAnd(_removed.second().field.getName(), SearchCriteria.Op.NULL);
         }
-        return searchIncludingRemoved(sc, filter, lock, cache, enable_query_cache);
+        return searchIncludingRemoved(sc, filter, lock, cache, enableQueryCache);
     }
 
     @Override
@@ -362,13 +362,13 @@ public abstract class GenericDaoBase<T, ID extends Serializable> extends Compone
     }
 
     @Override
-    public List<T> searchIncludingRemoved(SearchCriteria<T> sc, final Filter filter, final Boolean lock, final boolean cache, final boolean enable_query_cache) {
+    public List<T> searchIncludingRemoved(SearchCriteria<T> sc, final Filter filter, final Boolean lock, final boolean cache, final boolean enableQueryCache) {
         String clause = sc != null ? sc.getWhereClause() : null;
         if (clause != null && clause.length() == 0) {
             clause = null;
         }
 
-        final StringBuilder str = createPartialSelectSql(sc, clause != null, enable_query_cache);
+        final StringBuilder str = createPartialSelectSql(sc, clause != null, enableQueryCache);
         if (clause != null) {
             str.append(clause);
         }
@@ -896,11 +896,11 @@ public abstract class GenericDaoBase<T, ID extends Serializable> extends Compone
     }
 
     @DB()
-    protected List<T> listBy(final SearchCriteria<T> sc, final Filter filter, final boolean enable_query_cache) {
+    protected List<T> listBy(final SearchCriteria<T> sc, final Filter filter, final boolean enableQueryCache) {
         if (_removed != null) {
             sc.addAnd(_removed.second().field.getName(), SearchCriteria.Op.NULL);
         }
-        return listIncludingRemovedBy(sc, filter, enable_query_cache);
+        return listIncludingRemovedBy(sc, filter, enableQueryCache);
     }
 
     @DB()
@@ -909,8 +909,8 @@ public abstract class GenericDaoBase<T, ID extends Serializable> extends Compone
     }
 
     @DB()
-    protected List<T> listIncludingRemovedBy(final SearchCriteria<T> sc, final Filter filter, final boolean enable_query_cache) {
-        return searchIncludingRemoved(sc, filter, null, false, enable_query_cache);
+    protected List<T> listIncludingRemovedBy(final SearchCriteria<T> sc, final Filter filter, final boolean enableQueryCache) {
+        return searchIncludingRemoved(sc, filter, null, false, enableQueryCache);
     }
 
     @DB()
@@ -1194,8 +1194,8 @@ public abstract class GenericDaoBase<T, ID extends Serializable> extends Compone
     }
 
     @DB()
-    protected StringBuilder createPartialSelectSql(SearchCriteria<?> sc, final boolean whereClause, final boolean enable_query_cache) {
-        StringBuilder sql = new StringBuilder(enable_query_cache ? _partialQueryCacheSelectSql.first() : _partialSelectSql.first());
+    protected StringBuilder createPartialSelectSql(SearchCriteria<?> sc, final boolean whereClause, final boolean enableQueryCache) {
+        StringBuilder sql = new StringBuilder(enableQueryCache ? _partialQueryCacheSelectSql.first() : _partialSelectSql.first());
         if (sc != null && !sc.isSelectAll()) {
             sql.delete(7, sql.indexOf(" FROM"));
             sc.getSelect(sql, 7);
@@ -1281,8 +1281,8 @@ public abstract class GenericDaoBase<T, ID extends Serializable> extends Compone
 
     @Override
     @DB()
-    public List<T> search(final SearchCriteria<T> sc, final Filter filter, final boolean enable_query_cache) {
-        return search(sc, filter, null, false, enable_query_cache);
+    public List<T> search(final SearchCriteria<T> sc, final Filter filter, final boolean enableQueryCache) {
+        return search(sc, filter, null, false, enableQueryCache);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/be5e5cc6/framework/db/src/com/cloud/utils/db/Merovingian2.java
----------------------------------------------------------------------
diff --git a/framework/db/src/com/cloud/utils/db/Merovingian2.java b/framework/db/src/com/cloud/utils/db/Merovingian2.java
index 59dff2d..6eeea9f 100644
--- a/framework/db/src/com/cloud/utils/db/Merovingian2.java
+++ b/framework/db/src/com/cloud/utils/db/Merovingian2.java
@@ -52,7 +52,7 @@ public class Merovingian2 extends StandardMBean implements MerovingianMBean {
     private static final String SELECT_THREAD_LOCKS_SQL = SELECT_SQL + " WHERE mac=? AND ip=?";
     private static final String CLEANUP_THREAD_LOCKS_SQL = "DELETE FROM op_lock WHERE mac=? AND ip=? AND thread=?";
 
-    TimeZone s_gmtTimeZone = TimeZone.getTimeZone("GMT");
+    TimeZone _gmtTimeZone = TimeZone.getTimeZone("GMT");
 
     private final long _msId;
 
@@ -184,7 +184,7 @@ public class Merovingian2 extends StandardMBean implements MerovingianMBean {
             pstmt.setLong(2, _msId);
             pstmt.setString(3, threadName);
             pstmt.setInt(4, threadId);
-            pstmt.setString(5, DateUtil.getDateDisplayString(s_gmtTimeZone, new Date()));
+            pstmt.setString(5, DateUtil.getDateDisplayString(_gmtTimeZone, new Date()));
             try {
                 int rows = pstmt.executeUpdate();
                 if (rows == 1) {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/be5e5cc6/framework/db/src/com/cloud/utils/db/SqlGenerator.java
----------------------------------------------------------------------
diff --git a/framework/db/src/com/cloud/utils/db/SqlGenerator.java b/framework/db/src/com/cloud/utils/db/SqlGenerator.java
index 2c24f62..befe34b 100755
--- a/framework/db/src/com/cloud/utils/db/SqlGenerator.java
+++ b/framework/db/src/com/cloud/utils/db/SqlGenerator.java
@@ -567,10 +567,10 @@ public class SqlGenerator {
         return sql.toString();
     }
 
-    public Pair<StringBuilder, Attribute[]> buildSelectSql(boolean enable_query_cache) {
+    public Pair<StringBuilder, Attribute[]> buildSelectSql(boolean enableQueryCache) {
         StringBuilder sql = new StringBuilder("SELECT ");
 
-        sql.append(enable_query_cache ? "SQL_CACHE " : "");
+        sql.append(enableQueryCache ? "SQL_CACHE " : "");
 
         ArrayList<Attribute> attrs = new ArrayList<Attribute>();
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/be5e5cc6/framework/db/src/com/cloud/utils/db/TransactionLegacy.java
----------------------------------------------------------------------
diff --git a/framework/db/src/com/cloud/utils/db/TransactionLegacy.java b/framework/db/src/com/cloud/utils/db/TransactionLegacy.java
index e5cece1..b36c027 100755
--- a/framework/db/src/com/cloud/utils/db/TransactionLegacy.java
+++ b/framework/db/src/com/cloud/utils/db/TransactionLegacy.java
@@ -1203,7 +1203,7 @@ public class TransactionLegacy {
         final ConnectionFactory connectionFactory = new DriverManagerConnectionFactory("jdbc:mysql://localhost:3306/" + database, "cloud", "cloud");
         final PoolableConnectionFactory poolableConnectionFactory = new PoolableConnectionFactory(connectionFactory, connectionPool, null, null, false, true);
         return new PoolingDataSource(
-        /* connectionPool */poolableConnectionFactory.getPool());
+            /* connectionPool */poolableConnectionFactory.getPool());
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/be5e5cc6/framework/db/test/com/cloud/utils/db/GlobalLockTest.java
----------------------------------------------------------------------
diff --git a/framework/db/test/com/cloud/utils/db/GlobalLockTest.java b/framework/db/test/com/cloud/utils/db/GlobalLockTest.java
index 8b0720b..c26f248 100644
--- a/framework/db/test/com/cloud/utils/db/GlobalLockTest.java
+++ b/framework/db/test/com/cloud/utils/db/GlobalLockTest.java
@@ -28,7 +28,7 @@ import com.cloud.utils.Profiler;
 @ContextConfiguration(locations = "classpath:/testContext.xml")
 public class GlobalLockTest {
     public static final Logger s_logger = Logger.getLogger(GlobalLockTest.class);
-    private final static GlobalLock _workLock = GlobalLock.getInternLock("SecurityGroupWork");
+    private final static GlobalLock WorkLock = GlobalLock.getInternLock("SecurityGroupWork");
 
     public static class Worker implements Runnable {
         int id = 0;
@@ -47,7 +47,7 @@ public class GlobalLockTest {
             try {
                 Profiler p = new Profiler();
                 p.start();
-                locked = _workLock.lock(timeoutSeconds);
+                locked = WorkLock.lock(timeoutSeconds);
                 p.stop();
                 System.out.println("Thread " + id + " waited " + p.getDuration() + " ms, locked=" + locked);
                 if (locked) {
@@ -56,7 +56,7 @@ public class GlobalLockTest {
             } catch (InterruptedException e) {
             } finally {
                 if (locked) {
-                    boolean unlocked = _workLock.unlock();
+                    boolean unlocked = WorkLock.unlock();
                     System.out.println("Thread " + id + "  unlocked=" + unlocked);
                 }
             }


Mime
View raw message