Search in sources :

Example 1 with SchedulerUserInfo

use of org.ow2.proactive.scheduler.job.SchedulerUserInfo in project scheduling by ow2-proactive.

the class TestGetUsers method test.

@Test
public void test() throws Exception {
    // login once with a different user to reset the connection time
    schedulerHelper.getSchedulerInterface(TestUsers.USER);
    // login with the demo user
    Scheduler scheduler = schedulerHelper.getSchedulerInterface();
    List<SchedulerUserInfo> users;
    List<SchedulerUserInfo> usersWithJobs;
    users = scheduler.getUsers();
    assertEquals(1, users.size());
    checkUser(users.get(0), TestUsers.DEMO.username, null);
    assertTrue("Unexpected connect time: " + users.get(0).getConnectionTime(), users.get(0).getConnectionTime() > testStartTime);
    Long connectTime = users.get(0).getConnectionTime();
    scheduler.submit(createJob());
    users = scheduler.getUsers();
    usersWithJobs = scheduler.getUsersWithJobs();
    assertEquals(1, users.size());
    assertEquals(1, usersWithJobs.size());
    checkUser(users.get(0), TestUsers.DEMO.username, connectTime);
    checkUser(usersWithJobs.get(0), TestUsers.DEMO.username, null);
    scheduler.submit(createJob());
    users = scheduler.getUsers();
    usersWithJobs = scheduler.getUsersWithJobs();
    assertEquals(1, users.size());
    assertEquals(1, usersWithJobs.size());
    checkUser(users.get(0), TestUsers.DEMO.username, connectTime);
    checkUser(usersWithJobs.get(0), TestUsers.DEMO.username, null);
}
Also used : SchedulerUserInfo(org.ow2.proactive.scheduler.job.SchedulerUserInfo) Scheduler(org.ow2.proactive.scheduler.common.Scheduler) Test(org.junit.Test)

Example 2 with SchedulerUserInfo

use of org.ow2.proactive.scheduler.job.SchedulerUserInfo in project scheduling by ow2-proactive.

the class SchedulerFrontendState method getUsers.

synchronized List<SchedulerUserInfo> getUsers() {
    List<SchedulerUserInfo> users = new ArrayList<>(identifications.size());
    for (ListeningUser listeningUser : identifications.values()) {
        UserIdentificationImpl user = listeningUser.getUser();
        users.add(new SchedulerUserInfo(user.getHostName(), user.getUsername(), user.getConnectionTime(), user.getLastSubmitTime(), user.getSubmitNumber()));
    }
    return users;
}
Also used : SchedulerUserInfo(org.ow2.proactive.scheduler.job.SchedulerUserInfo) ArrayList(java.util.ArrayList) UserIdentificationImpl(org.ow2.proactive.scheduler.job.UserIdentificationImpl)

Aggregations

SchedulerUserInfo (org.ow2.proactive.scheduler.job.SchedulerUserInfo)2 ArrayList (java.util.ArrayList)1 Test (org.junit.Test)1 Scheduler (org.ow2.proactive.scheduler.common.Scheduler)1 UserIdentificationImpl (org.ow2.proactive.scheduler.job.UserIdentificationImpl)1