|
1 | 1 | package play;
|
2 | 2 |
|
| 3 | +import java.io.ByteArrayInputStream; |
| 4 | +import java.io.ByteArrayOutputStream; |
| 5 | +import java.io.File; |
| 6 | +import java.util.ArrayList; |
| 7 | +import java.util.Collections; |
| 8 | +import java.util.Properties; |
3 | 9 |
|
4 | 10 | import play.classloading.ApplicationClasses;
|
5 | 11 | import play.classloading.ApplicationClassloader;
|
|
8 | 14 | import play.mvc.Scope.RenderArgs;
|
9 | 15 | import play.vfs.VirtualFile;
|
10 | 16 |
|
11 |
| -import java.io.ByteArrayInputStream; |
12 |
| -import java.io.ByteArrayOutputStream; |
13 |
| -import java.io.File; |
14 |
| -import java.util.ArrayList; |
15 |
| -import java.util.Collections; |
16 |
| -import java.util.Properties; |
17 |
| - |
18 | 17 | /**
|
19 | 18 | * Builder-pattern-builder for Play-class..
|
20 | 19 | *
|
21 |
| - * It's kind of odd since Play only uses statics, |
22 |
| - * But it basically inits the needed properties for Play-object to work in unittests |
| 20 | + * It's kind of odd since Play only uses statics, But it basically inits the |
| 21 | + * needed properties for Play-object to work in unittests |
23 | 22 | */
|
24 | 23 | public class PlayBuilder {
|
25 | 24 |
|
26 | 25 | public Properties configuration = new Properties();
|
27 | 26 |
|
28 |
| - public PlayBuilder withConfiguration(Properties config){ |
| 27 | + public PlayBuilder withConfiguration(Properties config) { |
29 | 28 | this.configuration = config;
|
30 | 29 | return this;
|
31 | 30 | }
|
32 | 31 |
|
| 32 | + @SuppressWarnings({ "deprecation" }) |
| 33 | + public void build() { |
33 | 34 |
|
34 |
| - @SuppressWarnings({"deprecation"}) |
35 |
| - public void build(){ |
36 |
| - |
37 | 35 | Play.version = "localbuild";
|
38 | 36 | Play.configuration = configuration;
|
39 | 37 | Play.classes = new ApplicationClasses();
|
40 | 38 | Play.javaPath = new ArrayList<VirtualFile>();
|
41 | 39 | Play.applicationPath = new File(".");
|
42 | 40 | Play.classloader = new ApplicationClassloader();
|
43 |
| - Play.plugins = Collections.unmodifiableList( new ArrayList<PlayPlugin>()); |
| 41 | + Play.plugins = Collections.unmodifiableList(new ArrayList<PlayPlugin>()); |
| 42 | + Play.guessFrameworkPath(); |
44 | 43 |
|
45 | 44 | }
|
46 |
| - |
47 |
| - public void initMvcObject(){ |
| 45 | + |
| 46 | + public void initMvcObject() { |
48 | 47 | if (Request.current() == null) {
|
49 |
| - Request request = Request |
50 |
| - .createRequest(null, "GET", "/", "", null, null, null, |
51 |
| - null, false, 80, "localhost", false, null, null); |
| 48 | + Request request = Request.createRequest(null, "GET", "/", "", null, null, null, null, false, 80, "localhost", false, null, |
| 49 | + null); |
52 | 50 | request.body = new ByteArrayInputStream(new byte[0]);
|
53 | 51 | Request.current.set(request);
|
54 | 52 | }
|
|
0 commit comments