1+ /*
2+ * Licensed to the Apache Software Foundation (ASF) under one
3+ * or more contributor license agreements. See the NOTICE file
4+ * distributed with this work for additional information
5+ * regarding copyright ownership. The ASF licenses this file
6+ * to you under the Apache License, Version 2.0 (the
7+ * "License"); you may not use this file except in compliance
8+ * with the License. You may obtain a copy of the License at
9+ *
10+ * http://www.apache.org/licenses/LICENSE-2.0
11+ *
12+ * Unless required by applicable law or agreed to in writing,
13+ * software distributed under the License is distributed on an
14+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+ * KIND, either express or implied. See the License for the
16+ * specific language governing permissions and limitations
17+ * under the License.
18+ */
19+ package org .apache .cloudstack .storage .lifecycle ;
20+
21+ import org .junit .jupiter .api .BeforeEach ;
22+ import org .junit .jupiter .api .Test ;
23+ import org .junit .jupiter .api .extension .ExtendWith ;
24+ import org .mockito .InjectMocks ;
25+ import org .mockito .Mock ;
26+ import org .mockito .MockedStatic ;
27+ import org .mockito .Mockito ;
28+ import org .mockito .junit .jupiter .MockitoExtension ;
29+ import org .mockito .junit .jupiter .MockitoSettings ;
30+ import org .mockito .quality .Strictness ;
31+ import org .apache .cloudstack .storage .feign .model .Volume ;
32+ import com .cloud .dc .dao .ClusterDao ;
33+ import com .cloud .utils .exception .CloudRuntimeException ;
34+ import com .cloud .dc .ClusterVO ;
35+ import com .cloud .host .HostVO ;
36+ import com .cloud .resource .ResourceManager ;
37+ import com .cloud .storage .StorageManager ;
38+ import org .apache .cloudstack .engine .subsystem .api .storage .ClusterScope ;
39+ import org .apache .cloudstack .engine .subsystem .api .storage .DataStore ;
40+ import org .apache .cloudstack .engine .subsystem .api .storage .PrimaryDataStoreInfo ;
41+ import org .apache .cloudstack .engine .subsystem .api .storage .ZoneScope ;
42+ import org .apache .cloudstack .storage .datastore .db .StoragePoolDetailsDao ;
43+ import org .apache .cloudstack .storage .service .model .AccessGroup ;
44+ import com .cloud .hypervisor .Hypervisor ;
45+ import java .util .Map ;
46+ import java .util .List ;
47+ import java .util .ArrayList ;
48+ import static org .mockito .ArgumentMatchers .any ;
49+ import static org .mockito .ArgumentMatchers .anyLong ;
50+ import static org .mockito .ArgumentMatchers .eq ;
51+ import static org .mockito .Mockito .when ;
52+ import static org .mockito .Mockito .verify ;
53+ import static org .mockito .Mockito .times ;
54+ import static org .mockito .Mockito .withSettings ;
55+ import static org .junit .jupiter .api .Assertions .assertThrows ;
56+ import static org .junit .jupiter .api .Assertions .assertTrue ;
57+ import static org .junit .jupiter .api .Assertions .assertFalse ;
58+ import java .util .HashMap ;
59+ import org .apache .cloudstack .storage .provider .StorageProviderFactory ;
60+ import org .apache .cloudstack .storage .service .StorageStrategy ;
61+ import org .apache .cloudstack .storage .volume .datastore .PrimaryDataStoreHelper ;
62+ import org .apache .cloudstack .storage .utils .Utility ;
63+
64+
65+ @ ExtendWith (MockitoExtension .class )
66+ @ MockitoSettings (strictness = Strictness .LENIENT )
67+ public class OntapPrimaryDatastoreLifecycleTest {
68+ @ InjectMocks
69+ private OntapPrimaryDatastoreLifecycle ontapPrimaryDatastoreLifecycle ;
70+
71+ @ Mock
72+ private ClusterDao _clusterDao ;
73+
74+ @ Mock
75+ private StorageStrategy storageStrategy ;
76+
77+ @ Mock
78+ private PrimaryDataStoreHelper _dataStoreHelper ;
79+
80+ @ Mock
81+ private ResourceManager _resourceMgr ;
82+
83+ @ Mock
84+ private StorageManager _storageMgr ;
85+
86+ @ Mock
87+ private StoragePoolDetailsDao storagePoolDetailsDao ;
88+
89+ // Mock object that implements both DataStore and PrimaryDataStoreInfo
90+ // This is needed because attachCluster(DataStore) casts DataStore to PrimaryDataStoreInfo internally
91+ private DataStore dataStore ;
92+
93+ @ Mock
94+ private ClusterScope clusterScope ;
95+
96+ @ Mock
97+ private ZoneScope zoneScope ;
98+
99+ private List <HostVO > mockHosts ;
100+ private Map <String , String > poolDetails ;
101+
102+ }
0 commit comments