<commit_before>package com.versionone.hudson;

import com.versionone.om.ApplicationUnavailableException;
import com.versionone.om.AuthenticationException;
import com.versionone.om.V1Instance;
import hudson.Extension;
import hudson.Launcher;
import hudson.model.AbstractBuild;
import hudson.model.AbstractProject;
import hudson.model.BuildListener;
import hudson.scm.ChangeLogSet;
import hudson.tasks.BuildStepDescriptor;
import hudson.tasks.Notifier;
import hudson.tasks.Publisher;
import hudson.util.FormValidation;
import net.sf.json.JSONObject;
import org.kohsuke.stapler.QueryParameter;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.StaplerResponse;

import java.net.MalformedURLException;
import java.net.URL;
import java.util.GregorianCalendar;

public class VersionOneNotifier extends Notifier {

	@Extension
	public static final Descriptor DESCRIPTOR = new Descriptor();

	@Override
	public Descriptor getDescriptor() {
		return DESCRIPTOR;
	}

	public boolean perform(AbstractBuild build, Launcher launcher, BuildListener listener) {
		final V1Instance instance = new V1Instance(getDescriptor().getV1Path(), "admin", "admin");
		try {
			instance.validate();
			listener.getLogger().println("VersionOne connection validated.");
		} catch (ApplicationUnavailableException e) {
			listener.getLogger().println("VersionOne connection failed:");
			e.printStackTrace(listener.getLogger());
		} catch (AuthenticationException e) {
			listener.getLogger().println("VersionOne authentication failed:");
			e.printStackTrace(listener.getLogger());
		}

		listener.getLogger().println(getDescriptor().getV1Path());
		// this also shows how you can consult the global configuration of the builder
		listener.getLogger().println("Result: " + build.getResult());
		listener.getLogger().println("Description: " + build.getDescription());
		listener.getLogger().println("Project: " + build.getProject().getName());
		listener.getLogger().println("ChangeSet (kind): " + build.getChangeSet().getKind());
		GregorianCalendar now = new GregorianCalendar();

		listener.getLogger().println("Time: " + (now.getTime().getTime() - build.getTimestamp().getTime().getTime()));
		//SubversionChangeLogSet for Subversion
		for (Object item : build.getChangeSet().getItems()) {
			ChangeLogSet.Entry changeSetData = ((ChangeLogSet.Entry) item);
			listener.getLogger().println("Message: " + changeSetData.getMsg());
			listener.getLogger().println("Author: " + changeSetData.getAuthor());
			for (ChangeLogSet.AffectedFile file : changeSetData.getAffectedFiles()) {
				listener.getLogger().println("File: " + file.getPath());
			}
			//listener.getLogger().println("ChangeSet (Items): " + item.toString());
		}
		listener.getLogger().println("------------------------------------");
		// we can recognize who init this build user or triger by data in actions(build.getActions()):
		// hudson.model.Cause$UserCause - user
		// hudson.triggers.SCMTrigger$SCMTriggerCause - trigger by Subversion update
		// build.getActions().get(0); or verify all data in loop




		return true;
	}

	public static final class Descriptor extends BuildStepDescriptor<Publisher> {

		private static final String V1_PATH = "v1Path";<commit_msg>testing build integration was added 5 lines of code 1 if construction with 2 conditions<commit_after>package com.versionone.hudson;

import com.versionone.om.ApplicationUnavailableException;
import com.versionone.om.AuthenticationException;
import com.versionone.om.V1Instance;
import hudson.Extension;
import hudson.Launcher;
import hudson.model.AbstractBuild;
import hudson.model.AbstractProject;
import hudson.model.BuildListener;
import hudson.scm.ChangeLogSet;
import hudson.tasks.BuildStepDescriptor;
import hudson.tasks.Notifier;
import hudson.tasks.Publisher;
import hudson.util.FormValidation;
import net.sf.json.JSONObject;
import org.kohsuke.stapler.QueryParameter;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.StaplerResponse;

import java.net.MalformedURLException;
import java.net.URL;
import java.util.GregorianCalendar;

public class VersionOneNotifier extends Notifier {

	@Extension
	public static final Descriptor DESCRIPTOR = new Descriptor();

	@Override
	public Descriptor getDescriptor() {
		return DESCRIPTOR;
	}

	public boolean perform(AbstractBuild build, Launcher launcher, BuildListener listener) {
		final V1Instance instance = new V1Instance(getDescriptor().getV1Path(), "admin", "admin");
		try {
			instance.validate();
			listener.getLogger().println("VersionOne connection validated.");
		} catch (ApplicationUnavailableException e) {
			listener.getLogger().println("VersionOne connection failed:");
			e.printStackTrace(listener.getLogger());
		} catch (AuthenticationException e) {
			listener.getLogger().println("VersionOne authentication failed:");
			e.printStackTrace(listener.getLogger());
		}

		listener.getLogger().println(getDescriptor().getV1Path());
		// this also shows how you can consult the global configuration of the builder
		listener.getLogger().println("Result: " + build.getResult());
		listener.getLogger().println("Description: " + build.getDescription());
		listener.getLogger().println("Project: " + build.getProject().getName());
		listener.getLogger().println("ChangeSet (kind): " + build.getChangeSet().getKind());
		GregorianCalendar now = new GregorianCalendar();

		listener.getLogger().println("Time: " + (now.getTime().getTime() - build.getTimestamp().getTime().getTime()));
		//SubversionChangeLogSet for Subversion
		for (Object item : build.getChangeSet().getItems()) {
			ChangeLogSet.Entry changeSetData = ((ChangeLogSet.Entry) item);
			listener.getLogger().println("Message: " + changeSetData.getMsg());
			listener.getLogger().println("Author: " + changeSetData.getAuthor());
			for (ChangeLogSet.AffectedFile file : changeSetData.getAffectedFiles()) {
				listener.getLogger().println("File: " + file.getPath());
			}
			//listener.getLogger().println("ChangeSet (Items): " + item.toString());
		}
		listener.getLogger().println("------------------------------------");
		// we can recognize who init this build user or triger by data in actions(build.getActions()):
		// hudson.model.Cause$UserCause - user
		// hudson.triggers.SCMTrigger$SCMTriggerCause - trigger by Subversion update
		// build.getActions().get(0); or verify all data in loop
        if (true && true) {
            int i=0;
            i++;
            System.out.println(i);
        }




		return true;
	}

	public static final class Descriptor extends BuildStepDescriptor<Publisher> {

		private static final String V1_PATH = "v1Path";
{'fraction_non_alphanumeric': 0.1363431151241535, 'fraction_numerical': 0.0030097817908201654, 'mean_word_length': 4.992786293958521, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3137676', 'n_tokens_mistral': 2031, 'n_tokens_neox': 1831, 'n_words': 406}