diff options
author | Jon Bratseth <bratseth@yahoo-inc.com> | 2016-09-28 12:22:26 +0200 |
---|---|---|
committer | Jon Bratseth <bratseth@yahoo-inc.com> | 2016-09-28 12:22:26 +0200 |
commit | 321194bbe4a36d100d92188644d90c6cf4d373c7 (patch) | |
tree | dc2056158a3412aad0fda352496d86e6318d8959 /standalone-container/src | |
parent | cc406b3dacac9de80d16ed4f56998defce33556f (diff) |
Run Application with VespaModel instead of MockRoot
Diffstat (limited to 'standalone-container/src')
6 files changed, 16 insertions, 8 deletions
diff --git a/standalone-container/src/main/scala/com/yahoo/application/container/impl/ClassLoaderOsgiFramework.scala b/standalone-container/src/main/scala/com/yahoo/application/container/impl/ClassLoaderOsgiFramework.scala index 6d45e6fa8a1..5a41462cb48 100644 --- a/standalone-container/src/main/scala/com/yahoo/application/container/impl/ClassLoaderOsgiFramework.scala +++ b/standalone-container/src/main/scala/com/yahoo/application/container/impl/ClassLoaderOsgiFramework.scala @@ -17,6 +17,8 @@ import org.osgi.framework.wiring._ import org.osgi.resource.{Wire, Capability, Requirement} /** + * A (mock) OSGI implementation which loads classes from the system classpath + * * @author tonytv */ final class ClassLoaderOsgiFramework extends OsgiFramework { @@ -197,4 +199,5 @@ final class ClassLoaderOsgiFramework extends OsgiFramework { override def createFilter(filter: String) = throw new UnsupportedOperationException } + } diff --git a/standalone-container/src/main/scala/com/yahoo/container/standalone/StandaloneContainerApplication.scala b/standalone-container/src/main/scala/com/yahoo/container/standalone/StandaloneContainerApplication.scala index 8157170e6d1..7bc821244d2 100644 --- a/standalone-container/src/main/scala/com/yahoo/container/standalone/StandaloneContainerApplication.scala +++ b/standalone-container/src/main/scala/com/yahoo/container/standalone/StandaloneContainerApplication.scala @@ -10,6 +10,7 @@ import java.io.{IOException, File} import com.yahoo.config.model.test.MockRoot import com.yahoo.config.model.application.provider._ import com.yahoo.vespa.defaults.Defaults +import com.yahoo.vespa.model.VespaModel import com.yahoo.vespa.model.container.xml.{ConfigServerContainerModelBuilder, ManhattanContainerModelBuilder, ContainerModelBuilder} import org.w3c.dom.Element import com.yahoo.config.model.builder.xml.XmlHelper @@ -164,7 +165,7 @@ object StandaloneContainerApplication { fileRegistry: FileRegistry, preprocessedApplicationDir: File, networkingOption: Networking, - configModelRepo: ConfigModelRepo = new ConfigModelRepo): (MockRoot, Container) = { + configModelRepo: ConfigModelRepo = new ConfigModelRepo): (VespaModel, Container) = { val logger = new BaseDeployLogger val rawApplicationPackage = new FilesApplicationPackage.Builder(applicationPath.toFile).includeSourceFiles(true).preprocessedDir(preprocessedApplicationDir).build() // TODO: Needed until we get rid of semantic rules @@ -179,12 +180,14 @@ object StandaloneContainerApplication { configDefinitionRepo(configDefinitionRepo). build() - val root = new MockRoot("", deployState) + val root = VespaModel.createMutable(deployState) val vespaRoot = new ApplicationConfigProducerRoot(root, "vespa", deployState.getDocumentModel, deployState.getProperties.vespaVersion(), deployState.getProperties.applicationId()) + + vespaRoot.setupAdmin(root.getAdmin) // TODO: Try to remove val spec = containerRootElement(applicationPackage) val containerModel = newContainerModelBuilder(networkingOption).build(deployState, configModelRepo, vespaRoot, spec) @@ -197,6 +200,7 @@ object StandaloneContainerApplication { container.setHttpServerEnabled(networkingOption == Networking.enable) initializeContainer(container, spec) + root.freezeModelTopology() (root, container) } diff --git a/standalone-container/src/main/scala/com/yahoo/container/standalone/StandaloneSubscriberFactory.scala b/standalone-container/src/main/scala/com/yahoo/container/standalone/StandaloneSubscriberFactory.scala index 432e5b82946..4ac88eaafae 100644 --- a/standalone-container/src/main/scala/com/yahoo/container/standalone/StandaloneSubscriberFactory.scala +++ b/standalone-container/src/main/scala/com/yahoo/container/standalone/StandaloneSubscriberFactory.scala @@ -4,6 +4,7 @@ package com.yahoo.container.standalone import com.yahoo.config.model.test.MockRoot import com.yahoo.config.{ConfigBuilder, ConfigInstance} import com.yahoo.container.di.ConfigKeyT +import com.yahoo.vespa.model.VespaModel import scala.collection.JavaConversions._ import scala.collection.JavaConverters._ import com.yahoo.vespa.config.ConfigKey @@ -14,7 +15,7 @@ import StandaloneSubscriberFactory._ * @author tonytv * @author gjoranv */ -class StandaloneSubscriberFactory(root: MockRoot) extends SubscriberFactory { +class StandaloneSubscriberFactory(root: VespaModel) extends SubscriberFactory { class StandaloneSubscriber(configKeys: Set[ConfigKeyT]) extends Subscriber { override def configChanged = generation == 0 diff --git a/standalone-container/src/test/java/com/yahoo/container/standalone/StandaloneContainerActivatorTest.java b/standalone-container/src/test/java/com/yahoo/container/standalone/StandaloneContainerActivatorTest.java index 484d4c4d50e..f847f05108e 100644 --- a/standalone-container/src/test/java/com/yahoo/container/standalone/StandaloneContainerActivatorTest.java +++ b/standalone-container/src/test/java/com/yahoo/container/standalone/StandaloneContainerActivatorTest.java @@ -24,7 +24,7 @@ import static org.hamcrest.collection.IsEmptyCollection.empty; import static org.junit.Assert.assertThat; /** - * @author <a href="mailto:einarmr@yahoo-inc.com">Einar M R Rosenvinge</a> + * @author Einar M R Rosenvinge * @since 5.22.0 */ public class StandaloneContainerActivatorTest { diff --git a/standalone-container/src/test/scala/com/yahoo/container/standalone/StandaloneContainer.scala b/standalone-container/src/test/scala/com/yahoo/container/standalone/StandaloneContainer.scala index 7152c0c0af1..f0c2ce6fa0d 100644 --- a/standalone-container/src/test/scala/com/yahoo/container/standalone/StandaloneContainer.scala +++ b/standalone-container/src/test/scala/com/yahoo/container/standalone/StandaloneContainer.scala @@ -32,7 +32,7 @@ object StandaloneContainer { } } - def withContainerModel[T](containerNode: Node)(f: MockRoot => T) { + def withContainerModel[T](containerNode: Node)(f: VespaModel => T) { withTempDirectory { applicationPath => createServicesXml(applicationPath, containerNode) diff --git a/standalone-container/src/test/scala/com/yahoo/container/standalone/StandaloneContainerTest.scala b/standalone-container/src/test/scala/com/yahoo/container/standalone/StandaloneContainerTest.scala index 41026e1c263..2705322ab32 100644 --- a/standalone-container/src/test/scala/com/yahoo/container/standalone/StandaloneContainerTest.scala +++ b/standalone-container/src/test/scala/com/yahoo/container/standalone/StandaloneContainerTest.scala @@ -58,7 +58,7 @@ class StandaloneContainerTest { </services> StandaloneContainer.withContainerModel(servicesXml) { root => - assertNotNull(root.getProducer("container-1/standalone")) + assertTrue(root.getConfigProducer("container-1/standalone").isPresent) } } @@ -72,10 +72,10 @@ class StandaloneContainerTest { </jdisc> StandaloneContainer.withContainerModel(xml) { root => - val container = root.getProducer("jdisc/standalone").asInstanceOf[AbstractService] + val container = root.getConfigProducer("jdisc/standalone").get().asInstanceOf[AbstractService] println("portCnt: " + container.getPortCount) println("numPorts: " + container.getNumPortsAllocated) - assertThat(container.getNumPortsAllocated, is(1)) + assertEquals(1, container.getNumPortsAllocated) } } |