| 1 | /* | |
| 2 |  * Copyright (c) 2015 Maxim Yunusov | |
| 3 |  *    Licensed under the Apache License, Version 2.0 (the "License"); | |
| 4 |  *    you may not use this file except in compliance with the License. | |
| 5 |  *    You may obtain a copy of the License at | |
| 6 |  * | |
| 7 |  *        http://www.apache.org/licenses/LICENSE-2.0 | |
| 8 |  * | |
| 9 |  *    Unless required by applicable law or agreed to in writing, software | |
| 10 |  *    distributed under the License is distributed on an "AS IS" BASIS, | |
| 11 |  *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 12 |  *    See the License for the specific language governing permissions and | |
| 13 |  *    limitations under the License. | |
| 14 |  */ | |
| 15 | ||
| 16 | package org.maxur.perfmodel.backend.service; | |
| 17 | ||
| 18 | import org.aopalliance.intercept.ConstructorInterceptor; | |
| 19 | import org.aopalliance.intercept.MethodInterceptor; | |
| 20 | import org.glassfish.hk2.api.Filter; | |
| 21 | import org.glassfish.hk2.api.InterceptionService; | |
| 22 | import org.glassfish.hk2.utilities.BuilderHelper; | |
| 23 | import org.jvnet.hk2.annotations.Service; | |
| 24 | ||
| 25 | import java.lang.reflect.Constructor; | |
| 26 | import java.lang.reflect.Method; | |
| 27 | import java.util.Collections; | |
| 28 | import java.util.List; | |
| 29 | ||
| 30 | /** | |
| 31 |  * @author myunusov | |
| 32 |  * @version 1.0 | |
| 33 |  * @since <pre>02.09.2015</pre> | |
| 34 |  */ | |
| 35 | @Service | |
| 36 | public class HK2InterceptionService implements InterceptionService { | |
| 37 | ||
| 38 |     private final static MethodInterceptor METHOD_INTERCEPTOR = new BenchmarkMethodInterceptor(); | |
| 39 | ||
| 40 |     private final static List<MethodInterceptor> METHOD_LIST = Collections.singletonList(METHOD_INTERCEPTOR); | |
| 41 | ||
| 42 |     public Filter getDescriptorFilter() { | |
| 43 | 
1
1. getDescriptorFilter : mutated return of Object value for org/maxur/perfmodel/backend/service/HK2InterceptionService::getDescriptorFilter to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE | 
        return BuilderHelper.allFilter(); | 
| 44 |     } | |
| 45 | ||
| 46 |     @Override | |
| 47 |     public List<ConstructorInterceptor> getConstructorInterceptors(Constructor<?> constructor) { | |
| 48 | 
1
1. getConstructorInterceptors : mutated return of Object value for org/maxur/perfmodel/backend/service/HK2InterceptionService::getConstructorInterceptors to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE | 
        return null; | 
| 49 |     } | |
| 50 | ||
| 51 |     @Override | |
| 52 |     public List<MethodInterceptor> getMethodInterceptors(Method method) { | |
| 53 | 
1
1. getMethodInterceptors : negated conditional → NO_COVERAGE | 
        if (method.isAnnotationPresent(Benchmark.class)) { | 
| 54 | 
1
1. getMethodInterceptors : mutated return of Object value for org/maxur/perfmodel/backend/service/HK2InterceptionService::getMethodInterceptors to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE | 
            return METHOD_LIST; | 
| 55 |         } | |
| 56 | 
1
1. getMethodInterceptors : mutated return of Object value for org/maxur/perfmodel/backend/service/HK2InterceptionService::getMethodInterceptors to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE | 
        return null; | 
| 57 |     } | |
| 58 | ||
| 59 | ||
| 60 | } | |
| 61 | ||
Mutations | ||
| 43 | 
 
 1.1  | 
|
| 48 | 
 
 1.1  | 
|
| 53 | 
 
 1.1  | 
|
| 54 | 
 
 1.1  | 
|
| 56 | 
 
 1.1  |