Java Code Examples for hudson.tasks.Publisher

The following are top voted examples for showing how to use hudson.tasks.Publisher. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: jenkinslint-plugin   File: ArtifactChecker.java   View source code 6 votes vote down vote up
public boolean executeCheck(Item item) {
    LOG.log(Level.FINE, "executeCheck " + item);

    if (item instanceof Project) {
        Project project = (Project) item;
        DescribableList<Publisher, Descriptor<Publisher>> publishersList = project.getPublishersList();
        for (Publisher publisher : publishersList) {
            if (publisher instanceof ArtifactArchiver) {
                LOG.log(Level.FINEST, "ArtifactChecker " + publisher);
                return (((ArtifactArchiver) publisher).getArtifacts() == null ||
                        (((ArtifactArchiver) publisher).getArtifacts() != null &&
                                ((ArtifactArchiver) publisher).getArtifacts().length() == 0));
            }
        }
    }
    return false;
}
 
Example 2
Project: yaml-project-plugin   File: AbstractRunnableItemGroup.java   View source code 6 votes vote down vote up
/** {@inheritDoc} */
@Override
public DescribableList<Publisher, Descriptor<Publisher>> getPublishersList() {
  // TODO(mattmoor): switch to utilize something with an atomic
  // compare/exchange semantic.
  if (publishers != null) {
    return publishers;
  }

  // NOTE: I believe this is lazily initialized vs. created in the
  // constructor so that lazy API consumers can omit an empty publisher list
  // from their serialized XML blob.
  synchronized (this) {
    if (publishers == null) {
      publishers =
          new DescribableList<Publisher, Descriptor<Publisher>>(this);
    }
  }

  return publishers;
}
 
Example 3
Project: jenkins-inheritance-plugin   File: InheritanceProject.java   View source code 6 votes vote down vote up
public DescribableList<Publisher,Descriptor<Publisher>> getPublishersList(
		IMode mode) {
	InheritanceGovernor<DescribableList<Publisher, Descriptor<Publisher>>> gov =
			new InheritanceGovernor<DescribableList<Publisher, Descriptor<Publisher>>>(
					"publishersList", SELECTOR.PUBLISHER, this) {
		@Override
		protected DescribableList<Publisher, Descriptor<Publisher>> castToDestinationType(Object o) {
			return castToDescribableList(o);
		}
		
		@Override
		public DescribableList<Publisher, Descriptor<Publisher>> getRawField(
				InheritanceProject ip) {
			return ip.getRawPublishersList();
		}
		
		@Override
		protected DescribableList<Publisher, Descriptor<Publisher>> reduceFromFullInheritance(
				Deque<DescribableList<Publisher, Descriptor<Publisher>>> list) {
			return InheritanceGovernor.reduceDescribableByMerge(list);
		}
	};
	
	return gov.retrieveFullyDerivedField(this, mode);
}
 
Example 4
Project: delivery-pipeline-plugin   File: BPPManualTriggerResolver.java   View source code 6 votes vote down vote up
public boolean isManualTrigger(AbstractProject<?, ?> project) {
    List<AbstractProject> upstreamProjects = project.getUpstreamProjects();
    for (AbstractProject upstreamProject : upstreamProjects) {
        DescribableList<Publisher, Descriptor<Publisher>> upstreamPublishersLists =
                upstreamProject.getPublishersList();
        for (Publisher upstreamPub : upstreamPublishersLists) {
            if (upstreamPub instanceof BuildPipelineTrigger) {
                String names = ((BuildPipelineTrigger) upstreamPub).getDownstreamProjectNames();
                if (ProjectUtil.getProjectList(names, project.getParent(), null).contains(project)) {
                    return true;
                }
            }
        }
    }
    return false;
}
 
Example 5
Project: delivery-pipeline-plugin   File: BPPManualTriggerResolver.java   View source code 6 votes vote down vote up
@Override
public List<AbstractProject> getUpstreamManualTriggered(AbstractProject<?, ?> project) {
    List<AbstractProject> result = new ArrayList<>();
    List<AbstractProject> upstreamProjects = project.getUpstreamProjects();
    for (AbstractProject upstream : upstreamProjects) {
        @SuppressWarnings("unchecked")
        DescribableList<Publisher, Descriptor<Publisher>> upstreamPublishersLists = upstream.getPublishersList();
        for (Publisher upstreamPub : upstreamPublishersLists) {
            if (upstreamPub instanceof BuildPipelineTrigger) {
                String names = ((BuildPipelineTrigger) upstreamPub).getDownstreamProjectNames();
                if (ProjectUtil.getProjectList(names, project.getParent(), null).contains(project)) {
                    result.add(upstream);
                }
            }
        }
    }
    return result;
}
 
