Permalink
Browse files

initial irc server configuration

  • Loading branch information...
1 parent 0a549dd commit 9788f22de4c5b29e95c5e8b6bdc4a74b63d12081 @fhopf committed Aug 23, 2011
@@ -14,4 +14,9 @@ object ConfigurationService {
filtered
}
+ def readIrcConfig(path: String) = {
+ val line = Source.fromFile(path).getLines.toList (0)
+ val tokens = line.split(" ")
+ new IrcServer(tokens(0), tokens.slice(1, tokens.length).toList)
+ }
}
@@ -0,0 +1,4 @@
+package org.synyx.git
+
+class IrcServer(val server: String, val channels: List[String]) {
+}
@@ -0,0 +1 @@
+irc.synyx.de gitta testchannel
@@ -3,8 +3,7 @@ package org.synyx.git
import org.scalatest.FunSuite
import org.scalatest.junit.JUnitRunner
import org.scalatest.matchers.ShouldMatchers
-import org.junit.runner.RunWith
-
+import org.junit.runner.{Result, RunWith}
@RunWith(classOf[JUnitRunner])
class ConfigurationServiceTest extends FunSuite with ShouldMatchers {
@@ -34,4 +33,21 @@ class ConfigurationServiceTest extends FunSuite with ShouldMatchers {
repo2.folder.getAbsolutePath should be("/some/path")
repo2.url should be("https://url")
}
+
+ test("irc config object is IrcServer") {
+ val result = ConfigurationService.readIrcConfig("src/test/resources/irc.config")
+ assert(result.isInstanceOf[IrcServer])
+ }
+
+ test("irc config has server set") {
+ val result = ConfigurationService.readIrcConfig("src/test/resources/irc.config")
+ result.server should be("irc.synyx.de")
+ }
+
+ test("irc config has channels set") {
+ val result = ConfigurationService.readIrcConfig("src/test/resources/irc.config")
+ result.channels.length should be(2)
+ result.channels(0) should be("gitta")
+ result.channels(1) should be("testchannel")
+ }
}

0 comments on commit 9788f22

Please sign in to comment.