Search in sources :

Example 11 with Asset

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

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

the class ExchangeLogRestIT method getPollStatusRefGuidTest.

/**
 * Gets the poll status ref guid test.
 *
 * @return the poll status ref guid test
 * @throws Exception the exception
 */
@Test
public void getPollStatusRefGuidTest() throws Exception {
    Asset testAsset = AssetTestHelper.createTestAsset();
    Map<String, Object> programPollDataMap = MobileTerminalTestHelper.createPoll_Helper(testAsset);
    ArrayList sendPolls = (ArrayList) programPollDataMap.get("sentPolls");
    String uid = (String) sendPolls.get(0);
    final HttpResponse response = Request.Get(getBaseUrl() + "exchange/rest/exchange/poll/" + uid).setHeader("Content-Type", "application/json").setHeader("Authorization", getValidJwtToken()).execute().returnResponse();
    Map<String, Object> dataMap = checkSuccessResponseReturnMap(response);
    assertNotNull(uid, dataMap.get("guid"));
}
Also used : ArrayList(java.util.ArrayList) Asset(eu.europa.ec.fisheries.wsdl.asset.types.Asset) HttpResponse(org.apache.http.HttpResponse) Test(org.junit.Test) AbstractRestServiceTest(eu.europa.ec.fisheries.uvms.docker.validation.common.AbstractRestServiceTest)

Example 13 with Asset

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

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

the class AssetTestHelper method createTestAsset.

// ************************************************
// AssetResource
// ************************************************
public static Asset createTestAsset() throws IOException, ClientProtocolException, JsonProcessingException, JsonParseException, JsonMappingException {
    Asset asset = createDummyAsset(AssetIdType.CFR);
    final HttpResponse response = Request.Post(getBaseUrl() + "asset/rest/asset").setHeader("Content-Type", "application/json").setHeader("Authorization", getValidJwtToken()).bodyByteArray(writeValueAsString(asset).getBytes()).execute().returnResponse();
    return checkSuccessResponseReturnObject(response, Asset.class);
}
Also used : Asset(eu.europa.ec.fisheries.wsdl.asset.types.Asset) HttpResponse(org.apache.http.HttpResponse)

Example 15 with Asset

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

the class AssetTestHelper method createCfrTestAsset.

public static Asset createCfrTestAsset() throws IOException, ClientProtocolException, JsonProcessingException, JsonParseException, JsonMappingException {
    Asset asset = createDummyCFRAsset();
    final HttpResponse response = Request.Post(getBaseUrl() + "asset/rest/asset").setHeader("Content-Type", "application/json").setHeader("Authorization", getValidJwtToken()).bodyByteArray(writeValueAsString(asset).getBytes()).execute().returnResponse();
    return checkSuccessResponseReturnObject(response, Asset.class);
}
Also used : Asset(eu.europa.ec.fisheries.wsdl.asset.types.Asset) HttpResponse(org.apache.http.HttpResponse)

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