Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions teamengine-core/src/main/java/com/occamlab/te/util/LogUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.UUID;
import java.util.logging.Level;
import java.util.logging.Logger;

Expand Down Expand Up @@ -500,6 +501,15 @@ public static String generateSessionId(File logDir) {
return session;
}

/**
* Generates a session identifier for REST sessions. This will be a random UUID as
* String.
* @return a session id string
*/
public static String generateRestSessionId() {
return UUID.randomUUID().toString();
}

/**
* Generate a file in logDir refererring all logfiles. Create a file called
* "report_logs.xml" in the log folder that includes all logs listed inside the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -356,13 +356,10 @@ private Source handleMultipartFormDataPost(String etsCode, String etsVersion, Fi
private Source executeTestRun(String etsCode, Map<String, List<String>> testRunArgs, String preferredMediaType) {

List<String> authCredentials = this.headers.getRequestHeader("Authorization");
String logDir = System.getProperty("TE_BASE") + FileSystems.getDefault().getSeparator() + "users"
+ FileSystems.getDefault().getSeparator() + TestRunUtils.getUserName(authCredentials)
+ FileSystems.getDefault().getSeparator() + "rest";
String logDir = System.getProperty("java.io.tmpdir");

if (null != logDir) {
String sessionId = LogUtils.generateSessionId(new File(logDir));

String sessionId = LogUtils.generateRestSessionId();
testRunArgs.put("logDir", List.of(logDir));
testRunArgs.put("sessionId", Collections.singletonList(sessionId));
}
Expand Down
11 changes: 8 additions & 3 deletions teamengine-web/src/main/webapp/createSession.jsp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<%@ page language="java" session="false"
import="java.util.*,com.occamlab.te.index.*,com.occamlab.te.config.*,com.occamlab.te.web.*"%><%!
import="java.util.*,java.io.*,com.occamlab.te.index.*,com.occamlab.te.config.*,com.occamlab.te.web.*,com.occamlab.te.util.*"%><%!
Config Conf = null;
List<String> organizationList = null;
Map<String, List<String>> standardMap = null;
Expand Down Expand Up @@ -196,7 +196,6 @@
}
}


function removeAllOptions(selectbox)
{
var i;
Expand Down Expand Up @@ -274,7 +273,13 @@
<body onload="fillOrganization()" >
<%@ include file="header.jsp"%>
<form name="standardsForm" action="test.jsp" method="post" >

<div><% String sessionId = LogUtils.generateSessionId(new File(Conf.getUsersDir(), request.getRemoteUser())); %>
Preparing session: <% out.println(sessionId); %><br/>
<% if(sessionId.equals("s0000")) {
out.println("Warning: You seem to have reached the maximum number of sessions. Starting the test might overwrite session s0000. Consider deleting sessions. <a href=\"viewSessions.jsp\">View sessions</a>");
}
%>
</div>
<h4> Select a test suite: </h4>

<table width="60%" >
Expand Down