• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Repository类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: pullRequestListener

import com.atlassian.stash.repository.Repository; //导入依赖的package包/类
@EventListener
public void pullRequestListener(PullRequestMergeActivityEvent pullRequestMergeActivityEvent) {
    Repository targetRepo = pullRequestMergeActivityEvent.getPullRequest().getToRef().getRepository();
    PullRequest pullRequest = pullRequestMergeActivityEvent.getPullRequest();

    RepositoryHook repositoryHook = repositoryHookService.getByKey(targetRepo, REPO_HOOK_KEY);
    if (repositoryHook.isEnabled() && pullRequestMergeActivityEvent.getActivity().getAction().equals(PullRequestAction.MERGED)) {
        Settings settings = repositoryHookService.getSettings(targetRepo, REPO_HOOK_KEY);
        String bypassKeyword = settings.getString(PullRequestMergeRulesCheck.SETTING_KEY_BYPASS_KEYWORD);
        String apiToken = settings.getString(PullRequestMergeRulesCheck.SETTING_KEY_HIPCHAT_API_TOKEN);
        String roomId = settings.getString(PullRequestMergeRulesCheck.SETTING_KEY_HIPCHAT_ROOM_ID);

        if (StringUtils.containsIgnoreCase(pullRequest.getTitle(), bypassKeyword)
                && isHipChatConfigured(settings)) {
            String message = String.format("<b>%s</b> bypassed merge checks for pull request <b>#%d</b> in <b>%s/%s</b> <br/>%s",
                    pullRequestMergeActivityEvent.getUser().getDisplayName(),
                    pullRequest.getId(),
                    targetRepo.getProject().getKey(),
                    targetRepo.getSlug(),
                    pullRequest.getTitle());

            HipChatClient client = new HipChatClient(apiToken);
            client.sendRoomNotification(new HipChatNotification(message, roomId, HipChatNotification.Color.RED));
        }
    }
}
 
开发者ID:scheerer,项目名称:stash-merge-rules-plugin,代码行数:27,代码来源:MergeCheckBypassListener.java


示例2: saveSettings

import com.atlassian.stash.repository.Repository; //导入依赖的package包/类
private StatusMessages saveSettings(HttpServletRequest req, Repository repository) {
  final String button = req.getParameter("submit-button") != null ? req.getParameter("submit-button") : "";
  final StatusMessages messages;

  if (button.equals("Save")) {
    messages = saveGeneralSettings(req, repository);
  } else if (button.equals("Add")) {
    messages = addBranch(req, repository);
  } else if (button.equals("Update")) {
    messages = saveBranch(req, repository);
  } else if (button.equals("Delete")) {
    messages = deleteBranch(req, repository);
  } else if (button.equals("Cancel")) {
    messages = new NoMessages();
  } else {
    messages = null; // Invalid form leads to 404
  }

  return messages;
}
 
开发者ID:RichRelevance,项目名称:StashPRTriggerPlugin,代码行数:21,代码来源:PullRequestSettingServlet.java


示例3: saveGeneralSettings

import com.atlassian.stash.repository.Repository; //导入依赖的package包/类
private StatusMessages saveGeneralSettings(HttpServletRequest req, Repository repository) {
  Boolean enabled = (req.getParameter("enabled") != null);
  String url = req.getParameter("url"); url = url != null ? url.trim() : "";
  String user = req.getParameter("user"); user = user != null ? user.trim() : "";
  String password = req.getParameter("password"); password = password != null ? password.trim() : "";

  if (url.isEmpty() || user.isEmpty() || password.isEmpty()) {
    final String errorMessage = String.format("Empty field not allowed (url '%s', user '%s', password '%s', ",
      url, user, password.isEmpty() ? "" : "*********");
    log.info("Ignoring settings update: " + errorMessage);
    return SingleMessage.error(errorMessage);
  }

  PullRequestTriggerSettings settings = new ImmutablePullRequestTriggerSettings(enabled, url, user, password);

  pullRequestTriggerSettingsService.setPullRequestTriggerSettings(repository, settings);

  return SingleMessage.success("Settings updated");
}
 
开发者ID:RichRelevance,项目名称:StashPRTriggerPlugin,代码行数:20,代码来源:PullRequestSettingServlet.java


示例4: setPullRequestTriggerSettings

