DomComponentBuilder extends VespaDomBuilder.DomConfigProducerBuilder<Component> { @Override protected Component doBuild(DeployState deployState, AbstractConfigProducer ancestor, Element spec) { Component component = buildComponent(spec); addChildren(deployState, ancestor, spec, component); return component; } DomComponentBuilder();  DomComponentBuilder(ComponentId namespace); static void addChildren(DeployState deployState, AbstractConfigProducer ancestor, Element componentNode, Component<? super Component<?, ?>, ?> component); static final String elementName; }
@Test public void ensureCorrectModel() { Component<?, ?> handler = new DomComponentBuilder().doBuild(root.getDeployState(), root, parse( "<handler id='theId' class='theClass' bundle='theBundle' />")); BundleInstantiationSpecification instantiationSpecification = handler.model.bundleInstantiationSpec; assertThat(instantiationSpecification.id.stringValue(), is("theId")); assertThat(instantiationSpecification.classId.stringValue(), is("theClass")); assertThat(instantiationSpecification.bundle.stringValue(), is("theBundle")); }
@Test @SuppressWarnings("unchecked") public void components_can_be_nested() { Component<Component<?, ?>, ?> parent = new DomComponentBuilder().doBuild(root.getDeployState(), root, parse( "<component id='parent'>", " <component id='child' />", "</component>")); assertThat(parent.getGlobalComponentId(), is(ComponentId.fromString("parent"))); Component<?, ?> child = first(parent.getChildren().values()); assertNotNull(child); assertThat(child.getGlobalComponentId(), is(ComponentId.fromString("child@parent"))); }