Search in sources :

Example 16 with SvnCommand

use of com.thoughtworks.go.domain.materials.svn.SvnCommand in project gocd by gocd.

the class SvnPostCommitHookImplementerTest method shouldCreateRemoteUrlToRemoteUUIDMap.

@Test
public void shouldCreateRemoteUrlToRemoteUUIDMap() {
    final SvnPostCommitHookImplementer spy = spy(implementer);
    final SvnCommand svnCommand = mock(SvnCommand.class);
    final Material svnMaterial1 = mock(SvnMaterial.class);
    final Material hgMaterial1 = mock(HgMaterial.class);
    final HashSet<Material> allMaterials = new HashSet<>(Arrays.asList(svnMaterial1, hgMaterial1));
    doAnswer(new Answer() {

        @Override
        public Object answer(InvocationOnMock invocation) throws Throwable {
            return svnCommand;
        }
    }).when(spy).getEmptySvnCommand();
    spy.createUrlToRemoteUUIDMap(allMaterials);
    verify(svnCommand).createUrlToRemoteUUIDMap(new HashSet<>(Arrays.asList((SvnMaterial) svnMaterial1)));
}
Also used : Answer(org.mockito.stubbing.Answer) Mockito.doAnswer(org.mockito.Mockito.doAnswer) InvocationOnMock(org.mockito.invocation.InvocationOnMock) SvnCommand(com.thoughtworks.go.domain.materials.svn.SvnCommand) Material(com.thoughtworks.go.domain.materials.Material) P4Material(com.thoughtworks.go.config.materials.perforce.P4Material) DependencyMaterial(com.thoughtworks.go.config.materials.dependency.DependencyMaterial) GitMaterial(com.thoughtworks.go.config.materials.git.GitMaterial) SvnMaterial(com.thoughtworks.go.config.materials.svn.SvnMaterial) HgMaterial(com.thoughtworks.go.config.materials.mercurial.HgMaterial) TfsMaterial(com.thoughtworks.go.config.materials.tfs.TfsMaterial) HashSet(java.util.HashSet) Test(org.junit.Test)

Example 17 with SvnCommand

use of com.thoughtworks.go.domain.materials.svn.SvnCommand in project gocd by gocd.

the class BuildWorkArtifactUploadingTest method setUp.

@Before
public void setUp() throws IOException {
    initMocks(this);
    buildWorkingDirectory = new File("tmp" + UUID.randomUUID());
    environmentVariableContext = new EnvironmentVariableContext();
    svnRepoFixture = new SvnRepoFixture("../common/src/test/resources/data/svnrepo", temporaryFolder);
    svnRepoFixture.createRepository();
    SvnCommand command = new SvnCommand(null, svnRepoFixture.getEnd2EndRepoUrl());
    PipelineConfigMother.createPipelineConfig(PIPELINE_NAME, STAGE_NAME, JOB_NAME);
    svnMaterial = SvnMaterial.createSvnMaterialWithMock(command);
    new SystemEnvironment().setProperty("serviceUrl", "some_random_place");
}
Also used : SystemEnvironment(com.thoughtworks.go.util.SystemEnvironment) SvnCommand(com.thoughtworks.go.domain.materials.svn.SvnCommand) EnvironmentVariableContext(com.thoughtworks.go.util.command.EnvironmentVariableContext) File(java.io.File) SvnRepoFixture(com.thoughtworks.go.utils.SvnRepoFixture) Before(org.junit.Before)

Example 18 with SvnCommand

use of com.thoughtworks.go.domain.materials.svn.SvnCommand in project gocd by gocd.

the class MaterialExpansionService method svn.

