aboutsummaryrefslogtreecommitdiffstats
path: root/utils/webseal-simulator
diff options
context:
space:
mode:
authorLior Nachmias <ln699k@att.com>2018-02-26 18:21:23 +0200
committerMichael Lando <ml636r@att.com>2018-02-28 07:34:47 +0000
commitbc169d4b132891052cc8c642e18e642afd04464f (patch)
tree781768e4d3543568fa0d7f4347b8f3533fe82bac /utils/webseal-simulator
parent474996af323373c128ce32bcf404174b3352933d (diff)
Webseal fix
Change-Id: Ic6de1f490e72b05b057d246dd70a2eae6524458d Issue-ID: SDC-550 Signed-off-by: Lior Nachmias <ln699k@att.com>
Diffstat (limited to 'utils/webseal-simulator')
-rw-r--r--utils/webseal-simulator/sdc-simulator/startup.sh1
-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
3 files changed, 11 insertions, 11 deletions
diff --git a/utils/webseal-simulator/sdc-simulator/startup.sh b/utils/webseal-simulator/sdc-simulator/startup.sh
index 48b6a0d505..029126d183 100644
--- a/utils/webseal-simulator/sdc-simulator/startup.sh
+++ b/utils/webseal-simulator/sdc-simulator/startup.sh
@@ -11,6 +11,7 @@ if [[ $rc != 0 ]]; then
fi
JAVA_OPTIONS=" ${JAVA_OPTIONS} \
+ -Xdebug -agentlib:jdwp=transport=dt_socket,address=5000,server=y,suspend=n -Xmx128m -Xms128m -Xss1m \
-Dconfig.home=${JETTY_BASE}/config/sdc-simulator \
-Dlog.home=${JETTY_BASE}/logs \
-Dlogback.configurationFile=${JETTY_BASE}/config/sdc-simulator/logback.xml \
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);