Search in sources :

Example 1 with SpatialEnrichmentRS

use of eu.europa.ec.fisheries.uvms.spatial.model.schemas.SpatialEnrichmentRS in project UVMS-Docker by UnionVMS.

the class SpatialJmsIT method createSpatialEnrichmentRequestForRuttTest.

@Test(timeout = 40000)
public void createSpatialEnrichmentRequestForRuttTest() throws Exception {
    List<LatLong> position = movementHelper.createRutt(10);
    for (LatLong latLong : position) {
        SpatialEnrichmentRQ spatialEnrichmentRQ = new SpatialEnrichmentRQ();
        AreaTypes areaTypes = new AreaTypes();
        areaTypes.getAreaTypes().add(AreaType.COUNTRY);
        areaTypes.getAreaTypes().add(AreaType.RFMO);
        areaTypes.getAreaTypes().add(AreaType.EEZ);
        spatialEnrichmentRQ.setAreaTypes(areaTypes);
        LocationTypes locationTypes = new LocationTypes();
        locationTypes.getLocationTypes().add(LocationType.PORT);
        spatialEnrichmentRQ.setLocationTypes(locationTypes);
        spatialEnrichmentRQ.setMethod(SpatialModuleMethod.GET_ENRICHMENT);
        spatialEnrichmentRQ.setUnit(UnitType.NAUTICAL_MILES);
        PointType pointType = new PointType();
        spatialEnrichmentRQ.setPoint(pointType);
        pointType.setLatitude(latLong.latitude);
        pointType.setLongitude(latLong.longitude);
        pointType.setCrs(4326);
        SpatialEnrichmentRS spatialEnrichmentRS = spatialHelper.createSpatialEnrichment(spatialEnrichmentRQ);
        assertNotNull(spatialEnrichmentRS);
    }
}
Also used : LocationTypes(eu.europa.ec.fisheries.uvms.spatial.model.schemas.SpatialEnrichmentRQ.LocationTypes) SpatialEnrichmentRQ(eu.europa.ec.fisheries.uvms.spatial.model.schemas.SpatialEnrichmentRQ) AreaTypes(eu.europa.ec.fisheries.uvms.spatial.model.schemas.SpatialEnrichmentRQ.AreaTypes) SpatialEnrichmentRS(eu.europa.ec.fisheries.uvms.spatial.model.schemas.SpatialEnrichmentRS) PointType(eu.europa.ec.fisheries.uvms.spatial.model.schemas.PointType) LatLong(eu.europa.ec.fisheries.uvms.docker.validation.movement.LatLong) Test(org.junit.Test) AbstractRestServiceTest(eu.europa.ec.fisheries.uvms.docker.validation.common.AbstractRestServiceTest)

Example 2 with SpatialEnrichmentRS

use of eu.europa.ec.fisheries.uvms.spatial.model.schemas.SpatialEnrichmentRS in project UVMS-Docker by UnionVMS.

the class SpatialJmsPerformanceIT method createSpatialEnrichmentRequestPerformanceTest.

/**
 * Creates the spatial enrichment request performance test.
 *
 * @throws Exception the exception
 */
@Test
@PerfTest(threads = 2, duration = 10000)
@Required(max = 6900, average = 2500, percentile95 = 2500, throughput = 1)
public void createSpatialEnrichmentRequestPerformanceTest() throws Exception {
    LatLong position = createRutt.get(ThreadLocalRandom.current().nextInt(0, 30));
    SpatialEnrichmentRQ spatialEnrichmentRQ = new SpatialEnrichmentRQ();
    AreaTypes areaTypes = new AreaTypes();
    areaTypes.getAreaTypes().add(AreaType.COUNTRY);
    areaTypes.getAreaTypes().add(AreaType.PORT);
    areaTypes.getAreaTypes().add(AreaType.FMZ);
    spatialEnrichmentRQ.setAreaTypes(areaTypes);
    LocationTypes locationTypes = new LocationTypes();
    locationTypes.getLocationTypes().add(LocationType.PORT);
    spatialEnrichmentRQ.setLocationTypes(locationTypes);
    spatialEnrichmentRQ.setMethod(SpatialModuleMethod.GET_ENRICHMENT);
    spatialEnrichmentRQ.setUnit(UnitType.NAUTICAL_MILES);
    PointType pointType = new PointType();
    spatialEnrichmentRQ.setPoint(pointType);
    pointType.setLatitude(position.latitude);
    pointType.setLongitude(position.longitude);
    pointType.setCrs(4326);
    SpatialEnrichmentRS spatialEnrichmentRS = spatialHelper.createSpatialEnrichment(spatialEnrichmentRQ);
    assertNotNull(spatialEnrichmentRS);
}
Also used : LocationTypes(eu.europa.ec.fisheries.uvms.spatial.model.schemas.SpatialEnrichmentRQ.LocationTypes) SpatialEnrichmentRQ(eu.europa.ec.fisheries.uvms.spatial.model.schemas.SpatialEnrichmentRQ) AreaTypes(eu.europa.ec.fisheries.uvms.spatial.model.schemas.SpatialEnrichmentRQ.AreaTypes) SpatialEnrichmentRS(eu.europa.ec.fisheries.uvms.spatial.model.schemas.SpatialEnrichmentRS) PointType(eu.europa.ec.fisheries.uvms.spatial.model.schemas.PointType) LatLong(eu.europa.ec.fisheries.uvms.docker.validation.movement.LatLong) Required(org.databene.contiperf.Required) PerfTest(org.databene.contiperf.PerfTest) Test(org.junit.Test) AbstractRestServiceTest(eu.europa.ec.fisheries.uvms.docker.validation.common.AbstractRestServiceTest) PerfTest(org.databene.contiperf.PerfTest)

