use of eu.europa.ec.fisheries.wsdl.asset.types.Asset in project UVMS-Docker by UnionVMS.
the class AssetJMSIT method testGetAssetByMMSI.
@Test
public void testGetAssetByMMSI() throws Exception {
Asset asset = AssetTestHelper.createTestAsset();
Asset assetById = AssetJMSHelper.getAssetById(asset.getMmsiNo(), AssetIdType.MMSI);
setDecimalScaleAndNullNotes(assetById);
assertEquals(asset, assetById);
}
use of eu.europa.ec.fisheries.wsdl.asset.types.Asset in project UVMS-Docker by UnionVMS.
the class AssetJMSIT method getAssetListByAssetGroups.
@Test
public void getAssetListByAssetGroups() throws Exception {
AssetGroup assetGroup = AssetTestHelper.createBasicAssetGroup();
Asset asset1 = AssetTestHelper.createTestAsset();
Asset asset2 = AssetTestHelper.createTestAsset();
// Add assets to group
AssetGroupSearchField assetGroupSearchField1 = new AssetGroupSearchField();
assetGroupSearchField1.setKey(ConfigSearchField.GUID);
assetGroupSearchField1.setValue(asset1.getAssetId().getGuid());
assetGroup.getSearchFields().add(assetGroupSearchField1);
AssetGroupSearchField assetGroupSearchField2 = new AssetGroupSearchField();
assetGroupSearchField2.setKey(ConfigSearchField.GUID);
assetGroupSearchField2.setValue(asset2.getAssetId().getGuid());
assetGroup.getSearchFields().add(assetGroupSearchField2);
// Create Group
assetGroup = AssetTestHelper.createAssetGroup(assetGroup);
List<AssetGroup> assetGroups = new ArrayList<AssetGroup>();
assetGroups.add(assetGroup);
List<Asset> assets = AssetJMSHelper.getAssetListByAssetGroups(assetGroups);
setDecimalScaleAndNullNotes(assets);
assertTrue(assets.contains(asset1));
assertTrue(assets.contains(asset2));
}
use of eu.europa.ec.fisheries.wsdl.asset.types.Asset in project UVMS-Docker by UnionVMS.
the class AssetRestIT method getAssetListWithLikeSearchValue_ICCAT_AND_UVI_GFCM.
@Test
public void getAssetListWithLikeSearchValue_ICCAT_AND_UVI_GFCM() throws Exception {
Asset asset = AssetTestHelper.createDummyAsset(AssetIdType.GUID);
String theValue = UUID.randomUUID().toString();
asset.setIccat(theValue);
asset.setUvi(theValue);
asset.setGfcm(theValue);
asset = AssetTestHelper.createAsset(asset);
AssetListQuery assetListQuery = AssetTestHelper.getBasicAssetQuery();
AssetListCriteriaPair assetListCriteriaPair_ICCAT = new AssetListCriteriaPair();
AssetListCriteriaPair assetListCriteriaPair_UVI = new AssetListCriteriaPair();
AssetListCriteriaPair assetListCriteriaPair_GFCM = new AssetListCriteriaPair();
assetListCriteriaPair_ICCAT.setKey(ConfigSearchField.ICCAT);
assetListCriteriaPair_ICCAT.setValue(theValue);
assetListQuery.getAssetSearchCriteria().getCriterias().add(assetListCriteriaPair_ICCAT);
assetListCriteriaPair_UVI.setKey(ConfigSearchField.UVI);
assetListCriteriaPair_UVI.setValue(theValue);
assetListQuery.getAssetSearchCriteria().getCriterias().add(assetListCriteriaPair_UVI);
assetListCriteriaPair_GFCM.setKey(ConfigSearchField.GFCM);
assetListCriteriaPair_GFCM.setValue(theValue);
assetListQuery.getAssetSearchCriteria().getCriterias().add(assetListCriteriaPair_GFCM);
ListAssetResponse assetList = AssetTestHelper.assetListQuery(assetListQuery);
List<Asset> assets = assetList.getAsset();
assertTrue(assets.contains(asset));
}
use of eu.europa.ec.fisheries.wsdl.asset.types.Asset in project UVMS-Docker by UnionVMS.
the class AssetRestIT method getAssetListItemCountTest.
@Test
public void getAssetListItemCountTest() throws Exception {
AssetListQuery assetListQuery = AssetTestHelper.getBasicAssetQuery();
AssetListCriteriaPair assetListCriteriaPair = new AssetListCriteriaPair();
assetListCriteriaPair.setKey(ConfigSearchField.FLAG_STATE);
assetListCriteriaPair.setValue("SWE");
assetListQuery.getAssetSearchCriteria().getCriterias().add(assetListCriteriaPair);
Integer countBefore = AssetTestHelper.assetListQueryCount(assetListQuery);
// Add new asset
Asset asset = AssetTestHelper.createDummyAsset(AssetIdType.GUID);
asset.setCountryCode("SWE");
AssetTestHelper.createAsset(asset);
Integer countAfter = AssetTestHelper.assetListQueryCount(assetListQuery);
assertEquals(Integer.valueOf(countBefore + 1), countAfter);
}
use of eu.europa.ec.fisheries.wsdl.asset.types.Asset in project UVMS-Docker by UnionVMS.
the class AssetRestIT method getAssetListMultipleAssetsGuidsTest.
@Test
public void getAssetListMultipleAssetsGuidsTest() throws Exception {
Asset asset1 = AssetTestHelper.createTestAsset();
Asset asset2 = AssetTestHelper.createTestAsset();
AssetListQuery assetListQuery = AssetTestHelper.getBasicAssetQuery();
AssetListCriteriaPair assetListCriteriaPair1 = new AssetListCriteriaPair();
assetListCriteriaPair1.setKey(ConfigSearchField.GUID);
assetListCriteriaPair1.setValue(asset1.getAssetId().getGuid());
assetListQuery.getAssetSearchCriteria().getCriterias().add(assetListCriteriaPair1);
AssetListCriteriaPair assetListCriteriaPair2 = new AssetListCriteriaPair();
assetListCriteriaPair2.setKey(ConfigSearchField.GUID);
assetListCriteriaPair2.setValue(asset2.getAssetId().getGuid());
assetListQuery.getAssetSearchCriteria().getCriterias().add(assetListCriteriaPair2);
ListAssetResponse assetListResponse = AssetTestHelper.assetListQuery(assetListQuery);
List<Asset> assets = assetListResponse.getAsset();
assertEquals(2, assets.size());
assertTrue(assets.contains(asset1));
assertTrue(assets.contains(asset2));
}
Aggregations