Search in sources :

Example 51 with Asset

use of eu.europa.ec.fisheries.wsdl.asset.types.Asset in project UVMS-Docker by UnionVMS.

the class MovementMovementSearchRestIT method createMovementSearchGroup.

/**
 * Creates the movement search group.
 *
 * @return the movement search group
 * @throws Exception the exception
 */
private MovementSearchGroup createMovementSearchGroup() throws Exception {
    Asset testAsset = AssetTestHelper.createTestAsset();
    MovementSearchGroup movementSearchGroup = new MovementSearchGroup();
    movementSearchGroup.setDynamic(false);
    movementSearchGroup.setUser("vms_admin_com");
    movementSearchGroup.setName("Name" + UUID.randomUUID().toString());
    GroupListCriteria groupListCriteria = new GroupListCriteria();
    groupListCriteria.setType(SearchKeyType.ASSET);
    groupListCriteria.setKey("GUID");
    groupListCriteria.setValue(testAsset.getAssetId().getGuid());
    movementSearchGroup.getSearchFields().add(groupListCriteria);
    final HttpResponse response = Request.Post(getBaseUrl() + "movement/rest/search/group").setHeader("Content-Type", "application/json").setHeader("Authorization", getValidJwtToken()).bodyByteArray(writeValueAsString(movementSearchGroup).getBytes()).execute().returnResponse();
    Map<String, Object> dataMap = checkSuccessResponseReturnMap(response);
    movementSearchGroup.setId(BigInteger.valueOf(Long.valueOf("" + dataMap.get("id"))));
    return movementSearchGroup;
}
Also used : Asset(eu.europa.ec.fisheries.wsdl.asset.types.Asset) HttpResponse(org.apache.http.HttpResponse) MovementSearchGroup(eu.europa.ec.fisheries.schema.movement.search.v1.MovementSearchGroup) GroupListCriteria(eu.europa.ec.fisheries.schema.movement.search.v1.GroupListCriteria)

Example 52 with Asset

use of eu.europa.ec.fisheries.wsdl.asset.types.Asset in project UVMS-Docker by UnionVMS.

the class ExchangeLogRestIT method getExchangeLogByGuidTest.

/**
 * Gets the exchange log by guid test.
 *
 * @return the exchange log by guid test
 * @throws Exception the exception
 */
@Test
public void getExchangeLogByGuidTest() throws Exception {
    String guid = null;
    {
        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);
        guid = (String) dataMap.get("guid");
    }
    final HttpResponse response = Request.Get(getBaseUrl() + "exchange/rest/exchange/" + guid).setHeader("Content-Type", "application/json").setHeader("Authorization", getValidJwtToken()).execute().returnResponse();
    Map<String, Object> dataMap = checkSuccessResponseReturnMap(response);
    assertEquals("SEND_POLL", dataMap.get("type"));
}
Also used : ArrayList(java.util.ArrayList) Asset(eu.europa.ec.fisheries.wsdl.asset.types.Asset) HttpResponse(org.apache.http.HttpResponse) Map(java.util.Map) Test(org.junit.Test) AbstractRestServiceTest(eu.europa.ec.fisheries.uvms.docker.validation.common.AbstractRestServiceTest)

Example 53 with Asset

use of eu.europa.ec.fisheries.wsdl.asset.types.Asset in project UVMS-Docker by UnionVMS.

the class SetMovementReportRequestJmsIT method setMovementReportRequestRouteTest.

/**
 * Sets the movement report request route test.
 *
 * @throws Exception
 *             the exception
 */
@Test(timeout = 25000)
public void setMovementReportRequestRouteTest() throws Exception {
    Asset testAsset = AssetTestHelper.createTestAsset();
    MobileTerminalType mobileTerminalType = MobileTerminalTestHelper.createMobileTerminalType();
    MobileTerminalTestHelper.assignMobileTerminal(testAsset, mobileTerminalType);
    List<LatLong> latLongList = movementHelper.createRutt(2);
    for (LatLong latLong : latLongList) {
        final CreateMovementRequest createMovementRequest = movementHelper.createMovementRequest(testAsset, mobileTerminalType, latLong);
        MessageHelper.sendMessage("UVMSExchangeEvent", marshall(createSetReportMovementType(testAsset, mobileTerminalType, createMovementRequest)));
    }
}
Also used : CreateMovementRequest(eu.europa.ec.fisheries.schema.movement.module.v1.CreateMovementRequest) Asset(eu.europa.ec.fisheries.wsdl.asset.types.Asset) MobileTerminalType(eu.europa.ec.fisheries.schema.mobileterminal.types.v1.MobileTerminalType) LatLong(eu.europa.ec.fisheries.uvms.docker.validation.movement.LatLong) Test(org.junit.Test) AbstractRestServiceTest(eu.europa.ec.fisheries.uvms.docker.validation.common.AbstractRestServiceTest)

Example 54 with Asset

