|
|||||||||||||||||||
| Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
| SLSBClassInterceptorTest00.java | - | 100% | 100% | 100% |
|
||||||||||||||
| 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: SLSBClassInterceptorTest00.java 547 2006-05-30 13:50:43Z studzine $ | |
| 23 | * -------------------------------------------------------------------------- | |
| 24 | */ | |
| 25 | package org.objectweb.easybeans.tests.common.ejbs.stateless.containermanaged; | |
| 26 | ||
| 27 | import java.util.List; | |
| 28 | ||
| 29 | import javax.ejb.Remote; | |
| 30 | import javax.ejb.Stateless; | |
| 31 | import javax.interceptor.ExcludeClassInterceptors; | |
| 32 | import javax.interceptor.ExcludeDefaultInterceptors; | |
| 33 | import javax.interceptor.Interceptors; | |
| 34 | ||
| 35 | import org.objectweb.easybeans.tests.common.ejbs.base.ItfClassInterceptor; | |
| 36 | import org.objectweb.easybeans.tests.common.interceptors.business.PrintOrder01Interceptor; | |
| 37 | import org.objectweb.easybeans.tests.common.interceptors.business.PrintOrder02Interceptor; | |
| 38 | import org.objectweb.easybeans.tests.common.interceptors.business.PrintOrder03Interceptor; | |
| 39 | import org.objectweb.easybeans.tests.common.interceptors.business.PrintOrder04Interceptor; | |
| 40 | ||
| 41 | /** | |
| 42 | * Is used to test if the container call the class interceptors in order.Each | |
| 43 | * method in appends 0 in the array, the difference amog them is the way that | |
| 44 | * the interceptors are called. This class has not class interceptors. | |
| 45 | * @author Gisele Pinheiro Souza | |
| 46 | * @author Eduardo Studzinski E. de Castro | |
| 47 | */ | |
| 48 | @Stateless | |
| 49 | @Remote(ItfClassInterceptor.class) | |
| 50 | public class SLSBClassInterceptorTest00 implements ItfClassInterceptor<Integer> { | |
| 51 | ||
| 52 | /** | |
| 53 | * Appends an Integer with the value 0 in the par. This method has only | |
| 54 | * class interceptors that must be call in order. | |
| 55 | * @param par list used to append the value | |
| 56 | * @return the list with modified | |
| 57 | */ | |
| 58 | 1 | public List<Integer> withoutMethodInterceptor(final List<Integer> par) { |
| 59 | 1 | par.add(ORDER); |
| 60 | 1 | return par; |
| 61 | } | |
| 62 | ||
| 63 | /** | |
| 64 | * Appends an Integer with the value 0 in the par. This method has only | |
| 65 | * class interceptors that must be call in order and the default | |
| 66 | * interceptor(defined in the xml file) must not be executed | |
| 67 | * @param par array used to append the value | |
| 68 | * @return the array with modified | |
| 69 | */ | |
| 70 | 1 | @ExcludeDefaultInterceptors |
| 71 | public List<Integer> withExcludeDefaultInterceptor(final List<Integer> par) { | |
| 72 | 1 | par.add(ORDER); |
| 73 | 1 | return par; |
| 74 | } | |
| 75 | ||
| 76 | /** | |
| 77 | * Appends an Integer with the value 0 in the par. This method has the | |
| 78 | * annotation ExcludeClassInterceptor, so the interceptors must not be | |
| 79 | * executed. | |
| 80 | * @param par array used to append the value | |
| 81 | * @return the array with modified | |
| 82 | */ | |
| 83 | 1 | @ExcludeClassInterceptors |
| 84 | public List<Integer> withExcludeClassInterceptor(final List<Integer> par) { | |
| 85 | 1 | par.add(ORDER); |
| 86 | 1 | return par; |
| 87 | } | |
| 88 | ||
| 89 | /** | |
| 90 | * Appends an Integer with the value 0 in the par. This method has the | |
| 91 | * annotation ExcludeClassInterceptor, so only the method interceptor must | |
| 92 | * not be executed. | |
| 93 | * @param par array used to append the value | |
| 94 | * @return the array with modified | |
| 95 | */ | |
| 96 | 1 | @ExcludeClassInterceptors |
| 97 | @Interceptors({PrintOrder01Interceptor.class}) | |
| 98 | public List<Integer> withExcludeClassInterAndOneMethodInter(final List<Integer> par) { | |
| 99 | 1 | par.add(ORDER); |
| 100 | 1 | return par; |
| 101 | } | |
| 102 | ||
| 103 | /** | |
| 104 | * Appends an Integer with the value 0 in the par. This method has the | |
| 105 | * annotations ExcludeClassInterceptor and ExcludeDefaultInterceptor , so | |
| 106 | * only the method interceptor must not be executed. | |
| 107 | * @param par array used to append the value | |
| 108 | * @return the array with modified | |
| 109 | */ | |
| 110 | 1 | @ExcludeClassInterceptors |
| 111 | @ExcludeDefaultInterceptors | |
| 112 | @Interceptors({PrintOrder01Interceptor.class, PrintOrder02Interceptor.class, PrintOrder03Interceptor.class, | |
| 113 | PrintOrder04Interceptor.class}) | |
| 114 | public List<Integer> withExcludeClassDefInterAndFourMethodInter(final List<Integer> par) { | |
| 115 | 1 | par.add(ORDER); |
| 116 | 1 | return par; |
| 117 | } | |
| 118 | ||
| 119 | /** | |
| 120 | * Appends an Integer with the value 0 in the par. This method has the class | |
| 121 | * interceptors and the method interceptor, so all interceptors must not be | |
| 122 | * executed in order. | |
| 123 | * @param par array used to append the value | |
| 124 | * @return the array with modified | |
| 125 | */ | |
| 126 | 1 | @Interceptors({PrintOrder01Interceptor.class}) |
| 127 | public List<Integer> withOneMethodInterceptor(final List<Integer> par) { | |
| 128 | 1 | par.add(ORDER); |
| 129 | 1 | return par; |
| 130 | } | |
| 131 | ||
| 132 | /** | |
| 133 | * Appends an Integer with the value 0 in the par. This method has the class | |
| 134 | * interceptors and the method interceptors, so all interceptors must not be | |
| 135 | * executed in order. | |
| 136 | * @param par array used to append the value | |
| 137 | * @return the array with modified | |
| 138 | */ | |
| 139 | 1 | @Interceptors({PrintOrder01Interceptor.class, PrintOrder02Interceptor.class, PrintOrder03Interceptor.class}) |
| 140 | public List<Integer> withThreeMethodInterceptor(final List<Integer> par) { | |
| 141 | 1 | par.add(ORDER); |
| 142 | 1 | return par; |
| 143 | } | |
| 144 | ||
| 145 | } |
|
||||||||||