File tree Expand file tree Collapse file tree
server/src/test/java/org/apache/cloudstack/storage/heuristics Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1616// under the License.
1717package org .apache .cloudstack .storage .heuristics ;
1818
19+ import com .cloud .hypervisor .Hypervisor ;
20+ import com .cloud .storage .Storage ;
1921import com .cloud .storage .VMTemplateVO ;
2022import com .cloud .storage .VolumeVO ;
2123import com .cloud .utils .exception .CloudRuntimeException ;
2931import org .apache .cloudstack .utils .jsinterpreter .JsInterpreter ;
3032import org .apache .logging .log4j .Logger ;
3133import org .junit .Assert ;
34+ import org .junit .Before ;
3235import org .junit .Test ;
3336import org .junit .runner .RunWith ;
3437import org .mockito .InjectMocks ;
@@ -68,6 +71,19 @@ public class HeuristicRuleHelperTest {
6871 @ InjectMocks
6972 HeuristicRuleHelper heuristicRuleHelperSpy = new HeuristicRuleHelper ();
7073
74+ @ Before
75+ public void setUp () {
76+ Mockito .doReturn ("template-name" ).when (vmTemplateVOMock ).getName ();
77+ Mockito .doReturn (Storage .ImageFormat .QCOW2 ).when (vmTemplateVOMock ).getFormat ();
78+ Mockito .doReturn (Hypervisor .HypervisorType .KVM ).when (vmTemplateVOMock ).getHypervisorType ();
79+ Mockito .doReturn ("snapshot-name" ).when (snapshotInfoMock ).getName ();
80+ Mockito .doReturn (1024L ).when (snapshotInfoMock ).getSize ();
81+ Mockito .doReturn (Hypervisor .HypervisorType .VMware ).when (snapshotInfoMock ).getHypervisorType ();
82+ Mockito .doReturn ("volume-name" ).when (volumeVOMock ).getName ();
83+ Mockito .doReturn (Storage .ImageFormat .RAW ).when (volumeVOMock ).getFormat ();
84+ Mockito .doReturn (2048L ).when (volumeVOMock ).getSize ();
85+ }
86+
7187 @ Test
7288 public void getImageStoreIfThereIsHeuristicRuleTestZoneDoesNotHaveHeuristicRuleShouldReturnNull () {
7389 Long zoneId = 1L ;
You can’t perform that action at this time.
0 commit comments