Jetspeed 2
  1. Jetspeed 2
  2. JS2-1015

Unattached portlet definitions left in DB after registry unit tests run

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.2.0
    • Fix Version/s: 2.2.1
    • Component/s: Portlet Registry, Testing
    • Labels:
      None
    • Environment:
      J2 2.2 trunk
      JDK6/Linux/x86_64

      Description

      Portlet definition clone tests fail to properly clean up after cloned portlet definition is removed in unit tests. On the next unit test case invocation w/o clearing the database, queries for all portlet definitions fail when orphaned portlet definitions w/o a portlet applications are added to the registry cache and fail.

      Preliminary investigation indicates that the registry OM is not utilizing removal aware collections for persistent collections, but the test cases are trying to remove persistent members using operations on the transient collection implementations.

      1. registry-ojb-collections.patch
        50 kB
        Randy Watler
      2. page-manager-ojb-collections.patch
        13 kB
        Randy Watler

        Activity

        Hide
        Randy Watler added a comment -

        SVN commit: 785910

        Show
        Randy Watler added a comment - SVN commit: 785910
        Hide
        Randy Watler added a comment -

        The change to PersistenceBrokerPortletRegistry.java is not strictly necessary, but it is more in line with the existing PA and PD APIs. I had originally made this change to ensure that construction of the cloned PD followed existing PD creation paradigms while debugging. We can remove it if desired.

        Show
        Randy Watler added a comment - The change to PersistenceBrokerPortletRegistry.java is not strictly necessary, but it is more in line with the existing PA and PD APIs. I had originally made this change to ensure that construction of the cloned PD followed existing PD creation paradigms while debugging. We can remove it if desired.
        Hide
        David Sean Taylor added a comment -

        I am OK with the Page Manager patch. The registry patch has a lot of these:

        CollectionUtils.createCollection();

        which seem to be safe as well.

        This modification, if I understand correctly, is necessary too for the clone api to function correctly?:

        + // create new portlet in source portlet application
        + PortletDefinition copy = source.getApplication().addPortlet(newPortletName);

        • PortletDefinitionImpl copy = new PortletDefinitionImpl();
        Show
        David Sean Taylor added a comment - I am OK with the Page Manager patch. The registry patch has a lot of these: CollectionUtils.createCollection(); which seem to be safe as well. This modification, if I understand correctly, is necessary too for the clone api to function correctly?: + // create new portlet in source portlet application + PortletDefinition copy = source.getApplication().addPortlet(newPortletName); PortletDefinitionImpl copy = new PortletDefinitionImpl();
        Hide
        Randy Watler added a comment -

        Resolved this issue with attached registry-ojb-collections.patch: replaced all OM persistent collections and lists with removal aware versions as done with DBPM component. Note, however, that these collections are not synchronized, (the DBPM uses synchronized collections to protect against concurrent modification exceptions). This patch contains the ability to switch implementations if desired in the future.

        The attached page-manager-ojb-collections.patch contains changes necessary to implement synchronized collections that are also removal aware. This related problem was discovered while debugging modifications for the registry component. The patch also upgrades the synchronization of page manager OM collections to include collections loaded from the database, (only new collections were synchronized previously). If this is not desired, omit the changes to page-manager-repository.xml when applying patch.

        Show
        Randy Watler added a comment - Resolved this issue with attached registry-ojb-collections.patch: replaced all OM persistent collections and lists with removal aware versions as done with DBPM component. Note, however, that these collections are not synchronized, (the DBPM uses synchronized collections to protect against concurrent modification exceptions). This patch contains the ability to switch implementations if desired in the future. The attached page-manager-ojb-collections.patch contains changes necessary to implement synchronized collections that are also removal aware. This related problem was discovered while debugging modifications for the registry component. The patch also upgrades the synchronization of page manager OM collections to include collections loaded from the database, (only new collections were synchronized previously). If this is not desired, omit the changes to page-manager-repository.xml when applying patch.
        Hide
        Randy Watler added a comment -

        For future reference, here is the exception that is generated on subsequent portlet definition queries:

        Running org.apache.jetspeed.components.portletregistry.TestRegistryCache

                1. platform = MySQL
                  java.lang.IllegalStateException: Cannot generate a unique portlet name until the application and portlet name have been set
                  at org.apache.jetspeed.om.portlet.impl.PortletDefinitionImpl.getUniqueName(PortletDefinitionImpl.java:253)
                  at org.apache.jetspeed.components.portletregistry.RegistryPortletCache.cacheAdd(RegistryPortletCache.java:84)
                  at org.apache.jetspeed.components.portletregistry.RegistryPortletCache.cache(RegistryPortletCache.java:75)
                  at org.apache.ojb.broker.cache.CacheDistributor$ObjectCacheInternalWrapper.cache(CacheDistributor.java:396)
                  at org.apache.ojb.broker.cache.CacheDistributor$ObjectCacheInternalWrapper.doInternalCache(CacheDistributor.java:381)
                  at org.apache.ojb.broker.cache.CacheDistributor.doInternalCache(CacheDistributor.java:147)
                  at org.apache.ojb.broker.cache.MaterializationCache.pushObjects(MaterializationCache.java:198)
                  at org.apache.ojb.broker.cache.MaterializationCache.disableMaterializationCache(MaterializationCache.java:93)
                  at org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(QueryReferenceBroker.java:178)
                  at org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(QueryReferenceBroker.java:251)
                  at org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(QueryReferenceBroker.java:271)
                  at org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(PersistenceBrokerImpl.java:1367)
                  at org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQuery(DelegatingPersistenceBroker.java:338)
                  at org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQuery(DelegatingPersistenceBroker.java:338)
                  at org.springframework.orm.ojb.PersistenceBrokerTemplate$3.doInPersistenceBroker(PersistenceBrokerTemplate.java:192)
                  at org.springframework.orm.ojb.PersistenceBrokerTemplate.execute(PersistenceBrokerTemplate.java:138)
                  at org.springframework.orm.ojb.PersistenceBrokerTemplate.executeFind(PersistenceBrokerTemplate.java:159)
                  at org.springframework.orm.ojb.PersistenceBrokerTemplate.getCollectionByQuery(PersistenceBrokerTemplate.java:190)
                  at org.apache.jetspeed.components.portletregistry.PersistenceBrokerPortletRegistry.getAllPortletDefinitions(PersistenceBrokerPortletRegistry.java:108)
                  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                  at java.lang.reflect.Method.invoke(Method.java:597)
                  at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
                  at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
                  at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
                  at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
                  at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
                  at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
                  at $Proxy21.getAllPortletDefinitions(Unknown Source)
                  at org.apache.jetspeed.components.portletregistry.TestRegistryCache.testCache(TestRegistryCache.java:93)
        Show
        Randy Watler added a comment - For future reference, here is the exception that is generated on subsequent portlet definition queries: Running org.apache.jetspeed.components.portletregistry.TestRegistryCache platform = MySQL java.lang.IllegalStateException: Cannot generate a unique portlet name until the application and portlet name have been set at org.apache.jetspeed.om.portlet.impl.PortletDefinitionImpl.getUniqueName(PortletDefinitionImpl.java:253) at org.apache.jetspeed.components.portletregistry.RegistryPortletCache.cacheAdd(RegistryPortletCache.java:84) at org.apache.jetspeed.components.portletregistry.RegistryPortletCache.cache(RegistryPortletCache.java:75) at org.apache.ojb.broker.cache.CacheDistributor$ObjectCacheInternalWrapper.cache(CacheDistributor.java:396) at org.apache.ojb.broker.cache.CacheDistributor$ObjectCacheInternalWrapper.doInternalCache(CacheDistributor.java:381) at org.apache.ojb.broker.cache.CacheDistributor.doInternalCache(CacheDistributor.java:147) at org.apache.ojb.broker.cache.MaterializationCache.pushObjects(MaterializationCache.java:198) at org.apache.ojb.broker.cache.MaterializationCache.disableMaterializationCache(MaterializationCache.java:93) at org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(QueryReferenceBroker.java:178) at org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(QueryReferenceBroker.java:251) at org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(QueryReferenceBroker.java:271) at org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(PersistenceBrokerImpl.java:1367) at org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQuery(DelegatingPersistenceBroker.java:338) at org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQuery(DelegatingPersistenceBroker.java:338) at org.springframework.orm.ojb.PersistenceBrokerTemplate$3.doInPersistenceBroker(PersistenceBrokerTemplate.java:192) at org.springframework.orm.ojb.PersistenceBrokerTemplate.execute(PersistenceBrokerTemplate.java:138) at org.springframework.orm.ojb.PersistenceBrokerTemplate.executeFind(PersistenceBrokerTemplate.java:159) at org.springframework.orm.ojb.PersistenceBrokerTemplate.getCollectionByQuery(PersistenceBrokerTemplate.java:190) at org.apache.jetspeed.components.portletregistry.PersistenceBrokerPortletRegistry.getAllPortletDefinitions(PersistenceBrokerPortletRegistry.java:108) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) at $Proxy21.getAllPortletDefinitions(Unknown Source) at org.apache.jetspeed.components.portletregistry.TestRegistryCache.testCache(TestRegistryCache.java:93)

          People

          • Assignee:
            Randy Watler
            Reporter:
            Randy Watler
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development