Tuscany
  1. Tuscany
  2. TUSCANY-3947

Compliance testcase POJO_10009 testing for too strict of a condition

    Details

      Description

      In compliance testcase POJO_10009 service1ClassLoaderCheckImpl.operation1() is checking if the TCCL retrieved is exactly the same as service1ClassLoaderCheckImpl's classloader. However, it seems as long as the implementation class is loadable from the TCCL the testcase is still compliant with the specifiation.

      The suggested update is to change:

      public String operation1(String input)

      { ClassLoader tccl = Thread.currentThread().getContextClassLoader(); ClassLoader loader = this.getClass().getClassLoader(); String result = " thread context classloader is correct"; if( loader != tccl ) result = " thread context classloader not correct"; return serviceName + " operation1 invoked" + result; }

      to:

      public String operation1(String input)

      { ClassLoader tccl = Thread.currentThread().getContextClassLoader(); ClassLoader loader = this.getClass().getClassLoader(); ClassLoader loader2 = Class.forName("org.oasisopen.sca.test.service1ClassLoaderCheckImpl", false, tccl); String result = " thread context classloader is correct"; if (loader != loader2) result = " thread context classloader not correct"; return serviceName + " operation1 invoked" + result; }

        Activity

        Jennifer A Thompson made changes -
        Field Original Value New Value
        Description In compliance testcase POJO_10009 service1ClassLoaderCheckImpl.operation1() is checking if the TCCL retrieved is exactly the same as service1ClassLoaderCheckImpl's classloader. However, it seems as long as the implementation class is loadable from the TCCL the testcase is still compliant with the specifiation.


        The suggested update is to change:

        public String operation1(String input) {
        ClassLoader tccl = Thread.currentThread().getContextClassLoader();
        ClassLoader loader = this.getClass().getClassLoader();
        String result = " thread context classloader is correct";
        if( loader != tccl ) result = " thread context classloader not correct";
        return serviceName + " operation1 invoked" + result;
        }

        to:

        public String operation1(String input) {
        ClassLoader tccl = Thread.currentThread().getContextClassLoader();
        ClassLoader loader = this.getClass().getClassLoader();
        ClassLoader loader2 = Class.forName("org.oasisopen.sca.test.service1ClassLoaderCheckImpl", false, tccl);
        String result = " thread context classloader is correct";
        if (loader != loader2) result = " thread context classloader not correct";
        return serviceName + " operation1 invoked" + result;
        }

        This testcase would then allow the runtime the flexibility to compose a classloader that can delegate to the contribution classloader and to other classloaders (e.g. library loaders).
        In compliance testcase POJO_10009 service1ClassLoaderCheckImpl.operation1() is checking if the TCCL retrieved is exactly the same as service1ClassLoaderCheckImpl's classloader. However, it seems as long as the implementation class is loadable from the TCCL the testcase is still compliant with the specifiation.


        The suggested update is to change:

        public String operation1(String input) {
        ClassLoader tccl = Thread.currentThread().getContextClassLoader();
        ClassLoader loader = this.getClass().getClassLoader();
        String result = " thread context classloader is correct";
        if( loader != tccl ) result = " thread context classloader not correct";
        return serviceName + " operation1 invoked" + result;
        }

        to:

        public String operation1(String input) {
        ClassLoader tccl = Thread.currentThread().getContextClassLoader();
        ClassLoader loader = this.getClass().getClassLoader();
        ClassLoader loader2 = Class.forName("org.oasisopen.sca.test.service1ClassLoaderCheckImpl", false, tccl);
        String result = " thread context classloader is correct";
        if (loader != loader2) result = " thread context classloader not correct";
        return serviceName + " operation1 invoked" + result;
        }
        Jennifer A Thompson created issue -

          People

          • Assignee:
            Unassigned
            Reporter:
            Jennifer A Thompson
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:

              Development