@Test void testRoleConfigsWithSingleVolume() { HostgroupView hostGroup = hostGroupWithVolumeCount(1); assertEquals(List.of( config("fs_wal_dir", "/hadoopfs/fs1/kudu/master"), config("fs_data_dirs", "/hadoopfs/fs1/kudu/master")), subject.getRoleConfigs(KuduRoles.KUDU_MASTER, hostGroup, getTemplatePreparationObject(hostGroup)) ); assertEquals(List.of( config("fs_wal_dir", "/hadoopfs/fs1/kudu/tserver"), config("fs_data_dirs", "/hadoopfs/fs1/kudu/tserver")), subject.getRoleConfigs(KuduRoles.KUDU_TSERVER, hostGroup, getTemplatePreparationObject(hostGroup)) ); }
@Override public List<ApiClusterTemplateConfig> getRoleConfigs(String roleType, HostgroupView hostGroupView, TemplatePreparationObject source) { switch (roleType) { case KuduRoles.KUDU_MASTER: case KuduRoles.KUDU_TSERVER: String directorySuffix = KuduRoles.KUDU_MASTER.equals(roleType) ? "kudu/master" : "kudu/tserver"; Integer walVolumeCount = hostGroupView.getVolumeCount() > 0 ? 1 : 0; Integer dataDirVolumeIndex = hostGroupView.getVolumeCount() <= 1 ? 1 : 2; return List.of( config(KUDU_FS_WAL_DIRS, buildVolumePathStringZeroVolumeHandled(walVolumeCount, directorySuffix)), config(KUDU_FS_DATA_DIRS, buildVolumePathFromVolumeIndexZeroVolumeHandled(dataDirVolumeIndex, hostGroupView.getVolumeCount(), directorySuffix)) ); default: return List.of(); } }
KuduVolumeConfigProvider implements CmHostGroupRoleConfigProvider { @Override public List<ApiClusterTemplateConfig> getRoleConfigs(String roleType, HostgroupView hostGroupView, TemplatePreparationObject source) { switch (roleType) { case KuduRoles.KUDU_MASTER: case KuduRoles.KUDU_TSERVER: String directorySuffix = KuduRoles.KUDU_MASTER.equals(roleType) ? "kudu/master" : "kudu/tserver"; Integer walVolumeCount = hostGroupView.getVolumeCount() > 0 ? 1 : 0; Integer dataDirVolumeIndex = hostGroupView.getVolumeCount() <= 1 ? 1 : 2; return List.of( config(KUDU_FS_WAL_DIRS, buildVolumePathStringZeroVolumeHandled(walVolumeCount, directorySuffix)), config(KUDU_FS_DATA_DIRS, buildVolumePathFromVolumeIndexZeroVolumeHandled(dataDirVolumeIndex, hostGroupView.getVolumeCount(), directorySuffix)) ); default: return List.of(); } } }
KuduVolumeConfigProvider implements CmHostGroupRoleConfigProvider { @Override public List<ApiClusterTemplateConfig> getRoleConfigs(String roleType, HostgroupView hostGroupView, TemplatePreparationObject source) { switch (roleType) { case KuduRoles.KUDU_MASTER: case KuduRoles.KUDU_TSERVER: String directorySuffix = KuduRoles.KUDU_MASTER.equals(roleType) ? "kudu/master" : "kudu/tserver"; Integer walVolumeCount = hostGroupView.getVolumeCount() > 0 ? 1 : 0; Integer dataDirVolumeIndex = hostGroupView.getVolumeCount() <= 1 ? 1 : 2; return List.of( config(KUDU_FS_WAL_DIRS, buildVolumePathStringZeroVolumeHandled(walVolumeCount, directorySuffix)), config(KUDU_FS_DATA_DIRS, buildVolumePathFromVolumeIndexZeroVolumeHandled(dataDirVolumeIndex, hostGroupView.getVolumeCount(), directorySuffix)) ); default: return List.of(); } }  }
KuduVolumeConfigProvider implements CmHostGroupRoleConfigProvider { @Override public List<ApiClusterTemplateConfig> getRoleConfigs(String roleType, HostgroupView hostGroupView, TemplatePreparationObject source) { switch (roleType) { case KuduRoles.KUDU_MASTER: case KuduRoles.KUDU_TSERVER: String directorySuffix = KuduRoles.KUDU_MASTER.equals(roleType) ? "kudu/master" : "kudu/tserver"; Integer walVolumeCount = hostGroupView.getVolumeCount() > 0 ? 1 : 0; Integer dataDirVolumeIndex = hostGroupView.getVolumeCount() <= 1 ? 1 : 2; return List.of( config(KUDU_FS_WAL_DIRS, buildVolumePathStringZeroVolumeHandled(walVolumeCount, directorySuffix)), config(KUDU_FS_DATA_DIRS, buildVolumePathFromVolumeIndexZeroVolumeHandled(dataDirVolumeIndex, hostGroupView.getVolumeCount(), directorySuffix)) ); default: return List.of(); } }  @Override List<ApiClusterTemplateConfig> getRoleConfigs(String roleType, HostgroupView hostGroupView, TemplatePreparationObject source); @Override String getServiceType(); @Override Set<String> getRoleTypes(); @Override boolean sharedRoleType(String roleType); }
KuduVolumeConfigProvider implements CmHostGroupRoleConfigProvider { @Override public List<ApiClusterTemplateConfig> getRoleConfigs(String roleType, HostgroupView hostGroupView, TemplatePreparationObject source) { switch (roleType) { case KuduRoles.KUDU_MASTER: case KuduRoles.KUDU_TSERVER: String directorySuffix = KuduRoles.KUDU_MASTER.equals(roleType) ? "kudu/master" : "kudu/tserver"; Integer walVolumeCount = hostGroupView.getVolumeCount() > 0 ? 1 : 0; Integer dataDirVolumeIndex = hostGroupView.getVolumeCount() <= 1 ? 1 : 2; return List.of( config(KUDU_FS_WAL_DIRS, buildVolumePathStringZeroVolumeHandled(walVolumeCount, directorySuffix)), config(KUDU_FS_DATA_DIRS, buildVolumePathFromVolumeIndexZeroVolumeHandled(dataDirVolumeIndex, hostGroupView.getVolumeCount(), directorySuffix)) ); default: return List.of(); } }  @Override List<ApiClusterTemplateConfig> getRoleConfigs(String roleType, HostgroupView hostGroupView, TemplatePreparationObject source); @Override String getServiceType(); @Override Set<String> getRoleTypes(); @Override boolean sharedRoleType(String roleType);  }