Skip to content
Snippets Groups Projects
Commit 40df26be authored by felmer's avatar felmer
Browse files

make SetSessionUserTest more robust

parent 8adb90a2
No related branches found
No related tags found
No related merge requests found
......@@ -16,6 +16,7 @@
package ch.systemsx.cisd.openbis.systemtest;
import static ch.systemsx.cisd.common.test.AssertionUtil.assertContains;
import static org.testng.AssertJUnit.assertEquals;
import static org.testng.AssertJUnit.assertTrue;
import static org.testng.AssertJUnit.fail;
......@@ -29,6 +30,7 @@ import org.testng.annotations.Test;
import ch.systemsx.cisd.common.exceptions.AuthorizationFailureException;
import ch.systemsx.cisd.common.exceptions.UserFailureException;
import ch.systemsx.cisd.common.logging.BufferedAppender;
import ch.systemsx.cisd.common.test.AssertionUtil;
import ch.systemsx.cisd.openbis.generic.server.WhiteListBasedRemoteHostValidator;
import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ListSampleCriteria;
import ch.systemsx.cisd.openbis.generic.shared.basic.dto.SampleType;
......@@ -118,22 +120,13 @@ public class SetSessionUserTest extends SystemTestCase
commonServer.setSessionUser(sessionToken, "observer");
String logContentRaw = logRecorder.getLogContent();
String[] logContent = logContentRaw.split("\n");
assertEquals(logContentRaw, 4, logContent.length);
String logLine = logContent[3];
assertTrue("Following log line does start as expected: " + logLine,
logLine.startsWith("[USER:'test' SPACE:'CISD' HOST:'localhost'"));
assertTrue("Following log line does end as expected: " + logLine,
logLine.endsWith("set_session_user USER('observer')"));
assertContains("[USER:'test' SPACE:'CISD' HOST:'localhost'", logContentRaw);
assertContains("set_session_user USER('observer')", logContentRaw);
commonServer.logout(sessionToken);
String logContentRaw2 = logRecorder.getLogContent();
logContent = logContentRaw2.split("\n");
assertEquals("Log content: " + logContentRaw2, 8, logContent.length);
logLine = logContent[6];
assertEquals("Log content: " + logContentRaw2, "LOGOUT: Session '" + sessionToken
+ "' of user 'observer' has been closed.", logLine);
assertContains("LOGOUT: Session '" + sessionToken + "' of user 'observer' has been closed.", logContentRaw2);
}
@Test
......
......@@ -23,7 +23,7 @@ use-ssl = false
session-timeout = 30
# Path to the keystore
keystore.path = dist/etc/openBIS.keystore
keystore.path = ../datastore_server/dist/etc/openBIS.keystore
# Password of the keystore
keystore.password = changeit
# Key password of the keystore
......
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