Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JAMES-2156 issue implementation #1857

Closed
wants to merge 1 commit into from
Closed

Conversation

sebast26
Copy link

This is rebase of PR #1077 as in issue #999. Unfortunately there are some problems with tests. If you don't mind I will work on correcting the issues. Most of the work is done by @p3trur0.

@chibenwa chibenwa added this to the polish_2018_10 milestone Oct 29, 2018
@chibenwa chibenwa added the contribution Contribution of a kind contributor - also applicable for community oriented efforts. label Oct 29, 2018
@chibenwa
Copy link
Member

Hi @sebast26

Thanks for volunteering for continuing this work.

There are still a couple of issues with the proposed code...

[e27bd30fdc6011f56c0b07203e4b26f2855ffa5d] [ERROR] Errors: 
[e27bd30fdc6011f56c0b07203e4b26f2855ffa5d] [ERROR]   JPAAttachmentMapperTest>AttachmentMapperTest.getAttachmentShouldReturnTheAttachmentWhenReferenced:80 » AttachmentNotFound
[e27bd30fdc6011f56c0b07203e4b26f2855ffa5d] [ERROR]   JPAAttachmentMapperTest>AttachmentMapperTest.getAttachmentShouldReturnTheAttachmentsWhenMultipleStored:101 » AttachmentNotFound
[e27bd30fdc6011f56c0b07203e4b26f2855ffa5d] [ERROR]   JPAMemoryMessageWithAttachmentMapperTest>MessageWithAttachmentMapperTest.messagesCanBeRetrievedInMailboxWithRangeTypeOne:173->MessageWithAttachmentMapperTest.saveMessages:196 » InvalidState
[e27bd30fdc6011f56c0b07203e4b26f2855ffa5d] [ERROR]   JPAMemoryMessageWithAttachmentMapperTest>MessageWithAttachmentMapperTest.messagesRetrievedUsingFetchTypeBodyShouldHaveAttachmentsLoadedWhenOneAttachment:139->MessageWithAttachmentMapperTest.saveMessages:196 » InvalidState
[e27bd30fdc6011f56c0b07203e4b26f2855ffa5d] [ERROR]   JPAMemoryMessageWithAttachmentMapperTest>MessageWithAttachmentMapperTest.messagesRetrievedUsingFetchTypeBodyShouldHaveBodyDataLoaded:181->MessageWithAttachmentMapperTest.saveMessages:196 » InvalidState
[e27bd30fdc6011f56c0b07203e4b26f2855ffa5d] [ERROR]   JPAMemoryMessageWithAttachmentMapperTest>MessageWithAttachmentMapperTest.messagesRetrievedUsingFetchTypeFullShouldHaveAttachmentsEmptyWhenNoAttachment:165->MessageWithAttachmentMapperTest.saveMessages:196 » InvalidState
[e27bd30fdc6011f56c0b07203e4b26f2855ffa5d] [ERROR]   JPAMemoryMessageWithAttachmentMapperTest>MessageWithAttachmentMapperTest.messagesRetrievedUsingFetchTypeFullShouldHaveAttachmentsLoadedWhenOneAttachment:123->MessageWithAttachmentMapperTest.saveMessages:196 » InvalidState
[e27bd30fdc6011f56c0b07203e4b26f2855ffa5d] [ERROR]   JPAMemoryMessageWithAttachmentMapperTest>MessageWithAttachmentMapperTest.messagesRetrievedUsingFetchTypeFullShouldHaveAttachmentsLoadedWhenTwoAttachments:131->MessageWithAttachmentMapperTest.saveMessages:196 » InvalidState

Could you have a look?

Cheers,

@sebast26
Copy link
Author

Sure, that was my goal in the first place. ;P

@chibenwa chibenwa modified the milestones: polish_2018_10, Sprint 42 Oct 31, 2018
@blackheaven
Copy link

Hi @sebast26

Have you had some time to have a look at the test failure? Do you need some help?

Regards.

@chibenwa chibenwa removed this from the Sprint 42 milestone Jan 4, 2019
@Fredmomo
Copy link

Fredmomo commented Jan 24, 2019