use of eu.europa.ec.fisheries.wsdl.asset.types.Asset in project UVMS-Docker by UnionVMS.

the class MobileTerminalRestIT method unAssignMobileTerminalTest.

/**
 * Un assign mobile terminal test.
 *
 * @throws Exception
 *             the exception
 */
@Test
public void unAssignMobileTerminalTest() throws Exception {
    Asset testAsset = AssetTestHelper.createTestAsset();
    MobileTerminalType createdMobileTerminalType = MobileTerminalTestHelper.createMobileTerminalType();
    MobileTerminalAssignQuery mobileTerminalAssignQuery = new MobileTerminalAssignQuery();
    mobileTerminalAssignQuery.setMobileTerminalId(createdMobileTerminalType.getMobileTerminalId());
    mobileTerminalAssignQuery.setConnectId(testAsset.getAssetId().getGuid());
    {
        // Assign first
        final HttpResponse response = Request.Post(getBaseUrl() + "mobileterminal/rest/mobileterminal/assign?comment=comment").setHeader("Content-Type", "application/json").setHeader("Authorization", getValidJwtToken()).bodyByteArray(writeValueAsString(mobileTerminalAssignQuery).getBytes()).execute().returnResponse();
        Map<String, Object> dataMap = checkSuccessResponseReturnMap(response);
    }
    final HttpResponse response = Request.Post(getBaseUrl() + "mobileterminal/rest/mobileterminal/unassign?comment=comment").setHeader("Content-Type", "application/json").setHeader("Authorization", getValidJwtToken()).bodyByteArray(writeValueAsString(mobileTerminalAssignQuery).getBytes()).execute().returnResponse();
    Map<String, Object> dataMap = checkSuccessResponseReturnMap(response);
}
Also used : Asset(eu.europa.ec.fisheries.wsdl.asset.types.Asset) HttpResponse(org.apache.http.HttpResponse) MobileTerminalAssignQuery(eu.europa.ec.fisheries.schema.mobileterminal.types.v1.MobileTerminalAssignQuery) MobileTerminalType(eu.europa.ec.fisheries.schema.mobileterminal.types.v1.MobileTerminalType) Map(java.util.Map) Test(org.junit.Test)

Example 55 with Asset

use of eu.europa.ec.fisheries.wsdl.asset.types.Asset in project UVMS-Docker by UnionVMS.

the class MobileTerminalRestIT method assignMobileTerminalTest.

/**
 * Assign mobile terminal test.
 *
 * @throws Exception
 *             the exception
 */
@Test
public void assignMobileTerminalTest() throws Exception {
    Asset testAsset = AssetTestHelper.createTestAsset();
    MobileTerminalType createdMobileTerminalType = MobileTerminalTestHelper.createMobileTerminalType();
    Map<String, Object> dataMap = MobileTerminalTestHelper.assignMobileTerminal(testAsset, createdMobileTerminalType);
}
Also used : Asset(eu.europa.ec.fisheries.wsdl.asset.types.Asset) MobileTerminalType(eu.europa.ec.fisheries.schema.mobileterminal.types.v1.MobileTerminalType) Test(org.junit.Test)

Aggregations

Asset (eu.europa.ec.fisheries.wsdl.asset.types.Asset)61 Test (org.junit.Test)54 AbstractRestServiceTest (eu.europa.ec.fisheries.uvms.docker.validation.common.AbstractRestServiceTest)38 MobileTerminalType (eu.europa.ec.fisheries.schema.mobileterminal.types.v1.MobileTerminalType)15 ArrayList (java.util.ArrayList)14 HttpResponse (org.apache.http.HttpResponse)14 AssetListQuery (eu.europa.ec.fisheries.wsdl.asset.types.AssetListQuery)13 AssetListCriteriaPair (eu.europa.ec.fisheries.wsdl.asset.types.AssetListCriteriaPair)12 CreateMovementRequest (eu.europa.ec.fisheries.schema.movement.module.v1.CreateMovementRequest)11 CreateMovementResponse (eu.europa.ec.fisheries.schema.movement.module.v1.CreateMovementResponse)9 ListAssetResponse (eu.europa.ec.fisheries.wsdl.asset.types.ListAssetResponse)8 Date (java.util.Date)5 AssetGroup (eu.europa.ec.fisheries.wsdl.asset.group.AssetGroup)4 AssetGroupSearchField (eu.europa.ec.fisheries.wsdl.asset.group.AssetGroupSearchField)4 Map (java.util.Map)4 AssetIdentifierDto (eu.europa.ec.fisheries.ers.service.dto.AssetIdentifierDto)3 List (java.util.List)3 VesselDetailsDTO (eu.europa.ec.fisheries.ers.service.dto.fareport.details.VesselDetailsDTO)2 ServiceException (eu.europa.ec.fisheries.uvms.commons.service.exception.ServiceException)2 LatLong (eu.europa.ec.fisheries.uvms.docker.validation.movement.LatLong)2