@Test public void testGetConfiguration() throws URISyntaxException, IOException { try (CloseableClientResponse response = getResponse(RequestType.GET, "/drive/configuration")) { assertEquals(404, response.getStatus()); } File testConfigurationFile = new File( Thread.currentThread().getContextClassLoader().getResource("nuxeo-drive-config.json").toURI()); File serverConfigurationFile = new File(Environment.getDefault().getConfig(), "nuxeo-drive-config.json"); FileUtils.copyFile(testConfigurationFile, serverConfigurationFile); try (CloseableClientResponse response = getResponse(RequestType.GET, "/drive/configuration")) { assertEquals(200, response.getStatus()); assertEquals("application/json", response.getType().toString()); String json = response.getEntity(String.class); ObjectMapper mapper = new ObjectMapper(); @SuppressWarnings("unchecked") Map<String, Serializable> options = mapper.readValue(json, Map.class); assertNotNull(options); assertEquals(10, options.size()); assertEquals(30, options.get("delay")); } }
@GET @Path("configuration") public Response getConfiguration() { File configurationFolder = Environment.getDefault().getConfig(); File configurationFile = new File(configurationFolder, NUXEO_DRIVE_CONFIGURATION_FILE); if (!configurationFile.exists()) { throw new WebResourceNotFoundException("Nuxeo Drive configuration file not found."); } return Response.ok().entity(configurationFile).type(MediaType.APPLICATION_JSON).build(); }
NuxeoDriveObject extends DefaultObject { @GET @Path("configuration") public Response getConfiguration() { File configurationFolder = Environment.getDefault().getConfig(); File configurationFile = new File(configurationFolder, NUXEO_DRIVE_CONFIGURATION_FILE); if (!configurationFile.exists()) { throw new WebResourceNotFoundException("Nuxeo Drive configuration file not found."); } return Response.ok().entity(configurationFile).type(MediaType.APPLICATION_JSON).build(); } }
NuxeoDriveObject extends DefaultObject { @GET @Path("configuration") public Response getConfiguration() { File configurationFolder = Environment.getDefault().getConfig(); File configurationFile = new File(configurationFolder, NUXEO_DRIVE_CONFIGURATION_FILE); if (!configurationFile.exists()) { throw new WebResourceNotFoundException("Nuxeo Drive configuration file not found."); } return Response.ok().entity(configurationFile).type(MediaType.APPLICATION_JSON).build(); }  }
NuxeoDriveObject extends DefaultObject { @GET @Path("configuration") public Response getConfiguration() { File configurationFolder = Environment.getDefault().getConfig(); File configurationFile = new File(configurationFolder, NUXEO_DRIVE_CONFIGURATION_FILE); if (!configurationFile.exists()) { throw new WebResourceNotFoundException("Nuxeo Drive configuration file not found."); } return Response.ok().entity(configurationFile).type(MediaType.APPLICATION_JSON).build(); }  @GET @Path("configuration") Response getConfiguration(); }
NuxeoDriveObject extends DefaultObject { @GET @Path("configuration") public Response getConfiguration() { File configurationFolder = Environment.getDefault().getConfig(); File configurationFile = new File(configurationFolder, NUXEO_DRIVE_CONFIGURATION_FILE); if (!configurationFile.exists()) { throw new WebResourceNotFoundException("Nuxeo Drive configuration file not found."); } return Response.ok().entity(configurationFile).type(MediaType.APPLICATION_JSON).build(); }  @GET @Path("configuration") Response getConfiguration(); static final String NUXEO_DRIVE_CONFIGURATION_FILE; }