Search in sources :

Example 1 with TempMovementType

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());
}
Also used : TempMovementType(eu.europa.ec.fisheries.schema.movement.v1.TempMovementType) Test(org.junit.Test) AbstractRestServiceTest(eu.europa.ec.fisheries.uvms.docker.validation.common.AbstractRestServiceTest)

Example 2 with TempMovementType

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());
}
Also used : TempMovementType(eu.europa.ec.fisheries.schema.movement.v1.TempMovementType) Test(org.junit.Test) AbstractRestServiceTest(eu.europa.ec.fisheries.uvms.docker.validation.common.AbstractRestServiceTest)

Example 3 with TempMovementType

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());
}
Also used : TempMovementType(eu.europa.ec.fisheries.schema.movement.v1.TempMovementType) Test(org.junit.Test) AbstractRestServiceTest(eu.europa.ec.fisheries.uvms.docker.validation.common.AbstractRestServiceTest)

Example 4 with TempMovementType

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);
}
Also used : HttpResponse(org.apache.http.HttpResponse) TempMovementType(eu.europa.ec.fisheries.schema.movement.v1.TempMovementType) Test(org.junit.Test) AbstractRestServiceTest(eu.europa.ec.fisheries.uvms.docker.validation.common.AbstractRestServiceTest)

Example 5 with TempMovementType

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;
}
Also used : VesselType(eu.europa.ec.fisheries.schema.movement.asset.v1.VesselType) MovementPoint(eu.europa.ec.fisheries.schema.movement.v1.MovementPoint) TempMovementType(eu.europa.ec.fisheries.schema.movement.v1.TempMovementType) SimpleDateFormat(java.text.SimpleDateFormat) Date(java.util.Date)

Aggregations

TempMovementType (eu.europa.ec.fisheries.schema.movement.v1.TempMovementType)7 AbstractRestServiceTest (eu.europa.ec.fisheries.uvms.docker.validation.common.AbstractRestServiceTest)6 Test (org.junit.Test)6 HttpResponse (org.apache.http.HttpResponse)2 VesselType (eu.europa.ec.fisheries.schema.movement.asset.v1.VesselType)1 MovementPoint (eu.europa.ec.fisheries.schema.movement.v1.MovementPoint)1 SimpleDateFormat (java.text.SimpleDateFormat)1 Date (java.util.Date)1