Bladeren bron

Fix server test RemoveFromParentLockingTest

Change-Id: Ib3af43a1b6945db00194775fbb2a91b4b495ee9b
tags/7.7.0.alpha1
elmot 8 jaren geleden
bovenliggende
commit
d494f822bb

+ 9
- 4
server/src/test/java/com/vaadin/tests/server/component/abstractsinglecomponentcontainer/RemoveFromParentLockingTest.java Bestand weergeven

import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock; import java.util.concurrent.locks.ReentrantLock;


import org.junit.After;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Before;
import org.junit.Test; import org.junit.Test;


import com.vaadin.server.VaadinRequest; import com.vaadin.server.VaadinRequest;


public class RemoveFromParentLockingTest { public class RemoveFromParentLockingTest {


@Before
@After
public void cleanCurrentSession()
{
VaadinSession.setCurrent(null);
}

private static VerticalLayout createTestComponent() { private static VerticalLayout createTestComponent() {
VaadinSession session = new VaadinSession(null) { VaadinSession session = new VaadinSession(null) {
private final ReentrantLock lock = new ReentrantLock(); private final ReentrantLock lock = new ReentrantLock();
"Cannot remove from parent when the session is not locked." "Cannot remove from parent when the session is not locked."
+ " Furthermore, there is another locked session, indicating that the component might be about to be moved from one session to another.", + " Furthermore, there is another locked session, indicating that the component might be about to be moved from one session to another.",
e.getMessage()); e.getMessage());
} finally {
VaadinSession.setCurrent(null);
} }
} }


notLockedComponent.addComponent(lockedComponent); notLockedComponent.addComponent(lockedComponent);
} catch (AssertionError e) { } catch (AssertionError e) {
// All is fine, don't care about the exact wording in this case // All is fine, don't care about the exact wording in this case
} finally {
VaadinSession.setCurrent(null);
} }
} }



Laden…
Annuleren
Opslaan