Clover coverage report -
Coverage timestamp: Thu Jun 22 2006 14:24:50 CEST
file stats: LOC: 183   Methods: 11
NCLOC: 71   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
MethodInterceptorTest.java - 95% 90.9% 93.5%
coverage 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: MethodInterceptorTest.java 450 2006-05-12 15:30:25Z benoitf $
 23    * --------------------------------------------------------------------------
 24    */
 25    package org.objectweb.easybeans.tests.common.ejbs.base;
 26   
 27    import java.util.ArrayList;
 28    import java.util.List;
 29   
 30    import javax.annotation.PostConstruct;
 31    import javax.interceptor.Interceptors;
 32   
 33    import org.objectweb.easybeans.tests.common.interceptors.business.PackageInterceptor;
 34    import org.objectweb.easybeans.tests.common.interceptors.business.PrintOrder01Interceptor;
 35    import org.objectweb.easybeans.tests.common.interceptors.business.PrintOrder02Interceptor;
 36    import org.objectweb.easybeans.tests.common.interceptors.business.PrintOrder03Interceptor;
 37    import org.objectweb.easybeans.tests.common.interceptors.business.PrintOrder04Interceptor;
 38    import org.objectweb.easybeans.tests.common.interceptors.business.PrintOrder05Interceptor;
 39    import org.objectweb.easybeans.tests.common.interceptors.business.PrivateInterceptor;
 40    import org.objectweb.easybeans.tests.common.interceptors.business.ProtectedInterceptor;
 41   
 42    /**
 43    * Implements an interface that all methods append an Integer with value 0. The
 44    * difference between each method is the number of method interceptors used in
 45    * each one. There are not class interceptor and default interceptor specified.
 46    * @author Gisele Pinheiro Souza
 47    * @author Eduardo Studzinski E. de Castro
 48    */
 49    public class MethodInterceptorTest implements ItfMethodInterceptor<Integer> {
 50   
 51    /**
 52    * List used to test postconstruct callback.
 53    */
 54    private List<Integer> lstPostconstruct;
 55   
 56    /**
 57    * Appends an Integer with the value 0 in the par. This method has 5
 58    * interceptors that must be call in order.
 59    * @param par array used to append the value
 60    * @return the array with modified
 61    */
 62  2 @Interceptors({PrintOrder01Interceptor.class, PrintOrder02Interceptor.class, PrintOrder03Interceptor.class,
 63    PrintOrder04Interceptor.class, PrintOrder05Interceptor.class})
 64    public List<Integer> withFiveMethodInterceptors(final List<Integer> par) {
 65  2 par.add(ORDER);
 66  2 return par;
 67    }
 68   
 69    /**
 70    * Appends an Integer with the value 0 in the par. This method has 5
 71    * interceptors that must be call in order. The interceptor order is
 72    * inverse.
 73    * @param par array used to append the value
 74    * @return the array with modified
 75    */
 76  2 @Interceptors({PrintOrder05Interceptor.class, PrintOrder04Interceptor.class, PrintOrder03Interceptor.class,
 77    PrintOrder02Interceptor.class, PrintOrder01Interceptor.class})
 78    public List<Integer> withFiveMethodInterceptorsInverse(final List<Integer> par) {
 79  2 par.add(ORDER);
 80  2 return par;
 81    }
 82   
 83    /**
 84    * Appends an Integer with the value 0 in the par. This method has 1
 85    * interceptor that must be call in order.
 86    * @param par array used to append the value
 87    * @return the array with modified
 88    */
 89  2 @Interceptors({PrintOrder01Interceptor.class})
 90    public List<Integer> withOneMethodInterceptor(final List<Integer> par) {
 91  2 par.add(ORDER);
 92  2 return par;
 93    }
 94   
 95    /**
 96    * Appends an Integer with the value 0 in the par. This method has no
 97    * interceptors.
 98    * @param par array used to append the value
 99    * @return the array with modified
 100    */
 101  2 public List<Integer> withoutInterceptor(final List<Integer> par) {
 102  2 par.add(ORDER);
 103  2 return par;
 104    }
 105   
 106    /**
 107    * Appends an Integer with the value 0 in the par. This method has 2
 108    * interceptors that must be call in order.
 109    * @param par array used to append the value
 110    * @return the array with modified
 111    */
 112  2 @Interceptors({PrintOrder01Interceptor.class, PrintOrder02Interceptor.class})
 113    public List<Integer> withTwoMethodInterceptors(final List<Integer> par) {
 114  2 par.add(ORDER);
 115  2 return par;
 116    }
 117   
 118    /**
 119    * Verifies the list status. The list must be not null, because the PostConstruct callback will initializate this variable.
 120    * @return true if the list is properly configured to use.
 121    */
 122  0 public boolean checkPostbackInterceptors(){
 123  0 return (lstPostconstruct != null);
 124    }
 125   
 126    /**
 127    * Creates a list that will be used.
 128    */
 129  2 @PostConstruct
 130    public void postConstruct(){
 131  2 lstPostconstruct = new ArrayList<Integer>();
 132    }
 133   
 134    /**
 135    * Appends an Integer with the value 0 in the par. This method has 8
 136    * interceptors that must be call in order.
 137    * @param par array used to append the value
 138    * @return the array with modified
 139    */
 140  2 @Interceptors({PrivateInterceptor.class, ProtectedInterceptor.class, PrintOrder01Interceptor.class,
 141    PrivateInterceptor.class, PrintOrder03Interceptor.class, PrivateInterceptor.class, ProtectedInterceptor.class,
 142    ProtectedInterceptor.class})
 143    public List<Integer> withPrivateProtectedPublicInterceptors(final List<Integer> par) {
 144  2 par.add(ORDER);
 145  2 return par;
 146    }
 147   
 148    /**
 149    * Appends an Integer with the value 0 in the par. This method has 3
 150    * interceptors with a private method that must be call in order.
 151    * @param par array used to append the value
 152    * @return the array with modified
 153    */
 154  2 @Interceptors({PrivateInterceptor.class, PrivateInterceptor.class, PrivateInterceptor.class})
 155    public List<Integer> withPrivateInterceptors(final List<Integer> par) {
 156  2 par.add(ORDER);
 157  2 return par;
 158    }
 159   
 160    /**
 161    * Appends an Integer with the value 0 in the par. This method has 2
 162    * interceptors with a protected method that must be call in order.
 163    * @param par array used to append the value
 164    * @return the array with modified
 165    */
 166  2 @Interceptors({ProtectedInterceptor.class, ProtectedInterceptor.class})
 167    public List<Integer> withProtectedInterceptors(final List<Integer> par) {
 168  2 par.add(ORDER);
 169  2 return par;
 170    }
 171   
 172    /**
 173    * Appends an Integer with the value 0 in the par. This method has 4
 174    * interceptors with a package method that must be call in order.
 175    * @param par array used to append the value
 176    * @return the array with modified
 177    */
 178  2 @Interceptors({PackageInterceptor.class, PackageInterceptor.class, PackageInterceptor.class, PackageInterceptor.class})
 179    public List<Integer> withPackageInterceptors(final List<Integer> par) {
 180  2 par.add(ORDER);
 181  2 return par;
 182    }
 183    }