import com.atlassian.stash.repository.Repository; //导入依赖的package包/类
@Override
public PullRequestTriggerSettings setPullRequestTriggerSettings(Repository repository, PullRequestTriggerSettings settings) {
  permissionValidationService.validateForRepository(repository, Permission.REPO_ADMIN);
  final Map<String, String> data;
  final Integer repositoryId = repository.getId();
  if (repositoryId == null) {
    log.error("Repository id is null when saving settings: " + repository);
    return null;
  }
  try {
    data = serialize(settings);
  } catch (NullPointerException e) {
    log.error("Error serializing PR settings object " + settings, e);
    throw e;
  }
  pluginSettings.put(Integer.toString(repositoryId), data);
  cache.remove(repositoryId);
  return deserialize(data);
}
 
开发者ID:RichRelevance,项目名称:StashPRTriggerPlugin,代码行数:20,代码来源:DefaultPullRequestTriggerSettingsService.java


示例5: deleteBranch

import com.atlassian.stash.repository.Repository; //导入依赖的package包/类
@Override
public void deleteBranch(Repository repository, String branchName) {
  permissionValidationService.validateForRepository(repository, Permission.REPO_ADMIN);
  final String branchKey = branchKeyForRepoId(repository, branchName);
  final Integer repositoryId = repository.getId();
  final List<String> branches = branchListCache.get(repositoryId);

  if (repositoryId == null) {
    log.error("Repository id is null when deleting branch settings: " + repository);
    return;
  }

  if (branches.contains(branchName)) {
    branches.remove(branchName);
    pluginSettings.remove(KEY_BRANCH_LIST + repositoryId.toString());
    if (!branches.isEmpty())
      pluginSettings.put(KEY_BRANCH_LIST + repositoryId.toString(), branches);
    branchListCache.remove(repositoryId);
  }

  pluginSettings.remove(branchKey);
  branchCache.remove(branchKey);
}
 
开发者ID:RichRelevance,项目名称:StashPRTriggerPlugin,代码行数:24,代码来源:DefaultPullRequestTriggerSettingsService.java


示例6: getBranchSettingsForBranch

import com.atlassian.stash.repository.Repository; //导入依赖的package包/类
@Override
public List<BranchSettings> getBranchSettingsForBranch(Repository repository, String branchName) {
  permissionValidationService.validateForRepository(repository, Permission.REPO_READ);
  final List<String> branchList = branchListCache.get(repository.getId());
  final List<BranchSettings> result = new ArrayList<BranchSettings>();

  for (String branchPattern : branchList) {
    final Pattern regexPattern;

    try {
      regexPattern = Pattern.compile(branchPattern);
    } catch (PatternSyntaxException e) {
      log.error(String.format("Invalid regex for branch configuration: %s", branchName), e);
      return new ArrayList<BranchSettings>();
    }
    if (regexPattern.matcher(branchName).find()) {
      result.add(branchCache.get(branchKeyForRepoId(repository, branchPattern)));
    }
  }
  return result;
}
 
开发者ID:RichRelevance,项目名称:StashPRTriggerPlugin,代码行数:22,代码来源:DefaultPullRequestTriggerSettingsService.java


示例7: triggerBuild

import com.atlassian.stash.repository.Repository; //导入依赖的package包/类
@Override
public void triggerBuild(PullRequestEvent pullRequestEvent, BranchPredicate predicate) {
  final PullRequest pullRequest = pullRequestEvent.getPullRequest();
  final PullRequestTriggerSettings settings = getSettings(pullRequest);
  final Repository repository = getRepository(pullRequest);
  final String branchName = pullRequest.getToRef().getId();
  final List<BranchSettings> branchSettingsList = service.getBranchSettingsForBranch(repository, branchName);
  final Long prNumber = pullRequest.getId();

  if (prNumber != null) {
    if (settings.isEnabled()) {
      for (BranchSettings branchSettings : branchSettingsList) {
        if (predicate.matches(branchSettings)) {
          buildTriggerer.invoke(prNumber, settings, branchSettings);
        }
      }
    }
  } else {
    log.error("id of pull request is null: " + pullRequest);
  }
}
 
开发者ID:RichRelevance,项目名称:StashPRTriggerPlugin,代码行数:22,代码来源:TriggerImpl.java


示例8: gettingSettingsForNewRepoReturnsDefaultSettingsTest

