Search in sources :

Example 1 with DeployState

use of com.yahoo.config.model.deploy.DeployState in project vespa by vespa-engine.

the class AccessLogBuilder method buildIfNotDisabled.

public static Optional<AccessLogComponent> buildIfNotDisabled(ContainerCluster cluster, Element accessLogSpec) {
    AccessLogTypeLiteral typeLiteral = getOptionalAttribute(accessLogSpec, "type").map(AccessLogTypeLiteral::fromAttributeValue).orElse(AccessLogTypeLiteral.VESPA);
    AccessLogType logType = logTypeFor(typeLiteral);
    if (logType == null) {
        return Optional.empty();
    }
    DeployState deployState = cluster.getDeployState();
    return Optional.of(new DomBuilder(logType, deployState).build(cluster, accessLogSpec));
}
Also used : VespaDomBuilder(com.yahoo.vespa.model.builder.xml.dom.VespaDomBuilder) AccessLogType(com.yahoo.vespa.model.container.component.AccessLogComponent.AccessLogType) DeployState(com.yahoo.config.model.deploy.DeployState)

Example 2 with DeployState

use of com.yahoo.config.model.deploy.DeployState in project vespa by vespa-engine.

the class RoutingBuilderTest method getContainer.

private Container getContainer(ApplicationPackage applicationPackage, String region, Element clusterElem) throws IOException, SAXException {
    DeployState deployState = new DeployState.Builder().applicationPackage(applicationPackage).zone(new Zone(Environment.prod, RegionName.from(region))).build(true);
    root = new MockRoot("root", deployState);
    createModel(root, deployState, clusterElem);
    ContainerCluster cluster = getContainerCluster("default");
    return cluster.getContainers().get(0);
}
Also used : DeployState(com.yahoo.config.model.deploy.DeployState) MockRoot(com.yahoo.config.model.test.MockRoot) Zone(com.yahoo.config.provision.Zone) ContainerCluster(com.yahoo.vespa.model.container.ContainerCluster)

Example 3 with DeployState

use of com.yahoo.config.model.deploy.DeployState in project vespa by vespa-engine.

the class AccessControlValidatorTest method cluster_with_no_handlers_passes_validation_without_write_protection.

@Test
public void cluster_with_no_handlers_passes_validation_without_write_protection() throws IOException, SAXException {
    DeployState deployState = deployState(servicesXml(false, false));
    VespaModel model = new VespaModel(new NullConfigModelRegistry(), deployState);
    new AccessControlValidator().validate(model, deployState);
}
Also used : NullConfigModelRegistry(com.yahoo.config.model.NullConfigModelRegistry) DeployState(com.yahoo.config.model.deploy.DeployState) VespaModel(com.yahoo.vespa.model.VespaModel) Test(org.junit.Test)

Example 4 with DeployState

use of com.yahoo.config.model.deploy.DeployState in project vespa by vespa-engine.

the class AccessControlValidatorTest method cluster_with_write_protection_passes_validation.

@Test
public void cluster_with_write_protection_passes_validation() throws IOException, SAXException {
    DeployState deployState = deployState(servicesXml(true, true));
    VespaModel model = new VespaModel(new NullConfigModelRegistry(), deployState);
    new AccessControlValidator().validate(model, deployState);
}
Also used : NullConfigModelRegistry(com.yahoo.config.model.NullConfigModelRegistry) DeployState(com.yahoo.config.model.deploy.DeployState) VespaModel(com.yahoo.vespa.model.VespaModel) Test(org.junit.Test)

Example 5 with DeployState

use of com.yahoo.config.model.deploy.DeployState in project vespa by vespa-engine.

the class AccessControlValidatorTest method cluster_without_custom_components_passes_validation_without_write_protection.

@Test
public void cluster_without_custom_components_passes_validation_without_write_protection() throws IOException, SAXException {
    String servicesXml = joinLines("<services version='1.0'>", "  <container id='default' version='1.0' />", "</services>");
    DeployState deployState = deployState(servicesXml);
    VespaModel model = new VespaModel(new NullConfigModelRegistry(), deployState);
    new AccessControlValidator().validate(model, deployState);
}
Also used : NullConfigModelRegistry(com.yahoo.config.model.NullConfigModelRegistry) DeployState(com.yahoo.config.model.deploy.DeployState) VespaModel(com.yahoo.vespa.model.VespaModel) Test(org.junit.Test)

Aggregations

DeployState (com.yahoo.config.model.deploy.DeployState)29 Test (org.junit.Test)19 VespaModel (com.yahoo.vespa.model.VespaModel)14 NullConfigModelRegistry (com.yahoo.config.model.NullConfigModelRegistry)10 ApplicationPackage (com.yahoo.config.application.api.ApplicationPackage)9 DeployProperties (com.yahoo.config.model.deploy.DeployProperties)7 MockApplicationPackage (com.yahoo.config.model.test.MockApplicationPackage)7 Zone (com.yahoo.config.provision.Zone)7 MockRoot (com.yahoo.config.model.test.MockRoot)5 VespaModelCreatorWithMockPkg (com.yahoo.vespa.model.test.utils.VespaModelCreatorWithMockPkg)4 InMemoryProvisioner (com.yahoo.config.model.provision.InMemoryProvisioner)3 ConfigserverConfig (com.yahoo.cloud.config.ConfigserverConfig)2 SentinelConfig (com.yahoo.cloud.config.SentinelConfig)2 FilesApplicationPackage (com.yahoo.config.model.application.provider.FilesApplicationPackage)2 TestDriver (com.yahoo.config.model.test.TestDriver)2 TestRoot (com.yahoo.config.model.test.TestRoot)2 AllocatedHosts (com.yahoo.config.provision.AllocatedHosts)2 ContainerCluster (com.yahoo.vespa.model.container.ContainerCluster)2 Optional (java.util.Optional)2 ClusterInfoConfig (com.yahoo.cloud.config.ClusterInfoConfig)1