Example 3 with SpatialEnrichmentRS

use of eu.europa.ec.fisheries.uvms.spatial.model.schemas.SpatialEnrichmentRS in project UVMS-Docker by UnionVMS.

the class SpatialHelper method unMarshall.

public SpatialEnrichmentRS unMarshall(final Message response) throws Exception {
    TextMessage textMessage = (TextMessage) response;
    JAXBContext jaxbContext = JAXBContext.newInstance(SpatialEnrichmentRS.class);
    return (SpatialEnrichmentRS) jaxbContext.createUnmarshaller().unmarshal(new StringReader(textMessage.getText()));
}
Also used : SpatialEnrichmentRS(eu.europa.ec.fisheries.uvms.spatial.model.schemas.SpatialEnrichmentRS) StringReader(java.io.StringReader) JAXBContext(javax.xml.bind.JAXBContext) TextMessage(javax.jms.TextMessage)

Example 4 with SpatialEnrichmentRS

use of eu.europa.ec.fisheries.uvms.spatial.model.schemas.SpatialEnrichmentRS in project UVMS-Docker by UnionVMS.

the class SpatialJmsIT method createSpatialEnrichmentRequestTest.

/**
 * Creates the spatial enrichment request test.
 *
 * @throws Exception the exception
 */
@Test(timeout = 10000)
public void createSpatialEnrichmentRequestTest() throws Exception {
    LatLong position = movementHelper.createRutt(1).get(0);
    SpatialEnrichmentRQ spatialEnrichmentRQ = new SpatialEnrichmentRQ();
    AreaTypes areaTypes = new AreaTypes();
    areaTypes.getAreaTypes().add(AreaType.COUNTRY);
    areaTypes.getAreaTypes().add(AreaType.PORT);
    areaTypes.getAreaTypes().add(AreaType.FMZ);
    spatialEnrichmentRQ.setAreaTypes(areaTypes);
    LocationTypes locationTypes = new LocationTypes();
    locationTypes.getLocationTypes().add(LocationType.PORT);
    spatialEnrichmentRQ.setLocationTypes(locationTypes);
    spatialEnrichmentRQ.setMethod(SpatialModuleMethod.GET_ENRICHMENT);
    spatialEnrichmentRQ.setUnit(UnitType.NAUTICAL_MILES);
    PointType pointType = new PointType();
    spatialEnrichmentRQ.setPoint(pointType);
    pointType.setLatitude(position.latitude);
    pointType.setLongitude(position.longitude);
    pointType.setCrs(4326);
    SpatialEnrichmentRS spatialEnrichmentRS = spatialHelper.createSpatialEnrichment(spatialEnrichmentRQ);
    assertNotNull(spatialEnrichmentRS);
}
Also used : LocationTypes(eu.europa.ec.fisheries.uvms.spatial.model.schemas.SpatialEnrichmentRQ.LocationTypes) SpatialEnrichmentRQ(eu.europa.ec.fisheries.uvms.spatial.model.schemas.SpatialEnrichmentRQ) AreaTypes(eu.europa.ec.fisheries.uvms.spatial.model.schemas.SpatialEnrichmentRQ.AreaTypes) SpatialEnrichmentRS(eu.europa.ec.fisheries.uvms.spatial.model.schemas.SpatialEnrichmentRS) PointType(eu.europa.ec.fisheries.uvms.spatial.model.schemas.PointType) LatLong(eu.europa.ec.fisheries.uvms.docker.validation.movement.LatLong) Test(org.junit.Test) AbstractRestServiceTest(eu.europa.ec.fisheries.uvms.docker.validation.common.AbstractRestServiceTest)

Aggregations

SpatialEnrichmentRS (eu.europa.ec.fisheries.uvms.spatial.model.schemas.SpatialEnrichmentRS)4 AbstractRestServiceTest (eu.europa.ec.fisheries.uvms.docker.validation.common.AbstractRestServiceTest)3 LatLong (eu.europa.ec.fisheries.uvms.docker.validation.movement.LatLong)3 PointType (eu.europa.ec.fisheries.uvms.spatial.model.schemas.PointType)3 SpatialEnrichmentRQ (eu.europa.ec.fisheries.uvms.spatial.model.schemas.SpatialEnrichmentRQ)3 AreaTypes (eu.europa.ec.fisheries.uvms.spatial.model.schemas.SpatialEnrichmentRQ.AreaTypes)3 LocationTypes (eu.europa.ec.fisheries.uvms.spatial.model.schemas.SpatialEnrichmentRQ.LocationTypes)3 Test (org.junit.Test)3 StringReader (java.io.StringReader)1 TextMessage (javax.jms.TextMessage)1 JAXBContext (javax.xml.bind.JAXBContext)1 PerfTest (org.databene.contiperf.PerfTest)1 Required (org.databene.contiperf.Required)1