Skip to content
Snippets Groups Projects
Commit 8fec87f8 authored by Stefan E. Funk's avatar Stefan E. Funk
Browse files

Add name (real name) to UserRoleResponse

Increase CXF and JUNIT versions
parent b124f626
No related branches found
No related tags found
No related merge requests found
......@@ -23,9 +23,9 @@ import static org.junit.Assert.assertTrue;
import java.io.File;
import java.io.FileInputStream;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
import java.util.concurrent.ThreadFactory;
import javax.xml.ws.soap.SOAPFaultException;
import org.junit.AfterClass;
import org.junit.BeforeClass;
......@@ -111,8 +111,8 @@ public class TestTGAuthServiceOnline {
// **
// private static final String PROPERTIES_FILE = "tgauth.test.textgridlab-org.properties";
// private static final String PROPERTIES_FILE = "tgauth.test.dev-textgridlab-org.properties";
private static final String PROPERTIES_FILE = "tgauth.test.test-textgridlab-org.properties";
private static final String PROPERTIES_FILE = "tgauth.test.dev-textgridlab-org.properties";
// private static final String PROPERTIES_FILE = "tgauth.test.test-textgridlab-org.properties";
private static final String NOT_YET_IMPLEMENTED = "test not yet implemented!";
private static final int TGEXTRA_CLIENT_TIMEOUT = 0;
private static final String ERROR = "\t??ERROR: ";
......@@ -199,60 +199,6 @@ public class TestTGAuthServiceOnline {
deleteProject();
}
// ---
@Test
public void argltest()
throws info.textgrid.namespaces.middleware.tgauth.AuthenticationFault, UnknownProjectFault {
System.out.println("--- ARGL BEGIN ---");
// Create getUserRole request.
GetUserRoleRequest req = new GetUserRoleRequest();
req.setAuth(rbacSessionId);
req.setLog(logParameter);
req.setProject(projectId);
System.out.println("\tsession ID: " + req.getAuth());
System.out.println("\tlog parameter: " + req.getLog());
System.out.println("\tproject: " + req.getProject());
System.out.println(TGAuthClientCommon.TABLINE);
System.out.println("--- GETUSERROLE ---");
GetUserRoleResponse response = tgextra.getUserRole(req);
System.out.println("--- DONE ---");
// Assemble ePPN list.
List<String> eppns = new ArrayList<String>();
for (UserRole role : response.getUserRole()) {
eppns.add(role.getUsername());
}
// Create getNames request and add ePPN list.
GetNamesRequest gnreq = new GetNamesRequest();
req.setAuth(rbacSessionId);
gnreq.setLog(logParameter);
gnreq.getEPPN().addAll(eppns);
System.out.println(gnreq.getEPPN());
System.out.println("--- GETNAMES ---");
GetNamesResponse res = tgextra.getNames(gnreq);
System.out.println("--- DONE ---");
System.out.println("size: " + res.getUserdetails().size());
for (UserDetail ud : res.getUserdetails()) {
System.out.println(TGAuthClientCommon.TABLINE);
System.out.println(ud.getEPPN());
System.out.println(ud.getMail());
System.out.println(ud.getName());
System.out.println(ud.getOrganisation());
}
System.out.println("--- ARGL END ---");
}
// **
// TEST BUGS
// **
......@@ -490,11 +436,15 @@ public class TestTGAuthServiceOnline {
int userListSize = res.getUserdetails().size();
// Get first (and only) entry for given ePPn.
int theFunkCount = 0;
if (userListSize != 0) {
System.out.println("\tuser details:");
for (UserDetail det : res.getUserdetails()) {
System.out.println("\t\t" + det.getEPPN() + " " + det.getMail() + " " + det.getName() + " "
+ det.getOrganisation() + " " + det.isAgreesearch() + " " + det.isUsersupplieddata());
if (det.getMail().contains(getMyUserAtrributesEmail)) {
theFunkCount++;
}
}
} else {
System.out.println("\tnothing found");
......@@ -505,8 +455,8 @@ public class TestTGAuthServiceOnline {
if (userListSize == 0) {
System.err.println(ERROR + "no users found containing " + trunk + "!");
assertTrue(false);
} else if (userListSize != 4) {
System.err.println(ERROR + "expecting 4 users" + trunk + "! Got only " + userListSize);
} else if (theFunkCount != 3) {
System.err.println(ERROR + "theFunkCount must be 3!");
assertTrue(false);
} else {
System.out.println(OK);
......@@ -541,11 +491,15 @@ public class TestTGAuthServiceOnline {
int userListSize = res.getUserdetails().size();
// Get first (and only) entry for given ePPn.
int theFunkCount = 0;
if (userListSize != 0) {
System.out.println("\tuser details:");
for (UserDetail det : res.getUserdetails()) {
System.out.println("\t\t" + det.getEPPN() + " " + det.getMail() + " " + det.getName() + " "
+ det.getOrganisation() + " " + det.isAgreesearch() + " " + det.isUsersupplieddata());
if (det.getMail().contains(getMyUserAtrributesEmail)) {
theFunkCount++;
}
}
} else {
System.out.println("nothing found");
......@@ -556,9 +510,10 @@ public class TestTGAuthServiceOnline {
if (userListSize == 0) {
System.err.println(ERROR + "no users found containing " + usernameSearch + "!");
assertTrue(false);
} else if (userListSize != 3) {
} else if (theFunkCount != 3) {
System.err
.println(ERROR + "expecting 3 users" + usernameSearch + "! Got only " + userListSize);
.println(ERROR + "expecting 3 users with email " + getMyUserAtrributesEmail + "! Got "
+ theFunkCount);
assertTrue(false);
} else {
System.out.println(OK);
......@@ -856,7 +811,7 @@ public class TestTGAuthServiceOnline {
public void testTgextraGetUserRole()
throws info.textgrid.namespaces.middleware.tgauth.AuthenticationFault, UnknownProjectFault {
System.out.println("TESTING #GETUSERROLE");
System.out.println("TESTING #GETUSERROLE username (ePPN) only");
GetUserRoleRequest req = new GetUserRoleRequest();
req.setAuth(rbacSessionId);
......@@ -882,6 +837,46 @@ public class TestTGAuthServiceOnline {
System.out.println(OK);
}
/**
* <p>
* Gets all roles a user has on the project.
* </p>
*
* @throws info.textgrid.namespaces.middleware.tgauth.AuthenticationFault
* @throws UnknownProjectFault
*/
@Test
public void testTgextraGetUserRoleWithREALNAME()
throws info.textgrid.namespaces.middleware.tgauth.AuthenticationFault, UnknownProjectFault {
System.out
.println(
"TESTING #GETUSERROLE username (ePPN) AND name (as of tgauth version 1.10.0-SNAPSHOT)");
GetUserRoleRequest req = new GetUserRoleRequest();
req.setAuth(rbacSessionId);
req.setLog(logParameter);
req.setProject(projectId);
System.out.println("\tsession ID: " + req.getAuth());
System.out.println("\tlog parameter: " + req.getLog());
System.out.println("\tproject: " + req.getProject());
System.out.println(TGAuthClientCommon.TABLINE);
GetUserRoleResponse response = tgextra.getUserRole(req);
for (UserRole role : response.getUserRole()) {
System.out.print("\troles for " + role.getUsername() + " (" + role.getName() + "): ");
for (String r : role.getRoles()) {
System.out.print(r + " ");
}
System.out.println();
}
System.out.println(TGAuthClientCommon.TABLINE);
System.out.println(OK);
}
/**
*
*/
......
......@@ -7,8 +7,8 @@
<name>TextGrid :: TGAuth</name>
<packaging>pom</packaging>
<properties>
<cxf.version>3.1.5</cxf.version>
<junit.version>4.8.1</junit.version>
<cxf.version>3.2.8</cxf.version>
<junit.version>4.12</junit.version>
</properties>
<repositories>
<repository>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment