Compare commits
1 Commits
master
...
simboss-pa
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d9829f30e3 |
@ -13,3 +13,4 @@ notifications:
|
|||||||
on_failure: never
|
on_failure: never
|
||||||
after_success:
|
after_success:
|
||||||
- mvn clean cobertura:cobertura coveralls:report
|
- mvn clean cobertura:cobertura coveralls:report
|
||||||
|
|
||||||
|
|||||||
48
README.md
48
README.md
@ -1,68 +1,28 @@
|
|||||||
# geoserver-manager
|
# geoserver-manager
|
||||||
## Status
|
## Status
|
||||||
* Master on travis [](https://travis-ci.org/geosolutions-it/geoserver-manager)
|
|
||||||
* Master on Linux + OracleJDK7 [](http://build.geo-solutions.it/jenkins/view/GeoServer-manager/job/GeoServer-Manager-Master/)
|
* Master on Linux + OracleJDK7 [](http://build.geo-solutions.it/jenkins/view/GeoServer-manager/job/GeoServer-Manager-Master/)
|
||||||
* Master on Windows + OracleJDK7 [](http://winbuild.geo-solutions.it/jenkins/view/GeoServer-Manager/job/GeoServer-Manager-Master/)
|
* Master on Windows + OracleJDK7 [](http://winbuild.geo-solutions.it/jenkins/view/GeoServer-Manager/job/GeoServer-Manager-Master/)
|
||||||
* Stable on Linux + OracleJDK7 [](http://build.geo-solutions.it/jenkins/view/GeoServer-manager/job/GeoServer-Manager-Stable/)
|
* Stable on Linux + OracleJDK7 [](http://build.geo-solutions.it/jenkins/view/GeoServer-manager/job/GeoServer-Manager-Stable/)
|
||||||
* Stable on Windows + OracleJDK7 [](http://winbuild.geo-solutions.it/jenkins/view/GeoServer-Manager/job/GeoServer-Manager-Stable/)
|
* Stable on Windows + OracleJDK7 [](http://winbuild.geo-solutions.it/jenkins/view/GeoServer-Manager/job/GeoServer-Manager-Stable/)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Intro
|
## Intro
|
||||||
Client library written in Java to interact with [GeoServer](http://www.geoserver.org) through its [ReST administration interface](http://docs.geoserver.org/stable/en/user/rest/api/index.html).
|
Client library written in Java to interact with [GeoServer](http://www.geoserver.org) through its REst administration interface.
|
||||||
|
|
||||||
The purpose of this project is to hold a ReST client library to interact with GeoServer; a requirement for this library is to depend as less as possible on external libraries. This library aims at being lean and mean.
|
The purpose of this project is to hold a REST client library to interact with GeoServer; a requirement for this library is to depend as less as possible on external libraries. This library aims at being lean and mean.
|
||||||
|
|
||||||
For general questions about this project feel free to use the mailing lists.
|
For general questions about this project feel free to use the mailing lists.
|
||||||
|
|
||||||
## Using the library
|
|
||||||
|
|
||||||
### Working with Maven
|
|
||||||
In order to include the lib and its dependencies in a Maven project, the repository to point at is this one:
|
|
||||||
|
|
||||||
```xml
|
|
||||||
<repository>
|
|
||||||
<id>GeoSolutions</id>
|
|
||||||
<url>http://maven.geo-solutions.it/</url>
|
|
||||||
</repository>
|
|
||||||
```
|
|
||||||
|
|
||||||
and the dependency tag for your pom is as follows:
|
|
||||||
|
|
||||||
```xml
|
|
||||||
<dependency>
|
|
||||||
<groupId>it.geosolutions</groupId>
|
|
||||||
<artifactId>geoserver-manager</artifactId>
|
|
||||||
<version>1.7.0</version>
|
|
||||||
</dependency>
|
|
||||||
```
|
|
||||||
### Direct Link to JAR
|
|
||||||
If you are simply looking for the JAR to download and use you can find it [here](http://maven.geo-solutions.it/it/geosolutions/geoserver-manager/1.7.0/geoserver-manager-1.7.0.jar).
|
|
||||||
|
|
||||||
### GeoServer Compatibility Matrix
|
|
||||||
|
|
||||||
**GeoServer-Manager/GeoServer** | **2.6.x** |**2.7.x** |**2.8.x** |**2.9.x**
|
|
||||||
-------------------------------- | ----------|----------|----------|---------
|
|
||||||
**1.6.0** | Y | Y | P | P
|
|
||||||
**1.7.0** | N | P | Y | Y
|
|
||||||
|
|
||||||
### Documentation
|
|
||||||
You can find some examples in the wiki.
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
geoserver-manager is released under a permissive [MIT](https://opensource.org/licenses/MIT) license. See [wikipedia](https://en.wikipedia.org/wiki/MIT_License) for more information.
|
geoserver-manager is released under a permissinve [MIT](https://opensource.org/licenses/MIT) license. See [wikipedia](https://en.wikipedia.org/wiki/MIT_License) for more information.
|
||||||
|
|
||||||
|
|
||||||
## Mailing Lists
|
## Mailing Lists
|
||||||
|
|
||||||
* [USERS](https://groups.google.com/group/geoserver-manager-users)
|
* [USERS](https://groups.google.com/forum/?fromgroups#!forum/geoserver-manager-users]https://groups.google.com/forum/?fromgroups#!forum/geoserver-manager-users)
|
||||||
* [DEVELOPERS](https://groups.google.com/forum/?fromgroups#!forum/geoserver-manager-devs)
|
* [DEVELOPERS](https://groups.google.com/forum/?fromgroups#!forum/geoserver-manager-devs)
|
||||||
|
|
||||||
For more information see [this](https://github.com/geosolutions-it/geoserver-manager/wiki) page.
|
For more information see [this](https://github.com/geosolutions-it/geoserver-manager/wiki) page.
|
||||||
|
|
||||||
## Version
|
|
||||||
Current stable version is [1.7.0](https://github.com/geosolutions-it/geoserver-manager/releases/tag/v1.7.0) ([Changelog](https://github.com/geosolutions-it/geoserver-manager/wiki/Changelog)).
|
|
||||||
|
|
||||||
## Credits
|
|
||||||
The work on this library has been initiated by GeoSolutions. Over the years it has been funded by various organizations like UN FAO, German Space Agency (DLR) and others.
|
|
||||||
|
|
||||||
|
|||||||
578
pom.xml
578
pom.xml
@ -1,361 +1,287 @@
|
|||||||
<!--
|
<!-- * GeoServer-Manager - Simple Manager Library for GeoServer * * Copyright
|
||||||
* GeoServer-Manager - Simple Manager Library for GeoServer
|
(C) 2007,2011 GeoSolutions S.A.S. * http://www.geo-solutions.it * * Permission
|
||||||
*
|
is hereby granted, free of charge, to any person obtaining a copy * of this
|
||||||
* Copyright (C) 2007 - 2016 GeoSolutions S.A.S. http://www.geo-solutions.it
|
software and associated documentation files (the "Software"), to deal * in
|
||||||
*
|
the Software without restriction, including without limitation the rights
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
* copies of the Software, and to permit persons to whom the Software is *
|
||||||
* in the Software without restriction, including without limitation the rights
|
furnished to do so, subject to the following conditions: * * The above copyright
|
||||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
notice and this permission notice shall be included in * all copies or substantial
|
||||||
* copies of the Software, and to permit persons to whom the Software is
|
portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY
|
||||||
* furnished to do so, subject to the following conditions:
|
OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||||
*
|
OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
* The above copyright notice and this permission notice shall be included in
|
IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||||
* all copies or substantial portions of the Software.
|
DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||||
*
|
ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
DEALINGS IN * THE SOFTWARE. -->
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
* THE SOFTWARE.
|
|
||||||
-->
|
|
||||||
|
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
<modelVersion>4.0.0</modelVersion>
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
|
||||||
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<groupId>it.geosolutions</groupId>
|
||||||
|
<artifactId>geoserver-manager</artifactId>
|
||||||
|
<version>1.7-SNAPSHOT</version>
|
||||||
|
|
||||||
<groupId>it.geosolutions</groupId>
|
<packaging>jar</packaging>
|
||||||
<artifactId>geoserver-manager</artifactId>
|
|
||||||
<version>1.8-SNAPSHOT</version>
|
|
||||||
|
|
||||||
<packaging>jar</packaging>
|
<name>GeoServer 2 Manager - REST based</name>
|
||||||
|
<description>
|
||||||
<name>GeoServer Manager - REST based</name>
|
GeoServer Manager is a library to interact with GeoServer 2.x.
|
||||||
<description>
|
|
||||||
GeoServer Manager is a library to interact with GeoServer
|
|
||||||
The scope of this library is to have a simple API, and use as few external
|
The scope of this library is to have a simple API, and use as few external
|
||||||
libs as possible.
|
libs as possible.
|
||||||
</description>
|
</description>
|
||||||
|
|
||||||
<inceptionYear>2007</inceptionYear>
|
<inceptionYear>2007</inceptionYear>
|
||||||
|
|
||||||
<url>https://github.com/geosolutions-it/geoserver-manager</url>
|
<organization>
|
||||||
|
<name>GeoSolutions</name>
|
||||||
|
<url>http://www.geo-solutions.it</url>
|
||||||
|
</organization>
|
||||||
|
|
||||||
<organization>
|
<developers>
|
||||||
<name>GeoSolutions</name>
|
<developer>
|
||||||
<url>http://www.geo-solutions.it</url>
|
<id>etj</id>
|
||||||
</organization>
|
<name>Emanuele Tajariol</name>
|
||||||
|
<email>etj AT geosolutions.it</email>
|
||||||
|
<organization>GeoSolutions</organization>
|
||||||
|
<organizationUrl>http://www.geo-solutions.it</organizationUrl>
|
||||||
|
<roles>
|
||||||
|
<role>architect</role>
|
||||||
|
<role>developer</role>
|
||||||
|
</roles>
|
||||||
|
<timezone>+1</timezone>
|
||||||
|
</developer>
|
||||||
|
<developer>
|
||||||
|
<id>ccancellieri</id>
|
||||||
|
<name>Carlo Cancellieri</name>
|
||||||
|
<email>carlo.cancellieri AT geosolutions.it</email>
|
||||||
|
<organization>GeoSolutions</organization>
|
||||||
|
<organizationUrl>http://www.geo-solutions.it</organizationUrl>
|
||||||
|
<roles>
|
||||||
|
<role>architect</role>
|
||||||
|
<role>developer</role>
|
||||||
|
</roles>
|
||||||
|
<timezone>+1</timezone>
|
||||||
|
</developer>
|
||||||
|
</developers>
|
||||||
|
|
||||||
<developers>
|
<licenses>
|
||||||
<developer>
|
<license>
|
||||||
<id>etj</id>
|
<name>MIT License</name>
|
||||||
<name>Emanuele Tajariol</name>
|
<url>http://opensource.org/licenses/mit-license.php</url>
|
||||||
<email>etj AT geosolutions.it</email>
|
<distribution>repo</distribution>
|
||||||
<organization>GeoSolutions</organization>
|
</license>
|
||||||
<organizationUrl>http://www.geo-solutions.it</organizationUrl>
|
</licenses>
|
||||||
<roles>
|
|
||||||
<role>architect</role>
|
|
||||||
<role>developer</role>
|
|
||||||
</roles>
|
|
||||||
<timezone>+1</timezone>
|
|
||||||
</developer>
|
|
||||||
<developer>
|
|
||||||
<id>ccancellieri</id>
|
|
||||||
<name>Carlo Cancellieri</name>
|
|
||||||
<email>carlo.cancellieri AT geosolutions.it</email>
|
|
||||||
<organization>GeoSolutions</organization>
|
|
||||||
<organizationUrl>http://www.geo-solutions.it</organizationUrl>
|
|
||||||
<roles>
|
|
||||||
<role>architect</role>
|
|
||||||
<role>developer</role>
|
|
||||||
</roles>
|
|
||||||
<timezone>+1</timezone>
|
|
||||||
</developer>
|
|
||||||
</developers>
|
|
||||||
|
|
||||||
<licenses>
|
<url>http://code.google.com/p/geoserver-manager/</url>
|
||||||
<license>
|
|
||||||
<name>MIT License</name>
|
|
||||||
<url>http://opensource.org/licenses/mit-license.php</url>
|
|
||||||
<distribution>repo</distribution>
|
|
||||||
</license>
|
|
||||||
</licenses>
|
|
||||||
|
|
||||||
<issueManagement>
|
<issueManagement>
|
||||||
<system>GitHub</system>
|
<system>googlecode</system>
|
||||||
<url>https://github.com/geosolutions-it/geoserver-manager/issues</url>
|
<url>http://code.google.com/p/geoserver-manager/issues/list</url>
|
||||||
</issueManagement>
|
</issueManagement>
|
||||||
|
|
||||||
<mailingLists>
|
<mailingLists>
|
||||||
<mailingList>
|
<mailingList>
|
||||||
<name>GeoServer Manager User List</name>
|
<name>GeoServer Manager User List</name>
|
||||||
<post>geoserver-manager-users@googlegroups.com </post>
|
<post>geoserver-manager-users@googlegroups.com </post>
|
||||||
<archive>http://groups.google.com/group/geoserver-manager-users/topics</archive>
|
<archive>http://groups.google.com/group/geoserver-manager-users/topics</archive>
|
||||||
</mailingList>
|
</mailingList>
|
||||||
</mailingLists>
|
</mailingLists>
|
||||||
|
|
||||||
<scm>
|
<scm>
|
||||||
<connection>scm:git:[fetch=]https://github.com/geosolutions-it/geoserver-manager.git[push=]git@github.com:geosolutions-it/geoserver-manager.git</connection>
|
<connection>scm:git:[fetch=]https://github.com/geosolutions-it/geoserver-manager.git[push=]git@github.com:geosolutions-it/geoserver-manager.git</connection>
|
||||||
<url>https://github.com/geosolutions-it/geoserver-manager</url>
|
<!--developerConnection>scm:git</developerConnection -->
|
||||||
</scm>
|
<!--tag>master</tag -->
|
||||||
|
<url>https://github.com/geosolutions-it/geoserver-manager</url>
|
||||||
|
</scm>
|
||||||
|
|
||||||
<ciManagement>
|
<ciManagement>
|
||||||
<system>jenkins</system>
|
<system>jenkins</system>
|
||||||
<url>http://build.geo-solutions.it/jenkins/view/GeoServer-manager/</url>
|
<url>http://ci.geo-solutions.it/</url>
|
||||||
</ciManagement>
|
</ciManagement>
|
||||||
|
|
||||||
<repositories>
|
<distributionManagement>
|
||||||
<repository>
|
<downloadUrl>http://maven.geo-solutions.it</downloadUrl>
|
||||||
<id>boundless</id>
|
<repository>
|
||||||
<name>Boundless Maven Repository</name>
|
<uniqueVersion>false</uniqueVersion>
|
||||||
<url>https://repo.boundlessgeo.com/main/</url>
|
<id>geosolutions</id>
|
||||||
<!-- contains snapshot and release (including third-party-dependences) -->
|
<url>ftp://maven.geo-solutions.it/</url>
|
||||||
<!-- Restlet maven Repository (http://maven.restlet.org) -->
|
</repository>
|
||||||
<!-- ucar (https://artifacts.unidata.ucar.edu/content/repositories/unidata-releases) -->
|
<site>
|
||||||
<snapshots>
|
<id>demo.geosolutions</id>
|
||||||
<enabled>true</enabled>
|
<url>scp://demo.geo-solutions.it/var/www/share/github/gsman</url>
|
||||||
</snapshots>
|
</site>
|
||||||
<releases>
|
</distributionManagement>
|
||||||
<enabled>true</enabled>
|
|
||||||
</releases>
|
|
||||||
</repository>
|
|
||||||
|
|
||||||
<repository>
|
|
||||||
<id>osgeo</id>
|
|
||||||
<name>Open Source Geospatial Foundation Repository</name>
|
|
||||||
<url>http://download.osgeo.org/webdav/geotools/</url>
|
|
||||||
<snapshots>
|
|
||||||
<enabled>false</enabled>
|
|
||||||
</snapshots>
|
|
||||||
</repository>
|
|
||||||
|
|
||||||
<repository>
|
|
||||||
<id>maven-restlet</id>
|
|
||||||
<name>Restlet Maven Repository</name>
|
|
||||||
<url>http://maven.restlet.org</url>
|
|
||||||
<snapshots>
|
|
||||||
<enabled>false</enabled>
|
|
||||||
</snapshots>
|
|
||||||
</repository>
|
|
||||||
|
|
||||||
<repository>
|
|
||||||
<id>geosolutions</id>
|
|
||||||
<name>geosolutions repository</name>
|
|
||||||
<url>http://maven.geo-solutions.it/</url>
|
|
||||||
<snapshots>
|
|
||||||
<enabled>true</enabled>
|
|
||||||
</snapshots>
|
|
||||||
<releases>
|
|
||||||
<enabled>true</enabled>
|
|
||||||
</releases>
|
|
||||||
</repository>
|
|
||||||
</repositories>
|
|
||||||
|
|
||||||
<distributionManagement>
|
|
||||||
<downloadUrl>http://maven.geo-solutions.it</downloadUrl>
|
|
||||||
<repository>
|
|
||||||
<uniqueVersion>false</uniqueVersion>
|
|
||||||
<id>geosolutions</id>
|
|
||||||
<url>ftp://maven.geo-solutions.it/</url>
|
|
||||||
</repository>
|
|
||||||
<site>
|
|
||||||
<id>demo.geosolutions</id>
|
|
||||||
<url>scp://demo.geo-solutions.it/var/www/share/github/gsman</url>
|
|
||||||
</site>
|
|
||||||
</distributionManagement>
|
|
||||||
|
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
<version>2.0.2</version>
|
<version>2.0.2</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<source>1.6</source>
|
<source>1.6</source>
|
||||||
<target>1.6</target>
|
<target>1.6</target>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-javadoc-plugin</artifactId>
|
<artifactId>maven-javadoc-plugin</artifactId>
|
||||||
<version>2.7</version>
|
<version>2.7</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<detectLinks />
|
<detectLinks />
|
||||||
<!-- <links> <link>http://commons.apache.org/dbcp/apidocs/</link> <link>http://commons.apache.org/fileupload/apidocs/</link>
|
<!-- <links> <link>http://commons.apache.org/dbcp/apidocs/</link> <link>http://commons.apache.org/fileupload/apidocs/</link>
|
||||||
<link>http://download.oracle.com/javase/6/docs/api</link> </links> -->
|
<link>http://download.oracle.com/javase/6/docs/api</link> </links> -->
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
<!-- ======================================================= -->
|
<!-- ======================================================= -->
|
||||||
<!-- Source packaging. -->
|
<!-- Source packaging. -->
|
||||||
<!-- ======================================================= -->
|
<!-- ======================================================= -->
|
||||||
<plugin>
|
<plugin>
|
||||||
<inherited>true</inherited>
|
<inherited>true</inherited>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-source-plugin</artifactId>
|
<artifactId>maven-source-plugin</artifactId>
|
||||||
<configuration>
|
<configuration>
|
||||||
<attach>true</attach>
|
<attach>true</attach>
|
||||||
</configuration>
|
</configuration>
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
<id>attach-sources</id>
|
<id>attach-sources</id>
|
||||||
<goals>
|
<goals>
|
||||||
<goal>jar</goal>
|
<goal>jar</goal>
|
||||||
</goals>
|
</goals>
|
||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
<!-- versioning -->
|
<!-- versioning -->
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-release-plugin</artifactId>
|
<artifactId>maven-release-plugin</artifactId>
|
||||||
<version>2.2.2</version>
|
<version>2.2.2</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<tagNameFormat>v@{project.version}</tagNameFormat>
|
<tagNameFormat>v@{project.version}</tagNameFormat>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
|
|
||||||
<!-- ======================================================== -->
|
<!-- ======================================================== -->
|
||||||
<!-- Extensions settings for Deployment -->
|
<!-- Extensions settings for Deployment -->
|
||||||
<!-- ======================================================== -->
|
<!-- ======================================================== -->
|
||||||
<extensions>
|
<extensions>
|
||||||
<!--............................................. -->
|
<!--............................................. -->
|
||||||
<!-- geo-solutions (using wagon ftp) -->
|
<!-- geo-solutions (using wagon ftp) -->
|
||||||
<!--............................................. -->
|
<!--............................................. -->
|
||||||
<extension>
|
<extension>
|
||||||
<groupId>org.apache.maven.wagon</groupId>
|
<groupId>org.apache.maven.wagon</groupId>
|
||||||
<artifactId>wagon-ftp</artifactId>
|
<artifactId>wagon-ftp</artifactId>
|
||||||
<version>2.6</version>
|
<version>1.0-beta-7</version>
|
||||||
</extension>
|
</extension>
|
||||||
</extensions>
|
</extensions>
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
<reporting>
|
<reporting>
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-javadoc-plugin</artifactId>
|
<artifactId>maven-javadoc-plugin</artifactId>
|
||||||
<configuration>
|
<configuration>
|
||||||
<links>
|
<links>
|
||||||
<link>http://commons.apache.org/lang/api</link>
|
<link>http://commons.apache.org/lang/api</link>
|
||||||
<link>http://java.sun.com/j2se/1.5.0/docs/api</link>
|
<link>http://java.sun.com/j2se/1.5.0/docs/api</link>
|
||||||
<link>http://www.jdom.org/docs/apidocs</link>
|
<link>http://www.jdom.org/docs/apidocs</link>
|
||||||
</links>
|
</links>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
</plugins>
|
<!-- <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>cobertura-maven-plugin</artifactId>
|
||||||
</reporting>
|
<version>2.2</version> </plugin> -->
|
||||||
|
</plugins>
|
||||||
|
</reporting>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<slf4j.version>1.5.11</slf4j.version>
|
<slf4j.version>1.5.11</slf4j.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>commons-io</groupId>
|
|
||||||
<artifactId>commons-io</artifactId>
|
|
||||||
<version>2.0.1</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>commons-httpclient</groupId>
|
|
||||||
<artifactId>commons-httpclient</artifactId>
|
|
||||||
<version>3.1</version>
|
|
||||||
<exclusions>
|
|
||||||
<exclusion>
|
|
||||||
<groupId>commons-logging</groupId>
|
|
||||||
<artifactId>commons-logging</artifactId>
|
|
||||||
</exclusion>
|
|
||||||
</exclusions>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>jdom</groupId>
|
|
||||||
<artifactId>jdom</artifactId>
|
|
||||||
<version>1.1</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>net.sf.json-lib</groupId>
|
|
||||||
<artifactId>json-lib</artifactId>
|
|
||||||
<version>2.4</version>
|
|
||||||
<classifier>jdk15</classifier>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.servicemix.bundles</groupId>
|
<groupId>commons-io</groupId>
|
||||||
<artifactId>org.apache.servicemix.bundles.restlet</artifactId>
|
<artifactId>commons-io</artifactId>
|
||||||
<version>1.1.10_3</version>
|
<version>2.0.1</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.slf4j</groupId>
|
<groupId>commons-httpclient</groupId>
|
||||||
<artifactId>slf4j-api</artifactId>
|
<artifactId>commons-httpclient</artifactId>
|
||||||
<version>${slf4j.version}</version>
|
<version>3.1</version>
|
||||||
</dependency>
|
<exclusions>
|
||||||
<dependency>
|
<exclusion>
|
||||||
<groupId>org.slf4j</groupId>
|
<groupId>commons-logging</groupId>
|
||||||
<artifactId>jcl-over-slf4j</artifactId>
|
<artifactId>commons-logging</artifactId>
|
||||||
<version>${slf4j.version}</version>
|
</exclusion>
|
||||||
</dependency>
|
</exclusions>
|
||||||
<!-- commons-logging can be rather simply and conveniently excluded as
|
</dependency>
|
||||||
a dependency by declaring it in the provided scope within the pom.xml file
|
|
||||||
of your project. The actual commons-logging classes would be provided by
|
|
||||||
jcl-over-slf4j.
|
|
||||||
This translates into the following pom file snippet: -->
|
|
||||||
<!-- <dependency>
|
|
||||||
<groupId>commons-logging</groupId>
|
|
||||||
<artifactId>commons-logging</artifactId>
|
|
||||||
<version>1.1.1</version>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>log4j</groupId>
|
|
||||||
<artifactId>log4j</artifactId>
|
|
||||||
<version>1.2.16</version>
|
|
||||||
</dependency>
|
|
||||||
</dependency>-->
|
|
||||||
|
|
||||||
<!--================================================================= -->
|
|
||||||
<!-- TEST -->
|
|
||||||
<!--================================================================= -->
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>jdom</groupId>
|
||||||
<artifactId>junit</artifactId>
|
<artifactId>jdom</artifactId>
|
||||||
<version>4.8.2</version>
|
<version>1.1</version>
|
||||||
<scope>test</scope>
|
</dependency>
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework</groupId>
|
<groupId>org.slf4j</groupId>
|
||||||
<artifactId>spring-core</artifactId>
|
<artifactId>slf4j-api</artifactId>
|
||||||
<version>2.5.6.SEC02</version>
|
<version>${slf4j.version}</version>
|
||||||
<scope>test</scope>
|
</dependency>
|
||||||
<exclusions>
|
<dependency>
|
||||||
<exclusion>
|
<groupId>org.slf4j</groupId>
|
||||||
<groupId>commons-logging</groupId>
|
<artifactId>jcl-over-slf4j</artifactId>
|
||||||
<artifactId>commons-logging</artifactId>
|
<version>${slf4j.version}</version>
|
||||||
</exclusion>
|
</dependency>
|
||||||
</exclusions>
|
<!-- commons-logging can be rather simply and conveniently excluded as
|
||||||
</dependency>
|
a dependency by declaring it in the provided scope within the pom.xml file
|
||||||
|
of your project. The actual commons-logging classes would be provided by
|
||||||
|
jcl-over-slf4j. This translates into the following pom file snippet: -->
|
||||||
|
<!-- <dependency> <groupId>commons-logging</groupId> <artifactId>commons-logging</artifactId>
|
||||||
|
<version>1.1.1</version> <scope>provided</scope> </dependency> <dependency>
|
||||||
|
<groupId>log4j</groupId> <artifactId>log4j</artifactId> <version>1.2.16</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
</dependency>-->
|
||||||
|
<!--================================================================= -->
|
||||||
|
<!-- TEST -->
|
||||||
|
<!--================================================================= -->
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.slf4j</groupId>
|
<groupId>junit</groupId>
|
||||||
<artifactId>slf4j-log4j12</artifactId>
|
<artifactId>junit</artifactId>
|
||||||
<version>${slf4j.version}</version>
|
<version>4.8.2</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework</groupId>
|
||||||
|
<artifactId>spring-core</artifactId>
|
||||||
|
<version>2.5.6.SEC02</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>commons-logging</groupId>
|
||||||
|
<artifactId>commons-logging</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.slf4j</groupId>
|
||||||
|
<artifactId>slf4j-log4j12</artifactId>
|
||||||
|
<version>${slf4j.version}</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* GeoServer-Manager - Simple Manager Library for GeoServer
|
* GeoServer-Manager - Simple Manager Library for GeoServer
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007,2016 GeoSolutions S.A.S.
|
* Copyright (C) 2007,2013 GeoSolutions S.A.S.
|
||||||
* http://www.geo-solutions.it
|
* http://www.geo-solutions.it
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* GeoServer-Manager - Simple Manager Library for GeoServer
|
* GeoServer-Manager - Simple Manager Library for GeoServer
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007 - 2016 GeoSolutions S.A.S.
|
* Copyright (C) 2007,2015,2016 GeoSolutions S.A.S.
|
||||||
* http://www.geo-solutions.it
|
* http://www.geo-solutions.it
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
@ -42,7 +42,6 @@ import it.geosolutions.geoserver.rest.encoder.feature.GSFeatureTypeEncoder;
|
|||||||
import it.geosolutions.geoserver.rest.manager.GeoServerRESTStructuredGridCoverageReaderManager;
|
import it.geosolutions.geoserver.rest.manager.GeoServerRESTStructuredGridCoverageReaderManager;
|
||||||
import it.geosolutions.geoserver.rest.manager.GeoServerRESTStructuredGridCoverageReaderManager.ConfigureCoveragesOption;
|
import it.geosolutions.geoserver.rest.manager.GeoServerRESTStructuredGridCoverageReaderManager.ConfigureCoveragesOption;
|
||||||
import it.geosolutions.geoserver.rest.manager.GeoServerRESTStyleManager;
|
import it.geosolutions.geoserver.rest.manager.GeoServerRESTStyleManager;
|
||||||
import it.geosolutions.geoserver.rest.manager.GeoServerRESTImporterManager;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
@ -59,8 +58,6 @@ import org.apache.commons.io.FilenameUtils;
|
|||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import net.sf.json.JSONObject;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Connect to a GeoServer instance to publish or modify its contents via REST API.
|
* Connect to a GeoServer instance to publish or modify its contents via REST API.
|
||||||
* <P>
|
* <P>
|
||||||
@ -94,9 +91,6 @@ public class GeoServerRESTPublisher {
|
|||||||
|
|
||||||
|
|
||||||
private final GeoServerRESTStyleManager styleManager;
|
private final GeoServerRESTStyleManager styleManager;
|
||||||
|
|
||||||
private final GeoServerRESTImporterManager importerManager;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a <TT>GeoServerRESTPublisher</TT> to connect against a GeoServer instance with the given URL and user credentials.
|
* Creates a <TT>GeoServerRESTPublisher</TT> to connect against a GeoServer instance with the given URL and user credentials.
|
||||||
*
|
*
|
||||||
@ -116,7 +110,6 @@ public class GeoServerRESTPublisher {
|
|||||||
LOGGER.error("Bad URL: Calls to GeoServer are going to fail" , ex);
|
LOGGER.error("Bad URL: Calls to GeoServer are going to fail" , ex);
|
||||||
}
|
}
|
||||||
styleManager = new GeoServerRESTStyleManager(url, username, password);
|
styleManager = new GeoServerRESTStyleManager(url, username, password);
|
||||||
importerManager = new GeoServerRESTImporterManager(url, username, password);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
@ -1574,6 +1567,19 @@ public class GeoServerRESTPublisher {
|
|||||||
coverageName) } : (NameValuePair[]) null);
|
coverageName) } : (NameValuePair[]) null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Same as {@link #publishArcGrid(String, String, String, File, String, ProjectionPolicy, String, double[])} but without the last parameter
|
||||||
|
* (bbox). Kept here for backwards compatibility.
|
||||||
|
*
|
||||||
|
* @deprecated use the former method with bbox set to null.
|
||||||
|
*/
|
||||||
|
public boolean publishArcGrid(String workspace, String storeName, String resourceName,
|
||||||
|
File arcgrid, String srs, ProjectionPolicy policy, String defaultStyle)
|
||||||
|
throws FileNotFoundException, IllegalArgumentException {
|
||||||
|
return publishArcGrid(workspace, storeName, resourceName, arcgrid, srs, policy,
|
||||||
|
defaultStyle, null);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Upload and publish a ArcGrid image.
|
* Upload and publish a ArcGrid image.
|
||||||
*
|
*
|
||||||
@ -3152,58 +3158,4 @@ public class GeoServerRESTPublisher {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Refers to {@link it.geosolutions.geoserver.rest.manager.GeoServerRESTImporterManager#postNewImport() postNewImport} method
|
|
||||||
*
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
public int postNewImport() throws Exception {
|
|
||||||
return importerManager.postNewImport();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Refers to {@link it.geosolutions.geoserver.rest.manager.GeoServerRESTImporterManager#postNewTaskAsMultiPartForm(int, String) postNewTaskAsMultiPartForm} method
|
|
||||||
*
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
public int postNewTaskAsMultiPartForm(int i, String data) throws Exception {
|
|
||||||
return importerManager.postNewTaskAsMultiPartForm(i, data);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Refers to {@link it.geosolutions.geoserver.rest.manager.GeoServerRESTImporterManager#getTask(int, int) getTask} method
|
|
||||||
*
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
public JSONObject getTask(int i, int t) throws Exception {
|
|
||||||
return importerManager.getTask(i, t);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Refers to {@link it.geosolutions.geoserver.rest.manager.GeoServerRESTImporterManager#putTask(int, int, String) putTask} method
|
|
||||||
*
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
public void putTask(int i, int t, String json) throws Exception {
|
|
||||||
importerManager.putTask(i, t, json);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Refers to {@link it.geosolutions.geoserver.rest.manager.GeoServerRESTImporterManager#putTaskLayer(int, int, String) putTaskLayer} method
|
|
||||||
*
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
public void putTaskLayer(int i, int t, String json) throws Exception {
|
|
||||||
importerManager.putTaskLayer(i, t, json);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Refers to {@link it.geosolutions.geoserver.rest.manager.GeoServerRESTImporterManager#postImport(int) postImport} method
|
|
||||||
*
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
public void postImport(int i) throws Exception {
|
|
||||||
importerManager.postImport(i);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,7 +25,6 @@
|
|||||||
|
|
||||||
package it.geosolutions.geoserver.rest;
|
package it.geosolutions.geoserver.rest;
|
||||||
|
|
||||||
import java.io.ByteArrayOutputStream;
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
@ -34,11 +33,6 @@ import java.net.ConnectException;
|
|||||||
import java.net.HttpURLConnection;
|
import java.net.HttpURLConnection;
|
||||||
import java.net.MalformedURLException;
|
import java.net.MalformedURLException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import net.sf.json.JSON;
|
|
||||||
import net.sf.json.JSONSerializer;
|
|
||||||
|
|
||||||
import org.apache.commons.httpclient.Credentials;
|
import org.apache.commons.httpclient.Credentials;
|
||||||
import org.apache.commons.httpclient.HttpClient;
|
import org.apache.commons.httpclient.HttpClient;
|
||||||
@ -54,9 +48,6 @@ import org.apache.commons.httpclient.methods.PostMethod;
|
|||||||
import org.apache.commons.httpclient.methods.PutMethod;
|
import org.apache.commons.httpclient.methods.PutMethod;
|
||||||
import org.apache.commons.httpclient.methods.RequestEntity;
|
import org.apache.commons.httpclient.methods.RequestEntity;
|
||||||
import org.apache.commons.httpclient.methods.StringRequestEntity;
|
import org.apache.commons.httpclient.methods.StringRequestEntity;
|
||||||
import org.apache.commons.httpclient.methods.multipart.FilePart;
|
|
||||||
import org.apache.commons.httpclient.methods.multipart.MultipartRequestEntity;
|
|
||||||
import org.apache.commons.httpclient.methods.multipart.Part;
|
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@ -126,22 +117,6 @@ public class HTTPUtils {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Executes a request using the GET method and parses the result as a json object.
|
|
||||||
*
|
|
||||||
* @param path The path to request.
|
|
||||||
*
|
|
||||||
* @return The result parsed as json.
|
|
||||||
*/
|
|
||||||
public static JSON getAsJSON(String url, String username, String pw) throws Exception {
|
|
||||||
String response = get(url, username, pw);
|
|
||||||
return json(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static JSON json(String content) {
|
|
||||||
return JSONSerializer.toJSON(content);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PUTs a File to the given URL. <BR>
|
* PUTs a File to the given URL. <BR>
|
||||||
* Basic auth is used if both username and pw are not null.
|
* Basic auth is used if both username and pw are not null.
|
||||||
@ -200,23 +175,6 @@ public class HTTPUtils {
|
|||||||
return put(url, content, "text/xml", username, pw);
|
return put(url, content, "text/xml", username, pw);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* PUTs a String representing an JSON Object to the given URL. <BR>
|
|
||||||
* Basic auth is used if both username and pw are not null.
|
|
||||||
*
|
|
||||||
* @param url The URL where to connect to.
|
|
||||||
* @param content The JSON Object to be sent as a String.
|
|
||||||
* @param username Basic auth credential. No basic auth if null.
|
|
||||||
* @param pw Basic auth credential. No basic auth if null.
|
|
||||||
* @return The HTTP response as a String if the HTTP response code was 200
|
|
||||||
* (OK).
|
|
||||||
* @throws MalformedURLException
|
|
||||||
* @return the HTTP response or <TT>null</TT> on errors.
|
|
||||||
*/
|
|
||||||
public static String putJson(String url, String content, String username, String pw) {
|
|
||||||
return put(url, content, "application/json", username, pw);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Performs a PUT to the given URL. <BR>
|
* Performs a PUT to the given URL. <BR>
|
||||||
* Basic auth is used if both username and pw are not null.
|
* Basic auth is used if both username and pw are not null.
|
||||||
@ -275,38 +233,6 @@ public class HTTPUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* POSTs a list of files as attachments to the given URL. <BR>
|
|
||||||
* Basic auth is used if both username and pw are not null.
|
|
||||||
*
|
|
||||||
* @param url The URL where to connect to.
|
|
||||||
* @param dir The folder containing the attachments.
|
|
||||||
* @param username Basic auth credential. No basic auth if null.
|
|
||||||
* @param pw Basic auth credential. No basic auth if null.
|
|
||||||
* @return The HTTP response as a String if the HTTP response code was 200
|
|
||||||
* (OK).
|
|
||||||
* @throws MalformedURLException
|
|
||||||
* @return the HTTP response or <TT>null</TT> on errors.
|
|
||||||
*/
|
|
||||||
public static String postMultipartForm(String url, File dir, String username, String pw) {
|
|
||||||
try {
|
|
||||||
List<Part> parts = new ArrayList<Part>();
|
|
||||||
for (File f : dir.listFiles()) {
|
|
||||||
parts.add(new FilePart(f.getName(), f));
|
|
||||||
}
|
|
||||||
MultipartRequestEntity multipart = new MultipartRequestEntity(
|
|
||||||
parts.toArray(new Part[parts.size()]), new PostMethod().getParams());
|
|
||||||
|
|
||||||
ByteArrayOutputStream bout = new ByteArrayOutputStream();
|
|
||||||
multipart.writeRequest(bout);
|
|
||||||
|
|
||||||
return post(url, multipart, username, pw);
|
|
||||||
} catch (Exception ex) {
|
|
||||||
LOGGER.error("Cannot POST " + url, ex);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* POSTs a String representing an XML document to the given URL. <BR>
|
* POSTs a String representing an XML document to the given URL. <BR>
|
||||||
* Basic auth is used if both username and pw are not null.
|
* Basic auth is used if both username and pw are not null.
|
||||||
@ -324,23 +250,6 @@ public class HTTPUtils {
|
|||||||
return post(url, content, "text/xml", username, pw);
|
return post(url, content, "text/xml", username, pw);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* POSTs a String representing an JSON Object to the given URL. <BR>
|
|
||||||
* Basic auth is used if both username and pw are not null.
|
|
||||||
*
|
|
||||||
* @param url The URL where to connect to.
|
|
||||||
* @param content The JSON content to be sent as a String.
|
|
||||||
* @param username Basic auth credential. No basic auth if null.
|
|
||||||
* @param pw Basic auth credential. No basic auth if null.
|
|
||||||
* @return The HTTP response as a String if the HTTP response code was 200
|
|
||||||
* (OK).
|
|
||||||
* @throws MalformedURLException
|
|
||||||
* @return the HTTP response or <TT>null</TT> on errors.
|
|
||||||
*/
|
|
||||||
public static String postJson(String url, String content, String username, String pw) {
|
|
||||||
return post(url, content, "application/json", username, pw);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Performs a POST to the given URL. <BR>
|
* Performs a POST to the given URL. <BR>
|
||||||
* Basic auth is used if both username and pw are not null.
|
* Basic auth is used if both username and pw are not null.
|
||||||
@ -384,7 +293,6 @@ public class HTTPUtils {
|
|||||||
httpMethod.setRequestEntity(requestEntity);
|
httpMethod.setRequestEntity(requestEntity);
|
||||||
int status = client.executeMethod(httpMethod);
|
int status = client.executeMethod(httpMethod);
|
||||||
|
|
||||||
InputStream responseBody;
|
|
||||||
switch (status) {
|
switch (status) {
|
||||||
case HttpURLConnection.HTTP_OK:
|
case HttpURLConnection.HTTP_OK:
|
||||||
case HttpURLConnection.HTTP_CREATED:
|
case HttpURLConnection.HTTP_CREATED:
|
||||||
@ -395,10 +303,9 @@ public class HTTPUtils {
|
|||||||
LOGGER.info("HTTP " + httpMethod.getStatusText() + ": " + response);
|
LOGGER.info("HTTP " + httpMethod.getStatusText() + ": " + response);
|
||||||
return response;
|
return response;
|
||||||
default:
|
default:
|
||||||
responseBody = httpMethod.getResponseBodyAsStream();
|
|
||||||
LOGGER.warn("Bad response: code[" + status + "]" + " msg[" + httpMethod.getStatusText() + "]"
|
LOGGER.warn("Bad response: code[" + status + "]" + " msg[" + httpMethod.getStatusText() + "]"
|
||||||
+ " url[" + url + "]" + " method[" + httpMethod.getClass().getSimpleName()
|
+ " url[" + url + "]" + " method[" + httpMethod.getClass().getSimpleName()
|
||||||
+ "]: " + (responseBody != null ? IOUtils.toString(responseBody) : ""));
|
+ "]: " + IOUtils.toString(httpMethod.getResponseBodyAsStream()));
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
} catch (ConnectException e) {
|
} catch (ConnectException e) {
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* GeoServer-Manager - Simple Manager Library for GeoServer
|
* GeoServer-Manager - Simple Manager Library for GeoServer
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007 - 2016 GeoSolutions S.A.S.
|
* Copyright (C) 2007,2015 GeoSolutions S.A.S.
|
||||||
* http://www.geo-solutions.it
|
* http://www.geo-solutions.it
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
@ -50,13 +50,8 @@ public static final String QUIET_ON_NOT_FOUND_PARAM = "quietOnNotFound=";
|
|||||||
List<RESTStyle> styles = new ArrayList<RESTStyle>();
|
List<RESTStyle> styles = new ArrayList<RESTStyle>();
|
||||||
|
|
||||||
RESTStyle style = reader.getStyle(stylename);
|
RESTStyle style = reader.getStyle(stylename);
|
||||||
|
if(style != null)
|
||||||
// We don't want geoserver to be lenient here: take only the real global style if it exists
|
styles.add(style);
|
||||||
if(style != null) {
|
|
||||||
if(style.getWorkspace() == null || style.getWorkspace().isEmpty()) {
|
|
||||||
styles.add(style);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (String workspace : reader.getWorkspaceNames()) {
|
for (String workspace : reader.getWorkspaceNames()) {
|
||||||
style = reader.getStyle(workspace, stylename);
|
style = reader.getStyle(workspace, stylename);
|
||||||
|
|||||||
@ -56,7 +56,7 @@ public abstract class GSAbstractStoreEncoder extends PropertyXMLEncoder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getType() {
|
public String getType() {
|
||||||
return ElementUtils.contains(getRoot(), "type").getTextTrim();
|
return ElementUtils.contains(getRoot(), "name").getTextTrim();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setName(String name) {
|
public void setName(String name) {
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* GeoServer-Manager - Simple Manager Library for GeoServer
|
* GeoServer-Manager - Simple Manager Library for GeoServer
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2016 GeoSolutions S.A.S.
|
* Copyright (C) 2007,2011 GeoSolutions S.A.S.
|
||||||
* http://www.geo-solutions.it
|
* http://www.geo-solutions.it
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
@ -26,6 +26,7 @@
|
|||||||
package it.geosolutions.geoserver.rest.encoder;
|
package it.geosolutions.geoserver.rest.encoder;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
@ -36,7 +37,6 @@ import it.geosolutions.geoserver.rest.encoder.identifier.GSIdentifierInfoEncoder
|
|||||||
import it.geosolutions.geoserver.rest.encoder.identifier.IdentifierInfo;
|
import it.geosolutions.geoserver.rest.encoder.identifier.IdentifierInfo;
|
||||||
import it.geosolutions.geoserver.rest.encoder.utils.NestedElementEncoder;
|
import it.geosolutions.geoserver.rest.encoder.utils.NestedElementEncoder;
|
||||||
import it.geosolutions.geoserver.rest.encoder.utils.XmlElement;
|
import it.geosolutions.geoserver.rest.encoder.utils.XmlElement;
|
||||||
import java.util.LinkedHashMap;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Layer encoder for Geoserver = 2.1
|
* Layer encoder for Geoserver = 2.1
|
||||||
@ -102,7 +102,7 @@ public class GSLayerEncoder21 extends GSLayerEncoder {
|
|||||||
*/
|
*/
|
||||||
public void addAuthorityURL(GSAuthorityURLInfoEncoder authorityURLInfo){
|
public void addAuthorityURL(GSAuthorityURLInfoEncoder authorityURLInfo){
|
||||||
if(authorityURLList == null){
|
if(authorityURLList == null){
|
||||||
authorityURLList = new LinkedHashMap<String,String>();
|
authorityURLList = new HashMap<String,String>();
|
||||||
}
|
}
|
||||||
authorityURLList.put(authorityURLInfo.getHref(), authorityURLInfo.getName());
|
authorityURLList.put(authorityURLInfo.getHref(), authorityURLInfo.getName());
|
||||||
String jsonStr = "";
|
String jsonStr = "";
|
||||||
@ -152,7 +152,7 @@ public class GSLayerEncoder21 extends GSLayerEncoder {
|
|||||||
*/
|
*/
|
||||||
public void addIdentifier(GSIdentifierInfoEncoder identifierInfo){
|
public void addIdentifier(GSIdentifierInfoEncoder identifierInfo){
|
||||||
if(identifierList == null){
|
if(identifierList == null){
|
||||||
identifierList = new LinkedHashMap<String,List<String>>();
|
identifierList = new HashMap<String,List<String>>();
|
||||||
}
|
}
|
||||||
|
|
||||||
String authority = identifierInfo.getAuthority();
|
String authority = identifierInfo.getAuthority();
|
||||||
|
|||||||
@ -37,7 +37,7 @@ import org.jdom.filter.Filter;
|
|||||||
* {@code
|
* {@code
|
||||||
* final GSCoverageDimensionEncoder gsCoverageDimensionEncoder =
|
* final GSCoverageDimensionEncoder gsCoverageDimensionEncoder =
|
||||||
* new GSCoverageDimensionEncoder("GRAY_INDEX", "GridSampleDimension[-2.147483648E9,-2.147483648E9]",
|
* new GSCoverageDimensionEncoder("GRAY_INDEX", "GridSampleDimension[-2.147483648E9,-2.147483648E9]",
|
||||||
* String.valueOf(Integer.MIN_VALUE), String.valueOf(Integer.MAX_VALUE), "dobson units", "REAL_32BITS");
|
* String.valueOf(Integer.MIN_VALUE), String.valueOf(Integer.MAX_VALUE), "dobson units³", "REAL_32BITS");
|
||||||
* coverageEncoder.addCoverageDimensionInfo(gsCoverageDimensionEncoder);
|
* coverageEncoder.addCoverageDimensionInfo(gsCoverageDimensionEncoder);
|
||||||
* }
|
* }
|
||||||
* </pre>
|
* </pre>
|
||||||
@ -53,7 +53,7 @@ import org.jdom.filter.Filter;
|
|||||||
* <min>-2.147483648E9</min>
|
* <min>-2.147483648E9</min>
|
||||||
* <max>2.147483647E9</max>
|
* <max>2.147483647E9</max>
|
||||||
* </range>
|
* </range>
|
||||||
* <unit>dobson units</unit>
|
* <unit>dobson units³</unit>
|
||||||
* <dimensionType>
|
* <dimensionType>
|
||||||
* <name>REAL_32BITS</name>
|
* <name>REAL_32BITS</name>
|
||||||
* </dimensionType>
|
* </dimensionType>
|
||||||
@ -390,4 +390,4 @@ public class GSCoverageDimensionEncoder extends XmlElement {
|
|||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,321 +0,0 @@
|
|||||||
/*
|
|
||||||
* GeoServer-Manager - Simple Manager Library for GeoServer
|
|
||||||
*
|
|
||||||
* Copyright (C) 2007,2011 GeoSolutions S.A.S.
|
|
||||||
* http://www.geo-solutions.it
|
|
||||||
*
|
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
|
||||||
* in the Software without restriction, including without limitation the rights
|
|
||||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
* copies of the Software, and to permit persons to whom the Software is
|
|
||||||
* furnished to do so, subject to the following conditions:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice shall be included in
|
|
||||||
* all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
* THE SOFTWARE.
|
|
||||||
*/
|
|
||||||
package it.geosolutions.geoserver.rest.manager;
|
|
||||||
|
|
||||||
import it.geosolutions.geoserver.rest.HTTPUtils;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.net.URL;
|
|
||||||
|
|
||||||
import net.sf.json.JSON;
|
|
||||||
import net.sf.json.JSONObject;
|
|
||||||
|
|
||||||
import org.restlet.data.MediaType;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Alessio Fabiani, GeoSolutions S.A.S.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class GeoServerRESTImporterManager extends GeoServerRESTAbstractManager {
|
|
||||||
|
|
||||||
private final static Logger LOGGER = LoggerFactory.getLogger(GeoServerRESTImporterManager.class);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Default constructor.
|
|
||||||
*
|
|
||||||
* @param restURL GeoServer REST API endpoint
|
|
||||||
* @param username GeoServer REST API authorized username
|
|
||||||
* @param password GeoServer REST API password for the former username
|
|
||||||
*/
|
|
||||||
public GeoServerRESTImporterManager(URL restURL, String username, String password)
|
|
||||||
throws IllegalArgumentException {
|
|
||||||
super(restURL, username, password);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Retrieves the Import JSON Object given its identifier
|
|
||||||
*
|
|
||||||
* @param imp int: Import context number ID
|
|
||||||
*/
|
|
||||||
public JSONObject getImport(int imp) throws Exception {
|
|
||||||
JSON json = HTTPUtils.getAsJSON(String.format(buildUrl()+"/%d", imp), gsuser , gspass);
|
|
||||||
return ((JSONObject)json).getJSONObject("import");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Retrieves the Import Task JSON Object given its identifier and task number
|
|
||||||
*
|
|
||||||
* @param imp int: Import context number ID
|
|
||||||
* @param task int: Task number
|
|
||||||
*/
|
|
||||||
public JSONObject getTask(int imp, int task) throws Exception {
|
|
||||||
JSON json = HTTPUtils.getAsJSON(String.format(buildUrl()+"/%d/tasks/%d?expand=all", imp, task), gsuser , gspass);
|
|
||||||
return ((JSONObject)json).getJSONObject("task");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Example usage:
|
|
||||||
* <pre>
|
|
||||||
* // Creates a new Importer Context and gets back the ID
|
|
||||||
* int i = postNewImport();
|
|
||||||
*
|
|
||||||
* // Attaches to the new Importer Context a Task pointing to a shapefile's zip archive
|
|
||||||
* int t = postNewTaskAsMultiPartForm(i, "/path_to/shape/archsites_no_crs.zip");
|
|
||||||
*
|
|
||||||
* // Check that the Task was actually created and that the CRS has not recognized in this case
|
|
||||||
* JSONObject task = getTask(i, t);
|
|
||||||
* assertEquals("NO_CRS", task.getString("state"));
|
|
||||||
*
|
|
||||||
* // Prepare the JSON String instructing the Task about the SRS to use
|
|
||||||
* String json =
|
|
||||||
* "{" +
|
|
||||||
* "\"task\": {" +
|
|
||||||
* "\"layer\": {" +
|
|
||||||
* "\"srs\": \"EPSG:4326\"" +
|
|
||||||
* "}" +
|
|
||||||
* "}" +
|
|
||||||
* "}";
|
|
||||||
*
|
|
||||||
* // Performing the Task update
|
|
||||||
* putTask(i, t, json);
|
|
||||||
*
|
|
||||||
* // Double check that the Task is in the READY state
|
|
||||||
* task = getTask(i, t);
|
|
||||||
* assertEquals("READY", task.getString("state"));
|
|
||||||
* assertEquals("gs_archsites", task.getJSONObject("layer").getJSONObject("style").getString("name"));
|
|
||||||
*
|
|
||||||
* // Prepare the JSON String instructing the Task avout the SLD to use for the new Layer
|
|
||||||
* json =
|
|
||||||
* "{" +
|
|
||||||
* "\"task\": {" +
|
|
||||||
* "\"layer\": {" +
|
|
||||||
* "\"style\": {" +
|
|
||||||
* "\"name\": \"point\"" +
|
|
||||||
* "}" +
|
|
||||||
* "}" +
|
|
||||||
* "}" +
|
|
||||||
* "}";
|
|
||||||
*
|
|
||||||
* // Performing the Task update
|
|
||||||
* putTask(i, t,json);
|
|
||||||
*
|
|
||||||
* // Double check that the Task is in the READY state and that the Style has been correctly updated
|
|
||||||
* task = getTask(i, t);
|
|
||||||
* assertEquals("READY", task.getString("state"));
|
|
||||||
* assertEquals("point", task.getJSONObject("layer").getJSONObject("style").getString("name"));
|
|
||||||
*
|
|
||||||
* // Finally starts the Import ...
|
|
||||||
* postImport(i);
|
|
||||||
* </pre>
|
|
||||||
*
|
|
||||||
* @param imp int: Import context number ID
|
|
||||||
* @param task int: Task number
|
|
||||||
* @param json String: JSON containing the Task properties to be updated
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
public void putTask(int imp, int task, final String json) throws Exception {
|
|
||||||
//HTTPUtils.putJson(String.format(buildUrl()+"/%d/tasks/%d", imp, task), json, gsuser, gspass);
|
|
||||||
HTTPUtils.put(String.format(buildUrl()+"/%d/tasks/%d", imp, task), json, "text/plain", gsuser, gspass);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Just update the Layers properties associated to a Task (t) in the Importer Context (i).
|
|
||||||
*
|
|
||||||
* e.g.:
|
|
||||||
* <pre>
|
|
||||||
* putTaskLayer(i, t, "{\"title\":\"Archsites\", \"abstract\":\"Archeological Sites\"}");
|
|
||||||
* </pre>
|
|
||||||
*
|
|
||||||
* @param imp int: Import context number ID
|
|
||||||
* @param task int: Task number
|
|
||||||
* @param json String: JSON containing the Layer properties to be updated
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
public void putTaskLayer(int imp, int task, final String json) throws Exception {
|
|
||||||
HTTPUtils.putJson(String.format(buildUrl()+"/%d/tasks/%d/layer", imp, task), json, gsuser, gspass);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Just update the Layers properties associated to a Task (t) in the Importer Context (i).
|
|
||||||
*
|
|
||||||
* e.g.:
|
|
||||||
* <pre>
|
|
||||||
* putTaskLayer(i, t, "{\"title\":\"Archsites\", \"abstract\":\"Archeological Sites\"}");
|
|
||||||
* </pre>
|
|
||||||
*
|
|
||||||
* @param imp int: Import context number ID
|
|
||||||
* @param task int: Task number
|
|
||||||
* @param json String: JSON containing the Layer properties to be updated
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
public void postTaskTransform(int imp, int task, final String json) throws Exception {
|
|
||||||
HTTPUtils.postJson(String.format(buildUrl()+"/%d/tasks/%d/transforms", imp, task), json, gsuser, gspass);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates an empty Importer Context.
|
|
||||||
*
|
|
||||||
* @return The new Importer Context ID
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
public int postNewImport() throws Exception {
|
|
||||||
return postNewImport(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* e.g.:
|
|
||||||
* <pre>
|
|
||||||
* String body =
|
|
||||||
* "{" +
|
|
||||||
* "\"import\": { " +
|
|
||||||
* "\"data\": {" +
|
|
||||||
* "\"type\": \"mosaic\", " +
|
|
||||||
* "\"time\": {" +
|
|
||||||
* " \"mode\": \"auto\"" +
|
|
||||||
* "}" +
|
|
||||||
* "}" +
|
|
||||||
* "}" +
|
|
||||||
* "}";
|
|
||||||
* </pre>
|
|
||||||
*
|
|
||||||
* @param body JSON String representing the Importer Context definition
|
|
||||||
* @return The new Importer Context ID
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
public int postNewImport(String body) throws Exception {
|
|
||||||
String resp = body == null ? HTTPUtils.post(buildUrl(), "", "text/plain", gsuser, gspass)
|
|
||||||
: HTTPUtils.postJson(buildUrl(), body, gsuser, gspass);
|
|
||||||
|
|
||||||
JSONObject json = (JSONObject) HTTPUtils.json(resp);
|
|
||||||
JSONObject imprt = json.getJSONObject("import");
|
|
||||||
return imprt.getInt("id");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Actually starts the READY State Import.
|
|
||||||
*
|
|
||||||
* @param imp int: Import context number ID
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
public void postImport(int imp) throws Exception {
|
|
||||||
HTTPUtils.post(buildUrl()+"/" + imp + "?exec=true", "", "text/plain", gsuser, gspass);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param imp int: Import context number ID
|
|
||||||
* @param data
|
|
||||||
* @return
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
public int postNewTaskAsMultiPartForm(int imp, String data) throws Exception {
|
|
||||||
String resp = HTTPUtils.postMultipartForm(buildUrl()+"/" + imp + "/tasks", unpack(data), gsuser, gspass);
|
|
||||||
|
|
||||||
JSONObject json = (JSONObject) HTTPUtils.json(resp);
|
|
||||||
|
|
||||||
JSONObject task = json.getJSONObject("task");
|
|
||||||
return task.getInt("id");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allows to attach a new zip file to an existing Importer Context.
|
|
||||||
*
|
|
||||||
* @param imp int: Import context number ID
|
|
||||||
* @param path
|
|
||||||
* @return
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
public int putNewTask(int imp, String path) throws Exception {
|
|
||||||
File zip = new File(path);
|
|
||||||
|
|
||||||
String resp = HTTPUtils.put(buildUrl()+"/" + imp + "/tasks/" + zip.getName(), zip, MediaType.APPLICATION_ZIP.toString(), gsuser, gspass);
|
|
||||||
|
|
||||||
JSONObject json = (JSONObject) HTTPUtils.json(resp);
|
|
||||||
|
|
||||||
JSONObject task = json.getJSONObject("task");
|
|
||||||
return task.getInt("id");
|
|
||||||
}
|
|
||||||
|
|
||||||
//=========================================================================
|
|
||||||
// Util methods
|
|
||||||
//=========================================================================
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates the base REST URL for the imports
|
|
||||||
*/
|
|
||||||
protected String buildUrl() {
|
|
||||||
StringBuilder sUrl = new StringBuilder(gsBaseUrl.toString()).append("/rest/imports");
|
|
||||||
|
|
||||||
return sUrl.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a temporary file
|
|
||||||
*
|
|
||||||
* @return Path to the temporary file
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
public static File tmpDir() throws Exception {
|
|
||||||
File dir = File.createTempFile("importer", "data", new File("target"));
|
|
||||||
dir.delete();
|
|
||||||
dir.mkdirs();
|
|
||||||
return dir;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Expands a zip archive into the temporary folder.
|
|
||||||
*
|
|
||||||
* @param path The absolute path to the source zip file
|
|
||||||
* @return Path to the temporary folder containing the expanded files
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
public static File unpack(String path) throws Exception {
|
|
||||||
return unpack(path, tmpDir());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Expands a zip archive into the target folder.
|
|
||||||
*
|
|
||||||
* @param path The absolute path to the source zip file
|
|
||||||
* @param dir Full path of the target folder where to expand the archive
|
|
||||||
* @return Path to the temporary folder containing the expanded files
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
public static File unpack(String path, File dir) throws Exception {
|
|
||||||
|
|
||||||
File file = new File(path);
|
|
||||||
|
|
||||||
//new VFSWorker().extractTo(file, dir);
|
|
||||||
if (!file.delete()) {
|
|
||||||
// fail early as tests will expect it's deleted
|
|
||||||
throw new IOException("deletion failed during extraction");
|
|
||||||
}
|
|
||||||
|
|
||||||
return dir;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,5 +1,6 @@
|
|||||||
package it.geosolutions.geoserver.decoder;
|
package it.geosolutions.geoserver.decoder;
|
||||||
|
|
||||||
|
import it.geosolutions.geoserver.rest.decoder.RESTLayer;
|
||||||
import it.geosolutions.geoserver.rest.decoder.RESTLayer21;
|
import it.geosolutions.geoserver.rest.decoder.RESTLayer21;
|
||||||
import it.geosolutions.geoserver.rest.encoder.authorityurl.GSAuthorityURLInfoEncoder;
|
import it.geosolutions.geoserver.rest.encoder.authorityurl.GSAuthorityURLInfoEncoder;
|
||||||
import it.geosolutions.geoserver.rest.encoder.identifier.GSIdentifierInfoEncoder;
|
import it.geosolutions.geoserver.rest.encoder.identifier.GSIdentifierInfoEncoder;
|
||||||
@ -13,8 +14,6 @@ import junit.framework.Assert;
|
|||||||
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.io.FileUtils;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
import org.springframework.core.io.ClassPathResource;
|
import org.springframework.core.io.ClassPathResource;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -25,9 +24,7 @@ import org.springframework.core.io.ClassPathResource;
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class LayerDecoder21Test{
|
public class LayerDecoder21Test{
|
||||||
|
|
||||||
private final static Logger LOGGER = LoggerFactory.getLogger(LayerDecoder21Test.class);
|
|
||||||
|
|
||||||
RESTLayer21 layer;
|
RESTLayer21 layer;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
@ -46,7 +43,7 @@ public class LayerDecoder21Test{
|
|||||||
public void testAuthorityURLs() {
|
public void testAuthorityURLs() {
|
||||||
List<GSAuthorityURLInfoEncoder> authorityURLs = layer
|
List<GSAuthorityURLInfoEncoder> authorityURLs = layer
|
||||||
.getEncodedAuthorityURLInfoList();
|
.getEncodedAuthorityURLInfoList();
|
||||||
LOGGER.debug("Number of authority URLs: " + authorityURLs.size());
|
System.out.println(authorityURLs.size());
|
||||||
Assert.assertEquals("authority1", authorityURLs.get(0).getName());
|
Assert.assertEquals("authority1", authorityURLs.get(0).getName());
|
||||||
Assert.assertEquals("http://www.authority1.org", authorityURLs.get(0)
|
Assert.assertEquals("http://www.authority1.org", authorityURLs.get(0)
|
||||||
.getHref());
|
.getHref());
|
||||||
|
|||||||
@ -23,6 +23,7 @@ package it.geosolutions.geoserver.decoder;
|
|||||||
|
|
||||||
import it.geosolutions.geoserver.rest.decoder.RESTCoverage;
|
import it.geosolutions.geoserver.rest.decoder.RESTCoverage;
|
||||||
import it.geosolutions.geoserver.rest.decoder.RESTDimensionInfo;
|
import it.geosolutions.geoserver.rest.decoder.RESTDimensionInfo;
|
||||||
|
import it.geosolutions.geoserver.rest.encoder.metadatalink.GSMetadataLinkInfoEncoder;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|||||||
@ -156,8 +156,7 @@ public class ResourceDecoderTest {
|
|||||||
coverageDimension1.getDescription());
|
coverageDimension1.getDescription());
|
||||||
Assert.assertEquals("-inf", coverageDimension1.getRangeMin());
|
Assert.assertEquals("-inf", coverageDimension1.getRangeMin());
|
||||||
Assert.assertEquals("inf", coverageDimension1.getRangeMax());
|
Assert.assertEquals("inf", coverageDimension1.getRangeMax());
|
||||||
// Assert.assertEquals("dobson units", coverageDimension1.getUnit());
|
Assert.assertEquals("dobson units³", coverageDimension1.getUnit());
|
||||||
Assert.assertTrue(coverageDimension1.getUnit().startsWith("dobson units"));
|
|
||||||
Assert.assertEquals("REAL_32BITS", coverageDimension1.getDimensionTypeName());
|
Assert.assertEquals("REAL_32BITS", coverageDimension1.getDimensionTypeName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -21,8 +21,11 @@
|
|||||||
*/
|
*/
|
||||||
package it.geosolutions.geoserver.decoder;
|
package it.geosolutions.geoserver.decoder;
|
||||||
|
|
||||||
|
import it.geosolutions.geoserver.rest.GeoServerRESTPublisher;
|
||||||
|
import it.geosolutions.geoserver.rest.GeoServerRESTReader;
|
||||||
import it.geosolutions.geoserver.rest.GeoserverRESTTest;
|
import it.geosolutions.geoserver.rest.GeoserverRESTTest;
|
||||||
import it.geosolutions.geoserver.rest.decoder.about.GSVersionDecoder;
|
import it.geosolutions.geoserver.rest.decoder.about.GSVersionDecoder;
|
||||||
|
import it.geosolutions.geoserver.rest.decoder.about.GSVersionDecoder.VERSION;
|
||||||
import junit.framework.Assert;
|
import junit.framework.Assert;
|
||||||
|
|
||||||
import org.jdom.Element;
|
import org.jdom.Element;
|
||||||
|
|||||||
@ -64,7 +64,7 @@ public class ConfigTest extends GeoserverRESTTest {
|
|||||||
LOGGER.info("Existing styles: " + reader.getStyles().getNames());
|
LOGGER.info("Existing styles: " + reader.getStyles().getNames());
|
||||||
String basename = FilenameUtils.getBaseName(sldFile.toString());
|
String basename = FilenameUtils.getBaseName(sldFile.toString());
|
||||||
LOGGER.info("Publishing style " + sldFile + " as " + basename);
|
LOGGER.info("Publishing style " + sldFile + " as " + basename);
|
||||||
assertTrue("Could not publish " + sldFile, publisher.publishStyle(sldFile, basename));
|
assertTrue("Cound not publish " + sldFile, publisher.publishStyle(sldFile, basename));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -25,10 +25,12 @@
|
|||||||
package it.geosolutions.geoserver.rest;
|
package it.geosolutions.geoserver.rest;
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
import static org.junit.Assert.*;
|
||||||
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import it.geosolutions.geoserver.rest.decoder.RESTLayerGroup;
|
import it.geosolutions.geoserver.rest.decoder.RESTLayerGroup;
|
||||||
|
import it.geosolutions.geoserver.rest.decoder.utils.NameLinkElem;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
|||||||
@ -35,9 +35,6 @@ import it.geosolutions.geoserver.rest.decoder.utils.NameLinkElem;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
|
|
||||||
@ -47,8 +44,6 @@ import static org.junit.Assert.*;
|
|||||||
*/
|
*/
|
||||||
public class GeoserverRESTReaderTest extends GeoserverRESTTest {
|
public class GeoserverRESTReaderTest extends GeoserverRESTTest {
|
||||||
|
|
||||||
private final static Logger LOGGER = LoggerFactory.getLogger(GeoserverRESTReaderTest.class);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test of getLayers method, of class GeoServerRESTReader.
|
* Test of getLayers method, of class GeoServerRESTReader.
|
||||||
*/
|
*/
|
||||||
@ -61,16 +56,16 @@ public class GeoserverRESTReaderTest extends GeoserverRESTTest {
|
|||||||
// assertEquals(/*CHANGEME*/19, result.getChildren("layer").size()); // value in default gs installation
|
// assertEquals(/*CHANGEME*/19, result.getChildren("layer").size()); // value in default gs installation
|
||||||
|
|
||||||
// System.out.println("Layers:" + result.getChildren("layer").size());
|
// System.out.println("Layers:" + result.getChildren("layer").size());
|
||||||
LOGGER.debug("Layers: " + result.size());
|
System.out.println("Layers:" + result.size());
|
||||||
// LOGGER.debug("Layers:" );
|
System.out.print("Layers:" );
|
||||||
for (NameLinkElem shlayer : result) {
|
for (NameLinkElem shlayer : result) {
|
||||||
assertNotNull(shlayer.getName());
|
assertNotNull(shlayer.getName());
|
||||||
LOGGER.debug(shlayer.getName() + " ");
|
System.out.print(shlayer.getName() + " ");
|
||||||
}
|
}
|
||||||
// for (Element layer : (List<Element>)result.getChildren("layer")) {
|
// for (Element layer : (List<Element>)result.getChildren("layer")) {
|
||||||
// System.out.print(layer.getChildText("name") + " ");
|
// System.out.print(layer.getChildText("name") + " ");
|
||||||
// }
|
// }
|
||||||
LOGGER.debug("");
|
System.out.println();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -84,25 +79,25 @@ public class GeoserverRESTReaderTest extends GeoserverRESTTest {
|
|||||||
assertNotNull(wslist);
|
assertNotNull(wslist);
|
||||||
// assertEquals(7, wslist.size()); // value in default gs installation
|
// assertEquals(7, wslist.size()); // value in default gs installation
|
||||||
|
|
||||||
LOGGER.debug("Workspaces: " + wslist.size());
|
System.out.println("Workspaces: " + wslist.size());
|
||||||
int dsnum = 0;
|
int dsnum = 0;
|
||||||
for (RESTWorkspaceList.RESTShortWorkspace ws : wslist) {
|
for (RESTWorkspaceList.RESTShortWorkspace ws : wslist) {
|
||||||
LOGGER.debug("Getting DSlist for WS " + ws.getName() + "..." );
|
System.out.println("Getting DSlist for WS " + ws.getName() + "..." );
|
||||||
RESTDataStoreList result = reader.getDatastores(ws.getName());
|
RESTDataStoreList result = reader.getDatastores(ws.getName());
|
||||||
assertNotNull(result);
|
assertNotNull(result);
|
||||||
dsnum += result.size();
|
dsnum += result.size();
|
||||||
for (NameLinkElem ds : result) {
|
for (NameLinkElem ds : result) {
|
||||||
assertNotNull(ds.getName());
|
assertNotNull(ds.getName());
|
||||||
LOGGER.debug(ds.getName() + " " );
|
System.out.print(ds.getName() + " " );
|
||||||
RESTDataStore datastore = reader.getDatastore(ws.getName(), ds.getName());
|
RESTDataStore datastore = reader.getDatastore(ws.getName(), ds.getName());
|
||||||
assertNotNull(datastore);
|
assertNotNull(datastore);
|
||||||
assertEquals(ds.getName(), datastore.getName());
|
assertEquals(ds.getName(), datastore.getName());
|
||||||
assertEquals(ws.getName(), datastore.getWorkspaceName());
|
assertEquals(ws.getName(), datastore.getWorkspaceName());
|
||||||
}
|
}
|
||||||
LOGGER.debug("");
|
System.out.println();
|
||||||
}
|
}
|
||||||
LOGGER.debug("");
|
System.out.println();
|
||||||
LOGGER.debug("Datastores:" + dsnum); // value in default gs installation
|
System.out.println("Datastores:" + dsnum); // value in default gs installation
|
||||||
// assertEquals(4, dsnum); // value in default gs installation
|
// assertEquals(4, dsnum); // value in default gs installation
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -121,6 +116,7 @@ public class GeoserverRESTReaderTest extends GeoserverRESTTest {
|
|||||||
// assertEquals(7, wsnames.size()); // value in default gs installation
|
// assertEquals(7, wsnames.size()); // value in default gs installation
|
||||||
|
|
||||||
// System.out.println("Workspaces: " + wslist.size());
|
// System.out.println("Workspaces: " + wslist.size());
|
||||||
|
int dsnum = 0;
|
||||||
int wscnt = 0;
|
int wscnt = 0;
|
||||||
for (RESTWorkspaceList.RESTShortWorkspace ws : wslist) {
|
for (RESTWorkspaceList.RESTShortWorkspace ws : wslist) {
|
||||||
String wsname = wsnames.get(wscnt++);
|
String wsname = wsnames.get(wscnt++);
|
||||||
@ -162,14 +158,14 @@ public class GeoserverRESTReaderTest extends GeoserverRESTTest {
|
|||||||
assertNotNull(names);
|
assertNotNull(names);
|
||||||
assertEquals(names.size(), result.size()); // value in default gs installation
|
assertEquals(names.size(), result.size()); // value in default gs installation
|
||||||
|
|
||||||
LOGGER.debug("Namespaces:" + result.size());
|
System.out.println("Namespaces:" + result.size());
|
||||||
LOGGER.debug("Namespaces:" );
|
System.out.print("Namespaces:" );
|
||||||
int namesIdx = 0;
|
int namesIdx = 0;
|
||||||
for (RESTNamespaceList.RESTShortNamespace ns : result) {
|
for (RESTNamespaceList.RESTShortNamespace ns : result) {
|
||||||
assertEquals("namespace mismatch", names.get(namesIdx++), ns.getName());
|
assertEquals("namespace mismatch", names.get(namesIdx++), ns.getName());
|
||||||
LOGGER.debug(ns.getName() + " " );
|
System.out.print(ns.getName() + " " );
|
||||||
}
|
}
|
||||||
LOGGER.debug("");
|
System.out.println();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -183,12 +179,12 @@ public class GeoserverRESTReaderTest extends GeoserverRESTTest {
|
|||||||
assertNotNull(names);
|
assertNotNull(names);
|
||||||
// assertEquals(7, names.size()); // value in default gs installation
|
// assertEquals(7, names.size()); // value in default gs installation
|
||||||
|
|
||||||
LOGGER.debug("Namespaces:" + names.size());
|
System.out.println("Namespaces:" + names.size());
|
||||||
LOGGER.debug("Namespaces:");
|
System.out.print("Namespaces:");
|
||||||
for (String name : names) {
|
for (String name : names) {
|
||||||
LOGGER.debug(name + " ");
|
System.out.print(name + " ");
|
||||||
}
|
}
|
||||||
LOGGER.debug("");
|
System.out.println();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -202,12 +198,12 @@ public class GeoserverRESTReaderTest extends GeoserverRESTTest {
|
|||||||
assertNotNull(wslist);
|
assertNotNull(wslist);
|
||||||
// assertEquals(7, wslist.size()); // value in default gs installation
|
// assertEquals(7, wslist.size()); // value in default gs installation
|
||||||
|
|
||||||
LOGGER.debug("Workspaces:" + wslist.size());
|
System.out.println("Workspaces:" + wslist.size());
|
||||||
LOGGER.debug("Workspaces:");
|
System.out.print("Workspaces:");
|
||||||
for (RESTWorkspaceList.RESTShortWorkspace ws : wslist) {
|
for (RESTWorkspaceList.RESTShortWorkspace ws : wslist) {
|
||||||
LOGGER.debug(ws.getName() + " ");
|
System.out.print(ws.getName() + " ");
|
||||||
}
|
}
|
||||||
LOGGER.debug("");
|
System.out.println();
|
||||||
|
|
||||||
assertEquals(wslist.size(), reader.getWorkspaceNames().size());
|
assertEquals(wslist.size(), reader.getWorkspaceNames().size());
|
||||||
}
|
}
|
||||||
@ -222,12 +218,12 @@ public class GeoserverRESTReaderTest extends GeoserverRESTTest {
|
|||||||
assertNotNull(names);
|
assertNotNull(names);
|
||||||
// assertEquals(7, names.size()); // value in default gs installation
|
// assertEquals(7, names.size()); // value in default gs installation
|
||||||
|
|
||||||
LOGGER.debug("Workspaces:" + names.size());
|
System.out.println("Workspaces:" + names.size());
|
||||||
LOGGER.debug("Workspaces:");
|
System.out.print("Workspaces:");
|
||||||
for (String name : names) {
|
for (String name : names) {
|
||||||
LOGGER.debug(name + " ");
|
System.out.print(name + " ");
|
||||||
}
|
}
|
||||||
LOGGER.debug("");
|
System.out.println();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* GeoServer-Manager - Simple Manager Library for GeoServer
|
* GeoServer-Manager - Simple Manager Library for GeoServer
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007 - 2016 GeoSolutions S.A.S.
|
* Copyright (C) 2007,2011 GeoSolutions S.A.S.
|
||||||
* http://www.geo-solutions.it
|
* http://www.geo-solutions.it
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
@ -41,6 +41,7 @@ import java.util.List;
|
|||||||
|
|
||||||
import static org.junit.Assert.*;
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
|
import org.jdom.output.EscapeStrategy;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.BeforeClass;
|
import org.junit.BeforeClass;
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
@ -97,7 +98,7 @@ public abstract class GeoserverRESTTest {
|
|||||||
RESTURL = getenv("gsmgr_resturl", "http://localhost:8080/geoserver");
|
RESTURL = getenv("gsmgr_resturl", "http://localhost:8080/geoserver");
|
||||||
RESTUSER = getenv("gsmgr_restuser", "admin");
|
RESTUSER = getenv("gsmgr_restuser", "admin");
|
||||||
RESTPW = getenv("gsmgr_restpw", "geoserver");
|
RESTPW = getenv("gsmgr_restpw", "geoserver");
|
||||||
GS_VERSION = getenv("gsmgr_version", "2.8");
|
GS_VERSION = getenv("gsmgr_version", "2.4");
|
||||||
|
|
||||||
// These tests will destroy data, so let's make sure we do want to run them
|
// These tests will destroy data, so let's make sure we do want to run them
|
||||||
enabled = getenv("gsmgr_resttest", "false").equalsIgnoreCase("true");
|
enabled = getenv("gsmgr_resttest", "false").equalsIgnoreCase("true");
|
||||||
@ -135,17 +136,17 @@ public abstract class GeoserverRESTTest {
|
|||||||
+ RESTURL);
|
+ RESTURL);
|
||||||
}
|
}
|
||||||
} else if (existgs == false){
|
} else if (existgs == false){
|
||||||
LOGGER.debug("Failing tests : geoserver not found");
|
System.out.println("Failing tests : geoserver not found");
|
||||||
fail("GeoServer not found");
|
fail("GeoServer not found");
|
||||||
}
|
}
|
||||||
|
|
||||||
GSVersionDecoder v=reader.getGeoserverVersion();
|
GSVersionDecoder v=reader.getGeoserverVersion();
|
||||||
if (v.compareTo(VERSION.getVersion(GS_VERSION))!=0){
|
if (v.compareTo(VERSION.getVersion(GS_VERSION))!=0){
|
||||||
LOGGER.debug("Failing tests : geoserver version does not match.\nAccepted versions: "+VERSION.print());
|
System.out.println("Failing tests : geoserver version does not match.\nAccepted versions: "+VERSION.print());
|
||||||
fail("GeoServer version ("+v.getVersion()+") does not match the desired one ("+GS_VERSION+")");
|
fail("GeoServer version ("+v.getVersion()+") does not match the desired one ("+GS_VERSION+")");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
LOGGER.debug("Skipping tests ");
|
System.out.println("Skipping tests ");
|
||||||
LOGGER.warn("Tests are disabled. Please read the documentation to enable them.");
|
LOGGER.warn("Tests are disabled. Please read the documentation to enable them.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* GeoServer-Manager - Simple Manager Library for GeoServer
|
* GeoServer-Manager - Simple Manager Library for GeoServer
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007 - 2016 GeoSolutions S.A.S.
|
* Copyright (C) 2007,2013 GeoSolutions S.A.S.
|
||||||
* http://www.geo-solutions.it
|
* http://www.geo-solutions.it
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
@ -22,17 +22,20 @@
|
|||||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
* THE SOFTWARE.
|
* THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package it.geosolutions.geoserver.rest;
|
package it.geosolutions.geoserver.rest;
|
||||||
|
|
||||||
|
import static it.geosolutions.geoserver.rest.GeoserverRESTTest.publisher;
|
||||||
|
import static it.geosolutions.geoserver.rest.GeoserverRESTTest.reader;
|
||||||
import it.geosolutions.geoserver.rest.decoder.RESTStyle;
|
import it.geosolutions.geoserver.rest.decoder.RESTStyle;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.List;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
import static org.junit.Assert.*;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
|
||||||
import org.springframework.core.io.ClassPathResource;
|
import org.springframework.core.io.ClassPathResource;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -41,66 +44,52 @@ import org.springframework.core.io.ClassPathResource;
|
|||||||
*/
|
*/
|
||||||
public class UtilTest extends GeoserverRESTTest {
|
public class UtilTest extends GeoserverRESTTest {
|
||||||
|
|
||||||
private final static Logger LOGGER = LoggerFactory.getLogger(UtilTest.class);
|
private final static Logger LOGGER = LoggerFactory.getLogger(UtilTest.class);
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testSearchStyle() throws IOException {
|
@Test
|
||||||
if (!enabled()) {
|
public void testSearchStyle() throws IOException {
|
||||||
return;
|
if (!enabled())
|
||||||
}
|
return;
|
||||||
deleteAll();
|
deleteAll();
|
||||||
|
|
||||||
final String WORKSPACE = "testWorkspace";
|
final String WORKSPACE = "testWorkspace";
|
||||||
final String STYLENAME = "restteststyle";
|
final String STYLENAME = "restteststyle";
|
||||||
|
|
||||||
File sldFile = new ClassPathResource("testdata/restteststyle.sld").getFile();
|
File sldFile = new ClassPathResource("testdata/restteststyle.sld").getFile();
|
||||||
|
|
||||||
publisher.createWorkspace(WORKSPACE);
|
publisher.createWorkspace(WORKSPACE);
|
||||||
|
|
||||||
assertEquals(0, reader.getStyles().size());
|
assertEquals(0, reader.getStyles().size());
|
||||||
assertEquals(0, reader.getStyles(WORKSPACE).size());
|
assertEquals(0, reader.getStyles(WORKSPACE).size());
|
||||||
assertEquals(0, Util.searchStyles(reader, STYLENAME).size());
|
assertEquals(0, Util.searchStyles(reader, STYLENAME).size());
|
||||||
|
|
||||||
// insert style in workspace
|
// insert style in workspace
|
||||||
assertTrue(publisher.publishStyleInWorkspace(WORKSPACE, sldFile, STYLENAME));
|
assertTrue(publisher.publishStyleInWorkspace(WORKSPACE, sldFile, STYLENAME));
|
||||||
assertTrue(reader.existsStyle(WORKSPACE, STYLENAME));
|
assertTrue(reader.existsStyle(WORKSPACE, STYLENAME));
|
||||||
|
assertFalse(reader.existsStyle(STYLENAME));
|
||||||
// GeoServer returns workspace specific names if hte name is not found as global
|
assertEquals(0, reader.getStyles().size());
|
||||||
assertTrue(reader.existsStyle(STYLENAME));
|
assertEquals(1, reader.getStyles(WORKSPACE).size());
|
||||||
|
|
||||||
assertEquals(0, reader.getStyles().size());
|
|
||||||
assertEquals(1, reader.getStyles(WORKSPACE).size());
|
|
||||||
assertEquals(1, Util.searchStyles(reader, STYLENAME).size());
|
assertEquals(1, Util.searchStyles(reader, STYLENAME).size());
|
||||||
|
|
||||||
// insert global style
|
// insert global style
|
||||||
assertTrue(publisher.publishStyle(sldFile, STYLENAME));
|
assertTrue(publisher.publishStyle(sldFile, STYLENAME));
|
||||||
|
|
||||||
assertTrue(reader.existsStyle(STYLENAME));
|
assertTrue(reader.existsStyle(STYLENAME));
|
||||||
assertTrue(reader.existsStyle(WORKSPACE, STYLENAME));
|
assertTrue(reader.existsStyle(WORKSPACE, STYLENAME));
|
||||||
|
|
||||||
for(RESTStyle style : Util.searchStyles(reader, STYLENAME))
|
assertEquals(2, Util.searchStyles(reader, STYLENAME).size());
|
||||||
{
|
|
||||||
LOGGER.debug(style.getWorkspace() + " :: " + style.getName());
|
|
||||||
}
|
|
||||||
|
|
||||||
// there's a bug in geoserver here: the global style will include workspace info
|
assertEquals(1, reader.getStyles().size());
|
||||||
// https://osgeo-org.atlassian.net/browse/GEOS-7498
|
assertEquals(1, reader.getStyles(WORKSPACE).size());
|
||||||
// Commenting out all the concerned test code
|
|
||||||
|
|
||||||
// assertEquals(2, Util.searchStyles(reader, STYLENAME).size());
|
List<RESTStyle> styles = Util.searchStyles(reader, STYLENAME);
|
||||||
//
|
|
||||||
// assertEquals(1, reader.getStyles().size());
|
assertEquals(STYLENAME, styles.get(0).getName());
|
||||||
// assertEquals(1, reader.getStyles(WORKSPACE).size());
|
assertEquals(null, styles.get(0).getWorkspace()); // first one is the global one, if any
|
||||||
//
|
|
||||||
// List<RESTStyle> styles = Util.searchStyles(reader, STYLENAME);
|
assertEquals(STYLENAME, styles.get(1).getName());
|
||||||
//
|
assertEquals(WORKSPACE, styles.get(1).getWorkspace());
|
||||||
// assertEquals(STYLENAME, styles.get(0).getName());
|
}
|
||||||
//
|
|
||||||
//
|
|
||||||
// // assertEquals(null, styles.get(0).getWorkspace()); // first one is the global one, if any
|
|
||||||
//
|
|
||||||
// assertEquals(STYLENAME, styles.get(1).getName());
|
|
||||||
// assertEquals(WORKSPACE, styles.get(1).getWorkspace());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2007-2016 GeoSolutions S.A.S.
|
* Copyright (C) 2007 - 2011 GeoSolutions S.A.S.
|
||||||
* http://www.geo-solutions.it
|
* http://www.geo-solutions.it
|
||||||
*
|
*
|
||||||
* GPLv3 + Classpath exception
|
* GPLv3 + Classpath exception
|
||||||
@ -19,6 +19,7 @@
|
|||||||
*/
|
*/
|
||||||
package it.geosolutions.geoserver.rest.encoder;
|
package it.geosolutions.geoserver.rest.encoder;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import it.geosolutions.geoserver.rest.encoder.authorityurl.AuthorityURLInfo;
|
import it.geosolutions.geoserver.rest.encoder.authorityurl.AuthorityURLInfo;
|
||||||
@ -45,21 +46,16 @@ public class GSLayerEncoder21Test {
|
|||||||
public void setup() {
|
public void setup() {
|
||||||
layerEncoder = new GSLayerEncoder21();
|
layerEncoder = new GSLayerEncoder21();
|
||||||
layerEncoder.setAdvertised(true);
|
layerEncoder.setAdvertised(true);
|
||||||
layerEncoder.addAuthorityURL(
|
layerEncoder.addAuthorityURL(new GSAuthorityURLInfoEncoder(
|
||||||
new GSAuthorityURLInfoEncoder(
|
|
||||||
"authority1", "http://www.authority1.org"));
|
"authority1", "http://www.authority1.org"));
|
||||||
layerEncoder.addIdentifier(
|
layerEncoder.addIdentifier(new GSIdentifierInfoEncoder("authority1",
|
||||||
new GSIdentifierInfoEncoder(
|
"identifier1"));
|
||||||
"authority1", "identifier1"));
|
layerEncoder.addAuthorityURL(new GSAuthorityURLInfoEncoder(
|
||||||
layerEncoder.addAuthorityURL(
|
|
||||||
new GSAuthorityURLInfoEncoder(
|
|
||||||
"authority2", "http://www.authority2.org"));
|
"authority2", "http://www.authority2.org"));
|
||||||
layerEncoder.addIdentifier(
|
layerEncoder.addIdentifier(new GSIdentifierInfoEncoder("authority2",
|
||||||
new GSIdentifierInfoEncoder(
|
"identifier2"));
|
||||||
"authority2", "identifier2"));
|
layerEncoder.addIdentifier(new GSIdentifierInfoEncoder("authority2",
|
||||||
layerEncoder.addIdentifier(
|
"additionalId"));
|
||||||
new GSIdentifierInfoEncoder(
|
|
||||||
"authority2", "additionalId"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -101,33 +97,34 @@ public class GSLayerEncoder21Test {
|
|||||||
}else if(key.matches("identifiers")){
|
}else if(key.matches("identifiers")){
|
||||||
String jsonStr = el.getValue();
|
String jsonStr = el.getValue();
|
||||||
jsonStr = jsonStr.substring(2);
|
jsonStr = jsonStr.substring(2);
|
||||||
jsonStr = jsonStr.substring(0, jsonStr.length() - 3);
|
jsonStr = jsonStr.substring(0,
|
||||||
|
jsonStr.length() - 3);
|
||||||
|
|
||||||
String[] items = jsonStr.split("\\}(,)\\{");
|
String[] items = jsonStr.split("\\}(,)\\{");
|
||||||
|
|
||||||
String[] props1 = items[0].split(",");
|
String[] props1 = items[0].split(",");
|
||||||
String[] kvp1_1 = props1[0].split("\":");
|
String[] kvp1_1 = props1[0].split("\":");
|
||||||
String[] kvp1_2 = props1[1].split("\":");
|
String[] kvp1_2 = props1[1].split("\":");
|
||||||
Assert.assertEquals("idx0", IdentifierInfo.authority.name(), kvp1_1[0].replace("\"", ""));
|
Assert.assertEquals(IdentifierInfo.authority.name(), kvp1_1[0].replace("\"", ""));
|
||||||
Assert.assertEquals("idx0", "authority1", kvp1_1[1].replace("\"", ""));
|
Assert.assertEquals("authority2", kvp1_1[1].replace("\"", ""));
|
||||||
Assert.assertEquals("idx0", IdentifierInfo.identifier.name(), kvp1_2[0].replace("\"", ""));
|
Assert.assertEquals(IdentifierInfo.identifier.name(), kvp1_2[0].replace("\"", ""));
|
||||||
Assert.assertEquals("idx0", "identifier1", kvp1_2[1].replace("\"", ""));
|
Assert.assertEquals("identifier2", kvp1_2[1].replace("\"", ""));
|
||||||
|
|
||||||
String[] props2 = items[1].split(",");
|
String[] props2 = items[1].split(",");
|
||||||
String[] kvp2_1 = props2[0].split("\":");
|
String[] kvp2_1 = props2[0].split("\":");
|
||||||
String[] kvp2_2 = props2[1].split("\":");
|
String[] kvp2_2 = props2[1].split("\":");
|
||||||
Assert.assertEquals("idx1", IdentifierInfo.authority.name(), kvp2_1[0].replace("\"", ""));
|
Assert.assertEquals(IdentifierInfo.authority.name(), kvp2_1[0].replace("\"", ""));
|
||||||
Assert.assertEquals("idx1", "authority2", kvp2_1[1].replace("\"", ""));
|
Assert.assertEquals("authority2", kvp2_1[1].replace("\"", ""));
|
||||||
Assert.assertEquals("idx1", IdentifierInfo.identifier.name(), kvp2_2[0].replace("\"", ""));
|
Assert.assertEquals(IdentifierInfo.identifier.name(), kvp2_2[0].replace("\"", ""));
|
||||||
Assert.assertEquals("idx1", "identifier2", kvp2_2[1].replace("\"", ""));
|
Assert.assertEquals("additionalId", kvp2_2[1].replace("\"", ""));
|
||||||
|
|
||||||
String[] props3 = items[2].split(",");
|
String[] props3 = items[2].split(",");
|
||||||
String[] kvp3_1 = props3[0].split("\":");
|
String[] kvp3_1 = props3[0].split("\":");
|
||||||
String[] kvp3_2 = props3[1].split("\":");
|
String[] kvp3_2 = props3[1].split("\":");
|
||||||
Assert.assertEquals("idx2", IdentifierInfo.authority.name(), kvp3_1[0].replace("\"", ""));
|
Assert.assertEquals(IdentifierInfo.authority.name(), kvp3_1[0].replace("\"", ""));
|
||||||
Assert.assertEquals("idx2", "authority2", kvp3_1[1].replace("\"", ""));
|
Assert.assertEquals("authority1", kvp3_1[1].replace("\"", ""));
|
||||||
Assert.assertEquals("idx2", IdentifierInfo.identifier.name(), kvp3_2[0].replace("\"", ""));
|
Assert.assertEquals(IdentifierInfo.identifier.name(), kvp3_2[0].replace("\"", ""));
|
||||||
Assert.assertEquals("idx2", "additionalId", kvp3_2[1].replace("\"", ""));
|
Assert.assertEquals("identifier1", kvp3_2[1].replace("\"", ""));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -19,6 +19,8 @@
|
|||||||
*/
|
*/
|
||||||
package it.geosolutions.geoserver.rest.encoder.coverage;
|
package it.geosolutions.geoserver.rest.encoder.coverage;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
import static org.junit.Assert.assertNotNull;
|
||||||
import it.geosolutions.geoserver.rest.encoder.GSResourceEncoder;
|
import it.geosolutions.geoserver.rest.encoder.GSResourceEncoder;
|
||||||
import it.geosolutions.geoserver.rest.encoder.GSResourceEncoder.ProjectionPolicy;
|
import it.geosolutions.geoserver.rest.encoder.GSResourceEncoder.ProjectionPolicy;
|
||||||
import it.geosolutions.geoserver.rest.encoder.dimensions.GSCoverageDimensionEncoder;
|
import it.geosolutions.geoserver.rest.encoder.dimensions.GSCoverageDimensionEncoder;
|
||||||
@ -126,7 +128,7 @@ public class GSCoverageEncoderTest extends TestCase {
|
|||||||
// setting dimensions (since gs-2.4.x)
|
// setting dimensions (since gs-2.4.x)
|
||||||
GSCoverageDimensionEncoder gsCoverageDimensionEncoder = new GSCoverageDimensionEncoder(
|
GSCoverageDimensionEncoder gsCoverageDimensionEncoder = new GSCoverageDimensionEncoder(
|
||||||
"GRAY_INDEX", "GridSampleDimension[-Infinity,Infinity]", "-inf", "inf",
|
"GRAY_INDEX", "GridSampleDimension[-Infinity,Infinity]", "-inf", "inf",
|
||||||
"dobson units", "REAL_32BITS");
|
"dobson units³", "REAL_32BITS");
|
||||||
encoder.addCoverageDimensionInfo(gsCoverageDimensionEncoder);
|
encoder.addCoverageDimensionInfo(gsCoverageDimensionEncoder);
|
||||||
|
|
||||||
encoder.setNativeCoverageName("Sample native name");
|
encoder.setNativeCoverageName("Sample native name");
|
||||||
|
|||||||
@ -19,6 +19,12 @@
|
|||||||
*/
|
*/
|
||||||
package it.geosolutions.geoserver.rest.encoder.dimensions;
|
package it.geosolutions.geoserver.rest.encoder.dimensions;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertFalse;
|
||||||
|
import static org.junit.Assert.assertTrue;
|
||||||
|
import it.geosolutions.geoserver.rest.encoder.feature.GSFeatureTypeEncoder;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
import junit.framework.Assert;
|
import junit.framework.Assert;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
@ -33,14 +39,14 @@ public class GSCoverageDimensionEncoderTest {
|
|||||||
@Test
|
@Test
|
||||||
public void coverageDimensionTest() {
|
public void coverageDimensionTest() {
|
||||||
GSCoverageDimensionEncoder encoder = new GSCoverageDimensionEncoder("GRAY_INDEX",
|
GSCoverageDimensionEncoder encoder = new GSCoverageDimensionEncoder("GRAY_INDEX",
|
||||||
"GridSampleDimension[-Infinity,Infinity]", "-inf", "inf", "dobson units",
|
"GridSampleDimension[-Infinity,Infinity]", "-inf", "inf", "dobson units³",
|
||||||
"REAL_32BITS");
|
"REAL_32BITS");
|
||||||
|
|
||||||
Assert.assertEquals("GRAY_INDEX", encoder.getName());
|
Assert.assertEquals("GRAY_INDEX", encoder.getName());
|
||||||
Assert.assertEquals("GridSampleDimension[-Infinity,Infinity]", encoder.getDescription());
|
Assert.assertEquals("GridSampleDimension[-Infinity,Infinity]", encoder.getDescription());
|
||||||
Assert.assertEquals("-inf", encoder.getRangeMin());
|
Assert.assertEquals("-inf", encoder.getRangeMin());
|
||||||
Assert.assertEquals("inf", encoder.getRangeMax());
|
Assert.assertEquals("inf", encoder.getRangeMax());
|
||||||
Assert.assertEquals("dobson units", encoder.getUnit());
|
Assert.assertEquals("dobson units³", encoder.getUnit());
|
||||||
Assert.assertEquals("REAL_32BITS", encoder.getDimensionTypeName());
|
Assert.assertEquals("REAL_32BITS", encoder.getDimensionTypeName());
|
||||||
|
|
||||||
Assert.assertTrue(encoder.delName());
|
Assert.assertTrue(encoder.delName());
|
||||||
@ -59,15 +65,15 @@ public class GSCoverageDimensionEncoderTest {
|
|||||||
encoder.setName("GRAY_INDEX");
|
encoder.setName("GRAY_INDEX");
|
||||||
encoder.setDescription("GridSampleDimension[-Infinity,Infinity]");
|
encoder.setDescription("GridSampleDimension[-Infinity,Infinity]");
|
||||||
encoder.setRange("-inf", "inf");
|
encoder.setRange("-inf", "inf");
|
||||||
encoder.setUnit("dobson units");
|
encoder.setUnit("dobson units³");
|
||||||
encoder.setDimensionType("REAL_32BITS");
|
encoder.setDimensionType("REAL_32BITS");
|
||||||
|
|
||||||
Assert.assertEquals("GRAY_INDEX", encoder.getName());
|
Assert.assertEquals("GRAY_INDEX", encoder.getName());
|
||||||
Assert.assertEquals("GridSampleDimension[-Infinity,Infinity]", encoder.getDescription());
|
Assert.assertEquals("GridSampleDimension[-Infinity,Infinity]", encoder.getDescription());
|
||||||
Assert.assertEquals("-inf", encoder.getRangeMin());
|
Assert.assertEquals("-inf", encoder.getRangeMin());
|
||||||
Assert.assertEquals("inf", encoder.getRangeMax());
|
Assert.assertEquals("inf", encoder.getRangeMax());
|
||||||
Assert.assertEquals("dobson units", encoder.getUnit());
|
Assert.assertEquals("dobson units³", encoder.getUnit());
|
||||||
Assert.assertEquals("REAL_32BITS", encoder.getDimensionTypeName());
|
Assert.assertEquals("REAL_32BITS", encoder.getDimensionTypeName());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -23,11 +23,14 @@ import it.geosolutions.geoserver.rest.GeoServerRESTPublisher;
|
|||||||
import it.geosolutions.geoserver.rest.GeoserverRESTTest;
|
import it.geosolutions.geoserver.rest.GeoserverRESTTest;
|
||||||
import it.geosolutions.geoserver.rest.decoder.RESTFeatureType;
|
import it.geosolutions.geoserver.rest.decoder.RESTFeatureType;
|
||||||
import it.geosolutions.geoserver.rest.decoder.RESTLayer;
|
import it.geosolutions.geoserver.rest.decoder.RESTLayer;
|
||||||
|
import it.geosolutions.geoserver.rest.decoder.RESTResource;
|
||||||
|
import it.geosolutions.geoserver.rest.decoder.about.GSVersionDecoder;
|
||||||
import it.geosolutions.geoserver.rest.decoder.about.GSVersionDecoder.VERSION;
|
import it.geosolutions.geoserver.rest.decoder.about.GSVersionDecoder.VERSION;
|
||||||
import it.geosolutions.geoserver.rest.encoder.GSLayerEncoder;
|
import it.geosolutions.geoserver.rest.encoder.GSLayerEncoder;
|
||||||
import it.geosolutions.geoserver.rest.encoder.GSLayerEncoder21;
|
import it.geosolutions.geoserver.rest.encoder.GSLayerEncoder21;
|
||||||
import it.geosolutions.geoserver.rest.encoder.GSResourceEncoder;
|
import it.geosolutions.geoserver.rest.encoder.GSResourceEncoder;
|
||||||
import it.geosolutions.geoserver.rest.encoder.authorityurl.GSAuthorityURLInfoEncoder;
|
import it.geosolutions.geoserver.rest.encoder.authorityurl.GSAuthorityURLInfoEncoder;
|
||||||
|
import it.geosolutions.geoserver.rest.encoder.dimensions.GSCoverageDimensionEncoder;
|
||||||
import it.geosolutions.geoserver.rest.encoder.identifier.GSIdentifierInfoEncoder;
|
import it.geosolutions.geoserver.rest.encoder.identifier.GSIdentifierInfoEncoder;
|
||||||
import it.geosolutions.geoserver.rest.encoder.metadata.GSDimensionInfoEncoder;
|
import it.geosolutions.geoserver.rest.encoder.metadata.GSDimensionInfoEncoder;
|
||||||
import it.geosolutions.geoserver.rest.encoder.metadata.GSDimensionInfoEncoder.Presentation;
|
import it.geosolutions.geoserver.rest.encoder.metadata.GSDimensionInfoEncoder.Presentation;
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* GeoServer-Manager - Simple Manager Library for GeoServer
|
* GeoServer-Manager - Simple Manager Library for GeoServer
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007 - 2016 GeoSolutions S.A.S.
|
* Copyright (C) 2007,2012 GeoSolutions S.A.S.
|
||||||
* http://www.geo-solutions.it
|
* http://www.geo-solutions.it
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
@ -37,7 +37,6 @@ import java.util.Map;
|
|||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import static org.junit.Assert.*;
|
import static org.junit.Assert.*;
|
||||||
import org.junit.Ignore;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test datastore handling (create, read and update):
|
* Test datastore handling (create, read and update):
|
||||||
@ -64,12 +63,10 @@ import org.junit.Ignore;
|
|||||||
* <li>Read again.
|
* <li>Read again.
|
||||||
* <li>Test all new values.
|
* <li>Test all new values.
|
||||||
* </ol>
|
* </ol>
|
||||||
*
|
*
|
||||||
* @deprecated ignored since dir of shapes cannot be uploaded
|
|
||||||
* @author Oscar Fonts
|
* @author Oscar Fonts
|
||||||
*/
|
*/
|
||||||
@Ignore
|
public class GeoserverRESTDatastoreManagerTest extends StoreIntegrationTest {
|
||||||
public class DirShapeStoreManagerTest extends StoreIntegrationTest {
|
|
||||||
|
|
||||||
private static final String WS_NAME = DEFAULT_WS;
|
private static final String WS_NAME = DEFAULT_WS;
|
||||||
|
|
||||||
@ -81,7 +78,7 @@ public class DirShapeStoreManagerTest extends StoreIntegrationTest {
|
|||||||
|
|
||||||
private static URL LOCATION_2;
|
private static URL LOCATION_2;
|
||||||
|
|
||||||
public DirShapeStoreManagerTest() throws Exception {
|
public GeoserverRESTDatastoreManagerTest() throws Exception {
|
||||||
super(false);
|
super(false);
|
||||||
LOCATION_1 = new URL("file:data/shapefiles/");
|
LOCATION_1 = new URL("file:data/shapefiles/");
|
||||||
LOCATION_2 = new URL("file:data/2");
|
LOCATION_2 = new URL("file:data/2");
|
||||||
@ -107,7 +104,7 @@ public class DirShapeStoreManagerTest extends StoreIntegrationTest {
|
|||||||
// Create a directory of spatial files with default parameters
|
// Create a directory of spatial files with default parameters
|
||||||
GSDirectoryOfShapefilesDatastoreEncoder create = new GSDirectoryOfShapefilesDatastoreEncoder(
|
GSDirectoryOfShapefilesDatastoreEncoder create = new GSDirectoryOfShapefilesDatastoreEncoder(
|
||||||
DS_NAME, LOCATION_1);
|
DS_NAME, LOCATION_1);
|
||||||
assertTrue("Could not create create store", manager.getStoreManager().create(WS_NAME, create));
|
assertTrue(manager.getStoreManager().create(WS_NAME, create));
|
||||||
|
|
||||||
// Read the store from server; check all parameter values
|
// Read the store from server; check all parameter values
|
||||||
RESTDataStore read = reader.getDatastore(WS_NAME, DS_NAME);
|
RESTDataStore read = reader.getDatastore(WS_NAME, DS_NAME);
|
||||||
@ -134,14 +131,14 @@ public class DirShapeStoreManagerTest extends StoreIntegrationTest {
|
|||||||
update.setCacheAndReuseMemoryMaps(false);
|
update.setCacheAndReuseMemoryMaps(false);
|
||||||
|
|
||||||
// update the store
|
// update the store
|
||||||
assertTrue("Could not update store " + WS_NAME, manager.getStoreManager().update(WS_NAME, update));
|
assertTrue(manager.getStoreManager().update(WS_NAME, update));
|
||||||
|
|
||||||
// Read again, check that all parameters have changed
|
// Read again, check that all parameters have changed
|
||||||
read = reader.getDatastore(WS_NAME, DS_NAME);
|
read = reader.getDatastore(WS_NAME, DS_NAME);
|
||||||
assertEquals("Bad workspace name", read.getWorkspaceName(), WS_NAME);
|
assertEquals(read.getWorkspaceName(), WS_NAME);
|
||||||
assertEquals("Datastore should not be enabled", read.isEnabled(), false);
|
assertEquals(read.isEnabled(), false);
|
||||||
connParams = read.getConnectionParameters();
|
connParams = read.getConnectionParameters();
|
||||||
assertEquals("Bad URL", connParams.get("url"), LOCATION_2.toString());
|
assertEquals(connParams.get("url"), LOCATION_2.toString());
|
||||||
assertEquals(connParams.get("charset"), "UTF-8");
|
assertEquals(connParams.get("charset"), "UTF-8");
|
||||||
assertEquals(connParams.get("create spatial index"), "false");
|
assertEquals(connParams.get("create spatial index"), "false");
|
||||||
assertEquals(connParams.get("memory mapped buffer"), "true");
|
assertEquals(connParams.get("memory mapped buffer"), "true");
|
||||||
@ -156,7 +156,7 @@ public class GeoserverRESTArcGridTest extends GeoserverRESTTest {
|
|||||||
assertTrue(reader.existsCoveragestore(DEFAULT_WS, storeName));
|
assertTrue(reader.existsCoveragestore(DEFAULT_WS, storeName));
|
||||||
assertTrue(reader.existsCoverage(DEFAULT_WS, storeName, storeName));
|
assertTrue(reader.existsCoverage(DEFAULT_WS, storeName, storeName));
|
||||||
RESTLayer layer = reader.getLayer(DEFAULT_WS, storeName);
|
RESTLayer layer = reader.getLayer(DEFAULT_WS, storeName);
|
||||||
assertEquals(DEFAULT_WS + ":mystyle", layer.getDefaultStyle());
|
assertEquals("mystyle", layer.getDefaultStyle());
|
||||||
assertEquals(DEFAULT_WS, layer.getDefaultStyleWorkspace());
|
assertEquals(DEFAULT_WS, layer.getDefaultStyleWorkspace());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -130,8 +130,7 @@ public class GeoserverRESTGeoTiffTest extends GeoserverRESTTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGeoTiffWithStyleInWorkspace() throws IOException
|
public void testGeoTiffWithStyleInWorkspace() throws IOException {
|
||||||
{
|
|
||||||
if (!enabled()) return;
|
if (!enabled()) return;
|
||||||
deleteAll();
|
deleteAll();
|
||||||
|
|
||||||
@ -156,11 +155,11 @@ public class GeoserverRESTGeoTiffTest extends GeoserverRESTTest {
|
|||||||
|
|
||||||
assertNotNull("publish() failed", pub);
|
assertNotNull("publish() failed", pub);
|
||||||
// Test exists
|
// Test exists
|
||||||
assertTrue("New coverage not found", reader.existsCoveragestore(DEFAULT_WS, storeName));
|
assertTrue(reader.existsCoveragestore(DEFAULT_WS, storeName));
|
||||||
assertTrue("New Store not found", reader.existsCoverage(DEFAULT_WS, storeName, storeName));
|
assertTrue(reader.existsCoverage(DEFAULT_WS, storeName, storeName));
|
||||||
RESTLayer layer = reader.getLayer(DEFAULT_WS, storeName);
|
RESTLayer layer = reader.getLayer(DEFAULT_WS, storeName);
|
||||||
assertEquals("Bad default style", DEFAULT_WS + ":mystyle", layer.getDefaultStyle());
|
assertEquals("mystyle", layer.getDefaultStyle());
|
||||||
assertEquals("Bad workspace for style", DEFAULT_WS, layer.getDefaultStyleWorkspace());
|
assertEquals(DEFAULT_WS, layer.getDefaultStyleWorkspace());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
@ -116,7 +116,7 @@ public class GeoserverRESTImageMosaicTest extends GeoserverRESTTest {
|
|||||||
if (v.compareTo(GSVersionDecoder.VERSION.v24)>=0){
|
if (v.compareTo(GSVersionDecoder.VERSION.v24)>=0){
|
||||||
GSCoverageDimensionEncoder gsCoverageDimensionEncoder = new GSCoverageDimensionEncoder(
|
GSCoverageDimensionEncoder gsCoverageDimensionEncoder = new GSCoverageDimensionEncoder(
|
||||||
"GRAY_INDEX", "GridSampleDimension[-Infinity,Infinity]", "-inf", "inf",
|
"GRAY_INDEX", "GridSampleDimension[-Infinity,Infinity]", "-inf", "inf",
|
||||||
"dobson units", "REAL_32BITS");
|
"dobson units³", "REAL_32BITS");
|
||||||
coverageEncoder.addCoverageDimensionInfo(gsCoverageDimensionEncoder);
|
coverageEncoder.addCoverageDimensionInfo(gsCoverageDimensionEncoder);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,97 +0,0 @@
|
|||||||
/*
|
|
||||||
* GeoServer-Manager - Simple Manager Library for GeoServer
|
|
||||||
*
|
|
||||||
* Copyright (C) 2007,2011 GeoSolutions S.A.S.
|
|
||||||
* http://www.geo-solutions.it
|
|
||||||
*
|
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
|
||||||
* in the Software without restriction, including without limitation the rights
|
|
||||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
* copies of the Software, and to permit persons to whom the Software is
|
|
||||||
* furnished to do so, subject to the following conditions:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice shall be included in
|
|
||||||
* all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
* THE SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package it.geosolutions.geoserver.rest.publisher;
|
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
|
||||||
import it.geosolutions.geoserver.rest.GeoserverRESTTest;
|
|
||||||
import net.sf.json.JSONObject;
|
|
||||||
|
|
||||||
import org.junit.After;
|
|
||||||
import org.junit.Test;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
import org.springframework.core.io.ClassPathResource;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Testcase for publishing layers on geoserver.
|
|
||||||
* We need a running GeoServer to properly run the tests.
|
|
||||||
* If such geoserver instance cannot be contacted, tests will be skipped.
|
|
||||||
*
|
|
||||||
* @author Alessio Fabiani, GeoSolutions S.A.S.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class GeoserverRESTImporterTest extends GeoserverRESTTest {
|
|
||||||
|
|
||||||
private final static Logger LOGGER = LoggerFactory.getLogger(GeoserverRESTImporterTest.class);
|
|
||||||
|
|
||||||
@After
|
|
||||||
public void cleanUp() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testShapeFileImport() throws Exception {
|
|
||||||
if (!enabled())
|
|
||||||
return;
|
|
||||||
|
|
||||||
// Creates a new Importer Context and gets back the ID
|
|
||||||
int i = publisher.postNewImport();
|
|
||||||
|
|
||||||
// Attaches to the new Importer Context a Task pointing to a shapefile's zip archive
|
|
||||||
String data = new ClassPathResource("testdata/test_noepsg.zip").getFile().getAbsolutePath();
|
|
||||||
int t = publisher.postNewTaskAsMultiPartForm(i, data);
|
|
||||||
|
|
||||||
// Check that the Task was actually created and that the CRS has not recognized in this case
|
|
||||||
JSONObject task = publisher.getTask(i, t);
|
|
||||||
//assertEquals("NO_CRS", task.getString("state"));
|
|
||||||
assertEquals("READY", task.getString("state"));
|
|
||||||
|
|
||||||
// Prepare the JSON String instructing the Task about the SRS to use
|
|
||||||
String json = "{\"layer\":{\"srs\":\"EPSG:26713\"}}";
|
|
||||||
|
|
||||||
// Performing the Task update
|
|
||||||
publisher.putTaskLayer(i, t, json);
|
|
||||||
|
|
||||||
// Double check that the Task is in the READY state
|
|
||||||
task = publisher.getTask(i, t);
|
|
||||||
assertEquals("READY", task.getString("state"));
|
|
||||||
assertEquals("nurc_10m_populated_places", task.getJSONObject("layer").getJSONObject("style").getString("name"));
|
|
||||||
|
|
||||||
// Prepare the JSON String instructing the Task avout the SLD to use for the new Layer
|
|
||||||
json = "{\"layer\":{\"style\":{\"name\": \"point\"}}}";
|
|
||||||
|
|
||||||
// Performing the Task update
|
|
||||||
publisher.putTaskLayer(i, t,json);
|
|
||||||
|
|
||||||
// Double check that the Task is in the READY state and that the Style has been correctly updated
|
|
||||||
task = publisher.getTask(i, t);
|
|
||||||
assertEquals("READY", task.getString("state"));
|
|
||||||
assertEquals("point", task.getJSONObject("layer").getJSONObject("style").getString("name"));
|
|
||||||
|
|
||||||
// Finally starts the Import ...
|
|
||||||
publisher.postImport(i);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -274,7 +274,7 @@ public class GeoserverRESTShapeTest extends GeoserverRESTTest {
|
|||||||
RESTLayer layer = reader.getLayer(layerName);
|
RESTLayer layer = reader.getLayer(layerName);
|
||||||
// RESTLayer layerDecoder = new RESTLayer(layer);
|
// RESTLayer layerDecoder = new RESTLayer(layer);
|
||||||
LOGGER.info("Layer style is " + layer.getDefaultStyle());
|
LOGGER.info("Layer style is " + layer.getDefaultStyle());
|
||||||
assertEquals("Style not assigned properly", DEFAULT_WS + ":" + styleName, layer.getDefaultStyle());
|
assertEquals("Style not assigned properly", styleName, layer.getDefaultStyle());
|
||||||
assertEquals("Style not assigned properly", DEFAULT_WS, layer.getDefaultStyleWorkspace());
|
assertEquals("Style not assigned properly", DEFAULT_WS, layer.getDefaultStyleWorkspace());
|
||||||
|
|
||||||
// remove also datastore
|
// remove also datastore
|
||||||
|
|||||||
@ -1,382 +1,380 @@
|
|||||||
/*
|
/*
|
||||||
* GeoServer-Manager - Simple Manager Library for GeoServer
|
* GeoServer-Manager - Simple Manager Library for GeoServer
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2016 GeoSolutions S.A.S.
|
* Copyright (C) 2007,2015 GeoSolutions S.A.S.
|
||||||
* http://www.geo-solutions.it
|
* http://www.geo-solutions.it
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
* in the Software without restriction, including without limitation the rights
|
* in the Software without restriction, including without limitation the rights
|
||||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
* copies of the Software, and to permit persons to whom the Software is
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
* furnished to do so, subject to the following conditions:
|
* furnished to do so, subject to the following conditions:
|
||||||
*
|
*
|
||||||
* The above copyright notice and this permission notice shall be included in
|
* The above copyright notice and this permission notice shall be included in
|
||||||
* all copies or substantial portions of the Software.
|
* all copies or substantial portions of the Software.
|
||||||
*
|
*
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
* THE SOFTWARE.
|
* THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package it.geosolutions.geoserver.rest.publisher;
|
package it.geosolutions.geoserver.rest.publisher;
|
||||||
|
|
||||||
import it.geosolutions.geoserver.rest.GeoserverRESTTest;
|
import it.geosolutions.geoserver.rest.GeoserverRESTTest;
|
||||||
import it.geosolutions.geoserver.rest.decoder.RESTLayer;
|
import static it.geosolutions.geoserver.rest.GeoserverRESTTest.publisher;
|
||||||
import it.geosolutions.geoserver.rest.decoder.RESTStyle;
|
import static it.geosolutions.geoserver.rest.GeoserverRESTTest.reader;
|
||||||
import it.geosolutions.geoserver.rest.decoder.utils.JDOMBuilder;
|
import it.geosolutions.geoserver.rest.decoder.RESTLayer;
|
||||||
import it.geosolutions.geoserver.rest.encoder.GSLayerEncoder;
|
import it.geosolutions.geoserver.rest.decoder.RESTStyle;
|
||||||
|
import it.geosolutions.geoserver.rest.decoder.utils.JDOMBuilder;
|
||||||
import java.io.File;
|
import it.geosolutions.geoserver.rest.encoder.GSLayerEncoder;
|
||||||
import java.io.FileInputStream;
|
|
||||||
import java.io.FileNotFoundException;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.FileInputStream;
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
import org.apache.commons.io.IOUtils;
|
import java.io.IOException;
|
||||||
import org.jdom.Element;
|
|
||||||
import org.jdom.Namespace;
|
import org.apache.commons.io.IOUtils;
|
||||||
import org.junit.Test;
|
import org.jdom.Element;
|
||||||
import static org.junit.Assert.*;
|
import org.jdom.Namespace;
|
||||||
import org.slf4j.Logger;
|
import org.junit.Test;
|
||||||
import org.slf4j.LoggerFactory;
|
import static org.junit.Assert.*;
|
||||||
import org.springframework.core.io.ClassPathResource;
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
/**
|
import org.springframework.core.io.ClassPathResource;
|
||||||
* Testcase for publishing layers on geoserver. We need a running GeoServer to
|
|
||||||
* properly run the tests. If such geoserver instance cannot be contacted, tests
|
/**
|
||||||
* will be skipped.
|
* Testcase for publishing layers on geoserver. We need a running GeoServer to
|
||||||
*
|
* properly run the tests. If such geoserver instance cannot be contacted, tests
|
||||||
* @author etj
|
* will be skipped.
|
||||||
* @author Carlo Cancellieri - carlo.cancellieri@geo-solutions.it
|
*
|
||||||
*/
|
* @author etj
|
||||||
public class GeoserverRESTStyleTest extends GeoserverRESTTest {
|
* @author Carlo Cancellieri - carlo.cancellieri@geo-solutions.it
|
||||||
|
*/
|
||||||
private final static Logger LOGGER = LoggerFactory.getLogger(GeoserverRESTStyleTest.class);
|
public class GeoserverRESTStyleTest extends GeoserverRESTTest {
|
||||||
|
|
||||||
@Test
|
private final static Logger LOGGER = LoggerFactory
|
||||||
public void testStyles() throws IOException
|
.getLogger(GeoserverRESTStyleTest.class);
|
||||||
{
|
|
||||||
if (!enabled()) {
|
@Test
|
||||||
return;
|
public void testStyles() throws IOException {
|
||||||
}
|
if (!enabled())
|
||||||
deleteAll();
|
return;
|
||||||
|
deleteAll();
|
||||||
assertEquals(0, reader.getStyles().size());
|
|
||||||
|
assertEquals(0, reader.getStyles().size());
|
||||||
final String STYLENAME = "restteststyle";
|
|
||||||
File sldFile = new ClassPathResource("testdata/restteststyle.sld").getFile();
|
final String STYLENAME = "restteststyle";
|
||||||
|
File sldFile = new ClassPathResource("testdata/restteststyle.sld")
|
||||||
// insert style
|
.getFile();
|
||||||
assertTrue(publisher.publishStyle(sldFile));
|
|
||||||
assertTrue(reader.existsStyle(STYLENAME));
|
// insert style
|
||||||
|
assertTrue(publisher.publishStyle(sldFile));
|
||||||
assertFalse(publisher.publishStyle(sldFile));
|
assertTrue(reader.existsStyle(STYLENAME));
|
||||||
assertTrue(reader.existsStyle(STYLENAME));
|
|
||||||
|
assertFalse(publisher.publishStyle(sldFile));
|
||||||
// insert style v110
|
assertTrue(reader.existsStyle(STYLENAME));
|
||||||
final String STYLENAMEV110 = "restteststyleV110";
|
|
||||||
File sldFileV110 = new ClassPathResource("testdata/" + STYLENAMEV110 + ".sld").getFile();
|
// insert style v110
|
||||||
|
final String STYLENAMEV110 = "restteststyleV110";
|
||||||
assertTrue(publisher.publishStyle(sldFileV110, STYLENAMEV110, true));
|
File sldFileV110 = new ClassPathResource("testdata/" + STYLENAMEV110 + ".sld").getFile();
|
||||||
assertTrue(reader.existsStyle(STYLENAMEV110));
|
|
||||||
|
assertTrue(publisher.publishStyle(sldFileV110, STYLENAMEV110, true));
|
||||||
assertFalse(publisher.publishStyle(sldFileV110, STYLENAMEV110, true));
|
assertTrue(reader.existsStyle(STYLENAMEV110));
|
||||||
|
|
||||||
RESTStyle style = reader.getStyle(STYLENAME);
|
assertFalse(publisher.publishStyle(sldFileV110, STYLENAMEV110, true));
|
||||||
assertEquals(STYLENAME, style.getName());
|
|
||||||
assertNull(style.getWorkspace());
|
RESTStyle style = reader.getStyle(STYLENAME);
|
||||||
|
assertEquals(STYLENAME, style.getName());
|
||||||
String sld = reader.getSLD(STYLENAME);
|
assertNull(style.getWorkspace());
|
||||||
assertNotNull(sld);
|
|
||||||
|
String sld = reader.getSLD(STYLENAME);
|
||||||
Element styleEl = JDOMBuilder.buildElement(sld);
|
assertNotNull(sld);
|
||||||
assertNotNull(styleEl);
|
|
||||||
|
Element styleEl = JDOMBuilder.buildElement(sld);
|
||||||
Namespace SLDNS = Namespace.getNamespace("sld", "http://www.opengis.net/sld");
|
assertNotNull(styleEl);
|
||||||
|
|
||||||
try {
|
Namespace SLDNS = Namespace.getNamespace("sld",
|
||||||
assertEquals(STYLENAME, styleEl.getChild("NamedLayer", SLDNS)
|
"http://www.opengis.net/sld");
|
||||||
.getChild("Name", SLDNS).getText());
|
|
||||||
assertEquals("STYLE FOR TESTING PURPOSES",
|
try {
|
||||||
styleEl.getChild("NamedLayer", SLDNS)
|
|
||||||
.getChild("UserStyle", SLDNS)
|
assertEquals(STYLENAME, styleEl.getChild("NamedLayer", SLDNS)
|
||||||
.getChild("Title", SLDNS).getText());
|
.getChild("Name", SLDNS).getText());
|
||||||
} catch (NullPointerException npe) {
|
assertEquals("STYLE FOR TESTING PURPOSES",
|
||||||
fail("Error in SLD");
|
styleEl.getChild("NamedLayer", SLDNS)
|
||||||
}
|
.getChild("UserStyle", SLDNS)
|
||||||
|
.getChild("Title", SLDNS).getText());
|
||||||
// assertEquals(1475, sld.length());
|
} catch (NullPointerException npe) {
|
||||||
assertEquals(2, reader.getStyles().size());
|
fail("Error in SLD");
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void cleanupTestStyle(final String styleName)
|
// assertEquals(1475, sld.length());
|
||||||
{
|
|
||||||
// dry run delete to work in a known state
|
assertEquals(2, reader.getStyles().size());
|
||||||
if (reader.existsStyle(styleName)) {
|
}
|
||||||
LOGGER.info("Clearing stale test style " + styleName);
|
|
||||||
boolean ok = publisher.removeStyle(styleName);
|
protected void cleanupTestStyle(final String styleName) {
|
||||||
if (!ok) {
|
// dry run delete to work in a known state
|
||||||
fail("Could not unpublish style " + styleName);
|
if (reader.existsStyle(styleName)) {
|
||||||
}
|
LOGGER.info("Clearing stale test style " + styleName);
|
||||||
}
|
boolean ok = publisher.removeStyle(styleName);
|
||||||
assertFalse("Cleanup failed", reader.existsStyle(styleName));
|
if (!ok) {
|
||||||
}
|
fail("Could not unpublish style " + styleName);
|
||||||
|
}
|
||||||
@Test
|
}
|
||||||
public void testPublishDeleteStyleFile() throws FileNotFoundException,
|
assertFalse("Cleanup failed", reader.existsStyle(styleName));
|
||||||
IOException {
|
}
|
||||||
if (!enabled()) {
|
|
||||||
return;
|
@Test
|
||||||
}
|
public void testPublishDeleteStyleFile() throws FileNotFoundException,
|
||||||
// Assume.assumeTrue(enabled);
|
IOException {
|
||||||
final String styleName = "restteststyle";
|
if (!enabled()) {
|
||||||
|
return;
|
||||||
File sldFile = new ClassPathResource("testdata/restteststyle.sld")
|
}
|
||||||
.getFile();
|
// Assume.assumeTrue(enabled);
|
||||||
|
final String styleName = "restteststyle";
|
||||||
final String STYLENAMEV110 = "restteststyleV110";
|
|
||||||
File sldFileV110 = new ClassPathResource("testdata/" + STYLENAMEV110 + ".sld")
|
File sldFile = new ClassPathResource("testdata/restteststyle.sld")
|
||||||
.getFile();
|
.getFile();
|
||||||
|
|
||||||
// known state?
|
final String STYLENAMEV110 = "restteststyleV110";
|
||||||
cleanupTestStyle(styleName);
|
File sldFileV110 = new ClassPathResource("testdata/" + STYLENAMEV110 + ".sld")
|
||||||
cleanupTestStyle(STYLENAMEV110);
|
.getFile();
|
||||||
|
|
||||||
// test insert
|
// known state?
|
||||||
boolean published = publisher.publishStyle(sldFile); // Will take the
|
cleanupTestStyle(styleName);
|
||||||
// name from sld
|
cleanupTestStyle(STYLENAMEV110);
|
||||||
// contents
|
|
||||||
assertTrue("publish() failed", published);
|
// test insert
|
||||||
assertTrue(reader.existsStyle(styleName));
|
boolean published = publisher.publishStyle(sldFile); // Will take the
|
||||||
|
// name from sld
|
||||||
sldFile = new ClassPathResource("testdata/restteststyle2.sld").getFile();
|
// contents
|
||||||
published = publisher.updateStyle(sldFile, styleName); // update
|
assertTrue("publish() failed", published);
|
||||||
assertTrue("update() failed", published);
|
assertTrue(reader.existsStyle(styleName));
|
||||||
|
|
||||||
// test delete
|
sldFile = new ClassPathResource("testdata/restteststyle2.sld").getFile();
|
||||||
boolean ok = publisher.removeStyle(styleName);
|
published = publisher.updateStyle(sldFile, styleName); // update
|
||||||
assertTrue("Unpublish() failed", ok);
|
assertTrue("update() failed", published);
|
||||||
assertFalse(reader.existsStyle(styleName));
|
|
||||||
|
// test delete
|
||||||
published = publisher.publishStyle(sldFileV110, STYLENAMEV110, true);
|
boolean ok = publisher.removeStyle(styleName);
|
||||||
|
assertTrue("Unpublish() failed", ok);
|
||||||
assertTrue("publish() failed", published);
|
assertFalse(reader.existsStyle(styleName));
|
||||||
assertTrue(reader.existsStyle(STYLENAMEV110));
|
|
||||||
|
published = publisher.publishStyle(sldFileV110, STYLENAMEV110, true);
|
||||||
boolean updated = publisher.updateStyle(sldFileV110, STYLENAMEV110, true);
|
|
||||||
assertTrue("update() failed", updated);
|
assertTrue("publish() failed", published);
|
||||||
|
assertTrue(reader.existsStyle(STYLENAMEV110));
|
||||||
// test delete
|
|
||||||
ok = publisher.removeStyle(STYLENAMEV110);
|
boolean updated = publisher.updateStyle(sldFileV110, STYLENAMEV110, true);
|
||||||
assertTrue("Unpublish() failed", ok);
|
assertTrue("update() failed", updated);
|
||||||
assertFalse(reader.existsStyle(STYLENAMEV110));
|
|
||||||
}
|
// test delete
|
||||||
|
ok = publisher.removeStyle(STYLENAMEV110);
|
||||||
@Test
|
assertTrue("Unpublish() failed", ok);
|
||||||
public void testPublishDeleteStyleString()
|
assertFalse(reader.existsStyle(STYLENAMEV110));
|
||||||
throws FileNotFoundException, IOException
|
}
|
||||||
{
|
|
||||||
if (!enabled()) {
|
@Test
|
||||||
return;
|
public void testPublishDeleteStyleString() throws FileNotFoundException,
|
||||||
}
|
IOException {
|
||||||
// Assume.assumeTrue(enabled);
|
if (!enabled()) {
|
||||||
String styleName = "restteststyle";
|
return;
|
||||||
|
}
|
||||||
File sldFile = new ClassPathResource("testdata/restteststyle.sld")
|
// Assume.assumeTrue(enabled);
|
||||||
.getFile();
|
String styleName = "restteststyle";
|
||||||
|
|
||||||
// known state?
|
File sldFile = new ClassPathResource("testdata/restteststyle.sld")
|
||||||
cleanupTestStyle(styleName);
|
.getFile();
|
||||||
|
|
||||||
// test insert
|
// known state?
|
||||||
String sldContent = IOUtils.toString(new FileInputStream(sldFile));
|
cleanupTestStyle(styleName);
|
||||||
|
|
||||||
boolean published = publisher.publishStyle(sldContent); // Will take the
|
// test insert
|
||||||
// name from sld
|
String sldContent = IOUtils.toString(new FileInputStream(sldFile));
|
||||||
// contents
|
|
||||||
assertTrue("publish() failed", published);
|
boolean published = publisher.publishStyle(sldContent); // Will take the
|
||||||
assertTrue(reader.existsStyle(styleName));
|
// name from sld
|
||||||
// test delete
|
// contents
|
||||||
boolean ok = publisher.removeStyle(styleName);
|
assertTrue("publish() failed", published);
|
||||||
assertTrue("Unpublish() failed", ok);
|
assertTrue(reader.existsStyle(styleName));
|
||||||
assertFalse(reader.existsStyle(styleName));
|
// test delete
|
||||||
|
boolean ok = publisher.removeStyle(styleName);
|
||||||
styleName = "restteststyle_with_name";
|
assertTrue("Unpublish() failed", ok);
|
||||||
// test insert with name
|
assertFalse(reader.existsStyle(styleName));
|
||||||
published = publisher.publishStyle(sldContent, styleName); // Will set
|
|
||||||
// the name
|
styleName = "restteststyle_with_name";
|
||||||
assertTrue("publish() failed", published);
|
// test insert with name
|
||||||
assertTrue(reader.existsStyle(styleName));
|
published = publisher.publishStyle(sldContent, styleName); // Will set
|
||||||
String newSldContent = sldContent.replace(
|
// the name
|
||||||
"<sld:Title>STYLE FOR TESTING PURPOSES</sld:Title>",
|
assertTrue("publish() failed", published);
|
||||||
"<sld:Title>MODIFIED STYLE FOR TESTING</sld:Title>");
|
assertTrue(reader.existsStyle(styleName));
|
||||||
published = publisher.updateStyle(newSldContent, styleName); // update
|
String newSldContent = sldContent.replace(
|
||||||
assertTrue("publish() failed", published);
|
"<sld:Title>STYLE FOR TESTING PURPOSES</sld:Title>",
|
||||||
|
"<sld:Title>MODIFIED STYLE FOR TESTING</sld:Title>");
|
||||||
// test delete
|
published = publisher.updateStyle(newSldContent, styleName); // update
|
||||||
ok = publisher.removeStyle(styleName);
|
assertTrue("publish() failed", published);
|
||||||
assertTrue("Unpublish() failed", ok);
|
|
||||||
assertFalse(reader.existsStyle(styleName));
|
// test delete
|
||||||
|
ok = publisher.removeStyle(styleName);
|
||||||
}
|
assertTrue("Unpublish() failed", ok);
|
||||||
|
assertFalse(reader.existsStyle(styleName));
|
||||||
@Test
|
|
||||||
public void testUpdateDefaultStyle()
|
}
|
||||||
throws FileNotFoundException, IOException
|
|
||||||
{
|
@Test
|
||||||
if (!enabled()) {
|
public void testUpdateDefaultStyle() throws FileNotFoundException,
|
||||||
return;
|
IOException {
|
||||||
}
|
if (!enabled()) {
|
||||||
deleteAll();
|
return;
|
||||||
|
}
|
||||||
String storeName = "resttestshp";
|
deleteAll();
|
||||||
String layerName = "cities";
|
|
||||||
|
String storeName = "resttestshp";
|
||||||
final String styleName = "restteststyle";
|
String layerName = "cities";
|
||||||
{
|
|
||||||
File sldFile = new ClassPathResource("testdata/restteststyle.sld")
|
final String styleName = "restteststyle";
|
||||||
.getFile();
|
{
|
||||||
cleanupTestStyle(styleName);
|
File sldFile = new ClassPathResource("testdata/restteststyle.sld")
|
||||||
boolean sldpublished = publisher.publishStyle(sldFile); // Will take
|
.getFile();
|
||||||
// the name
|
cleanupTestStyle(styleName);
|
||||||
// from sld
|
boolean sldpublished = publisher.publishStyle(sldFile); // Will take
|
||||||
// contents
|
// the name
|
||||||
assertTrue("style publish() failed", sldpublished);
|
// from sld
|
||||||
assertTrue(reader.existsStyle(styleName));
|
// contents
|
||||||
}
|
assertTrue("style publish() failed", sldpublished);
|
||||||
|
assertTrue(reader.existsStyle(styleName));
|
||||||
final String styleName2 = "restteststyle2";
|
}
|
||||||
{
|
|
||||||
File sldFile = new ClassPathResource("testdata/restteststyle2.sld")
|
final String styleName2 = "restteststyle2";
|
||||||
.getFile();
|
{
|
||||||
cleanupTestStyle(styleName2);
|
File sldFile = new ClassPathResource("testdata/restteststyle2.sld")
|
||||||
boolean sldpublished = publisher.publishStyle(sldFile, styleName2);
|
.getFile();
|
||||||
assertTrue("style publish() failed", sldpublished);
|
cleanupTestStyle(styleName2);
|
||||||
assertTrue(reader.existsStyle(styleName2));
|
boolean sldpublished = publisher.publishStyle(sldFile, styleName2);
|
||||||
}
|
assertTrue("style publish() failed", sldpublished);
|
||||||
|
assertTrue(reader.existsStyle(styleName2));
|
||||||
File zipFile = new ClassPathResource("testdata/resttestshp.zip")
|
}
|
||||||
.getFile();
|
|
||||||
|
File zipFile = new ClassPathResource("testdata/resttestshp.zip")
|
||||||
assertTrue(publisher.createWorkspace(DEFAULT_WS));
|
.getFile();
|
||||||
|
|
||||||
// test insert
|
assertTrue(publisher.createWorkspace(DEFAULT_WS));
|
||||||
boolean published = publisher.publishShp(DEFAULT_WS, storeName,
|
|
||||||
layerName, zipFile, "EPSG:4326", styleName);
|
// test insert
|
||||||
assertTrue("publish() failed", published);
|
boolean published = publisher.publishShp(DEFAULT_WS, storeName,
|
||||||
assertTrue(existsLayer(layerName));
|
layerName, zipFile, "EPSG:4326", styleName);
|
||||||
|
assertTrue("publish() failed", published);
|
||||||
{
|
assertTrue(existsLayer(layerName));
|
||||||
RESTLayer layer = reader.getLayer(layerName);
|
|
||||||
LOGGER.info("Layer style is " + layer.getDefaultStyle());
|
{
|
||||||
assertEquals(styleName, layer.getDefaultStyle());
|
RESTLayer layer = reader.getLayer(layerName);
|
||||||
}
|
LOGGER.info("Layer style is " + layer.getDefaultStyle());
|
||||||
|
assertEquals(styleName, layer.getDefaultStyle());
|
||||||
GSLayerEncoder le = new GSLayerEncoder();
|
}
|
||||||
le.setDefaultStyle(styleName2);
|
|
||||||
publisher.configureLayer(DEFAULT_WS, layerName, le);
|
GSLayerEncoder le = new GSLayerEncoder();
|
||||||
|
le.setDefaultStyle(styleName2);
|
||||||
{
|
publisher.configureLayer(DEFAULT_WS, layerName, le);
|
||||||
RESTLayer layer = reader.getLayer(layerName);
|
|
||||||
LOGGER.info("Layer style is " + layer.getDefaultStyle());
|
{
|
||||||
assertEquals(styleName2, layer.getDefaultStyle());
|
RESTLayer layer = reader.getLayer(layerName);
|
||||||
}
|
LOGGER.info("Layer style is " + layer.getDefaultStyle());
|
||||||
|
assertEquals(styleName2, layer.getDefaultStyle());
|
||||||
// remove layer and datastore
|
}
|
||||||
boolean dsRemoved = publisher.removeDatastore(DEFAULT_WS, storeName,
|
|
||||||
true);
|
// remove layer and datastore
|
||||||
assertTrue("removeDatastore() failed", dsRemoved);
|
boolean dsRemoved = publisher.removeDatastore(DEFAULT_WS, storeName,
|
||||||
}
|
true);
|
||||||
|
assertTrue("removeDatastore() failed", dsRemoved);
|
||||||
@Test
|
}
|
||||||
public void testStylesInWorkspace() throws IOException
|
|
||||||
{
|
@Test
|
||||||
if (!enabled()) {
|
public void testStylesInWorkspace() throws IOException {
|
||||||
return;
|
if (!enabled())
|
||||||
}
|
return;
|
||||||
deleteAll();
|
deleteAll();
|
||||||
|
|
||||||
final String WORKSPACE = "testWorkspace";
|
final String WORKSPACE = "testWorkspace";
|
||||||
final String STYLENAME = "restteststyle";
|
final String STYLENAME = "restteststyle";
|
||||||
File sldFile = new ClassPathResource("testdata/restteststyle.sld").getFile();
|
File sldFile = new ClassPathResource("testdata/restteststyle.sld").getFile();
|
||||||
|
|
||||||
publisher.createWorkspace(WORKSPACE);
|
publisher.createWorkspace(WORKSPACE);
|
||||||
|
|
||||||
assertEquals(0, reader.getStyles().size());
|
assertEquals(0, reader.getStyles().size());
|
||||||
assertEquals(0, reader.getStyles(WORKSPACE).size());
|
assertEquals(0, reader.getStyles(WORKSPACE).size());
|
||||||
|
|
||||||
// insert style
|
|
||||||
assertTrue("Error inserting style", publisher.publishStyleInWorkspace(WORKSPACE, sldFile));
|
// insert style
|
||||||
assertTrue("Style does not exist in workspace", reader.existsStyle(WORKSPACE, STYLENAME));
|
assertTrue(publisher.publishStyleInWorkspace(WORKSPACE, sldFile));
|
||||||
|
assertTrue(reader.existsStyle(WORKSPACE, STYLENAME));
|
||||||
// this assertion is not enforced by geoserver, which is quite lenient in searching names
|
assertFalse(reader.existsStyle(STYLENAME));
|
||||||
//assertFalse("Style should not be global", reader.existsStyle(STYLENAME));
|
|
||||||
|
// insert style again
|
||||||
// insert style again
|
assertFalse(publisher.publishStyleInWorkspace(WORKSPACE, sldFile));
|
||||||
assertFalse("Dup style not trapped", publisher.publishStyleInWorkspace(WORKSPACE, sldFile));
|
assertTrue(reader.existsStyle(WORKSPACE, STYLENAME));
|
||||||
assertTrue("Style does not exist in workspace (2)", reader.existsStyle(WORKSPACE, STYLENAME));
|
assertFalse(reader.existsStyle(STYLENAME));
|
||||||
// this assertion is not enforced by geoserver, which is quite lenient in searching names
|
|
||||||
//assertFalse("Style should not be global (2)", reader.existsStyle(STYLENAME));
|
String sld = reader.getSLD(WORKSPACE, STYLENAME);
|
||||||
|
assertNotNull(sld);
|
||||||
String sld = reader.getSLD(WORKSPACE, STYLENAME);
|
|
||||||
assertNotNull(sld);
|
RESTStyle style = reader.getStyle(WORKSPACE, STYLENAME);
|
||||||
|
assertEquals(STYLENAME, style.getName());
|
||||||
RESTStyle style = reader.getStyle(WORKSPACE, STYLENAME);
|
assertEquals(WORKSPACE, style.getWorkspace());
|
||||||
assertEquals(STYLENAME, style.getName());
|
|
||||||
assertEquals(WORKSPACE, style.getWorkspace());
|
Element styleEl = JDOMBuilder.buildElement(sld);
|
||||||
|
assertNotNull(styleEl);
|
||||||
Element styleEl = JDOMBuilder.buildElement(sld);
|
|
||||||
assertNotNull(styleEl);
|
Namespace SLDNS = Namespace.getNamespace("sld",
|
||||||
|
"http://www.opengis.net/sld");
|
||||||
Namespace SLDNS = Namespace.getNamespace("sld", "http://www.opengis.net/sld");
|
|
||||||
|
try {
|
||||||
try {
|
|
||||||
|
assertEquals(STYLENAME, styleEl.getChild("NamedLayer", SLDNS)
|
||||||
assertEquals(STYLENAME, styleEl.getChild("NamedLayer", SLDNS)
|
.getChild("Name", SLDNS).getText());
|
||||||
.getChild("Name", SLDNS).getText());
|
assertEquals(
|
||||||
assertEquals(
|
"STYLE FOR TESTING PURPOSES",
|
||||||
"STYLE FOR TESTING PURPOSES",
|
styleEl.getChild("NamedLayer", SLDNS)
|
||||||
styleEl.getChild("NamedLayer", SLDNS)
|
.getChild("UserStyle", SLDNS)
|
||||||
.getChild("UserStyle", SLDNS)
|
.getChild("Title", SLDNS).getText());
|
||||||
.getChild("Title", SLDNS).getText());
|
} catch (NullPointerException npe) {
|
||||||
} catch (NullPointerException npe) {
|
fail("Error in SLD");
|
||||||
fail("Error in SLD");
|
}
|
||||||
}
|
|
||||||
|
// assertEquals(1475, sld.length());
|
||||||
// assertEquals(1475, sld.length());
|
|
||||||
assertEquals(0, reader.getStyles().size());
|
assertEquals(0, reader.getStyles().size());
|
||||||
assertEquals(1, reader.getStyles(WORKSPACE).size());
|
assertEquals(1, reader.getStyles(WORKSPACE).size());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testRemoveStylesInWorkspace() throws IOException
|
public void testRemoveStylesInWorkspace() throws IOException {
|
||||||
{
|
if (!enabled())
|
||||||
if (!enabled()) {
|
return;
|
||||||
return;
|
deleteAll();
|
||||||
}
|
|
||||||
deleteAll();
|
final String WORKSPACE = "testWorkspace";
|
||||||
|
final String STYLENAME = "restteststyle";
|
||||||
final String WORKSPACE = "testWorkspace";
|
final File sldFile = new ClassPathResource("testdata/restteststyle.sld").getFile();
|
||||||
final String STYLENAME = "restteststyle";
|
|
||||||
final File sldFile = new ClassPathResource("testdata/restteststyle.sld").getFile();
|
publisher.createWorkspace(WORKSPACE);
|
||||||
|
|
||||||
publisher.createWorkspace(WORKSPACE);
|
assertEquals(0, reader.getStyles(WORKSPACE).size());
|
||||||
|
|
||||||
assertEquals(0, reader.getStyles(WORKSPACE).size());
|
// insert style
|
||||||
|
assertTrue(publisher.publishStyleInWorkspace(WORKSPACE, sldFile));
|
||||||
// insert style
|
assertEquals(1, reader.getStyles(WORKSPACE).size());
|
||||||
assertTrue(publisher.publishStyleInWorkspace(WORKSPACE, sldFile));
|
assertTrue(reader.existsStyle(WORKSPACE, STYLENAME));
|
||||||
assertEquals(1, reader.getStyles(WORKSPACE).size());
|
|
||||||
assertTrue(reader.existsStyle(WORKSPACE, STYLENAME));
|
// remove style
|
||||||
|
assertTrue(publisher.removeStyleInWorkspace(WORKSPACE, STYLENAME, true));
|
||||||
// remove style
|
assertEquals(0, reader.getStyles(WORKSPACE).size());
|
||||||
assertTrue(publisher.removeStyleInWorkspace(WORKSPACE, STYLENAME, true));
|
assertFalse(reader.existsStyle(WORKSPACE, STYLENAME));
|
||||||
assertEquals(0, reader.getStyles(WORKSPACE).size());
|
}
|
||||||
assertFalse(reader.existsStyle(WORKSPACE, STYLENAME));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
@ -33,6 +33,8 @@ import java.io.IOException;
|
|||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import static org.junit.Assert.*;
|
import static org.junit.Assert.*;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.core.io.ClassPathResource;
|
import org.springframework.core.io.ClassPathResource;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -45,6 +47,8 @@ import org.springframework.core.io.ClassPathResource;
|
|||||||
*/
|
*/
|
||||||
public class GeoserverRESTWorkspaceTest extends GeoserverRESTTest {
|
public class GeoserverRESTWorkspaceTest extends GeoserverRESTTest {
|
||||||
|
|
||||||
|
private final static Logger LOGGER = LoggerFactory.getLogger(GeoserverRESTWorkspaceTest.class);
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testWorkspaces() {
|
public void testWorkspaces() {
|
||||||
if (!enabled()) return;
|
if (!enabled()) return;
|
||||||
|
|||||||
@ -35,6 +35,8 @@ import org.apache.commons.httpclient.NameValuePair;
|
|||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import static org.junit.Assert.*;
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.core.io.ClassPathResource;
|
import org.springframework.core.io.ClassPathResource;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -46,6 +48,8 @@ import org.springframework.core.io.ClassPathResource;
|
|||||||
*/
|
*/
|
||||||
public class GeoserverRESTWorldImageTest extends GeoserverRESTTest {
|
public class GeoserverRESTWorldImageTest extends GeoserverRESTTest {
|
||||||
|
|
||||||
|
private final static Logger LOGGER = LoggerFactory.getLogger(GeoserverRESTWorldImageTest.class);
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testPublishWorldImage() throws IOException {
|
public void testPublishWorldImage() throws IOException {
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user