use of eu.europa.ec.fisheries.wsdl.asset.types.Asset in project UVMS-Docker by UnionVMS.
the class AssetHistoryRestIT method getAssetHistoryByAssetHistGuidHistortyIsRetained.
@Test
public void getAssetHistoryByAssetHistGuidHistortyIsRetained() throws Exception {
// Create asset versions
Asset asset1 = AssetTestHelper.createTestAsset();
Asset asset2 = AssetTestHelper.getAssetByGuid(asset1.getAssetId().getGuid());
asset2.setName(asset2.getName() + "1");
asset2 = AssetTestHelper.updateAsset(asset2);
Asset asset3 = AssetTestHelper.getAssetByGuid(asset2.getAssetId().getGuid());
asset3.setName(asset3.getName() + "2");
asset3 = AssetTestHelper.updateAsset(asset3);
Asset assetHistory1 = AssetTestHelper.getAssetHistoryFromHistoryGuid(asset1.getEventHistory().getEventId());
assertEquals(asset1, assetHistory1);
Asset assetHistory2 = AssetTestHelper.getAssetHistoryFromHistoryGuid(asset2.getEventHistory().getEventId());
assertEquals(asset2, assetHistory2);
Asset assetHistory3 = AssetTestHelper.getAssetHistoryFromHistoryGuid(asset3.getEventHistory().getEventId());
assertEquals(asset3, assetHistory3);
}
use of eu.europa.ec.fisheries.wsdl.asset.types.Asset in project UVMS-Docker by UnionVMS.
the class AssetHistoryRestIT method getAssetHistoryListByAssetIdNumberOfHistoriesTest.
/**
* Gets the asset history list by asset id test.
*
* @return the asset history list by asset id test
* @throws Exception
* the exception
*/
@Test
public void getAssetHistoryListByAssetIdNumberOfHistoriesTest() throws Exception {
Asset asset = AssetTestHelper.createTestAsset();
List<Asset> assetHistories = AssetTestHelper.getAssetHistoryFromAssetGuid(asset.getAssetId().getGuid());
assertTrue(assetHistories.size() == 1);
asset.setName(asset.getName() + "Updated");
asset = AssetTestHelper.updateAsset(asset);
assetHistories = AssetTestHelper.getAssetHistoryFromAssetGuid(asset.getAssetId().getGuid());
assertTrue(assetHistories.size() == 2);
asset.setName(asset.getName() + "Updated2");
asset = AssetTestHelper.updateAsset(asset);
assetHistories = AssetTestHelper.getAssetHistoryFromAssetGuid(asset.getAssetId().getGuid());
assertTrue(assetHistories.size() == 3);
}
use of eu.europa.ec.fisheries.wsdl.asset.types.Asset in project UVMS-Docker by UnionVMS.
the class AssetJMSIT method testGetAssetListByQuery.
@Test
public void testGetAssetListByQuery() throws Exception {
Asset asset = AssetTestHelper.createTestAsset();
AssetListQuery assetListQuery = AssetTestHelper.getBasicAssetQuery();
AssetListCriteriaPair assetListCriteriaPair = new AssetListCriteriaPair();
assetListCriteriaPair.setKey(ConfigSearchField.FLAG_STATE);
assetListCriteriaPair.setValue(asset.getCountryCode());
assetListQuery.getAssetSearchCriteria().getCriterias().add(assetListCriteriaPair);
List<Asset> assets = AssetJMSHelper.getAssetByAssetListQuery(assetListQuery);
setDecimalScaleAndNullNotes(assets);
assertTrue(assets.contains(asset));
}
use of eu.europa.ec.fisheries.wsdl.asset.types.Asset in project UVMS-Docker by UnionVMS.
the class AssetJMSIT method testGetAssetByGuid.
@Test
public void testGetAssetByGuid() throws Exception {
Asset asset = AssetTestHelper.createTestAsset();
Asset assetById = AssetJMSHelper.getAssetById(asset.getAssetId().getGuid(), AssetIdType.GUID);
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 getAssetGroupListByUserTest.
@Test
public void getAssetGroupListByUserTest() 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 = AssetJMSHelper.getAssetGroupByUser(assetGroup.getUser());
assertTrue(assetGroups.contains(assetGroup));
}
Aggregations