Example 6
Project: ibm-cloud-devops   File: EventHandler.java   View source code 5 votes vote down vote up
public static OTCNotifier findPublisher(AbstractBuild r){
    List<Publisher> publisherList = r.getProject().getPublishersList().toList();

    //ensure that there is an OTCNotifier in the project
    for(Publisher publisher: publisherList){
        if(publisher instanceof OTCNotifier){
            return (OTCNotifier) publisher;
        }
    }

    return null;
}
 
Example 7
Project: ibm-cloud-devops   File: EventHandlerTest.java   View source code 5 votes vote down vote up
@Test
public void testFindPublisher() {
    OTCNotifier otcNotifier = mock(OTCNotifier.class);
    AbstractBuild r = mock(AbstractBuild.class);
    AbstractProject project = mock(AbstractProject.class);
    DescribableList<Publisher, Descriptor<Publisher>> describableList = mock(DescribableList.class);
    ArrayList<Publisher> publisherList = new ArrayList<Publisher>();

    publisherList.add(otcNotifier);
    when(r.getProject()).thenReturn(project);
    when(project.getPublishersList()).thenReturn(describableList);
    when(describableList.toList()).thenReturn(publisherList);

    assertEquals(otcNotifier, EventHandler.findPublisher(r));
}
 
Example 8
Project: Jenkins-Plugin-Examples   File: CoreStep.java   View source code 5 votes vote down vote up
public Collection<? extends Descriptor<?>> getApplicableDescriptors() {
    // Jenkins.instance.getDescriptorList(SimpleBuildStep) is empty, presumably because that itself is not a Describable.
    List<Descriptor<?>> r = new ArrayList<>();
    populate(r, Builder.class);
    populate(r, Publisher.class);
    return r;
}
 
Example 9
Project: custom-notifier-plugin   File: JobListener.java   View source code 5 votes vote down vote up
private JdumpService getService(AbstractBuild builder, TaskListener listener) {

        Map<Descriptor<Publisher>, Publisher> map = builder.getProject().getPublishersList().toMap();
        for (Publisher publisher : map.values()) {
            if (publisher instanceof JdumpNotifier) {
                return ((JdumpNotifier) publisher).newJdumpService(builder, listener);
            }
        }
        return null;
    }
 
Example 10
Project: plot-plugin   File: PlotPipelineDescriptor.java   View source code 5 votes vote down vote up
/**
 * Called when the user saves the project configuration.
 */
@Override
public Publisher newInstance(StaplerRequest req, JSONObject formData)
        throws FormException {
    PlotPipelinePublisher publisher = new PlotPipelinePublisher(true);
    for (Object data : SeriesFactory.getArray(formData.get("plots"))) {
        publisher.addPlot(bindPlot((JSONObject) data, req));
    }
    return publisher;
}
 
Example 11
Project: aptly-plugin   File: AptlyPublisher.java   View source code 5 votes vote down vote up
/**
* This method is called by hudson if the user has clicked the add button of the Aptly site hosts point in the System Configuration
* web page. It's create a new instance of the {@link AptlyPublisher} class and added all configured ftp sites to this instance by calling
* the method {@link AptlyPublisher#getEntries()} and on it's return value the addAll method is called.
*
* {@inheritDoc}
*
* @param req
*          {@inheritDoc}
* @return {@inheritDoc}
* @see hudson.model.Descriptor#newInstance(org.kohsuke.stapler.StaplerRequest)
*/
@Override
public Publisher newInstance(StaplerRequest req, JSONObject formData) {
   AptlyPublisher pub = new AptlyPublisher();
   try {
        List<PackageItem> entries = req.bindJSONToList(PackageItem.class, formData.get("packageItems"));
        pub.getPackageItems().addAll(entries);
   } catch (Exception e) {
       LOG.severe(">> bindJSONToList Exception: " + e.getMessage());
       return null;
   }
   return pub;
}
 
Example 12
Project: jenkins-telegram-plugin   File: TelegramNotifier.java   View source code 5 votes vote down vote up
@Override
public boolean prebuild(AbstractBuild<?, ?> build, BuildListener listener) {
    if (startNotification) {
        Map<Descriptor<Publisher>, Publisher> map = build.getProject().getPublishersList().toMap();
        for (Publisher publisher : map.values()) {
            if (publisher instanceof TelegramNotifier) {
                logger.info("Invoking Started...");
                new ActiveNotifier((TelegramNotifier) publisher, listener).started(build);
            }
        }
    }
    return super.prebuild(build, listener);
}
 
