http://git-wip-us.apache.org/repos/asf/eagle/blob/6fd95d5c/eagle-core/eagle-app/eagle-app-base/src/test/java/org/apache/eagle/app/StreamDefinitions.java ---------------------------------------------------------------------- diff --git a/eagle-core/eagle-app/eagle-app-base/src/test/java/org/apache/eagle/app/StreamDefinitions.java b/eagle-core/eagle-app/eagle-app-base/src/test/java/org/apache/eagle/app/StreamDefinitions.java deleted file mode 100644 index 7ca0176..0000000 --- a/eagle-core/eagle-app/eagle-app-base/src/test/java/org/apache/eagle/app/StreamDefinitions.java +++ /dev/null @@ -1,37 +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.eagle.app; - -import org.apache.eagle.alert.engine.coordinator.StreamDefinition; - -import javax.xml.bind.annotation.*; -import java.util.List; - -@XmlRootElement(name = "streams") -public class StreamDefinitions{ - - private List<StreamDefinition> streams; - - @XmlElement(name = "stream") - public List<StreamDefinition> getStreams() { - return streams; - } - - public void setStreams(List<StreamDefinition> streams) { - this.streams = streams; - } -} \ No newline at end of file
http://git-wip-us.apache.org/repos/asf/eagle/blob/6fd95d5c/eagle-core/eagle-app/eagle-app-base/src/test/java/org/apache/eagle/app/TestApplicationSimulatorImpl.java ---------------------------------------------------------------------- diff --git a/eagle-core/eagle-app/eagle-app-base/src/test/java/org/apache/eagle/app/TestApplicationSimulatorImpl.java b/eagle-core/eagle-app/eagle-app-base/src/test/java/org/apache/eagle/app/TestApplicationSimulatorImpl.java deleted file mode 100644 index f2a4bce..0000000 --- a/eagle-core/eagle-app/eagle-app-base/src/test/java/org/apache/eagle/app/TestApplicationSimulatorImpl.java +++ /dev/null @@ -1,41 +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.eagle.app; - -import com.google.inject.Inject; -import org.apache.eagle.app.test.ApplicationSimulator; -import org.apache.eagle.app.test.ApplicationTestBase; -import org.junit.Ignore; -import org.junit.Test; - -import javax.ws.rs.WebApplicationException; - -@Ignore -public class TestApplicationSimulatorImpl extends ApplicationTestBase { - @Inject - ApplicationSimulator simulator; - - @Test - public void testSimulatorValid() { - simulator.start(TestStormApplication.Provider.class); - } - - @Test(expected = WebApplicationException.class) - public void testSimulatorWithStaticApp() { - simulator.start(TestWebApplication.Provider.class); - } -} http://git-wip-us.apache.org/repos/asf/eagle/blob/6fd95d5c/eagle-core/eagle-app/eagle-app-base/src/test/java/org/apache/eagle/app/TestStormApplication.java ---------------------------------------------------------------------- diff --git a/eagle-core/eagle-app/eagle-app-base/src/test/java/org/apache/eagle/app/TestStormApplication.java b/eagle-core/eagle-app/eagle-app-base/src/test/java/org/apache/eagle/app/TestStormApplication.java deleted file mode 100644 index 7977650..0000000 --- a/eagle-core/eagle-app/eagle-app-base/src/test/java/org/apache/eagle/app/TestStormApplication.java +++ /dev/null @@ -1,93 +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.eagle.app; - -import backtype.storm.generated.StormTopology; -import backtype.storm.spout.SpoutOutputCollector; -import backtype.storm.task.TopologyContext; -import backtype.storm.topology.OutputFieldsDeclarer; -import backtype.storm.topology.TopologyBuilder; -import backtype.storm.topology.base.BaseRichSpout; -import backtype.storm.tuple.Fields; -import com.google.inject.Inject; -import com.typesafe.config.Config; -import org.apache.eagle.app.environment.impl.StormEnvironment; -import org.apache.eagle.app.spi.AbstractApplicationProvider; -import org.junit.Ignore; - -import java.util.Arrays; -import java.util.Map; - -@Ignore -public class TestStormApplication extends StormApplication{ - @Override - public StormTopology execute(Config config, StormEnvironment environment) { - TopologyBuilder builder = new TopologyBuilder(); - builder.setSpout("metric_spout", new RandomEventSpout(), config.getInt("spoutNum")); - builder.setBolt("sink_1",environment.getStreamSink("TEST_STREAM_1",config)).fieldsGrouping("metric_spout",new Fields("metric")); - builder.setBolt("sink_2",environment.getStreamSink("TEST_STREAM_2",config)).fieldsGrouping("metric_spout",new Fields("metric")); - return builder.createTopology(); - } - - private class RandomEventSpout extends BaseRichSpout { - private SpoutOutputCollector _collector; - @Override - public void open(Map map, TopologyContext topologyContext, SpoutOutputCollector spoutOutputCollector) { - _collector = spoutOutputCollector; - } - - @Override - public void nextTuple() { - _collector.emit(Arrays.asList("disk.usage",System.currentTimeMillis(),"host_1",56.7)); - _collector.emit(Arrays.asList("cpu.usage",System.currentTimeMillis(),"host_2",99.8)); - } - - @Override - public void declareOutputFields(OutputFieldsDeclarer outputFieldsDeclarer) { - outputFieldsDeclarer.declare(new Fields("metric","timestamp","fromStream","value")); - } - } - - public final static class Provider extends AbstractApplicationProvider<TestStormApplication> { - @Override - public TestStormApplication getApplication() { - return new TestStormApplication(); - } - - @Override - public void onRegister() { - bindToMemoryMetaStore(ExtendedDao.class,ExtendedDaoImpl.class); - } - } - - private interface ExtendedDao{ - Class<? extends ExtendedDao> getType(); - } - - private static class ExtendedDaoImpl implements ExtendedDao { - private final Config config; - - @Inject - public ExtendedDaoImpl(Config config){ - this.config = config; - } - @Override - public Class<? extends ExtendedDao> getType() { - return ExtendedDaoImpl.class; - } - } -} http://git-wip-us.apache.org/repos/asf/eagle/blob/6fd95d5c/eagle-core/eagle-app/eagle-app-base/src/test/java/org/apache/eagle/app/TestWebApplication.java ---------------------------------------------------------------------- diff --git a/eagle-core/eagle-app/eagle-app-base/src/test/java/org/apache/eagle/app/TestWebApplication.java b/eagle-core/eagle-app/eagle-app-base/src/test/java/org/apache/eagle/app/TestWebApplication.java deleted file mode 100644 index 2778d1f..0000000 --- a/eagle-core/eagle-app/eagle-app-base/src/test/java/org/apache/eagle/app/TestWebApplication.java +++ /dev/null @@ -1,27 +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.eagle.app; - -import org.junit.Ignore; - -@Ignore -public class TestWebApplication { - public static class Provider extends StaticApplicationProvider { - - } -} - http://git-wip-us.apache.org/repos/asf/eagle/blob/6fd95d5c/eagle-core/eagle-app/eagle-app-base/src/test/java/org/apache/eagle/app/environment/StaticEnvironmentTest.java ---------------------------------------------------------------------- diff --git a/eagle-core/eagle-app/eagle-app-base/src/test/java/org/apache/eagle/app/environment/StaticEnvironmentTest.java b/eagle-core/eagle-app/eagle-app-base/src/test/java/org/apache/eagle/app/environment/StaticEnvironmentTest.java deleted file mode 100644 index 906bf66..0000000 --- a/eagle-core/eagle-app/eagle-app-base/src/test/java/org/apache/eagle/app/environment/StaticEnvironmentTest.java +++ /dev/null @@ -1,39 +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.eagle.app.environment; - -import com.typesafe.config.ConfigFactory; -import org.apache.eagle.app.environment.impl.StaticEnvironment; -import org.junit.Before; -import org.junit.Test; - -public class StaticEnvironmentTest { - private StaticEnvironment environment; - - @Before - public void setUp(){ - environment = new StaticEnvironment(ConfigFactory.load()); - } - - /** - * StaticEnvironment stream sink will be usefully for collection only app - */ - @Test - public void testStreamSinkSupport(){ - environment.stream(); - } -} http://git-wip-us.apache.org/repos/asf/eagle/blob/6fd95d5c/eagle-core/eagle-app/eagle-app-base/src/test/java/org/apache/eagle/app/environment/builder/CounterToRateFunctionTest.java ---------------------------------------------------------------------- diff --git a/eagle-core/eagle-app/eagle-app-base/src/test/java/org/apache/eagle/app/environment/builder/CounterToRateFunctionTest.java b/eagle-core/eagle-app/eagle-app-base/src/test/java/org/apache/eagle/app/environment/builder/CounterToRateFunctionTest.java deleted file mode 100644 index 6c00880..0000000 --- a/eagle-core/eagle-app/eagle-app-base/src/test/java/org/apache/eagle/app/environment/builder/CounterToRateFunctionTest.java +++ /dev/null @@ -1,306 +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.eagle.app.environment.builder; - -import backtype.storm.task.IOutputCollector; -import backtype.storm.task.OutputCollector; -import backtype.storm.tuple.Tuple; -import org.apache.eagle.app.utils.ClockWithOffset; -import org.apache.eagle.app.utils.ManualClock; -import org.junit.Assert; -import org.junit.Test; - -import java.lang.reflect.Field; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.util.*; -import java.util.concurrent.TimeUnit; - -public class CounterToRateFunctionTest { - - - private Map mkCountTypeEvent(long ts, double value) { - Map event = new HashMap(); - event.put("timestamp", ts); - event.put("metric", "hadoop.hbase.regionserver.server.totalrequestcount"); - event.put("component", "hbasemaster"); - event.put("site", "sandbox"); - event.put("value", value); - event.put("host", "xxx-xxx.int.xxx.com"); - return event; - } - - private Map mkCountTypeEventWithMetricName(long ts, double value, String metric) { - Map event = new HashMap(); - event.put("timestamp", ts); - event.put("metric", metric); - event.put("component", "hbasemaster"); - event.put("site", "sandbox"); - event.put("value", value); - event.put("host", "xxx-xxx.int.xxx.com"); - return event; - } - - private Map mkOtherTypeEvent(long ts, double value) { - Map event = new HashMap(); - event.put("timestamp", ts); - event.put("metric", "hadoop.memory.heapmemoryusage.used"); - event.put("component", "hbasemaster"); - event.put("site", "sandbox"); - event.put("value", value); - event.put("host", "xxx-xxx.int.xxx.com"); - return event; - } - - - @Test - public void testToMetricAndCounterValue() throws NoSuchMethodException, InvocationTargetException, IllegalAccessException { - long baseTime = System.currentTimeMillis() + 100000L; - - MetricDescriptor metricDefinition = MetricDescriptor - .metricGroupByField("group") - .siteAs("siteId") - .namedByField("metric") - .eventTimeByField("timestamp") - .dimensionFields("host", "component", "site") - .granularity(Calendar.MINUTE) - .valueField("value"); - CounterToRateFunction counterToRateFunction = new CounterToRateFunction(metricDefinition, 3, TimeUnit.MINUTES, ClockWithOffset.INSTANCE); - - Map event = mkCountTypeEvent((baseTime + 0), 374042741.0); - Method toMetricMethod = counterToRateFunction.getClass().getDeclaredMethod("toMetric", Map.class); - toMetricMethod.setAccessible(true); - CounterToRateFunction.Metric metric = (CounterToRateFunction.Metric) toMetricMethod.invoke(counterToRateFunction, event); - Assert.assertEquals("xxx-xxx.int.xxx.com-hbasemaster-sandbox-hadoop.hbase.regionserver.server.totalrequestcount", metric.getMetricName()); - Assert.assertEquals(374042741.0, Double.valueOf(metric.getValue().toString()), 0.00001); - Assert.assertEquals(374042741.0, metric.getNumberValue().doubleValue(), 0.00001); - Assert.assertTrue(metric.isCounter()); - - - event = mkOtherTypeEvent((baseTime + 0), 100); - metric = (CounterToRateFunction.Metric) toMetricMethod.invoke(counterToRateFunction, event); - Assert.assertEquals("xxx-xxx.int.xxx.com-hbasemaster-sandbox-hadoop.memory.heapmemoryusage.used", metric.getMetricName()); - Assert.assertEquals(100, Double.valueOf(metric.getValue().toString()), 0.00001); - Assert.assertEquals(100, metric.getNumberValue().doubleValue(), 0.00001); - Assert.assertTrue(!metric.isCounter()); - - - } - - @Test - public void testTransformToRate() throws NoSuchFieldException, IllegalAccessException { - List<Map> result = new ArrayList<>(); - OutputCollector collector = new OutputCollector(new IOutputCollector() { - @Override - public List<Integer> emit(String streamId, Collection<Tuple> anchors, List<Object> tuple) { - result.add((Map) tuple.get(1)); - return null; - } - - @Override - public void emitDirect(int taskId, String streamId, Collection<Tuple> anchors, List<Object> tuple) { - - } - - @Override - public void ack(Tuple input) { - - } - - @Override - public void fail(Tuple input) { - - } - - @Override - public void reportError(Throwable error) { - - } - }); - MetricDescriptor metricDefinition = MetricDescriptor - .metricGroupByField("group") - .siteAs("siteId") - .namedByField("metric") - .eventTimeByField("timestamp") - .dimensionFields("host", "component", "site") - .granularity(Calendar.MINUTE) - .valueField("value"); - CounterToRateFunction counterToRateFunction = new CounterToRateFunction(metricDefinition, 3, TimeUnit.MINUTES, ClockWithOffset.INSTANCE); - counterToRateFunction.open(new StormOutputCollector(collector)); - long baseTime = System.currentTimeMillis() + 100000L; - //put first count sample - Map event = mkCountTypeEvent((baseTime + 0), 374042741.0); - counterToRateFunction.transform(event); - Assert.assertTrue(result.isEmpty()); - - Field cacheField = counterToRateFunction.getClass().getDeclaredField("cache"); - cacheField.setAccessible(true); - Map<String, CounterToRateFunction.CounterValue> cache = (Map<String, CounterToRateFunction.CounterValue>) cacheField.get(counterToRateFunction); - Assert.assertTrue(cache.size() == 1); - - CounterToRateFunction.CounterValue counterValue = cache.get("xxx-xxx.int.xxx.com-hbasemaster-sandbox-hadoop.hbase.regionserver.server.totalrequestcount"); - Assert.assertEquals((long) event.get("timestamp"), counterValue.getTimestamp()); - Field valueField = counterValue.getClass().getDeclaredField("value"); - valueField.setAccessible(true); - double value = (double) valueField.get(counterValue); - Assert.assertEquals(374042741.0, value, 0.00001); - result.clear(); - //put not count sample - event = mkOtherTypeEvent((baseTime + 0), 100); - counterToRateFunction.transform(event); - Assert.assertTrue(result.size() == 1); - Assert.assertTrue(cache.size() == 1); - Assert.assertEquals(baseTime + 0, counterValue.getTimestamp()); - Assert.assertEquals(374042741.0, value, 0.00001); - - Assert.assertEquals("hadoop.memory.heapmemoryusage.used", event.get("metric")); - Assert.assertEquals(100, (Double) event.get("value"), 0.00001); - result.clear(); - - //delta of 10 in 5 seconds - event = mkCountTypeEvent((baseTime + 5000), 374042751.0); - counterToRateFunction.transform(event); - - Assert.assertTrue(result.size() == 1); - Map transedEvent = result.get(0); - Assert.assertEquals(baseTime + 5000, transedEvent.get("timestamp")); - Assert.assertEquals(2.0, (double) transedEvent.get("value"), 0.00001); - Assert.assertEquals(baseTime + 5000, counterValue.getTimestamp()); - value = (double) valueField.get(counterValue); - Assert.assertEquals(374042751.0, value, 0.00001); - result.clear(); - - //delta of 15 in 5 seconds - event = mkCountTypeEvent((baseTime + 10000), 374042766.0); - counterToRateFunction.transform(event); - - Assert.assertTrue(result.size() == 1); - transedEvent = result.get(0); - Assert.assertEquals(baseTime + 10000, transedEvent.get("timestamp")); - Assert.assertEquals(3.0, (double) transedEvent.get("value"), 0.00001); - Assert.assertEquals(baseTime + 10000, counterValue.getTimestamp()); - value = (double) valueField.get(counterValue); - Assert.assertEquals(374042766.0, value, 0.00001); - result.clear(); - - - //No change from previous sample - event = mkCountTypeEvent((baseTime + 15000), 374042766.0); - counterToRateFunction.transform(event); - - Assert.assertTrue(result.size() == 1); - transedEvent = result.get(0); - Assert.assertEquals(baseTime + 15000, transedEvent.get("timestamp")); - Assert.assertEquals(0.0, (double) transedEvent.get("value"), 0.00001); - Assert.assertEquals(baseTime + 15000, counterValue.getTimestamp()); - value = (double) valueField.get(counterValue); - Assert.assertEquals(374042766.0, value, 0.00001); - result.clear(); - - //Decrease from previous sample - event = mkCountTypeEvent((baseTime + 20000), 1.0); - counterToRateFunction.transform(event); - - Assert.assertTrue(result.size() == 1); - transedEvent = result.get(0); - Assert.assertEquals(baseTime + 20000, transedEvent.get("timestamp")); - Assert.assertEquals(0.0, (double) transedEvent.get("value"), 0.00001); - Assert.assertEquals(baseTime + 20000, counterValue.getTimestamp()); - value = (double) valueField.get(counterValue); - Assert.assertEquals(1.0, value, 0.00001); - result.clear(); - } - - @Test - public void testTransformToRateWithExpiration() throws NoSuchFieldException, IllegalAccessException { - - MetricDescriptor metricDefinition = MetricDescriptor - .metricGroupByField("group") - .siteAs("siteId") - .namedByField("metric") - .eventTimeByField("timestamp") - .dimensionFields("host", "component", "site") - .granularity(Calendar.MINUTE) - .valueField("value"); - List<Map> result = new ArrayList<>(); - OutputCollector collector = new OutputCollector(new IOutputCollector() { - @Override - public List<Integer> emit(String streamId, Collection<Tuple> anchors, List<Object> tuple) { - result.add((Map) tuple.get(1)); - return null; - } - - @Override - public void emitDirect(int taskId, String streamId, Collection<Tuple> anchors, List<Object> tuple) { - - } - - @Override - public void ack(Tuple input) { - - } - - @Override - public void fail(Tuple input) { - - } - - @Override - public void reportError(Throwable error) { - - } - }); - ManualClock manualClock = new ManualClock(0); - manualClock.set(30000L); - CounterToRateFunction counterToRateFunction = new CounterToRateFunction(metricDefinition, 60, TimeUnit.SECONDS, manualClock); - counterToRateFunction.open(new StormOutputCollector(collector)); - Map event = mkCountTypeEventWithMetricName(manualClock.now(), 110, "hadoop.hbase.regionserver.server.totalrequestcount"); - counterToRateFunction.transform(event); - Field cacheField = counterToRateFunction.getClass().getDeclaredField("cache"); - cacheField.setAccessible(true); - Map<String, CounterToRateFunction.CounterValue> cache = (Map<String, CounterToRateFunction.CounterValue>) cacheField.get(counterToRateFunction); - Assert.assertTrue(cache.size() == 1); - - manualClock.set(50000L); - event = mkCountTypeEventWithMetricName(manualClock.now(), 130, "hadoop.hbase.regionserver.server.readerrequestcount"); - counterToRateFunction.transform(event); - - cache = (Map<String, CounterToRateFunction.CounterValue>) cacheField.get(counterToRateFunction); - Assert.assertEquals(2, cache.size()); - Assert.assertEquals("CounterValue{timestamp=30000, value=110.0}", cache.get("xxx-xxx.int.xxx.com-hbasemaster-sandbox-hadoop.hbase.regionserver.server.totalrequestcount").toString()); - Assert.assertEquals("CounterValue{timestamp=50000, value=130.0}", cache.get("xxx-xxx.int.xxx.com-hbasemaster-sandbox-hadoop.hbase.regionserver.server.readerrequestcount").toString()); - - manualClock.set(100000L); - event = mkCountTypeEventWithMetricName(manualClock.now(), 120, "hadoop.hbase.regionserver.server.totalrequestcount"); - counterToRateFunction.transform(event); - - cache = (Map<String, CounterToRateFunction.CounterValue>) cacheField.get(counterToRateFunction); - Assert.assertEquals(2, cache.size()); - Assert.assertEquals("CounterValue{timestamp=100000, value=120.0}", cache.get("xxx-xxx.int.xxx.com-hbasemaster-sandbox-hadoop.hbase.regionserver.server.totalrequestcount").toString()); - Assert.assertEquals("CounterValue{timestamp=50000, value=130.0}", cache.get("xxx-xxx.int.xxx.com-hbasemaster-sandbox-hadoop.hbase.regionserver.server.readerrequestcount").toString()); - - manualClock.set(160001L); - event = mkCountTypeEventWithMetricName(manualClock.now(), 10, "hadoop.hbase.regionserver.server.writerrequestcount"); - counterToRateFunction.transform(event); - Assert.assertEquals(2, cache.size()); - Assert.assertEquals("CounterValue{timestamp=160001, value=10.0}", cache.get("xxx-xxx.int.xxx.com-hbasemaster-sandbox-hadoop.hbase.regionserver.server.writerrequestcount").toString()); - Assert.assertEquals("CounterValue{timestamp=50000, value=130.0}", cache.get("xxx-xxx.int.xxx.com-hbasemaster-sandbox-hadoop.hbase.regionserver.server.readerrequestcount").toString()); - - - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/eagle/blob/6fd95d5c/eagle-core/eagle-app/eagle-app-base/src/test/java/org/apache/eagle/app/messaging/MetricStreamPersistTest.java ---------------------------------------------------------------------- diff --git a/eagle-core/eagle-app/eagle-app-base/src/test/java/org/apache/eagle/app/messaging/MetricStreamPersistTest.java b/eagle-core/eagle-app/eagle-app-base/src/test/java/org/apache/eagle/app/messaging/MetricStreamPersistTest.java deleted file mode 100644 index 1561a41..0000000 --- a/eagle-core/eagle-app/eagle-app-base/src/test/java/org/apache/eagle/app/messaging/MetricStreamPersistTest.java +++ /dev/null @@ -1,144 +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.eagle.app.messaging; - -import backtype.storm.Testing; -import backtype.storm.task.IOutputCollector; -import backtype.storm.task.OutputCollector; -import backtype.storm.tuple.Tuple; -import backtype.storm.tuple.Values; -import com.typesafe.config.Config; -import org.apache.eagle.app.environment.builder.MetricDescriptor; -import org.apache.eagle.app.utils.StreamConvertHelper; -import org.apache.eagle.log.entity.GenericMetricEntity; -import org.apache.eagle.log.entity.GenericServiceAPIResponseEntity; -import org.apache.eagle.service.client.impl.EagleServiceClientImpl; -import org.junit.Assert; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.powermock.api.mockito.PowerMockito; -import org.powermock.core.classloader.annotations.PrepareForTest; -import org.powermock.modules.junit4.PowerMockRunner; - -import java.lang.reflect.Field; -import java.util.*; - -import static org.mockito.Matchers.anyObject; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -@RunWith(PowerMockRunner.class) -@PrepareForTest( {MetricStreamPersist.class}) -public class MetricStreamPersistTest { - - @Test - public void testStructuredMetricMapper() throws Exception { - MetricDescriptor metricDefinition = MetricDescriptor - .metricGroupByField("group") - .siteAs("siteId") - .namedByField("metric") - .eventTimeByField("timestamp") - .dimensionFields("host", "component", "site") - .granularity(Calendar.MINUTE) - .valueField("value"); - Config config = mock(Config.class); - MetricStreamPersist metricStreamPersist = new MetricStreamPersist(metricDefinition, config); - Field mapperField = metricStreamPersist.getClass().getDeclaredField("mapper"); - mapperField.setAccessible(true); - - Map event = new HashMap(); - event.put("timestamp", 1482106479564L); - event.put("metric", "hadoop.memory.heapmemoryusage.used"); - event.put("component", "hbasemaster"); - event.put("site", "sandbox"); - event.put("value", 14460904.0); - event.put("host", "xxx-xxx.int.xxx.com"); - - Tuple tuple = Testing.testTuple(new Values("metric", event)); - MetricStreamPersist.MetricMapper mapper = (MetricStreamPersist.MetricMapper) mapperField.get(metricStreamPersist); - - GenericMetricEntity metricEntity = mapper.map(StreamConvertHelper.tupleToEvent(tuple).f1()); - - Assert.assertEquals("prefix:hadoop.memory.heapmemoryusage.used, timestamp:1482106440000, humanReadableDate:2016-12-19 00:14:00,000, tags: component=hbasemaster,site=sandbox,host=xxx-xxx.int.xxx.com,, encodedRowkey:null", metricEntity.toString()); - } - - @Test - public void testMetricStreamPersist() throws Exception { - List<String> result = new ArrayList<>(); - OutputCollector collector = new OutputCollector(new IOutputCollector() { - @Override - public List<Integer> emit(String streamId, Collection<Tuple> anchors, List<Object> tuple) { - result.add(String.valueOf(tuple.get(0))); - return null; - } - - @Override - public void emitDirect(int taskId, String streamId, Collection<Tuple> anchors, List<Object> tuple) { - - } - - @Override - public void ack(Tuple input) { - - } - - @Override - public void fail(Tuple input) { - - } - - @Override - public void reportError(Throwable error) { - - } - }); - - MetricDescriptor metricDefinition = MetricDescriptor - .metricGroupByField("group") - .siteAs("siteId") - .namedByField("metric") - .eventTimeByField("timestamp") - .dimensionFields("host", "component", "site") - .granularity(Calendar.MINUTE) - .valueField("value"); - Config config = mock(Config.class); - when(config.hasPath("service.batchSize")).thenReturn(false); - - GenericServiceAPIResponseEntity<String> response = mock(GenericServiceAPIResponseEntity.class); - when(response.isSuccess()).thenReturn(true); - - EagleServiceClientImpl client = mock(EagleServiceClientImpl.class); - PowerMockito.whenNew(EagleServiceClientImpl.class).withArguments(config).thenReturn(client); - when(client.create(anyObject())).thenReturn(response); - - MetricStreamPersist metricStreamPersist = new MetricStreamPersist(metricDefinition, config); - metricStreamPersist.prepare(null, null, collector); - Map event = new HashMap(); - event.put("timestamp", 1482106479564L); - event.put("metric", "hadoop.memory.heapmemoryusage.used"); - event.put("component", "hbasemaster"); - event.put("site", "sandbox"); - event.put("value", 14460904.0); - event.put("host", "xxx-xxx.int.xxx.com"); - - Tuple tuple = Testing.testTuple(new Values("metric", event)); - metricStreamPersist.execute(tuple); - Assert.assertTrue(result.size() == 1); - Assert.assertEquals("hadoop.memory.heapmemoryusage.used", result.get(0)); - } -} - http://git-wip-us.apache.org/repos/asf/eagle/blob/6fd95d5c/eagle-core/eagle-app/eagle-app-base/src/test/java/org/apache/eagle/app/resource/ApplicationResourceTest.java ---------------------------------------------------------------------- diff --git a/eagle-core/eagle-app/eagle-app-base/src/test/java/org/apache/eagle/app/resource/ApplicationResourceTest.java b/eagle-core/eagle-app/eagle-app-base/src/test/java/org/apache/eagle/app/resource/ApplicationResourceTest.java deleted file mode 100644 index 6c68cd2..0000000 --- a/eagle-core/eagle-app/eagle-app-base/src/test/java/org/apache/eagle/app/resource/ApplicationResourceTest.java +++ /dev/null @@ -1,83 +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.eagle.app.resource; - -import com.google.inject.Inject; -import org.apache.eagle.app.service.ApplicationOperations; -import org.apache.eagle.app.test.ApplicationTestBase; -import org.apache.eagle.metadata.model.ApplicationEntity; -import org.apache.eagle.metadata.model.SiteEntity; -import org.apache.eagle.metadata.resource.SiteResource; -import org.apache.eagle.metadata.service.ApplicationStatusUpdateService; -import org.junit.Assert; -import org.junit.Ignore; -import org.junit.Test; - -import java.util.HashMap; -import java.util.Map; - -@Ignore -public class ApplicationResourceTest extends ApplicationTestBase { - - @Inject - private SiteResource siteResource; - @Inject - private ApplicationResource applicationResource; - @Inject - ApplicationStatusUpdateService statusUpdateService; - - @Test - public void testApplicationLifecycle() throws InterruptedException { - // Create local site - SiteEntity siteEntity = new SiteEntity(); - siteEntity.setSiteId("test_site"); - siteEntity.setSiteName("Test Site"); - siteEntity.setDescription("Test Site for ExampleApplicationProviderTest"); - siteResource.createSite(siteEntity); - Assert.assertNotNull(siteEntity.getUuid()); - - ApplicationOperations.InstallOperation installOperation = new ApplicationOperations.InstallOperation("test_site", "TEST_APPLICATION", ApplicationEntity.Mode.LOCAL); - installOperation.setConfiguration(getConf()); - // Install application - ApplicationEntity applicationEntity = applicationResource.installApplication(installOperation).getData(); - // Start application - applicationResource.startApplication(new ApplicationOperations.StartOperation(applicationEntity.getUuid())); - statusUpdateService.updateApplicationEntityStatus(applicationEntity); - // Stop application - applicationResource.stopApplication(new ApplicationOperations.StopOperation(applicationEntity.getUuid())); - awaitApplicationStop(applicationEntity); - // Uninstall application - applicationResource.uninstallApplication(new ApplicationOperations.UninstallOperation(applicationEntity.getUuid())); - try { - applicationResource.getApplicationEntityByUUID(applicationEntity.getUuid()); - Assert.fail("Application instance (UUID: " + applicationEntity.getUuid() + ") should have been uninstalled"); - } catch (Exception ex) { - // Expected exception - } - } - - private Map<String, Object> getConf() { - Map<String, Object> conf = new HashMap<>(); - conf.put("dataSinkConfig.topic", "testTopic"); - conf.put("dataSinkConfig.brokerList", "broker"); - conf.put("dataSinkConfig.serializerClass", "serializerClass"); - conf.put("dataSinkConfig.keySerializerClass", "keySerializerClass"); - conf.put("spoutNum", 2); - conf.put("mode", "LOCAL"); - return conf; - } -} http://git-wip-us.apache.org/repos/asf/eagle/blob/6fd95d5c/eagle-core/eagle-app/eagle-app-base/src/test/java/org/apache/eagle/app/service/ApplicationActionTest.java ---------------------------------------------------------------------- diff --git a/eagle-core/eagle-app/eagle-app-base/src/test/java/org/apache/eagle/app/service/ApplicationActionTest.java b/eagle-core/eagle-app/eagle-app-base/src/test/java/org/apache/eagle/app/service/ApplicationActionTest.java deleted file mode 100644 index 7ab4380..0000000 --- a/eagle-core/eagle-app/eagle-app-base/src/test/java/org/apache/eagle/app/service/ApplicationActionTest.java +++ /dev/null @@ -1,107 +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.eagle.app.service; - -import com.typesafe.config.Config; -import com.typesafe.config.ConfigFactory; -import org.apache.commons.collections.map.HashedMap; -import org.apache.eagle.alert.engine.coordinator.StreamDefinition; -import org.apache.eagle.alert.metadata.IMetadataDao; -import org.apache.eagle.alert.metadata.impl.InMemMetadataDaoImpl; -import org.apache.eagle.alert.metric.MetricConfigs; -import org.apache.eagle.app.Application; -import org.apache.eagle.app.environment.impl.StaticEnvironment; -import org.apache.eagle.metadata.model.ApplicationDesc; -import org.apache.eagle.metadata.model.ApplicationEntity; -import org.apache.eagle.metadata.model.SiteEntity; -import org.junit.Assert; -import org.junit.Test; -import static org.mockito.Mockito.*; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -public class ApplicationActionTest { - /** - * appConfig.withFallback(envConfig): appConfig will override envConfig, envConfig is used as default config - */ - @Test - public void testTypeSafeConfigMerge(){ - Config appConfig = ConfigFactory.parseMap(new HashMap<String,String>(){{ - put("APP_CONFIG",ApplicationActionTest.this.getClass().getCanonicalName()); - put("SCOPE","APP"); - }}); - - Config envConfig = ConfigFactory.parseMap(new HashMap<String,String>(){{ - put("ENV_CONFIG",ApplicationActionTest.this.getClass().getCanonicalName()); - put("SCOPE","ENV"); - }}); - - Config mergedConfig = appConfig.withFallback(envConfig); - Assert.assertTrue(mergedConfig.hasPath("APP_CONFIG")); - Assert.assertTrue(mergedConfig.hasPath("ENV_CONFIG")); - Assert.assertEquals("appConfig.withFallback(envConfig): appConfig will override envConfig, envConfig is used as default config", - "APP",mergedConfig.getString("SCOPE")); - } - - @Test - public void testDoAction() { - Application application = mock(Application.class); - when(application.getEnvironmentType()).thenReturn(StaticEnvironment.class); - SiteEntity siteEntity = new SiteEntity(); - siteEntity.setSiteId("testsiteid"); - siteEntity.setSiteName("testsitename"); - siteEntity.setDescription("testdesc"); - ApplicationDesc applicationDesc = new ApplicationDesc(); - List<StreamDefinition> streamDefinitions = new ArrayList<>(); - StreamDefinition sd = new StreamDefinition(); - sd.setStreamId("streamId"); - sd.setDescription("desc"); - sd.setValidate(true); - sd.setTimeseries(false); - sd.setDataSource("ds1"); - sd.setSiteId("siteId"); - streamDefinitions.add(sd); - applicationDesc.setStreams(streamDefinitions); - applicationDesc.setType("type1"); - ApplicationEntity metadata = new ApplicationEntity(); - metadata.setAppId("appId"); - metadata.setSite(siteEntity); - metadata.setDescriptor(applicationDesc); - metadata.setMode(ApplicationEntity.Mode.LOCAL); - metadata.setJarPath(applicationDesc.getJarPath()); - Map<String, Object> configure = new HashedMap(); - configure.put("dataSinkConfig.topic", "test_topic"); - configure.put("dataSinkConfig.brokerList", "sandbox.hortonworks.com:6667"); - configure.put(MetricConfigs.METRIC_PREFIX_CONF, "eagle."); - metadata.setConfiguration(configure); - metadata.setContext(configure); - Config serverConfig = ConfigFactory.parseMap(new HashMap<String,String>(){{ - put("coordinator.metadataService.host", "localhost"); - put("coordinator.metadataService.context", "/rest"); - }}); - IMetadataDao alertMetadataService = new InMemMetadataDaoImpl(serverConfig); - ApplicationAction applicationAction = new ApplicationAction(application, metadata, serverConfig, alertMetadataService); - applicationAction.doInstall(); - applicationAction.doUninstall(); - applicationAction.doStart(); - applicationAction.doStop(); - Assert.assertEquals(ApplicationEntity.Status.INITIALIZED, applicationAction.getStatus()); - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/eagle/blob/6fd95d5c/eagle-core/eagle-app/eagle-app-base/src/test/java/org/apache/eagle/app/service/TestApplicationHealthCheckEmailPublisher.java ---------------------------------------------------------------------- diff --git a/eagle-core/eagle-app/eagle-app-base/src/test/java/org/apache/eagle/app/service/TestApplicationHealthCheckEmailPublisher.java b/eagle-core/eagle-app/eagle-app-base/src/test/java/org/apache/eagle/app/service/TestApplicationHealthCheckEmailPublisher.java deleted file mode 100644 index 23de188..0000000 --- a/eagle-core/eagle-app/eagle-app-base/src/test/java/org/apache/eagle/app/service/TestApplicationHealthCheckEmailPublisher.java +++ /dev/null @@ -1,64 +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.eagle.app.service; - -import com.codahale.metrics.health.HealthCheck; -import com.typesafe.config.Config; -import com.typesafe.config.ConfigFactory; -import org.apache.eagle.alert.engine.publisher.email.EagleMailClient; -import org.apache.eagle.app.service.impl.ApplicationHealthCheckEmailPublisher; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.powermock.api.mockito.PowerMockito; -import org.powermock.core.classloader.annotations.PrepareForTest; -import org.powermock.modules.junit4.PowerMockRunner; -import static org.mockito.Mockito.*; - -import java.util.HashMap; - -/** - * @Since 11/24/16. - */ -@RunWith(PowerMockRunner.class) -@PrepareForTest({ApplicationHealthCheckEmailPublisher.class}) -public class TestApplicationHealthCheckEmailPublisher { - - @Test - public void testOnUnHealthApplication() throws Exception { - Config config = ConfigFactory.parseMap(new HashMap<String, String>() { - { - put("mail.smtp.recipients", "[email protected]"); - put("mail.smtp.sender", "[email protected]"); - put("mail.smtp.subject", "test_subject"); - put("mail.smtp.cc", "[email protected]"); - put("mail.smtp.template", "test_template"); - put("mail.smtp.host", "localhost"); - put("mail.smtp.port", "25"); - put("host", "localhost"); - put("port", "9090"); - } - }); - ApplicationHealthCheckEmailPublisher publisher = new ApplicationHealthCheckEmailPublisher(config); - EagleMailClient client = mock(EagleMailClient.class); - PowerMockito.whenNew(EagleMailClient.class).withAnyArguments().thenReturn(client); - when(client.send(anyString(), anyString(), anyString(), anyString(), anyString(), anyObject(), anyObject())).thenReturn(false, true); - publisher.onUnHealthApplication("appId", new HashMap<String, HealthCheck.Result>(){{ - put("appId", HealthCheck.Result.healthy()); - }}); - verify(client, times(2)).send(anyString(), anyString(), anyString(), anyString(), anyString(), anyObject(), anyObject()); - } -} http://git-wip-us.apache.org/repos/asf/eagle/blob/6fd95d5c/eagle-core/eagle-app/eagle-app-base/src/test/java/org/apache/eagle/app/service/TestApplicationHealthCheckServiceImpl.java ---------------------------------------------------------------------- diff --git a/eagle-core/eagle-app/eagle-app-base/src/test/java/org/apache/eagle/app/service/TestApplicationHealthCheckServiceImpl.java b/eagle-core/eagle-app/eagle-app-base/src/test/java/org/apache/eagle/app/service/TestApplicationHealthCheckServiceImpl.java deleted file mode 100644 index ebb4856..0000000 --- a/eagle-core/eagle-app/eagle-app-base/src/test/java/org/apache/eagle/app/service/TestApplicationHealthCheckServiceImpl.java +++ /dev/null @@ -1,101 +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.eagle.app.service; - -import com.codahale.metrics.health.HealthCheckRegistry; -import com.google.inject.Injector; -import com.typesafe.config.Config; -import com.typesafe.config.ConfigFactory; -import io.dropwizard.setup.Environment; -import org.apache.commons.collections.map.HashedMap; -import org.apache.eagle.app.service.impl.ApplicationHealthCheckServiceImpl; -import org.apache.eagle.app.service.impl.ApplicationProviderServiceImpl; -import org.apache.eagle.metadata.model.ApplicationDesc; -import org.apache.eagle.metadata.model.ApplicationEntity; -import org.apache.eagle.metadata.model.SiteEntity; -import org.apache.eagle.metadata.service.ApplicationEntityService; -import org.junit.Before; -import org.junit.Test; -import org.powermock.reflect.Whitebox; - -import java.util.*; - -import static org.mockito.Mockito.*; - -/** - * @Since 11/24/16. - */ -public class TestApplicationHealthCheckServiceImpl { - - ApplicationProviderService applicationProviderService; - ApplicationEntityService applicationEntityService; - Environment environment; - Config config; - ApplicationHealthCheckServiceImpl applicationHealthCheckService; - - @Before - public void setUp() { - applicationEntityService = mock(ApplicationEntityService.class); - environment = mock(Environment.class); - config = ConfigFactory.parseMap(new HashMap<String, String>() { - { - put("application.healthCheck.initialDelay", "10000"); - put("application.healthCheck.period", "10000"); - put("application.healthCheck.publisher.publisherImpl", "org.apache.eagle.app.service.impl.ApplicationHealthCheckEmailPublisher"); - put("application.healthCheck.publisher.dailySendHour", "11"); - put("service.timezone", "UTC"); - put("application.provider.loader", "org.apache.eagle.app.service.impl.ApplicationProviderSPILoader"); - } - }); - applicationProviderService = new ApplicationProviderServiceImpl(config); - HealthCheckRegistry healthCheckRegistry = new HealthCheckRegistry(); - when(environment.healthChecks()).thenReturn(healthCheckRegistry); - when(applicationEntityService.findAll()).thenReturn(generateCollections()); - applicationHealthCheckService = new ApplicationHealthCheckServiceImpl(applicationProviderService, applicationEntityService, config); - Injector injector = mock(Injector.class); - Whitebox.setInternalState(applicationHealthCheckService, "currentInjector", injector); - - } - - @Test - public void testInit() throws NoSuchFieldException, IllegalAccessException { - applicationHealthCheckService.init(environment); - applicationHealthCheckService.unregister((ApplicationEntity)((List)generateCollections()).get(0)); - } - - public Collection<ApplicationEntity> generateCollections() { - Collection<ApplicationEntity> entities = new ArrayList<>(); - SiteEntity siteEntity = new SiteEntity(); - siteEntity.setSiteId("testsiteid"); - siteEntity.setSiteName("testsitename"); - siteEntity.setDescription("testdesc"); - ApplicationDesc applicationDesc = new ApplicationDesc(); - applicationDesc.setType("TEST_APPLICATION"); - ApplicationEntity applicationEntity = new ApplicationEntity(); - applicationEntity.setSite(siteEntity); - applicationEntity.setDescriptor(applicationDesc); - applicationEntity.setMode(ApplicationEntity.Mode.LOCAL); - applicationEntity.setJarPath(applicationDesc.getJarPath()); - Map<String, Object> configure = new HashedMap(); - configure.put("a", "b"); - applicationEntity.setConfiguration(configure); - applicationEntity.setContext(configure); - applicationEntity.setAppId("appId"); - entities.add(applicationEntity); - return entities; - } -} http://git-wip-us.apache.org/repos/asf/eagle/blob/6fd95d5c/eagle-core/eagle-app/eagle-app-base/src/test/java/org/apache/eagle/app/service/TestApplicationManagementServiceImpl.java ---------------------------------------------------------------------- diff --git a/eagle-core/eagle-app/eagle-app-base/src/test/java/org/apache/eagle/app/service/TestApplicationManagementServiceImpl.java b/eagle-core/eagle-app/eagle-app-base/src/test/java/org/apache/eagle/app/service/TestApplicationManagementServiceImpl.java deleted file mode 100644 index c4b0227..0000000 --- a/eagle-core/eagle-app/eagle-app-base/src/test/java/org/apache/eagle/app/service/TestApplicationManagementServiceImpl.java +++ /dev/null @@ -1,181 +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.eagle.app.service; - -import com.typesafe.config.Config; -import com.typesafe.config.ConfigFactory; -import junit.framework.Assert; -import org.apache.commons.collections.map.HashedMap; -import org.apache.eagle.alert.metadata.IMetadataDao; -import org.apache.eagle.alert.metadata.impl.InMemMetadataDaoImpl; -import org.apache.eagle.app.service.impl.ApplicationHealthCheckServiceImpl; -import org.apache.eagle.app.service.impl.ApplicationManagementServiceImpl; -import org.apache.eagle.app.service.impl.ApplicationProviderServiceImpl; -import org.apache.eagle.metadata.exceptions.ApplicationWrongStatusException; -import org.apache.eagle.metadata.exceptions.EntityNotFoundException; -import org.apache.eagle.metadata.model.ApplicationDependency; -import org.apache.eagle.metadata.model.ApplicationDesc; -import org.apache.eagle.metadata.model.ApplicationEntity; -import org.apache.eagle.metadata.model.SiteEntity; -import org.apache.eagle.metadata.service.ApplicationEntityService; -import org.apache.eagle.metadata.service.SiteEntityService; -import org.apache.eagle.metadata.service.memory.ApplicationEntityServiceMemoryImpl; -import org.apache.eagle.metadata.service.memory.SiteEntityEntityServiceMemoryImpl; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.powermock.api.mockito.PowerMockito; -import org.powermock.core.classloader.annotations.PrepareForTest; -import org.powermock.modules.junit4.PowerMockRunner; -import static org.mockito.Mockito.*; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Map; - -/** - * @Since 11/25/16. - */ -@RunWith(PowerMockRunner.class) -@PrepareForTest({ApplicationManagementServiceImpl.class}) -public class TestApplicationManagementServiceImpl { - - SiteEntityService siteEntityService; - ApplicationProviderService applicationProviderService; - ApplicationEntityService applicationEntityService; - Config config; - IMetadataDao alertMetadataService; - ApplicationHealthCheckService applicationHealthCheckService; - ApplicationManagementService applicationManagementService; - ApplicationOperations.InstallOperation installOperation; - ApplicationOperations.UninstallOperation uninstallOperation; - ApplicationOperations.StartOperation startOperation; - ApplicationOperations.StopOperation stopOperation; - ApplicationOperations.CheckStatusOperation checkStatusOperation; - ApplicationEntity resultEntity; - - @Before - public void setUp() throws EntityNotFoundException{ - siteEntityService = mock(SiteEntityEntityServiceMemoryImpl.class); - applicationEntityService = mock(ApplicationEntityServiceMemoryImpl.class); - config = ConfigFactory.parseMap(new HashMap<String, String>() { - { - put("application.healthCheck.initialDelay", "10000"); - put("application.healthCheck.period", "10000"); - put("application.healthCheck.publisher.publisherImpl", "org.apache.eagle.app.service.impl.ApplicationHealthCheckEmailPublisher"); - put("application.healthCheck.publisher.dailySendHour", "11"); - put("service.timezone", "UTC"); - put("application.provider.loader", "org.apache.eagle.app.service.impl.ApplicationProviderSPILoader"); - put("dataSinkConfig.topic", "test_topic"); - put("dataSinkConfig.brokerList", "sandbox.hortonworks.com:6667"); - put("spoutNum", "4"); - put("appId", "testAppId"); - } - }); - alertMetadataService = new InMemMetadataDaoImpl(config); - applicationProviderService = new ApplicationProviderServiceImpl(config); - applicationHealthCheckService = mock(ApplicationHealthCheckServiceImpl.class); - applicationManagementService = new ApplicationManagementServiceImpl(config, siteEntityService, applicationProviderService, applicationEntityService, - alertMetadataService, applicationHealthCheckService); - installOperation = new ApplicationOperations.InstallOperation("sandbox", "TEST_APPLICATION", ApplicationEntity.Mode.LOCAL, "/user"); - startOperation = new ApplicationOperations.StartOperation(null, "TEST_APPLICATION_SANDBOX"); - stopOperation = new ApplicationOperations.StopOperation(null, "TEST_APPLICATION_SANDBOX"); - uninstallOperation = new ApplicationOperations.UninstallOperation(null, "TEST_APPLICATION_SANDBOX"); - checkStatusOperation = new ApplicationOperations.CheckStatusOperation(null, "TEST_APPLICATION_SANDBOX"); - when(siteEntityService.getBySiteId(anyString())).thenReturn(generateSiteEntity()); - } - - - @Test - public void testInstall() throws EntityNotFoundException { - when(applicationEntityService.create(any(ApplicationEntity.class))).thenReturn(generateCommonEntity()); - resultEntity = applicationManagementService.install(installOperation); - Assert.assertNotNull(resultEntity); - } - - @Test - public void testUnInstall() throws ApplicationWrongStatusException { - when(applicationEntityService.getByUUIDOrAppId(anyString(), anyString())).thenReturn(generateCommonEntity()); - resultEntity = applicationManagementService.uninstall(uninstallOperation); - verify(applicationEntityService, times(1)).delete(any(ApplicationEntity.class)); - } - - @Test - public void testStart() throws Exception { - when(applicationEntityService.getByUUIDOrAppId(anyString(), anyString())).thenReturn(generateCommonEntity()); - ApplicationAction applicationAction = mock(ApplicationAction.class); - PowerMockito.whenNew(ApplicationAction.class).withArguments(anyObject(), anyObject(), anyObject(), anyObject()).thenReturn(applicationAction); - resultEntity = applicationManagementService.start(startOperation); - verify(applicationAction, times(1)).doStart(); - verify(applicationEntityService, times(1)).create(any(ApplicationEntity.class)); - } - - @Test - public void testStop() throws Exception { - when(applicationEntityService.getByUUIDOrAppId(anyString(), anyString())).thenReturn(generateRunningEntity()); - ApplicationAction applicationAction = mock(ApplicationAction.class); - PowerMockito.whenNew(ApplicationAction.class).withArguments(anyObject(), anyObject(), anyObject(), anyObject()).thenReturn(applicationAction); - resultEntity = applicationManagementService.stop(stopOperation); - verify(applicationAction, times(1)).doStop(); - verify(applicationEntityService, times(1)).delete(any(ApplicationEntity.class)); - verify(applicationEntityService, times(1)).create(any(ApplicationEntity.class)); - } - - @Test - public void testGetStatus() throws Exception { - when(applicationEntityService.getByUUIDOrAppId(anyString(), anyString())).thenReturn(generateRunningEntity()); - ApplicationAction applicationAction = mock(ApplicationAction.class); - PowerMockito.whenNew(ApplicationAction.class).withArguments(anyObject(), anyObject(), anyObject(), anyObject()).thenReturn(applicationAction); - when(applicationAction.getStatus()).thenReturn(ApplicationEntity.Status.RUNNING); - ApplicationEntity.Status status = applicationManagementService.getStatus(checkStatusOperation); - Assert.assertEquals(ApplicationEntity.Status.RUNNING, status); - } - - private SiteEntity generateSiteEntity() { - SiteEntity siteEntity = new SiteEntity(); - siteEntity.setSiteId("sandbox"); - siteEntity.setSiteName("sandboxname"); - siteEntity.setDescription("sandboxdesc"); - return siteEntity; - } - - private ApplicationEntity generateCommonEntity() { - ApplicationDesc applicationDesc = new ApplicationDesc(); - ApplicationDependency applicationDependency = new ApplicationDependency(); - applicationDependency.setRequired(false); - applicationDesc.setType("TEST_APPLICATION"); - applicationDesc.setDependencies(new ArrayList<ApplicationDependency>(){{ - add(applicationDependency); - }}); - ApplicationEntity applicationEntity = new ApplicationEntity(); - applicationEntity.setSite(generateSiteEntity()); - applicationEntity.setDescriptor(applicationDesc); - applicationEntity.setMode(ApplicationEntity.Mode.LOCAL); - applicationEntity.setJarPath(applicationDesc.getJarPath()); - Map<String, Object> configure = new HashedMap(); - configure.put("a", "b"); - applicationEntity.setConfiguration(configure); - applicationEntity.setContext(configure); - applicationEntity.setAppId("testAppId"); - return applicationEntity; - } - - private ApplicationEntity generateRunningEntity() { - ApplicationEntity applicationEntity = generateCommonEntity(); - applicationEntity.setStatus(ApplicationEntity.Status.RUNNING); - return applicationEntity; - } -} http://git-wip-us.apache.org/repos/asf/eagle/blob/6fd95d5c/eagle-core/eagle-app/eagle-app-base/src/test/java/org/apache/eagle/app/storm/MockStormApplication.java ---------------------------------------------------------------------- diff --git a/eagle-core/eagle-app/eagle-app-base/src/test/java/org/apache/eagle/app/storm/MockStormApplication.java b/eagle-core/eagle-app/eagle-app-base/src/test/java/org/apache/eagle/app/storm/MockStormApplication.java deleted file mode 100644 index eda9383..0000000 --- a/eagle-core/eagle-app/eagle-app-base/src/test/java/org/apache/eagle/app/storm/MockStormApplication.java +++ /dev/null @@ -1,60 +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.eagle.app.storm; - -import backtype.storm.generated.StormTopology; -import backtype.storm.spout.SpoutOutputCollector; -import backtype.storm.task.TopologyContext; -import backtype.storm.topology.OutputFieldsDeclarer; -import backtype.storm.topology.TopologyBuilder; -import backtype.storm.topology.base.BaseRichSpout; -import backtype.storm.tuple.Fields; -import com.typesafe.config.Config; -import org.apache.eagle.app.StormApplication; -import org.apache.eagle.app.environment.impl.StormEnvironment; - -import java.util.Arrays; -import java.util.Map; - -public class MockStormApplication extends StormApplication { - @Override - public StormTopology execute(Config config, StormEnvironment environment) { - TopologyBuilder builder = new TopologyBuilder(); - builder.setSpout("metric_spout", new RandomEventSpout(), config.getInt("spoutNum")); - builder.setBolt("sink_1",environment.getStreamSink("TEST_STREAM_1",config)).fieldsGrouping("metric_spout",new Fields("metric")); - builder.setBolt("sink_2",environment.getStreamSink("TEST_STREAM_2",config)).fieldsGrouping("metric_spout",new Fields("metric")); - return builder.createTopology(); - } - - private class RandomEventSpout extends BaseRichSpout { - private SpoutOutputCollector _collector; - @Override - public void open(Map map, TopologyContext topologyContext, SpoutOutputCollector spoutOutputCollector) { - _collector = spoutOutputCollector; - } - - @Override - public void nextTuple() { - _collector.emit(Arrays.asList("disk.usage",System.currentTimeMillis(),"host_1",56.7)); - _collector.emit(Arrays.asList("cpu.usage",System.currentTimeMillis(),"host_2",99.8)); - } - @Override - public void declareOutputFields(OutputFieldsDeclarer outputFieldsDeclarer) { - outputFieldsDeclarer.declare(new Fields("metric","timestamp","fromStream","value")); - } - } -} http://git-wip-us.apache.org/repos/asf/eagle/blob/6fd95d5c/eagle-core/eagle-app/eagle-app-base/src/test/java/org/apache/eagle/app/storm/MockStormApplicationTest.java ---------------------------------------------------------------------- diff --git a/eagle-core/eagle-app/eagle-app-base/src/test/java/org/apache/eagle/app/storm/MockStormApplicationTest.java b/eagle-core/eagle-app/eagle-app-base/src/test/java/org/apache/eagle/app/storm/MockStormApplicationTest.java deleted file mode 100644 index 84539c0..0000000 --- a/eagle-core/eagle-app/eagle-app-base/src/test/java/org/apache/eagle/app/storm/MockStormApplicationTest.java +++ /dev/null @@ -1,37 +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.eagle.app.storm; - -import org.apache.eagle.app.environment.impl.StormEnvironment; -import org.junit.Assert; -import org.junit.Ignore; -import org.junit.Test; - -public class MockStormApplicationTest { - @Ignore - @Test - public void testGetConfigClass(){ - MockStormApplication mockStormApplication = new MockStormApplication(); - Assert.assertEquals(StormEnvironment.class,mockStormApplication.getEnvironmentType()); - } - - @Ignore - @Test - public void testRunApplicationWithSysConfig(){ - new MockStormApplication().run(); - } -} http://git-wip-us.apache.org/repos/asf/eagle/blob/6fd95d5c/eagle-core/eagle-app/eagle-app-base/src/test/java/org/apache/eagle/app/stream/CEPFunctionTest.java ---------------------------------------------------------------------- diff --git a/eagle-core/eagle-app/eagle-app-base/src/test/java/org/apache/eagle/app/stream/CEPFunctionTest.java b/eagle-core/eagle-app/eagle-app-base/src/test/java/org/apache/eagle/app/stream/CEPFunctionTest.java deleted file mode 100644 index 039c087..0000000 --- a/eagle-core/eagle-app/eagle-app-base/src/test/java/org/apache/eagle/app/stream/CEPFunctionTest.java +++ /dev/null @@ -1,60 +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.eagle.app.stream; - -import org.apache.eagle.app.environment.builder.CEPFunction; -import org.apache.eagle.app.environment.builder.Collector; -import org.junit.Assert; -import org.junit.Test; - -import java.util.HashMap; -import java.util.Map; -import java.util.concurrent.Semaphore; -import java.util.concurrent.TimeUnit; - -public class CEPFunctionTest { - @Test - public void testSiddhiFunction() throws InterruptedException { - Semaphore semaphore = new Semaphore(0); - CEPFunction function = new CEPFunction( - "define stream inputStream (name string, value double);\n " - + "from inputStream#window.timeBatch( 5 sec ) \n" + - "select name, avg(value) as avgValue\n" + - "group by name \n" + - "insert into outputStream ", - "inputStream","outputStream"); - Collector collector = new Collector() { - @Override - public void collect(Object key, Map event) { - Assert.assertTrue(event.get("avgValue") instanceof Double); - Assert.assertTrue(Double.valueOf(event.get("avgValue").toString()) == 0.97); - semaphore.release(); - } - }; - function.open(collector); - function.transform(new HashMap<String,Object>() {{ - put("name","cpu.usage"); - put("value", 0.98); - }}); - function.transform(new HashMap<String,Object>() {{ - put("name","cpu.usage"); - put("value", 0.96); - }}); - Assert.assertTrue("Should get result in 5 s", semaphore.tryAcquire(15, TimeUnit.SECONDS)); - function.close(); - } -} http://git-wip-us.apache.org/repos/asf/eagle/blob/6fd95d5c/eagle-core/eagle-app/eagle-app-base/src/test/resources/ExampleApplicationConf.xml ---------------------------------------------------------------------- diff --git a/eagle-core/eagle-app/eagle-app-base/src/test/resources/ExampleApplicationConf.xml b/eagle-core/eagle-app/eagle-app-base/src/test/resources/ExampleApplicationConf.xml deleted file mode 100644 index 4a31c5e..0000000 --- a/eagle-core/eagle-app/eagle-app-base/src/test/resources/ExampleApplicationConf.xml +++ /dev/null @@ -1,31 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - ~ 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. - --> -<configuration> - <property> - <name>kafka.topic</name> - <displayName>Kafka Topic</displayName> - <value>hdfs_audit</value> - <description>Kafka Topic</description> - </property> - <property> - <name>zookeeper.server</name> - <displayName>Zookeeper Server</displayName> - <value>localhost:2181</value> - <description>Zookeeper Server address</description> - </property> -</configuration> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/eagle/blob/6fd95d5c/eagle-core/eagle-app/eagle-app-base/src/test/resources/META-INF/providers/org.apache.eagle.app.TestStormApplication$Provider.xml ---------------------------------------------------------------------- diff --git a/eagle-core/eagle-app/eagle-app-base/src/test/resources/META-INF/providers/org.apache.eagle.app.TestStormApplication$Provider.xml b/eagle-core/eagle-app/eagle-app-base/src/test/resources/META-INF/providers/org.apache.eagle.app.TestStormApplication$Provider.xml deleted file mode 100644 index 672cf2d..0000000 --- a/eagle-core/eagle-app/eagle-app-base/src/test/resources/META-INF/providers/org.apache.eagle.app.TestStormApplication$Provider.xml +++ /dev/null @@ -1,109 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<!-- - ~ 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. - --> - -<application> - <type>TEST_APPLICATION</type> - <name>Test Monitoring Application</name> - <appClass>org.apache.eagle.app.TestStormApplication</appClass> - <configuration> - <property> - <name>message.content</name> - <displayName>Message</displayName> - <value>Hello, example application!</value> - <description>Just an sample configuration property</description> - </property> - </configuration> - - <!-- Output components --> - <streams> - <stream> - <streamId>TEST_STREAM_1</streamId> - <description>Example output stream #1</description> - <validate>true</validate> - <timeseries>true</timeseries> - <columns> - <column> - <name>metric</name> - <type>string</type> - </column> - <column> - <name>source</name> - <type>string</type> - </column> - <column> - <name>value</name> - <type>double</type> - <defaultValue>0.0</defaultValue> - </column> - </columns> - </stream> - <stream> - <streamId>TEST_STREAM_2</streamId> - <description>Example output stream #2</description> - <validate>true</validate> - <timeseries>true</timeseries> - <columns> - <column> - <name>metric</name> - <type>string</type> - </column> - <column> - <name>source</name> - <type>string</type> - </column> - <column> - <name>value</name> - <type>double</type> - <defaultValue>0.0</defaultValue> - </column> - </columns> - </stream> - </streams> - <docs> - <install> - # Step 1: Create source kafka topic named "${site}_example_source_topic" - - ./bin/kafka-topics.sh --create --topic example_source_topic --replication-factor 1 --replication 1 - - # Step 2: Set up data collector to flow data into kafka topic in - - ./bin/logstash -f log_collector.conf - - ## `log_collector.conf` sample as following: - - input { - - } - filter { - - } - output{ - - } - - # Step 3: start application - - # Step 4: monitor with featured portal or alert with policies - </install> - <uninstall> - # Step 1: stop and uninstall application - # Step 2: delete kafka topic named "${site}_example_source_topic" - # Step 3: stop logstash - </uninstall> - </docs> -</application> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/eagle/blob/6fd95d5c/eagle-core/eagle-app/eagle-app-base/src/test/resources/META-INF/providers/org.apache.eagle.app.TestWebApplication$Provider.xml ---------------------------------------------------------------------- diff --git a/eagle-core/eagle-app/eagle-app-base/src/test/resources/META-INF/providers/org.apache.eagle.app.TestWebApplication$Provider.xml b/eagle-core/eagle-app/eagle-app-base/src/test/resources/META-INF/providers/org.apache.eagle.app.TestWebApplication$Provider.xml deleted file mode 100644 index ecf1d88..0000000 --- a/eagle-core/eagle-app/eagle-app-base/src/test/resources/META-INF/providers/org.apache.eagle.app.TestWebApplication$Provider.xml +++ /dev/null @@ -1,37 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<!-- - ~ 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. - --> - -<application> - <type>TEST_WEB_APPLICATION</type> - <name>Test Monitoring Web Application</name> - <version>0.5.0-beta</version> - <viewPath>/apps/test_web_app</viewPath> - <dependencies> - <dependency> - <type>TEST_APPLICATION</type> - </dependency> - </dependencies> - <docs> - <install> - <h1>Installation Guide</h1> - </install> - <uninstall> - <h1>Un-installation Guide</h1> - </uninstall> - </docs> -</application> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/eagle/blob/6fd95d5c/eagle-core/eagle-app/eagle-app-base/src/test/resources/META-INF/services/org.apache.eagle.app.spi.ApplicationProvider ---------------------------------------------------------------------- diff --git a/eagle-core/eagle-app/eagle-app-base/src/test/resources/META-INF/services/org.apache.eagle.app.spi.ApplicationProvider b/eagle-core/eagle-app/eagle-app-base/src/test/resources/META-INF/services/org.apache.eagle.app.spi.ApplicationProvider deleted file mode 100644 index 6810a3d..0000000 --- a/eagle-core/eagle-app/eagle-app-base/src/test/resources/META-INF/services/org.apache.eagle.app.spi.ApplicationProvider +++ /dev/null @@ -1,17 +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. - -org.apache.eagle.app.TestStormApplication$Provider -org.apache.eagle.app.TestWebApplication$Provider \ No newline at end of file http://git-wip-us.apache.org/repos/asf/eagle/blob/6fd95d5c/eagle-core/eagle-app/eagle-app-base/src/test/resources/TestApplicationConf.xml ---------------------------------------------------------------------- diff --git a/eagle-core/eagle-app/eagle-app-base/src/test/resources/TestApplicationConf.xml b/eagle-core/eagle-app/eagle-app-base/src/test/resources/TestApplicationConf.xml deleted file mode 100644 index 4a31c5e..0000000 --- a/eagle-core/eagle-app/eagle-app-base/src/test/resources/TestApplicationConf.xml +++ /dev/null @@ -1,31 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - ~ 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. - --> -<configuration> - <property> - <name>kafka.topic</name> - <displayName>Kafka Topic</displayName> - <value>hdfs_audit</value> - <description>Kafka Topic</description> - </property> - <property> - <name>zookeeper.server</name> - <displayName>Zookeeper Server</displayName> - <value>localhost:2181</value> - <description>Zookeeper Server address</description> - </property> -</configuration> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/eagle/blob/6fd95d5c/eagle-core/eagle-app/eagle-app-base/src/test/resources/TestStreamDefinitionConf.xml ---------------------------------------------------------------------- diff --git a/eagle-core/eagle-app/eagle-app-base/src/test/resources/TestStreamDefinitionConf.xml b/eagle-core/eagle-app/eagle-app-base/src/test/resources/TestStreamDefinitionConf.xml deleted file mode 100644 index 0bb0012..0000000 --- a/eagle-core/eagle-app/eagle-app-base/src/test/resources/TestStreamDefinitionConf.xml +++ /dev/null @@ -1,37 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<!-- - ~ 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. - --> - -<streams> - <stream> - <streamId>OUTPUT_STREAM_1</streamId> - <description>Example output stream</description> - <validate>true</validate> - <timeseries>true</timeseries> - <columns> - <column> - <name>metric</name> - <type>string</type> - </column> - <column> - <name>value</name> - <type>double</type> - <defaultValue>0.0</defaultValue> - </column> - </columns> - </stream> -</streams> \ No newline at end of file
