use of org.n52.io.response.dataset.Data in project series-rest-api by 52North.
the class TimeseriesDataController method getSeriesCollectionChart.
@RequestMapping(value = "/observations", produces = { Constants.IMAGE_PNG }, method = RequestMethod.POST)
public void getSeriesCollectionChart(HttpServletRequest request, HttpServletResponse response, @RequestHeader(value = Parameters.HttpHeader.ACCEPT_LANGUAGE, required = false) String httpLocale, @RequestBody RequestStyledParameterSet simpleParameters) throws Exception {
IoParameters parameters = createParameters(simpleParameters, httpLocale, response);
LOGGER.debug("get data collection chart with query: {}", parameters);
checkForUnknownDatasetIds(parameters, parameters.getDatasets());
// final String datasetType = getValueType(parameters);
final String valueType = getValueType(parameters, request.getRequestURI());
String outputFormat = Constants.IMAGE_PNG;
response.setContentType(outputFormat);
createIoFactory(valueType).setParameters(parameters).createHandler(outputFormat).writeBinary(response.getOutputStream());
}
use of org.n52.io.response.dataset.Data in project arctic-sea by 52North.
the class ElasticsearchAdminHandler method initEmbeddedMode.
private void initEmbeddedMode() {
embeddedServer = new EmbeddedElasticsearch();
embeddedServer.setHomePath(context.getRealPath("/WEB-INF").concat("/elasticsearch"));
embeddedServer.init();
client = embeddedServer.getClient();
logger.info("ElasticSearch data handler starting in EMBEDDED mode");
}
use of org.n52.io.response.dataset.Data in project arctic-sea by 52North.
the class ElasticSearchDataHandlerIT method persistBasicData.
@Test
public void persistBasicData() throws InterruptedException {
Thread.sleep(2500);
Map<String, Object> data = new HashMap<>();
data.put("alma", "korte");
dataHandler.persist(data);
logger.debug("Waiting 3s");
Thread.sleep(2500);
SearchResponse response = getEmbeddedClient().prepareSearch(clientSettings.getIndexId()).setTypes(clientSettings.getTypeId()).get();
Assert.assertEquals("korte", response.getHits().getHits()[0].getSource().get("alma"));
}
use of org.n52.io.response.dataset.Data in project arctic-sea by 52North.
the class ElasticsearchAdminHandlerIT method connectTransportMode.
@Test
public void connectTransportMode() throws InterruptedException {
settings.setNodeConnectionMode(ElasticsearchSettingsKeys.CONNECTION_MODE_TRANSPORT_CLIENT);
adminHandler.init();
Map<String, Object> data = new HashMap<>();
data.put("test", "test-string");
IndexResponse idx = dataHandler.persist(data);
Thread.sleep(2000);
String ret = getEmbeddedClient().prepareGet(idx.getIndex(), idx.getType(), idx.getId()).get().getSourceAsString();
Assert.assertNotNull(ret);
}
use of org.n52.io.response.dataset.Data in project arctic-sea by 52North.
the class ElasticsearchAdminHandlerIT method connectNodeMode.
@Test
public void connectNodeMode() throws Exception {
settings.setNodeConnectionMode(ElasticsearchSettingsKeys.CONNECTION_MODE_NODE);
adminHandler.init();
Map<String, Object> data = new HashMap<>();
data.put("test", "test-string");
IndexResponse idx = dataHandler.persist(data);
Thread.sleep(2000);
String ret = getEmbeddedClient().prepareGet(idx.getIndex(), idx.getType(), idx.getId()).get().getSourceAsString();
Assert.assertNotNull(ret);
}
Aggregations