Repository: ambari
Updated Branches:
  refs/heads/branch-3.0-ams a4293b7dc -> 42112e28d


http://git-wip-us.apache.org/repos/asf/ambari/blob/42112e28/ambari-metrics/ambari-metrics-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/source/RawMetricsSourceTest.java
----------------------------------------------------------------------
diff --git 
a/ambari-metrics/ambari-metrics-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/source/RawMetricsSourceTest.java
 
b/ambari-metrics/ambari-metrics-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/source/RawMetricsSourceTest.java
deleted file mode 100644
index 254ee6c..0000000
--- 
a/ambari-metrics/ambari-metrics-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/source/RawMetricsSourceTest.java
+++ /dev/null
@@ -1,141 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package 
org.apache.hadoop.yarn.server.applicationhistoryservice.metrics.timeline.source;
-
-import static 
org.apache.hadoop.yarn.server.applicationhistoryservice.metrics.timeline.source.InternalSourceProvider.SOURCE_NAME.RAW_METRICS;
-import static org.easymock.EasyMock.capture;
-import static org.easymock.EasyMock.createNiceMock;
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.expectLastCall;
-import static org.easymock.EasyMock.replay;
-import static org.easymock.EasyMock.verify;
-import static org.powermock.api.easymock.PowerMock.mockStatic;
-import static org.powermock.api.easymock.PowerMock.replayAll;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.TreeMap;
-
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.metrics2.sink.timeline.TimelineMetric;
-import org.apache.hadoop.metrics2.sink.timeline.TimelineMetrics;
-import 
org.apache.hadoop.yarn.server.applicationhistoryservice.metrics.timeline.TimelineMetricConfiguration;
-import 
org.apache.hadoop.yarn.server.applicationhistoryservice.metrics.timeline.sink.ExternalMetricsSink;
-import org.easymock.Capture;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.powermock.core.classloader.annotations.PrepareForTest;
-import org.powermock.modules.junit4.PowerMockRunner;
-
-import junit.framework.Assert;
-
-@RunWith(PowerMockRunner.class)
-@PrepareForTest(TimelineMetricConfiguration.class)
-public class RawMetricsSourceTest {
-
-  @Before
-  public void setupConf() throws Exception {
-    TimelineMetricConfiguration conf = new TimelineMetricConfiguration(new
-      Configuration(), new Configuration());
-    mockStatic(TimelineMetricConfiguration.class);
-    
expect(TimelineMetricConfiguration.getInstance()).andReturn(conf).anyTimes();
-    replayAll();
-  }
-
-  @Test
-  public void testRawMetricsSourcedAtFlushInterval() throws Exception {
-    InternalSourceProvider internalSourceProvider = new 
DefaultInternalMetricsSourceProvider();
-    ExternalMetricsSink rawMetricsSink = 
createNiceMock(ExternalMetricsSink.class);
-    expect(rawMetricsSink.getFlushSeconds()).andReturn(1);
-    expect(rawMetricsSink.getSinkTimeOutSeconds()).andReturn(1);
-    Capture<Collection<TimelineMetrics>> metricsCapture = new Capture<>();
-    rawMetricsSink.sinkMetricData(capture(metricsCapture));
-    expectLastCall();
-    replay(rawMetricsSink);
-
-    InternalMetricsSource rawMetricsSource = 
internalSourceProvider.getInternalMetricsSource(RAW_METRICS, 1, rawMetricsSink);
-    TimelineMetrics timelineMetrics = new TimelineMetrics();
-
-    final long now = System.currentTimeMillis();
-    TimelineMetric metric1 = new TimelineMetric();
-    metric1.setMetricName("m1");
-    metric1.setAppId("a1");
-    metric1.setInstanceId("i1");
-    metric1.setHostName("h1");
-    metric1.setStartTime(now - 200);
-    metric1.setMetricValues(new TreeMap<Long, Double>() {{
-      put(now - 100, 1.0);
-      put(now - 200, 2.0);
-    }});
-    timelineMetrics.getMetrics().add(metric1);
-
-    
rawMetricsSource.publishTimelineMetrics(Collections.singletonList(timelineMetrics));
-
-    verify(rawMetricsSink);
-  }
-
-  @Test(timeout = 10000)
-  public void testRawMetricsCachedAndSourced() throws Exception {
-    ExternalMetricsSink rawMetricsSink = 
createNiceMock(ExternalMetricsSink.class);
-    expect(rawMetricsSink.getFlushSeconds()).andReturn(2).anyTimes();
-    expect(rawMetricsSink.getSinkTimeOutSeconds()).andReturn(1).anyTimes();
-
-    class CaptureOnce<T> extends Capture<T> {
-      @Override
-      public void setValue(T value) {
-        if (!hasCaptured()) {
-          super.setValue(value);
-        }
-      }
-    }
-    Capture<Collection<TimelineMetrics>> metricsCapture = new CaptureOnce<>();
-
-    rawMetricsSink.sinkMetricData(capture(metricsCapture));
-    expectLastCall();
-    replay(rawMetricsSink);
-
-    InternalSourceProvider internalSourceProvider = new 
DefaultInternalMetricsSourceProvider();
-    InternalMetricsSource rawMetricsSource = 
internalSourceProvider.getInternalMetricsSource(RAW_METRICS, 1, rawMetricsSink);
-    TimelineMetrics timelineMetrics = new TimelineMetrics();
-
-    final long now = System.currentTimeMillis();
-    TimelineMetric metric1 = new TimelineMetric();
-    metric1.setMetricName("m1");
-    metric1.setAppId("a1");
-    metric1.setInstanceId("i1");
-    metric1.setHostName("h1");
-    metric1.setStartTime(now - 200);
-    metric1.setMetricValues(new TreeMap<Long, Double>() {{
-      put(now - 100, 1.0);
-      put(now - 200, 2.0);
-    }});
-    timelineMetrics.getMetrics().add(metric1);
-
-    
rawMetricsSource.publishTimelineMetrics(Collections.singletonList(timelineMetrics));
-
-    // Wait on eviction
-    Thread.sleep(5000);
-
-    verify(rawMetricsSink);
-
-    Assert.assertTrue(metricsCapture.hasCaptured());
-    
Assert.assertTrue(metricsCapture.getValue().iterator().next().getMetrics().iterator().next().equals(metric1));
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/42112e28/ambari-metrics/ambari-metrics-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/uuid/TimelineMetricUuidManagerTest.java
----------------------------------------------------------------------
diff --git 
a/ambari-metrics/ambari-metrics-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/uuid/TimelineMetricUuidManagerTest.java
 
b/ambari-metrics/ambari-metrics-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/uuid/TimelineMetricUuidManagerTest.java
deleted file mode 100644
index d1b3f01..0000000
--- 
a/ambari-metrics/ambari-metrics-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/uuid/TimelineMetricUuidManagerTest.java
+++ /dev/null
@@ -1,184 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package 
org.apache.hadoop.yarn.server.applicationhistoryservice.metrics.timeline.uuid;
-
-import static org.easymock.EasyMock.anyString;
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.replay;
-
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.metrics2.sink.timeline.TimelineMetric;
-import 
org.apache.hadoop.yarn.server.applicationhistoryservice.metrics.timeline.PhoenixHBaseAccessor;
-import 
org.apache.hadoop.yarn.server.applicationhistoryservice.metrics.timeline.aggregators.TimelineClusterMetric;
-import org.easymock.EasyMock;
-import org.junit.Assert;
-import org.junit.Ignore;
-import org.junit.Test;
-
-import java.io.BufferedReader;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.net.URL;
-import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-public class TimelineMetricUuidManagerTest {
-
-
-  private List<String> apps = Arrays.asList("namenode",
-    "datanode", "master_hbase", "slave_hbase", "kafka_broker", "nimbus", 
"ams-hbase",
-    "accumulo", "nodemanager", "resourcemanager", "ambari_server", "HOST", 
"timeline_metric_store_watcher",
-    "jobhistoryserver", "hiveserver2", "hivemetastore", 
"applicationhistoryserver", "amssmoketestfake");
-
-  private Map<String, Set<String>> metricSet  = new 
HashMap<>(populateMetricWhitelistFromFile());
-
-  @Test
-  public void testHashBasedUuidForMetricName() throws SQLException {
-
-    MetricUuidGenStrategy strategy = new HashBasedUuidGenStrategy();
-    Map<String, TimelineClusterMetric> uuids = new HashMap<>();
-    for (String app : metricSet.keySet()) {
-      Set<String> metrics = metricSet.get(app);
-      for (String metric : metrics) {
-        TimelineClusterMetric timelineClusterMetric = new 
TimelineClusterMetric(metric, app, null, -1l);
-        byte[] uuid = strategy.computeUuid(timelineClusterMetric, 16);
-        Assert.assertNotNull(uuid);
-        Assert.assertTrue(uuid.length == 16);
-        String uuidStr = new String(uuid);
-        Assert.assertFalse(uuids.containsKey(uuidStr) && 
!uuids.containsValue(timelineClusterMetric));
-        if (uuids.containsKey(uuidStr) ) {
-          if (!uuids.containsValue(timelineClusterMetric)) {
-            System.out.println("COLLISION : " + 
timelineClusterMetric.toString() + " = " + uuids.get(uuidStr));
-          }
-        }
-        uuids.put(uuidStr, timelineClusterMetric);
-      }
-    }
-  }
-
-  @Test
-  public void testHaseBasedUuidForAppIds() throws SQLException {
-
-    MetricUuidGenStrategy strategy = new HashBasedUuidGenStrategy();
-    Map<String, TimelineClusterMetric> uuids = new HashMap<>();
-    for (String app : metricSet.keySet()) {
-      TimelineClusterMetric timelineClusterMetric = new 
TimelineClusterMetric("TestMetric", app, null, -1l);
-      byte[] uuid = strategy.computeUuid(timelineClusterMetric, 16);
-      String uuidStr = new String(uuid);
-      if (uuids.containsKey(uuidStr) ) {
-        if (!uuids.containsValue(timelineClusterMetric)) {
-          System.out.println("COLLISION : " + timelineClusterMetric.toString() 
+ " = " + uuids.get(uuidStr));
-        }
-      }
-      uuids.put(uuidStr, timelineClusterMetric);
-    }
-  }
-
-  @Test
-  public void testHashBasedUuidForHostnames() throws SQLException {
-
-    MetricUuidGenStrategy strategy = new HashBasedUuidGenStrategy();
-    Map<String, String> uuids = new HashMap<>();
-
-    List<String> hosts = new ArrayList<>();
-    String hostPrefix = "TestHost.";
-    String hostSuffix = ".ambari.apache.org";
-
-    for (int i=0; i<=2000; i++) {
-      hosts.add(hostPrefix + i + hostSuffix);
-    }
-
-    for (String host : hosts) {
-      byte[] uuid = strategy.computeUuid(host, 4);
-      Assert.assertNotNull(uuid);
-      Assert.assertTrue(uuid.length == 4);
-      String uuidStr = new String(uuid);
-      Assert.assertFalse(uuids.containsKey(uuidStr));
-      uuids.put(uuidStr, host);
-    }
-  }
-
-
-  @Test
-  public void testRandomUuidForWhitelistedMetrics() throws SQLException {
-
-    MetricUuidGenStrategy strategy = new RandomUuidGenStrategy();
-    Map<String, String> uuids = new HashMap<>();
-    for (String app : metricSet.keySet()) {
-      Set<String> metrics = metricSet.get(app);
-      for (String metric : metrics) {
-        byte[] uuid = strategy.computeUuid(new TimelineClusterMetric(metric, 
app, null, -1l), 16);
-        Assert.assertNotNull(uuid);
-        Assert.assertTrue(uuid.length == 16);
-        String uuidStr = new String(uuid);
-        Assert.assertFalse(uuids.containsKey(uuidStr) && 
!uuids.containsValue(metric));
-        uuids.put(uuidStr, metric);
-      }
-    }
-  }
-
-  public Map<String, Set<String>> populateMetricWhitelistFromFile() {
-
-
-    Map<String, Set<String>> metricSet = new HashMap<String, Set<String>>();
-    FileInputStream fstream = null;
-    BufferedReader br = null;
-    String strLine;
-    for (String appId : apps) {
-      URL fileUrl = ClassLoader.getSystemResource("metrics_def/" + 
appId.toUpperCase() + ".dat");
-
-      Set<String> metricsForApp = new HashSet<>();
-      try {
-        fstream = new FileInputStream(fileUrl.getPath());
-        br = new BufferedReader(new InputStreamReader(fstream));
-        while ((strLine = br.readLine()) != null)   {
-          strLine = strLine.trim();
-          metricsForApp.add(strLine);
-        }
-      } catch (Exception ioEx) {
-        System.out.println("Metrics for AppId " + appId + " not found.");
-      } finally {
-        if (br != null) {
-          try {
-            br.close();
-          } catch (IOException e) {
-          }
-        }
-
-        if (fstream != null) {
-          try {
-            fstream.close();
-          } catch (IOException e) {
-          }
-        }
-      }
-      metricsForApp.add("live_hosts");
-      metricSet.put(appId.contains("hbase") ? "hbase" : appId, metricsForApp);
-      System.out.println("Found " + metricsForApp.size() + " metrics for appId 
= " + appId);
-    }
-    return metricSet;
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/42112e28/ambari-metrics/ambari-metrics-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/timeline/TestGenericObjectMapper.java
----------------------------------------------------------------------
diff --git 
a/ambari-metrics/ambari-metrics-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/timeline/TestGenericObjectMapper.java
 
b/ambari-metrics/ambari-metrics-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/timeline/TestGenericObjectMapper.java
deleted file mode 100644
index d684a27..0000000
--- 
a/ambari-metrics/ambari-metrics-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/timeline/TestGenericObjectMapper.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.hadoop.yarn.server.applicationhistoryservice.timeline;
-
-import org.apache.hadoop.classification.InterfaceAudience;
-import org.apache.hadoop.classification.InterfaceStability;
-import org.apache.hadoop.io.WritableComparator;
-import 
org.apache.hadoop.yarn.server.applicationhistoryservice.timeline.GenericObjectMapper;
-import org.junit.Test;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import static org.junit.Assert.assertEquals;
-
[email protected]
[email protected]
-public class TestGenericObjectMapper {
-
-  @Test
-  public void testEncoding() {
-    testEncoding(Long.MAX_VALUE);
-    testEncoding(Long.MIN_VALUE);
-    testEncoding(0l);
-    testEncoding(128l);
-    testEncoding(256l);
-    testEncoding(512l);
-    testEncoding(-256l);
-  }
-
-  private static void testEncoding(long l) {
-    byte[] b = GenericObjectMapper.writeReverseOrderedLong(l);
-    assertEquals("error decoding", l,
-        GenericObjectMapper.readReverseOrderedLong(b, 0));
-    byte[] buf = new byte[16];
-    System.arraycopy(b, 0, buf, 5, 8);
-    assertEquals("error decoding at offset", l,
-        GenericObjectMapper.readReverseOrderedLong(buf, 5));
-    if (l > Long.MIN_VALUE) {
-      byte[] a = GenericObjectMapper.writeReverseOrderedLong(l-1);
-      assertEquals("error preserving ordering", 1,
-          WritableComparator.compareBytes(a, 0, a.length, b, 0, b.length));
-    }
-    if (l < Long.MAX_VALUE) {
-      byte[] c = GenericObjectMapper.writeReverseOrderedLong(l+1);
-      assertEquals("error preserving ordering", 1,
-          WritableComparator.compareBytes(b, 0, b.length, c, 0, c.length));
-    }
-  }
-
-  private static void verify(Object o) throws IOException {
-    assertEquals(o, GenericObjectMapper.read(GenericObjectMapper.write(o)));
-  }
-
-  @Test
-  public void testValueTypes() throws IOException {
-    verify(Integer.MAX_VALUE);
-    verify(Integer.MIN_VALUE);
-    assertEquals(Integer.MAX_VALUE, GenericObjectMapper.read(
-        GenericObjectMapper.write((long) Integer.MAX_VALUE)));
-    assertEquals(Integer.MIN_VALUE, GenericObjectMapper.read(
-        GenericObjectMapper.write((long) Integer.MIN_VALUE)));
-    verify((long)Integer.MAX_VALUE + 1l);
-    verify((long)Integer.MIN_VALUE - 1l);
-
-    verify(Long.MAX_VALUE);
-    verify(Long.MIN_VALUE);
-
-    assertEquals(42, GenericObjectMapper.read(GenericObjectMapper.write(42l)));
-    verify(42);
-    verify(1.23);
-    verify("abc");
-    verify(true);
-    List<String> list = new ArrayList<String>();
-    list.add("123");
-    list.add("abc");
-    verify(list);
-    Map<String,String> map = new HashMap<String,String>();
-    map.put("k1","v1");
-    map.put("k2","v2");
-    verify(map);
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/42112e28/ambari-metrics/ambari-metrics-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/TestTimelineWebServices.java
----------------------------------------------------------------------
diff --git 
a/ambari-metrics/ambari-metrics-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/TestTimelineWebServices.java
 
b/ambari-metrics/ambari-metrics-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/TestTimelineWebServices.java
deleted file mode 100644
index 83e2a27..0000000
--- 
a/ambari-metrics/ambari-metrics-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/TestTimelineWebServices.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.hadoop.yarn.server.applicationhistoryservice.webapp;
-
-import static org.junit.Assert.assertEquals;
-
-import javax.ws.rs.core.MediaType;
-
-import org.apache.hadoop.metrics2.sink.timeline.TimelineMetrics;
-import org.apache.hadoop.yarn.api.records.timeline.TimelineEntities;
-import org.apache.hadoop.yarn.api.records.timeline.TimelineEntity;
-import org.apache.hadoop.yarn.api.records.timeline.TimelineEvent;
-import org.apache.hadoop.yarn.api.records.timeline.TimelineEvents;
-import org.apache.hadoop.yarn.api.records.timeline.TimelinePutResponse;
-import 
org.apache.hadoop.yarn.server.applicationhistoryservice.metrics.timeline.TestTimelineMetricStore;
-import 
org.apache.hadoop.yarn.server.applicationhistoryservice.metrics.timeline.TimelineMetricStore;
-import 
org.apache.hadoop.yarn.server.applicationhistoryservice.timeline.TimelineStore;
-import org.apache.hadoop.yarn.webapp.GenericExceptionHandler;
-import org.apache.hadoop.yarn.webapp.YarnJacksonJaxbJsonProvider;
-import org.junit.Test;
-
-import com.google.inject.Guice;
-import com.google.inject.Injector;
-import com.google.inject.servlet.GuiceServletContextListener;
-import com.google.inject.servlet.ServletModule;
-import com.sun.jersey.api.client.ClientResponse;
-import com.sun.jersey.api.client.WebResource;
-import com.sun.jersey.api.client.config.DefaultClientConfig;
-import com.sun.jersey.guice.spi.container.servlet.GuiceContainer;
-import com.sun.jersey.test.framework.JerseyTest;
-import com.sun.jersey.test.framework.WebAppDescriptor;
-
-import junit.framework.Assert;
-
-
-public class TestTimelineWebServices extends JerseyTest {
-  private static TimelineMetricStore metricStore;
-  private long beforeTime;
-
-  private Injector injector = Guice.createInjector(new ServletModule() {
-
-    @Override
-    protected void configureServlets() {
-      bind(YarnJacksonJaxbJsonProvider.class);
-      bind(TimelineWebServices.class);
-      bind(GenericExceptionHandler.class);
-      try {
-        metricStore = new TestTimelineMetricStore();
-      } catch (Exception e) {
-        Assert.fail();
-      }
-      bind(TimelineMetricStore.class).toInstance(metricStore);
-      serve("/*").with(GuiceContainer.class);
-    }
-
-  });
-
-  public class GuiceServletConfig extends GuiceServletContextListener {
-
-    @Override
-    protected Injector getInjector() {
-      return injector;
-    }
-  }
-
-  public TestTimelineWebServices() {
-    super(new WebAppDescriptor.Builder(
-      "org.apache.hadoop.yarn.server.applicationhistoryservice.webapp")
-      .contextListenerClass(GuiceServletConfig.class)
-      .filterClass(com.google.inject.servlet.GuiceFilter.class)
-      .contextPath("jersey-guice-filter")
-      .servletPath("/")
-      .clientConfig(new DefaultClientConfig(YarnJacksonJaxbJsonProvider.class))
-      .build());
-  }
-
-  @Test
-  public void testAbout() throws Exception {
-    WebResource r = resource();
-    ClientResponse response = r.path("ws").path("v1").path("timeline")
-      .accept(MediaType.APPLICATION_JSON)
-      .get(ClientResponse.class);
-    assertEquals(MediaType.APPLICATION_JSON_TYPE, response.getType());
-    TimelineWebServices.AboutInfo about =
-      response.getEntity(TimelineWebServices.AboutInfo.class);
-    Assert.assertNotNull(about);
-    Assert.assertEquals("AMS API", about.getAbout());
-  }
-  
-  private static void verifyMetrics(TimelineMetrics metrics) {
-    Assert.assertNotNull(metrics);
-    Assert.assertEquals("cpu_user", 
metrics.getMetrics().get(0).getMetricName());
-    Assert.assertEquals(3, 
metrics.getMetrics().get(0).getMetricValues().size());
-    Assert.assertEquals("mem_free", 
metrics.getMetrics().get(1).getMetricName());
-    Assert.assertEquals(3, 
metrics.getMetrics().get(1).getMetricValues().size());
-  }
-
-  @Test
-  public void testGetMetrics() throws Exception {
-    WebResource r = resource();
-    ClientResponse response = r.path("ws").path("v1").path("timeline")
-      .path("metrics").queryParam("metricNames", 
"cpu_user").queryParam("precision", "seconds")
-      .accept(MediaType.APPLICATION_JSON)
-      .get(ClientResponse.class);
-    assertEquals(MediaType.APPLICATION_JSON_TYPE, response.getType());
-    verifyMetrics(response.getEntity(TimelineMetrics.class));
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/42112e28/ambari-metrics/ambari-metrics-timelineservice/src/test/resources/loadsimulator/README
----------------------------------------------------------------------
diff --git 
a/ambari-metrics/ambari-metrics-timelineservice/src/test/resources/loadsimulator/README
 
b/ambari-metrics/ambari-metrics-timelineservice/src/test/resources/loadsimulator/README
index eec3e5d..c756a83 100644
--- 
a/ambari-metrics/ambari-metrics-timelineservice/src/test/resources/loadsimulator/README
+++ 
b/ambari-metrics/ambari-metrics-timelineservice/src/test/resources/loadsimulator/README
@@ -41,7 +41,7 @@
  2. Build the ambari-metrics-timelineservice jar.
  3. Invoke the test using the command as follows.
 
-   java -cp lib/*:ambari-metrics-timelineservice-<version>.jar 
org.apache.hadoop.yarn.server.applicationhistoryservice.metrics.loadsimulator.jmetertest.jmetertest.AMSJMeterLoadTest
 -t <S/U>
+   java -cp lib/*:ambari-metrics-timelineservice-<version>.jar 
AMSJMeterLoadTest -t <S/U>
 
    lib/* -> All the dependency JARs generated for the 
ambari-metrics-timelineservice JAR.
    -t option => S-Sink simulator or U-UI simulator

Reply via email to