Search in sources :

Example 16 with Asset

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);
}
Also used : Asset(eu.europa.ec.fisheries.wsdl.asset.types.Asset) Test(org.junit.Test) AbstractRestServiceTest(eu.europa.ec.fisheries.uvms.docker.validation.common.AbstractRestServiceTest)

Example 17 with Asset

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);
}
Also used : Asset(eu.europa.ec.fisheries.wsdl.asset.types.Asset) Test(org.junit.Test) AbstractRestServiceTest(eu.europa.ec.fisheries.uvms.docker.validation.common.AbstractRestServiceTest)

Example 18 with Asset

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));
}
Also used : AssetListCriteriaPair(eu.europa.ec.fisheries.wsdl.asset.types.AssetListCriteriaPair) AssetListQuery(eu.europa.ec.fisheries.wsdl.asset.types.AssetListQuery) Asset(eu.europa.ec.fisheries.wsdl.asset.types.Asset) Test(org.junit.Test)

Example 19 with 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);
}
Also used : Asset(eu.europa.ec.fisheries.wsdl.asset.types.Asset) Test(org.junit.Test)

Example 20 with Asset

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));
}
Also used : Asset(eu.europa.ec.fisheries.wsdl.asset.types.Asset) AssetGroupSearchField(eu.europa.ec.fisheries.wsdl.asset.group.AssetGroupSearchField) AssetGroup(eu.europa.ec.fisheries.wsdl.asset.group.AssetGroup) Test(org.junit.Test)

Aggregations

Asset (eu.europa.ec.fisheries.wsdl.asset.types.Asset)61 Test (org.junit.Test)54 AbstractRestServiceTest (eu.europa.ec.fisheries.uvms.docker.validation.common.AbstractRestServiceTest)38 MobileTerminalType (eu.europa.ec.fisheries.schema.mobileterminal.types.v1.MobileTerminalType)15 ArrayList (java.util.ArrayList)14 HttpResponse (org.apache.http.HttpResponse)14 AssetListQuery (eu.europa.ec.fisheries.wsdl.asset.types.AssetListQuery)13 AssetListCriteriaPair (eu.europa.ec.fisheries.wsdl.asset.types.AssetListCriteriaPair)12 CreateMovementRequest (eu.europa.ec.fisheries.schema.movement.module.v1.CreateMovementRequest)11 CreateMovementResponse (eu.europa.ec.fisheries.schema.movement.module.v1.CreateMovementResponse)9 ListAssetResponse (eu.europa.ec.fisheries.wsdl.asset.types.ListAssetResponse)8 Date (java.util.Date)5 AssetGroup (eu.europa.ec.fisheries.wsdl.asset.group.AssetGroup)4 AssetGroupSearchField (eu.europa.ec.fisheries.wsdl.asset.group.AssetGroupSearchField)4 Map (java.util.Map)4 AssetIdentifierDto (eu.europa.ec.fisheries.ers.service.dto.AssetIdentifierDto)3 List (java.util.List)3 VesselDetailsDTO (eu.europa.ec.fisheries.ers.service.dto.fareport.details.VesselDetailsDTO)2 ServiceException (eu.europa.ec.fisheries.uvms.commons.service.exception.ServiceException)2 LatLong (eu.europa.ec.fisheries.uvms.docker.validation.movement.LatLong)2