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;
}
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"));
}
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)));
}
}
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);
}
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);
}
Aggregations