import com.atlassian.stash.repository.Repository; //导入依赖的package包/类
@Test
public void gettingSettingsForNewRepoReturnsDefaultSettingsTest() {
  final PermissionValidationService permService = mock(PermissionValidationService.class);
  final PluginSettingsFactory factory = mock(PluginSettingsFactory.class);
  final PluginSettings pluginSettings = mock(PluginSettings.class);
  final Repository repository = mock(Repository.class);

  when(repository.getId()).thenReturn(1);
  when(factory.createSettingsForKey(PluginMetadata.getPluginKey())).thenReturn(pluginSettings);

  final DefaultPullRequestTriggerSettingsService service = new DefaultPullRequestTriggerSettingsService(permService, factory);

  final PullRequestTriggerSettings settings = service.getPullRequestTriggerSettings(repository);

  assertEquals(new ImmutablePullRequestTriggerSettings(), settings);
}
 
开发者ID:RichRelevance,项目名称:StashPRTriggerPlugin,代码行数:17,代码来源:SettingsTest.java


示例9: settingsCanBeSavedTest

import com.atlassian.stash.repository.Repository; //导入依赖的package包/类
@Test
public void settingsCanBeSavedTest() {
  final PermissionValidationService permService = mock(PermissionValidationService.class);
  final PluginSettingsFactory factory = mock(PluginSettingsFactory.class);
  final PluginSettings pluginSettings = mock(PluginSettings.class);
  final Repository repository = mock(Repository.class);

  when(repository.getId()).thenReturn(1);
  when(factory.createSettingsForKey(PluginMetadata.getPluginKey())).thenReturn(pluginSettings);
  when(pluginSettings.put("1", settingsMapEnabled)).thenReturn(settingsMapEnabled);
  when(pluginSettings.get("1")).thenReturn(settingsMapEnabled);

  final DefaultPullRequestTriggerSettingsService service = new DefaultPullRequestTriggerSettingsService(permService, factory);

  service.setPullRequestTriggerSettings(repository, settingsEnabled);
  final PullRequestTriggerSettings settings = service.getPullRequestTriggerSettings(repository);

  InOrder inOrder = inOrder(pluginSettings);
  inOrder.verify(pluginSettings).put("1", settingsMapEnabled);
  inOrder.verify(pluginSettings).get("1");

  assertEquals(settingsEnabled, settings);
  assertNotSame(new ImmutablePullRequestTriggerSettings(), settings);
}
 
开发者ID:RichRelevance,项目名称:StashPRTriggerPlugin,代码行数:25,代码来源:SettingsTest.java


示例10: gettingSettingsForBranchReturnsBranchesMatchingNameTest

import com.atlassian.stash.repository.Repository; //导入依赖的package包/类
@Test
public void gettingSettingsForBranchReturnsBranchesMatchingNameTest() {
  final PermissionValidationService permService = mock(PermissionValidationService.class);
  final PluginSettingsFactory factory = mock(PluginSettingsFactory.class);
  final PluginSettings pluginSettings = mock(PluginSettings.class);
  final Repository repository = mock(Repository.class);

  when(repository.getId()).thenReturn(1);
  when(factory.createSettingsForKey(PluginMetadata.getPluginKey())).thenReturn(pluginSettings);
  when(pluginSettings.get("branchList:1")).thenReturn(expandedBranchList());
  when(pluginSettings.get(branchName + ":1")).thenReturn(branchSettingsMap);
  when(pluginSettings.get(anotherBranchName + ":1")).thenReturn(anotherBranchMap);

  final DefaultPullRequestTriggerSettingsService service = new DefaultPullRequestTriggerSettingsService(permService, factory);

  final List<BranchSettings> settingsList = service.getBranchSettingsForBranch(repository, branchName);

  assertEquals(Lists.newArrayList(immutableBranchSettings), settingsList);
}
 
开发者ID:RichRelevance,项目名称:StashPRTriggerPlugin,代码行数:20,代码来源:SettingsTest.java


示例11: gettingSettingsForBranchReturnsBranchesMatchingRegexTest

import com.atlassian.stash.repository.Repository; //导入依赖的package包/类
@Test
public void gettingSettingsForBranchReturnsBranchesMatchingRegexTest() {
  final PermissionValidationService permService = mock(PermissionValidationService.class);
  final PluginSettingsFactory factory = mock(PluginSettingsFactory.class);
  final PluginSettings pluginSettings = mock(PluginSettings.class);
  final Repository repository = mock(Repository.class);

  when(repository.getId()).thenReturn(1);
  when(factory.createSettingsForKey(PluginMetadata.getPluginKey())).thenReturn(pluginSettings);
  when(pluginSettings.get("branchList:1")).thenReturn(regexBranchList());
  when(pluginSettings.get(regexBranchPattern + ":1")).thenReturn(regexBranchMap);

  final DefaultPullRequestTriggerSettingsService service = new DefaultPullRequestTriggerSettingsService(permService, factory);

  final List<BranchSettings> settingsList = service.getBranchSettingsForBranch(repository, anotherBranchName);

  assertEquals(Lists.newArrayList(regexBranchSettings), settingsList);
}
 