Example 13
Project: jenkins-telegram-plugin   File: TelegramListener.java   View source code 5 votes vote down vote up
@SuppressWarnings("unchecked")
FineGrainedNotifier getNotifier(AbstractProject project, TaskListener listener) {
    Map<Descriptor<Publisher>, Publisher> map = project.getPublishersList().toMap();
    for (Publisher publisher : map.values()) {
        if (publisher instanceof TelegramNotifier) {
            return new ActiveNotifier((TelegramNotifier) publisher, (BuildListener)listener);
        }
    }
    return new DisabledNotifier();
}
 
Example 14
Project: jenkins-mattermost-plugin   File: MattermostNotifier.java   View source code 5 votes vote down vote up
@Override
public boolean prebuild(AbstractBuild<?, ?> build, BuildListener listener) {
	if (startNotification) {
		Map<Descriptor<Publisher>, Publisher> map = build.getProject().getPublishersList().toMap();
		for (Publisher publisher : map.values()) {
			if (publisher instanceof MattermostNotifier) {
				logger.info("Invoking Started...");
				new ActiveNotifier((MattermostNotifier)publisher, listener).started(build);
			}
		}
	}
	return super.prebuild(build, listener);
}
 
Example 15
Project: jenkins-mattermost-plugin   File: MattermostListener.java   View source code 5 votes vote down vote up
@SuppressWarnings("unchecked")
FineGrainedNotifier getNotifier(AbstractProject project, TaskListener listener) {
	Map<Descriptor<Publisher>, Publisher> map = project.getPublishersList().toMap();
	for (Publisher publisher : map.values()) {
		if (publisher instanceof MattermostNotifier) {
			return new ActiveNotifier((MattermostNotifier) publisher, (BuildListener)listener);
		}
	}
	return new DisabledNotifier();
}
 
Example 16
Project: jenkinslint-plugin   File: JavadocChecker.java   View source code 5 votes vote down vote up
public boolean executeCheck(Item item) {
    if (item instanceof Project) {
        DescribableList<Publisher, Descriptor<Publisher>> publishersList = ((Project) item).getPublishersList();
        for (Publisher publisher : publishersList) {
            if (publisher instanceof hudson.tasks.JavadocArchiver) {
                return ( ((JavadocArchiver) publisher).getJavadocDir() == null ||
                         ( ((JavadocArchiver) publisher).getJavadocDir() != null &&
                           ((JavadocArchiver) publisher).getJavadocDir().length() == 0 ));
            }
        }
    }
    return false;
}
 
Example 17
Project: sumologic-jenkins-plugin   File: SumoBuildNotifier.java   View source code 5 votes vote down vote up
@SuppressWarnings("unchecked")
public static SumoBuildNotifier getNotifier(AbstractProject project) {
  Map<Descriptor<Publisher>, Publisher> map = project.getPublishersList().toMap();
  for (Publisher publisher : map.values()) {
    if (publisher instanceof SumoBuildNotifier) {
      return (SumoBuildNotifier) publisher;
    }
  }
  return null;
}
 
Example 18
Project: github-integration-plugin   File: DslIntegrationTest.java   View source code 5 votes vote down vote up
private void verifyPublishers(DescribableList<Publisher, Descriptor<Publisher>> publishers) {
    assertThat("Should add publisher", publishers, hasSize(2));

    assertThat("Should add status publisher", publishers.get(0), instanceOf(GitHubPRBuildStatusPublisher.class));
    assertThat("Should add 2 packages",
            ((GitHubPRBuildStatusPublisher) publishers.get(0)).getStatusMsg().getContent(),
            equalTo(JOB_DSL_PUBLISHER_TEXT_CONTENT));

    assertThat("Has comment publisher", publishers.get(1), instanceOf(GitHubPRCommentPublisher.class));
    GitHubPRCommentPublisher commentPublisher = (GitHubPRCommentPublisher) publishers.get(1);

    assertThat("Comment matches", commentPublisher.getComment().getContent(), equalTo("comment"));
    assertThat("Only failed builds", commentPublisher.getStatusVerifier().getBuildStatus(), equalTo(Result.FAILURE));
    assertThat("Publish marked as failure", commentPublisher.getErrorHandler().getBuildStatus(), equalTo(Result.FAILURE));
}
 
Example 19
Project: grapes-jenkins-plugin   File: GrapesPlugin.java   View source code 5 votes vote down vote up
/**
 * Returns the Grapes Notifier instance of a project (null if there is none)
 *
 * @param project AbstractProject<?, ?>
 * @return GrapesNotifier
 */
public static GrapesNotifier getGrapesNotifier(final AbstractProject<?, ?> project){
    for(Publisher publisher : project.getPublishersList()){
        if(publisher instanceof GrapesNotifier){
           return (GrapesNotifier) publisher;
        }
    }

    return null;
}
 
