Skip to content
Snippets Groups Projects
Commit 51acd730 authored by pkupczyk's avatar pkupczyk
Browse files

SP-824 / BIS-518 : Logs - improve logging of service calls

SVN: 29684
parent 8fa7a386
No related branches found
No related tags found
No related merge requests found
......@@ -64,8 +64,9 @@ public class ParameterMap
{
String parameter = event.substring(0, event.lastIndexOf("-"));
String value = event.substring(event.lastIndexOf("-") + 1);
IValueFilter filter = filters.get(parameter);
if (filters.get(parameter).isValid(value))
if (filter != null && filter.isValid(value))
{
values.put(parameter, value);
}
......
......@@ -47,7 +47,7 @@ public class ControlFileReaderTest
}
@Test
public void testSwitchOnAndOff() throws IOException
public void testSwitchLogServiceCallStart() throws IOException
{
ControlFileReader reader = new ControlFileReader(getControlFileDirectory(), -1);
Assert.assertFalse(reader.isLogServiceCallStartEnabled());
......@@ -60,15 +60,39 @@ public class ControlFileReaderTest
}
@Test
public void testWithNotExistingControlFileDirectory() throws IOException
public void testSwitchLogServiceCallStartWithValueInDifferentCase() throws IOException
{
ControlFileReader reader = new ControlFileReader(new File(getControlFileDirectory(), "notExisting"), -1);
ControlFileReader reader = new ControlFileReader(getControlFileDirectory(), -1);
Assert.assertFalse(reader.isLogServiceCallStartEnabled());
new File(getControlFileDirectory(), "log-service-call-start-on").createNewFile();
new File(getControlFileDirectory(), "log-service-call-start-On").createNewFile();
Assert.assertTrue(reader.isLogServiceCallStartEnabled());
}
@Test
public void testSwitchLogServiceCallStartWithIncorrectValue() throws IOException
{
ControlFileReader reader = new ControlFileReader(getControlFileDirectory(), -1);
Assert.assertFalse(reader.isLogServiceCallStartEnabled());
new File(getControlFileDirectory(), "log-service-call-start-off").createNewFile();
new File(getControlFileDirectory(), "log-service-call-start-incorrect-value").createNewFile();
Assert.assertFalse(reader.isLogServiceCallStartEnabled());
}
@Test
public void testGetLogServiceCallStartWithNotExistingControlDirectory() throws IOException
{
File notExistingFile = new File(getControlFileDirectory(), "notExisting");
ControlFileReader reader = new ControlFileReader(notExistingFile, -1);
Assert.assertFalse(reader.isLogServiceCallStartEnabled());
}
@Test
public void testGetLogServiceCallStartWithControlDirectoryThatIsAFile() throws IOException
{
File file = new File(getControlFileDirectory(), "aFile");
file.createNewFile();
ControlFileReader reader = new ControlFileReader(file, -1);
Assert.assertFalse(reader.isLogServiceCallStartEnabled());
}
......
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