You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ra...@apache.org on 2018/05/16 20:14:14 UTC

[cloudstack] branch master updated: Re-add code that was missed during merge forward of PR#2629

This is an automated email from the ASF dual-hosted git repository.

rafael pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cloudstack.git


The following commit(s) were added to refs/heads/master by this push:
     new 0afba54  Re-add code that was missed during merge forward of PR#2629
0afba54 is described below

commit 0afba54cd52444546425911429aaa8664c04254b
Author: Rafael Weingärtner <ra...@gmail.com>
AuthorDate: Wed May 16 17:13:50 2018 -0300

    Re-add code that was missed during merge forward of PR#2629
---
 .../com/cloud/storage/VolumeApiServiceImplTest.java    | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/server/src/test/java/com/cloud/storage/VolumeApiServiceImplTest.java b/server/src/test/java/com/cloud/storage/VolumeApiServiceImplTest.java
index ddcf475..8ae122d 100644
--- a/server/src/test/java/com/cloud/storage/VolumeApiServiceImplTest.java
+++ b/server/src/test/java/com/cloud/storage/VolumeApiServiceImplTest.java
@@ -172,7 +172,15 @@ public class VolumeApiServiceImplTest {
     private long volumeSizeMock = 456789921939l;
 
     @Before
-    public void before() throws Exception {
+    public void setup() throws InterruptedException, ExecutionException {
+        Mockito.doReturn(volumeMockId).when(volumeDataStoreVoMock).getVolumeId();
+        Mockito.doReturn(volumeMockId).when(volumeVoMock).getId();
+        Mockito.doReturn(accountMockId).when(accountMock).getId();
+        Mockito.doReturn(volumeSizeMock).when(volumeVoMock).getSize();
+        Mockito.doReturn(volumeSizeMock).when(newDiskOfferingMock).getDiskSize();
+
+        Mockito.doReturn(Mockito.mock(VolumeApiResult.class)).when(asyncCallFutureVolumeapiResultMock).get();
+
         Mockito.when(storagePoolMock.getId()).thenReturn(storagePoolMockId);
 
         volumeApiServiceImpl._gson = GsonHelper.getGsonLogger();
@@ -476,8 +484,8 @@ public class VolumeApiServiceImplTest {
      */
     @Test
     public void testResourceLimitCheckForUploadedVolume() throws NoSuchFieldException, IllegalAccessException, ResourceAllocationException {
-        doThrow(new ResourceAllocationException("primary storage resource limit check failed", Resource.ResourceType.primary_storage)).when(resourceLimitServiceMock).checkResourceLimit(any(AccountVO.class),
-                any(Resource.ResourceType.class), any(Long.class));
+        doThrow(new ResourceAllocationException("primary storage resource limit check failed", Resource.ResourceType.primary_storage)).when(resourceLimitServiceMock)
+        .checkResourceLimit(any(AccountVO.class), any(Resource.ResourceType.class), any(Long.class));
         UserVmVO vm = Mockito.mock(UserVmVO.class);
         VolumeInfo volumeToAttach = Mockito.mock(VolumeInfo.class);
         when(volumeToAttach.getId()).thenReturn(9L);
@@ -811,7 +819,7 @@ public class VolumeApiServiceImplTest {
     }
 
     @Test(expected = InterruptedException.class)
-    public void expungeVolumesInSecondaryStorageIfNeededTestthrowinInterruptedException() throws InterruptedException, ExecutionException {
+    public void expungeVolumesInSecondaryStorageIfNeededTestThrowinInterruptedException() throws InterruptedException, ExecutionException {
         Mockito.doReturn(asyncCallFutureVolumeapiResultMock).when(volumeServiceMock).expungeVolumeAsync(volumeInfoMock);
         Mockito.doReturn(volumeInfoMock).when(volumeDataFactoryMock).getVolume(volumeMockId, DataStoreRole.Image);
         Mockito.doNothing().when(resourceLimitServiceMock).decrementResourceCount(accountMockId, ResourceType.secondary_storage, volumeSizeMock);
@@ -825,7 +833,7 @@ public class VolumeApiServiceImplTest {
     }
 
     @Test(expected = ExecutionException.class)
-    public void expungeVolumesInSecondaryStorageIfNeededTestthrowinExecutionException() throws InterruptedException, ExecutionException {
+    public void expungeVolumesInSecondaryStorageIfNeededTestThrowingExecutionException() throws InterruptedException, ExecutionException {
         Mockito.doReturn(asyncCallFutureVolumeapiResultMock).when(volumeServiceMock).expungeVolumeAsync(volumeInfoMock);
         Mockito.doReturn(volumeInfoMock).when(volumeDataFactoryMock).getVolume(volumeMockId, DataStoreRole.Image);
         Mockito.doNothing().when(resourceLimitServiceMock).decrementResourceCount(accountMockId, ResourceType.secondary_storage, volumeSizeMock);

-- 
To stop receiving notification emails like this one, please contact
rafael@apache.org.