Example 20
Project: yaml-project-plugin   File: YamlProjectFactory.java   View source code 5 votes vote down vote up
@DataBoundConstructor
public YamlProjectFactory(String yamlPath,
    AbstractRestriction restriction,
    @Nullable List<Publisher> publishers) {
  this.yamlPath = checkNotNull(yamlPath);
  this.restriction = checkNotNull(restriction);
  this.publishers = publishers;
}
 
Example 21
Project: yaml-project-plugin   File: YamlMultiBranchProject.java   View source code 5 votes vote down vote up
/** {@inheritDoc} */
@Override
protected BranchProjectFactory<YamlProject<T>, YamlBuild<T>>
    newProjectFactory() {
  return new YamlProjectFactory(YamlProject.DEFAULT_YAML,
      new NoRestriction(), ImmutableList.<Publisher>of());
}
 
Example 22
Project: yaml-project-plugin   File: AbstractRunnableItemGroup.java   View source code 5 votes vote down vote up
/** {@inheritDoc} */
@Override
protected void submit(StaplerRequest req, StaplerResponse rsp)
    throws IOException, ServletException, FormException {
  super.submit(req, rsp);

  final JSONObject json = req.getSubmittedForm();

  getBuildWrappersList().rebuild(req, json, BuildWrappers.getFor(this));
  getPublishersList().rebuildHetero(req, json, Publisher.all(), "publisher");
}
 
Example 23
Project: yaml-project-plugin   File: YamlProjectFactoryTest.java   View source code 5 votes vote down vote up
@Before
public void setUp() throws Exception {
  MockitoAnnotations.initMocks(this);

  underTest = new YamlProjectFactory(YAML_PATH, RESTRICTION,
      ImmutableList.<Publisher>of(new Mailer()));
}
 
Example 24
Project: jenkins   File: PushPublisher.java   View source code 5 votes vote down vote up
@Override
public Publisher newInstance(StaplerRequest req, JSONObject formData) throws FormException {
    try {
        JSONObject pushJSON = formData.getJSONObject("remoteImageStrategy");

        RemoteImageStrategy remoteImageStrategy = RemoteImageStrategy.DO_NOT_USE;
        String remoteImageName = null;
        String dateFormat = null;
        boolean appendDate = false;
        String organization = null;
        boolean overwriteOrganization = false;

        if (pushJSON != null && !pushJSON.isNullObject()) {
            String remoteImageStrategyName = pushJSON.getString("value");
            remoteImageStrategy = RemoteImageStrategy.valueOf(remoteImageStrategyName);
            organization = getKeyOrDefault(pushJSON, "organization");
            overwriteOrganization = getBoolOrDefault(pushJSON, "overwriteOrganization");
            remoteImageName = getKeyOrDefault(pushJSON, "remoteImageName");
            dateFormat = getKeyOrDefault(pushJSON, "dateFormat");
            appendDate = getBoolOrDefault(pushJSON, "appendDate");
        }

        return new PushPublisher(remoteImageStrategy, organization, overwriteOrganization, remoteImageName, dateFormat, appendDate);
    } catch (JSONException ex) {
        throw new IllegalStateException("Error while parsing data form", ex);
    }
}
 
Example 25
Project: jenkins-inheritance-plugin   File: InheritanceProject.java   View source code 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public DescribableList<Publisher,Descriptor<Publisher>> getPublishersList() {
	//Note: Between Jenkins 1.509 and 1.625, the "synchronized" requirement
	//was dropped from this method, removing a source of deadlocks.
	return this.getPublishersList(IMode.AUTO);
}
 
Example 26
Project: jenkins-inheritance-plugin   File: InheritanceProject.java   View source code 5 votes vote down vote up
public String getSVGDetail() {
	List<ParameterDefinition> pLst = this.getParameters(IMode.LOCAL_ONLY);
	if (pLst == null) {
		return "";
	}
	StringBuilder b = new StringBuilder();
	for (ParameterDefinition pd : pLst) {
		if (pd == null) { continue; }
		b.append(pd.getName());
		ParameterValue pv = pd.getDefaultParameterValue();
		if (pv != null && pv instanceof StringParameterValue) {
			b.append(": ");
			b.append(((StringParameterValue)pv).value);
		}
		b.append('\n');
	}
	
	if (b.length() > 0) {
		b.append("\r\n");
	}
	
	List<Builder> builders = this.getBuilders();
	String str = (builders == null || builders.size() != 1) ? "steps" : "step";
	int num = (builders == null) ? 0 : builders.size();
	b.append(String.format(
			"%d build %s\n", num, str
	));
	
	DescribableList<Publisher, Descriptor<Publisher>> pubs = this.getPublishersList();
	str = (pubs == null || pubs.size() != 1) ? "publishers" : "publisher";
	num = (pubs == null) ? 0 : pubs.size();
	b.append(String.format(
			"%d %s", num, str
	));
	
	
	
	return b.toString();
}
 
