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);
}
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"));
}
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)));
}
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);
}
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);
}
Aggregations