Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

initial irc server configuration

  • Loading branch information...
commit 9788f22de4c5b29e95c5e8b6bdc4a74b63d12081 1 parent 0a549dd
Florian Hopf authored August 23, 2011
5  src/main/scala/org/synyx/git/ConfigurationService.scala
@@ -14,4 +14,9 @@ object ConfigurationService {
14 14
     filtered
15 15
   }
16 16
 
  17
+  def readIrcConfig(path: String) = {
  18
+    val line = Source.fromFile(path).getLines.toList (0)
  19
+    val tokens = line.split(" ")
  20
+    new IrcServer(tokens(0), tokens.slice(1, tokens.length).toList)
  21
+  }
17 22
 }
4  src/main/scala/org/synyx/git/IrcServer.scala
... ...
@@ -0,0 +1,4 @@
  1
+package org.synyx.git
  2
+
  3
+class IrcServer(val server: String, val channels: List[String]) {
  4
+}
1  src/test/resources/irc.config
... ...
@@ -0,0 +1 @@
  1
+irc.synyx.de gitta testchannel
20  src/test/scala/org/synyx/git/ConfigurationServiceTest.scala
@@ -3,8 +3,7 @@ package org.synyx.git
3 3
 import org.scalatest.FunSuite
4 4
 import org.scalatest.junit.JUnitRunner
5 5
 import org.scalatest.matchers.ShouldMatchers
6  
-import org.junit.runner.RunWith
7  
-
  6
+import org.junit.runner.{Result, RunWith}
8 7
 
9 8
 @RunWith(classOf[JUnitRunner])
10 9
 class ConfigurationServiceTest extends FunSuite with ShouldMatchers {
@@ -34,4 +33,21 @@ class ConfigurationServiceTest extends FunSuite with ShouldMatchers {
34 33
     repo2.folder.getAbsolutePath should be("/some/path")
35 34
     repo2.url should be("https://url")
36 35
   }
  36
+
  37
+  test("irc config object is IrcServer") {
  38
+    val result = ConfigurationService.readIrcConfig("src/test/resources/irc.config")
  39
+    assert(result.isInstanceOf[IrcServer])
  40
+  }
  41
+
  42
+  test("irc config has server set") {
  43
+    val result = ConfigurationService.readIrcConfig("src/test/resources/irc.config")
  44
+    result.server should be("irc.synyx.de")
  45
+  }
  46
+
  47
+  test("irc config has channels set") {
  48
+    val result = ConfigurationService.readIrcConfig("src/test/resources/irc.config")
  49
+    result.channels.length should be(2)
  50
+    result.channels(0) should be("gitta")
  51
+    result.channels(1) should be("testchannel")
  52
+  }
37 53
 }

0 notes on commit 9788f22

Please sign in to comment.
Something went wrong with that request. Please try again.