use of eu.europa.ec.fisheries.wsdl.asset.types.Asset in project UVMS-Docker by UnionVMS.
the class PollRestIT method createPollTest.
/**
* Creates the poll test.
*
* @throws Exception
* the exception
*/
@Test
public void createPollTest() throws Exception {
Asset testAsset = AssetTestHelper.createTestAsset();
Map<String, Object> programPollDataMap = MobileTerminalTestHelper.createPoll_Helper(testAsset);
}
use of eu.europa.ec.fisheries.wsdl.asset.types.Asset in project UVMS-Docker by UnionVMS.
the class PollRestIT method stopProgramPollTest.
/**
* Stop program poll test.
*
* @throws Exception
* the exception
*/
@Test
public void stopProgramPollTest() throws Exception {
Asset testAsset = AssetTestHelper.createTestAsset();
Map<String, Object> programPollDataMap = MobileTerminalTestHelper.createPoll_Helper(testAsset);
ArrayList sendPolls = (ArrayList) programPollDataMap.get("sentPolls");
String uid = (String) sendPolls.get(0);
// start it
{
final HttpResponse response = Request.Put(getBaseUrl() + "mobileterminal/rest/poll/start/" + uid).setHeader("Content-Type", "application/json").setHeader("Authorization", getValidJwtToken()).execute().returnResponse();
Map<String, Object> dataMap = checkSuccessResponseReturnMap(response);
}
// stop it
final HttpResponse response = Request.Put(getBaseUrl() + "mobileterminal/rest/poll/stop/" + uid).setHeader("Content-Type", "application/json").setHeader("Authorization", getValidJwtToken()).execute().returnResponse();
Map<String, Object> dataMap = checkSuccessResponseReturnMap(response);
ArrayList values = (ArrayList) dataMap.get("value");
assertNotNull(values);
assertTrue(values.size() == 10);
}
use of eu.europa.ec.fisheries.wsdl.asset.types.Asset in project UVMS-Docker by UnionVMS.
the class PollRestIT method startProgramPollTest.
/**
* Start program poll test.
*
* @throws Exception
* the exception
*/
@Test
public void startProgramPollTest() throws Exception {
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.Put(getBaseUrl() + "mobileterminal/rest/poll/start/" + uid).setHeader("Content-Type", "application/json").setHeader("Authorization", getValidJwtToken()).execute().returnResponse();
Map<String, Object> dataMap = checkSuccessResponseReturnMap(response);
ArrayList values = (ArrayList) dataMap.get("value");
assertNotNull(values);
assertTrue(values.size() == 10);
}
use of eu.europa.ec.fisheries.wsdl.asset.types.Asset in project UVMS-Docker by UnionVMS.
the class AssetTestHelper method createDummyAsset.
public static Asset createDummyAsset(AssetIdType assetIdType) {
String ircs = "F" + generateARandomStringWithMaxLength(4);
Asset asset = new Asset();
AssetId assetId = new AssetId();
assetId.setType(assetIdType);
switch(assetIdType) {
case GUID:
assetId.setGuid(UUID.randomUUID().toString());
break;
case INTERNAL_ID:
assetId.setValue("INTERNALID_" + UUID.randomUUID().toString());
break;
case CFR:
String val = UUID.randomUUID().toString().substring(0, 12);
assetId.setValue(val);
asset.setCfr(val);
break;
}
asset.setActive(true);
asset.setAssetId(assetId);
asset.setSource(CarrierSource.INTERNAL);
// asset.setEventHistory();
asset.setName("Ship" + generateARandomStringWithMaxLength(10));
asset.setCountryCode("SWE");
asset.setGearType("DERMERSAL");
asset.setHasIrcs("1");
asset.setIrcs(ircs);
asset.setExternalMarking("EXT3");
String imo = "0" + generateARandomStringWithMaxLength(6);
asset.setImo(imo);
String mmsi = generateARandomStringWithMaxLength(9);
asset.setMmsiNo(mmsi);
asset.setHasLicense(true);
asset.setLicenseType("MOCK-license-DB");
asset.setHomePort("TEST_GOT");
asset.setLengthOverAll(new BigDecimal(15.0).setScale(1));
asset.setLengthBetweenPerpendiculars(new BigDecimal(3.0).setScale(1));
asset.setGrossTonnage(new BigDecimal(200.0).setScale(1));
asset.setGrossTonnageUnit("OSLO");
asset.setSafetyGrossTonnage(new BigDecimal(80.0).setScale(1));
asset.setPowerMain(new BigDecimal(10.0).setScale(1));
asset.setPowerAux(new BigDecimal(10.0).setScale(1));
AssetProdOrgModel assetProdOrgModel = new AssetProdOrgModel();
assetProdOrgModel.setName("NAME" + generateARandomStringWithMaxLength(10));
assetProdOrgModel.setCity("CITY" + generateARandomStringWithMaxLength(10));
assetProdOrgModel.setAddress("ADDRESS" + generateARandomStringWithMaxLength(10));
assetProdOrgModel.setCode("CODE" + generateARandomStringWithMaxLength(10));
assetProdOrgModel.setPhone("070" + generateARandomStringWithMaxLength(10));
asset.setProducer(assetProdOrgModel);
asset.getContact();
asset.getNotes();
return asset;
}
use of eu.europa.ec.fisheries.wsdl.asset.types.Asset in project UVMS-ActivityModule-APP by UnionVMS.
the class FishingTripServiceBean method enrichWithAssetsModuleDataIfNeeded.
// need confirmation for removal of this method
private void enrichWithAssetsModuleDataIfNeeded(VesselDetailsDTO vesselDetailsDTO) {
if (vesselDetailsDTO != null && vesselDetailsDTO.hasEmptyIdentifierValues()) {
try {
Set<AssetIdentifierDto> vesselIdentifiers = vesselDetailsDTO.getVesselIdentifiers();
List<AssetListCriteriaPair> assetListCriteriaPairs = BaseMapper.mapToAssetListCriteriaPairList(vesselIdentifiers);
AssetListCriteria criteria = new AssetListCriteria();
criteria.getCriterias().addAll(assetListCriteriaPairs);
AssetListQuery query = new AssetListQuery();
query.setAssetSearchCriteria(criteria);
List<Asset> assetList = assetModuleService.getAssetListResponse(query);
vesselDetailsDTO.enrichIdentifiers(assetList.get(0));
} catch (ServiceException e) {
log.error("Error while trying to send message to Assets module.", e);
}
}
}
Aggregations