Skip to content

Commit

Permalink
[GEOS-8099] Expand test coverage to include NetCDF-3
Browse files Browse the repository at this point in the history
  • Loading branch information
bencaradocdavies committed May 6, 2017
1 parent 8ab2cae commit 0dcf838
Showing 1 changed file with 21 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -526,19 +526,34 @@ private void configureTemperatureSurface() {
}

/**
* Test extra variables, variable attributes, and global attributes of different types. Uses <code>Temperature_surface</code>.
* Test <code>Temperature_surface</code> extra variables, variable attributes, and global attributes of different types, for NetCDF-3 output.
*/
@Test
public void testExtraVariables() throws Exception {
// for some reason the request only worka with netcdf4
// TODO: investigate what this test fails with format=application/x-netcdf
public void testExtraVariablesNetcdf3() throws Exception {
checkExtraVariables("application/x-netcdf");
}

/**
* Test <code>Temperature_surface</code> extra variables, variable attributes, and global attributes of different types, for NetCDF-4 output.
*/
@Test
public void testExtraVariablesNetcdf4() throws Exception {
assumeTrue(NetCDFUtilities.isNC4CAvailable());
checkExtraVariables("application/x-netcdf4");
}

/**
* Check <code>Temperature_surface</code> extra variables, variable attributes, and global attributes of different type.
*
* @param format the output format MIME type
*/
private void checkExtraVariables(String format) throws Exception {
MockHttpServletResponse response = getAsServletResponse(
"wcs?service=WCS&version=2.0.1&request=GetCoverage"
+ "&coverageid=wcs__Temperature_surface&format=application/x-netcdf4");
+ "&coverageid=wcs__Temperature_surface&format=" + format);
assertNotNull(response);
assertEquals(200, response.getStatus());
assertEquals("application/x-netcdf4", response.getContentType());
assertEquals(format, response.getContentType());
byte[] responseBytes = getBinary(response);
File file = File.createTempFile("extra-variable-", "-wcs__Temperature_surface.nc",
new File("./target"));
Expand Down

0 comments on commit 0dcf838

Please sign in to comment.