Permalink
Browse files

Adding property resolution for Resourcetype config event provider.

  • Loading branch information...
atooni committed Dec 3, 2018
1 parent 0016652 commit 6ac5a9449fdfc8e8041bfc089be9d83af54cab41
@@ -44,7 +44,6 @@ object BrokerConfig {
private val getAndResolve : (String => Try[Any]) => Config => String => Option[String] = resolve => cfg => propName =>
cfg.getStringOption(propName).map(s => resolve(s).get).map(_.toString)
val name : (String => Try[Any]) => Config => Option[String] = resolve => cfg =>
getAndResolve(resolve)(cfg)("brokerName")
@@ -32,8 +32,8 @@ object ResourceTypeRouterConfig {
val eventProvider = ProviderResolver.getProvider(
provider,
cfg.getString(defaultEventVendorPath, internalProvider.vendor),
cfg.getString(defaultEventProviderPath, internalProvider.provider)
idSvc.resolvePropertyString(cfg.getString(defaultEventVendorPath, internalProvider.vendor)).map(_.toString).get,
idSvc.resolvePropertyString(cfg.getString(defaultEventProviderPath, internalProvider.provider)).map(_.toString).get
).get
val logHeader : List[String] = cfg.getStringList(applicationLogHeaderPath, List.empty)
@@ -70,11 +70,13 @@ trait PojoSrTestHelper {
}
def createSimpleBlendedContainer(
mandatoryProperties : List[String] = List.empty
mandatoryProperties : List[String] = List.empty,
sysProperties : Map[String, String] = Map.empty
): Try[BlendedPojoRegistry] = Try {
System.setProperty("BLENDED_HOME", baseDir)
System.setProperty("blended.home", baseDir)
System.setProperty("blended.container.home", baseDir)
sysProperties.foreach { case (k,v) => System.setProperty(k, v) }
startBundle(createRegistry().get)(
classOf[ContainerIdentifierServiceImpl].getPackage().getName(), idSvcActivator(Some(mandatoryProperties.mkString(",")))
).get._2
@@ -13,8 +13,16 @@ abstract class SimplePojoContainerSpec
*/
def bundles: Seq[(String, BundleActivator)]
/**
* Specify, which properties are mandatory for the simulated container.
*/
def mandatoryPropertyNames: List[String] = List.empty
/**
* If required, inject additional system properties when firing up the container.
*/
def systemProperties : Map[String, String] = Map.empty
override protected def afterAll(): Unit = {
_registry.foreach { r =>
stopRegistry(r)
@@ -29,7 +37,7 @@ abstract class SimplePojoContainerSpec
def registry: BlendedPojoRegistry = {
_registry.getOrElse {
_registry = Some(
bundles.foldLeft(createSimpleBlendedContainer(mandatoryPropertyNames).get) {
bundles.foldLeft(createSimpleBlendedContainer(mandatoryPropertyNames, systemProperties).get) {
case (current, (name, activator)) =>
startBundle(current)(name, activator).get._2
}

0 comments on commit 6ac5a94

Please sign in to comment.