Example 27
Project: xldeploy-plugin   File: RepositoryUtilsTest.java   View source code 5 votes vote down vote up
@Test
public void shouldRetrieveOverridingCredentialFromProject() throws Exception {
    Folder f = r.jenkins.createProject(Folder.class, "folder1");
    UsernamePasswordCredentialsImpl credentials =
            new UsernamePasswordCredentialsImpl(CredentialsScope.GLOBAL, ID, DESCRIPTION, USERNAME,
                    PASSWORD);
    getFolderStore(f).addCredentials(Domain.global(), credentials);

    // Matches what's sent from ui
    Credential overridingCredentialProvided = new Credential(null, "", null, credentials.getId(), null, true);
    DeployitNotifier.DeployitDescriptor descriptor = new DeployitNotifier.DeployitDescriptor();

    DeployitNotifier notifierSpy = spy(new DeployitNotifier("AdminGlobal1", "app1", null, null, null, null, false, null, overridingCredentialProvided));
    doReturn(descriptor).when(notifierSpy).getDescriptor();
    doReturn(overridingCredentialProvided).when(notifierSpy).getOverridingCredential();

    FreeStyleProject freeStyleProjectSpy = spy(new FreeStyleProject(f, "folder1/proj1"));
    freeStyleProjectSpy.addPublisher(notifierSpy);

    DescribableList<Publisher, Descriptor<Publisher>> publisherListMock = mock(DescribableList.class);
    doReturn(notifierSpy).when(publisherListMock).get(any(DeployitNotifier.DeployitDescriptor.class));
    doReturn(publisherListMock).when(freeStyleProjectSpy).getPublishersList();

    Credential overridingCredential = RepositoryUtils.retrieveOverridingCredentialFromProject(freeStyleProjectSpy);
    assertEquals(USERNAME, overridingCredential.getUsername());
    assertEquals(PASSWORD, overridingCredential.getPassword().getPlainText());
}
 
Example 28
Project: jenkins-wordpress-plugin   File: DescriptorImpl.java   View source code 5 votes vote down vote up
@Override
public Publisher newInstance(StaplerRequest req, JSONObject json) throws FormException {
    String endpointUrl = json.optString("endpointUrl");
    if (endpointUrl == null || endpointUrl.isEmpty()) {
        endpointUrl = this.endpointUrl;
    }
    String username = json.optString("username");
    if (username == null || username.isEmpty()) {
        username = this.username;
    }
    String password = json.optString("password");
    if (password == null || password.isEmpty()) {
        password = this.password;
    }
    String category = json.getString("category");
    if (category == null || category.isEmpty()) {
        category = this.category;
    }
    String tags = json.getString("tags");
    if (tags == null || tags.isEmpty()) {
        tags = this.tags;
    }
    boolean smartNotify = json.getBoolean("smartNotify");

    try {

        return new WordpressNotifier(endpointUrl, username, password, category, tags, smartNotify);

    } catch (Exception e) {
        String message = "Failed to initialize WordPress Notifier - check your WordPress Notifier configuration settings: " + e.getMessage();
        LOGGER.log(Level.WARNING, message, e);
        throw new FormException(message, e, "");
    }
}
 
Example 29
Project: plot-plugin   File: PlotPipelinePublisher.java   View source code 4 votes vote down vote up
/**
 * Called by Jenkins.
 */
@Override
public BuildStepDescriptor<Publisher> getDescriptor() {
    return DESCRIPTOR;
}
 
Example 30
Project: jenkins-deployment-manager-plugin   File: CloudDeploymentDeleter.java   View source code 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public boolean isApplicable(Descriptor descriptor) {
  // Only allow this within the context of publishers
  return Publisher.class.isAssignableFrom(descriptor.clazz);
}
 
Example 31
Project: influxdb-plugin   File: InfluxDbPublisher.java   View source code 4 votes vote down vote up
@Override
public BuildStepDescriptor<Publisher> getDescriptor() {
    return DESCRIPTOR;
}
 
Example 32
Project: influxdb-plugin   File: DescriptorImpl.java   View source code 4 votes vote down vote up
@Override
public Publisher newInstance(@CheckForNull StaplerRequest req, @Nonnull JSONObject formData) {
    InfluxDbPublisher publisher = new InfluxDbPublisher();
    req.bindParameters(publisher, "publisherBinding.");
    return publisher;
}
 
Example 33
Project: zee-jenkins   File: ZeeDescriptor.java   View source code 4 votes vote down vote up
@Override
public Publisher newInstance(StaplerRequest req, JSONObject formData)
		throws FormException {
	return super.newInstance(req, formData);
}
 
