@Test(expected = CanNotDeleteException.class) public void testDeleteS() { // 判断有异态的情况,如果有异态,则不能删除 assertRowsCount(Operation.class, 5); // 业务删除 assertRowsCount(OperationS.class, 3); // 业务删除 operationService.delete(3L); assertRowsCount(Operation.class, 5); // 业务删除 assertRowsCount(OperationS.class, 3); // 业务删除 }
@Test(expected = CanNotDeleteException.class) public void testDelete() { // 其他信息不受影响,运行图级联删除,通路不变 operationService.delete(2L); this.flushSessionAndCloseSessionAndNewASession(); assertRowsCount(Program.class, 5); // 节目不受影响 assertRowsCount(Operation.class, 4); // 业务删除 assertRowsCount(OperationT.class, 0); // 业务删除 assertRowsCount(Channel.class, 2); // 通路不受影响 assertRowsCount(Schedule.class, 3); }
@Test public void testSaveP() { OperationP op = new OperationP( "a", new TransmitDef(17L), new TransType(1L), 1.1, 1.1, new Date(), new Date(), "wj", new Program(1L)); operationService.save(op); this.flushSessionAndCloseSessionAndNewASession(); assertRowsCount(OperationP.class, 2); }
@Test public void testSaveS() { OperationS op = new OperationS( "a", new TransmitDef(17L), new TransType(1L), 1.1, 1.1, new Date(), new Date(), "wj", new Cawave(1L), new Transfer(1L)); operationService.save(op); this.flushSessionAndCloseSessionAndNewASession(); assertRowsCount(OperationS.class, 4); }
@Test(expected = CanNotDeleteException.class) public void testDeleteP2() { assertRowsCount(Operation.class, 5); // 业务删除 operationService.delete(1L); assertRowsCount(Operation.class, 5); // 业务删除 }