use of eu.europa.ec.fisheries.schema.movement.module.v1.CreateMovementRequest in project UVMS-Docker by UnionVMS.
the class ReportingRestIT method createTestAssetWithTerminalAndPositions.
/**
* Creates the test asset with terminal and positions.
*/
@BeforeClass
public static void createTestAssetWithTerminalAndPositions() {
try {
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);
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
use of eu.europa.ec.fisheries.schema.movement.module.v1.CreateMovementRequest in project UVMS-Docker by UnionVMS.
the class MovementHelper method createMovementRequest.
public CreateMovementRequest createMovementRequest(Asset testAsset, MobileTerminalType mobileTerminalType, LatLong latlong) throws IOException, ClientProtocolException, JsonProcessingException, JsonParseException, JsonMappingException {
// Date positionTime = new Date(System.currentTimeMillis());
final CreateMovementRequest createMovementRequest1 = new CreateMovementRequest();
final MovementBaseType movementBaseType = new MovementBaseType();
AssetId assetId = new AssetId();
assetId.setAssetType(AssetType.VESSEL);
assetId.setIdType(AssetIdType.GUID);
assetId.setValue(testAsset.getAssetId().getGuid());
movementBaseType.setAssetId(assetId);
movementBaseType.setConnectId(mobileTerminalType.getConnectId());
MovementActivityType movementActivityType = new MovementActivityType();
movementBaseType.setActivity(movementActivityType);
movementActivityType.setMessageId(UUID.randomUUID().toString());
movementActivityType.setMessageType(MovementActivityTypeType.ANC);
createMovementRequest1.setMovement(movementBaseType);
createMovementRequest1.setMethod(MovementModuleMethod.CREATE);
createMovementRequest1.setUsername("vms_admin_com");
MovementPoint movementPoint = new MovementPoint();
movementPoint.setLongitude(latlong.longitude);
movementPoint.setLatitude(latlong.latitude);
movementPoint.setAltitude((double) 5);
movementBaseType.setPosition(movementPoint);
movementBaseType.setPositionTime(latlong.positionTime);
movementBaseType.setMovementType(MovementTypeType.POS);
movementBaseType.setReportedCourse(latlong.bearing);
movementBaseType.setReportedSpeed(latlong.speed);
return createMovementRequest1;
}
use of eu.europa.ec.fisheries.schema.movement.module.v1.CreateMovementRequest 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);
}
}
use of eu.europa.ec.fisheries.schema.movement.module.v1.CreateMovementRequest 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());
}
use of eu.europa.ec.fisheries.schema.movement.module.v1.CreateMovementRequest 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);
}
Aggregations