Skip to content

Commit

Permalink
[JENKINS-62297] Rename to UserCount
Browse files Browse the repository at this point in the history
Co-authored-by: Daniel Beck <1831569+daniel-beck@users.noreply.github.com>
Co-authored-by: Robert Sandell <rsandell@cloudbees.com>
  • Loading branch information
3 people committed May 22, 2020
1 parent 4660881 commit e8fabdc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
@@ -1,7 +1,7 @@
/*
* The MIT License
*
* Copyright (c) 2019, CloudBees, Inc.
* Copyright (c) 2020, CloudBees, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -40,7 +40,7 @@
import java.util.stream.Collectors;

@Extension
public class UsersContent extends UnfilteredFileListCapComponent {
public class UserCount extends UnfilteredFileListCapComponent {

@NonNull
@Override
Expand Down Expand Up @@ -72,7 +72,7 @@ protected void printTo(PrintWriter out) {
.forEach((lastGrantedAuthoritiesProperty, aLong) ->
out.println(" * "
+ (lastGrantedAuthoritiesProperty ? "Authenticated" : "Non Authenticated")
+ " Users count: " + aLong)
+ " User Count: " + aLong)
);
}

Expand Down
@@ -1,11 +1,10 @@
/*
* Copyright © 2013 CloudBees, Inc.
*/
package com.cloudbees.jenkins.support.timer;
package com.cloudbees.jenkins.support.impl;

import com.cloudbees.jenkins.support.SupportTestUtils;
import com.cloudbees.jenkins.support.api.Component;
import com.cloudbees.jenkins.support.impl.UsersContent;
import hudson.ExtensionList;
import hudson.model.User;
import jenkins.security.LastGrantedAuthoritiesProperty;
Expand All @@ -17,7 +16,7 @@
import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.MatcherAssert.assertThat;

public class UsersContentTest {
public class UserCountTest {

@Rule
public JenkinsRule j = new JenkinsRule();
Expand All @@ -31,8 +30,8 @@ public void testAboutJenkinsContent() throws Exception {
User.getOrCreateByIdOrFullName("dave").addProperty(new LastGrantedAuthoritiesProperty());
User.getOrCreateByIdOrFullName("eve").addProperty(new LastGrantedAuthoritiesProperty());

String usersMdToString = SupportTestUtils.invokeComponentToString(ExtensionList.lookup(Component.class).get(UsersContent.class));
assertThat(usersMdToString, containsString(" * Non Authenticated Users count: " + 3));
assertThat(usersMdToString, containsString(" * Authenticated Users count: " + 2));
String usersMdToString = SupportTestUtils.invokeComponentToString(ExtensionList.lookup(Component.class).get(UserCount.class));
assertThat(usersMdToString, containsString(" * Non Authenticated User Count: " + 3));
assertThat(usersMdToString, containsString(" * Authenticated User Count: " + 2));
}
}

0 comments on commit e8fabdc

Please sign in to comment.