Search in sources :

Example 6 with Asset

use of eu.europa.ec.fisheries.wsdl.asset.types.Asset 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 7 with Asset

use of eu.europa.ec.fisheries.wsdl.asset.types.Asset 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 8 with Asset

use of eu.europa.ec.fisheries.wsdl.asset.types.Asset 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)

Example 9 with Asset

use of eu.europa.ec.fisheries.wsdl.asset.types.Asset 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)

Example 10 with Asset

use of eu.europa.ec.fisheries.wsdl.asset.types.Asset in project UVMS-Docker by UnionVMS.

the class MovementMovementRestIT method getLatestMovementsTest.

/**
 * Gets the latest movements test.
 *
 * @return the latest movements test
 * @throws Exception
 *             the exception
 */
@Test
public void getLatestMovementsTest() throws Exception {
    Asset testAsset = AssetTestHelper.createTestAsset();
    MobileTerminalType mobileTerminalType = MobileTerminalTestHelper.createMobileTerminalType();
    Map<String, Object> assignedMap = MobileTerminalTestHelper.assignMobileTerminal(testAsset, mobileTerminalType);
    LatLong latLong = new LatLong(16.9, 32.6333333, new Date(System.currentTimeMillis()));
    CreateMovementRequest createMovementRequest = movementHelper.createMovementRequest(testAsset, mobileTerminalType, latLong);
    CreateMovementResponse createMovementResponse = movementHelper.createMovement(testAsset, mobileTerminalType, createMovementRequest);
    // give it some time to execute before retrieving. TODO: Remove the functionality and this horrible test
    Thread.sleep(10000);
    final HttpResponse response = Request.Get(getBaseUrl() + "movement/rest/movement/latest/100").setHeader("Content-Type", "application/json").setHeader("Authorization", getValidJwtToken()).execute().returnResponse();
    List dataList = checkSuccessResponseReturnType(response, List.class);
    assertTrue(dataList.size() > 0);
}
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) ArrayList(java.util.ArrayList) List(java.util.List) MobileTerminalType(eu.europa.ec.fisheries.schema.mobileterminal.types.v1.MobileTerminalType) Date(java.util.Date) Test(org.junit.Test) AbstractRestServiceTest(eu.europa.ec.fisheries.uvms.docker.validation.common.AbstractRestServiceTest)

Aggregations

Asset (eu.europa.ec.fisheries.wsdl.asset.types.Asset)61 Test (org.junit.Test)54 AbstractRestServiceTest (eu.europa.ec.fisheries.uvms.docker.validation.common.AbstractRestServiceTest)38 MobileTerminalType (eu.europa.ec.fisheries.schema.mobileterminal.types.v1.MobileTerminalType)15 ArrayList (java.util.ArrayList)14 HttpResponse (org.apache.http.HttpResponse)14 AssetListQuery (eu.europa.ec.fisheries.wsdl.asset.types.AssetListQuery)13 AssetListCriteriaPair (eu.europa.ec.fisheries.wsdl.asset.types.AssetListCriteriaPair)12 CreateMovementRequest (eu.europa.ec.fisheries.schema.movement.module.v1.CreateMovementRequest)11 CreateMovementResponse (eu.europa.ec.fisheries.schema.movement.module.v1.CreateMovementResponse)9 ListAssetResponse (eu.europa.ec.fisheries.wsdl.asset.types.ListAssetResponse)8 Date (java.util.Date)5 AssetGroup (eu.europa.ec.fisheries.wsdl.asset.group.AssetGroup)4 AssetGroupSearchField (eu.europa.ec.fisheries.wsdl.asset.group.AssetGroupSearchField)4 Map (java.util.Map)4 AssetIdentifierDto (eu.europa.ec.fisheries.ers.service.dto.AssetIdentifierDto)3 List (java.util.List)3 VesselDetailsDTO (eu.europa.ec.fisheries.ers.service.dto.fareport.details.VesselDetailsDTO)2 ServiceException (eu.europa.ec.fisheries.uvms.commons.service.exception.ServiceException)2 LatLong (eu.europa.ec.fisheries.uvms.docker.validation.movement.LatLong)2