Search in sources :

Example 1 with CreateMovementResponse

use of eu.europa.ec.fisheries.schema.movement.module.v1.CreateMovementResponse in project UVMS-Docker by UnionVMS.

the class ReportingRestIT method createTestAssetWithTerminalAndPositions.

/**
 * Creates the test asset with terminal and positions.
 */
@BeforeClass
public static void createTestAssetWithTerminalAndPositions() {
    try {
        testAsset = AssetTestHelper.createTestAsset();
        MobileTerminalType mobileTerminalType = MobileTerminalTestHelper.createMobileTerminalType();
        MobileTerminalTestHelper.assignMobileTerminal(testAsset, mobileTerminalType);
        List<LatLong> route = movementHelper.createRuttVarbergGrena(-1);
        for (LatLong position : route) {
            final CreateMovementRequest createMovementRequest = movementHelper.createMovementRequest(testAsset, mobileTerminalType, position);
            CreateMovementResponse createMovementResponse = movementHelper.createMovement(testAsset, mobileTerminalType, createMovementRequest);
            assertNotNull(createMovementResponse);
        }
    } catch (Exception e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}
Also used : CreateMovementRequest(eu.europa.ec.fisheries.schema.movement.module.v1.CreateMovementRequest) CreateMovementResponse(eu.europa.ec.fisheries.schema.movement.module.v1.CreateMovementResponse) MobileTerminalType(eu.europa.ec.fisheries.schema.mobileterminal.types.v1.MobileTerminalType) LatLong(eu.europa.ec.fisheries.uvms.docker.validation.movement.LatLong) ClientProtocolException(org.apache.http.client.ClientProtocolException) JsonParseException(com.fasterxml.jackson.core.JsonParseException) IOException(java.io.IOException) JsonProcessingException(com.fasterxml.jackson.core.JsonProcessingException) JsonMappingException(com.fasterxml.jackson.databind.JsonMappingException) BeforeClass(org.junit.BeforeClass)

Example 2 with CreateMovementResponse

use of eu.europa.ec.fisheries.schema.movement.module.v1.CreateMovementResponse in project UVMS-Docker by UnionVMS.

the class MovementHelper method unMarshallCreateMovementResponse.

/**
 * Un marshall create movement response.
 *
 * @param response the response
 * @return the creates the movement response
 * @throws Exception the exception
 */
public CreateMovementResponse unMarshallCreateMovementResponse(final Message response) throws Exception {
    TextMessage textMessage = (TextMessage) response;
    JAXBContext jaxbContext = JAXBContext.newInstance(CreateMovementResponse.class);
    return (CreateMovementResponse) jaxbContext.createUnmarshaller().unmarshal(new StringReader(textMessage.getText()));
}
Also used : CreateMovementResponse(eu.europa.ec.fisheries.schema.movement.module.v1.CreateMovementResponse) StringReader(java.io.StringReader) JAXBContext(javax.xml.bind.JAXBContext) TextMessage(javax.jms.TextMessage)

Example 3 with CreateMovementResponse

use of eu.europa.ec.fisheries.schema.movement.module.v1.CreateMovementResponse in project UVMS-Docker by UnionVMS.

the class MovementJmsIT method createSmallFishingTourFromVarberg.

@Test
public void createSmallFishingTourFromVarberg() throws Exception {
    Asset testAsset = AssetTestHelper.createTestAsset();
    MobileTerminalType mobileTerminalType = MobileTerminalTestHelper.createMobileTerminalType();
    MobileTerminalTestHelper.assignMobileTerminal(testAsset, mobileTerminalType);
    List<LatLong> route = movementHelper.createSmallFishingTourFromVarberg();
    List<CreateMovementResponse> fromAPI = new ArrayList<>();
    for (LatLong position : route) {
        final CreateMovementRequest createMovementRequest = movementHelper.createMovementRequest(testAsset, mobileTerminalType, position);
        CreateMovementResponse createMovementResponse = movementHelper.createMovement(testAsset, mobileTerminalType, createMovementRequest);
        assertNotNull(createMovementResponse);
        assertNotNull(createMovementResponse.getMovement());
        assertNotNull(createMovementResponse.getMovement().getPosition());
        fromAPI.add(createMovementResponse);
    }
}
Also used : CreateMovementRequest(eu.europa.ec.fisheries.schema.movement.module.v1.CreateMovementRequest) CreateMovementResponse(eu.europa.ec.fisheries.schema.movement.module.v1.CreateMovementResponse) ArrayList(java.util.ArrayList) Asset(eu.europa.ec.fisheries.wsdl.asset.types.Asset) MobileTerminalType(eu.europa.ec.fisheries.schema.mobileterminal.types.v1.MobileTerminalType) Test(org.junit.Test) AbstractRestServiceTest(eu.europa.ec.fisheries.uvms.docker.validation.common.AbstractRestServiceTest)

Example 4 with CreateMovementResponse

use of eu.europa.ec.fisheries.schema.movement.module.v1.CreateMovementResponse in project UVMS-Docker by UnionVMS.

the class MovementJmsIT method createMovementRequestTest.

/**
 * Creates the movement request test.
 *
 * @throws Exception
 *             the exception
 */
@Test(timeout = 10000)
public void createMovementRequestTest() throws Exception {
    Asset testAsset = AssetTestHelper.createTestAsset();
    MobileTerminalType mobileTerminalType = MobileTerminalTestHelper.createMobileTerminalType();
    MobileTerminalTestHelper.assignMobileTerminal(testAsset, mobileTerminalType);
    LatLong latLong = movementHelper.createRutt(1).get(0);
    final CreateMovementRequest createMovementRequest = movementHelper.createMovementRequest(testAsset, mobileTerminalType, latLong);
    CreateMovementResponse createMovementResponse = movementHelper.createMovement(testAsset, mobileTerminalType, createMovementRequest);
    assertNotNull(createMovementResponse);
    assertEquals(null, createMovementResponse.getMovement().getCalculatedCourse());
    assertEquals(null, createMovementResponse.getMovement().getCalculatedSpeed());
    assertFalse(createMovementResponse.getMovement().getMetaData().getAreas().isEmpty());
    assertEquals(createMovementRequest.getMovement().getPosition().getLongitude(), createMovementResponse.getMovement().getPosition().getLongitude());
    assertEquals(createMovementRequest.getMovement().getPosition().getLatitude(), createMovementResponse.getMovement().getPosition().getLatitude());
// assertEquals(createMovementRequest.getMovement().getPosition().getAltitude(),createMovementResponse.getMovement().getPosition().getAltitude());
}
Also used : CreateMovementRequest(eu.europa.ec.fisheries.schema.movement.module.v1.CreateMovementRequest) CreateMovementResponse(eu.europa.ec.fisheries.schema.movement.module.v1.CreateMovementResponse) Asset(eu.europa.ec.fisheries.wsdl.asset.types.Asset) MobileTerminalType(eu.europa.ec.fisheries.schema.mobileterminal.types.v1.MobileTerminalType) Test(org.junit.Test) AbstractRestServiceTest(eu.europa.ec.fisheries.uvms.docker.validation.common.AbstractRestServiceTest)

Example 5 with CreateMovementResponse

use of eu.europa.ec.fisheries.schema.movement.module.v1.CreateMovementResponse in project UVMS-Docker by UnionVMS.

the class MovementJmsIT method createMovementBatchRequestTest.

@Test
public void createMovementBatchRequestTest() throws Exception {
    Asset testAsset = AssetTestHelper.createTestAsset();
    MobileTerminalType mobileTerminalType = MobileTerminalTestHelper.createMobileTerminalType();
    MobileTerminalTestHelper.assignMobileTerminal(testAsset, mobileTerminalType);
    List<LatLong> latLongList = movementHelper.createRuttCobhNewYork(ALL, 0.4f);
    final CreateMovementBatchRequest createMovementBatchRequest = movementHelper.createMovementBatchRequest(testAsset, mobileTerminalType, latLongList);
    CreateMovementBatchResponse createMovementResponse = movementHelper.createMovementBatch(testAsset, mobileTerminalType, createMovementBatchRequest);
}
Also used : Asset(eu.europa.ec.fisheries.wsdl.asset.types.Asset) CreateMovementBatchRequest(eu.europa.ec.fisheries.schema.movement.module.v1.CreateMovementBatchRequest) CreateMovementBatchResponse(eu.europa.ec.fisheries.schema.movement.module.v1.CreateMovementBatchResponse) MobileTerminalType(eu.europa.ec.fisheries.schema.mobileterminal.types.v1.MobileTerminalType) Test(org.junit.Test) AbstractRestServiceTest(eu.europa.ec.fisheries.uvms.docker.validation.common.AbstractRestServiceTest)

Aggregations

MobileTerminalType (eu.europa.ec.fisheries.schema.mobileterminal.types.v1.MobileTerminalType)11 CreateMovementResponse (eu.europa.ec.fisheries.schema.movement.module.v1.CreateMovementResponse)11 CreateMovementRequest (eu.europa.ec.fisheries.schema.movement.module.v1.CreateMovementRequest)10 AbstractRestServiceTest (eu.europa.ec.fisheries.uvms.docker.validation.common.AbstractRestServiceTest)10 Asset (eu.europa.ec.fisheries.wsdl.asset.types.Asset)10 Test (org.junit.Test)10 ArrayList (java.util.ArrayList)4 HttpResponse (org.apache.http.HttpResponse)3 Date (java.util.Date)2 JsonParseException (com.fasterxml.jackson.core.JsonParseException)1 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)1 JsonMappingException (com.fasterxml.jackson.databind.JsonMappingException)1 CreateMovementBatchRequest (eu.europa.ec.fisheries.schema.movement.module.v1.CreateMovementBatchRequest)1 CreateMovementBatchResponse (eu.europa.ec.fisheries.schema.movement.module.v1.CreateMovementBatchResponse)1 LatLong (eu.europa.ec.fisheries.uvms.docker.validation.movement.LatLong)1 MovementDTO (eu.europa.ec.fisheries.uvms.reporting.service.dto.MovementDTO)1 IOException (java.io.IOException)1 StringReader (java.io.StringReader)1 List (java.util.List)1 TextMessage (javax.jms.TextMessage)1