update SimpleJNDIUnitTest

This commit is contained in:
azhwani
2020-06-10 10:34:38 +01:00
parent 5d370c576d
commit bcb8e3e727

View File

@@ -6,6 +6,7 @@ import javax.naming.Context;
import javax.naming.InitialContext;
import javax.sql.DataSource;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@@ -15,6 +16,12 @@ public class SimpleJNDIUnitTest {
@BeforeEach
public void setup() throws Exception {
System.setProperty("java.naming.factory.initial", "org.osjava.sj.SimpleContextFactory");
System.setProperty("org.osjava.sj.root", "file://src/test/resources");
System.setProperty("org.osjava.sj.delimiter", ".");
System.setProperty("jndi.syntax.separator", "/");
System.setProperty("org.osjava.sj.space", "java:/comp/env");
this.initContext = new InitialContext();
}
@@ -26,5 +33,16 @@ public class SimpleJNDIUnitTest {
assertEquals(dsString, ds.toString());
}
@AfterEach
public void tearDown() throws Exception {
System.clearProperty("java.naming.factory.initial");
System.clearProperty("org.osjava.sj.root");
System.clearProperty("org.osjava.sj.delimiter");
System.clearProperty("jndi.syntax.separator");
System.clearProperty("org.osjava.sj.space");
this.initContext = null;
}
}