Displaying WebRTC Nest Cameras in an Android App

Wanting to display some Nest Cameras in an Android App, I needed to deal with the fact that there were two primary flavors of cameras. In particular, the version I needed to support first was the Wired Camera that exposed WebRTC-based video streams. So, in order to accomplish showing WebRTC in an Android app, I took the approach of embedding a WebView and depending on the native JavaScript support for WebRTC.

More →

Grails 3.1.9 Functional Test Port

With Grails 3.1.9 and above we now get a default port for Functional tests that is randomly assigned. This is a great feature that was added in with this commit.

While this is a nice addition our tests which were not using Geb were left broken this is due to the fact we now need to know what port was selected for a given run of the tests. So our old test:

More →

Grails 3 Metrics and Path Variables

Grails 3 is built on top of SpringBoot on of the key components of SpringBoot is Actuator. Actuator sets up Metrics and healthchecks all the things modern services are expected to just have. Grails 3 ships with the /metrics endpoint turned on meaning every request gets tracked by default the endpoint will be available to all logged in users assuming you are using some security.

Most of the time this wouldn’t be an issue and would be very nice to have those metrics the problem comes to the fact that currently all requests with Path Variables are treated as different endpoints. So requests to /items/$id of /items/123 and /items/333 will end up listed as two different metrics with the value of the path variable for everyone to see. This exposes more data than intended and doesn’t provide really useful metrics. Its due to an issue in Actuator GH Issue 5875. So until this is fixed I recommend turning off metrics collection all together for Grails 3.

More →

RxJava and Ratpack Testing Gotcha

Ratpack tends to stay out of the way when building out functionality so there are times you may make classes that use RxJava and Guice without anything from Ratpack. But there is one caveat during testing, if you are using RxJava in a unit test without any Ratpack integration that will work just fine. As soon as there is another test in the same execution that uses Ratpacks integration (ratpack.dependency("rx")) with RxJava such as a functional test you will start seeing the following error in the standard out:

java.lang.IllegalStateException: Cannot install RxJava integration because another execution hook (class rx.plugins.RxJavaObservableExecutionHookDefault) is already installed
	at ratpack.rx.RxRatpack.initialize(RxRatpack.java:101) ~[ratpack-rx-1.1.0.jar:na]
	at ratpack.rx.RxRatpack$initialize$0.call(Unknown Source) ~[na:na]
	at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48) [groovy-all-2.4.4.jar:2.4.4]
	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113) [groovy-all-2.4.4.jar:2.4.4]
	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:117) [groovy-all-2.4.4.jar:2.4.4]
More →

Grails 3 and JaCoCo

Now that we have Gradle as our build system we have a whole range of plugins we can use directly in Gradle. For code coverage I am using the JaCoCo plugin. To use it with Grails we just apply the plugin to the build. By default you will get a HTML report, in the build/report/jacoco directory.

apply plugin: "jacoco"
More →