Search in sources :

Example 6 with GPOrganization

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

the class WSAccountTest method testAllOrganizationAccounts.

@Test
public void testAllOrganizationAccounts() throws Exception {
    // Initial test
    List<ShortAccountDTO> accountList = gpWSClient.getAccounts(organizationNameTest).getAccounts();
    assertNotNull(accountList);
    int numAccounts = accountList.size();
    logger.info("\n*** Number of Accounts for Organization \"{}\": {} ***", organizationNameTest, numAccounts);
    for (ShortAccountDTO account : accountList) {
        assertEquals(organizationNameTest, account.getOrganization());
    }
    // Insert User of the organization for test
    this.createAndInsertUser("to_search", organizationTest, USER);
    // Insert the other Organization and a User for it
    GPOrganization otherOrganization = new GPOrganization("other_organization_ws_test");
    Long otherOrganizationID = gpWSClient.insertOrganization(otherOrganization);
    this.createAndInsertUser("none_search", otherOrganization, USER);
    // Final test
    accountList = gpWSClient.getAccounts(organizationNameTest).getAccounts();
    assertNotNull(accountList);
    assertEquals(numAccounts + 1, accountList.size());
    for (ShortAccountDTO account : accountList) {
        assertEquals(organizationNameTest, account.getOrganization());
    }
    // Delete the other Organization
    gpWSClient.deleteOrganization(otherOrganizationID);
}
Also used : ShortAccountDTO(org.geosdi.geoplatform.response.ShortAccountDTO) GPOrganization(org.geosdi.geoplatform.core.model.GPOrganization) Test(org.junit.Test)

Example 7 with GPOrganization

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

the class BasicRestServiceTest method setUpOrganization.

@Override
protected void setUpOrganization() throws IllegalParameterFault {
    organizationTest = new GPOrganization(organizationNameRSTest);
    organizationTest.setId(gpWSClient.insertOrganization(organizationTest));
}
Also used : GPOrganization(org.geosdi.geoplatform.core.model.GPOrganization)

Example 8 with GPOrganization

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

the class RSAccountTest method testAllOrganizationAccountsRest.

@Test
public void testAllOrganizationAccountsRest() throws Exception {
    // Initial test
    List<ShortAccountDTO> accountList = gpWSClient.getAccounts(organizationNameRSTest).getAccounts();
    Assert.assertNotNull(accountList);
    int numAccounts = accountList.size();
    logger.info("\n*** Number of Accounts for Organization \"{}\": {} ***", organizationNameRSTest, numAccounts);
    for (ShortAccountDTO account : accountList) {
        Assert.assertEquals(organizationNameRSTest, account.getOrganization());
    }
    // Insert User of the organization for test
    this.createAndInsertUser("to_search", organizationTest, GPRole.USER);
    // Insert the other Organization and a User for it
    GPOrganization otherOrganization = new GPOrganization("other_organization_ws_test");
    Long otherOrganizationID = gpWSClient.insertOrganization(otherOrganization);
    this.createAndInsertUser("none_search", otherOrganization, GPRole.USER);
    // Final test
    accountList = gpWSClient.getAccounts(organizationNameRSTest).getAccounts();
    Assert.assertNotNull(accountList);
    Assert.assertEquals(numAccounts + 1, accountList.size());
    for (ShortAccountDTO account : accountList) {
        Assert.assertEquals(organizationNameRSTest, account.getOrganization());
    }
    // Delete the other Organization
    gpWSClient.deleteOrganization(otherOrganizationID);
}
Also used : ShortAccountDTO(org.geosdi.geoplatform.response.ShortAccountDTO) GPOrganization(org.geosdi.geoplatform.core.model.GPOrganization) Test(org.junit.Test)

Example 9 with GPOrganization

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

the class CSWEntityCorrectness method checkCSWServer.

// ==========================================================================
// === Server
// ==========================================================================
public static void checkCSWServer(GeoPlatformServer server) throws IllegalParameterFault {
    if (server.getServerType() != GPCapabilityType.CSW) {
        throw new IllegalParameterFault("Server is not a CSW server.");
    }
    String url = server.getServerUrl();
    if (url == null) {
        throw new IllegalParameterFault("Server URL must not be null.");
    }
    if (!url.startsWith("http://") && !url.startsWith("https://")) {
        throw new IllegalParameterFault("URL must be start with \"http://\" or \"https://\".");
    }
    GPOrganization organization = server.getOrganization();
    if (organization == null) {
        throw new IllegalParameterFault("Server Organization must not be null.");
    }
}
Also used : IllegalParameterFault(org.geosdi.geoplatform.exception.IllegalParameterFault) GPOrganization(org.geosdi.geoplatform.core.model.GPOrganization)

Example 10 with GPOrganization

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

the class ShortAccountDTOFactoryMassiveTest method createGPApplication.

private GPApplication createGPApplication(int i) {
    int f = ++i * 20;
    GPApplication application = new GPApplication();
    application.setId(new Long(f));
    application.setOrganization(new GPOrganization("ORGANIZATION_" + "APPLICATION_TEST"));
    application.setAppID("APPLICATION_TEST" + f);
    return application;
}
Also used : GPOrganization(org.geosdi.geoplatform.core.model.GPOrganization) GPApplication(org.geosdi.geoplatform.core.model.GPApplication)

Aggregations

GPOrganization (org.geosdi.geoplatform.core.model.GPOrganization)20 GeoPlatformServer (org.geosdi.geoplatform.core.model.GeoPlatformServer)6 IllegalParameterFault (org.geosdi.geoplatform.exception.IllegalParameterFault)6 GPUser (org.geosdi.geoplatform.core.model.GPUser)4 Test (org.junit.Test)4 ResourceNotFoundFault (org.geosdi.geoplatform.exception.ResourceNotFoundFault)3 GPDAOException (org.geosdi.geoplatform.persistence.dao.exception.GPDAOException)3 InsertAccountRequest (org.geosdi.geoplatform.request.InsertAccountRequest)3 MalformedURLException (java.net.MalformedURLException)2 ShortAccountDTO (org.geosdi.geoplatform.response.ShortAccountDTO)2 IOException (java.io.IOException)1 URL (java.net.URL)1 CriteriaBuilder (javax.persistence.criteria.CriteriaBuilder)1 ClientErrorException (javax.ws.rs.ClientErrorException)1 CatalogCapabilities (org.geosdi.geoplatform.connector.api.capabilities.model.csw.CatalogCapabilities)1 GPApplication (org.geosdi.geoplatform.core.model.GPApplication)1 GPAuthServer (org.geosdi.geoplatform.core.model.GPAuthServer)1 GPRestExceptionMessage (org.geosdi.geoplatform.exception.rs.GPRestExceptionMessage)1 GeoPlatformException (org.geosdi.geoplatform.gui.global.GeoPlatformException)1 AreaInfo (org.geosdi.geoplatform.gui.responce.AreaInfo)1