本文整理汇总了Java中jetbrains.buildServer.users.User类的典型用法代码示例。如果您正苦于以下问题:Java User类的具体用法?Java User怎么用?Java User使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
User类属于jetbrains.buildServer.users包,在下文中一共展示了User类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doHandle
import jetbrains.buildServer.users.User; //导入依赖的package包/类
@Override
@Nullable
protected ModelAndView doHandle(@NotNull final HttpServletRequest request, @NotNull final HttpServletResponse response) throws Exception {
final ModelAndView result = new ModelAndView(myJspPath);
final User user = SessionUser.getUser(request);
result.getModel().put("pluginName", NotifierConstants.NOTIFIER_TYPE);
result.getModel().put("buildTypes", myServer.getStatusProvider().getWatchedBuildTypes(user, NotifierConstants.NOTIFIER_TYPE));
result.getModel().put("runningBuilds", myServer.getRunningStatus(user, null));
final long userId = user.getId();
result.getModel().put("hasRules", !myRulesManager.getUserNotificationRules(userId, NotifierConstants.NOTIFIER_TYPE).isEmpty());
result.getModel().put("userId", userId);
return result;
}
示例2: testUserAccountRemoved_DoesNothing
import jetbrains.buildServer.users.User; //导入依赖的package包/类
@Test
public void testUserAccountRemoved_DoesNothing() throws Exception {
final SBuildServer sBuildServer = mock(SBuildServer.class);
final UsernameMapperConfig mapperConfig = mock(UsernameMapperConfig.class);
final TfsUsernameMapperListener listener = new TfsUsernameMapperListener(sBuildServer, mapperConfig);
User user = mock(User.class);
listener.userAccountRemoved(user);
verifyZeroInteractions(sBuildServer);
verifyZeroInteractions(user);
verifyZeroInteractions(mapperConfig);
verifyZeroInteractions(user);
}
示例3: responsibleChanged
import jetbrains.buildServer.users.User; //导入依赖的package包/类
@Override
public void responsibleChanged(@NotNull SProject project, @NotNull Collection<BuildProblemInfo> buildProblems, @Nullable ResponsibilityEntry entry) {
super.responsibleChanged(project, buildProblems, entry);
if (entry == null) return;
if (notifyInvestigationTaken(entry)) return;
if (!notifyInvestigationDelegated(entry)) return;
User responsible = entry.getResponsibleUser();
for (BuildProblemInfo problem: buildProblems) {
if (problem instanceof BuildProblem) {
BuildProblem bp = (BuildProblem) problem;
if (BuildProblemTypes.TC_COMPILATION_ERROR_TYPE.equals(bp.getBuildProblemData().getType())) {
registerUserEvent(responsible, AchievementEvents.compilationBroken.name());
break;
}
}
}
}
示例4: getUserEvents
import jetbrains.buildServer.users.User; //导入依赖的package包/类
@NotNull
public UserEvents getUserEvents(@NotNull final User user) {
UserEvents userEvents = myUserEvents.get(user.getId());
if (userEvents == null) {
userEvents = new UserEventsImpl(myTimeService) {
@Override
public synchronized void registerEvent(@NotNull String eventName) {
super.registerEvent(eventName);
myEventDispatcher.getMulticaster().userEventPublished(user, eventName, null);
}
public void registerEvent(@NotNull String eventName, @Nullable Object additionalData) {
super.registerEvent(eventName);
myEventDispatcher.getMulticaster().userEventPublished(user, eventName, additionalData);
}
};
myUserEvents.put(user.getId(), userEvents);
}
return userEvents;
}
示例5: fillModel
import jetbrains.buildServer.users.User; //导入依赖的package包/类
@Override
public void fillModel(@NotNull Map<String, Object> model, @NotNull HttpServletRequest request) {
User user = SessionUser.getUser(request);
final String userIdStr = request.getParameter("userId");
if (userIdStr != null) {
long userId = Long.parseLong(userIdStr);
user = myUserModel.findUserById(userId);
if (user == null) throw new UserNotFoundException(userId, "User with id " + userIdStr + " does not exist");
}
model.put("showPausedWarning", myConfig.isPaused());
boolean showTeamRoomNotConfiguredWarning = false;
boolean showCredentialsNotConfiguredWarning = false;
if (myRulesManager.isRulesWithEventsConfigured(user.getId(), getPluginName())) {
showTeamRoomNotConfiguredWarning = !VSOUserProperties.isTargetTeamRoomConfigured(user);
showCredentialsNotConfiguredWarning = !VSOUserProperties.isCredentialsConfigured(user);
}
model.put("showTeamRoomNotConfiguredWarning", showTeamRoomNotConfiguredWarning);
model.put("showCredentialsNotConfiguredWarning", showCredentialsNotConfiguredWarning);
model.put("settingsBean", VSONotificationUserSettingsBean.createFromUserSettings(user));
}
示例6: testUserAccountCreated_whenUserMappingIsFound_DoesNothing
import jetbrains.buildServer.users.User; //导入依赖的package包/类
@Test
public void testUserAccountCreated_whenUserMappingIsFound_DoesNothing() throws Exception {
long userId = 1;
final SBuildServer sBuildServer = mock(SBuildServer.class);
final UsernameMapperConfig mapperConfig = mock(UsernameMapperConfig.class);
when(mapperConfig.getDomainName()).thenReturn("MYDOMAIN");
final UserModel userModel = mock(UserModel.class);
when(sBuildServer.getUserModel()).thenReturn(userModel);
final VcsUsernamePropertyKey propertyKey = new VcsUsernamePropertyKey(new VcsRootImpl(1, "tfs"));
final SUser sUser = mock(SUser.class);
when(sUser.getVcsUsernameProperties()).thenReturn(new ArrayList<VcsUsernamePropertyKey>() {{
add(propertyKey);
}});
when(userModel.findUserById(userId)).thenReturn(sUser);
final TfsUsernameMapperListener listener = new TfsUsernameMapperListener(sBuildServer, mapperConfig);
User user = mock(User.class);
when(user.getId()).thenReturn(userId);
when(user.getUsername()).thenReturn("bob");
when(user.getPropertyValue(propertyKey)).thenReturn("MYDOMAIN\\bob");
listener.userAccountCreated(user);
verify(sBuildServer).getUserModel();
verify(userModel).findUserById(userId);
verify(sUser).getVcsUsernameProperties();
verify(user).getUsername();
verifyNoMoreInteractions(sBuildServer);
verifyNoMoreInteractions(userModel);
verifyNoMoreInteractions(sUser);
}
示例7: testUserAccountCreated_whenUserMappingIsFoundButEmpty_UpdatesMapping
import jetbrains.buildServer.users.User; //导入依赖的package包/类
@Test
public void testUserAccountCreated_whenUserMappingIsFoundButEmpty_UpdatesMapping() throws Exception {
long userId = 1;
final SBuildServer sBuildServer = mock(SBuildServer.class);
final UsernameMapperConfig mapperConfig = mock(UsernameMapperConfig.class);
when(mapperConfig.getDomainName()).thenReturn("MYDOMAIN");
final UserModel userModel = mock(UserModel.class);
when(sBuildServer.getUserModel()).thenReturn(userModel);
final VcsUsernamePropertyKey propertyKey = new VcsUsernamePropertyKey(new VcsRootImpl(1, "tfs"));
final SUser sUser = mock(SUser.class);
when(sUser.getVcsUsernameProperties()).thenReturn(new ArrayList<VcsUsernamePropertyKey>() {{
add(propertyKey);
}});
when(userModel.findUserById(userId)).thenReturn(sUser);
final TfsUsernameMapperListener listener = new TfsUsernameMapperListener(sBuildServer, mapperConfig);
User user = mock(User.class);
when(user.getId()).thenReturn(userId);
when(user.getUsername()).thenReturn("bob");
when(user.getPropertyValue(propertyKey)).thenReturn(null);
listener.userAccountCreated(user);
verify(sBuildServer).getUserModel();
verify(userModel).findUserById(userId);
verify(sUser).getVcsUsernameProperties();
verify(user).getUsername();
verify(sUser).setUserProperty(propertyKey, "MYDOMAIN\\bob");
verifyNoMoreInteractions(sBuildServer);
verifyNoMoreInteractions(userModel);
verifyNoMoreInteractions(sUser);
}
示例8: ProductivityBoost
import jetbrains.buildServer.users.User; //导入依赖的package包/类
public ProductivityBoost(@NotNull final UserEventsRegistry userEventsRegistry) {
super(AchievementEvents.changeAdded.name(), 20);
userEventsRegistry.addListener(new UserEventsListener() {
public void userEventPublished(@NotNull User user, @NotNull String eventName, @Nullable Object additionalData) {
if (!AchievementEvents.changeAdded.name().equals(eventName)) return;
if (!(additionalData instanceof SVcsModification)) return;
SVcsModification mod = (SVcsModification) additionalData;
Date vcsDate = mod.getVcsDate();
if (Calendar.getInstance().getTime().getTime() - vcsDate.getTime() < 24 * 3600 * 1000) {
userEventsRegistry.getUserEvents(user).registerEvent(getId() + ":changeAdded");
}
}
});
}
示例9: buildUnpinned
import jetbrains.buildServer.users.User; //导入依赖的package包/类
@Override
public void buildUnpinned(@NotNull SBuild build, @Nullable User user, @Nullable String comment) {
super.buildUnpinned(build, user, comment);
if (user != null) {
registerUserEvent(user, AchievementEvents.buildUnpinned.name());
}
}
示例10: testsMuted
import jetbrains.buildServer.users.User; //导入依赖的package包/类
@Override
public void testsMuted(@NotNull MuteInfo muteInfo) {
super.testsMuted(muteInfo);
User user = muteInfo.getMutingUser();
if (user == null) return;
if (muteInfo.getAutoUnmuteOptions().getUnmuteByTime() == null) return;
for (STest ignored : muteInfo.getTests()) {
registerUserEvent(user, AchievementEvents.testBombed.name());
}
}
示例11: buildTagsChanged
import jetbrains.buildServer.users.User; //导入依赖的package包/类
@Override
public void buildTagsChanged(@NotNull SBuild build, User user, @NotNull List<String> oldTags, @NotNull List<String> newTags) {
super.buildTagsChanged(build, user, oldTags, newTags);
if (user != null && !newTags.isEmpty()) {
registerUserEvent(user, AchievementEvents.buildTagged.name());
}
}
示例12: notifyInvestigationDelegated
import jetbrains.buildServer.users.User; //导入依赖的package包/类
private boolean notifyInvestigationDelegated(@NotNull ResponsibilityEntry entry) {
User responsible = entry.getResponsibleUser();
User reporter = entry.getReporterUser();
if (reporter != null && reporter.getId() != responsible.getId()) {
registerUserEvent(reporter, AchievementEvents.investigationDelegated.name());
return true;
}
return false;
}
示例13: notifyInvestigationTaken
import jetbrains.buildServer.users.User; //导入依赖的package包/类
private boolean notifyInvestigationTaken(@NotNull ResponsibilityEntry entry) {
User responsible = entry.getResponsibleUser();
User reporter = entry.getReporterUser();
if (reporter != null && reporter.getId() == responsible.getId()) {
registerUserEvent(reporter, AchievementEvents.investigationTaken.name());
return true;
}
return false;
}
示例14: getUserDisplayName
import jetbrains.buildServer.users.User; //导入依赖的package包/类
@Nullable
private String getUserDisplayName(@Nullable User user) {
if(user == null) return null;
final String vsoUserName = VSOUserProperties.getUserDisplayName(user);
if(vsoUserName != null){
return "@" + vsoUserName;
}
return user.getDescriptiveName();
}
示例15: fillModel
import jetbrains.buildServer.users.User; //导入依赖的package包/类
@Override
public void fillModel(@NotNull Map<String, Object> model, @NotNull HttpServletRequest request) {
User user = SessionUser.getUser(request);
final String userIdStr = request.getParameter("userId");
if (userIdStr != null) {
long userId = Long.parseLong(userIdStr);
user = myUserModel.findUserById(userId);
if (user == null) throw new UserNotFoundException(userId, "User with id " + userIdStr + " does not exist");
}
model.put("settingsBean", VSONotificationUserSettingsBean.createFromUserSettings(user));
}