Search in sources :

Example 1 with BackendUserResource

use of org.ovirt.engine.api.restapi.resource.aaa.BackendUserResource in project ovirt-engine by oVirt.

the class BackendVmSessionsResourceTest method testList.

@Test
public void testList() throws Exception {
    BackendUserResource userResourceMock = mock(BackendUserResource.class);
    resource.setUserResource(userResourceMock);
    resource.setUriInfo(setUpBasicUriExpectations());
    setUpGetEntityExpectations(QueryType.GetVmByVmId, IdQueryParameters.class, new String[] { "Id" }, new Object[] { GUIDS[0] }, getEntity(0));
    setUpGetEntityExpectations(QueryType.GetDbUserByUserNameAndDomain, GetDbUserByUserNameAndDomainQueryParameters.class, new String[] { "UserName", "DomainName" }, new Object[] { "admin", "internal" }, null);
    Sessions sessions = resource.list();
    assertEquals(2, sessions.getSessions().size());
    assertNotNull(sessions.getSessions().get(0).getVm());
    assertNotNull(sessions.getSessions().get(1).getVm());
    assertNotNull(sessions.getSessions().get(0).getId());
    assertNotNull(sessions.getSessions().get(1).getId());
}
Also used : BackendUserResource(org.ovirt.engine.api.restapi.resource.aaa.BackendUserResource) Sessions(org.ovirt.engine.api.model.Sessions) Test(org.junit.Test)

Example 2 with BackendUserResource

use of org.ovirt.engine.api.restapi.resource.aaa.BackendUserResource in project ovirt-engine by oVirt.

the class BackendVmSessionsResource method getUserResource.

private BackendUserResource getUserResource() {
    if (this.userResource == null) {
        BackendUsersResource usersResource = new BackendUsersResource();
        inject(usersResource);
        UserResource userResource = usersResource.getUserResource("");
        this.userResource = (BackendUserResource) userResource;
    }
    return this.userResource;
}
Also used : BackendUsersResource(org.ovirt.engine.api.restapi.resource.aaa.BackendUsersResource) UserResource(org.ovirt.engine.api.resource.aaa.UserResource) BackendUserResource(org.ovirt.engine.api.restapi.resource.aaa.BackendUserResource)

Aggregations

BackendUserResource (org.ovirt.engine.api.restapi.resource.aaa.BackendUserResource)2 Test (org.junit.Test)1 Sessions (org.ovirt.engine.api.model.Sessions)1 UserResource (org.ovirt.engine.api.resource.aaa.UserResource)1 BackendUsersResource (org.ovirt.engine.api.restapi.resource.aaa.BackendUsersResource)1