Search in sources :

Example 16 with GPOrganization

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

the class ShortAccountDTOFactoryMassiveTest method createGPUser.

private GPUser createGPUser(int i) {
    GPUser user = new GPUser();
    user.setId(new Long(i));
    user.setName("TEST" + i);
    user.setUsername("TEST" + i);
    user.setEmailAddress("user@test.it");
    user.setSendEmail(Boolean.FALSE);
    user.setOrganization(new GPOrganization("ORGANIZATION_TEST"));
    user.setName("USER_TEST" + i);
    return user;
}
Also used : GPUser(org.geosdi.geoplatform.core.model.GPUser) GPOrganization(org.geosdi.geoplatform.core.model.GPOrganization)

Example 17 with GPOrganization

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

the class CSWCatalogTest method setUp.

@Before
public void setUp() throws Exception {
    logger.trace("\n\t@@@ {}.setUp @@@", this.getClass().getSimpleName());
    organizationTest = new GPOrganization(organizationNameTest);
    organizationTest.setId(gpWSClient.insertOrganization(organizationTest));
    // Insert the servers test
    serverTestOur = this.createCSWServer("CSW Server WS Test", geosdiProvider.getGeosdiUrl(), organizationTest);
    serverTestOurID = cswService.insertServerCSW(serverTestOur);
    serverTestOur.setId(serverTestOurID);
    serverTestTrevisoID = cswService.insertServerCSW(this.createCSWServer("Provincia di Treviso", "http://ows.provinciatreviso.it/geonetwork/srv/it/csw", organizationTest));
    // Create the CSW search parameters
    catalogFinder = new CatalogFinderBean();
    catalogFinder.setServerID(serverTestOurID);
    TextInfo searchInfo = new TextInfo();
    searchInfo.setText(null);
    searchInfo.setSearchTitle(true);
    searchInfo.setSearchAbstract(true);
    searchInfo.setSearchSubjects(true);
    catalogFinder.setTextInfo(searchInfo);
    catalogFinder.setAreaInfo(new AreaInfo());
    catalogFinder.setTimeInfo(new TimeInfo());
}
Also used : CatalogFinderBean(org.geosdi.geoplatform.gui.responce.CatalogFinderBean) TextInfo(org.geosdi.geoplatform.gui.responce.TextInfo) TimeInfo(org.geosdi.geoplatform.gui.responce.TimeInfo) GPOrganization(org.geosdi.geoplatform.core.model.GPOrganization) AreaInfo(org.geosdi.geoplatform.gui.responce.AreaInfo) Before(org.junit.Before)

Example 18 with GPOrganization

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

the class BaseSoapServiceTest method setUpOrganization.

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

Example 19 with GPOrganization

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

the class WSAccountTest method testInsertIncorrectUserWRTUOrganization.

@Test
public void testInsertIncorrectUserWRTUOrganization() {
    GPUser user = super.createUser("no-organization", new GPOrganization("organization-inexistent"), USER);
    try {
        gpWSClient.insertAccount(new InsertAccountRequest(user, FALSE));
        fail("User incorrect wrt organization");
    } catch (IllegalParameterFault ex) {
        if (!ex.getMessage().toLowerCase().contains("organization")) {
            // Must be fail for other reasons
            fail("Not fail for User incorrect wrt organization, but for: " + ex.getMessage());
        }
    }
}
Also used : InsertAccountRequest(org.geosdi.geoplatform.request.InsertAccountRequest) IllegalParameterFault(org.geosdi.geoplatform.exception.IllegalParameterFault) GPUser(org.geosdi.geoplatform.core.model.GPUser) GPOrganization(org.geosdi.geoplatform.core.model.GPOrganization) Test(org.junit.Test)

Example 20 with GPOrganization

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

the class RSAccountTest method testInsertIncorrectUserWRTUOrganizationRest.

@Test
public void testInsertIncorrectUserWRTUOrganizationRest() throws Exception {
    GPUser user = super.createUser("no-organization-rs", new GPOrganization("organization-inexistent-rs"), GPRole.USER);
    try {
        gpWSClient.insertAccount(new InsertAccountRequest(user, Boolean.FALSE));
        Assert.fail("User incorrect wrt organization");
    } catch (ClientErrorException ex) {
        GPRestExceptionMessage exMess = ex.getResponse().readEntity(GPRestExceptionMessage.class);
        logger.debug("\n@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ {}\n", exMess);
        if (!exMess.getMessage().toLowerCase().contains("organization")) {
            // Must be fail for other reasons
            Assert.fail("Not fail for User incorrect wrt organization, but for: " + ex.getMessage());
        }
    }
}
Also used : InsertAccountRequest(org.geosdi.geoplatform.request.InsertAccountRequest) GPUser(org.geosdi.geoplatform.core.model.GPUser) GPOrganization(org.geosdi.geoplatform.core.model.GPOrganization) ClientErrorException(javax.ws.rs.ClientErrorException) GPRestExceptionMessage(org.geosdi.geoplatform.exception.rs.GPRestExceptionMessage) Test(org.junit.Test)

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