/*
* JBoss, Home of Professional Open Source
* Copyright $today.year Red Hat Inc. and/or its affiliates and other
* contributors as indicated by the @author tags. All rights reserved.
* See the copyright.txt in the distribution for a full listing of
* individual contributors.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/

package org.jboss.weld.tests.interceptors.lhotse;

import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.shrinkwrap.api.Archive;
import org.jboss.shrinkwrap.api.BeanArchive;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.jboss.weld.tests.category.Integration;
import org.jboss.weld.tests.interceptors.lhotse.fst.TDAO;
import org.jboss.weld.tests.interceptors.lhotse.fst.TxInterceptor;
import org.jboss.weld.tests.interceptors.lhotse.snd.CDAO;
import org.jboss.weld.tests.interceptors.lhotse.snd.Client;
import org.junit.Assert;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.runner.RunWith;

/**
 * @author <a href="mailto:ales.justin@jboss.org">Ales Justin</a>
 */
@RunWith(Arquillian.class)
@Category(Integration.class)
public class SplitInterceptorsTest {
    @Deployment
    public static Archive<?> deploy() {
        WebArchive web = ShrinkWrap.create(WebArchive.class).addPackage(SplitInterceptorsTest.class.getPackage());

        BeanArchive fst = ShrinkWrap.create(BeanArchive.class).intercept(TxInterceptor.class);
        fst.addPackage(TDAO.class.getPackage());
        web.addAsLibrary(fst);

        BeanArchive snd = ShrinkWrap.create(BeanArchive.class).intercept(TxInterceptor.class);
        snd.addPackage(CDAO.class.getPackage());
        web.addAsLibrary(snd);

        return web;
    }

    @Test
    public void testInterceptors(CDAO cdao) throws Exception {
        TxInterceptor.used = false;

        Client c = new Client();
        Assert.assertTrue(cdao.save(c));
        Assert.assertTrue(TxInterceptor.used);
    }
}

@@ -1224,32 +1224,78 @@
 ap.api.Archive;%0A
+import org.jboss.shrinkwrap.api.ArchivePaths;%0A
 import org.jboss
@@ -1404,26 +1404,119 @@
 pi.spec.
-WebArchive
+JavaArchive;%0Aimport org.jboss.shrinkwrap.api.spec.WebArchive;%0Aimport org.jboss.shrinkwrap.impl.BeansXml
 ;%0Aimport
@@ -2450,36 +2450,36 @@
 (fst);%0A%0A        
-Bean
+Java
 Archive snd = Sh
@@ -2486,36 +2486,36 @@
 rinkWrap.create(
-Bean
+Java
 Archive.class).i
@@ -2505,32 +2505,69 @@
 aArchive.class).
+addAsManifestResource(new BeansXml().
 intercept(TxInte
@@ -2551,32 +2551,35 @@
 sXml().intercept
+ors
 (TxInterceptor.c
@@ -2575,32 +2575,67 @@
 terceptor.class)
+, ArchivePaths.create(%22beans.xml%22))
 ;%0A        snd.ad

Fix SplitInterceptorsTest