2 Replies Latest reply on Oct 28, 2010 4:50 AM by jaikiran

    Bootstraping Weld Extension in unit test

    garcimouche

      Hi there,

       

      I'm new to Arquilian. I have a weld se project where my class under test uses the beautiful @Inject Logger logger produced by the Weld Extension library. I cannot use ShrinkWrap.create(JavaArchive.class).addClasses(LoggerProducer.class) as this class is protected. What's the solution here? Thanks,

       

      WELD-001408 Unsatisfied dependencies for type [Logger] with qualifiers [@Default] at injection point [[field] @Inject private com.acme.search.index.extractor.jdbc.GSSJDBCEntryExtractor.logger]
        • 1. Re: Bootstraping Weld Extension in unit test
          aslak

          Hmm.. you would have to add it by Package instead. addPackage()

           

          But in the current ShrinkWrap version it relays on there being a Package, and a Package only exists in the ClassLoader if a Class in that package has been loaded. Since this is a lonely class that is not refered to from any where it probably won't be. Next version of ShrinkWrap supports loading Classes from packages without going through the ClassLoader, which should help in thee cases.

          • 2. Re: Bootstraping Weld Extension in unit test
            jaikiran

            Maybe this hackish workaround would work for now?

             

            ShrinkWrap.create(JavaArchive.class).addResource("org/blah/blahblah/LoggerProducer.class");