开发者ID:RichRelevance,项目名称:StashPRTriggerPlugin,代码行数:19,代码来源:SettingsTest.java


示例12: gettingSettingsForBranchReturnsBranchesWithPartialNameMatchesTest

import com.atlassian.stash.repository.Repository; //导入依赖的package包/类
@Test
public void gettingSettingsForBranchReturnsBranchesWithPartialNameMatchesTest() {
  final PermissionValidationService permService = mock(PermissionValidationService.class);
  final PluginSettingsFactory factory = mock(PluginSettingsFactory.class);
  final PluginSettings pluginSettings = mock(PluginSettings.class);
  final Repository repository = mock(Repository.class);

  when(repository.getId()).thenReturn(1);
  when(factory.createSettingsForKey(PluginMetadata.getPluginKey())).thenReturn(pluginSettings);
  when(pluginSettings.get("branchList:1")).thenReturn(expandedBranchList());
  when(pluginSettings.get(branchName + ":1")).thenReturn(branchSettingsMap);
  when(pluginSettings.get(anotherBranchName + ":1")).thenReturn(anotherBranchMap);

  final DefaultPullRequestTriggerSettingsService service = new DefaultPullRequestTriggerSettingsService(permService, factory);

  final List<BranchSettings> settingsList = service.getBranchSettingsForBranch(repository, anotherBranchName);

  assertEquals(Lists.newArrayList(anotherBranchSettings), settingsList);
}
 
开发者ID:RichRelevance,项目名称:StashPRTriggerPlugin,代码行数:20,代码来源:SettingsTest.java


示例13: gettingSettingsForBranchReturnsAllBranchesMatchingNameTest

import com.atlassian.stash.repository.Repository; //导入依赖的package包/类
@Test
public void gettingSettingsForBranchReturnsAllBranchesMatchingNameTest() {
  final PermissionValidationService permService = mock(PermissionValidationService.class);
  final PluginSettingsFactory factory = mock(PluginSettingsFactory.class);
  final PluginSettings pluginSettings = mock(PluginSettings.class);
  final Repository repository = mock(Repository.class);

  when(repository.getId()).thenReturn(1);
  when(factory.createSettingsForKey(PluginMetadata.getPluginKey())).thenReturn(pluginSettings);
  when(pluginSettings.get("branchList:1")).thenReturn(regexExpandedBranchList());
  when(pluginSettings.get(branchName + ":1")).thenReturn(branchSettingsMap);
  when(pluginSettings.get(regexBranchPattern + ":1")).thenReturn(regexBranchMap);

  final DefaultPullRequestTriggerSettingsService service = new DefaultPullRequestTriggerSettingsService(permService, factory);

  final List<BranchSettings> settingsList = service.getBranchSettingsForBranch(repository, branchName);

  assertEquals(Lists.newArrayList(immutableBranchSettings, regexBranchSettings), settingsList);
}
 
开发者ID:RichRelevance,项目名称:StashPRTriggerPlugin,代码行数:20,代码来源:SettingsTest.java


示例14: automaticTriggerBuildIfBranchAutomaticBuildIsEnabledTest

import com.atlassian.stash.repository.Repository; //导入依赖的package包/类
@Test
public void automaticTriggerBuildIfBranchAutomaticBuildIsEnabledTest() {
  BuildTriggerer buildTriggerer = mock(BuildTriggerer.class);
  PullRequestEvent event = mock(PullRequestEvent.class);
  PullRequest pullRequest = mock(PullRequest.class);
  PullRequestRef ref = mock(PullRequestRef.class);
  Repository repository = mock(Repository.class);

  when(event.getPullRequest()).thenReturn(pullRequest);
  when(pullRequest.getToRef()).thenReturn(ref, ref);
  when(ref.getRepository()).thenReturn(repository);
  when(ref.getId()).thenReturn(branchName);
  when(pullRequest.getId()).thenReturn(1L);

  Trigger trigger = new TriggerImpl(settingsServiceEnabled, buildTriggerer);

  trigger.automaticTrigger(event);

  verify(buildTriggerer).invoke(1L, settingsEnabled, immutableBranchSettings);
}
 
