Clover coverage report -
Coverage timestamp: Thu Jun 22 2006 14:24:50 CEST
file stats: LOC: 116   Methods: 5
NCLOC: 46   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
AllLifeCallbackUserTransactionAccess00.java - 0% 0% 0%
coverage
 1    /**
 2    * EasyBeans
 3    * Copyright (C) 2006 Bull S.A.S.
 4    * Contact: easybeans@objectweb.org
 5    *
 6    * This library is free software; you can redistribute it and/or
 7    * modify it under the terms of the GNU Lesser General Public
 8    * License as published by the Free Software Foundation; either
 9    * version 2.1 of the License, or any later version.
 10    *
 11    * This library is distributed in the hope that it will be useful,
 12    * but WITHOUT ANY WARRANTY; without even the implied warranty of
 13    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 14    * Lesser General Public License for more details.
 15    *
 16    * You should have received a copy of the GNU Lesser General Public
 17    * License along with this library; if not, write to the Free Software
 18    * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
 19    * USA
 20    *
 21    * --------------------------------------------------------------------------
 22    * $Id: AllLifeCallbackUserTransactionAccess00.java 602 2006-06-08 08:40:57Z studzine $
 23    * --------------------------------------------------------------------------
 24    */
 25    package org.objectweb.easybeans.tests.common.interceptors.lifecycle.misc;
 26   
 27    import javax.annotation.PostConstruct;
 28    import javax.annotation.PreDestroy;
 29    import javax.ejb.EJB;
 30    import javax.ejb.PostActivate;
 31    import javax.ejb.PrePassivate;
 32    import javax.interceptor.InvocationContext;
 33   
 34    import org.objectweb.easybeans.log.JLog;
 35    import org.objectweb.easybeans.log.JLogFactory;
 36    import org.objectweb.easybeans.tests.common.ejbs.entity.callbacklogger.CallbackType;
 37    import org.objectweb.easybeans.tests.common.ejbs.stateless.containermanaged.callbacklogger.ItfCallbackLoggerAccess;
 38    import org.objectweb.easybeans.tests.common.resources.UserTransactionTester;
 39   
 40    /**
 41    * This interceptor contains methods to the four lifecycle callbacks.
 42    * Every method tries to access the UserTransaction.
 43    * @author Eduardo Studzinski Estima de Castro
 44    * @author Gisele Pinheiro Souza
 45    *
 46    */
 47    public class AllLifeCallbackUserTransactionAccess00 extends UserTransactionTester{
 48   
 49    /**
 50    * Logger.
 51    */
 52    private JLog logger = JLogFactory.getLog(AllLifeCallbackUserTransactionAccess00.class);
 53   
 54    /**
 55    * SessionFacade Callback Logger.
 56    */
 57    @EJB(beanName="SLSBCallbackLoggerAccess")
 58    private ItfCallbackLoggerAccess beanLogger;
 59   
 60    /**
 61    * PostActivate that accesses the UserTransaction.
 62    * @param ic contains attributes of invocation
 63    */
 64  0 @PostActivate
 65    public void postActivate(final InvocationContext ic){
 66  0 this.intercept(ic, CallbackType.POST_ACTIVATE);
 67    }
 68   
 69    /**
 70    * PostConstruct that accesses the UserTransaction.
 71    * @param ic contains attributes of invocation
 72    */
 73  0 @PostConstruct
 74    public void postConstruct(final InvocationContext ic){
 75  0 this.intercept(ic, CallbackType.POST_CONSTRUCT);
 76    }
 77   
 78    /**
 79    * PreDestroy that accesses the UserTransaction.
 80    * @param ic contains attributes of invocation
 81    */
 82  0 @PreDestroy
 83    public void preDestroy(final InvocationContext ic){
 84  0 this.intercept(ic, CallbackType.PRE_DESTROY);
 85    }
 86   
 87    /**
 88    * PrePassivate that accesses the UserTransaction.
 89    * @param ic contains attributes of invocation
 90    */
 91  0 @PrePassivate
 92    public void prePassivate(final InvocationContext ic){
 93  0 this.intercept(ic, CallbackType.PRE_PASSIVATE);
 94    }
 95   
 96    /**
 97    * Does the access.
 98    * @param ic context
 99    * @param type lifecycle interceptor type
 100    */
 101  0 protected void intercept(final InvocationContext ic, final CallbackType type){
 102  0 try {
 103  0 String beanClassName = ic.getTarget().getClass().getName();
 104   
 105  0 logger.debug("{0} - Testing access - Instance: {1}.", type.name(), beanClassName);
 106  0 super.access00();
 107  0 beanLogger.insertCallbackLogger(beanClassName, type,
 108    AllLifeCallbackUserTransactionAccess00.class.getName());
 109  0 logger.debug("{0} - Access is ok - Instance: {1}.", type.name(), beanClassName);
 110   
 111  0 ic.proceed();
 112    } catch (Exception e) {
 113  0 throw new IllegalStateException(type.name() + " Exception. ", e);
 114    }
 115    }
 116    }