Search in sources :

Example 1 with AthenzClientFactoryMock

use of com.yahoo.vespa.hosted.controller.athenz.mock.AthenzClientFactoryMock in project vespa by vespa-engine.

the class ControllerContainerTest method addUserToHostedOperatorRole.

protected void addUserToHostedOperatorRole(AthenzIdentity athenzIdentity) {
    AthenzClientFactoryMock mock = (AthenzClientFactoryMock) container.components().getComponent(AthenzClientFactoryMock.class.getName());
    mock.getSetup().addHostedOperator(athenzIdentity);
}
Also used : AthenzClientFactoryMock(com.yahoo.vespa.hosted.controller.athenz.mock.AthenzClientFactoryMock)

Example 2 with AthenzClientFactoryMock

use of com.yahoo.vespa.hosted.controller.athenz.mock.AthenzClientFactoryMock in project vespa by vespa-engine.

the class ApplicationApiTest method addScrewdriverUserToDeployRole.

/**
 * In production this happens outside hosted Vespa, so there is no API for it and we need to reach down into the
 * mock setup to replicate the action.
 */
private void addScrewdriverUserToDeployRole(ScrewdriverId screwdriverId, AthenzDomain domain, com.yahoo.vespa.hosted.controller.api.identifiers.ApplicationId applicationId) {
    AthenzClientFactoryMock mock = (AthenzClientFactoryMock) container.components().getComponent(AthenzClientFactoryMock.class.getName());
    AthenzIdentity screwdriverIdentity = HostedAthenzIdentities.from(screwdriverId);
    AthenzDbMock.Application athenzApplication = mock.getSetup().domains.get(domain).applications.get(applicationId);
    athenzApplication.addRoleMember(ApplicationAction.deploy, screwdriverIdentity);
}
Also used : AthenzClientFactoryMock(com.yahoo.vespa.hosted.controller.athenz.mock.AthenzClientFactoryMock) AthenzIdentity(com.yahoo.vespa.athenz.api.AthenzIdentity) AthenzDbMock(com.yahoo.vespa.hosted.controller.athenz.mock.AthenzDbMock)

Example 3 with AthenzClientFactoryMock

use of com.yahoo.vespa.hosted.controller.athenz.mock.AthenzClientFactoryMock in project vespa by vespa-engine.

the class ControllerTester method createController.

private static Controller createController(ControllerDb db, CuratorDb curator, RotationsConfig rotationsConfig, ConfigServerClientMock configServerClientMock, ManualClock clock, GitHubMock gitHubClientMock, ZoneRegistryMock zoneRegistryMock, AthenzDbMock athensDb, MemoryNameService nameService, ArtifactRepository artifactRepository, EntityService entityService) {
    Controller controller = new Controller(db, curator, rotationsConfig, gitHubClientMock, entityService, new MockOrganization(clock), new MemoryGlobalRoutingService(), zoneRegistryMock, configServerClientMock, new NodeRepositoryClientMock(), new MockMetricsService(), nameService, new MockRoutingGenerator(), new ChefMock(), clock, new AthenzClientFactoryMock(athensDb), artifactRepository);
    controller.updateVersionStatus(VersionStatus.compute(controller));
    return controller;
}
Also used : MockMetricsService(com.yahoo.vespa.hosted.controller.integration.MockMetricsService) ChefMock(com.yahoo.vespa.hosted.controller.api.integration.chef.ChefMock) AthenzClientFactoryMock(com.yahoo.vespa.hosted.controller.athenz.mock.AthenzClientFactoryMock) MockOrganization(com.yahoo.vespa.hosted.controller.api.integration.organization.MockOrganization) MemoryGlobalRoutingService(com.yahoo.vespa.hosted.controller.api.integration.routing.MemoryGlobalRoutingService) MockRoutingGenerator(com.yahoo.vespa.hosted.controller.routing.MockRoutingGenerator)

Example 4 with AthenzClientFactoryMock

use of com.yahoo.vespa.hosted.controller.athenz.mock.AthenzClientFactoryMock in project vespa by vespa-engine.

the class ContainerControllerTester method authorize.

/*
     * Authorize action on tenantDomain/application for a given screwdriverId
     */
public void authorize(AthenzDomain tenantDomain, ScrewdriverId screwdriverId, ApplicationAction action, Application application) {
    AthenzClientFactoryMock mock = (AthenzClientFactoryMock) containerTester.container().components().getComponent(AthenzClientFactoryMock.class.getName());
    mock.getSetup().domains.get(tenantDomain).applications.get(new com.yahoo.vespa.hosted.controller.api.identifiers.ApplicationId(application.id().application().value())).addRoleMember(action, HostedAthenzIdentities.from(screwdriverId));
}
Also used : AthenzClientFactoryMock(com.yahoo.vespa.hosted.controller.athenz.mock.AthenzClientFactoryMock) ApplicationId(com.yahoo.config.provision.ApplicationId)

Example 5 with AthenzClientFactoryMock

use of com.yahoo.vespa.hosted.controller.athenz.mock.AthenzClientFactoryMock in project vespa by vespa-engine.

the class ContainerControllerTester method addTenantAthenzDomain.

private AthenzDomain addTenantAthenzDomain(String domainName, String userName) {
    AthenzClientFactoryMock mock = (AthenzClientFactoryMock) containerTester.container().components().getComponent(AthenzClientFactoryMock.class.getName());
    AthenzDomain athensDomain = new AthenzDomain(domainName);
    AthenzDbMock.Domain domain = new AthenzDbMock.Domain(athensDomain);
    domain.markAsVespaTenant();
    domain.admin(AthenzIdentities.from(new AthenzDomain("domain"), userName));
    mock.getSetup().addDomain(domain);
    return athensDomain;
}
Also used : AthenzClientFactoryMock(com.yahoo.vespa.hosted.controller.athenz.mock.AthenzClientFactoryMock) AthenzDomain(com.yahoo.vespa.athenz.api.AthenzDomain) AthenzDbMock(com.yahoo.vespa.hosted.controller.athenz.mock.AthenzDbMock) AthenzDomain(com.yahoo.vespa.athenz.api.AthenzDomain)

Aggregations

AthenzClientFactoryMock (com.yahoo.vespa.hosted.controller.athenz.mock.AthenzClientFactoryMock)6 AthenzDbMock (com.yahoo.vespa.hosted.controller.athenz.mock.AthenzDbMock)3 AthenzDomain (com.yahoo.vespa.athenz.api.AthenzDomain)2 ApplicationId (com.yahoo.config.provision.ApplicationId)1 AthenzIdentity (com.yahoo.vespa.athenz.api.AthenzIdentity)1 ChefMock (com.yahoo.vespa.hosted.controller.api.integration.chef.ChefMock)1 MockOrganization (com.yahoo.vespa.hosted.controller.api.integration.organization.MockOrganization)1 MemoryGlobalRoutingService (com.yahoo.vespa.hosted.controller.api.integration.routing.MemoryGlobalRoutingService)1 MockMetricsService (com.yahoo.vespa.hosted.controller.integration.MockMetricsService)1 MockRoutingGenerator (com.yahoo.vespa.hosted.controller.routing.MockRoutingGenerator)1