Exemple #1
0
        public void DeclarativeWithAttributes()
        {
            ITestObjectManager mgr = ctx["testObjectManager"] as ITestObjectManager;
            TestObjectDao      dao = (TestObjectDao)ctx["testObjectDao"];

            TransactionTemplateTests.PerformOperations(mgr, dao);
        }
        public static void PerformOperations(ITestObjectManager mgr,
            ITestObjectDao dao)
        {
            Assert.IsNotNull(mgr);
            TestObject to1 = new TestObject();
            to1.Name = "Jack";
            to1.Age = 7;
            TestObject to2 = new TestObject();
            to2.Name = "Jill";
            to2.Age = 8;
            mgr.SaveTwoTestObjects(to1, to2);

            TestObject to = dao.FindByName("Jack");
            Assert.IsNotNull(to);

            to = dao.FindByName("Jill");
            Assert.IsNotNull(to);
            Assert.AreEqual("Jill", to.Name);

            mgr.DeleteTwoTestObjects("Jack", "Jill");

            to = dao.FindByName("Jack");
            Assert.IsNull(to);

            to = dao.FindByName("Jill");
            Assert.IsNull(to);
        }
Exemple #3
0
        public void DeclarativeViaAutoProxyCreator()
        {
            ITestObjectManager mgr = ctx["testObjectManager"] as ITestObjectManager;
            TestObjectDao      dao = (TestObjectDao)ctx["testObjectDao"];

            PerformOperations(mgr, dao);
        }
Exemple #4
0
        public void DeclarativeViaTransactionProxyFactoryObject()
        {
            ITestObjectManager mgr = ctx["testObjectManagerTP"] as ITestObjectManager;
            ITestObjectDao     dao = (ITestObjectDao)ctx["testObjectDao"];

            PerformOperations(mgr, dao);
        }
Exemple #5
0
        public void DeclarativeViaProxyFactoryObject()
        {
            ITestObjectManager mgr = ctx["testObjectManagerPF"] as ITestObjectManager;
            TestObjectDao      dao = (TestObjectDao)ctx["testObjectDao"];

            PerformOperations(mgr, dao);
        }
Exemple #6
0
        public static void PerformOperations(ITestObjectManager mgr,
                                             ITestObjectDao dao)
        {
            Assert.IsNotNull(mgr);
            TestObject to1 = new TestObject();

            to1.Name = "Jack";
            to1.Age  = 7;
            TestObject to2 = new TestObject();

            to2.Name = "Jill";
            to2.Age  = 8;
            mgr.SaveTwoTestObjects(to1, to2);

            TestObject to = dao.FindByName("Jack");

            Assert.IsNotNull(to);

            to = dao.FindByName("Jill");
            Assert.IsNotNull(to);
            Assert.AreEqual("Jill", to.Name);

            mgr.DeleteTwoTestObjects("Jack", "Jill");

            to = dao.FindByName("Jack");
            Assert.IsNull(to);

            to = dao.FindByName("Jill");
            Assert.IsNull(to);
        }
Exemple #7
0
        public void TearDown()
        {
            ITestObjectManager testObjectManager = ctx["testObjectManager"] as ITestObjectManager;

            testObjectManager.DeleteTwoTestObjects("Jack", "Jill");
            testObjectManager.DeleteAllTestObjects();
        }
        public void RollbackTestSetup()
        {
            // WELLKNOWN
//            NamespaceParserRegistry.RegisterParser(typeof (DatabaseNamespaceParser));
//            NamespaceParserRegistry.RegisterParser(typeof (TxNamespaceParser));
//            NamespaceParserRegistry.RegisterParser(typeof (AopNamespaceParser));
            IApplicationContext ctx =
                new XmlApplicationContext(
                    "assembly://Spring.Data.Integration.Tests/Spring.Data/TestTxIsolationLevel.xml");
            Assert.IsNotNull(ctx);
            testObjectManager = ctx["testObjectManager"] as ITestObjectManager;
            Assert.IsNotNull(testObjectManager);
        }
Exemple #9
0
        public void SetUp()
        {
            ctx =
                new XmlApplicationContext("assembly://Spring.Data.Integration.Tests/Spring.Data/templateTests.xml");
            dbProvider         = ctx["DbProvider"] as IDbProvider;
            transactionManager = ctx["transactionManager"] as IPlatformTransactionManager;
            adoOperations      = ctx["adoTemplate"] as IAdoOperations;

            ITestObjectManager testObjectManager = ctx["testObjectManager"] as ITestObjectManager;

            testObjectManager.DeleteAllTestObjects();
            testObjectManager.SaveTwoTestObjects(new TestObject("Jack", 10), new TestObject("Jill", 20));
        }
Exemple #10
0
        public void RollbackTestSetup()
        {
            // WELLKNOWN
//            NamespaceParserRegistry.RegisterParser(typeof (DatabaseNamespaceParser));
//            NamespaceParserRegistry.RegisterParser(typeof (TxNamespaceParser));
//            NamespaceParserRegistry.RegisterParser(typeof (AopNamespaceParser));
            IApplicationContext ctx =
                new XmlApplicationContext(
                    "assembly://Spring.Data.Integration.Tests/Spring.Data/TestTxIsolationLevel.xml");

            Assert.IsNotNull(ctx);
            testObjectManager = ctx["testObjectManager"] as ITestObjectManager;
            Assert.IsNotNull(testObjectManager);
        }
Exemple #11
0
        private void DeleteTestData()
        {
            ITestObjectManager testObjectManager = ctx["testObjectManager"] as ITestObjectManager;

            testObjectManager.DeleteAllTestObjects();
        }
Exemple #12
0
        private void PopulateTestData()
        {
            ITestObjectManager testObjectManager = ctx["testObjectManager"] as ITestObjectManager;

            testObjectManager.SaveTwoTestObjects(new TestObject("Jack", 10), new TestObject("Jill", 20));
        }