当前位置: 首页>>代码示例>>Java>>正文


Java DatabaseAuditHandler类代码示例

本文整理汇总了Java中org.audit4j.handler.db.DatabaseAuditHandler的典型用法代码示例。如果您正苦于以下问题:Java DatabaseAuditHandler类的具体用法?Java DatabaseAuditHandler怎么用?Java DatabaseAuditHandler使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


DatabaseAuditHandler类属于org.audit4j.handler.db包,在下文中一共展示了DatabaseAuditHandler类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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();
}
 
开发者ID:audit4j,项目名称:audit4j-db,代码行数:25,代码来源:ConnectionPoolIntTest.java

示例2: testInitWithPooled

import org.audit4j.handler.db.DatabaseAuditHandler; //导入依赖的package包/类
@Test
public void testInitWithPooled() {
    DatabaseAuditHandler handler = new DatabaseAuditHandler();
    handler.setDb_connection_type("pooled");
    handler.setDb_datasourceClass("org.hsqldb.jdbc.JDBCDataSource");
    handler.init();
    handler.stop();
}
 
开发者ID:audit4j,项目名称:audit4j-db,代码行数:9,代码来源:DBHandlerEmbededInitIntTest.java

示例3: 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();
}
 
开发者ID:audit4j,项目名称:audit4j-db,代码行数:34,代码来源:ConnectionPoolIntTest.java

示例4: 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();
}
 
开发者ID:audit4j,项目名称:audit4j-db,代码行数:31,代码来源:ConnectionPoolIntTest.java

示例5: testRepositoryTag

import org.audit4j.handler.db.DatabaseAuditHandler; //导入依赖的package包/类
@Test
public void testRepositoryTag() {
    handler = new DatabaseAuditHandler();
    handler.setSeparate(true);
    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));
    AuditEvent event = builder.build();
    event.setRepository("test");

    handler.setAuditEvent(event);

    try {
        handler.handle();
    } catch (HandlerException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

    List<String> tables = getTableList();
    assertTrue(tables.contains("TEST_AUDIT"));
    assertTrue(getTableRecordCount("TEST_AUDIT") > 0);
    System.out.println(getTableRecordCount("TEST_AUDIT"));

    System.out.println("sd");
    System.out.println(tables.toString());
    dropTableIfExists("TEST_AUDIT");
}
 
开发者ID:audit4j,项目名称:audit4j-db,代码行数:32,代码来源:RepositoryIntTests.java

示例6: testTestRepositoryPrefixAndSuffix

import org.audit4j.handler.db.DatabaseAuditHandler; //导入依赖的package包/类
@Test
public void testTestRepositoryPrefixAndSuffix() {

    handler = new DatabaseAuditHandler();
    handler.setSeparate(true);
    handler.setTable_prefix("testprefix");
    handler.setTable_suffix("testsuffix");
    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));
    AuditEvent event = builder.build();
    event.setRepository("test");

    handler.setAuditEvent(event);

    try {
        handler.handle();
    } catch (HandlerException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

    List<String> tables = getTableList();

    System.out.println(tables.toString());
    assertTrue(tables.contains("TESTPREFIX_TEST_TESTSUFFIX"));
    assertTrue(getTableRecordCount("TESTPREFIX_TEST_TESTSUFFIX") > 0);
    System.out.println(getTableRecordCount("TESTPREFIX_TEST_TESTSUFFIX"));

    System.out.println("sd");
    System.out.println(tables.toString());
    dropTableIfExists("TESTPREFIX_TEST_TESTSUFFIX");
}
 
开发者ID:audit4j,项目名称:audit4j-db,代码行数:37,代码来源:RepositoryIntTests.java

示例7: databaseHandler

import org.audit4j.handler.db.DatabaseAuditHandler; //导入依赖的package包/类
@Bean
public DatabaseAuditHandler databaseHandler() {
    DatabaseAuditHandler dbHandler = new DatabaseAuditHandler();
    dbHandler.setEmbedded("true");
    return dbHandler;
}
 
开发者ID:nipunthathsara,项目名称:Audit4j-Hibernate,代码行数:7,代码来源:AuditConfig.java

示例8: testInitWithDefaultMode

import org.audit4j.handler.db.DatabaseAuditHandler; //导入依赖的package包/类
@Test
public void testInitWithDefaultMode() {
    DatabaseAuditHandler handler = new DatabaseAuditHandler();
    handler.init();
    handler.stop();
}
 
开发者ID:audit4j,项目名称:audit4j-db,代码行数:7,代码来源:DBHandlerEmbededInitIntTest.java

示例9: setup

import org.audit4j.handler.db.DatabaseAuditHandler; //导入依赖的package包/类
@Before
public void setup() {
    handler = new DatabaseAuditHandler();
    handler.init();
}
 
开发者ID:audit4j,项目名称:audit4j-db,代码行数:6,代码来源:DBHandlerEmbededHandleIntTest.java


注:本文中的org.audit4j.handler.db.DatabaseAuditHandler类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。