Search in sources :

Example 26 with Asset

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);
}
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 27 with Asset

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

Example 28 with Asset

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);
}
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 29 with Asset

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());
}
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 30 with Asset

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

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