summaryrefslogtreecommitdiffstats
path: root/server/tests
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2013-04-09 01:06:33 +0300
committerArtur Signell <artur@vaadin.com>2013-04-09 23:32:17 +0300
commit48208188a5da6b143b83aa26f908e7f91163ca18 (patch)
tree24b7d6741f6a49e71363a3773281862fb77c0f81 /server/tests
parent5552dce2c4a4dd107c6794c8ffa717bfaf14152c (diff)
downloadvaadin-framework-48208188a5da6b143b83aa26f908e7f91163ca18.tar.gz
vaadin-framework-48208188a5da6b143b83aa26f908e7f91163ca18.zip
Fixed tests to use a real DeploymentConfiguration instance
Change-Id: I1c6f74bfcefda7843a55d149a5ecd33ae4c2ebf2
Diffstat (limited to 'server/tests')
-rw-r--r--server/tests/src/com/vaadin/server/VaadinSessionTest.java3
-rw-r--r--server/tests/src/com/vaadin/tests/data/converter/ConverterFactory.java2
-rw-r--r--server/tests/src/com/vaadin/tests/server/TestStreamVariableMapping.java5
-rw-r--r--server/tests/src/com/vaadin/tests/server/clientconnector/AttachDetachListeners.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/DefaultConverterFactory.java2
-rw-r--r--server/tests/src/com/vaadin/tests/server/component/abstractfield/RemoveListenersOnDetach.java2
-rw-r--r--server/tests/src/com/vaadin/tests/server/component/label/LabelConverters.java2
-rw-r--r--server/tests/src/com/vaadin/tests/server/component/ui/CustomUIClassLoader.java2
-rw-r--r--server/tests/src/com/vaadin/tests/server/component/window/AddRemoveSubWindow.java2
-rw-r--r--server/tests/src/com/vaadin/tests/server/component/window/AttachDetachWindow.java2
-rw-r--r--server/tests/src/com/vaadin/tests/util/AlwaysLockedVaadinSession.java (renamed from server/tests/src/com/vaadin/tests/server/AlwaysLockedVaadinSession.java)2
-rw-r--r--server/tests/src/com/vaadin/tests/util/MockDeploymentConfiguration.java92
-rw-r--r--server/tests/src/com/vaadin/ui/LabelDataSource.java2
14 files changed, 108 insertions, 14 deletions
diff --git a/server/tests/src/com/vaadin/server/VaadinSessionTest.java b/server/tests/src/com/vaadin/server/VaadinSessionTest.java
index e433e6fd05..3f83fde711 100644
--- a/server/tests/src/com/vaadin/server/VaadinSessionTest.java
+++ b/server/tests/src/com/vaadin/server/VaadinSessionTest.java
@@ -30,6 +30,7 @@ import org.junit.Test;
import com.vaadin.server.ClientConnector.DetachEvent;
import com.vaadin.server.ClientConnector.DetachListener;
+import com.vaadin.tests.util.MockDeploymentConfiguration;
import com.vaadin.ui.UI;
import com.vaadin.util.CurrentInstance;
@@ -53,7 +54,7 @@ public class VaadinSessionTest {
};
mockService = new VaadinServletService(mockServlet,
- EasyMock.createMock(DeploymentConfiguration.class));
+ new MockDeploymentConfiguration());
mockHttpSession = EasyMock.createMock(HttpSession.class);
mockWrappedSession = new WrappedHttpSession(mockHttpSession) {
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 bf4412fbce..9da8406507 100644
--- a/server/tests/src/com/vaadin/tests/data/converter/ConverterFactory.java
+++ b/server/tests/src/com/vaadin/tests/data/converter/ConverterFactory.java
@@ -22,7 +22,7 @@ import junit.framework.TestCase;
import com.vaadin.data.util.converter.Converter;
import com.vaadin.data.util.converter.DefaultConverterFactory;
import com.vaadin.server.VaadinSession;
-import com.vaadin.tests.server.AlwaysLockedVaadinSession;
+import com.vaadin.tests.util.AlwaysLockedVaadinSession;
import com.vaadin.ui.TextField;
public class ConverterFactory extends TestCase {
diff --git a/server/tests/src/com/vaadin/tests/server/TestStreamVariableMapping.java b/server/tests/src/com/vaadin/tests/server/TestStreamVariableMapping.java
index da0bf9ebc8..3ea114b488 100644
--- a/server/tests/src/com/vaadin/tests/server/TestStreamVariableMapping.java
+++ b/server/tests/src/com/vaadin/tests/server/TestStreamVariableMapping.java
@@ -4,13 +4,14 @@ import junit.framework.TestCase;
import org.easymock.EasyMock;
-import com.vaadin.server.DeploymentConfiguration;
import com.vaadin.server.LegacyCommunicationManager;
import com.vaadin.server.StreamVariable;
import com.vaadin.server.VaadinRequest;
import com.vaadin.server.VaadinServlet;
import com.vaadin.server.VaadinServletService;
import com.vaadin.server.VaadinSession;
+import com.vaadin.tests.util.AlwaysLockedVaadinSession;
+import com.vaadin.tests.util.MockDeploymentConfiguration;
import com.vaadin.ui.ConnectorTracker;
import com.vaadin.ui.UI;
import com.vaadin.ui.Upload;
@@ -78,7 +79,7 @@ public class TestStreamVariableMapping extends TestCase {
private LegacyCommunicationManager createCommunicationManager() {
VaadinServletService vss = new VaadinServletService(
EasyMock.createMock(VaadinServlet.class),
- EasyMock.createMock(DeploymentConfiguration.class));
+ new MockDeploymentConfiguration());
return new LegacyCommunicationManager(
new AlwaysLockedVaadinSession(vss));
}
diff --git a/server/tests/src/com/vaadin/tests/server/clientconnector/AttachDetachListeners.java b/server/tests/src/com/vaadin/tests/server/clientconnector/AttachDetachListeners.java
index f8dbaccdad..bd7053af40 100644
--- a/server/tests/src/com/vaadin/tests/server/clientconnector/AttachDetachListeners.java
+++ b/server/tests/src/com/vaadin/tests/server/clientconnector/AttachDetachListeners.java
@@ -18,7 +18,7 @@ import com.vaadin.server.ClientConnector.DetachListener;
import com.vaadin.server.VaadinRequest;
import com.vaadin.server.VaadinService;
import com.vaadin.server.VaadinSession;
-import com.vaadin.tests.server.AlwaysLockedVaadinSession;
+import com.vaadin.tests.util.AlwaysLockedVaadinSession;
import com.vaadin.ui.Component;
import com.vaadin.ui.CssLayout;
import com.vaadin.ui.Label;
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 144ca0fe24..3c4d43543b 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
@@ -17,7 +17,7 @@ import com.vaadin.tests.data.bean.Address;
import com.vaadin.tests.data.bean.Country;
import com.vaadin.tests.data.bean.Person;
import com.vaadin.tests.data.bean.Sex;
-import com.vaadin.tests.server.AlwaysLockedVaadinSession;
+import com.vaadin.tests.util.AlwaysLockedVaadinSession;
import com.vaadin.ui.CheckBox;
import com.vaadin.ui.TextField;
diff --git a/server/tests/src/com/vaadin/tests/server/component/abstractfield/DefaultConverterFactory.java b/server/tests/src/com/vaadin/tests/server/component/abstractfield/DefaultConverterFactory.java
index 5455da18f8..bac024725f 100644
--- a/server/tests/src/com/vaadin/tests/server/component/abstractfield/DefaultConverterFactory.java
+++ b/server/tests/src/com/vaadin/tests/server/component/abstractfield/DefaultConverterFactory.java
@@ -11,7 +11,7 @@ import com.vaadin.tests.data.bean.Address;
import com.vaadin.tests.data.bean.Country;
import com.vaadin.tests.data.bean.Person;
import com.vaadin.tests.data.bean.Sex;
-import com.vaadin.tests.server.AlwaysLockedVaadinSession;
+import com.vaadin.tests.util.AlwaysLockedVaadinSession;
import com.vaadin.ui.TextField;
public class DefaultConverterFactory extends TestCase {
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 731387d203..fcf17cc499 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
@@ -9,7 +9,7 @@ import com.vaadin.data.util.AbstractProperty;
import com.vaadin.data.util.converter.Converter.ConversionException;
import com.vaadin.server.VaadinRequest;
import com.vaadin.server.VaadinSession;
-import com.vaadin.tests.server.AlwaysLockedVaadinSession;
+import com.vaadin.tests.util.AlwaysLockedVaadinSession;
import com.vaadin.ui.AbstractField;
import com.vaadin.ui.UI;
diff --git a/server/tests/src/com/vaadin/tests/server/component/label/LabelConverters.java b/server/tests/src/com/vaadin/tests/server/component/label/LabelConverters.java
index 13da46cd60..9d71db89a6 100644
--- a/server/tests/src/com/vaadin/tests/server/component/label/LabelConverters.java
+++ b/server/tests/src/com/vaadin/tests/server/component/label/LabelConverters.java
@@ -21,7 +21,7 @@ import com.vaadin.data.Property;
import com.vaadin.data.util.MethodProperty;
import com.vaadin.server.VaadinSession;
import com.vaadin.tests.data.bean.Person;
-import com.vaadin.tests.server.AlwaysLockedVaadinSession;
+import com.vaadin.tests.util.AlwaysLockedVaadinSession;
import com.vaadin.ui.Label;
public class LabelConverters extends TestCase {
diff --git a/server/tests/src/com/vaadin/tests/server/component/ui/CustomUIClassLoader.java b/server/tests/src/com/vaadin/tests/server/component/ui/CustomUIClassLoader.java
index 186f563569..1df1d36cab 100644
--- a/server/tests/src/com/vaadin/tests/server/component/ui/CustomUIClassLoader.java
+++ b/server/tests/src/com/vaadin/tests/server/component/ui/CustomUIClassLoader.java
@@ -15,7 +15,7 @@ import com.vaadin.server.UIClassSelectionEvent;
import com.vaadin.server.VaadinRequest;
import com.vaadin.server.VaadinService;
import com.vaadin.server.VaadinSession;
-import com.vaadin.tests.server.AlwaysLockedVaadinSession;
+import com.vaadin.tests.util.AlwaysLockedVaadinSession;
import com.vaadin.ui.UI;
public class CustomUIClassLoader extends TestCase {
diff --git a/server/tests/src/com/vaadin/tests/server/component/window/AddRemoveSubWindow.java b/server/tests/src/com/vaadin/tests/server/component/window/AddRemoveSubWindow.java
index 15d3707f28..774eafceaf 100644
--- a/server/tests/src/com/vaadin/tests/server/component/window/AddRemoveSubWindow.java
+++ b/server/tests/src/com/vaadin/tests/server/component/window/AddRemoveSubWindow.java
@@ -8,7 +8,7 @@ import org.junit.Test;
import com.vaadin.server.LegacyApplication;
import com.vaadin.server.VaadinSession;
-import com.vaadin.tests.server.AlwaysLockedVaadinSession;
+import com.vaadin.tests.util.AlwaysLockedVaadinSession;
import com.vaadin.ui.LegacyWindow;
import com.vaadin.ui.UI;
import com.vaadin.ui.Window;
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 4dfadc23a1..485b17830f 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
@@ -8,7 +8,7 @@ import org.junit.Test;
import com.vaadin.server.ClientConnector;
import com.vaadin.server.VaadinRequest;
import com.vaadin.server.VaadinSession;
-import com.vaadin.tests.server.AlwaysLockedVaadinSession;
+import com.vaadin.tests.util.AlwaysLockedVaadinSession;
import com.vaadin.ui.Label;
import com.vaadin.ui.UI;
import com.vaadin.ui.VerticalLayout;
diff --git a/server/tests/src/com/vaadin/tests/server/AlwaysLockedVaadinSession.java b/server/tests/src/com/vaadin/tests/util/AlwaysLockedVaadinSession.java
index 49e761f8b1..9b0b524b6a 100644
--- a/server/tests/src/com/vaadin/tests/server/AlwaysLockedVaadinSession.java
+++ b/server/tests/src/com/vaadin/tests/util/AlwaysLockedVaadinSession.java
@@ -1,4 +1,4 @@
-package com.vaadin.tests.server;
+package com.vaadin.tests.util;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
diff --git a/server/tests/src/com/vaadin/tests/util/MockDeploymentConfiguration.java b/server/tests/src/com/vaadin/tests/util/MockDeploymentConfiguration.java
new file mode 100644
index 0000000000..cd53a564d2
--- /dev/null
+++ b/server/tests/src/com/vaadin/tests/util/MockDeploymentConfiguration.java
@@ -0,0 +1,92 @@
+package com.vaadin.tests.util;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+
+import com.vaadin.server.DeploymentConfiguration;
+import com.vaadin.shared.communication.PushMode;
+
+public class MockDeploymentConfiguration implements DeploymentConfiguration {
+
+ private boolean productionMode = false;
+ private boolean xsrfProtectionEnabled = true;
+
+ private int resourceCacheTime = 12;
+ private int heartbeatInterval = 300;
+ private boolean closeIdleSessions = false;
+ private PushMode pushMode = PushMode.DISABLED;
+ private Properties initParameters = new Properties();
+ private Map<String, String> applicationOrSystemProperty = new HashMap<String, String>();
+
+ public boolean isProductionMode() {
+ return productionMode;
+ }
+
+ public void setProductionMode(boolean productionMode) {
+ this.productionMode = productionMode;
+ }
+
+ public boolean isXsrfProtectionEnabled() {
+ return xsrfProtectionEnabled;
+ }
+
+ public void setXsrfProtectionEnabled(boolean xsrfProtectionEnabled) {
+ this.xsrfProtectionEnabled = xsrfProtectionEnabled;
+ }
+
+ public int getResourceCacheTime() {
+ return resourceCacheTime;
+ }
+
+ public void setResourceCacheTime(int resourceCacheTime) {
+ this.resourceCacheTime = resourceCacheTime;
+ }
+
+ public int getHeartbeatInterval() {
+ return heartbeatInterval;
+ }
+
+ public void setHeartbeatInterval(int heartbeatInterval) {
+ this.heartbeatInterval = heartbeatInterval;
+ }
+
+ public boolean isCloseIdleSessions() {
+ return closeIdleSessions;
+ }
+
+ public void setCloseIdleSessions(boolean closeIdleSessions) {
+ this.closeIdleSessions = closeIdleSessions;
+ }
+
+ public PushMode getPushMode() {
+ return pushMode;
+ }
+
+ public void setPushMode(PushMode pushMode) {
+ this.pushMode = pushMode;
+ }
+
+ public Properties getInitParameters() {
+ return initParameters;
+ }
+
+ public void setInitParameter(String key, String value) {
+ initParameters.setProperty(key, value);
+ }
+
+ public void setApplicationOrSystemProperty(String key, String value) {
+ applicationOrSystemProperty.put(key, value);
+ }
+
+ @Override
+ public String getApplicationOrSystemProperty(String propertyName,
+ String defaultValue) {
+ if (applicationOrSystemProperty.containsKey(propertyName)) {
+ return applicationOrSystemProperty.get(propertyName);
+ } else {
+ return defaultValue;
+ }
+ }
+
+}
diff --git a/server/tests/src/com/vaadin/ui/LabelDataSource.java b/server/tests/src/com/vaadin/ui/LabelDataSource.java
index 87ca4e372c..21d3e56d57 100644
--- a/server/tests/src/com/vaadin/ui/LabelDataSource.java
+++ b/server/tests/src/com/vaadin/ui/LabelDataSource.java
@@ -24,7 +24,7 @@ import org.junit.Test;
import com.vaadin.data.util.ObjectProperty;
import com.vaadin.server.VaadinRequest;
import com.vaadin.server.VaadinSession;
-import com.vaadin.tests.server.AlwaysLockedVaadinSession;
+import com.vaadin.tests.util.AlwaysLockedVaadinSession;
public class LabelDataSource {