-
Notifications
You must be signed in to change notification settings - Fork 683
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fa3160a
commit 300ae7b
Showing
6 changed files
with
89 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
samples-and-tests/just-test-cases/app/controllers/UseCache.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package controllers; | ||
|
||
import play.*; | ||
import play.mvc.*; | ||
import play.cache.*; | ||
|
||
import java.util.*; | ||
|
||
import models.*; | ||
|
||
public class UseCache extends Controller { | ||
|
||
public static void index() { | ||
render(); | ||
} | ||
|
||
@CacheFor("2s") | ||
public static void getDate() { | ||
Date a = new Date(); | ||
render(a); | ||
} | ||
|
||
} | ||
|
1 change: 1 addition & 0 deletions
1
samples-and-tests/just-test-cases/app/views/UseCache/getDate.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<strong id="a">${a}</strong> |
17 changes: 17 additions & 0 deletions
17
samples-and-tests/just-test-cases/app/views/UseCache/index.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<h1>Try cache</h1> | ||
|
||
<p id="yop"> | ||
#{cache 'yop', for:'2s'} | ||
${new java.util.Date()} | ||
#{/cache} | ||
</p> | ||
|
||
<p id="kiki"> | ||
#{cache 'kiki'} | ||
${new java.util.Date()} | ||
#{/cache} | ||
</p> | ||
|
||
#{cache 'p'} | ||
#{render 'Application/a.html' /} | ||
#{/cache} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#{selenium 'Test the cache tag'} | ||
|
||
open('@{UseCache.index()}') | ||
|
||
storeText('yop', 'firstDate') | ||
storeText('kiki', 'secondDate') | ||
|
||
open('@{UseCache.index()}') | ||
assertText('yop', '$[firstDate]') | ||
assertText('kiki', '$[secondDate]') | ||
|
||
pause(3000) | ||
|
||
open('@{UseCache.index()}') | ||
assertNotText('yop', '$[firstDate]') | ||
assertText('kiki', '$[secondDate]') | ||
|
||
open('@{UseCache.getDate()}') | ||
storeText('a', 'aDate') | ||
|
||
open('@{UseCache.getDate()}') | ||
assertText('a', '$[aDate]') | ||
|
||
pause(3000) | ||
|
||
open('@{UseCache.getDate()}') | ||
assertNotText('a', '$[aDate]') | ||
|
||
#{/selenium} |