Search in sources :

Example 36 with GeoPlatformServer

use of org.geosdi.geoplatform.core.model.GeoPlatformServer in project geo-platform by geosdi.

the class CSWCatalogRecordTest method testGetRecordsGeomatysCountTimeFiltering.

@Ignore("Catalog is down")
@Test
public void testGetRecordsGeomatysCountTimeFiltering() throws Exception {
    // Insert the server
    GeoPlatformServer server = super.createCSWServer("Geomatys", "http://demo.geomatys.com/mdweb-cnes-labs/WS/csw/default", organizationTest);
    Long serverID = cswService.insertServerCSW(server);
    assertNotNull(serverID);
    catalogFinder.setServerID(serverID);
    int count = cswService.getRecordsCount(catalogFinder);
    assertTrue(count > 0);
    Calendar startCalendar = new GregorianCalendar(2000, Calendar.JANUARY, 1);
    Calendar endCalendar = new GregorianCalendar(2012, Calendar.JANUARY, 1);
    catalogFinder.getTimeInfo().setActive(true);
    catalogFinder.getTimeInfo().setStartDate(startCalendar.getTime());
    catalogFinder.getTimeInfo().setEndDate(endCalendar.getTime());
    assertTrue(count > cswService.getRecordsCount(catalogFinder));
    // Delete the server
    boolean deleted = cswService.deleteServerCSW(serverID);
    assertTrue(deleted);
}
Also used : GeoPlatformServer(org.geosdi.geoplatform.core.model.GeoPlatformServer) GregorianCalendar(java.util.GregorianCalendar) Calendar(java.util.Calendar) GregorianCalendar(java.util.GregorianCalendar) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 37 with GeoPlatformServer

use of org.geosdi.geoplatform.core.model.GeoPlatformServer in project geo-platform by geosdi.

the class RSServerTest method testSaveServerRest.

@Test
public void testSaveServerRest() throws ResourceNotFoundFault, IllegalParameterFault {
    logger.trace("\n@@@ testSaveServer @@@");
    // Server is into DB
    ServerDTO serverGeoSDI = gpWSClient.getShortServer(serverUrlGeoSDI);
    Assert.assertNotNull(serverGeoSDI);
    ServerDTO serverDTO = gpWSClient.saveServer(new WSSaveServerRequest(serverGeoSDI.getId(), "geoSDI", serverUrlGeoSDI, organizationTest.getName()));
    Assert.assertNotNull("ServerDTO geoSDI is NULL", serverDTO);
    Assert.assertEquals("ServerDTO geoSDI alias is wrong", "geoSDI", serverDTO.getAlias());
    // Server is NOT into DB
    String serverUrlEx = "http://iws.erdas.com/ecwp/ecw_wms.dll?request=GetCapabilities";
    serverDTO = gpWSClient.saveServer(new WSSaveServerRequest(null, "Erdas", serverUrlEx, organizationTest.getName()));
    Assert.assertNotNull("ServerDTO EX is NULL", serverDTO);
    // Check if the server was insert
    GeoPlatformServer serverEx = gpWSClient.getServerDetailByUrl(serverUrlEx);
    Assert.assertNotNull("Server Ex is NULL for URL", serverEx);
    Assert.assertEquals("Server Ex URL is NOT correct", serverUrlEx, serverEx.getServerUrl());
    Assert.assertEquals("Server Ex ID is NOT correct", serverDTO.getId(), serverEx.getId());
    // Delete server
    gpWSClient.deleteServer(serverEx.getId());
}
Also used : ServerDTO(org.geosdi.geoplatform.response.ServerDTO) GeoPlatformServer(org.geosdi.geoplatform.core.model.GeoPlatformServer) WSSaveServerRequest(org.geosdi.geoplatform.request.server.WSSaveServerRequest) Test(org.junit.Test)

Example 38 with GeoPlatformServer

use of org.geosdi.geoplatform.core.model.GeoPlatformServer in project geo-platform by geosdi.

the class RSServerTest method testGetServerRest.

@Test
public void testGetServerRest() throws ResourceNotFoundFault {
    // Get Server from Id
    GeoPlatformServer gpServer = gpWSClient.getServerDetail(idServerTest);
    logger.debug("\n*** gpServer:\n{}\n***", gpServer);
    Assert.assertNotNull(gpServer);
    Assert.assertEquals("Id Server NOT match", idServerTest, gpServer.getId().longValue());
    Assert.assertEquals("URL Server NOT match", serverUrlTest, gpServer.getServerUrl());
    // Get Server from serverUrl
    ServerDTO serverDTO = gpWSClient.getShortServer(serverUrlTest);
    logger.debug("\n*** serverDTO:\n{}\n***", serverDTO);
    Assert.assertNotNull(serverDTO);
    Assert.assertEquals("Id Server NOT match", idServerTest, serverDTO.getId().longValue());
    Assert.assertEquals("URL Server NOT match", serverUrlTest, serverDTO.getServerUrl());
}
Also used : GeoPlatformServer(org.geosdi.geoplatform.core.model.GeoPlatformServer) ServerDTO(org.geosdi.geoplatform.response.ServerDTO) Test(org.junit.Test)

