### Question:
SchemaRegistryJarStorageConfigProvider implements CmHostGroupRoleConfigProvider { @Override public List<ApiClusterTemplateConfig> getRoleConfigs(String roleType, HostgroupView hostGroupView, TemplatePreparationObject source) { CdhVersionForStreaming cdhVersionForStreaming = KafkaConfigProviderUtils.getCdhVersionForStreaming(source); if (cdhVersionForStreaming.supportsCloudJarStorage()) { return List.of( config(CONFIG_JAR_STORAGE_DIRECTORY_PATH, "/schema-registry"), config(CONFIG_JAR_STORAGE_TYPE, "hdfs")); } else { Integer volumeCount = Objects.nonNull(hostGroupView) && hostGroupView.getVolumeCount() > 0 ? 1 : 0; String localPath = buildVolumePathStringZeroVolumeHandled(volumeCount, "schema_registry"); return List.of( config(CONFIG_JAR_STORAGE_DIRECTORY_PATH, localPath)); } }  @Override List<ApiClusterTemplateConfig> getRoleConfigs(String roleType, HostgroupView hostGroupView, TemplatePreparationObject source); @Override String getServiceType(); @Override Set<String> getRoleTypes(); @Override boolean sharedRoleType(String roleType); static final String CONFIG_JAR_STORAGE_DIRECTORY_PATH; static final String CONFIG_JAR_STORAGE_TYPE; }### Answer:
@Test void testRoleConfigsWithMultipleVolumes() { HostgroupView hostGroup = hostGroupWithVolumeCount(3); assertEquals(List.of( config("schema.registry.jar.storage.directory.path", "/hadoopfs/fs1/schema_registry")), subject.getRoleConfigs(SCHEMA_REGISTRY_SERVER, hostGroup, getTemplatePreparationObject(hostGroup)) ); }
@Test void testRoleConfigsWithSingleVolume() { HostgroupView hostGroup = hostGroupWithVolumeCount(1); assertEquals(List.of( config("schema.registry.jar.storage.directory.path", "/hadoopfs/fs1/schema_registry")), subject.getRoleConfigs(SCHEMA_REGISTRY_SERVER, hostGroup, getTemplatePreparationObject(hostGroup)) ); }
@Test void testRoleConfigsWithoutVolumes() { HostgroupView hostGroup = hostGroupWithVolumeCount(0); assertEquals(List.of( config("schema.registry.jar.storage.directory.path", "/hadoopfs/root1/schema_registry")), subject.getRoleConfigs(SCHEMA_REGISTRY_SERVER, hostGroup, getTemplatePreparationObject(hostGroup)) ); }
@Test void testCloudStorageIsChosenWhenCdhVersionIsAtLeast711() { cdhMainVersionIs("7.2.0"); TemplatePreparationObject tpo = getTemplatePreparationObject(1); HostgroupView hostGroup = tpo.getHostGroupsWithComponent(SCHEMA_REGISTRY_SERVER).findFirst().get(); assertEquals(List.of( config(CONFIG_JAR_STORAGE_DIRECTORY_PATH, "/schema-registry"), config(CONFIG_JAR_STORAGE_TYPE, "hdfs")), subject.getRoleConfigs(SCHEMA_REGISTRY_SERVER, hostGroup, tpo)); }
@Test void testLocalStorageIsChosenWhenSingleSchemaRegistryInstance() { cdhMainVersionIs("7.1.0"); TemplatePreparationObject tpo = getTemplatePreparationObject(1); HostgroupView hostGroup = tpo.getHostGroupsWithComponent(SCHEMA_REGISTRY_SERVER).findFirst().get(); assertEquals(List.of( config(CONFIG_JAR_STORAGE_DIRECTORY_PATH, "/hadoopfs/root1/schema_registry")), subject.getRoleConfigs(SCHEMA_REGISTRY_SERVER, hostGroup, tpo)); }