### Question:
DAOSOAMetricsQueryServiceProvider implements SOAMetricsQueryServiceProvider { @Override public List<String> getMetricsMetadata(String resourceEntityType, List<String> resourceEntityName, String resourceEntityResponseType) { return delegate.getMetricsMetadata(resourceEntityType, resourceEntityName, resourceEntityResponseType); } DAOSOAMetricsQueryServiceProvider();  DAOSOAMetricsQueryServiceProvider(EntityManagerFactory entityManagerFactory); @Override List<MetricData> getCustomReportData(ReportCriteria reportCriteria, MetricCriteria metricCriteria); @Override List<MetricData> getDetailData(String dc, MetricCriteria metricCriteria,
                    MetricResourceCriteria metricResourceCriteria); @Override List<MetricGraphData> getErrorGraph(String serviceName, String operationName, String consumerName,
                    String errorId, String errorCategory, String errorSeverity, MetricCriteria metricCriteria); @Override List<ErrorViewData> getErrorMetricsData(String errorType, List<String> serviceName,
                    List<String> operationName, List<String> consumerName, String errorId, String errorCategory,
                    String errorSeverity, String errorName, MetricCriteria metricCriteria); @Override ErrorInfos getErrorMetricsMetadata(String errorId, String errorName, String serviceName); @Override List<MetricGroupData> getMetricsData(MetricCriteria metricCriteria,
                    MetricResourceCriteria metricResourceCriteria); @Override MetricData getMetricSummaryData(String dc, MetricCriteria metricCriteria,
                    MetricResourceCriteria metricResourceCriteria); @Override List<MetricGraphData> getMetricValue(CriteriaInfo criteriaInfo, long startTime, long duration, int step,
                    String autoDelay); @Override List<PolicyMetricData> getPolicyMetricData(long startTime, long endTime, String policyType,
                    String policyName, String serviceName, String operationName, String subjectTypeName,
                    String subjectValue, String effect); @Override List<PolicyMetricGraphData> getPolicyMetricDetailData(String policyName, String serviceName,
                    String operationName, String subjectTypeName, String subjectValue, String listType, long startTime,
                    long endTime); @Override List<MetricData> getStandardReportData(String reportType, MetricCriteria metricCriteria); @Override List<String> getMetricsMetadata(String resourceEntityType, List<String> resourceEntityName,
                    String resourceEntityResponseType); @Override List<ExtendedErrorViewData> getExtendedErrorMetricsData(String errorType, List<String> serviceName,
                    List<String> operationName, List<String> consumerName, String errorId, String errorCategory,
                    String errorSeverity, String errorName, MetricCriteria metricCriteria);  }### Answer:
@Test public void testGetMetricsMetadataByService() { List<String> serviceNames = provider.getMetricsMetadata(ResourceEntity.SERVICE.value(), Collections.<String> emptyList(), ResourceEntity.SERVICE.value()); assertEquals(3, serviceNames.size()); Collections.sort(serviceNames); assertEquals("service_1", serviceNames.get(0)); assertEquals("service_2", serviceNames.get(1)); assertEquals("service_3", serviceNames.get(2)); serviceNames = provider.getMetricsMetadata(ResourceEntity.SERVICE.value(), Arrays.asList("service_2"), ResourceEntity.SERVICE.value()); assertEquals(1, serviceNames.size()); assertEquals("service_2", serviceNames.get(0)); }
@Test public void testGetMetricsMetadataByOperation() { List<String> operationNames = provider.getMetricsMetadata(ResourceEntity.SERVICE.value(), Arrays.asList("service_1", "service_2"), ResourceEntity.OPERATION.value()); assertEquals(4, operationNames.size()); Collections.sort(operationNames); assertEquals("service_1.operation_1_1", operationNames.get(0)); assertEquals("service_1.operation_1_2", operationNames.get(1)); assertEquals("service_2.operation_2_1", operationNames.get(2)); assertEquals("service_2.operation_2_2", operationNames.get(3)); operationNames = provider.getMetricsMetadata(ResourceEntity.SERVICE.value(), Arrays.asList("service_2"), ResourceEntity.OPERATION.value()); assertEquals(2, operationNames.size()); Collections.sort(operationNames); assertEquals("service_2.operation_2_1", operationNames.get(0)); assertEquals("service_2.operation_2_2", operationNames.get(1)); }