Ejemplo n.º 1
0
  @Test
  public void testBadRequest() throws IOException {

    ViewerRequestParamsBean params = new ViewerRequestParamsBean();
    params.setViewer("BadViewer");
    params.setCatalog("wrong_catalog.xml"); //
    params.setDataset("wrong_dataset.nc"); // 	
    BindingResult result = new BeanPropertyBindingResult(params, "params");
    MockHttpServletResponse res = new MockHttpServletResponse();
    MockHttpServletRequest req = new MockHttpServletRequest();
    req.setRequestURI(
        "/thredds/view/ToolsUI.jnlp?catalog=http://localhost:9080/thredds/catalog/gribCollection/GFS_CONUS_80km/files/catalog.xml&dataset=ncss_tests/files/GFS_CONUS_80km_20120227_0000.grib1");
    viewerController.launchViewer(params, result, res, req);
    assertEquals(404, res.getStatus());
  }
Ejemplo n.º 2
0
  @Test
  public void testLaunchViewerToolsUIVRequest() throws IOException {

    ViewerRequestParamsBean params = new ViewerRequestParamsBean();
    params.setViewer("ToolsUI");
    params.setCatalog(
        "http://localhost:9080/thredds/catalog/gribCollection/GFS_CONUS_80km/files/catalog.xml");
    params.setDataset("gribCollection/GFS_CONUS_80km/files/GFS_CONUS_80km_20120227_0000.grib1");
    BindingResult result = new BeanPropertyBindingResult(params, "params");
    MockHttpServletResponse res = new MockHttpServletResponse();
    MockHttpServletRequest req = new MockHttpServletRequest();
    req.setRequestURI(
        "/thredds/view/ToolsUI.jnlp?catalog=http://localhost:9080/thredds/catalog/gribCollection/GFS_CONUS_80km/files/catalog.xml&dataset=ncss_tests/files/GFS_CONUS_80km_20120227_0000.grib1");
    viewerController.launchViewer(params, result, res, req);
    assertEquals(200, res.getStatus());
    assertEquals("application/x-java-jnlp-file", res.getContentType());
  }