当前位置: 首页>>代码示例>>Java>>正文


Java User.get方法代码示例

本文整理汇总了Java中hudson.model.User.get方法的典型用法代码示例。如果您正苦于以下问题:Java User.get方法的具体用法?Java User.get怎么用?Java User.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在hudson.model.User的用法示例。


在下文中一共展示了User.get方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: specialStatus

import hudson.model.User; //导入方法依赖的package包/类
@Test public void specialStatus() throws Exception {
    User.get("smrt");
    WorkflowJob p = r.jenkins.createProject(WorkflowJob.class, "p");
    p.setDefinition(new CpsFlowDefinition(
            "catchError {\n" +
            "  semaphore 'specialStatus'\n" +
            "}", true));
    SemaphoreStep.failure("specialStatus/1", new FlowInterruptedException(Result.UNSTABLE, new CauseOfInterruption.UserInterruption("smrt")));
    WorkflowRun b = p.scheduleBuild2(0).get();
    r.assertLogContains("smrt", r.assertBuildStatus(Result.UNSTABLE, b));
    /* TODO fixing this is trickier since CpsFlowExecution.setResult does not implement a public method, and anyway CatchErrorStep in its current location could not refer to FlowExecution:
    List<FlowNode> heads = b.getExecution().getCurrentHeads();
    assertEquals(1, heads.size());
    assertEquals(Result.UNSTABLE, ((FlowEndNode) heads.get(0)).getResult());
    */
}
 
开发者ID:10000TB,项目名称:Jenkins-Plugin-Examples,代码行数:17,代码来源:CatchErrorStepTest.java

示例2: getAuthor

import hudson.model.User; //导入方法依赖的package包/类
/**
 * Gets the user who made this change.
 * 
 * This is a mandatory part of the Change Log Architecture
 * 
 * @return the author of the checkin (aka commit)
 */
@Exported
public User getAuthor() {
    User user = User.get(author, false);

    if (user == null) {
        user = User.get(author, true);

        // set email address for user
        if (fixEmpty(authorEmail) != null) {
            try {
                user.addProperty(new Mailer.UserProperty(authorEmail));
            } catch (IOException e) {
                // ignore error
            }
        }
    }

    return user;
}
 
开发者ID:rjperrella,项目名称:jenkins-fossil-adapter,代码行数:27,代码来源:FossilChangeLogEntry.java

示例3: TestGitRepo

import hudson.model.User; //导入方法依赖的package包/类
public TestGitRepo(String name, File tmpDir, TaskListener listener) throws IOException, InterruptedException {
  this.name = name;
  this.listener = listener;

  envVars = new EnvVars();

  gitDir = tmpDir;
  User john = User.get(johnDoe.getName(), true);
  UserProperty johnsMailerProperty = new Mailer.UserProperty(johnDoe.getEmailAddress());
  john.addProperty(johnsMailerProperty);

  User jane = User.get(janeDoe.getName(), true);
  UserProperty janesMailerProperty = new Mailer.UserProperty(janeDoe.getEmailAddress());
  jane.addProperty(janesMailerProperty);

  // initialize the git interface.
  gitDirPath = new FilePath(gitDir);
  git = Git.with(listener, envVars).in(gitDir).getClient();

  // finally: initialize the repo
  git.init();
}
 
开发者ID:jenkinsci,项目名称:flaky-test-handler-plugin,代码行数:23,代码来源:TestGitRepo.java

示例4: getEmailAddress

import hudson.model.User; //导入方法依赖的package包/类
public String getEmailAddress(String username) {
   String address = null;
   User u = User.get(username);
   if (u == null) {
      println("failed obtaining user for name " + username);
      return address;
   }
   Mailer.UserProperty p = u.getProperty(Mailer.UserProperty.class);
   if (p == null) {
      println("failed obtaining email address for user " + username);
      return address;
   }

   if (p.getAddress() == null) {
      println("failed obtaining email address (is null) for user " + username);
      return address;
   }

   return p.getAddress();
}
 
开发者ID:samsta,项目名称:quarantine,代码行数:21,代码来源:MailNotifier.java

示例5: setUp

import hudson.model.User; //导入方法依赖的package包/类
@Override
protected void setUp() throws Exception {
   super.setUp();
   java.util.logging.Logger.getLogger("com.gargoylesoftware.htmlunit").setLevel(java.util.logging.Level.SEVERE);

   project = createFreeStyleProject(projectName);
   DescribableList<TestDataPublisher, Descriptor<TestDataPublisher>> publishers = new DescribableList<TestDataPublisher, Descriptor<TestDataPublisher>>(
         project);
   publishers.add(new QuarantineTestDataPublisher());
   QuarantinableJUnitResultArchiver archiver = new QuarantinableJUnitResultArchiver("*.xml");
   archiver.setTestDataPublishers(publishers);
   project.getPublishersList().add(archiver);

   hudson.setAuthorizationStrategy(new FullControlOnceLoggedInAuthorizationStrategy());
   hudson.setSecurityRealm(createDummySecurityRealm());

   User u = User.get("user1");
   u.addProperty(new Mailer.UserProperty(user1Mail));
}
 
开发者ID:samsta,项目名称:quarantine,代码行数:20,代码来源:QuarantineCoreTest.java

示例6: setLabel

