當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。