alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Play Framework/Scala example source code file (test)

This example Play Framework source code file (test) is included in my "Source Code Warehouse" project. The intent of this project is to help you more easily find Play Framework (and Scala) source code examples by using tags.

All credit for the original source code belongs to Play Framework; I'm just trying to make examples easier to find. (For my Scala work, see my Scala examples and tutorials.)

Play Framework tags/keywords

change, check, fix, introduce, no, start, wait

The test Play Framework example source code

# Start dev mode
> run

# Check various action types
> verify-resource-contains / 200 original
> verify-resource-contains /assets/some.css 200 original
> verify-resource-contains /assets/main.css 200 original
> verify-reloads 1

# Wait a while and ensure we still haven't reloaded
$ sleep 1000
> verify-resource-contains / 200
> verify-reloads 1

# Change a scala file
$ copy-file changes/Application.scala.1 app/controllers/Application.scala
$ sleep 1000
> verify-resource-contains / 200 first
> verify-reloads 2

# Change a static asset
$ copy-file changes/some.css.1 public/some.css
$ sleep 1000
> verify-resource-contains /assets/some.css 200 first
# No reloads should have happened
> verify-reloads 2

# Change a compiled asset
$ copy-file changes/main.less.1 app/assets/main.less
$ sleep 1000
> verify-resource-contains /assets/main.css 200 first
# No reloads should have happened
> verify-reloads 2

# Introduce a compile error
$ copy-file changes/Application.scala.2 app/controllers/Application.scala
$ sleep 1000
> verify-resource-contains / 500
> verify-reloads 2

# Fix the compile error
$ copy-file changes/Application.scala.3 app/controllers/Application.scala
$ sleep 1000
> verify-resource-contains / 200 second
> verify-reloads 3

# Change a resource (also introduces a startup failure)
$ copy-file changes/application.conf.1 conf/application.conf
$ sleep 1000
> verify-resource-contains / 500
> verify-reloads 4

# Fix the start up failure
$ copy-file changes/application.conf.2 conf/application.conf
$ sleep 1000
> verify-resource-contains / 200
> verify-reloads 5

> play-stop

Other Play Framework source code examples

Here is a short list of links related to this Play Framework test source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.