atom feed6 messages in com.googlegroups.alfresco-technical-discussionRe: [alfresco-tech] Delete user does ...
FromSent OnAttachments
Mano SwertsDec 7, 2012 6:22 am 
Gabriele ColumbroDec 7, 2012 9:34 am 
Mano SwertsDec 11, 2012 1:23 am 
Mano SwertsDec 11, 2012 11:33 pm 
Mano SwertsJan 15, 2013 11:08 pm 
Gabriele ColumbroJan 17, 2013 2:41 am 
Subject:Re: [alfresco-tech] Delete user does not work consistently in Maven SDK tests
From:Gabriele Columbro ("gab@alfresco.com)
Date:Jan 17, 2013 2:41:01 am
List:com.googlegroups.alfresco-technical-discussion

Sorry Mano,

I have been quite caught up lately and not able to give any TLC to the SDK.

I'll try to have a look at this this week, unless someone else in the list has some spare cycle to look into this / share experiences?

Thanks,

Gab

On 16 January 2013 08:08, Mano Swerts <m.sw@aca-it.be> wrote:

Hi all,

Does nobody have the same issue? Is there somebody looking into this?

Kind regards,

Mano Swerts

On Wednesday, December 12, 2012 8:33:27 AM UTC+1, Mano Swerts wrote:

Hi Gabriele,

The problem occurs with the deletion of other nodes as well. So probably you are right that it has to do with the transaction in the teardown not being committed. Do you have any clue how the transactions are implemented in the SDK? We already tried to set the Spring @Transactional and @Rollback annotations, but without any success. We also tried to manually start and commit a transaction using the Alfresco TransactionService, but also without result.

Hi Gabriele,

The deletion fails silently. It could be a transactional issue, but we do no manage transactions manually. The @AfterClass is always called and the deletes are called as well. We do a check whether the person still exists after the delete and it returns false. So it should be deleted, but apparently when we run the build a second time they do not seem to be deleted. So it seems to be a transaction that has not been committed, but like I said before, we do not handle transactions ourselves.

What I noticed however, is that the teardown only fails in the last test of the build. The teardown for all tests run fine, except for the last one. I verified that this behaviour is consistent.

Kind regards,

On Friday, December 7, 2012 6:34:15 PM UTC+1, Gabriele Columbro wrote:

Hi,

cc-ing the Maven Alfresco List as the question might be more appropriate there.

Do you get any exception when the deletion fail or it fails silently? Could it be somehow related to the transaction not being committed? Is the @AfterClass method always called?

Sorry for the quite simple questions, but I have no clue right now on why it shouldn't work.

Thanks,

Gab

On 7 December 2012 06:22, Mano Swerts <m.sw@aca-it.be> wrote:

Hi all,

We are using the new Alfresco Maven SDK, but we are running into problems creating and removing test users for our tests.

Take the following example:

public class AlfrescoTest { protected static PersonService personService;

@BeforeClass public static void initAppContext() { ApplicationContextHelper.**setUseLazyLoading(false); ApplicationContextHelper.**setNoAutoStart(true);

applicationContext = ApplicationContextHelper.**getApplicationContext(new String[] { "classpath:alfresco/**application-context.xml" }); personService = (PersonService) applicationContext.getBean("** PersonService"); AuthenticationUtil.**setFullyAuthenticatedUser("**admin"); personService.deletePerson("**John"); // always works, but not the place to do it createUser("John"); } @Test public void aSimpleTest() { // ... } @AfterClass public static void teardown() { AuthenticationUtil.**setFullyAuthenticatedUser("**admin"); personService.deletePerson("**John"); // mostly doesn't work } private static void createUser(String userName) { Map<QName, Serializable> properties = new HashMap<>(); properties.put(ContentModel.**PROP_USERNAME, userName); personService.createPerson(**properties); } }

As you can see in the code, we want to create some test users in the @BeforeClass of our test. This works fine. Then we want to delete these users at the end of the tests, so in the @AfterClass. This does not work reliably. Most of the time the users aren't deleted. When we delete them in the @BeforeClass it always works, but that's not the place we want to clear our users.

Does anybody have a clue why this isn't working?

Any help is greatly appreciated.

<http://university.alfresco.com>
<http://university.alfresco.com><https://twitter.com/#!/mindthegabz><https://www.facebook.com/mindthegabz><http://mindthegab.com/category/alfresco/><http://www.linkedin.com/in/columbro><http://www.youtube.com/user/alfresco101>

You received this message because you are subscribed to the Google Groups "Alfresco Technical Discussion" group. To view this discussion on the web visit https://groups.google.com/d/msg/alfresco-technical-discussion/-/xM5LQrL6rJ4J .

To post to this group, send email to alfr@googlegroups.com. To unsubscribe from this group, send email to alfresco-technical-discussion+unsu@googlegroups.com. For more options, visit this group at http://groups.google.com/group/alfresco-technical-discussion?hl=en.

<http://university.alfresco.com> <http://university.alfresco.com><https://twitter.com/#!/mindthegabz><https://www.facebook.com/mindthegabz><http://mindthegab.com/category/alfresco/><http://www.linkedin.com/in/columbro><http://www.youtube.com/user/alfresco101>