Search in sources :

Example 11 with GeoPlatformServer

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

the class RSServerTest method testUpdateServerRest.

@Test
public void testUpdateServerRest() 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)

Example 12 with GeoPlatformServer

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

the class SOAPServerTest method testGetServer.

@Test
public void testGetServer() 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 13 with GeoPlatformServer

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

the class CSWCatalogServerTest method testSearchCSWServersMore.

@Test
public void testSearchCSWServersMore() throws Exception {
    // Insert 27 servers (only 25 for matching wrt alias)
    Long[] serverIDs = new Long[27];
    for (int i = 1; i <= 27; i++) {
        GeoPlatformServer server = super.createCSWServer("Mock title " + i, "http://url.mock-" + i, organizationTest);
        if (i >= 3) {
            server.setAliasName("Alias test " + i);
        }
        serverIDs[i - 1] = cswService.insertServerCSW(server);
        Assert.assertNotNull(serverIDs[i - 1]);
    }
    // First page
    // wrt title and alias
    PaginatedSearchRequest request = new PaginatedSearchRequest("test", 10, 0);
    List<ServerCSWDTO> search = cswService.searchCSWServers(request, super.organizationNameTest);
    Assert.assertNotNull(search);
    Assert.assertEquals(10, search.size());
    // Second page
    // wrt title and alias
    request = new PaginatedSearchRequest("test", 10, 1);
    search = cswService.searchCSWServers(request, super.organizationNameTest);
    Assert.assertNotNull(search);
    Assert.assertEquals(10, search.size());
    // Third page
    // wrt title and alias
    request = new PaginatedSearchRequest("test", 10, 2);
    search = cswService.searchCSWServers(request, super.organizationNameTest);
    Assert.assertNotNull(search);
    Assert.assertEquals(6, search.size());
    // Delete the servers
    for (Long serverID : serverIDs) {
        boolean deleted = cswService.deleteServerCSW(serverID);
        Assert.assertTrue(deleted);
    }
}
Also used : GeoPlatformServer(org.geosdi.geoplatform.core.model.GeoPlatformServer) ServerCSWDTO(org.geosdi.geoplatform.responce.ServerCSWDTO) PaginatedSearchRequest(org.geosdi.geoplatform.request.PaginatedSearchRequest) Test(org.junit.Test)

Example 14 with GeoPlatformServer

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

the class CSWCatalogServerTest method testCSWServersCountTwo.

@Test
public void testCSWServersCountTwo() throws Exception {
    // Insert the server
    GeoPlatformServer server = super.createCSWServer("Mock title", "http://url.mock", organizationTest);
    server.setAliasName("Alias test");
    Long serverID = cswService.insertServerCSW(server);
    Assert.assertNotNull(serverID);
    // wrt title and alias
    SearchRequest request = new SearchRequest("test");
    int count = cswService.getCSWServersCount(request, super.organizationNameTest);
    Assert.assertEquals(2, count);
    // Delete the server
    boolean deleted = cswService.deleteServerCSW(serverID);
    Assert.assertTrue(deleted);
}
Also used : GeoPlatformServer(org.geosdi.geoplatform.core.model.GeoPlatformServer) SearchRequest(org.geosdi.geoplatform.request.SearchRequest) PaginatedSearchRequest(org.geosdi.geoplatform.request.PaginatedSearchRequest) Test(org.junit.Test)

Example 15 with GeoPlatformServer

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

the class CSWCatalogServerTest method testGetServerDetailByUrl.

@Test
public void testGetServerDetailByUrl() throws Exception {
    GeoPlatformServer retrievedServer = cswService.getServerDetailCSWByUrl(serverTestOur.getServerUrl());
    this.compareServer(serverTestOur, retrievedServer);
}
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