use of eu.europa.ec.fisheries.schema.mobileterminal.types.v1.MobileTerminalType in project UVMS-Docker by UnionVMS.
the class MobileTerminalRestIT method updateMobileTerminalTest.
/**
* Update mobile terminal test.
*
* @throws Exception
* the exception
*/
@Test
public void updateMobileTerminalTest() throws Exception {
MobileTerminalType createdMobileTerminalType = MobileTerminalTestHelper.createMobileTerminalType();
createdMobileTerminalType.setArchived(true);
final HttpResponse response = Request.Put(getBaseUrl() + "mobileterminal/rest/mobileterminal?comment=comment").setHeader("Content-Type", "application/json").setHeader("Authorization", getValidJwtToken()).bodyByteArray(writeValueAsString(createdMobileTerminalType).getBytes()).execute().returnResponse();
Map<String, Object> dataMap = checkSuccessResponseReturnMap(response);
}
use of eu.europa.ec.fisheries.schema.mobileterminal.types.v1.MobileTerminalType in project UVMS-Docker by UnionVMS.
the class MobileTerminalRestIT method setStatusInactiveTest.
/**
* Sets the status inactive test.
*
* @throws Exception
* the exception
*/
@Test
public void setStatusInactiveTest() throws Exception {
MobileTerminalType createdMobileTerminalType = MobileTerminalTestHelper.createMobileTerminalType();
final HttpResponse response = Request.Put(getBaseUrl() + "mobileterminal/rest/mobileterminal/status/inactivate?comment=comment").setHeader("Content-Type", "application/json").setHeader("Authorization", getValidJwtToken()).bodyByteArray(writeValueAsString(createdMobileTerminalType.getMobileTerminalId()).getBytes()).execute().returnResponse();
Map<String, Object> dataMap = checkSuccessResponseReturnMap(response);
}
use of eu.europa.ec.fisheries.schema.mobileterminal.types.v1.MobileTerminalType in project UVMS-Docker by UnionVMS.
the class MobileTerminalRestIT method setStatusRemovedTest.
/**
* Sets the status removed test.
*
* @throws Exception
* the exception
*/
@Test
public void setStatusRemovedTest() throws Exception {
MobileTerminalType createdMobileTerminalType = MobileTerminalTestHelper.createMobileTerminalType();
final HttpResponse response = Request.Put(getBaseUrl() + "mobileterminal/rest/mobileterminal/status/remove?comment=comment").setHeader("Content-Type", "application/json").setHeader("Authorization", getValidJwtToken()).bodyByteArray(writeValueAsString(createdMobileTerminalType.getMobileTerminalId()).getBytes()).execute().returnResponse();
Map<String, Object> dataMap = checkSuccessResponseReturnMap(response);
}
use of eu.europa.ec.fisheries.schema.mobileterminal.types.v1.MobileTerminalType in project UVMS-Docker by UnionVMS.
the class MobileTerminalTestHelper method createPoll_Helper.
public static Map<String, Object> createPoll_Helper(Asset testAsset) throws Exception {
MobileTerminalType createdMobileTerminalType = 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);
}
String comChannelId = createdMobileTerminalType.getChannels().get(0).getGuid();
PollRequestType pollRequestType = new PollRequestType();
pollRequestType.setPollType(PollType.PROGRAM_POLL);
pollRequestType.setUserName("vms_admin_com");
pollRequestType.setComment("Manual poll created by test");
PollMobileTerminal pollMobileTerminal = new PollMobileTerminal();
pollMobileTerminal.setComChannelId(comChannelId);
pollMobileTerminal.setConnectId(testAsset.getAssetId().getGuid());
pollMobileTerminal.setMobileTerminalId(createdMobileTerminalType.getMobileTerminalId().getGuid());
List<MobileTerminalAttribute> mobileTerminalAttributes = createdMobileTerminalType.getAttributes();
List<PollAttribute> pollAttributes = pollRequestType.getAttributes();
for (MobileTerminalAttribute mobileTerminalAttribute : mobileTerminalAttributes) {
String type = mobileTerminalAttribute.getType();
String value = mobileTerminalAttribute.getValue();
PollAttribute pollAttribute = new PollAttribute();
try {
PollAttributeType pollAttributeType = PollAttributeType.valueOf(type);
pollAttribute.setKey(pollAttributeType);
pollAttribute.setValue(value);
pollAttributes.add(pollAttribute);
} catch (RuntimeException rte) {
// ignore
}
}
PollAttribute frequency = new PollAttribute();
PollAttribute startDate = new PollAttribute();
PollAttribute endDate = new PollAttribute();
pollAttributes.add(frequency);
frequency.setKey(PollAttributeType.FREQUENCY);
frequency.setValue("1000");
pollAttributes.add(startDate);
startDate.setKey(PollAttributeType.START_DATE);
startDate.setValue(getDateAsString(2001, Calendar.JANUARY, 7, 1, 7, 23, 45));
pollAttributes.add(endDate);
endDate.setKey(PollAttributeType.END_DATE);
endDate.setValue(getDateAsString(2027, Calendar.DECEMBER, 24, 11, 45, 7, 980));
pollRequestType.getMobileTerminals().add(pollMobileTerminal);
final HttpResponse response = Request.Post(getBaseUrl() + "mobileterminal/rest/poll").setHeader("Content-Type", "application/json").setHeader("Authorization", getValidJwtToken()).bodyByteArray(writeValueAsString(pollRequestType).getBytes()).execute().returnResponse();
Map<String, Object> dataMap = checkSuccessResponseReturnMap(response);
return dataMap;
}
use of eu.europa.ec.fisheries.schema.mobileterminal.types.v1.MobileTerminalType in project UVMS-Docker by UnionVMS.
the class MovementJmsIT method createRouteTest.
@Test(timeout = 720000)
public void createRouteTest() throws Exception {
Asset testAsset = AssetTestHelper.createTestAsset();
MobileTerminalType mobileTerminalType = MobileTerminalTestHelper.createMobileTerminalType();
MobileTerminalTestHelper.assignMobileTerminal(testAsset, mobileTerminalType);
List<LatLong> route = movementHelper.createRutt(24);
for (LatLong position : route) {
final CreateMovementRequest createMovementRequest = movementHelper.createMovementRequest(testAsset, mobileTerminalType, position);
CreateMovementResponse createMovementResponse = movementHelper.createMovement(testAsset, mobileTerminalType, createMovementRequest);
assertNotNull(createMovementResponse);
}
}
Aggregations