public static Path getClusterHighAvailableStoragePath(Configuration configuration) {
        final String storagePath = configuration.getValue(HighAvailabilityOptions.HA_STORAGE_PATH);

        if (isNullOrWhitespaceOnly(storagePath)) {
            throw new IllegalConfigurationException(
                    "Configuration is missing the mandatory parameter: "
                            + HighAvailabilityOptions.HA_STORAGE_PATH);
        }

        final Path path;
        try {
            path = new Path(storagePath);
        } catch (Exception e) {
            throw new IllegalConfigurationException(
                    "Invalid path for highly available storage ("
                            + HighAvailabilityOptions.HA_STORAGE_PATH.key()
                            + ')',
                    e);
        }

        final String clusterId = configuration.getValue(HighAvailabilityOptions.HA_CLUSTER_ID);

        final Path clusterStoragePath;

        try {
            clusterStoragePath = new Path(path, clusterId);
        } catch (Exception e) {
            throw new IllegalConfigurationException(
                    String.format(
                            "Cannot create cluster high available storage path '%s/%s'. This indicates that an invalid cluster id (%s) has been specified.",
                            storagePath, clusterId, HighAvailabilityOptions.HA_CLUSTER_ID.key()),
                    e);
        }
        return clusterStoragePath;
    }
@Test
    public void testGetClusterHighAvailableStoragePath() throws IOException {
        final String haStorageRootDirectory = temporaryFolder.newFolder().getAbsolutePath();
        final String clusterId = UUID.randomUUID().toString();
        final Configuration configuration = new Configuration();

        configuration.set(HighAvailabilityOptions.HA_STORAGE_PATH, haStorageRootDirectory);
        configuration.set(HighAvailabilityOptions.HA_CLUSTER_ID, clusterId);

        final Path clusterHighAvailableStoragePath =
                HighAvailabilityServicesUtils.getClusterHighAvailableStoragePath(configuration);

        final Path expectedPath = new Path(haStorageRootDirectory, clusterId);
        assertThat(clusterHighAvailableStoragePath, is(expectedPath));
    }