Example 34
Project: zfj-jenkins   File: ZfjDescriptor.java   View source code 4 votes vote down vote up
@Override
public Publisher newInstance(StaplerRequest req, JSONObject formData)
		throws FormException {
	return super.newInstance(req, formData);
}
 
Example 35
Project: plugin-stats-plugin   File: PluginStatsAction.java   View source code 4 votes vote down vote up
private void queryProject(Project job, Hashtable<String, InstalledPlugin> installedPluginSet) {
    if (job != null) {
       // Query Builders
        if (job.getBuilders() != null && job.getBuilders().size() > 0) {
            for (int i = 0; i < job.getBuilders().size(); i++) {
                LOG.log(Level.FINE, "getBuilders " + addJob(job.getName(), job.getShortUrl(), job.getBuilders().get(i).getClass(), installedPluginSet));
            }
        } else {
            LOG.log(Level.FINE, "getBuilders is empty");
        }

        if (job.getBuildWrappersList() != null && job.getBuildWrappersList().size() > 0) {
            DescribableList<BuildWrapper, Descriptor<BuildWrapper>> wrappersList = job.getBuildWrappersList();
            Iterator<BuildWrapper> buildWrapperIterator = wrappersList.iterator();
            while (buildWrapperIterator.hasNext()) {
                BuildWrapper buildWrapper = buildWrapperIterator.next();
                LOG.log(Level.FINE, "getBuildWrappers " + addJob(job.getName(), job.getShortUrl(), buildWrapper.getClass(), installedPluginSet));
            }

        } else {
            LOG.log(Level.FINE, "getBuildWrappers is empty");
        }

        if (job.getPublishersList() != null && job.getPublishersList().size() > 0) {
            DescribableList<Publisher, Descriptor<Publisher>> publisherList = job.getPublishersList();
            Iterator<Publisher> publisherIterator = publisherList.iterator();
            while (publisherIterator.hasNext()) {
                Publisher publisher = publisherIterator.next();
                LOG.log(Level.FINE, "getPublishersList " + addJob(job.getName(), job.getShortUrl(), publisher.getClass(), installedPluginSet));
            }
        } else {
            LOG.log(Level.FINE, "getPublishersList is empty");
        }

        if (job.getScm() != null) {
            LOG.log(Level.FINE, "getScm " + addJob(job.getName(), job.getShortUrl(), job.getScm().getClass(), installedPluginSet));
        } else {
            LOG.log(Level.FINE, "getScm is empty");
        }

        if (job.getTriggers() != null && job.getTriggers().size() > 0) {
            Iterator<Trigger> triggerIterator =  job.getTriggers().values().iterator();
            while (triggerIterator.hasNext()) {
                Trigger trigger = triggerIterator.next();
                LOG.log(Level.FINE, "getTriggers " + addJob(job.getName(), job.getShortUrl(), trigger.getClass(), installedPluginSet));
            }
        } else {
            LOG.log(Level.FINE, "getTriggers is empty");
        }

        if (job.getProperties() !=null && job.getProperties().size() > 0){
            Map<JobPropertyDescriptor,JobProperty> properties = job.getProperties();
            for (Map.Entry<JobPropertyDescriptor,JobProperty> entry : properties.entrySet()) {
                LOG.log(Level.FINE, "getProperties " + addJob(job.getName(), job.getShortUrl(), entry.getKey().getClass(), installedPluginSet));
            }
        }else {
            LOG.log(Level.FINE, "getProperties is empty");
        }

        if (job.getAllActions() != null && job.getAllActions().size() > 0) {
            for (Action action : job.getAllActions()) {
                LOG.log(Level.FINE, "getAllActions " + addJob(job.getName(), job.getShortUrl(), action.getClass(), installedPluginSet));
            }
        } else {
            LOG.log(Level.FINE, "getAllActions is empty");
        }

    } else {
        LOG.log(Level.FINE, "PROJECT is null");
    }
}
 