Hi, I'm looking at this task, first start from scratch and later find this pr, while doing unit testing I found there's an issue with the MessageWithAttachmentMapperTest$$saveMessages()method, it deeply calls JPAUidProvider$$lockedNextUid() method, however when running uts, the JPAMailbox m = manager.find(JPAMailbox.class, mailboxId.getRawId());will return null when running ut and after adding the optional statement as

JPAMailbox m = Optional.ofNullable(manager.find(JPAMailbox.class, mailboxId.getRawId()))
                    .orElse(new JPAMailbox(mailbox));

I will get persistence exception saying the MAILBOX_ID cannot accept null value, when I set the mailbox_id obtained from last step JPAId mailboxId = (JPAId) mailbox.getMailboxId(); then I will get optimistic exception with this message Attempted to attach deleted instance type "class org.apache.james.mailbox.jpa.mail.model.JPAMailbox" with oid "774084263". If the instance is new, the version field should be left to its default value., I try to change the id generated strategy and change persist() to merge()trying to attach the entity but the exception still exists. Dose somebody have any idea on this?

@Fredmomo
Copy link

BTW, there's a jira ticket which may have some relevance with this, the issue happens when null pointer exception thrown and in finally block to close entity manage but the transaction is still active.

@trantienduchn
Copy link

trantienduchn commented Jan 24, 2019

Hello @ReturnHttp402, are you testing current MessageWithAttachmentMapperTest at master? or the JPAMemoryMessageWithAttachmentMapperTest in this branch? Is the problem is:

JPAMailbox m = manager.find(JPAMailbox.class, mailboxId.getRawId());

always returns null?

@Fredmomo
Copy link

Fredmomo commented Jan 24, 2019

Hello @ReturnHttp402, are you testing current MessageWithAttachmentMapperTest at master? or the JPAMemoryMessageWithAttachmentMapperTest in this branch? Is the problem is:

JPAMailbox m = manager.find(JPAMailbox.class, mailboxId.getRawId());

always returns null?

Yes I'm testing MessageWithAttachmentMapperTest 's implementation test class JPAMessageWithAttachmentMapperTest but no I'm testing in my own local branch, but I look through the code, my code is very similar with this branch. the find JPAMailbox always returns null.

@trantienduchn
Copy link

I don't have much experiment with this component, could you share to me your branch so I can run that test on my local machine and find out what is wrong?

@Fredmomo
Copy link

I don't have much experiment with this component, could you share to me your branch so I can run that test on my local machine and find out what is wrong?

I have uploaded my code and you can find in this pull request

@chibenwa chibenwa closed this Apr 21, 2023
quantranhong1999 pushed a commit to quantranhong1999/james-project that referenced this pull request Dec 18, 2023
vttranlina pushed a commit to vttranlina/james-project that referenced this pull request Jan 10, 2024
vttranlina pushed a commit to vttranlina/james-project that referenced this pull request Jan 11, 2024
vttranlina pushed a commit to vttranlina/james-project that referenced this pull request Jan 11, 2024
vttranlina pushed a commit to vttranlina/james-project that referenced this pull request Jan 11, 2024
Arsnael pushed a commit to Arsnael/james-project that referenced this pull request Mar 20, 2024
vttranlina pushed a commit to vttranlina/james-project that referenced this pull request Apr 14, 2024
vttranlina pushed a commit to vttranlina/james-project that referenced this pull request Apr 16, 2024
vttranlina pushed a commit to vttranlina/james-project that referenced this pull request Jun 25, 2024
vttranlina pushed a commit to vttranlina/james-project that referenced this pull request Jun 25, 2024
vttranlina pushed a commit to vttranlina/james-project that referenced this pull request Jun 26, 2024
Arsnael pushed a commit to Arsnael/james-project that referenced this pull request Jun 28, 2024
vttranlina pushed a commit to vttranlina/james-project that referenced this pull request Oct 24, 2024
vttranlina pushed a commit to vttranlina/james-project that referenced this pull request Nov 20, 2024
vttranlina pushed a commit to vttranlina/james-project that referenced this pull request Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contribution Contribution of a kind contributor - also applicable for community oriented efforts.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants