public void testSerializableWithoutPreviousUsage() throws Exception { ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("annotationDrivenProxyTargetClassTests.xml", getClass()); TransactionalService service = context.getBean("service", TransactionalService.class); service = (TransactionalService) SerializationTestUtils.serializeAndDeserialize(service); service.setSomething("someName"); }
private void doTestWithMultipleTransactionManagers(ApplicationContext context) { CallCountingTransactionManager tm1 = context.getBean("transactionManager1", CallCountingTransactionManager.class); CallCountingTransactionManager tm2 = context.getBean("transactionManager2", CallCountingTransactionManager.class); TransactionalService service = context.getBean("service", TransactionalService.class); assertTrue(AopUtils.isCglibProxy(service)); service.setSomething("someName"); assertEquals(1, tm1.commits); assertEquals(0, tm2.commits); service.doSomething(); assertEquals(1, tm1.commits); assertEquals(1, tm2.commits); service.setSomething("someName"); assertEquals(2, tm1.commits); assertEquals(1, tm2.commits); service.doSomething(); assertEquals(2, tm1.commits); assertEquals(2, tm2.commits); }