diff --git a/metrics/src/test/java/com/megaease/easeagent/metrics/BaseMetricsTest.java b/metrics/src/test/java/com/megaease/easeagent/metrics/BaseMetricsTest.java deleted file mode 100644 index 717c29522..000000000 --- a/metrics/src/test/java/com/megaease/easeagent/metrics/BaseMetricsTest.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2017, MegaEase - * All rights reserved. - * - * Licensed 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 com.megaease.easeagent.metrics; - -import org.junit.Assert; -import org.junit.Test; - -public class BaseMetricsTest { - - @Test - public void t(){ - Assert.assertTrue(true); - } -// public Config createConfig(String key, String value) { -// Map map = new HashMap<>(); -// map.put(key, value); -// map.put(SwitchUtil.GLOBAL_METRICS_ENABLE_KEY, "true"); -// map.put(SwitchUtil.GLOBAL_TRACING_ENABLE_KEY, "true"); -// return new Configs(map); -// } -} diff --git a/metrics/src/test/java/com/megaease/easeagent/metrics/JVMGCMetricTest.java b/metrics/src/test/java/com/megaease/easeagent/metrics/JVMGCMetricTest.java deleted file mode 100644 index af89ddb84..000000000 --- a/metrics/src/test/java/com/megaease/easeagent/metrics/JVMGCMetricTest.java +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Copyright (c) 2017, MegaEase - * All rights reserved. - * - * Licensed 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 com.megaease.easeagent.metrics; - -import org.junit.Assert; -import org.junit.Test; - -public class JVMGCMetricTest extends BaseMetricsTest { - @Test - public void t(){ - Assert.assertTrue(true); - } -// -// @Test -// public void success() throws Exception { -// Config config = this.createConfig(JVMGCMetric.ENABLE_KEY, "true"); -// MetricRegistry metricRegistry = new MetricRegistry(); -// JVMGCMetric jvmgcMetric = new JVMGCMetric(metricRegistry, config); -// jvmgcMetric.collect(); -// int serverPort = 12999; -// HttpServer httpServer = httpServer(serverPort); -// httpServer.response(new ResponseHandler() { -// @SneakyThrows -// @Override -// public void writeToResponse(SessionContext context) { -// List list = new ArrayList<>(); -// for (int i = 0; i < 40; i++) { -// list.add(new byte[10 * 1024 * 1024]); -// } -// Assert.assertNotNull(list); -// System.gc(); -// TimeUnit.SECONDS.sleep(1); -// } -// -// @Override -// public ResponseHandler apply(MocoConfig config) { -// return this; -// } -// }); -// -// running(httpServer, () -> { -// OkHttpClient client = new OkHttpClient.Builder().readTimeout(100, TimeUnit.SECONDS).build(); -// for (int i = 0; i < 1; i++) { -// Request request = new Request.Builder() -// .url("http://localhost:" + serverPort) -// .build(); -// try (Response response = client.newCall(request).execute()) { -// Objects.requireNonNull(response.body()).string(); -// } -// TimeUnit.SECONDS.sleep(1); -// } -// TimeUnit.SECONDS.sleep(5); -// Map metrics = metricRegistry.getMetrics(); -// Assert.assertFalse(metrics.isEmpty()); -// for (Map.Entry entry : metrics.entrySet()) { -// Metric value = entry.getValue(); -// if (value instanceof Meter) { -// Meter meter = (Meter) value; -// Assert.assertTrue(meter.getCount() > 1); -// continue; -// } -// if (value instanceof Gauge) { -// Counter counter = (Counter) value; -// Assert.assertTrue(counter.getCount() > 1); -// } -// } -// }); -// } -// -// @Test -// public void disableCollect() throws Exception { -// Config config = this.createConfig(JVMGCMetric.ENABLE_KEY, "false"); -// MetricRegistry metricRegistry = new MetricRegistry(); -// JVMGCMetric jvmgcMetric = new JVMGCMetric(metricRegistry, config); -// jvmgcMetric.collect(); -// int serverPort = 12999; -// HttpServer httpServer = httpServer(serverPort); -// httpServer.response(new ResponseHandler() { -// @SneakyThrows -// @Override -// public void writeToResponse(SessionContext context) { -// List list = new ArrayList<>(); -// for (int i = 0; i < 40; i++) { -// list.add(new byte[10 * 1024 * 1024]); -// } -// Assert.assertNotNull(list); -// System.gc(); -// TimeUnit.SECONDS.sleep(1); -// } -// -// @Override -// public ResponseHandler apply(MocoConfig config) { -// return this; -// } -// }); -// -// running(httpServer, () -> { -// OkHttpClient client = new OkHttpClient.Builder().readTimeout(100, TimeUnit.SECONDS).build(); -// for (int i = 0; i < 1; i++) { -// Request request = new Request.Builder() -// .url("http://localhost:" + serverPort) -// .build(); -// try (Response response = client.newCall(request).execute()) { -// Objects.requireNonNull(response.body()).string(); -// } -// TimeUnit.SECONDS.sleep(1); -// } -// TimeUnit.SECONDS.sleep(5); -// Map metrics = metricRegistry.getMetrics(); -// Assert.assertTrue(metrics.isEmpty()); -// }); -// } -} diff --git a/metrics/src/test/java/com/megaease/easeagent/metrics/JVMMemoryMetricTest.java b/metrics/src/test/java/com/megaease/easeagent/metrics/JVMMemoryMetricTest.java deleted file mode 100644 index 3a8b5fefb..000000000 --- a/metrics/src/test/java/com/megaease/easeagent/metrics/JVMMemoryMetricTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2017, MegaEase - * All rights reserved. - * - * Licensed 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 com.megaease.easeagent.metrics; - -import org.junit.Assert; -import org.junit.Test; - -public class JVMMemoryMetricTest extends BaseMetricsTest { - @Test - public void t(){ - Assert.assertTrue(true); - } - -// @Test -// public void success() { -// Config config = this.createConfig(JVMMemoryMetric.ENABLE_KEY, "true"); -// MetricRegistry metricRegistry = new MetricRegistry(); -// JVMMemoryMetric jvmMemoryMetric = new JVMMemoryMetric(metricRegistry, config, false); -// -// jvmMemoryMetric.doJob(); -// -// Assert.assertFalse(metricRegistry.getMetrics().isEmpty()); -// } -// -// @Test -// public void disableCollect() { -// Config config = this.createConfig(JVMMemoryMetric.ENABLE_KEY, "false"); -// MetricRegistry metricRegistry = new MetricRegistry(); -// JVMMemoryMetric jvmMemoryMetric = new JVMMemoryMetric(metricRegistry, config, false); -// -// jvmMemoryMetric.doJob(); -// -// Assert.assertTrue(metricRegistry.getMetrics().isEmpty()); -// } - -}