Пример #1
0
  @Test
  public void testAduitInsertObject() throws Exception {
    ParameterGroup parameterGroup = new ParameterGroup();
    parameterGroup.setParamGroup("TEST_AUDIT");
    parameterGroup.setDescription("Audit Desc");

    parameterGroupDao.persist(parameterGroup);
    parameterGroupDao.flush();

    // oldObject will send null in case INSERT
    auditService.callAuditing(null, parameterGroup, "TEST_USER");
  }
Пример #2
0
  @Test
  public void testAduditUpdateObject() throws Exception {
    ParameterGroup parameterGroup = parameterGroupDao.findOne(24L);
    ParameterGroup oldParameterGroup = AuditUtil.getStateObject(parameterGroup);

    parameterGroup.setParamGroup("TEST_AUDIT_edit");
    parameterGroup.setDescription("Audit Desc_edit");

    parameterGroupDao.merge(parameterGroup);
    parameterGroupDao.flush();

    // Send oldObject and newObject for compare
    auditService.callAuditing(oldParameterGroup, parameterGroup, "TEST_USER2");
  }
Пример #3
0
  @Test
  public void testAuditPLInsertObject() throws SQLException {
    ParameterGroup parameterGroup = new ParameterGroup();
    parameterGroup.setParamGroup("TEST_AUDIT_PL");
    parameterGroup.setDescription("Audit Desc PL");

    parameterGroupDao.persist(parameterGroup);
    parameterGroupDao.flush();

    Long auditId = auditDetailDao.getNextSequence();
    auditDetailDao.insertAuditDetailByPL(
        auditService.getTableName(parameterGroup),
        parameterGroup.getParamGroupId().toString(),
        "TEST_PL",
        auditId);
  }
Пример #4
0
  @Transactional
  @Test
  public void testAuditPLUpdateObject() throws SQLException {
    ParameterGroup parameterGroup = parameterGroupDao.findOne(25L);
    parameterGroup.setParamGroup("TEST_AUDIT_PL_edit3");
    parameterGroup.setDescription("Audit Desc_PL_edit4");

    Long auditId = auditDetailDao.getNextSequence();
    auditDetailDao.beforeUpdateAuditDetailByPL(
        auditService.getTableName(parameterGroup), parameterGroup.getParamGroupId().toString());
    parameterGroupDao.merge(parameterGroup);
    parameterGroupDao.flush();
    auditDetailDao.afterUpdateAuditDetailByPL(
        auditService.getTableName(parameterGroup),
        parameterGroup.getParamGroupId().toString(),
        auditId,
        "TEST_PL2");
  }