[gatein-issues] [JBoss JIRA] (GTNPORTAL-2673) Gatein master Unit tests fails in GateIn Portal Component Portal Data on openjdk7

Stian Thorgersen (JIRA) jira-events at lists.jboss.org
Wed Nov 7 06:32:18 EST 2012


    [ https://issues.jboss.org/browse/GTNPORTAL-2673?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12732387#comment-12732387 ] 

Stian Thorgersen commented on GTNPORTAL-2673:
---------------------------------------------

After having looked at this a bit more there are a few issues with this:

h2. Garbage collection of expired tokens fails silently

If cleanExpiredTokens fails once the exception is not logged, and it will also stop garbage collecting in the future. I think it would be better if the exception is caught+logged.


h2. AbstractTokenService#cleanExpiredTokens could throw NPE

If a token is deleted between getAllTokens and getToken the returned token would be null, but this isn't checked.


h2. Many executors for AbstractTokenService

There are at least 5 implementations of AbstractTokenService each with its own ScheduledExecutorService. It would be more efficient to have a single service that does this job, or at least share the ScheduledExecutorService by making it static.


h2. Database/JCR is not initialized before first call

This is the real problem with this test. If the first test executes simultaneously with the first time AbstractTokenService#executor is executed it causes both to try to initialize the database/jcr as it seems there are some structures not initialized on "startup". I couldn't really get to the bottom of why this is, but I think if this is initialized lazily then it should be thread safe.

The exception from this is:
{code}
Caused by: javax.jcr.ItemExistsException: [portal-test] ADD NODE. Item already exists. Condition: parent ID, name, index. []:1[]gadgettokens:1, ID: d6b710db7f00010158c9af0e8ad058bc, ParentID: 00exo0jcr0root0uuid0000000000000. Cause >>>> integrity constraint violation: unique constraint or index violation: JCR_IDX_IPORTALTEST_PARENT: integrity constraint violation: unique constraint or index violation: JCR_IDX_IPORTALTEST_PARENT: integrity constraint violation: unique constraint or index violation: JCR_IDX_IPORTALTEST_PARENT
{code}

A workaround for the test would be to call for example service.getAllTokens() in setUp and catch the above exception if it occurs.


h2. ChromatticLifeCycle doesn't remove context from currenctContext when closed

It seems ChromatticLifeCycle should remove a context from currentContext when it is closed. For example in the test if service.getAllTokens() fails in setUp it causes the tests to fail as the currentContext in ChromatticLifeCycle is invalid.

The exception is:
{code}
org.chromattic.api.UndeclaredRepositoryException: javax.jcr.RepositoryException: This kind of operation is forbidden after a session.logout().
	at org.chromattic.core.DomainSession.findByPath(DomainSession.java:199)
	at org.chromattic.core.api.ChromatticSessionImpl.findByPath(ChromatticSessionImpl.java:228)
	at org.exoplatform.portal.gadget.core.GadgetTokenInfoService$TokenTask.getGadgetTokenContainer(GadgetTokenInfoService.java:149)
	at org.exoplatform.portal.gadget.core.GadgetTokenInfoService$1.execute(GadgetTokenInfoService.java:55)
	at org.exoplatform.portal.gadget.core.GadgetTokenInfoService$1.execute(GadgetTokenInfoService.java:1)
	at org.exoplatform.portal.gadget.core.GadgetTokenInfoService$TokenTask.execute(GadgetTokenInfoService.java:165)
	at org.exoplatform.commons.chromattic.ContextualTask.executeWith(ContextualTask.java:54)
	at org.exoplatform.portal.gadget.core.GadgetTokenInfoService.createToken(GadgetTokenInfoService.java:59)
	at org.exoplatform.portal.gadget.TestGadgetTokenInfoService.createTokens(TestGadgetTokenInfoService.java:76)
	at org.exoplatform.portal.gadget.TestGadgetTokenInfoService.testGetAllToken(TestGadgetTokenInfoService.java:109)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:601)
	at junit.framework.TestCase.runTest(TestCase.java:168)
	at junit.framework.TestCase.runBare(TestCase.java:134)
	at org.exoplatform.component.test.AbstractGateInTest.runBare(AbstractGateInTest.java:91)
	at junit.framework.TestResult$1.protect(TestResult.java:110)
	at junit.framework.TestResult.runProtected(TestResult.java:128)
	at junit.framework.TestResult.run(TestResult.java:113)
	at junit.framework.TestCase.run(TestCase.java:124)
	at junit.framework.TestSuite.runTest(TestSuite.java:243)
	at junit.framework.TestSuite.run(TestSuite.java:238)
	at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83)
	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: javax.jcr.RepositoryException: This kind of operation is forbidden after a session.logout().
	at org.exoplatform.services.jcr.impl.core.SessionImpl.checkLive(SessionImpl.java:917)
	at org.exoplatform.services.jcr.impl.core.SessionImpl.getRootNode(SessionImpl.java:760)
	at org.chromattic.core.DomainSessionImpl._getRoot(DomainSessionImpl.java:809)
	at org.chromattic.core.DomainSessionImpl._findByPath(DomainSessionImpl.java:115)
	at org.chromattic.core.DomainSession.findByPath(DomainSession.java:196)
	... 29 more
{code}
                
> Gatein master Unit tests fails in GateIn Portal Component Portal Data on openjdk7
> ---------------------------------------------------------------------------------
>
>                 Key: GTNPORTAL-2673
>                 URL: https://issues.jboss.org/browse/GTNPORTAL-2673
>             Project: GateIn Portal
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>    Affects Versions: 3.4.0.Final
>         Environment: jboss as 7.1.3
>            Reporter: Vlastislav Ramik
>            Assignee: Stian Thorgersen
>              Labels: EPP6.0-Test-Dev
>             Fix For: 3.5.0.Beta02
>
>
> org.exoplatform.portal.gadget.TestGadgetTokenInfoService.testGetToken
> org.exoplatform.portal.gadget.TestGadgetTokenInfoService.testGetAllToken
> org.exoplatform.portal.gadget.TestGadgetTokenInfoService.testSize
> org.exoplatform.portal.gadget.TestGadgetTokenInfoService.testDeleteToken
> see details: https://jenkins.mw.lab.eng.bos.redhat.com/hudson/view/EPP/view/6.0/view/Unit%20testing/job/epp6_unit_tests_epp6_openjdk1.7/12

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the gatein-issues mailing list