use of eu.europa.ec.fisheries.schema.movement.v1.TempMovementType in project UVMS-Docker by UnionVMS.
the class TempMovementRestIT method createTempMovementTest.
/**
* Creates the temp test.
*
* @throws Exception the exception
*/
@Test
public void createTempMovementTest() throws Exception {
TempMovementType tempMovement = getTempMovement();
TempMovementType createdTempMovement = TempMovementRestHelper.createTempMovement(tempMovement);
assertTrue(createdTempMovement.getGuid() != null);
assertEquals(tempMovement.getAsset(), createdTempMovement.getAsset());
assertEquals(tempMovement.getCourse(), createdTempMovement.getCourse());
assertEquals(tempMovement.getPosition().getLatitude(), createdTempMovement.getPosition().getLatitude());
assertEquals(tempMovement.getPosition().getLongitude(), createdTempMovement.getPosition().getLongitude());
assertEquals(tempMovement.getSpeed(), createdTempMovement.getSpeed());
assertEquals(tempMovement.getState(), createdTempMovement.getState());
assertEquals(tempMovement.getTime(), createdTempMovement.getTime());
}
use of eu.europa.ec.fisheries.schema.movement.v1.TempMovementType in project UVMS-Docker by UnionVMS.
the class TempMovementRestIT method updateTempMovementTest.
@Test
public void updateTempMovementTest() throws Exception {
TempMovementType tempMovement = getTempMovement();
TempMovementType createdTempMovement = TempMovementRestHelper.createTempMovement(tempMovement);
Double newCourse = 123d;
createdTempMovement.setCourse(newCourse);
TempMovementType updatedTempMovement = TempMovementRestHelper.updateTempMovement(createdTempMovement);
assertEquals(createdTempMovement.getAsset(), updatedTempMovement.getAsset());
assertEquals(newCourse, updatedTempMovement.getCourse());
assertEquals(createdTempMovement.getPosition().getLatitude(), updatedTempMovement.getPosition().getLatitude());
assertEquals(createdTempMovement.getPosition().getLongitude(), updatedTempMovement.getPosition().getLongitude());
assertEquals(createdTempMovement.getSpeed(), updatedTempMovement.getSpeed());
assertEquals(createdTempMovement.getState(), updatedTempMovement.getState());
assertEquals(createdTempMovement.getTime(), updatedTempMovement.getTime());
}
use of eu.europa.ec.fisheries.schema.movement.v1.TempMovementType in project UVMS-Docker by UnionVMS.
the class TempMovementRestIT method removeTempMovementTest.
@Test
public void removeTempMovementTest() throws Exception {
TempMovementType tempMovement = getTempMovement();
TempMovementType createdTempMovement = TempMovementRestHelper.createTempMovement(tempMovement);
assertEquals(TempMovementStateEnum.SENT, createdTempMovement.getState());
TempMovementType removedTempMovement = TempMovementRestHelper.removeTempMovement(createdTempMovement.getGuid());
assertEquals(TempMovementStateEnum.DELETED, removedTempMovement.getState());
}
use of eu.europa.ec.fisheries.schema.movement.v1.TempMovementType in project UVMS-Docker by UnionVMS.
the class TempMovementRestIT method createTempMovementNoPositionShouldFail.
@Test
public void createTempMovementNoPositionShouldFail() throws Exception {
TempMovementType tempMovement = getTempMovement();
tempMovement.getPosition().setLatitude(null);
tempMovement.getPosition().setLongitude(null);
HttpResponse response = TempMovementRestHelper.createTempMovementResponse(tempMovement);
checkErrorResponse(response);
}
use of eu.europa.ec.fisheries.schema.movement.v1.TempMovementType in project UVMS-Docker by UnionVMS.
the class TempMovementRestIT method getTempMovement.
/**
* Creates the temp movement.
*
* @return the temp movement type
*/
private static TempMovementType getTempMovement() {
final VesselType vesselType = new VesselType();
vesselType.setCfr("T");
vesselType.setExtMarking("T");
vesselType.setFlagState("T");
vesselType.setIrcs("T");
vesselType.setName("T");
final MovementPoint movementPoint = new MovementPoint();
movementPoint.setAltitude(0.0);
movementPoint.setLatitude(0.0);
movementPoint.setLongitude(0.0);
final Date d = Calendar.getInstance().getTime();
final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss Z");
sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
final TempMovementType tempMovementType = new TempMovementType();
tempMovementType.setAsset(vesselType);
tempMovementType.setCourse(0.0);
tempMovementType.setPosition(movementPoint);
tempMovementType.setSpeed(0.0);
tempMovementType.setState(TempMovementStateEnum.SENT);
tempMovementType.setTime(sdf.format(d));
return tempMovementType;
}
Aggregations