本文整理汇总了Java中org.audit4j.handler.db.DatabaseAuditHandler.setEmbedded方法的典型用法代码示例。如果您正苦于以下问题:Java DatabaseAuditHandler.setEmbedded方法的具体用法?Java DatabaseAuditHandler.setEmbedded怎么用?Java DatabaseAuditHandler.setEmbedded使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.audit4j.handler.db.DatabaseAuditHandler
的用法示例。
在下文中一共展示了DatabaseAuditHandler.setEmbedded方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testConnectionPoolNormal
import org.audit4j.handler.db.DatabaseAuditHandler; //导入方法依赖的package包/类
@Test
public void testConnectionPoolNormal() {
DatabaseAuditHandler handler = new DatabaseAuditHandler();
handler.setEmbedded("true");
handler.setDb_connection_type("pooled");
handler.setDb_datasourceClass("org.hsqldb.jdbc.JDBCDataSource");
handler.init();
String actor = "Dummy Actor";
EventBuilder builder = new EventBuilder();
builder.addActor(actor).addAction("myMethod").addOrigin("Origin1").addField("myParam1Name", "param1")
.addField("myParam2Name", new Integer(2));
handler.setAuditEvent(builder.build());
try {
handler.handle();
handler.handle();
} catch (HandlerException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Assert.assertNotNull(getAuditTableRecordCount());
System.out.println("stopping handler");
handler.stop();
}
示例2: testConnectionPoolConnections
import org.audit4j.handler.db.DatabaseAuditHandler; //导入方法依赖的package包/类
@Test
public void testConnectionPoolConnections() {
DatabaseAuditHandler handler = new DatabaseAuditHandler();
handler.setEmbedded("true");
handler.setDb_connection_type("pooled");
handler.setDb_datasourceClass("org.hsqldb.jdbc.JDBCDataSource");
handler.setDb_pool_maximumPoolSize(5);
handler.init();
String actor = "Dummy Actor";
EventBuilder builder = new EventBuilder();
builder.addActor(actor).addAction("myMethod").addOrigin("Origin1").addField("myParam1Name", "param1")
.addField("myParam2Name", new Integer(2));
handler.setAuditEvent(builder.build());
try {
handler.handle();
handler.handle();
handler.handle();
handler.handle();
handler.handle();
handler.handle();
handler.handle();
handler.handle();
handler.handle();
handler.handle();
} catch (HandlerException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Assert.assertNotNull(getAuditTableRecordCount());
System.out.println("stopping handler");
handler.stop();
}
示例3: testConnectionPoolParams
import org.audit4j.handler.db.DatabaseAuditHandler; //导入方法依赖的package包/类
@Test
public void testConnectionPoolParams() {
DatabaseAuditHandler handler = new DatabaseAuditHandler();
handler.setEmbedded("true");
handler.setDb_connection_type("pooled");
handler.setDb_datasourceClass("org.hsqldb.jdbc.JDBCDataSource");
handler.setDb_pool_maximumPoolSize(5);
handler.setDb_pool_autoCommit(false);
handler.setDb_pool_connectionTimeout(10000L);
handler.setDb_pool_idleTimeout(20000);
handler.setDb_pool_maxLifetime(40000);
handler.setDb_pool_minimumIdle(20000);
handler.init();
String actor = "Dummy Actor";
EventBuilder builder = new EventBuilder();
builder.addActor(actor).addAction("myMethod").addOrigin("Origin1").addField("myParam1Name", "param1")
.addField("myParam2Name", new Integer(2));
handler.setAuditEvent(builder.build());
try {
handler.handle();
handler.handle();
} catch (HandlerException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Assert.assertNotNull(getAuditTableRecordCount());
System.out.println("stopping handler");
handler.stop();
}
示例4: databaseHandler
import org.audit4j.handler.db.DatabaseAuditHandler; //导入方法依赖的package包/类
@Bean
public DatabaseAuditHandler databaseHandler() {
DatabaseAuditHandler dbHandler = new DatabaseAuditHandler();
dbHandler.setEmbedded("true");
return dbHandler;
}