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);
}
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)));
}
Aggregations