summaryrefslogtreecommitdiffstats
path: root/utils/webseal-simulator/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'utils/webseal-simulator/src/main')
-rw-r--r--utils/webseal-simulator/src/main/java/org/openecomp/sdc/webseal/simulator/Login.java2
-rw-r--r--utils/webseal-simulator/src/main/java/org/openecomp/sdc/webseal/simulator/RequestsClient.java19
2 files changed, 10 insertions, 11 deletions
diff --git a/utils/webseal-simulator/src/main/java/org/openecomp/sdc/webseal/simulator/Login.java b/utils/webseal-simulator/src/main/java/org/openecomp/sdc/webseal/simulator/Login.java
index 78aca50e95..0f6cd8a5c4 100644
--- a/utils/webseal-simulator/src/main/java/org/openecomp/sdc/webseal/simulator/Login.java
+++ b/utils/webseal-simulator/src/main/java/org/openecomp/sdc/webseal/simulator/Login.java
@@ -111,7 +111,7 @@ public class Login extends HttpServlet {
System.out.println("Login -> doPOst userId=" + userId);
User user = getUser(userId, password);
if (user == null) {
- response.sendError(500, "ERROR: userId or password incorect");
+ response.sendError(500, "ERROR: userId or password incorrect");
// doGet(request, response);
} else {
System.out.println("Login -> doPOst redirext to /sdc1 (to proxy)");
diff --git a/utils/webseal-simulator/src/main/java/org/openecomp/sdc/webseal/simulator/RequestsClient.java b/utils/webseal-simulator/src/main/java/org/openecomp/sdc/webseal/simulator/RequestsClient.java
index a5e4a8a0eb..4cfacecb12 100644
--- a/utils/webseal-simulator/src/main/java/org/openecomp/sdc/webseal/simulator/RequestsClient.java
+++ b/utils/webseal-simulator/src/main/java/org/openecomp/sdc/webseal/simulator/RequestsClient.java
@@ -26,12 +26,10 @@ public class RequestsClient extends HttpServlet {
@Override
protected void doGet(final HttpServletRequest request, final HttpServletResponse response) throws ServletException, IOException {
- String hostname = request.getParameter("hostname") != null ? request.getParameter("hostname") : "127.0.0.1";
- String port = request.getParameter("port") != null ? request.getParameter("port") : "8080";
String adminId = request.getParameter("adminId") != null ? request.getParameter("adminId") : "jh0003";
-
String createAll = request.getParameter("all");
-
+ String url = Conf.getInstance().getFeHost() + "/sdc1/feProxy/rest/v1/user";
+
PrintWriter writer = response.getWriter();
int resultCode;
@@ -39,7 +37,7 @@ public class RequestsClient extends HttpServlet {
if ("true".equals(createAll)) {
Map<String, User> users = Conf.getInstance().getUsers();
for (User user : users.values()) {
- resultCode = createUser(response, user.getUserId(), user.getRole().toUpperCase(), user.getFirstName(), user.getLastName(), user.getEmail(), hostname, port, adminId);
+ resultCode = createUser(response, user.getUserId(), user.getRole().toUpperCase(), user.getFirstName(), user.getLastName(), user.getEmail(), url, adminId);
writer.println("User "+ user.getFirstName() + " " + user.getLastName() + getResultMessage(resultCode) + "<br>");
}
} else {
@@ -48,7 +46,9 @@ public class RequestsClient extends HttpServlet {
String firstName = request.getParameter("firstName");
String lastName = request.getParameter("lastName");
String email = request.getParameter("email");
- resultCode = createUser(response, userId, role, firstName, lastName, email, hostname, port, adminId);
+
+ resultCode = createUser(response, userId, role, firstName, lastName, email, url, adminId);
+
writer.println("User "+ firstName + " " + lastName +getResultMessage(resultCode));
}
@@ -60,12 +60,11 @@ public class RequestsClient extends HttpServlet {
return 201 == resultCode? " created successfuly":" not created ("+ resultCode +")";
}
- private int createUser(final HttpServletResponse response, String userId, String role, String firstName, String lastName, String email, String hostname, String port, String adminId) throws IOException {
+ private int createUser(final HttpServletResponse response, String userId, String role, String firstName, String lastName, String email, String url, String adminId) throws IOException {
response.setContentType("text/html");
- // Fill the data of the request
- String url = "http://" + hostname + ":" + port + "/sdc2/rest/v1/user";
- String body = "{'firstName':'" + firstName + "', 'lastName':'" + lastName + "', 'userId':'" + userId + "', 'email':'" + email + "','role':'" + role + "'}";
+ String body = "{\"firstName\":\"" + firstName + "\", \"lastName\":\"" + lastName + "\", \"userId\":\"" + userId + "\", \"email\":\"" + email + "\",\"role\":\"" + role + "\"}";
+
HashMap<String, String> headers = new HashMap<String, String>();
headers.put("Content-Type", "application/json");
headers.put("USER_ID", adminId);