Search in sources :

Example 1 with CreateMovementRequest

use of eu.europa.ec.fisheries.schema.movement.module.v1.CreateMovementRequest 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 CreateMovementRequest

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

the class MovementHelper method createMovementRequest.

public CreateMovementRequest createMovementRequest(Asset testAsset, MobileTerminalType mobileTerminalType, LatLong latlong) throws IOException, ClientProtocolException, JsonProcessingException, JsonParseException, JsonMappingException {
    // Date positionTime = new Date(System.currentTimeMillis());
    final CreateMovementRequest createMovementRequest1 = new CreateMovementRequest();
    final MovementBaseType movementBaseType = new MovementBaseType();
    AssetId assetId = new AssetId();
    assetId.setAssetType(AssetType.VESSEL);
    assetId.setIdType(AssetIdType.GUID);
    assetId.setValue(testAsset.getAssetId().getGuid());
    movementBaseType.setAssetId(assetId);
    movementBaseType.setConnectId(mobileTerminalType.getConnectId());
    MovementActivityType movementActivityType = new MovementActivityType();
    movementBaseType.setActivity(movementActivityType);
    movementActivityType.setMessageId(UUID.randomUUID().toString());
    movementActivityType.setMessageType(MovementActivityTypeType.ANC);
    createMovementRequest1.setMovement(movementBaseType);
    createMovementRequest1.setMethod(MovementModuleMethod.CREATE);
    createMovementRequest1.setUsername("vms_admin_com");
    MovementPoint movementPoint = new MovementPoint();
    movementPoint.setLongitude(latlong.longitude);
    movementPoint.setLatitude(latlong.latitude);
    movementPoint.setAltitude((double) 5);
    movementBaseType.setPosition(movementPoint);
    movementBaseType.setPositionTime(latlong.positionTime);
    movementBaseType.setMovementType(MovementTypeType.POS);
    movementBaseType.setReportedCourse(latlong.bearing);
    movementBaseType.setReportedSpeed(latlong.speed);
    return createMovementRequest1;
}
Also used : CreateMovementRequest(eu.europa.ec.fisheries.schema.movement.module.v1.CreateMovementRequest) MovementActivityType(eu.europa.ec.fisheries.schema.movement.v1.MovementActivityType) MovementBaseType(eu.europa.ec.fisheries.schema.movement.v1.MovementBaseType) MovementPoint(eu.europa.ec.fisheries.schema.movement.v1.MovementPoint) AssetId(eu.europa.ec.fisheries.schema.movement.asset.v1.AssetId)

Example 3 with CreateMovementRequest

use of eu.europa.ec.fisheries.schema.movement.module.v1.CreateMovementRequest 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 CreateMovementRequest

use of eu.europa.ec.fisheries.schema.movement.module.v1.CreateMovementRequest 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 CreateMovementRequest

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

the class MovementMovementRestIT method getByIdTest.

/**
 * Gets the by id test.
 *
 * @return the by id test
 * @throws Exception
 *             the exception
 */
@Test
public void getByIdTest() throws Exception {
    Asset testAsset = AssetTestHelper.createTestAsset();
    MobileTerminalType mobileTerminalType = MobileTerminalTestHelper.createMobileTerminalType();
    MobileTerminalTestHelper.assignMobileTerminal(testAsset, mobileTerminalType);
    LatLong latLong = movementHelper.createRutt(1).get(0);
    CreateMovementRequest createMovementRequest = movementHelper.createMovementRequest(testAsset, mobileTerminalType, latLong);
    CreateMovementResponse createMovementResponse = movementHelper.createMovement(testAsset, mobileTerminalType, createMovementRequest);
    assertNotNull(createMovementResponse);
    assertNotNull(createMovementResponse.getMovement());
    assertNotNull(createMovementResponse.getMovement().getGuid());
    String id = createMovementResponse.getMovement().getGuid();
    // give it some time to execute before retrieving
    Thread.sleep(10000);
    final HttpResponse response = Request.Get(getBaseUrl() + "movement/rest/movement/" + id).setHeader("Content-Type", "application/json").setHeader("Authorization", getValidJwtToken()).execute().returnResponse();
    Map<String, Object> map = checkSuccessResponseReturnMap(response);
    assertNotNull(map);
}
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) HttpResponse(org.apache.http.HttpResponse) 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

CreateMovementRequest (eu.europa.ec.fisheries.schema.movement.module.v1.CreateMovementRequest)13 MobileTerminalType (eu.europa.ec.fisheries.schema.mobileterminal.types.v1.MobileTerminalType)12 AbstractRestServiceTest (eu.europa.ec.fisheries.uvms.docker.validation.common.AbstractRestServiceTest)11 Asset (eu.europa.ec.fisheries.wsdl.asset.types.Asset)11 Test (org.junit.Test)11 CreateMovementResponse (eu.europa.ec.fisheries.schema.movement.module.v1.CreateMovementResponse)10 ArrayList (java.util.ArrayList)4 LatLong (eu.europa.ec.fisheries.uvms.docker.validation.movement.LatLong)3 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 AssetId (eu.europa.ec.fisheries.schema.movement.asset.v1.AssetId)1 MovementActivityType (eu.europa.ec.fisheries.schema.movement.v1.MovementActivityType)1 MovementBaseType (eu.europa.ec.fisheries.schema.movement.v1.MovementBaseType)1 MovementPoint (eu.europa.ec.fisheries.schema.movement.v1.MovementPoint)1 MovementDTO (eu.europa.ec.fisheries.uvms.reporting.service.dto.MovementDTO)1 IOException (java.io.IOException)1 List (java.util.List)1