当前位置: 首页>>代码示例>>Java>>正文


Java RelativeTargetDirectory类代码示例

本文整理汇总了Java中hudson.plugins.git.extensions.impl.RelativeTargetDirectory的典型用法代码示例。如果您正苦于以下问题:Java RelativeTargetDirectory类的具体用法?Java RelativeTargetDirectory怎么用?Java RelativeTargetDirectory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


RelativeTargetDirectory类属于hudson.plugins.git.extensions.impl包,在下文中一共展示了RelativeTargetDirectory类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setupProject

import hudson.plugins.git.extensions.impl.RelativeTargetDirectory; //导入依赖的package包/类
protected FreeStyleProject setupProject(List<BranchSpec> branches, boolean authorOrCommitter,
    String relativeTargetDir, String excludedRegions,
    String excludedUsers, String localBranch, boolean fastRemotePoll,
    String includedRegions, List<SparseCheckoutPath> sparseCheckoutPaths) throws Exception {
  FreeStyleProject project = createFreeStyleProject();
  GitSCM scm = new GitSCM(
      createRemoteRepositories(),
      branches,
      false, Collections.<SubmoduleConfig>emptyList(),
      null, null,
      Collections.<GitSCMExtension>emptyList());
  scm.getExtensions().add(new DisableRemotePoll()); // don't work on a file:// repository
  if (relativeTargetDir!=null)
    scm.getExtensions().add(new RelativeTargetDirectory(relativeTargetDir));
  if (excludedUsers!=null)
    scm.getExtensions().add(new UserExclusion(excludedUsers));
  if (excludedRegions!=null || includedRegions!=null)
    scm.getExtensions().add(new PathRestriction(includedRegions,excludedRegions));

  scm.getExtensions().add(new SparseCheckoutPaths(sparseCheckoutPaths));

  project.setScm(scm);
  project.getBuildersList().add(new CaptureEnvironmentBuilder());
  return project;
}
 
开发者ID:jenkinsci,项目名称:flaky-test-handler-plugin,代码行数:26,代码来源:AbstractGitTestCase.java

示例2: perform

import hudson.plugins.git.extensions.impl.RelativeTargetDirectory; //导入依赖的package包/类
/**
 * Calls the SCM-specific function according to the chosen SCM. Only called for Non pipeline jobs
 *
 * @param build    The Build
 * @param launcher The Launcher
 * @param listener The BuildListener
 * @return boolean True on success.
 * @throws InterruptedException An foreseen issue
 */
@Override
public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener) throws InterruptedException {
    AbstractProject<?, ?> proj = build.getProject();
    if (proj instanceof MatrixConfiguration) {
        listener.getLogger().println(LOG_PREFIX + "MatrixConfiguration/sub - skipping publisher - leaving it to root job");
    } else {
        GitSCM scm = (GitSCM)proj.getScm();
        RelativeTargetDirectory rtd = scm.getExtensions().get(RelativeTargetDirectory.class);
        try {
            FilePath wsForUs = rtd != null ? rtd.getWorkingDirectory(scm, proj, build.getWorkspace(), build.getEnvironment(listener), listener) : build.getWorkspace();
            printWarningIfUnsupported(proj.getClass(), listener);
            if(wsForUs != null) {
                perform((Run) build, wsForUs, launcher, listener);
            } else {
                throw new InterruptedException("[PREINT] Fatal: Workspace is null");
            }
        } catch (IOException ex) {
            listener.getLogger().println("[PREINT] FATAL: Unable to determine workspace");
            throw new InterruptedException("[PREINT] FATAL: Unable to determine workspace");
        }
    }
    return true;
}
 
开发者ID:Praqma,项目名称:pretested-integration-plugin,代码行数:33,代码来源:PretestedIntegrationPostCheckout.java

示例3: testCheckOutToSubDirectoryWithSqushShouldSucceed

import hudson.plugins.git.extensions.impl.RelativeTargetDirectory; //导入依赖的package包/类
/**
 * Basically we need to verify that the plugin works when you checkout to a
 * subdirectory. Using squashed strategy.
 *
 * @throws Exception
 */
