-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
iss #24: use universal config in mt8057 agent
- Loading branch information
Showing
17 changed files
with
347 additions
and
359 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
core/src/main/scala/ru/maizy/ambient7/core/config/Mt8057AgentSpecificOptions.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package ru.maizy.ambient7.core.config | ||
|
||
import java.io.File | ||
|
||
/** | ||
* Copyright (c) Nikita Kovaliov, maizy.ru, 2017 | ||
* See LICENSE.txt for details. | ||
*/ | ||
|
||
// TODO: should be only in mt8057-agent submodule | ||
|
||
trait EnumerationMap extends Enumeration { | ||
self => | ||
lazy val valuesMap: Map[String, Value] = self.values.map{ v => (v.toString, v) }.toMap | ||
} | ||
|
||
object Writers extends Enumeration with EnumerationMap { | ||
self => | ||
type Writer = Value | ||
val Console = Value("console") | ||
val Interactive = Value("interactive") | ||
val InfluxDb = Value("influxdb") | ||
} | ||
|
||
case class Mt8057AgentSpecificOptions( | ||
writers: Set[Writers.Writer] = Set.empty, | ||
useEmulator: Boolean = false, | ||
logFile: Option[File] = None, | ||
verboseLogging: Boolean = false | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
core/src/test/scala/ru/maizy/ambient7/core/tests/data/AgentTagsSpec.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package ru.maizy.ambient7.core.tests.data | ||
|
||
/** | ||
* Copyright (c) Nikita Kovaliov, maizy.ru, 2017 | ||
* See LICENSE.txt for details. | ||
*/ | ||
|
||
import ru.maizy.ambient7.core.data.{ AgentTag, AgentTags } | ||
import ru.maizy.ambient7.core.tests.BaseSpec | ||
|
||
class AgentTagsSpec extends BaseSpec { | ||
|
||
"AgentTags" should "encode & decode tags and tags values with escaping" in { | ||
val originalString = "atag=va\\,lue,b\\,tag=value" | ||
AgentTags(originalString) shouldBe | ||
AgentTags(Seq(AgentTag("atag", "va,lue"), AgentTag("b,tag", "value"))) | ||
|
||
AgentTags(originalString).encoded shouldBe originalString | ||
} | ||
} |
109 changes: 0 additions & 109 deletions
109
mt8057-agent/src/main/scala/ru/maizy/ambient7/mt8057agent/AgentApp.scala
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.