FSQueueMetrics extends QueueMetrics { public void setSteadyFairShare(Resource resource) { steadyFairShareMB.set(resource.getMemorySize()); steadyFairShareVCores.set(resource.getVirtualCores()); if (customResources != null) { customResources.setSteadyFairShare(resource); } } FSQueueMetrics(MetricsSystem ms, String queueName, Queue parent,
      boolean enableUserMetrics, Configuration conf); Resource getFairShare(); void setFairShare(Resource resource); long getSteadyFairShareMB(); long getSteadyFairShareVCores(); Resource getSteadyFairShare(); void setSteadyFairShare(Resource resource); long getMinShareMB(); long getMinShareVirtualCores(); Resource getMinShare(); void setMinShare(Resource resource); long getMaxShareMB(); long getMaxShareVirtualCores(); Resource getMaxShare(); void setMaxShare(Resource resource); int getMaxApps(); void setMaxApps(int max); long getMaxAMShareMB(); int getMaxAMShareVCores(); Resource getMaxAMShare(); void setMaxAMShare(Resource resource); long getAMResourceUsageMB(); int getAMResourceUsageVCores(); Resource getAMResourceUsage(); void setAMResourceUsage(Resource resource); @Metric("Scheduling policy") String getSchedulingPolicy(); void setSchedulingPolicy(String policy); synchronized static FSQueueMetrics forQueue(String queueName, Queue parent,
      boolean enableUserMetrics, Configuration conf); @VisibleForTesting synchronized static FSQueueMetrics forQueue(MetricsSystem ms, String queueName,
      Queue parent, boolean enableUserMetrics, Configuration conf);  }
@Test public void testSetSteadyFairShare() { FSQueueMetrics metrics = setupMetrics(RESOURCE_NAME); Resource res = Resource.newInstance(2048L, 4, ImmutableMap.of(RESOURCE_NAME, 20L)); metrics.setSteadyFairShare(res); assertEquals(getErrorMessage("steadyFairShareMB"), 2048L, metrics.getSteadyFairShareMB()); assertEquals(getErrorMessage("steadyFairShareVcores"), 4L, metrics.getSteadyFairShareVCores()); Resource steadyFairShare = metrics.getSteadyFairShare(); assertEquals(getErrorMessage("steadyFairShareMB"), 2048L, steadyFairShare.getMemorySize()); assertEquals(getErrorMessage("steadyFairShareVcores"), 4L, steadyFairShare.getVirtualCores()); assertEquals(getErrorMessage("steadyFairShare for resource: " + RESOURCE_NAME), 20L, steadyFairShare.getResourceValue(RESOURCE_NAME)); res = Resource.newInstance(2049L, 5); metrics.setSteadyFairShare(res); assertEquals(getErrorMessage("steadyFairShareMB"), 2049L, metrics.getSteadyFairShareMB()); assertEquals(getErrorMessage("steadyFairShareVcores"), 5L, metrics.getSteadyFairShareVCores()); steadyFairShare = metrics.getSteadyFairShare(); assertEquals(getErrorMessage("steadyFairShareMB"), 2049L, steadyFairShare.getMemorySize()); assertEquals(getErrorMessage("steadyFairShareVcores"), 5L, steadyFairShare.getVirtualCores()); assertEquals(getErrorMessage("steadyFairShare for resource: " + RESOURCE_NAME), 0, steadyFairShare.getResourceValue(RESOURCE_NAME)); }