@Bug(25445)
@Test
public void testCheckOutToSubDirectoryWithSqushShouldSucceed() throws Exception {
    Repository repository = TestUtilsFactory.createValidRepository("test-repo-sqSubdir");
    FreeStyleProject project = TestUtilsFactory.configurePretestedIntegrationPlugin(jenkinsRule, TestUtilsFactory.STRATEGY_TYPE.SQUASH, repository, true);
    GitSCM scm = (GitSCM) project.getScm();
    scm.getExtensions().add(new RelativeTargetDirectory("rel-dir"));
    TestUtilsFactory.triggerProject(project);

    jenkinsRule.waitUntilNoActivityUpTo(60000);

    TestUtilsFactory.destroyRepo(repository);

    FreeStyleBuild build = project.getBuilds().getFirstBuild();

    String text = jenkinsRule.createWebClient().getPage(build, "console").asText();
    System.out.println("=====BUILD-LOG=====");
    System.out.println(text);
    System.out.println("=====BUILD-LOG=====");

    assertTrue(build.getResult().isBetterOrEqualTo(Result.SUCCESS));
}
 
开发者ID:Praqma,项目名称:pretested-integration-plugin,代码行数:29,代码来源:GeneralBehaviourIT.java

示例4: testCheckOutToSubDirectoryWithAccumulateShouldSucceed

import hudson.plugins.git.extensions.impl.RelativeTargetDirectory; //导入依赖的package包/类
/**
 * Basically we need to verify that the plugin works when you checkout to a
 * subdirectory. Using accumulated strategy.
 *
 * @throws Exception
 */
@Bug(25445)
@Test
public void testCheckOutToSubDirectoryWithAccumulateShouldSucceed() throws Exception {
    Repository repository = TestUtilsFactory.createValidRepository("test-repo-accSubdir");
    FreeStyleProject project = TestUtilsFactory.configurePretestedIntegrationPlugin(jenkinsRule, TestUtilsFactory.STRATEGY_TYPE.ACCUMULATED, repository, true);
    GitSCM scm = (GitSCM) project.getScm();
    scm.getExtensions().add(new RelativeTargetDirectory("rel-dir"));
    TestUtilsFactory.triggerProject(project);

    jenkinsRule.waitUntilNoActivityUpTo(60000);

    TestUtilsFactory.destroyRepo(repository);

    FreeStyleBuild build = project.getBuilds().getFirstBuild();

    String text = jenkinsRule.createWebClient().getPage(build, "console").asText();
    System.out.println("=====BUILD-LOG=====");
    System.out.println(text);
    System.out.println("=====BUILD-LOG=====");

    assertTrue(build.getResult().isBetterOrEqualTo(Result.SUCCESS));
}
 
开发者ID:Praqma,项目名称:pretested-integration-plugin,代码行数:29,代码来源:GeneralBehaviourIT.java

示例5: resolveWorkspace

import hudson.plugins.git.extensions.impl.RelativeTargetDirectory; //导入依赖的package包/类
/**
 * Returns the workspace
 *
 * @param build    The Build
 * @param listener The Listener
 * @return a FilePath representing the workspace
 * @throws InterruptedException Unforeseen issue
 * @throws IOException          Unforeseen IO issue
 */
public FilePath resolveWorkspace(AbstractBuild<?, ?> build, BuildListener listener) throws InterruptedException, IOException {
    FilePath workspace = build.getWorkspace();
    GitSCM scm = findScm(build, listener);
    RelativeTargetDirectory dir = scm.getExtensions().get(RelativeTargetDirectory.class);

    if (dir != null) {
        workspace = dir.getWorkingDirectory(scm, build.getProject(), workspace, build.getEnvironment(listener), listener);
    }

    LOGGER.log(Level.FINE, "Resolved workspace to {0}", workspace);
    return workspace;
}
 
开发者ID:Praqma,项目名称:pretested-integration-plugin,代码行数:22,代码来源:GitBridge.java

示例6: getManager