private Subversion svn(SvnMaterialConfig svnMaterialConfig) {
    String cacheKey = cacheKeyForSubversionMaterialCommand(svnMaterialConfig.getFingerprint());
    Subversion svnLazyLoaded = (SvnCommand) goCache.get(cacheKey);
    if (svnLazyLoaded == null || !svnLazyLoaded.getUrl().forCommandline().equals(svnMaterialConfig.getUrl())) {
        synchronized (cacheKey) {
            svnLazyLoaded = (SvnCommand) goCache.get(cacheKey);
            if (svnLazyLoaded == null || !svnLazyLoaded.getUrl().forCommandline().equals(svnMaterialConfig.getUrl())) {
                svnLazyLoaded = new SvnCommand(svnMaterialConfig.getFingerprint(), svnMaterialConfig.getUrl(), svnMaterialConfig.getUserName(), svnMaterialConfig.getPassword(), svnMaterialConfig.isCheckExternals());
                goCache.put(cacheKeyForSubversionMaterialCommand(svnMaterialConfig.getFingerprint()), svnLazyLoaded);
            }
        }
    }
    return svnLazyLoaded;
}
Also used : Subversion(com.thoughtworks.go.domain.materials.svn.Subversion) SvnCommand(com.thoughtworks.go.domain.materials.svn.SvnCommand)

Example 19 with SvnCommand

use of com.thoughtworks.go.domain.materials.svn.SvnCommand in project gocd by gocd.

the class SvnTestRepoWithExternal method commitToExternalRepo.

private void commitToExternalRepo(String externalUrl) throws IOException {
    File folder = temporaryFolder.newFolder();
    try {
        SvnCommand repository = getSvnExternalCommand(externalUrl, false);
        repository.checkoutTo(outputStreamConsumer, folder, SubversionRevision.HEAD);
        repository.propset(folder, "newPropetyForExternal", "any value");
        repository.commit(inMemoryConsumer(), folder, "make change");
    } finally {
        FileUtils.deleteQuietly(folder);
    }
}
Also used : SvnCommand(com.thoughtworks.go.domain.materials.svn.SvnCommand) File(java.io.File)

Example 20 with SvnCommand

use of com.thoughtworks.go.domain.materials.svn.SvnCommand in project gocd by gocd.

the class ScheduleServiceIntegrationTest method setup.

@Before
public void setup() throws Exception {
    configHelper = new GoConfigFileHelper();
    dbHelper.onSetUp();
    configHelper.usingCruiseConfigDao(goConfigDao).initializeConfigFile();
    configHelper.onSetUp();
    pipelineFixture = new PipelineWithTwoStages(materialRepository, transactionTemplate, temporaryFolder);
    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)

Aggregations

SvnCommand (com.thoughtworks.go.domain.materials.svn.SvnCommand)27 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)6 SvnTestRepo (com.thoughtworks.go.helper.SvnTestRepo)6 Before (org.junit.Before)6 SvnMaterial (com.thoughtworks.go.config.materials.svn.SvnMaterial)5 GoConfigFileHelper (com.thoughtworks.go.util.GoConfigFileHelper)5 MaterialConfigs (com.thoughtworks.go.config.materials.MaterialConfigs)4 SvnMaterialConfig (com.thoughtworks.go.config.materials.svn.SvnMaterialConfig)4 Subversion (com.thoughtworks.go.domain.materials.svn.Subversion)4 Test (org.junit.Test)4 DependencyMaterial (com.thoughtworks.go.config.materials.dependency.DependencyMaterial)3 PipelineWithTwoStages (com.thoughtworks.go.fixture.PipelineWithTwoStages)3 TestRepo (com.thoughtworks.go.helper.TestRepo)3 EnvironmentVariableContext (com.thoughtworks.go.util.command.EnvironmentVariableContext)3 SvnRepoFixture (com.thoughtworks.go.utils.SvnRepoFixture)3 PipelineConfig (com.thoughtworks.go.config.PipelineConfig)2 BuildCause (com.thoughtworks.go.domain.buildcause.BuildCause)2 SystemEnvironment (com.thoughtworks.go.util.SystemEnvironment)2 File (java.io.File)2 Date (java.util.Date)2