import hudson.model.User; //导入方法依赖的package包/类
public void setLabel(ConnectionHelper p4, String labelId) throws Exception {
	Label label = (Label) p4.getLabel(labelId);

	// set id
	id = new P4LabelRef(labelId);

	// set author
	String user = label.getOwnerName();
	user = (user != null && !user.isEmpty()) ? user : "unknown";
	author = User.get(user);

	// set date of change
	date = label.getLastAccess();

	// set client id
	clientId = labelId;

	// set display message
	msg = label.getDescription();

	// set list of file revisions in change
	List<IFileSpec> files = p4.getLabelFiles(labelId, fileCountLimit + 1);
	if (files.size() > fileCountLimit) {
		fileLimit = true;
		files = files.subList(0, fileCountLimit);
	}

	// set list of affected files
	affectedFiles = new ArrayList<P4AffectedFile>();
	for (IFileSpec item : files) {
		affectedFiles.add(new P4AffectedFile(item));
	}
}
 
开发者ID:p4paul,项目名称:p4-jenkins,代码行数:34,代码来源:P4ChangeEntry.java

示例7: setGraphCommit

import hudson.model.User; //导入方法依赖的package包/类
public void setGraphCommit(ConnectionHelper p4, String repo, String sha) throws Exception {

		ICommit commit = p4.getGraphCommit(sha, repo);
		id = new P4GraphRef(repo, commit);

		// set author
		String user = commit.getAuthor();
		user = (user != null && !user.isEmpty()) ? user : "unknown";
		author = User.get(user);

		// set date of change
		date = commit.getDate();

		// set client id
		clientId = commit.getAuthorEmail();

		// set display message
		msg = commit.getDescription();

		// set list of affected paths
		affectedFiles = new ArrayList<>();

		List<IFileSpec> graphFiles = p4.getCommitFiles(repo, sha);
		for (IFileSpec item : graphFiles) {
			String path = item.getDepotPathString();
			FileAction action = item.getAction();
			affectedFiles.add(new P4AffectedFile(path, sha, action));
		}

		if (affectedFiles.size() > fileCountLimit) {
			fileLimit = true;
			affectedFiles = affectedFiles.subList(0, fileCountLimit);
		}
	}
 
开发者ID:p4paul,项目名称:p4-jenkins,代码行数:35,代码来源:P4ChangeEntry.java

示例8: quarantinedByName

import hudson.model.User; //导入方法依赖的package包/类
public String quarantinedByName() {
   User user = User.get(quarantinedBy, false, Collections.emptyMap());
   if (user != null) {
      return user.getDisplayName();
   } else {
      return quarantinedBy;
   }
}
 
开发者ID:samsta,项目名称:quarantine,代码行数:9,代码来源:QuarantineTestAction.java

示例9: setChange

import hudson.model.User; //导入方法依赖的package包/类
public void setChange(ConnectionHelper p4, IChangelistSummary changelist) throws Exception {

		// set id
		int changeId = changelist.getId();
		id = new P4ChangeRef(changeId);

		// set author
		String user = changelist.getUsername();
		author = User.get(user);

		// set email property on user
		String email = p4.getEmail(user);
		if (email != null && !email.isEmpty()) {
			P4UserProperty p4prop = new P4UserProperty(email);
			author.addProperty(p4prop);
			logger.fine("Setting email for user: " + user + ":" + email);

			// Set default email for Jenkins user if not defined
			UserProperty prop = author.getProperty(UserProperty.class);
			if (prop == null || prop.getAddress() == null || prop.getAddress().isEmpty()) {
				prop = new UserProperty(email);
				author.addProperty(prop);
				logger.fine("Setting default user: " + user + ":" + email);
			}
		}

		// set date of change
		date = changelist.getDate();

		// set client id
		clientId = changelist.getClientId();

		// set display message
		msg = changelist.getDescription();

		// set list of file revisions in change
		List<IFileSpec> files;
		if (changelist.getStatus() == ChangelistStatus.PENDING) {
			files = p4.getShelvedFiles(changeId);
			shelved = true;
		} else {
			files = p4.getChangeFiles(changeId, fileCountLimit + 1);
			shelved = false;
		}
		if (files != null && files.size() > fileCountLimit) {
			fileLimit = true;
			files = files.subList(0, fileCountLimit);
		}

		// set list of affected paths/files
		affectedFiles = new ArrayList<P4AffectedFile>();
		if (files != null) {
			for (IFileSpec item : files) {
				affectedFiles.add(new P4AffectedFile(item));
			}
		}

		// set list of jobs in change
		this.jobs = p4.getJobs(changeId);
	}
 
开发者ID:p4paul,项目名称:p4-jenkins,代码行数:61,代码来源:P4ChangeEntry.java

示例10: setAuthor

import hudson.model.User; //导入方法依赖的package包/类
public void setAuthor(String value) {
	author = User.get(value);
}
 
开发者ID:p4paul,项目名称:p4-jenkins,代码行数:4,代码来源:P4ChangeEntry.java

示例11: getAuthor

import hudson.model.User; //导入方法依赖的package包/类
@Override
public User getAuthor() {
    return committer.isEmpty() ? User.getUnknown() : User.get(committer);
}
 
开发者ID:randycoulman,项目名称:visualworks-store-plugin,代码行数:5,代码来源:StoreChangeLogEntry.java

示例12: getAuthor

import hudson.model.User; //导入方法依赖的package包/类
/**
 * Get author of the changes.
 *
 * @return Author of AffectedFile change.
 */
@Override
public User getAuthor() {
    return User.get(this.affectedFile.file.changeUserID);
}
 
开发者ID:jenkinsci,项目名称:zos-connector-plugin,代码行数:10,代码来源:SCLMChangeLogSet.java


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