/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements. See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership. The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License. You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied. See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */
package org.apache.webbeans.test.component.event.normal;

import javax.interceptor.AroundInvoke;
import javax.interceptor.Interceptor;
import javax.interceptor.InvocationContext;
import java.io.Serializable;

@Interceptor
@Transactional
public class TransactionalInterceptor implements Serializable
{

    @AroundInvoke
    public Object caller(InvocationContext context) throws Exception
    {
        try
        {
            ComponentWithObserves2.hasBeenIntercepted = true;
            return context.proceed();
            
        }catch(Exception e)
        {
            ComponentWithObserves2.hasBeenIntercepted = false;
        }
        
        return null;
    }
}

@@ -853,16 +853,129 @@
 ormal;%0A%0A
+import javax.enterprise.inject.Intercepted;%0Aimport javax.enterprise.inject.spi.Bean;%0Aimport javax.inject.Inject;%0A
 import j
@@ -1005,16 +1005,16 @@
 Invoke;%0A
-
 import j
@@ -1117,16 +1117,42 @@
 zable;%0A%0A
+import org.junit.Assert;%0A%0A
 @Interce
@@ -1236,16 +1236,233 @@
 able%0A%7B%0A%0A
+    private @Inject @Intercepted Bean%3C?%3E interceptedBean;%0A    private @Inject Bean%3CTransactionalInterceptor%3E bean;%0A    private @Inject javax.enterprise.inject.spi.Interceptor %3CTransactionalInterceptor%3E interceptor;%0A%0A%0A
     @Aro
@@ -1542,24 +1542,51 @@
 ption%0A    %7B%0A
+        checkInjections();%0A
         try%0A
@@ -1849,16 +1849,191 @@
 n null;%0A
-
     %7D%0A
+%0A    private void checkInjections()%0A    %7B%0A        Assert.assertNotNull(interceptedBean);%0A        Assert.assertNotNull(bean);%0A        Assert.assertNotNull(interceptor);%0A    %7D%0A%0A
 %7D%0A

improve interceptor meta-information injection tests