diff options
author | Leif Åstrand <leif@vaadin.com> | 2012-07-26 14:53:59 +0300 |
---|---|---|
committer | Leif Åstrand <leif@vaadin.com> | 2012-07-26 14:53:59 +0300 |
commit | 6455d8a5f809c98d93f6bfe89fbe55a64c66a03f (patch) | |
tree | 1f431716f3d581d33983fd2b788eb91d42a8ac95 /tests/server-side | |
parent | df430157bf12ae88e265318c09250a3865981a0c (diff) | |
parent | ca9fab0922d9db510c51f2d363b46577f7f6c0c4 (diff) | |
download | vaadin-framework-6455d8a5f809c98d93f6bfe89fbe55a64c66a03f.tar.gz vaadin-framework-6455d8a5f809c98d93f6bfe89fbe55a64c66a03f.zip |
Merge remote branch 'origin/6.8'
Conflicts:
src/com/vaadin/terminal/gwt/server/CommunicationManager.java
Diffstat (limited to 'tests/server-side')
-rw-r--r-- | tests/server-side/com/vaadin/tests/server/TestStreamVariableMapping.java | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/tests/server-side/com/vaadin/tests/server/TestStreamVariableMapping.java b/tests/server-side/com/vaadin/tests/server/TestStreamVariableMapping.java new file mode 100644 index 0000000000..7e9aefcbd9 --- /dev/null +++ b/tests/server-side/com/vaadin/tests/server/TestStreamVariableMapping.java @@ -0,0 +1,57 @@ +package com.vaadin.tests.server; + +import junit.framework.TestCase; + +import org.easymock.EasyMock; + +import com.vaadin.Application; +import com.vaadin.terminal.StreamVariable; +import com.vaadin.terminal.gwt.server.CommunicationManager; +import com.vaadin.ui.Upload; + +public class TestStreamVariableMapping extends TestCase { + private static final String variableName = "myName"; + + private Upload owner; + private StreamVariable streamVariable; + + private CommunicationManager cm; + + @Override + protected void setUp() throws Exception { + owner = new Upload(); + streamVariable = EasyMock.createMock(StreamVariable.class); + cm = createCommunicationManager(); + + super.setUp(); + } + + public void testAddStreamVariable() { + String targetUrl = cm.getStreamVariableTargetUrl(owner, variableName, + streamVariable); + assertTrue(targetUrl.startsWith("app://APP/UPLOAD/PID0/myName/")); + + StreamVariable streamVariable2 = cm.getStreamVariable( + cm.getPaintableId(owner), variableName); + assertSame(streamVariable, streamVariable2); + } + + public void testRemoverVariable() { + cm.getStreamVariableTargetUrl(owner, variableName, streamVariable); + assertNotNull(cm.getStreamVariable(cm.getPaintableId(owner), + variableName)); + + cm.cleanStreamVariable(owner, variableName); + assertNull(cm.getStreamVariable(cm.getPaintableId(owner), variableName)); + } + + private CommunicationManager createCommunicationManager() { + return new CommunicationManager(new Application() { + @Override + public void init() { + // TODO Auto-generated method stub + } + }); + } + +} |