- changing limit and offset to Integers
This commit is contained in:
parent
c3a437de20
commit
eeea363c87
@ -655,7 +655,7 @@ public class GeoServerRESTReader {
|
|||||||
* @throws MalformedURLException
|
* @throws MalformedURLException
|
||||||
* @throws UnsupportedEncodingException
|
* @throws UnsupportedEncodingException
|
||||||
*/
|
*/
|
||||||
public RESTStructuredCoverageGranulesList getGranules(final String workspace, String coverageStore, String coverage, String filter, String offset, String limit)
|
public RESTStructuredCoverageGranulesList getGranules(final String workspace, String coverageStore, String coverage, String filter, Integer offset, Integer limit)
|
||||||
throws MalformedURLException, UnsupportedEncodingException {
|
throws MalformedURLException, UnsupportedEncodingException {
|
||||||
try {
|
try {
|
||||||
GeoServerRESTStructuredGridCoverageReaderManager manager =
|
GeoServerRESTStructuredGridCoverageReaderManager manager =
|
||||||
|
|||||||
@ -129,7 +129,7 @@ public class GeoServerRESTStructuredGridCoverageReaderManager extends GeoServerR
|
|||||||
// does it exist?
|
// does it exist?
|
||||||
RESTStructuredCoverageGranulesList granulesList=null;
|
RESTStructuredCoverageGranulesList granulesList=null;
|
||||||
try {
|
try {
|
||||||
granulesList = getGranules(workspace, coverageStore, coverageStore, filter, null, "1");
|
granulesList = getGranules(workspace, coverageStore, coverageStore, filter, null, 1);
|
||||||
} catch (MalformedURLException e) {
|
} catch (MalformedURLException e) {
|
||||||
if(LOGGER.isTraceEnabled()){
|
if(LOGGER.isTraceEnabled()){
|
||||||
LOGGER.trace(e.getMessage(), e);
|
LOGGER.trace(e.getMessage(), e);
|
||||||
@ -155,7 +155,7 @@ public class GeoServerRESTStructuredGridCoverageReaderManager extends GeoServerR
|
|||||||
// does it exist?
|
// does it exist?
|
||||||
granulesList=null;
|
granulesList=null;
|
||||||
try {
|
try {
|
||||||
granulesList = getGranules(workspace, coverageStore, coverageStore, filter, null, "1");
|
granulesList = getGranules(workspace, coverageStore, coverageStore, filter, null, 1);
|
||||||
} catch (MalformedURLException e) {
|
} catch (MalformedURLException e) {
|
||||||
if(LOGGER.isTraceEnabled()){
|
if(LOGGER.isTraceEnabled()){
|
||||||
LOGGER.trace(e.getMessage(), e);
|
LOGGER.trace(e.getMessage(), e);
|
||||||
@ -282,7 +282,7 @@ public class GeoServerRESTStructuredGridCoverageReaderManager extends GeoServerR
|
|||||||
* @throws MalformedURLException
|
* @throws MalformedURLException
|
||||||
* @throws UnsupportedEncodingException
|
* @throws UnsupportedEncodingException
|
||||||
*/
|
*/
|
||||||
public RESTStructuredCoverageGranulesList getGranules(final String workspace, String coverageStore, String coverage, String filter, String offset, String limit)
|
public RESTStructuredCoverageGranulesList getGranules(final String workspace, String coverageStore, String coverage, String filter, Integer offset, Integer limit)
|
||||||
throws MalformedURLException, UnsupportedEncodingException {
|
throws MalformedURLException, UnsupportedEncodingException {
|
||||||
// checks
|
// checks
|
||||||
checkString(workspace);
|
checkString(workspace);
|
||||||
@ -296,12 +296,12 @@ public class GeoServerRESTStructuredGridCoverageReaderManager extends GeoServerR
|
|||||||
append = true;
|
append = true;
|
||||||
sUrl = HTTPUtils.append(sUrl, "?filter=", URLEncoder.encode(filter, "UTF-8")).toString();
|
sUrl = HTTPUtils.append(sUrl, "?filter=", URLEncoder.encode(filter, "UTF-8")).toString();
|
||||||
}
|
}
|
||||||
if (offset != null && !offset.isEmpty()) {
|
if (offset != null) {
|
||||||
sUrl = HTTPUtils.append(sUrl, append ? "&offset=" : "?offset=", offset).toString();
|
sUrl = HTTPUtils.append(sUrl, append ? "&offset=" : "?offset=", offset.toString()).toString();
|
||||||
append = true;
|
append = true;
|
||||||
}
|
}
|
||||||
if (limit != null && !limit.isEmpty()) {
|
if (limit != null) {
|
||||||
sUrl = HTTPUtils.append(sUrl, append ? "&limit=" : "?limit=", limit).toString();
|
sUrl = HTTPUtils.append(sUrl, append ? "&limit=" : "?limit=", limit.toString()).toString();
|
||||||
append = true;
|
append = true;
|
||||||
}
|
}
|
||||||
String result = HTTPUtils.get(sUrl, gsuser, gspass);
|
String result = HTTPUtils.get(sUrl, gsuser, gspass);
|
||||||
|
|||||||
@ -73,6 +73,9 @@ public class GeoServerRESTImageMosaicManagerTest extends StoreIntegrationTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void createAndDelete() throws IllegalArgumentException, MalformedURLException, UnsupportedEncodingException{
|
public void createAndDelete() throws IllegalArgumentException, MalformedURLException, UnsupportedEncodingException{
|
||||||
|
if (!enabled()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
GeoServerRESTStructuredGridCoverageReaderManager manager =
|
GeoServerRESTStructuredGridCoverageReaderManager manager =
|
||||||
new GeoServerRESTStructuredGridCoverageReaderManager(new URL(RESTURL), RESTUSER, RESTPW);
|
new GeoServerRESTStructuredGridCoverageReaderManager(new URL(RESTURL), RESTUSER, RESTPW);
|
||||||
GeoServerRESTReader reader = new GeoServerRESTReader(new URL(RESTURL), RESTUSER, RESTPW);
|
GeoServerRESTReader reader = new GeoServerRESTReader(new URL(RESTURL), RESTUSER, RESTPW);
|
||||||
@ -129,14 +132,14 @@ public class GeoServerRESTImageMosaicManagerTest extends StoreIntegrationTest {
|
|||||||
|
|
||||||
|
|
||||||
// get with paging
|
// get with paging
|
||||||
granulesList = manager.getGranules("it.geosolutions", "mosaic", "mosaic" , null, "0", "1");
|
granulesList = manager.getGranules("it.geosolutions", "mosaic", "mosaic" , null, 0, 1);
|
||||||
assertNotNull(granulesList);
|
assertNotNull(granulesList);
|
||||||
assertEquals(1, granulesList.size());
|
assertEquals(1, granulesList.size());
|
||||||
assertFalse(granulesList.isEmpty());
|
assertFalse(granulesList.isEmpty());
|
||||||
granule = granulesList.get(0);
|
granule = granulesList.get(0);
|
||||||
assertNotNull(granule);
|
assertNotNull(granule);
|
||||||
|
|
||||||
granulesList = manager.getGranules("it.geosolutions", "mosaic", "mosaic", null, null, "2");
|
granulesList = manager.getGranules("it.geosolutions", "mosaic", "mosaic", null, null, 2);
|
||||||
assertNotNull(granulesList);
|
assertNotNull(granulesList);
|
||||||
assertEquals(2, granulesList.size());
|
assertEquals(2, granulesList.size());
|
||||||
assertFalse(granulesList.isEmpty());
|
assertFalse(granulesList.isEmpty());
|
||||||
@ -183,10 +186,6 @@ public class GeoServerRESTImageMosaicManagerTest extends StoreIntegrationTest {
|
|||||||
final File file = urlToFile(url);
|
final File file = urlToFile(url);
|
||||||
final String filePath = file.getAbsolutePath();
|
final String filePath = file.getAbsolutePath();
|
||||||
|
|
||||||
int i=0;
|
|
||||||
i++;
|
|
||||||
|
|
||||||
|
|
||||||
// use reflection to get the store URL since coveragestore only returns name and workspace
|
// use reflection to get the store URL since coveragestore only returns name and workspace
|
||||||
result = manager.createOrHarvestExternal("it.geosolutions", "mosaic", "imagemosaic", filePath + File.separatorChar + fileLocation );
|
result = manager.createOrHarvestExternal("it.geosolutions", "mosaic", "imagemosaic", filePath + File.separatorChar + fileLocation );
|
||||||
Assert.assertTrue(result);
|
Assert.assertTrue(result);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user