summaryrefslogtreecommitdiffstats
path: root/server/tests/src/com/vaadin
diff options
context:
space:
mode:
authorLeif Åstrand <leif@vaadin.com>2012-09-05 19:30:41 +0300
committerLeif Åstrand <leif@vaadin.com>2012-09-05 19:30:41 +0300
commitcc3ddcac953a087b09ae330ff37126dcd5ec727f (patch)
tree35a0b367042298b212038e9cba0ea7d81e6909c3 /server/tests/src/com/vaadin
parentd1c361e251800c6f7d596ddf79ed1c7569196856 (diff)
downloadvaadin-framework-cc3ddcac953a087b09ae330ff37126dcd5ec727f.tar.gz
vaadin-framework-cc3ddcac953a087b09ae330ff37126dcd5ec727f.zip
Remove getApplication() and add getSession() (#9402)
Diffstat (limited to 'server/tests/src/com/vaadin')
-rw-r--r--server/tests/src/com/vaadin/tests/data/converter/ConverterFactory.java4
-rw-r--r--server/tests/src/com/vaadin/tests/server/TestStreamVariableMapping.java2
-rw-r--r--server/tests/src/com/vaadin/tests/server/component/abstractfield/AbstractFieldValueConversions.java2
-rw-r--r--server/tests/src/com/vaadin/tests/server/component/abstractfield/RemoveListenersOnDetach.java4
-rw-r--r--server/tests/src/com/vaadin/tests/server/component/window/AttachDetachWindow.java47
5 files changed, 37 insertions, 22 deletions
diff --git a/server/tests/src/com/vaadin/tests/data/converter/ConverterFactory.java b/server/tests/src/com/vaadin/tests/data/converter/ConverterFactory.java
index 66160907b2..b64514ea14 100644
--- a/server/tests/src/com/vaadin/tests/data/converter/ConverterFactory.java
+++ b/server/tests/src/com/vaadin/tests/data/converter/ConverterFactory.java
@@ -72,7 +72,7 @@ public class ConverterFactory extends TestCase {
TextField tf = new TextField("", "123") {
@Override
- public VaadinSession getApplication() {
+ public VaadinSession getSession() {
return appWithCustomIntegerConverter;
};
};
@@ -103,7 +103,7 @@ public class ConverterFactory extends TestCase {
TextField tf = new TextField("", "123") {
@Override
- public VaadinSession getApplication() {
+ public VaadinSession getSession() {
return fieldAppWithCustomIntegerConverter;
}
};
diff --git a/server/tests/src/com/vaadin/tests/server/TestStreamVariableMapping.java b/server/tests/src/com/vaadin/tests/server/TestStreamVariableMapping.java
index e286e7231e..0dd7efa507 100644
--- a/server/tests/src/com/vaadin/tests/server/TestStreamVariableMapping.java
+++ b/server/tests/src/com/vaadin/tests/server/TestStreamVariableMapping.java
@@ -30,7 +30,7 @@ public class TestStreamVariableMapping extends TestCase {
}
@Override
- public VaadinSession getApplication() {
+ public VaadinSession getSession() {
return application;
}
};
diff --git a/server/tests/src/com/vaadin/tests/server/component/abstractfield/AbstractFieldValueConversions.java b/server/tests/src/com/vaadin/tests/server/component/abstractfield/AbstractFieldValueConversions.java
index d372b96339..b48ad62bcc 100644
--- a/server/tests/src/com/vaadin/tests/server/component/abstractfield/AbstractFieldValueConversions.java
+++ b/server/tests/src/com/vaadin/tests/server/component/abstractfield/AbstractFieldValueConversions.java
@@ -190,7 +190,7 @@ public class AbstractFieldValueConversions extends TestCase {
VaadinSession.setCurrent(a);
TextField tf = new TextField() {
@Override
- public VaadinSession getApplication() {
+ public VaadinSession getSession() {
return a;
}
};
diff --git a/server/tests/src/com/vaadin/tests/server/component/abstractfield/RemoveListenersOnDetach.java b/server/tests/src/com/vaadin/tests/server/component/abstractfield/RemoveListenersOnDetach.java
index b498bbe73f..c9f579a887 100644
--- a/server/tests/src/com/vaadin/tests/server/component/abstractfield/RemoveListenersOnDetach.java
+++ b/server/tests/src/com/vaadin/tests/server/component/abstractfield/RemoveListenersOnDetach.java
@@ -29,7 +29,7 @@ public class RemoveListenersOnDetach {
}
@Override
- public VaadinSession getApplication() {
+ public VaadinSession getSession() {
return application;
}
@@ -59,7 +59,7 @@ public class RemoveListenersOnDetach {
};
@Override
- public VaadinSession getApplication() {
+ public VaadinSession getSession() {
return application;
};
};
diff --git a/server/tests/src/com/vaadin/tests/server/component/window/AttachDetachWindow.java b/server/tests/src/com/vaadin/tests/server/component/window/AttachDetachWindow.java
index bab7ca2c8c..ec722fdffb 100644
--- a/server/tests/src/com/vaadin/tests/server/component/window/AttachDetachWindow.java
+++ b/server/tests/src/com/vaadin/tests/server/component/window/AttachDetachWindow.java
@@ -5,6 +5,7 @@ import static org.junit.Assert.assertTrue;
import org.junit.Test;
+import com.vaadin.server.ClientConnector;
import com.vaadin.server.VaadinSession;
import com.vaadin.server.WrappedRequest;
import com.vaadin.ui.Label;
@@ -23,7 +24,7 @@ public class AttachDetachWindow {
public TestContent getTestContent();
- public VaadinSession getApplication();
+ public VaadinSession getSession();
}
private class TestWindow extends Window implements TestContainer {
@@ -61,6 +62,11 @@ public class AttachDetachWindow {
public TestContent getTestContent() {
return testContent;
}
+
+ @Override
+ public VaadinSession getSession() {
+ return super.getSession();
+ }
}
private class TestContent extends VerticalLayout {
@@ -155,7 +161,7 @@ public class AttachDetachWindow {
assertUnattached(sub);
// attaching main should recurse to sub
- main.setApplication(testApp);
+ main.setSession(testApp);
assertAttached(main);
assertAttached(sub);
}
@@ -165,7 +171,7 @@ public class AttachDetachWindow {
assertUnattached(main);
assertUnattached(sub);
- main.setApplication(testApp);
+ main.setSession(testApp);
assertAttached(main);
assertUnattached(sub);
@@ -177,7 +183,7 @@ public class AttachDetachWindow {
@Test
public void removeSubWindowBeforeDetachingMainWindow() {
- main.setApplication(testApp);
+ main.setSession(testApp);
main.addWindow(sub);
// sub should be detached when removing from attached main
@@ -186,18 +192,18 @@ public class AttachDetachWindow {
assertDetached(sub);
// main detach should recurse to sub
- main.setApplication(null);
+ main.setSession(null);
assertDetached(main);
assertDetached(sub);
}
@Test
public void removeSubWindowAfterDetachingMainWindow() {
- main.setApplication(testApp);
+ main.setSession(testApp);
main.addWindow(sub);
// main detach should recurse to sub
- main.setApplication(null);
+ main.setSession(null);
assertDetached(main);
assertDetached(sub);
@@ -219,22 +225,31 @@ public class AttachDetachWindow {
assertTrue("window child attach not called",
testContent.childAttachCalled);
- assertSame("window not attached", win.getApplication(), testApp);
- assertSame("window content not attached", testContent.getApplication(),
- testApp);
- assertSame("window children not attached",
- testContent.child.getApplication(), testApp);
+ assertSame("window not attached", win.getSession(), testApp);
+ assertSame("window content not attached", testContent.getUI()
+ .getSession(), testApp);
+ assertSame("window children not attached", testContent.child.getUI()
+ .getSession(), testApp);
}
/**
* Asserts that win and its children are not attached.
*/
private void assertUnattached(TestContainer win) {
- assertSame("window not detached", win.getApplication(), null);
- assertSame("window content not detached", win.getTestContent()
- .getApplication(), null);
+ assertSame("window not detached", win.getSession(), null);
+ assertSame("window content not detached",
+ getVaadinSession(win.getTestContent()), null);
assertSame("window children not detached",
- win.getTestContent().child.getApplication(), null);
+ getVaadinSession(win.getTestContent().child), null);
+ }
+
+ private VaadinSession getVaadinSession(ClientConnector testContainer) {
+ UI ui = testContainer.getUI();
+ if (ui != null) {
+ return ui.getSession();
+ } else {
+ return null;
+ }
}
/**