use of com.yahoo.component.ComponentId in project vespa by vespa-engine.
the class Content method addIndexingChain.
private static void addIndexingChain(ContainerCluster containerCluster) {
DocprocChain chainAlreadyPresent = containerCluster.getDocprocChains().allChains().getComponent(new ComponentId(IndexingDocprocChain.NAME));
if (chainAlreadyPresent != null) {
if (chainAlreadyPresent instanceof IndexingDocprocChain)
return;
throw new IllegalArgumentException("A docproc chain may not have the ID '" + IndexingDocprocChain.NAME + ", since this is reserved by Vespa. Please use a different ID.");
}
containerCluster.getDocprocChains().add(new IndexingDocprocChain());
}
use of com.yahoo.component.ComponentId in project vespa by vespa-engine.
the class ContainerModelBuilderTest method component_includes_are_added.
@Test
public void component_includes_are_added() {
VespaModelCreatorWithFilePkg creator = new VespaModelCreatorWithFilePkg("src/test/cfg/application/include_dirs");
VespaModel model = creator.create(true);
ContainerCluster cluster = model.getContainerClusters().get("default");
Map<ComponentId, Component<?, ?>> componentsMap = cluster.getComponentsMap();
Component<?, ?> example = componentsMap.get(ComponentId.fromString("test.Exampledocproc"));
assertThat(example.getComponentId().getName(), is("test.Exampledocproc"));
}
use of com.yahoo.component.ComponentId in project vespa by vespa-engine.
the class RestApiTest method all_non_restApi_components_are_injected_to_RestApiContext.
@Test
public void all_non_restApi_components_are_injected_to_RestApiContext() throws Exception {
setup();
ComponentsConfig componentsConfig = root.getConfig(ComponentsConfig.class, ClusterId);
Set<ComponentId> clusterChildrenComponentIds = getContainerCluster(ClusterId).getAllComponents().stream().map(Component::getComponentId).collect(Collectors.toSet());
Set<ComponentId> restApiChildrenComponentIds = restApi.getChildren().values().stream().map(child -> ((Component<?, ?>) child).getComponentId()).collect(Collectors.toSet());
// TODO: Review: replace with filtering against RestApiContext.isCycleGeneratingComponent
ComponentId cycleInducingComponents = ComponentId.fromString("com.yahoo.container.handler.observability.ApplicationStatusHandler");
Set<ComponentId> expectedInjectedConfigIds = new HashSet<>(clusterChildrenComponentIds);
expectedInjectedConfigIds.removeAll(restApiChildrenComponentIds);
expectedInjectedConfigIds.remove(cycleInducingComponents);
Set<ComponentId> injectedConfigIds = restApiContextConfig(componentsConfig).inject().stream().map(inject -> ComponentId.fromString(inject.id())).collect(Collectors.toSet());
// Verify that the two sets are equal. Split in two asserts to get decent failure messages.
assertThat("Not all required components are injected", injectedConfigIds, containsInAnyOrder(expectedInjectedConfigIds.toArray()));
assertThat("We inject some components that should not be injected", expectedInjectedConfigIds, containsInAnyOrder(injectedConfigIds.toArray()));
}
use of com.yahoo.component.ComponentId in project vespa by vespa-engine.
the class ComponentIdTestCase method testCompareWithNameSpace.
@Test
public void testCompareWithNameSpace() {
ComponentId withNS = ComponentId.fromString("foo@ns");
// Should be less than withNs
ComponentId withoutNS = ComponentId.fromString("foo");
assertEquals(withNS.compareTo(withoutNS), 1);
assertEquals(withoutNS.compareTo(withNS), -1);
}
use of com.yahoo.component.ComponentId in project vespa by vespa-engine.
the class ComponentClassTestCase method testCreateComponent.
@SuppressWarnings("unchecked")
@Test
public void testCreateComponent() throws NoSuchMethodException {
Map<ConfigKey, ConfigInstance> availableConfigs = new HashMap<>();
String configId = "testConfigId";
availableConfigs.put(new ConfigKey(StringConfig.class, configId), new StringConfig(new StringConfig.Builder()));
availableConfigs.put(new ConfigKey(IntConfig.class, configId), new IntConfig(new IntConfig.Builder()));
ComponentClass<TestComponent> testClass = new ComponentClass<>(TestComponent.class);
TestComponent component = testClass.createComponent(new ComponentId("test", new Version(1)), availableConfigs, configId);
assertEquals("test", component.getId().getName());
assertEquals(1, component.getId().getVersion().getMajor());
assertEquals(1, component.intVal);
assertEquals("_default_", component.stringVal);
}
Aggregations