Skip to content
Permalink
Browse files

As of JENKINS-32396, JENKINS-32670 is irrelevant since we *do* have a…

… legitimate BranchProperty.
  • Loading branch information...
jglick committed May 25, 2016
1 parent 18077ec commit 4e5b39efc03ff86836aa09f09a444fabc8c523d4
@@ -34,15 +34,20 @@
import hudson.scm.SCM;
import hudson.scm.SCMDescriptor;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import javax.annotation.Nonnull;
import jenkins.branch.BranchProperty;
import jenkins.branch.BranchPropertyDescriptor;
import jenkins.branch.BranchPropertyStrategy;
import jenkins.branch.BranchPropertyStrategyDescriptor;
import jenkins.branch.BranchSource;
import jenkins.branch.DefaultBranchPropertyStrategy;
import jenkins.branch.NamedExceptionsBranchPropertyStrategy;
import jenkins.branch.NoTriggerBranchProperty;
import jenkins.plugins.git.GitSCMSource;
import jenkins.scm.api.SCMHead;
import jenkins.scm.api.SCMSource;
@@ -127,19 +132,21 @@ static void showIndexing(@Nonnull WorkflowMultiBranchProject mp) throws Exceptio
System.out.println("---%<--- ");
}

@Issue("JENKINS-32670")
@Issue({"JENKINS-32396", "JENKINS-32670"})
@Test public void visibleBranchProperties() throws Exception {
WorkflowMultiBranchProject p = r.jenkins.createProject(WorkflowMultiBranchProject.class, "p");
Set<Class<? extends BranchProperty>> clazzes = new HashSet<Class<? extends BranchProperty>>();
Set<Class<? extends BranchProperty>> propertyTypes = new HashSet<>();
for (BranchPropertyDescriptor d : DescriptorVisibilityFilter.apply(p, BranchPropertyDescriptor.all())) {
clazzes.add(d.clazz);
propertyTypes.add(d.clazz);
}
// RateLimitBranchProperty & BuildRetentionBranchProperty hidden by JobPropertyStep.HideSuperfluousBranchProperties.
// UntrustedBranchProperty hidden because it applies only to Project.
assertEquals(Collections.<Class<? extends BranchProperty>>emptySet(), clazzes);
/* TODO uncomment when branch-api 1.5+:
assertEquals(Collections.<BranchPropertyStrategyDescriptor>emptyList(), r.jenkins.getDescriptorByType(BranchSource.DescriptorImpl.class).propertyStrategyDescriptors(p, r.jenkins.getDescriptorByType(SingleSCMSource.DescriptorImpl.class)));
*/
assertEquals(Collections.singleton(NoTriggerBranchProperty.class), propertyTypes);
Set<Class<? extends BranchPropertyStrategy>> strategyTypes = new HashSet<>();
for (BranchPropertyStrategyDescriptor d : r.jenkins.getDescriptorByType(BranchSource.DescriptorImpl.class).propertyStrategyDescriptors(p, r.jenkins.getDescriptorByType(SingleSCMSource.DescriptorImpl.class))) {
strategyTypes.add(d.clazz);
}
assertEquals(new HashSet<>(Arrays.asList(DefaultBranchPropertyStrategy.class, NamedExceptionsBranchPropertyStrategy.class)), strategyTypes);
}

@SuppressWarnings("rawtypes")

0 comments on commit 4e5b39e

Please sign in to comment.
You can’t perform that action at this time.