Skip to content

Commit

Permalink
Merge pull request #56 from BartRobeyns/tests_with_default_configuration
Browse files Browse the repository at this point in the history
Tests shouldn't rely on an audit4j.conf.yml file in user's home dir
  • Loading branch information
janithb authored Nov 29, 2017
2 parents 21af9d7 + 6cfd912 commit ed2ffd8
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/main/java/org/audit4j/core/Configurations.java
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ static ConfigurationStream resolveConfigFileAsStream(String configFilePath) thro
fileStream = getClasspathResourceAsStream(CONFIG_FILE_NAME + "." + XML_EXTENTION);
fileExtention = XML_EXTENTION;
} else {

String defaultConfigDir = System.getProperty("user.dir");
String defaultConfigPath = scanConfigFile(defaultConfigDir);
fileExtention = FilenameUtils.getExtension(defaultConfigPath);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.lang.reflect.Method;

import org.audit4j.core.AuditManager;
import org.audit4j.core.Configuration;
import org.audit4j.core.IAuditManager;
import org.audit4j.core.Mock.MethodAnnotationMock;
import org.junit.After;
Expand All @@ -13,7 +14,7 @@ public class DeIdentifyAnnotationTest {

@Before
public void setup() {

AuditManager.startWithConfiguration(Configuration.DEFAULT);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.lang.reflect.Method;

import org.audit4j.core.AuditManager;
import org.audit4j.core.Configuration;
import org.audit4j.core.IAuditManager;
import org.audit4j.core.Mock.ClassAnnotationMock;
import org.audit4j.core.util.Log;
Expand All @@ -15,7 +16,7 @@ public class IgnoreAuditAnnotationTest {

@Before
public void setup() {

AuditManager.startWithConfiguration(Configuration.DEFAULT);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.lang.reflect.Method;

import org.audit4j.core.AuditManager;
import org.audit4j.core.Configuration;
import org.audit4j.core.Mock.MethodAnnotationMock;
import org.audit4j.core.util.Log;
import org.audit4j.core.util.StopWatch;
Expand All @@ -14,7 +15,7 @@ public class MethodAnnotationTest {

@Before
public void setup() {
AuditManager.getInstance();
AuditManager.startWithConfiguration(Configuration.DEFAULT);
}

@Test
Expand Down
7 changes: 7 additions & 0 deletions src/test/java/org/audit4j/core/smoke/SmokeTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,22 @@
import java.util.concurrent.TimeUnit;

import org.audit4j.core.AuditManager;
import org.audit4j.core.Configuration;
import org.audit4j.core.IAuditManager;
import org.audit4j.core.dto.AuditEvent;
import org.audit4j.core.dto.EventBuilder;
import org.audit4j.core.util.Log;
import org.audit4j.core.util.StopWatch;
import org.junit.Before;
import org.junit.Test;

public class SmokeTest {

@Before
public void setup() {
AuditManager.startWithConfiguration(Configuration.DEFAULT);
}

@Test
public void smokeTestAuditEvent() throws InterruptedException {
StopWatch watch = new StopWatch();
Expand Down

0 comments on commit ed2ffd8

Please sign in to comment.