Search in sources :

Example 1 with UpdateConfigCommand

use of com.thoughtworks.go.config.UpdateConfigCommand in project gocd by gocd.

the class PackageRepositoryServiceIntegrationTest method setUp.

@Before
public void setUp() throws Exception {
    initMocks(this);
    service.setPluginManager(pluginManager);
    username = new Username("CurrentUser");
    UpdateConfigCommand command = goConfigService.modifyAdminPrivilegesCommand(asList(username.getUsername().toString()), new TriStateSelection(Admin.GO_SYSTEM_ADMIN, TriStateSelection.Action.add));
    goConfigService.updateConfig(command);
}
Also used : UpdateConfigCommand(com.thoughtworks.go.config.UpdateConfigCommand) Username(com.thoughtworks.go.server.domain.Username) TriStateSelection(com.thoughtworks.go.presentation.TriStateSelection) Before(org.junit.Before)

Example 2 with UpdateConfigCommand

use of com.thoughtworks.go.config.UpdateConfigCommand in project gocd by gocd.

the class AgentConfigServiceTest method shouldEnableAgentWhenAlreadyInTheConfig.

@Test
public void shouldEnableAgentWhenAlreadyInTheConfig() {
    String agentId = DatabaseAccessHelper.AGENT_UUID;
    AgentConfig agentConfig = new AgentConfig(agentId, "remote-host", "50.40.30.20");
    agentConfig.disable();
    AgentInstance instance = AgentInstance.createFromConfig(agentConfig, new SystemEnvironment());
    when(goConfigService.currentCruiseConfig()).thenReturn(mock(CruiseConfig.class));
    when(goConfigService.hasAgent(agentConfig.getUuid())).thenReturn(true);
    agentConfigService.enableAgents(Username.ANONYMOUS, instance);
    shouldPerformCommand(new GoConfigDao.CompositeConfigCommand((UpdateConfigCommand) new AgentConfigService.UpdateAgentApprovalStatus(agentId, false)));
}
Also used : AgentInstance(com.thoughtworks.go.domain.AgentInstance) SystemEnvironment(com.thoughtworks.go.util.SystemEnvironment) AgentConfig(com.thoughtworks.go.config.AgentConfig) UpdateConfigCommand(com.thoughtworks.go.config.UpdateConfigCommand) GoConfigDao(com.thoughtworks.go.config.GoConfigDao) CruiseConfig(com.thoughtworks.go.config.CruiseConfig) Test(org.junit.Test)

Aggregations

UpdateConfigCommand (com.thoughtworks.go.config.UpdateConfigCommand)2 AgentConfig (com.thoughtworks.go.config.AgentConfig)1 CruiseConfig (com.thoughtworks.go.config.CruiseConfig)1 GoConfigDao (com.thoughtworks.go.config.GoConfigDao)1 AgentInstance (com.thoughtworks.go.domain.AgentInstance)1 TriStateSelection (com.thoughtworks.go.presentation.TriStateSelection)1 Username (com.thoughtworks.go.server.domain.Username)1 SystemEnvironment (com.thoughtworks.go.util.SystemEnvironment)1 Before (org.junit.Before)1 Test (org.junit.Test)1