public QueueCapacityVector parse(String capacityString, QueuePath queuePath) {

    if (queuePath.isRoot()) {
      return QueueCapacityVector.of(100f, ResourceUnitCapacityType.PERCENTAGE);
    }

    if (capacityString == null) {
      return new QueueCapacityVector();
    }
    // Trim all spaces from capacity string
    capacityString = capacityString.replaceAll(" ", "");

    for (Parser parser : parsers) {
      Matcher matcher = parser.regex.matcher(capacityString);
      if (matcher.find()) {
        return parser.parser.apply(matcher);
      }
    }

    return new QueueCapacityVector();
  }
@Test
  public void testAbsoluteCapacityVectorConfig() {
    CapacitySchedulerConfiguration conf = new CapacitySchedulerConfiguration();
    conf.set(getQueuePrefix(QUEUE_PATH) + CapacitySchedulerConfiguration.CAPACITY,
        ABSOLUTE_RESOURCE);
    conf.set(YarnConfiguration.RESOURCE_TYPES, RESOURCE_TYPES);
    ResourceUtils.resetResourceTypes(conf);

    QueueCapacityVector absoluteCapacityVector = capacityConfigParser.parse(ABSOLUTE_RESOURCE,
        QUEUE_PATH);

    Assert.assertEquals(ResourceUnitCapacityType.ABSOLUTE,
        absoluteCapacityVector.getResource(MEMORY_URI).getVectorResourceType());
    Assert.assertEquals(12 * GB, absoluteCapacityVector.getResource(MEMORY_URI)
        .getResourceValue(), EPSILON);

    Assert.assertEquals(ResourceUnitCapacityType.ABSOLUTE,
        absoluteCapacityVector.getResource(VCORES_URI).getVectorResourceType());
    Assert.assertEquals(VCORE_ABSOLUTE, absoluteCapacityVector.getResource(VCORES_URI)
        .getResourceValue(), EPSILON);

    Assert.assertEquals(ResourceUnitCapacityType.ABSOLUTE,
        absoluteCapacityVector.getResource(GPU_URI).getVectorResourceType());
    Assert.assertEquals(GPU_ABSOLUTE, absoluteCapacityVector.getResource(GPU_URI)
        .getResourceValue(), EPSILON);

    QueueCapacityVector withoutGpuVector = capacityConfigParser
        .parse(ABSOLUTE_RESOURCE_MEMORY_VCORE, QUEUE_PATH);

    Assert.assertEquals(3, withoutGpuVector.getResourceCount());
    Assert.assertEquals(0f, withoutGpuVector.getResource(GPU_URI).getResourceValue(), EPSILON);
  }