]> jfr.im git - irc/rizon/moo.git/commitdiff
Change line endings to lf
authorAdam <redacted>
Wed, 28 Dec 2016 20:49:43 +0000 (15:49 -0500)
committerAdam <redacted>
Wed, 28 Dec 2016 20:49:43 +0000 (15:49 -0500)
grafana/src/test/java/net/rizon/moo/plugin/grafana/HttpServerHandlerTest.java

index de8d12e161f9b2e1bc295c44786827466f048647..1e49502a3bf02729dbd7b72abc0a99a1bc1bed7c 100644 (file)
@@ -1,88 +1,88 @@
-/*\r
- * Copyright (c) 2016, Adam <Adam@rizon.net>\r
- * All rights reserved.\r
- *\r
- * Redistribution and use in source and binary forms, with or without\r
- * modification, are permitted provided that the following conditions are met:\r
- *\r
- * 1. Redistributions of source code must retain the above copyright notice, this\r
- *    list of conditions and the following disclaimer.\r
- * 2. Redistributions in binary form must reproduce the above copyright notice,\r
- *    this list of conditions and the following disclaimer in the documentation\r
- *    and/or other materials provided with the distribution.\r
- *\r
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND\r
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\r
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\r
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR\r
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\r
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\r
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\r
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\r
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\r
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
- */\r
-package net.rizon.moo.plugin.grafana;\r
-\r
-import com.google.inject.Provider;\r
-import com.google.inject.testing.fieldbinder.Bind;\r
-import io.netty.channel.ChannelHandlerContext;\r
-import java.util.Arrays;\r
-import javax.inject.Inject;\r
-import net.rizon.moo.irc.Protocol;\r
-import net.rizon.moo.plugin.grafana.beans.GrafanaNotification;\r
-import net.rizon.moo.plugin.grafana.beans.Metric;\r
-import net.rizon.moo.plugin.grafana.conf.GrafanaConfiguration;\r
-import net.rizon.moo.test.MooJUnitRunner;\r
-import org.junit.Test;\r
-import org.junit.runner.RunWith;\r
-import org.mockito.Matchers;\r
-import org.mockito.Mock;\r
-import static org.mockito.Mockito.verify;\r
-import static org.mockito.Mockito.when;\r
-\r
-@RunWith(MooJUnitRunner.class)\r
-public class HttpServerHandlerTest\r
-{\r
-       @Mock\r
-       private ChannelHandlerContext ctx;\r
-\r
-       @Bind\r
-       @Mock\r
-       private Protocol protocol;\r
-\r
-       @Inject\r
-       private HttpServerHandler handler;\r
-\r
-       @Mock\r
-       private GrafanaConfiguration conf;\r
-\r
-       @Bind\r
-       private Provider<GrafanaConfiguration> confProvider = new Provider<GrafanaConfiguration>()\r
-       {\r
-               @Override\r
-               public GrafanaConfiguration get()\r
-               {\r
-                       return conf;\r
-               }\r
-       };\r
-\r
-       @Test\r
-       public void testChannelRead0() throws Exception\r
-       {\r
-               when(conf.getReportStates()).thenReturn(Arrays.asList("alerting"));\r
-\r
-               GrafanaNotification notification = new GrafanaNotification();\r
-               notification.setRuleName("test");\r
-               notification.setState("alerting");\r
-               notification.setEvalMatches(Arrays.asList(\r
-                       new Metric("42", "server.one", null),\r
-                       new Metric("43", "server.two", null)\r
-               ));\r
-\r
-               handler.channelRead0(ctx, notification);\r
-\r
-               verify(protocol).privmsg(Matchers.anyString(), Matchers.eq("Grafana: test is now in state alerting for metric(s): server.one (42), server.two (43)"));\r
-       }\r
-\r
-}\r
+/*
+ * Copyright (c) 2016, Adam <Adam@rizon.net>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ *    list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package net.rizon.moo.plugin.grafana;
+
+import com.google.inject.Provider;
+import com.google.inject.testing.fieldbinder.Bind;
+import io.netty.channel.ChannelHandlerContext;
+import java.util.Arrays;
+import javax.inject.Inject;
+import net.rizon.moo.irc.Protocol;
+import net.rizon.moo.plugin.grafana.beans.GrafanaNotification;
+import net.rizon.moo.plugin.grafana.beans.Metric;
+import net.rizon.moo.plugin.grafana.conf.GrafanaConfiguration;
+import net.rizon.moo.test.MooJUnitRunner;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Matchers;
+import org.mockito.Mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+@RunWith(MooJUnitRunner.class)
+public class HttpServerHandlerTest
+{
+       @Mock
+       private ChannelHandlerContext ctx;
+
+       @Bind
+       @Mock
+       private Protocol protocol;
+
+       @Inject
+       private HttpServerHandler handler;
+
+       @Mock
+       private GrafanaConfiguration conf;
+
+       @Bind
+       private Provider<GrafanaConfiguration> confProvider = new Provider<GrafanaConfiguration>()
+       {
+               @Override
+               public GrafanaConfiguration get()
+               {
+                       return conf;
+               }
+       };
+
+       @Test
+       public void testChannelRead0() throws Exception
+       {
+               when(conf.getReportStates()).thenReturn(Arrays.asList("alerting"));
+
+               GrafanaNotification notification = new GrafanaNotification();
+               notification.setRuleName("test");
+               notification.setState("alerting");
+               notification.setEvalMatches(Arrays.asList(
+                       new Metric("42", "server.one", null),
+                       new Metric("43", "server.two", null)
+               ));
+
+               handler.channelRead0(ctx, notification);
+
+               verify(protocol).privmsg(Matchers.anyString(), Matchers.eq("Grafana: test is now in state alerting for metric(s): server.one (42), server.two (43)"));
+       }
+
+}