NodeGroupCreate { public static String[] getImagestoreNamePattern(ClusterCreate clusterSpec, NodeGroupCreate nodeGroupSpec) { AuAssert.check(nodeGroupSpec != null && nodeGroupSpec.getStorage() != null); String[] patterns; StorageRead storage = nodeGroupSpec.getStorage(); if (storage.getImagestoreNamePattern() != null && !storage.getImagestoreNamePattern().isEmpty()) { patterns = storage.getImagestoreNamePattern().toArray( new String[storage.getImagestoreNamePattern().size()]); } else { return getDiskstoreNamePattern(clusterSpec, nodeGroupSpec); } return patterns; } NodeGroupCreate();  NodeGroupCreate(NodeGroupCreate group); NodeGroupInfo toNodeGroupInfo(); Map<String, Object> getConfiguration(); void setConfiguration(Map<String, Object> configuration); @RestRequired String getName(); void setName(String name); @RestRequired List<String> getRoles(); void setRoles(List<String> roles); int getInstanceNum(); void setInstanceNum(int instanceNum); InstanceType getInstanceType(); void setInstanceType(InstanceType instanceType); PlacementPolicy getPlacementPolicies(); void setPlacementPolicies(PlacementPolicy placementPolicies); Integer getCpuNum(); void setCpuNum(Integer cpuNum); Integer getMemCapacityMB(); void setMemCapacityMB(Integer memCapacityMB); Float getSwapRatio(); void setSwapRatio(Float swapRatio); StorageRead getStorage(); void setStorage(StorageRead storage); List<String> getRpNames(); void setRpNames(List<String> rpNames); String getHaFlag(); void setHaFlag(String haFlag); LatencyPriority getLatencySensitivity(); void setLatencySensitivity(LatencyPriority latencySensitivity); Float getReservedCpuRatio(); void setReservedCpuRatio(
         Float reservedCpuRatio); Float getReservedMemRatio(); void setReservedMemRatio(
         Float reservedMemRatio); @RestIgnore List<VcCluster> getVcClusters(ClusterCreate cluster); void setVcClusters(List<VcCluster> vcClusters); @RestIgnore String getVmFolderPath(); void setVmFolderPath(String vmFolderPath); Integer calculateHostNum(); @JsonIgnore String getReferredGroup(); @JsonIgnore boolean isStrictReferred(); Integer instancePerHost(); boolean validatePlacementPolicies(ClusterCreate cluster,
         Map<String, NodeGroupCreate> groups, List<String> failedMsgList,
         List<String> warningMsgList); static String[] getImagestoreNamePattern(ClusterCreate clusterSpec,
         NodeGroupCreate nodeGroupSpec); static String[] getDiskstoreNamePattern(ClusterCreate clusterSpec,
         NodeGroupCreate nodeGroupSpec);  }
@SuppressWarnings("static-access") @Test public void testGetImagestoreNamePattern() { ClusterCreate cluster = new ClusterCreate(); NodeGroupCreate worker = new NodeGroupCreate(); StorageRead storage = new StorageRead(); storage.setType("shared"); storage.setImagestoreNamePattern(Arrays.asList("st_imagestore")); worker.setStorage(storage); Set<String> sharedDatastorePattern = new HashSet<String>(); sharedDatastorePattern.add("cluster_shared.*"); Set<String> localDatastorePattern = new HashSet<String>(); localDatastorePattern.add("cluster_local.*"); cluster.setSharedDatastorePattern(sharedDatastorePattern); cluster.setLocalDatastorePattern(localDatastorePattern); cluster.setNodeGroups(new NodeGroupCreate[] { worker }); assertEquals("st_imagestore", worker.getImagestoreNamePattern(cluster, worker)[0]); storage.setImagestoreNamePattern(null); storage.setDiskstoreNamePattern(Arrays.asList("st_diskstore")); worker.setStorage(storage); assertEquals("st_diskstore", worker.getImagestoreNamePattern(cluster, worker)[0]); storage.setDiskstoreNamePattern(null); worker.setStorage(storage); assertEquals("cluster_shared.*", worker.getImagestoreNamePattern(cluster, worker)[0]); storage.setType(""); assertEquals("cluster_local.*", worker.getImagestoreNamePattern(cluster, worker)[0]); localDatastorePattern.clear(); cluster.setLocalDatastorePattern(localDatastorePattern); assertEquals("cluster_shared.*", worker.getImagestoreNamePattern(cluster, worker)[0]); }