use of org.eclipse.jetty.security.JDBCLoginService in project jetty.project by eclipse.
the class JdbcLoginServiceTest method setUp.
@BeforeClass
public static void setUp() throws Exception {
_docRoot = MavenTestingUtils.getTargetTestingDir("loginservice-test");
FS.ensureDirExists(_docRoot);
File content = new File(_docRoot, "input.txt");
try (FileOutputStream out = new FileOutputStream(content)) {
out.write(_content.getBytes("utf-8"));
}
//drop any tables that might have existed
File scriptFile = MavenTestingUtils.getTestResourceFile("droptables.sql");
int result = DatabaseLoginServiceTestServer.runscript(scriptFile);
//ignore result, if the tables dont already exist, derby spits out an error
//create the tables afresh
scriptFile = MavenTestingUtils.getTestResourceFile("createdb.sql");
result = DatabaseLoginServiceTestServer.runscript(scriptFile);
assertThat("runScript result", result, is(0));
File jdbcRealmFile = MavenTestingUtils.getTestResourceFile("jdbcrealm.properties");
LoginService loginService = new JDBCLoginService(__realm, jdbcRealmFile.getAbsolutePath());
_testServer = new DatabaseLoginServiceTestServer();
_testServer.setResourceBase(_docRoot.getAbsolutePath());
_testServer.setLoginService(loginService);
_testServer.start();
_baseUri = _testServer.getBaseUri();
}
Aggregations