@@ -0,0 +1,3119 @@
+/*%0A * Copyright 2015 Red Hat, Inc. and/or its affiliates%0A * and other contributors as indicated by the @author tags.%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *    http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0Apackage org.hawkular.client.test.metrics.openshift;%0A%0Aimport java.util.Collections;%0Aimport java.util.List;%0Aimport java.util.stream.Collectors;%0A%0Aimport org.hawkular.client.metrics.model.MetricDefinition;%0Aimport org.testng.Assert;%0Aimport org.testng.Reporter;%0Aimport org.testng.annotations.Test;%0A%0Aimport com.google.common.collect.ImmutableList;%0A%0A/**%0A * Verify container metric definitions%3Cp%3E%0A * Test expects 1-container pod%0A * @author vnguyen%0A *%0A */%0A@Test(groups=%7B%22openshift%22%7D)%0Apublic class MetricDefinitionTest extends OpenshiftBaseTest %7B%0A%0A    private static final List%3CString%3E expectedMetricIDs = ImmutableList.of(%0A            %22memory/page_faults%22,%0A            %22cpu/usage%22,%0A            %22memory/usage%22,%0A            %22memory/major_page_faults%22,%0A            %22memory/working_set%22,%0A            %22cpu/limit%22,%0A            %22uptime%22,%0A            %22memory/limit%22);%0A%0A    public MetricDefinitionTest() throws Exception %7B%0A        super();%0A    %7D%0A%0A    @Test%0A    public void verifyMetricDefinitionForPod() %7B%0A        String project = %22default%22;%0A        String container = %22hawkular-metrics%22;%0A%0A        String type = null; // ignore metric type%0A        String tags = %22container_name:%22 + container + %22,pod_namespace:%22 + project;%0A        List%3CMetricDefinition%3E defs = client().metrics().findMetricDefinitions(%0A                                                OpenshiftBaseTest.TENANT_ID,%0A                                                type,%0A                                                tags);%0A        Reporter.log(defs.toString(), true);%0A%0A        Assert.assertTrue(defs != null && defs.size() == expectedMetricIDs.size());%0A%0A        // collect all metric IDs%0A        List%3CString%3E metricIDs = defs.stream()%0A                .map(x -%3E x.getId())%0A                .collect(Collectors.toList());%0A%0A        Reporter.log(metricIDs.toString(), true);%0A%0A        // pad expected metric id with container name + pod id%0A        String podId = defs.get(0).getTags().get(%22pod_id%22);%0A        String idPrefix = container + %22/%22 + podId + %22/%22;%0A        List%3CString%3E expectedIDs = expectedMetricIDs%0A                                        .stream()%0A                                        .map(item -%3E idPrefix + item)%0A                                        .collect(Collectors.toList());%0A        Collections.sort(metricIDs);%0A        Collections.sort(expectedIDs);%0A%0A        Assert.assertEquals(metricIDs, expectedIDs);%0A    %7D%0A%0A    @Test%0A    public void verifyTags() %7B%0A        //TBD%0A    %7D%0A%7D

Add metric definition test