Search in sources :

Example 1 with TaggedResourceService

use of com.cloud.server.TaggedResourceService in project cloudstack by apache.

the class VolumeApiServiceImplTest method testTakeSnapshotF2.

@Test
public void testTakeSnapshotF2() throws ResourceAllocationException {
    when(volumeDataFactoryMock.getVolume(anyLong())).thenReturn(volumeInfoMock);
    when(volumeInfoMock.getState()).thenReturn(Volume.State.Ready);
    when(volumeInfoMock.getInstanceId()).thenReturn(null);
    when(volumeInfoMock.getPoolId()).thenReturn(1L);
    when(volumeServiceMock.takeSnapshot(Mockito.any(VolumeInfo.class))).thenReturn(snapshotInfoMock);
    final TaggedResourceService taggedResourceService = Mockito.mock(TaggedResourceService.class);
    Mockito.lenient().when(taggedResourceService.createTags(anyObject(), anyObject(), anyObject(), anyObject())).thenReturn(null);
    ReflectionTestUtils.setField(volumeApiServiceImpl, "taggedResourceService", taggedResourceService);
    volumeApiServiceImpl.takeSnapshot(5L, Snapshot.MANUAL_POLICY_ID, 3L, null, false, null, false, null);
}
Also used : VolumeInfo(org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo) TaggedResourceService(com.cloud.server.TaggedResourceService) Test(org.junit.Test)

Aggregations

TaggedResourceService (com.cloud.server.TaggedResourceService)1 VolumeInfo (org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo)1 Test (org.junit.Test)1