jenkins.scm.api.SCMSourceObserver Java Examples
The following examples show how to use
jenkins.scm.api.SCMSourceObserver.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GitHubSCMNavigatorTest.java From github-branch-source-plugin with MIT License | 5 votes |
@Test public void fetchOneRepo_BelongingToAuthenticatedUser() throws Exception { setCredentials(Collections.singletonList(credentials)); navigator = navigatorForRepoOwner("stephenc", credentials.getId()); final Set<String> projectNames = new HashSet<>(); final SCMSourceObserver observer = getObserver(projectNames); navigator.visitSources(SCMSourceObserver.filter(observer, "yolo-archived")); assertThat(projectNames, containsInAnyOrder("yolo-archived")); }
Example #2
Source File: GitHubSCMNavigatorTest.java From github-branch-source-plugin with MIT License | 5 votes |
private SCMSourceObserver getObserver(Collection<String> names){ return new SCMSourceObserver() { @NonNull @Override public SCMSourceOwner getContext() { return scmSourceOwner; } @NonNull @Override public TaskListener getListener() { return new LogTaskListener(Logger.getAnonymousLogger(), Level.INFO); } @NonNull @Override public ProjectObserver observe(@NonNull String projectName) throws IllegalArgumentException { names.add(projectName); return new NoOpProjectObserver(); } @Override public void addAttribute(@NonNull String key, @Nullable Object value) throws IllegalArgumentException, ClassCastException { } }; }
Example #3
Source File: GitHubSCMNavigatorTest.java From github-branch-source-plugin with MIT License | 5 votes |
@Test public void appliesFilters() throws Exception { final Set<String> projectNames = new HashSet<>(); final SCMSourceObserver observer = getObserver(projectNames); navigator.visitSources(SCMSourceObserver.filter(observer, "Hello-World", "other-repo")); assertEquals(projectNames, Collections.singleton("Hello-World")); }
Example #4
Source File: GitHubSCMNavigatorTest.java From github-branch-source-plugin with MIT License | 5 votes |
@Test public void fetchRepos_BelongingToUser_ExcludingArchived() throws Exception { navigator = navigatorForRepoOwner("stephenc", null); navigator.setTraits(Collections.singletonList(new ExcludeArchivedRepositoriesTrait())); final Set<String> projectNames = new HashSet<>(); final SCMSourceObserver observer = getObserver(projectNames); navigator.visitSources(observer); assertThat(projectNames, containsInAnyOrder("yolo")); }
Example #5
Source File: GitHubSCMNavigatorTest.java From github-branch-source-plugin with MIT License | 5 votes |
@Test public void fetchRepos_BelongingToUser() throws Exception { navigator = navigatorForRepoOwner("stephenc", null); final Set<String> projectNames = new HashSet<>(); final SCMSourceObserver observer = getObserver(projectNames); navigator.visitSources(observer); assertThat(projectNames, containsInAnyOrder("yolo", "yolo-archived")); }
Example #6
Source File: GitHubSCMNavigatorTest.java From github-branch-source-plugin with MIT License | 5 votes |
@Test public void fetchRepos_BelongingToOrg_ExcludingArchived() throws Exception { navigator.setTraits(Collections.singletonList(new ExcludeArchivedRepositoriesTrait())); final Set<String> projectNames = new HashSet<>(); final SCMSourceObserver observer = getObserver(projectNames); navigator.visitSources( SCMSourceObserver.filter(observer, "Hello-World", "github-branch-source-plugin", "yolo-archived")); assertThat(projectNames, containsInAnyOrder("Hello-World", "github-branch-source-plugin")); }
Example #7
Source File: GitHubSCMNavigatorTest.java From github-branch-source-plugin with MIT License | 5 votes |
@Test public void fetchRepos_BelongingToOrg() throws Exception { final Set<String> projectNames = new HashSet<>(); final SCMSourceObserver observer = getObserver(projectNames); navigator.visitSources( SCMSourceObserver.filter(observer, "Hello-World", "github-branch-source-plugin", "yolo-archived")); assertThat(projectNames, containsInAnyOrder("Hello-World", "github-branch-source-plugin", "yolo-archived")); }
Example #8
Source File: GitHubSCMNavigatorTest.java From github-branch-source-plugin with MIT License | 5 votes |
@Test public void fetchRepos_BelongingToAuthenticatedUser_ExcludingArchived() throws Exception { setCredentials(Collections.singletonList(credentials)); navigator = navigatorForRepoOwner("stephenc", credentials.getId()); navigator.setTraits(Collections.singletonList(new ExcludeArchivedRepositoriesTrait())); final Set<String> projectNames = new HashSet<>(); final SCMSourceObserver observer = getObserver(projectNames); navigator.visitSources(observer); assertThat(projectNames, containsInAnyOrder("yolo")); }
Example #9
Source File: GitHubSCMNavigatorTest.java From github-branch-source-plugin with MIT License | 5 votes |
@Test public void fetchRepos_BelongingToAuthenticatedUser() throws Exception { setCredentials(Collections.singletonList(credentials)); navigator = navigatorForRepoOwner("stephenc", credentials.getId()); final Set<String> projectNames = new HashSet<>(); final SCMSourceObserver observer = getObserver(projectNames); navigator.visitSources(observer); assertThat(projectNames, containsInAnyOrder("yolo", "yolo-archived")); }
Example #10
Source File: GitHubSCMNavigatorTest.java From github-branch-source-plugin with MIT License | 5 votes |
@Test public void fetchOneRepo_BelongingToUser_ExcludingArchived() throws Exception { navigator = navigatorForRepoOwner("stephenc", null); navigator.setTraits(Collections.singletonList(new ExcludeArchivedRepositoriesTrait())); final Set<String> projectNames = new HashSet<>(); final SCMSourceObserver observer = getObserver(projectNames); navigator.visitSources(SCMSourceObserver.filter(observer, "yolo-archived")); assertThat(projectNames, empty()); }
Example #11
Source File: GitHubSCMNavigatorTest.java From github-branch-source-plugin with MIT License | 5 votes |
@Test public void fetchOneRepo_BelongingToUser() throws Exception { navigator = navigatorForRepoOwner("stephenc", null); final Set<String> projectNames = new HashSet<>(); final SCMSourceObserver observer = getObserver(projectNames); navigator.visitSources(SCMSourceObserver.filter(observer, "yolo-archived")); assertThat(projectNames, containsInAnyOrder("yolo-archived")); }
Example #12
Source File: GitHubSCMNavigatorTest.java From github-branch-source-plugin with MIT License | 5 votes |
@Test public void fetchOneRepo_BelongingToOrg_ExcludingArchived() throws Exception { navigator.setTraits(Collections.singletonList(new ExcludeArchivedRepositoriesTrait())); final Set<String> projectNames = new HashSet<>(); final SCMSourceObserver observer = getObserver(projectNames); navigator.visitSources(SCMSourceObserver.filter(observer, "yolo-archived")); assertThat(projectNames, empty()); }
Example #13
Source File: GitHubSCMNavigatorTest.java From github-branch-source-plugin with MIT License | 5 votes |
@Test public void fetchOneRepo_BelongingToOrg() throws Exception { final Set<String> projectNames = new HashSet<>(); final SCMSourceObserver observer = getObserver(projectNames); navigator.visitSources(SCMSourceObserver.filter(observer, "yolo-archived")); assertThat(projectNames, containsInAnyOrder("yolo-archived")); }
Example #14
Source File: GitHubSCMNavigatorTest.java From github-branch-source-plugin with MIT License | 5 votes |
@Test public void fetchOneRepo_BelongingToAuthenticatedUser_ExcludingArchived() throws Exception { setCredentials(Collections.singletonList(credentials)); navigator = navigatorForRepoOwner("stephenc", credentials.getId()); navigator.setTraits(Collections.singletonList(new ExcludeArchivedRepositoriesTrait())); final Set<String> projectNames = new HashSet<>(); final SCMSourceObserver observer = getObserver(projectNames); navigator.visitSources(SCMSourceObserver.filter(observer, "yolo-archived")); assertThat(projectNames, empty()); }
Example #15
Source File: GitLabSCMNavigatorRequest.java From gitlab-branch-source-plugin with MIT License | 5 votes |
protected GitLabSCMNavigatorRequest(@NonNull SCMNavigator source, @NonNull GitLabSCMNavigatorContext context, @NonNull SCMSourceObserver observer) { super(source, context, observer); wantSubgroupProjects = context.wantSubgroupProjects(); projectNamingStrategy = context.withProjectNamingStrategy(); }
Example #16
Source File: GitHubSCMNavigatorTest.java From github-branch-source-plugin with MIT License | 5 votes |
@Test public void fetchReposFromTeamSlug() throws Exception { final Set<String> projectNames = new HashSet<>(); final SCMSourceObserver observer = getObserver(projectNames); List<SCMTrait<? extends SCMTrait<?>>> traits = new ArrayList<>(navigator.getTraits()); traits.add(new TeamSlugTrait("justice-league")); navigator.setTraits(traits); navigator.visitSources(SCMSourceObserver.filter(observer, "Hello-World", "github-branch-source-plugin")); assertThat(projectNames, containsInAnyOrder("Hello-World", "github-branch-source-plugin")); }
Example #17
Source File: GitHubSCMNavigatorTest.java From github-branch-source-plugin with MIT License | 5 votes |
@Test public void fetchSmokes() throws Exception { final Set<String> projectNames = new HashSet<>(); final SCMSourceObserver observer = getObserver(projectNames); navigator.visitSources(SCMSourceObserver.filter(observer, "yolo")); assertThat(projectNames, contains("yolo")); }
Example #18
Source File: SourceVisitor.java From gitlab-branch-source-plugin with GNU General Public License v2.0 | 5 votes |
private void visitProject(GitLabProject project) throws IOException, InterruptedException { if (!observer.isObserving()) { return; } checkInterrupt(); log(Messages.GitLabSCMNavigator_visitProject(project.getPathWithNamespace())); SCMSourceObserver.ProjectObserver projectObserver = observer.observe(project.getPathWithNamespace()); GitLabSCMSource source = new GitLabSCMSource(project, navigator.getSourceSettings()); projectObserver.addSource(source); projectObserver.complete(); source.afterSave(); }
Example #19
Source File: GitHubSCMNavigatorContext.java From github-branch-source-plugin with MIT License | 4 votes |
/** * {@inheritDoc} */ @NonNull @Override public GitHubSCMNavigatorRequest newRequest(@NonNull SCMNavigator navigator, @NonNull SCMSourceObserver observer) { return new GitHubSCMNavigatorRequest(navigator, this, observer); }
Example #20
Source File: SourceVisitor.java From gitlab-branch-source-plugin with GNU General Public License v2.0 | 4 votes |
SourceVisitor(GitLabSCMNavigator navigator, SCMSourceObserver observer) { this.navigator = navigator; this.observer = observer; this.log = observer.getListener().getLogger(); }
Example #21
Source File: GitLabSCMNavigator.java From gitlab-branch-source-plugin with GNU General Public License v2.0 | 4 votes |
private SourceVisitor createVisitor(@Nonnull SCMSourceObserver observer) { return new SourceVisitor(this, observer); }
Example #22
Source File: GitLabSCMNavigator.java From gitlab-branch-source-plugin with GNU General Public License v2.0 | 4 votes |
@Override public void visitSource(@Nonnull String sourceName, @Nonnull SCMSourceObserver observer) throws IOException, InterruptedException { LOGGER.info("visiting " + sourceName + " for context " + observer.getContext().getFullName()); createVisitor(observer).visitProject(sourceName); }
Example #23
Source File: GitLabSCMNavigator.java From gitlab-branch-source-plugin with GNU General Public License v2.0 | 4 votes |
@Override public void visitSources(@Nonnull SCMSourceObserver observer) throws IOException, InterruptedException { LOGGER.info("visiting sources for context " + observer.getContext().getFullName() + "..."); createVisitor(observer).visitSources(); }
Example #24
Source File: GiteaSCMNavigatorContext.java From gitea-plugin with MIT License | 4 votes |
@NonNull @Override public GiteaSCMNavigatorRequest newRequest(@NonNull SCMNavigator navigator, @NonNull SCMSourceObserver observer) { return new GiteaSCMNavigatorRequest(navigator, this, observer); }
Example #25
Source File: GiteaSCMNavigatorRequest.java From gitea-plugin with MIT License | 4 votes |
protected GiteaSCMNavigatorRequest(@NonNull SCMNavigator source, @NonNull GiteaSCMNavigatorContext context, @NonNull SCMSourceObserver observer) { super(source, context, observer); }
Example #26
Source File: GitLabSCMNavigatorContext.java From gitlab-branch-source-plugin with MIT License | 4 votes |
@NonNull @Override public GitLabSCMNavigatorRequest newRequest(@NonNull SCMNavigator navigator, @NonNull SCMSourceObserver observer) { return new GitLabSCMNavigatorRequest(navigator, this, observer); }
Example #27
Source File: GitHubSCMNavigatorRequest.java From github-branch-source-plugin with MIT License | 2 votes |
/** * Constructor. * * @param source the source. * @param context the context. * @param observer the observer. */ protected GitHubSCMNavigatorRequest(@NonNull SCMNavigator source, @NonNull GitHubSCMNavigatorContext context, @NonNull SCMSourceObserver observer) { super(source, context, observer); }