Search in sources :

Example 36 with IoParameters

use of org.n52.io.request.IoParameters in project series-rest-api by 52North.

the class ChartRendererTest method shouldPrintDefaultOutputTimezoneInDomainAxisLabel.

@Test
public void shouldPrintDefaultOutputTimezoneInDomainAxisLabel() {
    IoParameters config = IoParameters.createDefaults();
    IoStyleContext context = IoStyleContext.create(config);
    String label = new MyChartRenderer(context).getXYPlot().getDomainAxis().getLabel();
    assertThat(label, is("Time (UTC)"));
}
Also used : IoStyleContext(org.n52.io.IoStyleContext) IoParameters(org.n52.io.request.IoParameters) Test(org.junit.Test)

Example 37 with IoParameters

use of org.n52.io.request.IoParameters in project series-rest-api by 52North.

the class IoParametersTest method when_timespanWithNow_then_normalizeWithDateString.

@Test
public void when_timespanWithNow_then_normalizeWithDateString() {
    DateTimeFormatter dateFormat = DateTimeFormat.forPattern("YYYY-MM-dd");
    String now = dateFormat.print(new DateTime());
    IoParameters parameters = createDefaults().extendWith(Parameters.TIMESPAN, "PT4h/now");
    IntervalWithTimeZone expected = new IntervalWithTimeZone("PT4h/" + now);
    assertThat(parameters.getNormalizedTimespan(dateFormat), is(expected.toString()));
}
Also used : IntervalWithTimeZone(org.n52.io.IntervalWithTimeZone) DateTimeFormatter(org.joda.time.format.DateTimeFormatter) DateTime(org.joda.time.DateTime) Test(org.junit.Test)

Example 38 with IoParameters

use of org.n52.io.request.IoParameters in project series-rest-api by 52North.

the class IoParametersTest method when_jsonBbox_then_parsingSpatialFilter.

@Test
public void when_jsonBbox_then_parsingSpatialFilter() throws ParseException {
    Map<String, String> map = Collections.singletonMap("bbox", "{\"ll\":{\"type\":\"Point\",\"coordinates\":[6.7,51.7]},\"ur\":{\"type\":\"Point\",\"coordinates\":[7.9,51.9]}}");
    IoParameters parameters = createFromSingleValueMap(map);
    BoundingBox actual = parameters.getSpatialFilter();
    WKTReader wktReader = new WKTReader();
    Geometry ll = wktReader.read("POINT (6.7 51.7)");
    Geometry ur = wktReader.read("POINT(7.9 51.9)");
    Assert.assertTrue(actual.getLowerLeft().equals(ll));
    Assert.assertTrue(actual.getUpperRight().equals(ur));
}
Also used : Geometry(com.vividsolutions.jts.geom.Geometry) BoundingBox(org.n52.io.crs.BoundingBox) WKTReader(com.vividsolutions.jts.io.WKTReader) Test(org.junit.Test)

Aggregations

IoParameters (org.n52.io.request.IoParameters)31 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)20 RequestSimpleParameterSet (org.n52.io.request.RequestSimpleParameterSet)14 ModelAndView (org.springframework.web.servlet.ModelAndView)7 Test (org.junit.Test)5 IntervalWithTimeZone (org.n52.io.IntervalWithTimeZone)4 Stopwatch (org.n52.web.common.Stopwatch)4 IoStyleContext (org.n52.io.IoStyleContext)3 RequestStyledParameterSet (org.n52.io.request.RequestStyledParameterSet)3 ResourceNotFoundException (org.n52.web.exception.ResourceNotFoundException)3 IOException (java.io.IOException)2 HashMap (java.util.HashMap)2 Geometry (com.vividsolutions.jts.geom.Geometry)1 WKTReader (com.vividsolutions.jts.io.WKTReader)1 FileOutputStream (java.io.FileOutputStream)1 InputStream (java.io.InputStream)1 ArrayList (java.util.ArrayList)1 DateTime (org.joda.time.DateTime)1 DateTimeFormatter (org.joda.time.format.DateTimeFormatter)1 I18N (org.n52.io.I18N)1