use of edu.uiuc.ncsa.myproxy.oa4mp.server.admin.things.actions.ActionList in project OA4MP by ncsa.
the class PermissionServerTest method testGetAdmins.
public void testGetAdmins(CMTestStoreProvider tp2) throws Exception {
int clientCount = 4;
CC cc = setupClients(tp2);
List<AdminClient> admins = new LinkedList<>();
for (int i = 0; i < clientCount; i++) {
AdminClient ac2 = getAdminClient(tp2.getAdminClientStore());
Permission p = tp2.getPermissionStore().create();
p.setDelete(true);
p.setRead(true);
p.setApprove(true);
p.setCreate(true);
p.setWrite(true);
p.setAdminID(ac2.getIdentifier());
p.setClientID(cc.client.getIdentifier());
tp2.getPermissionStore().save(p);
admins.add(ac2);
}
admins.add(cc.adminClient);
// need this list of identifiers later for checking that the returned result is correct.
List<Identifier> adminIDs = new LinkedList<>();
for (AdminClient ac : admins) {
adminIDs.add(ac.getIdentifier());
}
PermissionServer permissionServer = new PermissionServer(tp2.getCOSE());
// ListAdminsRequest req = new ListAdminsRequest(cc.adminClient, cc.client);
ListAdminsRequest req = (ListAdminsRequest) RequestFactory.createRequest(null, new TypePermission(), new ActionList(), cc.client, null);
ListAdminsResponse resp = (ListAdminsResponse) permissionServer.process(req);
// so add a bunch of admins for a single client and check that they all come back.
List<AdminClient> returnedACs = resp.getAdmins();
assert returnedACs.size() == admins.size();
for (AdminClient x : returnedACs) {
assert adminIDs.contains(x.getIdentifier());
}
}
use of edu.uiuc.ncsa.myproxy.oa4mp.server.admin.things.actions.ActionList in project OA4MP by ncsa.
the class PermissionServerTest method testGetClients.
public void testGetClients(CMTestStoreProvider tp2) throws Exception {
int clientCount = 4;
CC cc = setupClients(tp2);
List<OA2Client> clients = new LinkedList<>();
for (int i = 0; i < clientCount; i++) {
OA2Client client2 = getOa2Client(tp2.getClientStore());
Permission p = tp2.getPermissionStore().create();
p.setDelete(true);
p.setRead(true);
p.setApprove(true);
p.setCreate(true);
p.setWrite(true);
p.setAdminID(cc.adminClient.getIdentifier());
p.setClientID(client2.getIdentifier());
tp2.getPermissionStore().save(p);
clients.add(client2);
}
clients.add(cc.client);
// need this list of identifiers later for checking that the returned result is correct.
List<Identifier> clientIDs = new LinkedList<>();
for (OA2Client ac : clients) {
clientIDs.add(ac.getIdentifier());
}
PermissionServer permissionServer = new PermissionServer(tp2.getCOSE());
ListClientsRequest req = (ListClientsRequest) RequestFactory.createRequest(cc.adminClient, new TypePermission(), new ActionList(), null, null);
ListClientResponse resp = (ListClientResponse) permissionServer.process(req);
// so add a bunch of admins for a single client and check that they all come back.
List<OA2Client> returnedACs = resp.getClients();
assert returnedACs.size() == clients.size();
for (OA2Client x : returnedACs) {
assert clientIDs.contains(x.getIdentifier());
}
}
Aggregations