Example 36
Project: plugin-stats-plugin   File: PluginStatsAction.java   View source code 4 votes vote down vote up
private void queryMatrixProject(MatrixProject job, Hashtable<String, InstalledPlugin> installedPluginSet) {
    if (job != null) {
        if (job.getBuilders() != null && job.getBuilders().size() > 0) {
            for (int i = 0; i < job.getBuilders().size(); i++) {
                LOG.log(Level.FINE, "getBuilders " + addJob(job.getName(), job.getShortUrl(), job.getBuilders().get(i).getClass(), installedPluginSet));
            }
        } else {
            LOG.log(Level.FINE, "getBuilders is empty");
        }

        if (job.getBuildWrappersList() != null && job.getBuildWrappersList().size() > 0) {
            DescribableList<BuildWrapper, Descriptor<BuildWrapper>> wrappersList = job.getBuildWrappersList();
            Iterator<BuildWrapper> buildWrapperIterator = wrappersList.iterator();
            while (buildWrapperIterator.hasNext()) {
                BuildWrapper buildWrapper = buildWrapperIterator.next();
                LOG.log(Level.FINE, "getBuildWrappers " + addJob(job.getName(), job.getShortUrl(), buildWrapper.getClass(), installedPluginSet));
            }

        } else {
            LOG.log(Level.FINE, "getBuildWrappers is empty");
        }

        if (job.getPublishersList() != null && job.getPublishersList().size() > 0) {
            DescribableList<Publisher, Descriptor<Publisher>> publisherList = job.getPublishersList();
            Iterator<Publisher> publisherIterator = publisherList.iterator();
            while (publisherIterator.hasNext()) {
                Publisher publisher = publisherIterator.next();
                LOG.log(Level.FINE, "getPublishersList " + addJob(job.getName(), job.getShortUrl(), publisher.getClass(), installedPluginSet));
            }
        } else {
            LOG.log(Level.FINE, "getPublishersList is empty");
        }

        if (job.getScm() != null) {
            LOG.log(Level.FINE, "getScm " + addJob(job.getName(), job.getShortUrl(), job.getScm().getClass(), installedPluginSet));
        } else {
            LOG.log(Level.FINE, "getScm is empty");
        }

        if (job.getTriggers() != null && job.getTriggers().size() > 0) {
            Iterator<Trigger<?>> triggerIterator =  job.getTriggers().values().iterator();
            while (triggerIterator.hasNext()) {
                Trigger trigger = triggerIterator.next();
                LOG.log(Level.FINE, "getTriggers " + addJob(job.getName(), job.getShortUrl(), trigger.getClass(), installedPluginSet));
            }
        } else {
            LOG.log(Level.FINE, "getTriggers is empty");
        }

        // TODO: Query Properties
        if (job.getProperties() !=null && job.getProperties().size() > 0){
            LOG.log(Level.FINE, "getProperties is " + job.getProperties().size());
            for (int j = 0; j < job.getProperties().size(); j++) {
                LOG.log(Level.FINE, "getProperties " +job.getProperties().get(j));//+ /+ addJob(job, job.getProperties().get(j).getClass(), installedPluginSet));
            }
        }else {
            LOG.log(Level.FINE, "getProperties is empty");
        }

        if (job.getAllActions() != null && job.getAllActions().size() > 0) {
            for (Action action : job.getAllActions()) {
                LOG.log(Level.FINE, "getAllActions " + addJob(job.getName(), job.getShortUrl(), action.getClass(), installedPluginSet));
            }
        } else {
            LOG.log(Level.FINE, "getAllActions is empty");
        }

    } else {
        LOG.log(Level.FINE, "PROJECT is null");
    }
}
 
Example 37
Project: plugin-stats-plugin   File: PluginStatsAction.java   View source code 4 votes vote down vote up
private void queryMavenProject(MavenModuleSet job, Hashtable<String, InstalledPlugin> installedPluginSet) {
    if (job != null) {

        if (job.getBuildWrappersList() != null && job.getBuildWrappersList().size() > 0) {
            DescribableList<BuildWrapper, Descriptor<BuildWrapper>> wrappersList = job.getBuildWrappersList();
            Iterator<BuildWrapper> buildWrapperIterator = wrappersList.iterator();
            while (buildWrapperIterator.hasNext()) {
                BuildWrapper buildWrapper = buildWrapperIterator.next();
                LOG.log(Level.FINE, "getBuildWrappers " + addJob(job.getName(), job.getShortUrl(), buildWrapper.getClass(), installedPluginSet));
            }

        } else {
            LOG.log(Level.FINE, "getBuildWrappers is empty");
        }

        if (job.getPublishersList() != null && job.getPublishersList().size() > 0) {
            DescribableList<Publisher, Descriptor<Publisher>> publisherList = job.getPublishersList();
            Iterator<Publisher> publisherIterator = publisherList.iterator();
            while (publisherIterator.hasNext()) {
                Publisher publisher = publisherIterator.next();
                LOG.log(Level.FINE, "getPublishersList " + addJob(job.getName(), job.getShortUrl(), publisher.getClass(), installedPluginSet));
            }
        } else {
            LOG.log(Level.FINE, "getPublishersList is empty");
        }

        if (job.getScm() != null) {
            LOG.log(Level.FINE, "getScm " + addJob(job.getName(), job.getShortUrl(), job.getScm().getClass(), installedPluginSet));
        } else {
            LOG.log(Level.FINE, "getScm is empty");
        }

        if (job.getTriggers() != null && job.getTriggers().size() > 0) {
            Iterator<Trigger<?>> triggerIterator =  job.getTriggers().values().iterator();
            while (triggerIterator.hasNext()) {
                Trigger trigger = triggerIterator.next();
                LOG.log(Level.FINE, "getTriggers " + addJob(job.getName(), job.getShortUrl(), trigger.getClass(), installedPluginSet));
            }
        } else {
            LOG.log(Level.FINE, "getTriggers is empty");
        }

        if (job.getProperties() !=null && job.getProperties().size() > 0){
            Map<JobPropertyDescriptor, JobProperty<? super MavenModuleSet>> properties = job.getProperties();
            for (Map.Entry<JobPropertyDescriptor, JobProperty<? super MavenModuleSet>> entry : properties.entrySet()) {
                LOG.log(Level.FINE, "getProperties " + addJob(job.getName(), job.getShortUrl(), entry.getKey().getClass(), installedPluginSet));
            }
        }else {
            LOG.log(Level.FINE, "getProperties is empty");
        }

        if (job.getAllActions() != null && job.getAllActions().size() > 0) {
            for (Action action : job.getAllActions()) {
                LOG.log(Level.FINE, "getAllActions " + addJob(job.getName(), job.getShortUrl(), action.getClass(), installedPluginSet));
            }
        } else {
            LOG.log(Level.FINE, "getAllActions is empty");
        }

    } else {
        LOG.log(Level.FINE, "PROJECT is null");
    }
}
 
