]> source.dussan.org Git - vaadin-framework.git/commitdiff
Fixed test issues
authorArtur Signell <artur@vaadin.com>
Thu, 6 Jun 2013 21:32:36 +0000 (00:32 +0300)
committerArtur Signell <artur@vaadin.com>
Thu, 6 Jun 2013 21:38:27 +0000 (00:38 +0300)
Change-Id: Iebf44d7bff598248fe1cda138ac1d8b4100775ba

common.xml
server/tests/src/com/vaadin/server/TestAbstractApplicationServletStaticFilesLocation.java
server/tests/src/com/vaadin/tests/server/TestStreamVariableMapping.java
server/tests/src/com/vaadin/ui/AbsFieldDataSourceLocaleChange.java

index e46cefd895f2aece0a3150ffb2fb7b4faa7ad3f8..f00d4c8baf027c1900049d13c9208c815ffe69a0 100644 (file)
             <batchtest fork="yes">
                 <fileset dir="${test.src}">
                     <exclude name="**/Abstract*" />
+                    <exclude name="**/Mock*" />
                     <exclude name="com/vaadin/tests/data/bean/*" />
                     <exclude name="com/vaadin/tests/util/*" />
                     <exclude name="**/VaadinClasses.java" />
index 2a83f5d5b2aaa4cbe3e2a99da9330dd1dbca0198..3f940ae0a762114b522f82f45a236e9663b8b47a 100644 (file)
@@ -4,10 +4,8 @@ import static org.easymock.EasyMock.createMock;
 import static org.easymock.EasyMock.expect;
 import static org.easymock.EasyMock.replay;
 
-import java.lang.reflect.Field;
 import java.net.MalformedURLException;
 import java.net.URL;
-import java.util.Properties;
 
 import javax.servlet.http.HttpServletRequest;
 
@@ -24,16 +22,7 @@ public class TestAbstractApplicationServletStaticFilesLocation extends TestCase
         super.setUp();
 
         servlet = new VaadinServlet();
-
-        // Workaround to avoid calling init and creating servlet config
-        Field f = VaadinServlet.class.getDeclaredField("servletService");
-        f.setAccessible(true);
-        VaadinServletService service = new VaadinServletService(servlet,
-                new DefaultDeploymentConfiguration(servlet.getClass(),
-                        new Properties()));
-        service.init();
-        f.set(servlet, service);
-
+        servlet.init(new MockServletConfig());
     }
 
     public void testWidgetSetLocation() throws Exception {
index bee932a29fcbfefe9d6134f1800d8b0009bc94df..fcc54a989da06b6ed88000542b256bd3856cd87a 100644 (file)
@@ -5,6 +5,7 @@ import junit.framework.TestCase;
 import org.easymock.EasyMock;
 
 import com.vaadin.server.LegacyCommunicationManager;
+import com.vaadin.server.MockServletConfig;
 import com.vaadin.server.StreamVariable;
 import com.vaadin.server.VaadinRequest;
 import com.vaadin.server.VaadinServlet;
@@ -78,10 +79,10 @@ public class TestStreamVariableMapping extends TestCase {
 
     private LegacyCommunicationManager createCommunicationManager()
             throws Exception {
-        VaadinServletService vss = new VaadinServletService(
-                EasyMock.createMock(VaadinServlet.class),
+        VaadinServlet servlet = new VaadinServlet();
+        VaadinServletService vss = new VaadinServletService(servlet,
                 new MockDeploymentConfiguration());
-        vss.init();
+        servlet.init(new MockServletConfig());
         return new LegacyCommunicationManager(
                 new AlwaysLockedVaadinSession(vss));
     }
index acea0a84c7144010ff989689fb90e5a8ca5b7084..55d5771f8063da89d275c615ea19ab3e1a479f8a 100644 (file)
@@ -11,6 +11,7 @@ import org.junit.Test;
 import com.vaadin.data.util.converter.StringToIntegerConverter;
 import com.vaadin.server.VaadinRequest;
 import com.vaadin.server.VaadinSession;
+import com.vaadin.tests.util.AlwaysLockedVaadinSession;
 
 public class AbsFieldDataSourceLocaleChange {
 
@@ -19,7 +20,7 @@ public class AbsFieldDataSourceLocaleChange {
 
     @Before
     public void setup() {
-        vaadinSession = new VaadinSession(null);
+        vaadinSession = new AlwaysLockedVaadinSession(null);
         VaadinSession.setCurrent(vaadinSession);
         ui = new UI() {