4 Replies Latest reply on Jun 15, 2010 7:20 AM by alesj

    Invalid changes in jboss-cl

    thomas.diesler

      Recent changes in jboss-cl break a large number of test cases in jbosgi-framework, namely

       

      Failed tests: 
        testServiceReferenceBean(org.jboss.test.osgi.core.jbosgi326.OSGi326TestCase)
        testServiceReferenceBoth(org.jboss.test.osgi.core.jbosgi326.OSGi326TestCase)
        testServiceReferenceReverse(org.jboss.test.osgi.core.jbosgi326.OSGi326TestCase)
        testEventAdmin(org.jboss.test.osgi.core.jbosgi341.OSGi341TestCase)
        testGetServiceReferenceFromMC(org.jboss.test.osgi.service.ServiceMixTestCase)
        testDynamicImportWithWildcard(org.jboss.test.osgi.core.jbosgi323.OSGi323TestCase)
        testAllPackagesWildcard(org.jboss.test.osgi.classloader.DynamicImportPackageTestCase)
        testAllPackagesWildcardNotWired(org.jboss.test.osgi.classloader.DynamicImportPackageTestCase)
        testAllPackagesWildcardNotThere(org.jboss.test.osgi.classloader.DynamicImportPackageTestCase)
        testPackageWildcardWired(org.jboss.test.osgi.classloader.DynamicImportPackageTestCase)
        testPackageWildcardNotWired(org.jboss.test.osgi.classloader.DynamicImportPackageTestCase)
        testPackageWildcardNotThere(org.jboss.test.osgi.classloader.DynamicImportPackageTestCase)
        testLogServiceAvailableOnInstall(org.jboss.test.osgi.classloader.DynamicImportPackageTestCase)
        testLogServiceNotAvailableOnInstall(org.jboss.test.osgi.classloader.DynamicImportPackageTestCase)
      
      Tests in error: 
        testLogServiceFromCompendium(org.jboss.test.osgi.simple.SimpleLogServiceTestCase)
        testLogServiceFromTwoExporters(org.jboss.test.osgi.simple.SimpleLogServiceTestCase)
        testFiltering(org.jboss.test.osgi.service.ServiceMixTestCase)
      
      Tests run: 223, Failures: 14, Errors: 3, Skipped: 0
      
      

       

      One of the issue is a NPE in WildcardDelegateLoader

       

         protected DelegateLoader resolve(String pckg)
         {
            ... 
            if (item.resolve(controller))
            {
               Module resolvedModule = item.getResolvedModule();
               DelegateLoader loader = resolvedModule.getDelegateLoader(module, requirement);
      
      

       

      Although the item reports resolved the associated Module is null

        • 1. Re: Invalid changes in jboss-cl
          alesj
          Although the item reports resolved the associated Module is null

          I think that is the case of self resolved dependency; item is resolved by the requesting module.

           

          I can handle this in the WildcardDelegateLoader, but this seams like an impl detail.

          So, the better question is probably why the resolvedModule isn't the requesting module itself in the RequirementDI?

          Potential cyclic issue perhaps?

           

          RequirementDependencyItem.java:

           

          public boolean resolve(Controller controller)
             {
                Module module = getModule().resolveModule(this, true);
                
                // No module present
                if (module == null)
                {
                   Requirement requirement = getRequirement();
                   setResolved(requirement.isOptional() || requirement.isDynamic());
                   return isResolved();
                }
          
                // Self dependency
                if (module == this.module)
                {
                   ControllerContext context = module.getControllerContext();
                   setIDependOn(context.getName());
                   setResolved(true);
                   // HERE??
                   return true;
                }
          
          
          • 2. Re: Invalid changes in jboss-cl
            thomas.diesler

            This seems to be related to

             

            DynamicImport-Package takes presendence over embedded classes

            https://jira.jboss.org/browse/JBOSGI-323

             

            We do not generate capabilities for embedded packages that are not exported, which is correct.

            I don't know about the resolve phase, but at the classloading phase we handeled this by looking at the dynamic-imports AFTER we looked at the local packages.

             

            Do you have a test for this use case in jboss-cl?

            • 3. Re: Invalid changes in jboss-cl
              thomas.diesler

              Yes, that fixes some of the issues. We are now down to these failures

               

              Failed tests: 
                testServiceReferenceBean(org.jboss.test.osgi.core.jbosgi326.OSGi326TestCase)
                testServiceReferenceBoth(org.jboss.test.osgi.core.jbosgi326.OSGi326TestCase)
                testServiceReferenceReverse(org.jboss.test.osgi.core.jbosgi326.OSGi326TestCase)
                testEventAdmin(org.jboss.test.osgi.core.jbosgi341.OSGi341TestCase)
                testGetServiceReferenceFromMC(org.jboss.test.osgi.service.ServiceMixTestCase)
                testFiltering(org.jboss.test.osgi.service.ServiceMixTestCase)
                testDynamicImportWithWildcard(org.jboss.test.osgi.core.jbosgi323.OSGi323TestCase)
                testAllPackagesWildcard(org.jboss.test.osgi.classloader.DynamicImportPackageTestCase)
              
              Tests run: 216, Failures: 8, Errors: 0, Skipped: 0
              

               

              Could you please add the DynamicImport-Package presendence use case to your test coverage for

               

              https://jira.jboss.org/browse/JBCL-160

              • 4. Re: Invalid changes in jboss-cl
                alesj
                We do not generate capabilities for embedded packages that are not exported, which is correct.

                I don't know about the resolve phase, but at the classloading phase we handeled this by looking at the dynamic-imports AFTER we looked at the local packages.

                I don't see how resolving and imports phase are related wrt this test failures.

                 

                WildcardDelegateLoader explicitly sets itself to AFTER,

                and then also adds any new delegate loader to AFTER phase, but before itself.

                 

                If you give me more info of the cause or nature of the failure,

                I'll try to mock it up in jboss-cl project.