use of eu.europa.ec.fisheries.schema.mobileterminal.types.v1.MobileTerminalType in project UVMS-Docker by UnionVMS.
the class FluxMessageReceiverBeanIT method postRequestTypeRequestSuccessTest.
/**
* Post request type request success test.
*
* @throws Exception the exception
*/
@Test
@Ignore
public void postRequestTypeRequestSuccessTest() throws Exception {
Asset testAsset = AssetTestHelper.createTestAsset();
MobileTerminalType mobileTerminalType = MobileTerminalTestHelper.createMobileTerminalType();
MobileTerminalTestHelper.assignMobileTerminal(testAsset, mobileTerminalType);
GregorianCalendar calendar = new GregorianCalendar();
calendar.setTime(new Date());
BridgeConnectorPortType bridgeConnectorPortType = createBridgeConnector();
RequestType requestType = new RequestType();
FLUXVesselPositionMessage fLUXVesselPositionMessage = new FLUXVesselPositionMessage();
VesselTransportMeansType vesselTransportMeansType = new VesselTransportMeansType();
IDType cfrId = new IDType();
cfrId.setSchemeID("CFR");
cfrId.setValue(testAsset.getCfr());
vesselTransportMeansType.getIDS().add(cfrId);
IDType ircsId = new IDType();
ircsId.setSchemeID("IRCS");
ircsId.setValue(testAsset.getIrcs());
vesselTransportMeansType.getIDS().add(ircsId);
// IDType extMarkingId = new IDType();
// extMarkingId.setSchemeID("EXT_MARKING");
// extMarkingId.setValue(testAsset.getExternalMarking());
// vesselTransportMeansType.getIDS().add(extMarkingId);
VesselCountryType vesselCountry = new VesselCountryType();
IDType countryId = new IDType();
countryId.setValue("SWE");
vesselCountry.setID(countryId);
vesselTransportMeansType.setRegistrationVesselCountry(vesselCountry);
VesselPositionEventType vesselPositionEventType = new VesselPositionEventType();
MeasureType measureType = new MeasureType();
measureType.setValue(new BigDecimal(282));
vesselPositionEventType.setCourseValueMeasure(measureType);
DateTimeType posDateTime = new DateTimeType();
posDateTime.setDateTime(DatatypeFactory.newInstance().newXMLGregorianCalendar(calendar));
vesselPositionEventType.setObtainedOccurrenceDateTime(posDateTime);
VesselGeographicalCoordinateType cordinates = new VesselGeographicalCoordinateType();
MeasureType longitude = new MeasureType();
longitude.setValue(new BigDecimal(21.5740000000));
cordinates.setLongitudeMeasure(longitude);
MeasureType latitude = new MeasureType();
latitude.setValue(new BigDecimal(59.6480000000));
cordinates.setLatitudeMeasure(latitude);
vesselPositionEventType.setSpecifiedVesselGeographicalCoordinate(cordinates);
MeasureType speedValue = new MeasureType();
speedValue.setValue(new BigDecimal(7.5));
vesselPositionEventType.setSpeedValueMeasure(speedValue);
CodeType typeCodeValue = new CodeType();
typeCodeValue.setValue("POS");
vesselPositionEventType.setTypeCode(typeCodeValue);
vesselTransportMeansType.getSpecifiedVesselPositionEvents().add(vesselPositionEventType);
fLUXVesselPositionMessage.setVesselTransportMeans(vesselTransportMeansType);
FLUXReportDocumentType fluxReportDocumentType = new FLUXReportDocumentType();
DateTimeType dateTimeType = new DateTimeType();
dateTimeType.setDateTime(DatatypeFactory.newInstance().newXMLGregorianCalendar(calendar));
fluxReportDocumentType.setCreationDateTime(dateTimeType);
FLUXPartyType fLUXPartyType = new FLUXPartyType();
fLUXPartyType.getIDS().add(countryId);
fluxReportDocumentType.setOwnerFLUXParty(fLUXPartyType);
TextType textType = new TextType();
fluxReportDocumentType.setPurpose(textType);
CodeType purposeCode = new CodeType();
purposeCode.setValue("9");
fluxReportDocumentType.setPurposeCode(purposeCode);
IDType idType = new IDType();
fluxReportDocumentType.setReferencedID(idType);
CodeType typeCode = new CodeType();
fluxReportDocumentType.setTypeCode(typeCode);
fLUXVesselPositionMessage.setFLUXReportDocument(fluxReportDocumentType);
requestType.setAny(createAnyElement(fLUXVesselPositionMessage));
requestType.setAD("SWE");
requestType.setAR(true);
requestType.setDF("df");
requestType.setON("on");
requestType.setTO(1234);
requestType.setTODT(DatatypeFactory.newInstance().newXMLGregorianCalendar(calendar));
ResponseType responseType = bridgeConnectorPortType.post(requestType);
assertNotNull(responseType);
assertEquals("OK", responseType.getStatus());
Thread.sleep(7500);
List<String> connectIds = new ArrayList<>();
connectIds.add(testAsset.getEventHistory().getEventId());
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 dataList = checkSuccessResponseReturnType(response, List.class);
assertEquals("Expect one position in movement db", 1, dataList.size());
}
use of eu.europa.ec.fisheries.schema.mobileterminal.types.v1.MobileTerminalType 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.mobileterminal.types.v1.MobileTerminalType 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.mobileterminal.types.v1.MobileTerminalType 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.mobileterminal.types.v1.MobileTerminalType in project UVMS-Docker by UnionVMS.
the class MovementJmsIT method createMovementBatchRequestTest.
@Test
public void createMovementBatchRequestTest() throws Exception {
Asset testAsset = AssetTestHelper.createTestAsset();
MobileTerminalType mobileTerminalType = MobileTerminalTestHelper.createMobileTerminalType();
MobileTerminalTestHelper.assignMobileTerminal(testAsset, mobileTerminalType);
List<LatLong> latLongList = movementHelper.createRuttCobhNewYork(ALL, 0.4f);
final CreateMovementBatchRequest createMovementBatchRequest = movementHelper.createMovementBatchRequest(testAsset, mobileTerminalType, latLongList);
CreateMovementBatchResponse createMovementResponse = movementHelper.createMovementBatch(testAsset, mobileTerminalType, createMovementBatchRequest);
}
Aggregations