Example 38
Project: plugin-stats-plugin   File: PluginStatsAction.java   View source code 4 votes vote down vote up
private void queryMultibranchProject(FreeStyleMultiBranchProject job, Hashtable<String, InstalledPlugin> installedPluginSet) {
    if (job != null) {
        if (job.getPublishersList() != null && job.getPublishersList().size() > 0) {
            DescribableList<Publisher, Descriptor<Publisher>> publisherList = job.getPublishersList();
            Iterator<Publisher> publisherIterator = publisherList.iterator();
            while (publisherIterator.hasNext()) {
                Publisher publisher = publisherIterator.next();
                LOG.log(Level.FINE, "getPublishersList " + addJob(job.getName(), job.getShortUrl(), publisher.getClass(), installedPluginSet));
            }
        } else {
            LOG.log(Level.FINE, "getPublishersList is empty");
        }

        if (job.getScm() != null) {
            LOG.log(Level.FINE, "getScm " + addJob(job.getName(), job.getShortUrl(), job.getScm().getClass(), installedPluginSet));
        } else {
            LOG.log(Level.FINE, "getScm is empty");
        }

        if (job.getTriggers() != null && job.getTriggers().size() > 0) {
            Iterator<Trigger<?>> triggerIterator =  job.getTriggers().values().iterator();
            while (triggerIterator.hasNext()) {
                Trigger trigger = triggerIterator.next();
                LOG.log(Level.FINE, "getTriggers " + addJob(job.getName(), job.getShortUrl(), trigger.getClass(), installedPluginSet));
            }
        } else {
            LOG.log(Level.FINE, "getTriggers is empty");
        }

        if (job.getProperties() !=null && job.getProperties().size() > 0){
            Map<JobPropertyDescriptor, JobProperty<? super FreeStyleProject>> properties = job.getProperties();
            for (Map.Entry<JobPropertyDescriptor, JobProperty<? super FreeStyleProject>> entry : properties.entrySet()) {
                LOG.log(Level.FINE, "getProperties " + addJob(job.getName(), job.getShortUrl(), entry.getKey().getClass(), installedPluginSet));
            }
        }else {
            LOG.log(Level.FINE, "getProperties is empty");
        }

        if (job.getAllActions() != null && job.getAllActions().size() > 0) {
            for (Action action : job.getAllActions()) {
                LOG.log(Level.FINE, "getAllActions " + addJob(job.getName(), job.getShortUrl(), action.getClass(), installedPluginSet));
            }
        } else {
            LOG.log(Level.FINE, "getAllActions is empty");
        }

    } else {
        LOG.log(Level.FINE, "PROJECT is null");
    }
}
 
Example 39
Project: pyjenkins   File: MockProject.java   View source code 4 votes vote down vote up
@Override
public DescribableList<Publisher, Descriptor<Publisher>> getPublishersList() {
    return null;
}
 
Example 40
Project: phabricator-jenkins-plugin   File: TestUtils.java   View source code 4 votes vote down vote up
public static Publisher getDefaultXUnitPublisher() {
    return new JUnitResultArchiver(
            JUNIT_XML
    );
}