开发者ID:RichRelevance,项目名称:StashPRTriggerPlugin,代码行数:21,代码来源:TriggerImplTest.java


示例15: automaticTriggerDoesNotBuildIfBranchAutomaticBuildIsDisabledTest

import com.atlassian.stash.repository.Repository; //导入依赖的package包/类
@Test
public void automaticTriggerDoesNotBuildIfBranchAutomaticBuildIsDisabledTest() {
  BuildTriggerer buildTriggerer = mock(BuildTriggerer.class);
  PullRequestEvent event = mock(PullRequestEvent.class);
  PullRequest pullRequest = mock(PullRequest.class);
  PullRequestRef ref = mock(PullRequestRef.class);
  Repository repository = mock(Repository.class);

  when(event.getPullRequest()).thenReturn(pullRequest);
  when(pullRequest.getToRef()).thenReturn(ref, ref);
  when(ref.getRepository()).thenReturn(repository);
  when(ref.getId()).thenReturn(branchName);
  when(pullRequest.getId()).thenReturn(1L);

  Trigger trigger = new TriggerImpl(settingsServiceOnDemand, buildTriggerer);

  trigger.automaticTrigger(event);

  verify(buildTriggerer, never()).invoke(anyLong(), any(PullRequestTriggerSettings.class), any(BranchSettings.class));
}
 
开发者ID:RichRelevance,项目名称:StashPRTriggerPlugin,代码行数:21,代码来源:TriggerImplTest.java


示例16: onDemandTriggerBuildsIfMessageMatchesSettingsTest

import com.atlassian.stash.repository.Repository; //导入依赖的package包/类
@Test
public void onDemandTriggerBuildsIfMessageMatchesSettingsTest() {
  PullRequestCommentAddedEvent event = mock(PullRequestCommentAddedEvent.class);
  Comment comment = mock(Comment.class);
  PullRequest pullRequest = mock(PullRequest.class);
  PullRequestRef ref = mock(PullRequestRef.class);
  Repository repository = mock(Repository.class);
  BuildTriggerer buildTriggerer = mock(BuildTriggerer.class);

  when(event.getComment()).thenReturn(comment);
  when(comment.getText()).thenReturn(retestMsg);
  when(event.getPullRequest()).thenReturn(pullRequest);
  when(pullRequest.getToRef()).thenReturn(ref);
  when(ref.getRepository()).thenReturn(repository);
  when(ref.getId()).thenReturn(branchName);
  when(pullRequest.getId()).thenReturn(1L);

  Trigger trigger = new TriggerImpl(settingsServiceEnabled, buildTriggerer);

  trigger.onDemandTrigger(event);

  verify(buildTriggerer).invoke(1L, settingsEnabled, immutableBranchSettings);
}
 
开发者ID:RichRelevance,项目名称:StashPRTriggerPlugin,代码行数:24,代码来源:TriggerImplTest.java


示例17: onDemandTriggerBuildsIfMessageMatchesRegexTest

import com.atlassian.stash.repository.Repository; //导入依赖的package包/类
@Test
public void onDemandTriggerBuildsIfMessageMatchesRegexTest() {
  PullRequestCommentAddedEvent event = mock(PullRequestCommentAddedEvent.class);
  Comment comment = mock(Comment.class);
  PullRequest pullRequest = mock(PullRequest.class);
  PullRequestRef ref = mock(PullRequestRef.class);
  Repository repository = mock(Repository.class);
  BuildTriggerer buildTriggerer = mock(BuildTriggerer.class);

  when(event.getComment()).thenReturn(comment);
  when(comment.getText()).thenReturn("KLAATU BARADA NIKTO");
  when(event.getPullRequest()).thenReturn(pullRequest);
  when(pullRequest.getToRef()).thenReturn(ref);
  when(ref.getRepository()).thenReturn(repository);
  when(ref.getId()).thenReturn(branchName);
  when(pullRequest.getId()).thenReturn(1L);

  Trigger trigger = new TriggerImpl(settingsServiceRegexEnabled, buildTriggerer);

  trigger.onDemandTrigger(event);

  verify(buildTriggerer).invoke(1L, settingsRegexEnabled, immutableBranchSettings);
}
 
开发者ID:RichRelevance,项目名称:StashPRTriggerPlugin,代码行数:24,代码来源:TriggerImplTest.java


示例18: onDemandTriggersOnlyMatchingBranchesWithMatchingMessagesTest

