Examples of HibernateSessionManager


Examples of org.apache.tapestry5.hibernate.HibernateSessionManager

    @Test
    public void undecorated()
    {
        VoidService delegate = newMock(VoidService.class);
        HibernateSessionManager manager = newMock(HibernateSessionManager.class);
        HibernateTransactionDecorator decorator = newHibernateSessionManagerDecorator(manager);
        VoidService interceptor = decorator.build(VoidService.class, delegate, "foo.Bar");

        delegate.undecorated();
View Full Code Here

Examples of org.apache.tapestry5.hibernate.HibernateSessionManager

    @Test
    public void void_method()
    {
        VoidService delegate = newMock(VoidService.class);
        HibernateSessionManager manager = newMock(HibernateSessionManager.class);
        HibernateTransactionDecorator decorator = newHibernateSessionManagerDecorator(manager);
        VoidService interceptor = decorator.build(VoidService.class, delegate, "foo.Bar");

        delegate.voidMethod();
        manager.commit();

        replay();
        interceptor.voidMethod();
        verify();
View Full Code Here

Examples of org.apache.tapestry5.hibernate.HibernateSessionManager

    @Test
    public void void_method_with_param()
    {
        VoidService delegate = newMock(VoidService.class);
        HibernateSessionManager manager = newMock(HibernateSessionManager.class);
        HibernateTransactionDecorator decorator = newHibernateSessionManagerDecorator(manager);
        VoidService interceptor = decorator.build(VoidService.class, delegate, "foo.Bar");

        delegate.voidMethodWithParam(777);
        manager.commit();

        replay();
        interceptor.voidMethodWithParam(777);
        verify();
View Full Code Here

Examples of org.apache.tapestry5.hibernate.HibernateSessionManager

    @Test
    public void runtime_exception_will_abort_transaction() throws Exception
    {
        Performer delegate = newMock(Performer.class);
        HibernateSessionManager manager = newMock(HibernateSessionManager.class);
        HibernateTransactionDecorator decorator = newHibernateSessionManagerDecorator(manager);
        RuntimeException re = new RuntimeException("Unexpected.");

        delegate.perform();
        TestBase.setThrowable(re);
        manager.abort();

        replay();

        Performer interceptor = decorator.build(Performer.class, delegate, "foo.Bar");
View Full Code Here

Examples of org.apache.tapestry5.hibernate.HibernateSessionManager

    @Test
    public void checked_exception_will_commit_transaction() throws Exception
    {
        Performer delegate = newMock(Performer.class);
        HibernateSessionManager manager = newMock(HibernateSessionManager.class);
        HibernateTransactionDecorator decorator = newHibernateSessionManagerDecorator(manager);
        SQLException se = new SQLException("Checked.");

        delegate.perform();
        TestBase.setThrowable(se);
        manager.commit();

        replay();

        Performer interceptor = decorator.build(Performer.class, delegate, "foo.Bar");
View Full Code Here

Examples of org.apache.tapestry5.hibernate.HibernateSessionManager

    @Test
    public void return_type_method()
    {
        ReturnTypeService delegate = newTestService();
        HibernateSessionManager manager = newMock(HibernateSessionManager.class);
        HibernateTransactionDecorator decorator = newHibernateSessionManagerDecorator(manager);
        ReturnTypeService interceptor = decorator.build(ReturnTypeService.class, delegate, "foo.Bar");

        delegate.returnTypeMethod();

        manager.commit();

        replay();
        Assert.assertEquals(interceptor.returnTypeMethod(), "Foo");
        verify();
    }
View Full Code Here

Examples of org.apache.tapestry5.hibernate.HibernateSessionManager

    @Test
    public void return_type_method_with_param()
    {
        ReturnTypeService delegate = newTestService();
        HibernateSessionManager manager = newMock(HibernateSessionManager.class);
        HibernateTransactionDecorator decorator = newHibernateSessionManagerDecorator(manager);
        ReturnTypeService interceptor = decorator.build(ReturnTypeService.class, delegate, "foo.Bar");

        delegate.returnTypeMethodWithParam(5, 3);

        manager.commit();

        replay();
        Assert.assertEquals(interceptor.returnTypeMethodWithParam(5, 3), 8);
        verify();
View Full Code Here

Examples of org.apache.tapestry5.hibernate.HibernateSessionManager

    }


    @Test
    public void test() {
        HibernateSessionManager sessionManager = tester.getService(HibernateSessionManager.class);

        Session session = sessionManager.getSession();

        Tag tag = new Tag();
        tag.setName("Foo");

        Tag anotherTag = new Tag();
        anotherTag.setName("Bar");

        session.save(tag);

        session.save(anotherTag);

        sessionManager.commit();

        Document document = tester.renderPage(SidebarBlocksDemo.class.getSimpleName());

        String markup = document.toString();
View Full Code Here

Examples of org.apache.tapestry5.hibernate.HibernateSessionManager

    }


    @Test
    public void test() {
        HibernateSessionManager sessionManager = tester.getService(HibernateSessionManager.class);

        Session session = sessionManager.getSession();

        ExternalBlog blog = new ExternalBlog();
        blog.setName("http://tapestry5.de");
        blog.setUri("http://tapestry5.de");

        session.save(blog);

        sessionManager.commit();

        Document document = tester.renderPage(SidebarBlocksDemo.class.getSimpleName());

        String markup = document.toString();
View Full Code Here

Examples of org.apache.tapestry5.hibernate.HibernateSessionManager

    }


    @Test
    public void test() {
        HibernateSessionManager sessionManager = tester.getService(HibernateSessionManager.class);

        Session session = sessionManager.getSession();

        final Blog blog = new Blog();
        blog.setName("Tapestry 5 Blog");
        blog.setDescription("Thoughts on coding, technology and occasional stuff");

        sessionManager.getSession().save(blog);

        Article article = new Article();
        article.setBlog(blog);
        article.setTitle("Hello world!");
        article.setContent("Hello world!");
        article.setPublishDate(new GregorianCalendar(2011, 0, 28).getTime());

        session.save(article);

        sessionManager.commit();

        Document document = tester.renderPage(SidebarBlocksDemo.class.getSimpleName());

        String markup = document.toString();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.