@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"); }
@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"); }
@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); }
@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"); }