Uploaded image for project: 'CDI TCK'
  1. CDI TCK
  2. CDITCK-223

EnterpriseBeanLifecycleTest.testCreateSFSB

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • 1.0.5.CR1, 1.1.0.Alpha2
    • 1.0.4.Final
    • Tests
    • None

    Description

      This test is good except the last part where it checks for Serializable as an interface:

            // Verify that the instance returned is a proxy by checking for all local interfaces
            assert getCurrentConfiguration().getBeans().isProxy(stadtInstance);
            Set<Class> interfaces = new HashSet<Class>(Arrays.asList(stadtInstance.getClass().getInterfaces()));
            Class c = stadtInstance.getClass();
            Class[] cs = c.getInterfaces();
            assert interfaces.contains(KleinStadt.class);
            assert interfaces.contains(SchoeneStadt.class);
            assert interfaces.contains(Serializable.class);
      

      It isn't valid to check Serializable is a business local interface. Remote proxies are required to be serializable, but there's no explicit requirement for local proxies. Most vendors may do that for internal purposes (makes supporting passivation easier), but that's not something CDI needs to worry about.

      Our proxies actually are serializable – they just don't implement the interface directly. It's done through another internal interface that takes care of a few other details, so this assert fails. On that note, we should probably change these asserts to:

            // Verify that the instance returned is a proxy by checking for all local interfaces
            assert getCurrentConfiguration().getBeans().isProxy(stadtInstance);
            assert stadtInstance instanceof KleinStadt;
            assert stadtInstance instanceof SchoeneStadt;
      

      Probably CDI doesn't need to care about the details on how the vendor ensures a proxy is assignable to the business local interfaces.

      Attachments

        Activity

          People

            mkouba@redhat.com Martin Kouba
            dblevins_jira David Blevins (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              PagerDuty