summaryrefslogtreecommitdiffstats
path: root/standalone-container/src/test/scala/com/yahoo/container/standalone/StandaloneSubscriberTest.scala
blob: 40e4480be3770dcd3ad38ff21a679199f478947d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.container.standalone

import org.junit.{Ignore, Test}
import org.junit.Assert.assertThat
import org.hamcrest.CoreMatchers.is
import org.hamcrest.number.OrderingComparison.greaterThan

import StandaloneContainer.withContainerModel
import com.yahoo.vespa.config.ConfigKey
import com.yahoo.config.ConfigInstance
import com.yahoo.container.{ComponentsConfig, BundlesConfig, di}
import scala.collection.JavaConverters._

/**
 * @author tonytv
 */
class StandaloneSubscriberTest {
  val bundlesKey = key("bundles")
  val componentsKey = key("components")

  def key(name: String) = new ConfigKey(name, "container", "container").asInstanceOf[ConfigKey[ConfigInstance]]

  def box(i: Int) = new java.lang.Integer(i)

  @Test
  @Ignore
  def standalone_subscriber() {
    withContainerModel(<container version="1.0"> </container>) { root =>
      val subscriber = new StandaloneSubscriberFactory(root).getSubscriber(Set(bundlesKey, componentsKey).asJava)
      val config = subscriber.config.asScala
      assertThat(config.size, is(2))

      val bundlesConfig = config(bundlesKey).asInstanceOf[BundlesConfig]
      val componentsConfig = config(componentsKey).asInstanceOf[ComponentsConfig]

      assertThat(bundlesConfig.bundle().size(), is(0))
      assertThat(box(componentsConfig.components().size()), greaterThan(box(10)))
    }
  }
}