use of eu.europa.ec.fisheries.wsdl.asset.types.Asset in project UVMS-Docker by UnionVMS.
the class AssetRestIT method archiveAssetAuditLogCreatedTest.
@Test
public void archiveAssetAuditLogCreatedTest() throws Exception {
Date fromDate = DateUtils.getNowDateUTC();
Asset testAsset = AssetTestHelper.createTestAsset();
testAsset.setActive(false);
AssetTestHelper.archiveAsset(testAsset);
AssetTestHelper.assertAssetAuditLogCreated(testAsset.getAssetId().getGuid(), AuditOperationEnum.ARCHIVE, fromDate);
}
use of eu.europa.ec.fisheries.wsdl.asset.types.Asset in project UVMS-Docker by UnionVMS.
the class AssetRestIT method assetListQueryMultipleHistoryGuidTest.
@Test
public void assetListQueryMultipleHistoryGuidTest() 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);
AssetListQuery assetListQuery = AssetTestHelper.getBasicAssetQuery();
AssetListCriteriaPair assetListCriteriaPair = new AssetListCriteriaPair();
assetListCriteriaPair.setKey(ConfigSearchField.HIST_GUID);
assetListCriteriaPair.setValue(asset1.getEventHistory().getEventId());
assetListQuery.getAssetSearchCriteria().getCriterias().add(assetListCriteriaPair);
AssetListCriteriaPair assetListCriteriaPair2 = new AssetListCriteriaPair();
assetListCriteriaPair2.setKey(ConfigSearchField.HIST_GUID);
assetListCriteriaPair2.setValue(asset2.getEventHistory().getEventId());
assetListQuery.getAssetSearchCriteria().getCriterias().add(assetListCriteriaPair2);
ListAssetResponse assetHistory = AssetTestHelper.assetListQuery(assetListQuery);
List<Asset> assets = assetHistory.getAsset();
assertEquals(2, assets.size());
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 getAssetByIdTest.
/**
* Gets the asset by id test.
*
* @return the asset by id test
* @throws Exception
* the exception
*/
@Test
public void getAssetByIdTest() throws Exception {
Asset asset = AssetTestHelper.createTestAsset();
Asset assetByGuid = AssetTestHelper.getAssetByGuid(asset.getAssetId().getGuid());
assertEquals(asset, assetByGuid);
}
use of eu.europa.ec.fisheries.wsdl.asset.types.Asset in project UVMS-Docker by UnionVMS.
the class AssetRestIT method updateAssetTest.
/**
* Update asset test.
*
* @throws Exception
* the exception
*/
@Test
public void updateAssetTest() throws Exception {
Asset testAsset = AssetTestHelper.createTestAsset();
String newName = testAsset.getName() + "Changed";
testAsset.setName(newName);
Asset updatedAsset = AssetTestHelper.updateAsset(testAsset);
assertEquals(newName, updatedAsset.getName());
assertEquals(testAsset.getAssetId().getGuid(), updatedAsset.getAssetId().getGuid());
assertEquals(testAsset.getCfr(), updatedAsset.getCfr());
assertNotEquals(testAsset.getEventHistory().getEventId(), updatedAsset.getEventHistory().getEventId());
}
use of eu.europa.ec.fisheries.wsdl.asset.types.Asset in project UVMS-Docker by UnionVMS.
the class AssetRestIT method getAssetListWithLikeSearchValue.
@Test
public void getAssetListWithLikeSearchValue() throws Exception {
Asset asset = AssetTestHelper.createDummyAsset(AssetIdType.GUID);
asset.setHomePort("MyHomePort");
asset = AssetTestHelper.createAsset(asset);
AssetListQuery assetListQuery = AssetTestHelper.getBasicAssetQuery();
AssetListCriteriaPair assetListCriteriaPair = new AssetListCriteriaPair();
assetListCriteriaPair.setKey(ConfigSearchField.HOMEPORT);
assetListCriteriaPair.setValue("My*");
assetListQuery.getAssetSearchCriteria().getCriterias().add(assetListCriteriaPair);
ListAssetResponse assetList = AssetTestHelper.assetListQuery(assetListQuery);
List<Asset> assets = assetList.getAsset();
assertTrue(assets.contains(asset));
}
Aggregations