import hudson.plugins.git.extensions.impl.RelativeTargetDirectory; //导入依赖的package包/类
public static AdvancedSCMManager getManager(AbstractBuild build, Launcher launcher, BuildListener listener) throws Exception {
    String givenRepoSubdir = null;
    PrintStream l = listener.getLogger();
    givenRepoSubdir = build.getEnvironment(listener).get("REPO_SUBDIR", "");
    SCM scm = build.getProject().getScm();

    // Sort out multiscm scms.
    if (scm instanceof MultiSCM) {
        List<SCM> scms = ((MultiSCM) scm).getConfiguredSCMs();
        if (scms.size() > 1) {
            // loop and find correct repo to apply credentials on
            for (SCM s: ((MultiSCM) scm).getConfiguredSCMs()) {
                // Only if typeof scm is mercurial
                if (s instanceof MercurialSCM) {
                    String subDir = ((MercurialSCM) s).getSubdir();
                    if (subDir != null) {
                        if (subDir.equals(givenRepoSubdir)) {
                            l.append("Chosen MultiSCM with Mercurial Backend");
                            return new MercurialBackend(build, launcher, listener, (MercurialSCM) s);
                        }
                    }
                } else if (s instanceof GitSCM) {
                    GitSCM gitSCM = (GitSCM) s;

                    for (GitSCMExtension extension: gitSCM.getExtensions()){
                        if (extension instanceof RelativeTargetDirectory) {
                            String targetDir = ((RelativeTargetDirectory) extension).getRelativeTargetDir();
                            if (targetDir  != null && !targetDir .isEmpty() && targetDir == givenRepoSubdir) {
                                l.append("Chosen MultiSCM with Git Backend");
                                return new GitBackend(build, launcher, listener, (GitSCM) s);
                            }
                        }
                    }
                }
            }
        } else {
            scm = scms.get(0);
        }
    }

    // No multiscm, just return correct backend.
    if (scm instanceof MercurialSCM) {
        l.append("Chosen Mercurial backend, NO MultiSCM");
        return new MercurialBackend(build, launcher, listener, (MercurialSCM) scm);
    } else if (scm instanceof GitSCM) {
        l.append("Chosen Git backend, NO MultiSCM");
        return new GitBackend(build, launcher, listener, (GitSCM) scm);
    }

    // If we come here, no viable SCM was found, so we quit.
    throw new Exception("There is no implementation available for the chosen SCM. Sorry about that.");
}
 
开发者ID:jenkinsci,项目名称:gatekeeper-plugin,代码行数:53,代码来源:SCMManagerFactory.java

示例7: testBasicMultiSCMMerge

import hudson.plugins.git.extensions.impl.RelativeTargetDirectory; //导入依赖的package包/类
@Test
public void testBasicMultiSCMMerge() throws Exception {
    FreeStyleProject p = j.createFreeStyleProject();
    ArrayList<SCM> scmList = new ArrayList<SCM>();

    List<UserRemoteConfig> remotes = new ArrayList<UserRemoteConfig>();
    remotes.add(new UserRemoteConfig(repo.getPath(), "origin", "master", null));
    scmList.add(new GitSCM(remotes, null, false, null, null, null, null));

    remotes = new ArrayList<UserRemoteConfig>();
    remotes.add(new UserRemoteConfig(repo2.getPath(), "origin", "master", null));
    List<GitSCMExtension> extensions = new ArrayList<GitSCMExtension>();
    extensions.add(new RelativeTargetDirectory("src/asdf"));
    scmList.add(new GitSCM(remotes, null, false, null, null, null, extensions));

    p.setScm(new MultiSCM(scmList));

    ArrayList<ParameterValue> parameters = new ArrayList<ParameterValue>();
    parameters.add(new StringParameterValue("REPO_SUBDIR", "src/asdf"));

    // Init repo with release and feature branch.
    GitClient client = g.gitClient(repo);
    client.init();
    g.touchAndCommit(repo, "dummy");

    client = g.gitClient(repo2);
    client.init();
    g.touchAndCommit(repo2, "init");
    client.checkout("HEAD", "r1336");
    g.touchAndCommit(repo2, "r1336");
    client.checkout("HEAD", "c3");
    g.touchAndCommit(repo2, "c3");

    // Custom builder that merges feature branch with release branch using AdvancedSCMManager.
    p.getBuildersList().add(new TestBuilder() {
        @Override
        public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException {
            try {
                AdvancedSCMManager amm = SCMManagerFactory.getManager(build, launcher, listener);
                amm.update("r1336");
                amm.mergeWorkspaceWith("c3", null);
                amm.commit("merge c3", "test <[email protected]>");
                return true;
            } catch (Exception e) {
                e.printStackTrace(listener.getLogger());
                return false;
            }
        }
    });

    // Assert file is here (should be after successful merge)
    g.buildAndCheck(p, "src/asdf/c3", new ParametersAction(parameters));
}
 
开发者ID:jenkinsci,项目名称:gatekeeper-plugin,代码行数:54,代码来源:BasicGitTest.java


注:本文中的hudson.plugins.git.extensions.impl.RelativeTargetDirectory类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。