public static URI generateSegmentMetadataURI(String segmentTarPath, String segmentName)
      throws URISyntaxException {
    URI segmentTarURI = URI.create(segmentTarPath);
    URI metadataTarGzFilePath = new URI(
        segmentTarURI.getScheme(),
        segmentTarURI.getUserInfo(),
        segmentTarURI.getHost(),
        segmentTarURI.getPort(),
        new File(segmentTarURI.getPath()).getParentFile() + File.separator + segmentName
            + Constants.METADATA_TAR_GZ_FILE_EXT,
        segmentTarURI.getQuery(),
        segmentTarURI.getFragment());
    return metadataTarGzFilePath;
  }
@Test
  public void testGenerateSegmentMetadataURI()
      throws URISyntaxException {
    assertEquals(
        SegmentPushUtils.generateSegmentMetadataURI("/a/b/c/my-segment.tar.gz", "my-segment"),
        URI.create("/a/b/c/my-segment.metadata.tar.gz"));

    assertEquals(
        SegmentPushUtils.generateSegmentMetadataURI("s3://a/b/c/my-segment.tar.gz", "my-segment"),
        URI.create("s3://a/b/c/my-segment.metadata.tar.gz"));

    assertEquals(
        SegmentPushUtils.generateSegmentMetadataURI("hdfs://a/b/c/my-segment.tar.gz", "my-segment"),
        URI.create("hdfs://a/b/c/my-segment.metadata.tar.gz"));
  }