Example 39 with GeoPlatformServer

use of org.geosdi.geoplatform.core.model.GeoPlatformServer in project geo-platform by geosdi.

the class SOAPServerTest method testSaveServer.

@Test
public void testSaveServer() throws ResourceNotFoundFault, IllegalParameterFault {
    logger.trace("\n@@@ testSaveServer @@@");
    // Server is into DB
    ServerDTO serverGeoSDI = gpWSClient.getShortServer(serverUrlGeoSDI);
    Assert.assertNotNull(serverGeoSDI);
    ServerDTO serverDTO = gpWSClient.saveServer(new WSSaveServerRequest(serverGeoSDI.getId(), "geoSDI", serverUrlGeoSDI, organizationTest.getName()));
    Assert.assertNotNull("ServerDTO geoSDI is NULL", serverDTO);
    Assert.assertEquals("ServerDTO geoSDI alias is wrong", serverDTO.getAlias(), "geoSDI");
    // Server is NOT into DB
    String serverUrlEx = "http://iws.erdas.com/ecwp/ecw_wms.dll?request=GetCapabilities";
    serverDTO = gpWSClient.saveServer(new WSSaveServerRequest(null, "Erdas", serverUrlEx, organizationTest.getName()));
    Assert.assertNotNull("ServerDTO EX is NULL", serverDTO);
    // Check if the server was insert
    GeoPlatformServer serverEx = gpWSClient.getServerDetailByUrl(serverUrlEx);
    Assert.assertNotNull("Server Ex is NULL for URL", serverEx);
    Assert.assertEquals("Server Ex URL is NOT correct", serverUrlEx, serverEx.getServerUrl());
    Assert.assertEquals("Server Ex ID is NOT correct", serverDTO.getId(), serverEx.getId());
    // Delete server
    gpWSClient.deleteServer(serverEx.getId());
}
Also used : ServerDTO(org.geosdi.geoplatform.response.ServerDTO) GeoPlatformServer(org.geosdi.geoplatform.core.model.GeoPlatformServer) WSSaveServerRequest(org.geosdi.geoplatform.request.server.WSSaveServerRequest) Test(org.junit.Test)

Example 40 with GeoPlatformServer

use of org.geosdi.geoplatform.core.model.GeoPlatformServer in project geo-platform by geosdi.

the class SOAPServerTest method testUpdateServer.

@Test
public void testUpdateServer() throws IllegalParameterFault, ResourceNotFoundFault {
    final String serverUrlUpdated = serverUrlTest.replaceAll("org", "com");
    // Retrieve Server
    GeoPlatformServer serverTest = gpWSClient.getServerDetail(idServerTest);
    logger.debug("\n*** serverTest:\n{}\n***", serverTest);
    // Update Server
    serverTest.setServerUrl(serverUrlUpdated);
    gpWSClient.updateServer(serverTest);
    // Retrieve Server modified
    GeoPlatformServer serverModified = gpWSClient.getServerDetail(idServerTest);
    logger.debug("\n*** serverModified:\n{}\n***", serverModified);
    // Assert on Server modified
    Assert.assertNotNull(serverModified);
    Assert.assertEquals(serverTest.getServerUrl(), serverModified.getServerUrl());
}
Also used : GeoPlatformServer(org.geosdi.geoplatform.core.model.GeoPlatformServer) Test(org.junit.Test)

Aggregations

GeoPlatformServer (org.geosdi.geoplatform.core.model.GeoPlatformServer)40 Test (org.junit.Test)15 ResourceNotFoundFault (org.geosdi.geoplatform.exception.ResourceNotFoundFault)9 ServerDTO (org.geosdi.geoplatform.response.ServerDTO)8 GPOrganization (org.geosdi.geoplatform.core.model.GPOrganization)6 GPDAOException (org.geosdi.geoplatform.persistence.dao.exception.GPDAOException)6 ServerCSWDTO (org.geosdi.geoplatform.responce.ServerCSWDTO)3 Ignore (org.junit.Ignore)3 MalformedURLException (java.net.MalformedURLException)2 ArrayList (java.util.ArrayList)2 JAXBElement (javax.xml.bind.JAXBElement)2 IllegalParameterFault (org.geosdi.geoplatform.exception.IllegalParameterFault)2 ServerInternalFault (org.geosdi.geoplatform.exception.ServerInternalFault)2 PaginatedSearchRequest (org.geosdi.geoplatform.request.PaginatedSearchRequest)2 WSSaveServerRequest (org.geosdi.geoplatform.request.server.WSSaveServerRequest)2 RasterLayerDTO (org.geosdi.geoplatform.response.RasterLayerDTO)2 IOException (java.io.IOException)1 URL (java.net.URL)1 Calendar (java.util.Calendar)1 GregorianCalendar (java.util.GregorianCalendar)1