Package org.apache.tapestry5.hibernate

Examples of org.apache.tapestry5.hibernate.HibernateTransactionDecorator


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

        try
        {
            interceptor.perform();
            TestBase.unreachable();
View Full Code Here


    @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();
View Full Code Here

    @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();
View Full Code Here

    @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();

        replay();
        interceptor.undecorated();
View Full Code Here

    @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();
View Full Code Here

    @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();
View Full Code Here

    @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();
        setThrowable(re);
        manager.abort();

        replay();

        Performer interceptor = decorator.build(Performer.class, delegate, "foo.Bar");

        try
        {
            interceptor.perform();
            unreachable();
View Full Code Here

    @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();
        setThrowable(se);
        manager.commit();

        replay();

        Performer interceptor = decorator.build(Performer.class, delegate, "foo.Bar");

        try
        {
            interceptor.perform();
            unreachable();
View Full Code Here

    @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();
View Full Code Here

    @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();
View Full Code Here

TOP

Related Classes of org.apache.tapestry5.hibernate.HibernateTransactionDecorator

Copyright © 2018 www.massapicom. 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.