Test DBStorages without Lifecycle objects

Contains useful source code for specific use cases.

Test DBStorages without Lifecycle objects

Postby Development@SIB » Sun Mar 20, 2011 3:08 pm

Access a DBStorage without JVx Server, Lifecycle Object, Security e.g. for Unit tests

Code: Select all
//configure DB access
DBAccess dba = new DBAccess();
dba.setUrl("...");
dba.setUsername("user");
dba.setPassword("pwd");
dba.open();
      
//configure storage for Table USERS
DBStorage dbs = new DBStorage();
dbs.setFromClause("USERS");
dbs.setDBAccess(dba);
dbs.open();
      
//direct object connection for direct method calls
DirectObjectConnection con = new DirectObjectConnection();
con.put("users", dbs);

//client connection for RemoteDataBook access to the storage
MasterConnection macon = new MasterConnection(con);
macon.open();

RemoteDataSource rds = new RemoteDataSource(macon);
rds.open();

RemoteDataBook rdbApps = new RemoteDataBook();
rdbApps.setDataSource(rds);
rdbApps.setName("users");
rdbApps.open();
User avatar
Development@SIB
 
Posts: 311
Joined: Mon Sep 28, 2009 1:54 pm

Return to Code snippets