summaryrefslogtreecommitdiffstats
path: root/uitest
diff options
context:
space:
mode:
authorLeif Åstrand <leif@vaadin.com>2012-09-04 16:59:24 +0300
committerLeif Åstrand <leif@vaadin.com>2012-09-05 11:39:35 +0300
commitb0b1a13247bf931eb7f33ff6d0a88fc1833144e9 (patch)
treeb00c4174fd4a9f2b0d77d45d835e4cc60469f994 /uitest
parentc71563c8a6e9993cbbdff3ddfdfccfee4aa34f7b (diff)
downloadvaadin-framework-b0b1a13247bf931eb7f33ff6d0a88fc1833144e9.tar.gz
vaadin-framework-b0b1a13247bf931eb7f33ff6d0a88fc1833144e9.zip
Move getBaseDirectory() to DeploymentConfiguration (#9402)
Diffstat (limited to 'uitest')
-rw-r--r--uitest/src/com/vaadin/tests/resources/NonExistingFileResource.java8
-rw-r--r--uitest/src/com/vaadin/tests/tickets/Ticket1975.java10
-rw-r--r--uitest/src/com/vaadin/tests/util/SampleDirectory.java5
3 files changed, 16 insertions, 7 deletions
diff --git a/uitest/src/com/vaadin/tests/resources/NonExistingFileResource.java b/uitest/src/com/vaadin/tests/resources/NonExistingFileResource.java
index eb8559f746..45552df39c 100644
--- a/uitest/src/com/vaadin/tests/resources/NonExistingFileResource.java
+++ b/uitest/src/com/vaadin/tests/resources/NonExistingFileResource.java
@@ -3,9 +3,11 @@ package com.vaadin.tests.resources;
import java.io.File;
import com.vaadin.server.FileResource;
+import com.vaadin.server.WrappedRequest;
import com.vaadin.tests.components.TestBase;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.util.CurrentInstance;
public class NonExistingFileResource extends TestBase {
@@ -24,8 +26,10 @@ public class NonExistingFileResource extends TestBase {
@Override
public void buttonClick(ClickEvent event) {
- FileResource res = new FileResource(new File(getContext()
- .getBaseDirectory() + "/" + filename));
+ FileResource res = new FileResource(new File(CurrentInstance
+ .get(WrappedRequest.class).getDeploymentConfiguration()
+ .getBaseDirectory()
+ + "/" + filename));
getMainWindow().open(res);
}
diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1975.java b/uitest/src/com/vaadin/tests/tickets/Ticket1975.java
index e85fe294f2..4fa3470f0b 100644
--- a/uitest/src/com/vaadin/tests/tickets/Ticket1975.java
+++ b/uitest/src/com/vaadin/tests/tickets/Ticket1975.java
@@ -5,13 +5,14 @@ import java.io.File;
import java.io.FileInputStream;
import com.vaadin.Application;
-import com.vaadin.server.ServletApplicationContext;
+import com.vaadin.server.WrappedRequest;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Button.ClickListener;
import com.vaadin.ui.CustomLayout;
import com.vaadin.ui.GridLayout;
import com.vaadin.ui.UI.LegacyWindow;
+import com.vaadin.util.CurrentInstance;
public class Ticket1975 extends Application.LegacyApplication {
@@ -33,7 +34,6 @@ public class Ticket1975 extends Application.LegacyApplication {
try {
cl1 = new CustomLayout(new ByteArrayInputStream(s.getBytes()));
layout.addComponent(cl1);
- ServletApplicationContext wc = ((ServletApplicationContext) getContext());
layout.addComponent(new Button("Disable/Enable",
new ClickListener() {
@@ -47,8 +47,10 @@ public class Ticket1975 extends Application.LegacyApplication {
}
}));
- File f = new File(wc.getBaseDirectory().getAbsoluteFile()
- + "/VAADIN/themes/" + getTheme()
+ File baseDir = CurrentInstance.get(WrappedRequest.class)
+ .getDeploymentConfiguration().getBaseDirectory()
+ .getAbsoluteFile();
+ File f = new File(baseDir + "/VAADIN/themes/" + getTheme()
+ "/layouts/Ticket1975.html");
cl2 = new CustomLayout(new FileInputStream(f));
diff --git a/uitest/src/com/vaadin/tests/util/SampleDirectory.java b/uitest/src/com/vaadin/tests/util/SampleDirectory.java
index e15f0ccfe3..7304f1cab8 100644
--- a/uitest/src/com/vaadin/tests/util/SampleDirectory.java
+++ b/uitest/src/com/vaadin/tests/util/SampleDirectory.java
@@ -20,10 +20,12 @@ import java.io.File;
import com.vaadin.Application;
import com.vaadin.server.SystemError;
+import com.vaadin.server.WrappedRequest;
import com.vaadin.shared.ui.label.ContentMode;
import com.vaadin.ui.Label;
import com.vaadin.ui.Panel;
import com.vaadin.ui.UI;
+import com.vaadin.util.CurrentInstance;
/**
* Provides sample directory based on application directory. If this fails then
@@ -46,7 +48,8 @@ public class SampleDirectory {
+ "context base directory failed, "
+ "possible security constraint with Application "
+ "Server or Servlet Container.<br />";
- File file = application.getContext().getBaseDirectory();
+ File file = CurrentInstance.get(WrappedRequest.class)
+ .getDeploymentConfiguration().getBaseDirectory();
if ((file == null) || (!file.canRead())
|| (file.getAbsolutePath() == null)) {
// cannot access example directory, possible security issue with