Search in sources :

Example 56 with GoConfigFileHelper

use of com.thoughtworks.go.util.GoConfigFileHelper in project gocd by gocd.

the class PipelineConfigServiceIntegrationTest method setup.

@BeforeEach
public void setup() throws Exception {
    cachedGoPartials.clear();
    configHelper = new GoConfigFileHelper();
    dbHelper.onSetUp();
    configHelper.usingCruiseConfigDao(goConfigDao);
    configHelper.onSetUp();
    goConfigService.forceNotifyListeners();
    user = new Username(new CaseInsensitiveString("current"));
    pipelineConfig = GoConfigMother.createPipelineConfigWithMaterialConfig(UUID.randomUUID().toString(), git("FOO"));
    goConfigService.addPipeline(pipelineConfig, groupName);
    repoConfig1 = createConfigRepoWithDefaultRules(MaterialConfigsMother.gitMaterialConfig("url"), XmlPartialConfigProvider.providerName, "git-id1");
    repoConfig2 = createConfigRepoWithDefaultRules(MaterialConfigsMother.gitMaterialConfig("url2"), XmlPartialConfigProvider.providerName, "git-id2");
    goConfigService.updateConfig(new UpdateConfigCommand() {

        @Override
        public CruiseConfig update(CruiseConfig cruiseConfig) throws Exception {
            cruiseConfig.getConfigRepos().add(repoConfig1);
            cruiseConfig.getConfigRepos().add(repoConfig2);
            return cruiseConfig;
        }
    });
    GoCipher goCipher = new GoCipher();
    goConfigService.updateServerConfig(new MailHost(goCipher), goConfigService.configFileMd5(), "artifacts", null, null, "0", null, null, "foo");
    UpdateConfigCommand command = goConfigService.modifyAdminPrivilegesCommand(asList(user.getUsername().toString()), new TriStateSelection(Admin.GO_SYSTEM_ADMIN, TriStateSelection.Action.add));
    goConfigService.updateConfig(command);
    remoteDownstreamPipelineName = "remote-downstream";
    partialConfig = PartialConfigMother.pipelineWithDependencyMaterial(remoteDownstreamPipelineName, pipelineConfig, new RepoConfigOrigin(repoConfig1, "repo1_r1"));
    partialConfigService.onSuccessPartialConfig(repoConfig1, partialConfig);
    PartialConfig partialConfigFromRepo2 = PartialConfigMother.withPipeline("independent-pipeline", new RepoConfigOrigin(repoConfig2, "repo2_r1"));
    partialConfigService.onSuccessPartialConfig(repoConfig2, partialConfigFromRepo2);
    result = new HttpLocalizedOperationResult();
    headCommitBeforeUpdate = configRepository.getCurrentRevCommit().name();
    goConfigService.security().securityAuthConfigs().add(new SecurityAuthConfig("file", "cd.go.authentication.passwordfile"));
}
Also used : GoCipher(com.thoughtworks.go.security.GoCipher) TriStateSelection(com.thoughtworks.go.presentation.TriStateSelection) PartialConfig(com.thoughtworks.go.config.remote.PartialConfig) GitAPIException(org.eclipse.jgit.api.errors.GitAPIException) HttpLocalizedOperationResult(com.thoughtworks.go.server.service.result.HttpLocalizedOperationResult) Username(com.thoughtworks.go.server.domain.Username) RepoConfigOrigin(com.thoughtworks.go.config.remote.RepoConfigOrigin) GoConfigFileHelper(com.thoughtworks.go.util.GoConfigFileHelper) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 57 with GoConfigFileHelper

use of com.thoughtworks.go.util.GoConfigFileHelper in project gocd by gocd.

the class PipelineConfigsServiceIntegrationTest method setUp.

@BeforeEach
public void setUp() throws Exception {
    configHelper = new GoConfigFileHelper();
    xml = goConfigMigration.upgradeIfNecessary(IOUtils.toString(getClass().getResource("/data/config_with_pluggable_artifacts_store.xml"), UTF_8));
    setupMetadataForPlugin();
    configHelper.usingCruiseConfigDao(goConfigDao);
    configHelper.onSetUp();
    configHelper.writeXmlToConfigFile(xml);
    goConfigService.forceNotifyListeners();
}
Also used : GoConfigFileHelper(com.thoughtworks.go.util.GoConfigFileHelper) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 58 with GoConfigFileHelper

