예제 #1
0
  @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(
            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(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());
  }
예제 #2
0
  @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());
  }
예제 #3
0
  @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());
  }
예제 #4
0
 private GeoPlatformServer createServer(
     String serverUrl, GPCapabilityType serverType, GPOrganization organization) {
   // Create field's value from Regex on Server URL
   String serverName = serverUrl.replaceAll("http://(\\w+)\\.([^\\.]+)\\.(\\w+)", "$1.$2.$3");
   logger.trace("\n*** serverName: {} ***", serverName);
   String labelServer = serverName.replaceAll("(\\w+)\\.([^\\.]+)\\.(\\w+)", "$2");
   logger.trace("\n*** labelServer: {} ***", labelServer);
   // Create Server
   GeoPlatformServer server = new GeoPlatformServer();
   server.setServerUrl(serverUrl);
   server.setName(serverName);
   server.setTitle(labelServer);
   server.setAbstractServer("Abstract of " + labelServer);
   server.setServerType(serverType);
   server.setOrganization(organization);
   return server;
 }