mandag 29. mars 2010
CometActor: What happens when render fails
I also found out that when the render fails, it will display defaultXml which if you do some binding is not valid xml.
I later came to that overriding defaultXml must be a good way to make my CometActor more fault tolerant.
The problem in the code above is that we try to bind using the newly defined defaultXml and not the NodeSeq from the template. How can we get hold of template xml? Easy we just call super.defaultXml:
Adding scripts to CometActor in Lift
If you ever wondered how to include javascript in the head section or how to include other content in the body when using a CometActor the solution is to override fixedRender:
The resulting html:
Notice that Lift is using two div's, and during a reRender(false) only the inner one is updated.
Unfortunately the Alert doesn't take a JsCmd, I would prefer writing:
mandag 1. mars 2010
Maven and Scalatest
I started experimenting with ScalaTest some days ago tempted by the nice looking Feature Specs over here.
mvn scala:cc is continuously compiling my scala code - I wanted to be able to call something like mvn test -Dtest=MyTest from command line as well as for maven to run all my test suites when building.
This is how:
Install the maven-scalatest-plugin:
git clone git://github.com/teigen/maven-scalatest-plugin.git
cd maven-scalatest-plugin && mvn clean install
Update the pom.xml
<!-- disable surefire -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
<!-- enable scalatest -->
<plugin>
<groupId>com.jteigen</groupId>
<artifactId>maven-scalatest-plugin</artifactId>
<version>1.0-SNAPSHOT</version>
<executions>
<execution>
<goals>
<goal>test</goal>
</goals>
</execution>
</executions>
<configuration>
<testFailureIgnore>true</testFailureIgnore>
<filereports>NCXEHLOWFD file/constrained.txt,file/full.txt</filereports>
<xmlreports>xml</xmlreports>
<htmlreports>html/report.html</htmlreports>
</configuration>
</plugin>
Run tests:
mvn test will now exectue all the scala test suites found after building the project.
However the build is not really necessary when mvn scala:cc is running at the same time.
mvn com.jteigen:maven-scalatest-plugin:1.0-SNAPSHOT:test will only execute the tests.
What if you don't want to run all the suites?
mvn com.jteigen:maven-scalatest-plugin:1.0-SNAPSHOT:test -Dsuite=mypack.MySuite