use of com.thoughtworks.go.util.GoConfigFileHelper in project gocd by gocd.

the class ScheduleStageTest method setUp.

@BeforeEach
public void setUp(@TempDir Path tempDir) throws Exception {
    configHelper = new GoConfigFileHelper().usingCruiseConfigDao(dao);
    fixture = new PipelineWithMultipleStages(3, materialRepository, transactionTemplate, tempDir);
    fixture.usingThreeJobs();
    fixture.usingConfigHelper(configHelper).usingDbHelper(dbHelper).onSetUp();
}
Also used : GoConfigFileHelper(com.thoughtworks.go.util.GoConfigFileHelper) PipelineWithMultipleStages(com.thoughtworks.go.fixture.PipelineWithMultipleStages) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 59 with GoConfigFileHelper

use of com.thoughtworks.go.util.GoConfigFileHelper in project gocd by gocd.

the class ScheduledPipelineLoaderIntegrationTest method setup.

@BeforeEach
public void setup(@TempDir Path tempDir) throws Exception {
    configHelper = new GoConfigFileHelper(goConfigDao);
    dbHelper.onSetUp();
    goCache.clear();
    configHelper.onSetUp();
    svnRepo = new SvnTestRepoWithExternal(tempDir);
    cleanupTempFolders();
}
Also used : GoConfigFileHelper(com.thoughtworks.go.util.GoConfigFileHelper) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 60 with GoConfigFileHelper

use of com.thoughtworks.go.util.GoConfigFileHelper in project gocd by gocd.

the class ScheduleServiceIntegrationTest method setup.

@BeforeEach
public void setup(@TempDir Path tempDir) throws Exception {
    configHelper = new GoConfigFileHelper();
    dbHelper.onSetUp();
    configHelper.usingCruiseConfigDao(goConfigDao);
    configHelper.onSetUp();
    pipelineFixture = new PipelineWithTwoStages(materialRepository, transactionTemplate, tempDir);
    pipelineFixture.usingConfigHelper(configHelper).usingDbHelper(dbHelper).onSetUp();
    repository = new SvnCommand(null, testRepo.projectRepositoryUrl());
    mingleConfig = configHelper.addPipeline("mingle", STAGE_NAME, repository, JOB_NAME, "functional");
    goConfigService.forceNotifyListeners();
    agentAssignment.clear();
    goCache.clear();
}
Also used : PipelineWithTwoStages(com.thoughtworks.go.fixture.PipelineWithTwoStages) SvnCommand(com.thoughtworks.go.domain.materials.svn.SvnCommand) GoConfigFileHelper(com.thoughtworks.go.util.GoConfigFileHelper) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

GoConfigFileHelper (com.thoughtworks.go.util.GoConfigFileHelper)64 BeforeEach (org.junit.jupiter.api.BeforeEach)36 Before (org.junit.Before)23 PipelineWithTwoStages (com.thoughtworks.go.fixture.PipelineWithTwoStages)16 SvnCommand (com.thoughtworks.go.domain.materials.svn.SvnCommand)8 Username (com.thoughtworks.go.server.domain.Username)6 SvnTestRepo (com.thoughtworks.go.helper.SvnTestRepo)5 File (java.io.File)5 MockHttpServletResponse (org.springframework.mock.web.MockHttpServletResponse)5 HgTestRepo (com.thoughtworks.go.helper.HgTestRepo)4 MockHttpServletRequest (org.springframework.mock.web.MockHttpServletRequest)4 PipelineWithMultipleStages (com.thoughtworks.go.fixture.PipelineWithMultipleStages)3 TriStateSelection (com.thoughtworks.go.presentation.TriStateSelection)3 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)2 ConfigRepoConfig (com.thoughtworks.go.config.remote.ConfigRepoConfig)2 ConfigWithFreeEditionLicense (com.thoughtworks.go.fixture.ConfigWithFreeEditionLicense)2 TwoPipelineGroups (com.thoughtworks.go.fixture.TwoPipelineGroups)2 StubScheduleCheckCompletedListener (com.thoughtworks.go.server.messaging.StubScheduleCheckCompletedListener)2 ScheduleTestUtil (com.thoughtworks.go.server.service.ScheduleTestUtil)2 ConfigRepository (com.thoughtworks.go.service.ConfigRepository)2