import com.atlassian.stash.repository.Repository; //导入依赖的package包/类
@Test
public void onDemandTriggersOnlyMatchingBranchesWithMatchingMessagesTest() {
  PullRequestCommentAddedEvent event = mock(PullRequestCommentAddedEvent.class);
  Comment comment = mock(Comment.class);
  PullRequest pullRequest = mock(PullRequest.class);
  PullRequestRef ref = mock(PullRequestRef.class);
  Repository repository = mock(Repository.class);
  BuildTriggerer buildTriggerer = mock(BuildTriggerer.class);

  when(event.getComment()).thenReturn(comment);
  when(comment.getText()).thenReturn(alternateMsg);

  when(event.getPullRequest()).thenReturn(pullRequest);
  when(pullRequest.getToRef()).thenReturn(ref);
  when(ref.getRepository()).thenReturn(repository);
  when(ref.getId()).thenReturn(branchName);
  when(pullRequest.getId()).thenReturn(1L);

  Trigger trigger = new TriggerImpl(settingsServiceEnabledMultiBranch, buildTriggerer);

  trigger.onDemandTrigger(event);

  InOrder inOrder = inOrder(buildTriggerer);
  inOrder.verify(buildTriggerer).invoke(1L, settingsEnabled, alternateBranchSettings);
  inOrder.verifyNoMoreInteractions();
}
 
开发者ID:RichRelevance,项目名称:StashPRTriggerPlugin,代码行数:27,代码来源:TriggerImplTest.java


示例19: onDemandDoesNotTriggerBuildsIfMessageDoesNotMatchSettingsTest

import com.atlassian.stash.repository.Repository; //导入依赖的package包/类
@Test
public void onDemandDoesNotTriggerBuildsIfMessageDoesNotMatchSettingsTest() {
  PullRequestCommentAddedEvent event = mock(PullRequestCommentAddedEvent.class);
  Comment comment = mock(Comment.class);
  PullRequest pullRequest = mock(PullRequest.class);
  PullRequestRef ref = mock(PullRequestRef.class);
  Repository repository = mock(Repository.class);
  BuildTriggerer buildTriggerer = mock(BuildTriggerer.class);

  when(event.getComment()).thenReturn(comment);
  when(comment.getText()).thenReturn("Do Not Retest");
  when(event.getPullRequest()).thenReturn(pullRequest);
  when(pullRequest.getToRef()).thenReturn(ref);
  when(ref.getRepository()).thenReturn(repository);
  when(ref.getId()).thenReturn(branchName);
  when(pullRequest.getId()).thenReturn(1L);

  Trigger trigger = new TriggerImpl(settingsServiceEnabled, buildTriggerer);

  trigger.onDemandTrigger(event);

  verify(buildTriggerer, never()).invoke(anyLong(), any(PullRequestTriggerSettings.class), any(BranchSettings.class));
}
 
开发者ID:RichRelevance,项目名称:StashPRTriggerPlugin,代码行数:24,代码来源:TriggerImplTest.java


示例20: onDemandDoesNotTriggerBuildsIfMessageIsEmptyTest

import com.atlassian.stash.repository.Repository; //导入依赖的package包/类
@Test
public void onDemandDoesNotTriggerBuildsIfMessageIsEmptyTest() {
  PullRequestCommentAddedEvent event = mock(PullRequestCommentAddedEvent.class);
  Comment comment = mock(Comment.class);
  PullRequest pullRequest = mock(PullRequest.class);
  PullRequestRef ref = mock(PullRequestRef.class);
  Repository repository = mock(Repository.class);
  BuildTriggerer buildTriggerer = mock(BuildTriggerer.class);

  when(event.getComment()).thenReturn(comment);
  when(comment.getText()).thenReturn(retestMsg);
  when(event.getPullRequest()).thenReturn(pullRequest);
  when(pullRequest.getToRef()).thenReturn(ref);
  when(ref.getRepository()).thenReturn(repository);
  when(ref.getId()).thenReturn(branchName);
  when(pullRequest.getId()).thenReturn(1L);

  Trigger trigger = new TriggerImpl(settingsServiceEmptyMsg, buildTriggerer);

  trigger.onDemandTrigger(event);

  verify(buildTriggerer, never()).invoke(anyLong(), any(PullRequestTriggerSettings.class), any(BranchSettings.class));
}
 
开发者ID:RichRelevance,项目名称:StashPRTriggerPlugin,代码行数:24,代码来源:TriggerImplTest.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Sound类代码示例发布时间:2022-05-23
下一篇:
Java HeaderCard类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap