Package hudson.plugins.scm_sync_configuration

Examples of hudson.plugins.scm_sync_configuration.SCMManipulator


    return mockedSCM;
  }

  protected SCMManipulator createMockedScmManipulator() throws ComponentLookupException, PlexusContainerException{
    // Settling up scm context
    SCMManipulator scmManipulator = new SCMManipulator(SCMManagerFactory.getInstance().createScmManager());
    boolean configSettledUp = scmManipulator.scmConfigurationSettledUp(scmContext, true);
    assertThat(configSettledUp, is(true));
   
    return scmManipulator;
  }
View Full Code Here


    protected void verifyCurrentScmContentMatchesHierarchy(String hierarchyPath, boolean match) throws ComponentLookupException, PlexusContainerException, IOException{
           verifyCurrentScmContentMatchesHierarchy(new ClassPathResource(hierarchyPath).getFile(), match);
     }

    protected void verifyCurrentScmContentMatchesHierarchy(File hierarchy, boolean match) throws ComponentLookupException, PlexusContainerException, IOException{
    SCMManipulator scmManipulator = createMockedScmManipulator();
   
    // Checkouting scm in temp directory
    File checkoutDirectoryForVerifications = createTmpDirectory(this.getClass().getSimpleName()+"_"+testName.getMethodName()+"__verifyCurrentScmContentMatchesHierarchy");
    scmManipulator.checkout(checkoutDirectoryForVerifications);
        List<String> diffs = DirectoryUtils.diffDirectories(checkoutDirectoryForVerifications, hierarchy,
                getSpecialSCMDirectoryExcludePattern(), true);

    FileUtils.deleteDirectory(checkoutDirectoryForVerifications);
   
View Full Code Here

   
    // Synchronizing hudson config files
    sscBusiness.synchronizeAllConfigs(ScmSyncConfigurationPlugin.AVAILABLE_STRATEGIES);
   
    // Let's checkout current scm view ... and commit something in it ...
    SCMManipulator scmManipulator = createMockedScmManipulator();
    File checkoutDirectoryForVerifications = createTmpDirectory(this.getClass().getSimpleName()+"_"+testName.getMethodName()+"__tmpHierarchyForCommit");
    scmManipulator.checkout(checkoutDirectoryForVerifications);
    final File hello1 = new File(checkoutDirectoryForVerifications.getAbsolutePath()+"/jobs/hello.txt");
    final File hello2 = new File(checkoutDirectoryForVerifications.getAbsolutePath()+"/hello2.txt");
    FileUtils.fileAppend(hello1.getAbsolutePath(), "hello world !");
    FileUtils.fileAppend(hello2.getAbsolutePath(), "hello world 2 !");
    scmManipulator.addFile(checkoutDirectoryForVerifications, "jobs/hello.txt");
    scmManipulator.addFile(checkoutDirectoryForVerifications, "hello2.txt");
    scmManipulator.checkinFiles(checkoutDirectoryForVerifications, "external commit");
   
    // Renaming fakeJob to newFakeJob
    Item mockedItem = Mockito.mock(Item.class);
    File mockedItemRootDir = new File(getCurrentHudsonRootDirectory() + "/jobs/newFakeJob/" );
    when(mockedItem.getRootDir()).thenReturn(mockedItemRootDir);
View Full Code Here

   
    // Synchronizing hudson config files
    sscBusiness.synchronizeAllConfigs(ScmSyncConfigurationPlugin.AVAILABLE_STRATEGIES);
   
    // Let's checkout current scm view ... and commit something in it ...
    SCMManipulator scmManipulator = createMockedScmManipulator();
    File checkoutDirectoryForVerifications = createTmpDirectory(this.getClass().getSimpleName()+"_"+testName.getMethodName()+"__tmpHierarchyForCommit");
    scmManipulator.checkout(checkoutDirectoryForVerifications);
    final File hello1 = new File(checkoutDirectoryForVerifications.getAbsolutePath()+"/jobs/hello.txt");
    final File hello2 = new File(checkoutDirectoryForVerifications.getAbsolutePath()+"/hello2.txt");
    FileUtils.fileAppend(hello1.getAbsolutePath(), "hello world !");
    FileUtils.fileAppend(hello2.getAbsolutePath(), "hello world 2 !");
    scmManipulator.addFile(checkoutDirectoryForVerifications, "jobs/hello.txt");
    scmManipulator.addFile(checkoutDirectoryForVerifications, "hello2.txt");
    scmManipulator.checkinFiles(checkoutDirectoryForVerifications, "external commit");
   
    // Deleting fakeJob
    Item mockedItem = Mockito.mock(Item.class);
    File mockedItemRootDir = new File(getCurrentHudsonRootDirectory() + "/jobs/fakeJob/" );
    when(mockedItem.getRootDir()).thenReturn(mockedItemRootDir);
View Full Code Here

   
    // Synchronizing hudson config files
    sscBusiness.synchronizeAllConfigs(ScmSyncConfigurationPlugin.AVAILABLE_STRATEGIES);
   
    // Let's checkout current scm view ... and commit something in it ...
    SCMManipulator scmManipulator = createMockedScmManipulator();
    File checkoutDirectoryForVerifications = createTmpDirectory(this.getClass().getSimpleName()+"_"+testName.getMethodName()+"__tmpHierarchyForCommit");
    scmManipulator.checkout(checkoutDirectoryForVerifications);
   
    verifyCurrentScmContentMatchesCurrentHudsonDir(true);
   
    final File configFile = new File(checkoutDirectoryForVerifications.getAbsolutePath() + "/config.xml");
    FileUtils.fileAppend(configFile.getAbsolutePath(), "toto");
    scmManipulator.checkinFiles(checkoutDirectoryForVerifications, "external commit on config file");
   
    final File configJobFile = new File(checkoutDirectoryForVerifications.getAbsolutePath() + "/jobs/fakeJob/config.xml");
    FileUtils.fileAppend(configJobFile.getAbsolutePath(), "titi");
    scmManipulator.checkinFiles(checkoutDirectoryForVerifications, "external commit on jonb file");
   
    verifyCurrentScmContentMatchesCurrentHudsonDir(false);
   
    // Reload config
    List<File> syncedFiles = sscBusiness.reloadAllFilesFromScm();
View Full Code Here

   
    // Synchronizing hudson config files
    sscBusiness.synchronizeAllConfigs(ScmSyncConfigurationPlugin.AVAILABLE_STRATEGIES);
   
    // Let's checkout current scm view ... and commit something in it ...
    SCMManipulator scmManipulator = createMockedScmManipulator();
    File checkoutDirectoryForVerifications = createTmpDirectory(this.getClass().getSimpleName()+"_"+testName.getMethodName()+"__tmpHierarchyForCommit");
    scmManipulator.checkout(checkoutDirectoryForVerifications);

        // Verifying there isn't any difference between hudson and scm repo once every file are synchronized
    verifyCurrentScmContentMatchesCurrentHudsonDir(true);
   
    final File addedFile = new File(checkoutDirectoryForVerifications.getAbsolutePath() + "/myConfigFile.xml");
    FileUtils.fileWrite(addedFile.getAbsolutePath(), "toto");
    scmManipulator.addFile(checkoutDirectoryForVerifications, "myConfigFile.xml");
    scmManipulator.checkinFiles(checkoutDirectoryForVerifications, "external commit for add file");

    final String jobDir = checkoutDirectoryForVerifications.getAbsolutePath() + "/jobs/myJob";
    FileUtils.mkdir(jobDir);
    final File addedJobFile = new File(jobDir + "/config.xml");
    FileUtils.fileWrite(addedJobFile.getAbsolutePath(), "titi");
    scmManipulator.addFile(checkoutDirectoryForVerifications, "jobs/myJob");
    scmManipulator.checkinFiles(checkoutDirectoryForVerifications, "external commit for add job file");

    verifyCurrentScmContentMatchesCurrentHudsonDir(false);
   
    // Reload config
    List<File> syncedFiles = sscBusiness.reloadAllFilesFromScm();
View Full Code Here

TOP

Related Classes of hudson.plugins.scm_sync_configuration.SCMManipulator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.