ExecuteRequestExtractor { public Map<String, String> getInputParametersMapRaw() { return inputParametersMapRaw; } ExecuteRequestExtractor(Execute execute); Map<String, String> getInputParametersMapRaw(); String getValue(String parameterName);  }
@Test public void canGetParameterMap() throws Exception { String executeRequestString = getExecuteRequestString(); InputStream requestInputStream = new ByteArrayInputStream(executeRequestString.getBytes()); Execute execute = (Execute) JaxbHelper.unmarshal(requestInputStream, new ObjectFactory()); requestExtractor = new ExecuteRequestExtractor(execute); Map<String, String> parameterMap = requestExtractor.getInputParametersMapRaw(); assertThat(parameterMap.get("doAtmosphericCorrection"), equalTo("true")); assertThat(parameterMap.get("outputTosa"), equalTo("false")); assertThat(parameterMap.get("outputTransmittance"), equalTo("false")); assertThat(parameterMap.get("calvalus.l3.parameters"), equalTo("<parameters>\n" + "<planetaryGrid>org.esa.beam.binning.support.PlateCarreeGrid</planetaryGrid>\n" + "<numRows>21600</numRows>\n" + "<compositingType>MOSAICKING</compositingType>\n" + "<superSampling>1</superSampling>\n" + "<maskExpr>!case2_flags.INVALID</maskExpr>\n" + "<aggregators>\n" + "<aggregator>\n" + "<type>AVG</type>\n" + "<varName>tsm</varName>\n" + "</aggregator>\n" + "<aggregator>\n" + "<type>MIN_MAX</type>\n" + "<varName>chl_conc</varName>\n" + "</aggregator>\n" + "<aggregator>\n" + "<type>AVG</type>\n" + "<varName>Z90_max</varName>\n" + "</aggregator>\n" + "</aggregators>\n" + "</parameters>")); }
@Test public void canGetParameterMapTimeScanProcess() throws Exception { String executeRequestString = getExecuteStringTimeScanProcess(); InputStream requestInputStream = new ByteArrayInputStream(executeRequestString.getBytes()); Execute execute = (Execute) JaxbHelper.unmarshal(requestInputStream, new ObjectFactory()); requestExtractor = new ExecuteRequestExtractor(execute); Map<String, String> parameterMap = requestExtractor.getInputParametersMapRaw(); assertThat(parameterMap.get("calvalus.l3.parameters"), equalTo("<parameters>\n" + "<planetaryGrid>org.esa.snap.binning.support.PlateCarreeGrid</planetaryGrid>\n" + "<numRows>972000</numRows>\n" + "<compositingType>MOSAICKING</compositingType>\n" + "<superSampling>1</superSampling>\n" + "<maskExpr>! lc_invalid and ! lc_cloud</maskExpr>\n" + "<variables>\n" + "<variable>\n" + "<name>ndbi</name>\n" + "<expr>(B11 - B8A) / (B11 + B8A)</expr>\n" + "</variable>\n" + "<variable>\n" + "<name>ndvi</name>\n" + "<expr>(B8A - B4) / (B8A + B4)</expr>\n" + "</variable>\n" + "<variable>\n" + "<name>ndwi</name>\n" + "<expr>(B3 - B8A) / (B3 + B8A)</expr>\n" + "</variable>\n" + "<variable>\n" + "<name>mndwi</name>\n" + "<expr>(B3 - B11) / (B3 + B11)</expr>\n" + "</variable>\n" + "</variables>\n" + "<aggregators>\n" + "<aggregator>\n" + "<type>MIN_MAX</type>\n" + "<varName>ndbi</varName>\n" + "</aggregator>\n" + "<aggregator>\n" + "<type>AVG</type>\n" + "<varName>ndbi</varName>\n" + "</aggregator>\n" + "<aggregator>\n" + "<type>PERCENTILE</type>\n" + "<percentage>10</percentage>\n" + "<varName>ndbi</varName>\n" + "</aggregator>\n" + "<aggregator>\n" + "<type>PERCENTILE</type>\n" + "<percentage>90</percentage>\n" + "<varName>ndbi</varName>\n" + "</aggregator>\n" + "<aggregator>\n" + "<type>MIN_MAX</type>\n" + "<varName>ndvi</varName>\n" + "</aggregator>\n" + "<aggregator>\n" + "<type>AVG</type>\n" + "<varName>ndvi</varName>\n" + "</aggregator>\n" + "<aggregator>\n" + "<type>PERCENTILE</type>\n" + "<percentage>10</percentage>\n" + "<varName>ndvi</varName>\n" + "</aggregator>\n" + "<aggregator>\n" + "<type>PERCENTILE</type>\n" + "<percentage>90</percentage>\n" + "<varName>ndvi</varName>\n" + "</aggregator>\n" + "<aggregator>\n" + "<type>MIN_MAX</type>\n" + "<varName>ndwi</varName>\n" + "</aggregator>\n" + "<aggregator>\n" + "<type>AVG</type>\n" + "<varName>ndwi</varName>\n" + "</aggregator>\n" + "<aggregator>\n" + "<type>PERCENTILE</type>\n" + "<percentage>10</percentage>\n" + "<varName>ndwi</varName>\n" + "</aggregator>\n" + "<aggregator>\n" + "<type>PERCENTILE</type>\n" + "<percentage>90</percentage>\n" + "<varName>ndwi</varName>\n" + "</aggregator>\n" + "<aggregator>\n" + "<type>MIN_MAX</type>\n" + "<varName>mndwi</varName>\n" + "</aggregator>\n" + "<aggregator>\n" + "<type>AVG</type>\n" + "<varName>mndwi</varName>\n" + "</aggregator>\n" + "<aggregator>\n" + "<type>PERCENTILE</type>\n" + "<percentage>10</percentage>\n" + "<varName>mndwi</varName>\n" + "</aggregator>\n" + "<aggregator>\n" + "<type>PERCENTILE</type>\n" + "<percentage>90</percentage>\n" + "<varName>mndwi</varName>\n" + "</aggregator>\n" + "</aggregators>\n" + "</parameters>")); }