Search in sources :

Example 6 with MobileTerminalType

use of eu.europa.ec.fisheries.schema.mobileterminal.types.v1.MobileTerminalType 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 7 with MobileTerminalType

use of eu.europa.ec.fisheries.schema.mobileterminal.types.v1.MobileTerminalType 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)

Example 8 with MobileTerminalType

use of eu.europa.ec.fisheries.schema.mobileterminal.types.v1.MobileTerminalType in project UVMS-Docker by UnionVMS.

the class MovementMovementRestIT method getLatestMovementsByConnectIdsTest.

/**
 * Gets the latest movements by connect ids test.
 *
 * @return the latest movements by connect ids test
 * @throws Exception
 *             the exception
 */
@Test
public void getLatestMovementsByConnectIdsTest() throws Exception {
    Asset testAsset = AssetTestHelper.createTestAsset();
    MobileTerminalType mobileTerminalType = MobileTerminalTestHelper.createMobileTerminalType();
    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);
    List<String> connectIds = new ArrayList<>();
    assertNotNull(createMovementResponse);
    assertNotNull(createMovementResponse.getMovement());
    assertNotNull(createMovementResponse.getMovement().getConnectId());
    String connectId = createMovementResponse.getMovement().getConnectId();
    connectIds.add(connectId);
    // give it some time to execute before retrieving TODO: Remove the functionality and this horrible test
    Thread.sleep(10000);
    final HttpResponse response = Request.Post(getBaseUrl() + "movement/rest/movement/latest").setHeader("Content-Type", "application/json").setHeader("Authorization", getValidJwtToken()).bodyByteArray(writeValueAsString(connectIds).getBytes()).execute().returnResponse();
    List<MovementDTO> dataList = checkSuccessResponseReturnType(response, ArrayList.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) ArrayList(java.util.ArrayList) MovementDTO(eu.europa.ec.fisheries.uvms.reporting.service.dto.MovementDTO) Asset(eu.europa.ec.fisheries.wsdl.asset.types.Asset) HttpResponse(org.apache.http.HttpResponse) 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)

Example 9 with MobileTerminalType

use of eu.europa.ec.fisheries.schema.mobileterminal.types.v1.MobileTerminalType in project UVMS-Docker by UnionVMS.

the class SetMovementReportRequestJmsIT method setMovementReportRequestTest.

/**
 * Creates the movement request test.
 *
 * @throws Exception
 *             the exception
 */
@Test(timeout = 5000)
public void setMovementReportRequestTest() 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);
    MessageHelper.sendMessage("UVMSExchangeEvent", marshall(createSetReportMovementType(testAsset, mobileTerminalType, createMovementRequest)));
}
Also used : CreateMovementRequest(eu.europa.ec.fisheries.schema.movement.module.v1.CreateMovementRequest) Asset(eu.europa.ec.fisheries.wsdl.asset.types.Asset) MobileTerminalType(eu.europa.ec.fisheries.schema.mobileterminal.types.v1.MobileTerminalType) 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 10 with MobileTerminalType

use of eu.europa.ec.fisheries.schema.mobileterminal.types.v1.MobileTerminalType in project UVMS-Docker by UnionVMS.

the class MobileTerminalRestIT method setStatusActiveTest.

/**
 * Sets the status active test.
 *
 * @throws Exception
 *             the exception
 */
@Test
public void setStatusActiveTest() throws Exception {
    MobileTerminalType createdMobileTerminalType = MobileTerminalTestHelper.createMobileTerminalType();
    final HttpResponse response = Request.Put(getBaseUrl() + "mobileterminal/rest/mobileterminal/status/activate?comment=comment").setHeader("Content-Type", "application/json").setHeader("Authorization", getValidJwtToken()).bodyByteArray(writeValueAsString(createdMobileTerminalType.getMobileTerminalId()).getBytes()).execute().returnResponse();
    Map<String, Object> dataMap = checkSuccessResponseReturnMap(response);
}
Also used : HttpResponse(org.apache.http.HttpResponse) MobileTerminalType(eu.europa.ec.fisheries.schema.mobileterminal.types.v1.MobileTerminalType) Test(org.junit.Test)

Aggregations

MobileTerminalType (eu.europa.ec.fisheries.schema.mobileterminal.types.v1.MobileTerminalType)24 Test (org.junit.Test)21 Asset (eu.europa.ec.fisheries.wsdl.asset.types.Asset)15 HttpResponse (org.apache.http.HttpResponse)14 AbstractRestServiceTest (eu.europa.ec.fisheries.uvms.docker.validation.common.AbstractRestServiceTest)13 CreateMovementRequest (eu.europa.ec.fisheries.schema.movement.module.v1.CreateMovementRequest)12 CreateMovementResponse (eu.europa.ec.fisheries.schema.movement.module.v1.CreateMovementResponse)10 ArrayList (java.util.ArrayList)6 MobileTerminalAssignQuery (eu.europa.ec.fisheries.schema.mobileterminal.types.v1.MobileTerminalAssignQuery)3 LatLong (eu.europa.ec.fisheries.uvms.docker.validation.movement.LatLong)3 Date (java.util.Date)3 Map (java.util.Map)3 MobileTerminalAttribute (eu.europa.ec.fisheries.schema.mobileterminal.types.v1.MobileTerminalAttribute)2 List (java.util.List)2 JsonParseException (com.fasterxml.jackson.core.JsonParseException)1 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)1 JsonMappingException (com.fasterxml.jackson.databind.JsonMappingException)1 PollAttribute (eu.europa.ec.fisheries.schema.mobileterminal.polltypes.v1.PollAttribute)1 PollAttributeType (eu.europa.ec.fisheries.schema.mobileterminal.polltypes.v1.PollAttributeType)1 PollMobileTerminal (eu.europa.ec.fisheries.schema.mobileterminal.polltypes.v1.PollMobileTerminal)1