Skip to content
Permalink
Browse files

Some code cleanup

  • Loading branch information...
atooni committed Mar 26, 2019
1 parent f9e3a7a commit 0debd3414a708ca214f682a00f1f6e25c2472cbf
@@ -0,0 +1,5 @@
package blended.akka.http.proxy

class ProxyActivatorSpec {

}
@@ -242,9 +242,6 @@ class ProxyRouteSpec extends FreeSpec with ScalatestRouteTest {
assert(handled === true)
assert(entityAs[String].contains("An OSGI container framework in Scala with focus on testing"))
}

}

}

}
@@ -35,7 +35,7 @@ object MockObjects {
private[this] def sizedProperties(namePrefix: String = "prop", numProps: Int) =
1.to(numProps).map(i => (s"$namePrefix-$i", s"value$i")).toMap

private[this] def serviceInfo(numProps: Int = 10) = ServiceInfo(
private[this] def serviceInfo(numProps: Int = 10) : ServiceInfo = ServiceInfo(
name = s"service-${serviceCount.incrementAndGet()}",
serviceType = s"type-${rnd.nextInt(3) + 1}",
timestampMsec = System.currentTimeMillis(),
@@ -76,7 +76,7 @@ object MockObjects {
ProfileGroup(name = "blended-simple", "1.1", List(noOverlays, someOverlays, invalid))
).flatMap(_.toSingle)

def createContainer(numContainers: Integer) = 1.to(numContainers).map { i =>
def createContainer(numContainers: Integer) : List[ContainerInfo] = 1.to(numContainers).map { i =>

val serviceSeqs = 1.to(3).map { i =>
serviceSeq(rnd.nextInt(5) + 1)
@@ -91,54 +91,5 @@ object MockObjects {
appliedUpdateActionIds = Nil
)
}.toList

// use this method and one of the defined environments in the mock server
def containerList(l: List[ContainerInfo]): String = {
log.debug("about to pickle: ${l}")
Pickle.intoString(l)
}

def remoteContainerStateList(l: List[ContainerInfo]): String = {
log.debug(s"about to pickle: ${l}")
val result = l.map(ci => RemoteContainerState(containerInfo = ci, outstandingUpdateActions = List()))
Pickle.intoString(result)
}

def profilesList(l: List[ProfileGroup]) = Pickle.intoString(l)

// Define some test environments here

// 1. empty environment
val emptyEnv = List.empty[ContainerInfo]

// 2. a single container environment
val minimalEnv = createContainer(1)

// 3. A medium sized environment
val mediumEnv = createContainer(5)

val runtimeConfigs = {
val rcs = List(
RuntimeConfig(
name = "blended-example",
version = "1.0.0",
startLevel = 10,
defaultStartLevel = 10,
properties = sizedProperties("prop", 3),
frameworkProperties = sizedProperties("frameworkProp", 2),
systemProperties = sizedProperties("sysProp", 1)
)
)
Pickle.intoString(rcs)
}

val overlayConfigs = {
val ocs = List(
OverlayConfig(name = "test-overlay", version = "1.0.0", properties = sizedProperties("prop", 3),
generatedConfigs = List(GeneratedConfig(configFile = "conf/test.conf", config = "org.example { a = 1, b = 2 }")))
)
Pickle.intoString(ocs)
}

}

@@ -1,14 +1,13 @@
package blended.mgmt.mock.clients

import scala.util.Try

import akka.actor.Props
import blended.mgmt.agent.internal.MgmtReporter
import blended.mgmt.agent.internal.MgmtReporter.MgmtReporterConfig
import blended.updater.config.ContainerInfo

import scala.util.Try

class ContainerActor(reporterConfig: MgmtReporterConfig, containerInfo: ContainerInfo) extends MgmtReporter {
import ContainerActor._

override val config: Try[MgmtReporter.MgmtReporterConfig] = Try(reporterConfig)

This file was deleted.

Oops, something went wrong.
@@ -10,7 +10,6 @@ object BlendedMgmtMock extends ProjectFactory {
deps = Seq(
Dependencies.cmdOption,
Dependencies.akkaActor,
Dependencies.wiremockStandalone,
Dependencies.logbackClassic,
Dependencies.logbackCore
)
@@ -34,19 +34,4 @@ object BuildHelper {
isSnapshot := buildVersion.endsWith("SNAPSHOT")
)
}

// def classpathDepsByScope(cp: Keys.Classpath, scope: String) : Seq[File] = {
//
// cp.filter{ af =>
// af.metadata.entries.find { e => e.value.isInstanceOf[Configuration] } match {
// case None => false
// case Some(obj) =>
// val cfg = obj.value.asInstanceOf[Configuration]
//
// println(cfg.name + ":" + cfg.extendsConfigs)
// cfg.name == scope ||
// (cfg.extendsConfigs.exists(_.name == scope))
// }
// }.map(_.data)
// }
}
@@ -145,10 +145,7 @@ trait Dependencies {
val typesafeConfig = "com.typesafe" % "config" % "1.3.3"
// FIXME: Rename to typesafeSslConfigCore
val typesafeConfigSSL = "com.typesafe" %% "ssl-config-core" % "0.3.6"

val wiremock = "com.github.tomakehurst" % "wiremock" % "2.1.11"
val wiremockStandalone = "com.github.tomakehurst" % "wiremock-standalone" % "2.1.11"


}

object Dependencies extends Dependencies

0 comments on commit 0debd34

Please sign in to comment.
You can’t perform that action at this time.