Search in sources :

Example 16 with MobileTerminalType

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

the class MovementJmsIT method createRouteTestVarbergGrena.

@Test
public void createRouteTestVarbergGrena() throws Exception {
    Asset 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);
    }
}
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 17 with MobileTerminalType

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

the class MovementJmsIT method createRouteAddPositionsInRandomOrder.

@Test
public void createRouteAddPositionsInRandomOrder() throws Exception {
    // currently there is no way to check if randomly added positions
    // actually is processed ok
    // so we say its ok just to add them for now . . .
    int NUMBER_OF_POSITIONS = 5;
    Asset testAsset = AssetTestHelper.createTestAsset();
    MobileTerminalType mobileTerminalType = MobileTerminalTestHelper.createMobileTerminalType();
    MobileTerminalTestHelper.assignMobileTerminal(testAsset, mobileTerminalType);
    List<LatLong> route = movementHelper.createRuttVarbergGrena(NUMBER_OF_POSITIONS);
    // shake the content so it is not in a deterministic order
    List<LatLong> routeBeforeShake = new ArrayList<>(route);
    Collections.shuffle(route);
    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) ArrayList(java.util.ArrayList) 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 18 with MobileTerminalType

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

the class MovementJmsIT method createRouteTestTitanic.

@Test
public void createRouteTestTitanic() throws Exception {
    Asset testAsset = AssetTestHelper.createTestAsset();
    MobileTerminalType mobileTerminalType = MobileTerminalTestHelper.createMobileTerminalType();
    MobileTerminalTestHelper.assignMobileTerminal(testAsset, mobileTerminalType);
    List<LatLong> route = movementHelper.createRuttCobhNewYork(-1, 0.4f);
    for (LatLong position : route) {
        final CreateMovementRequest createMovementRequest = movementHelper.createMovementRequest(testAsset, mobileTerminalType, position);
        CreateMovementResponse createMovementResponse = movementHelper.createMovement(testAsset, mobileTerminalType, createMovementRequest);
        assertNotNull(createMovementResponse);
    }
}
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 19 with MobileTerminalType

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

the class SetMovementReportRequestJmsIT method setMovementReportRequestRouteTest.

/**
 * Sets the movement report request route test.
 *
 * @throws Exception
 *             the exception
 */
@Test(timeout = 25000)
public void setMovementReportRequestRouteTest() throws Exception {
    Asset testAsset = AssetTestHelper.createTestAsset();
    MobileTerminalType mobileTerminalType = MobileTerminalTestHelper.createMobileTerminalType();
    MobileTerminalTestHelper.assignMobileTerminal(testAsset, mobileTerminalType);
    List<LatLong> latLongList = movementHelper.createRutt(2);
    for (LatLong latLong : latLongList) {
        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 20 with MobileTerminalType

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

the class MobileTerminalRestIT method unAssignMobileTerminalTest.

/**
 * Un assign mobile terminal test.
 *
 * @throws Exception
 *             the exception
 */
@Test
public void unAssignMobileTerminalTest() throws Exception {
    Asset testAsset = AssetTestHelper.createTestAsset();
    MobileTerminalType createdMobileTerminalType = MobileTerminalTestHelper.createMobileTerminalType();
    MobileTerminalAssignQuery mobileTerminalAssignQuery = new MobileTerminalAssignQuery();
    mobileTerminalAssignQuery.setMobileTerminalId(createdMobileTerminalType.getMobileTerminalId());
    mobileTerminalAssignQuery.setConnectId(testAsset.getAssetId().getGuid());
    {
        // Assign first
        final HttpResponse response = Request.Post(getBaseUrl() + "mobileterminal/rest/mobileterminal/assign?comment=comment").setHeader("Content-Type", "application/json").setHeader("Authorization", getValidJwtToken()).bodyByteArray(writeValueAsString(mobileTerminalAssignQuery).getBytes()).execute().returnResponse();
        Map<String, Object> dataMap = checkSuccessResponseReturnMap(response);
    }
    final HttpResponse response = Request.Post(getBaseUrl() + "mobileterminal/rest/mobileterminal/unassign?comment=comment").setHeader("Content-Type", "application/json").setHeader("Authorization", getValidJwtToken()).bodyByteArray(writeValueAsString(mobileTerminalAssignQuery).getBytes()).execute().returnResponse();
    Map<String, Object> dataMap = checkSuccessResponseReturnMap(response);
}
Also used : Asset(eu.europa.ec.fisheries.wsdl.asset.types.Asset) HttpResponse(org.apache.http.HttpResponse) MobileTerminalAssignQuery(eu.europa.ec.fisheries.schema.mobileterminal.types.v1.MobileTerminalAssignQuery) MobileTerminalType(eu.europa.ec.fisheries.schema.mobileterminal.types.v1.MobileTerminalType) Map(java.util.Map) 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