Search in sources :

Example 41 with Asset

use of eu.europa.ec.fisheries.wsdl.asset.types.Asset in project UVMS-Docker by UnionVMS.

the class AssetJMSIT method testGetAssetByIRCS.

@Test
public void testGetAssetByIRCS() throws Exception {
    Asset asset = AssetTestHelper.createTestAsset();
    Asset assetById = AssetJMSHelper.getAssetById(asset.getIrcs(), AssetIdType.IRCS);
    setDecimalScaleAndNullNotes(assetById);
    assertEquals(asset, assetById);
}
Also used : Asset(eu.europa.ec.fisheries.wsdl.asset.types.Asset) Test(org.junit.Test)

Example 42 with Asset

use of eu.europa.ec.fisheries.wsdl.asset.types.Asset in project UVMS-Docker by UnionVMS.

the class AssetJMSIT method getAssetGroupByAssetGuidTest.

@Test
public void getAssetGroupByAssetGuidTest() throws Exception {
    AssetGroup assetGroup = AssetTestHelper.createBasicAssetGroup();
    Asset asset1 = AssetTestHelper.createTestAsset();
    // Add asset to group
    AssetGroupSearchField assetGroupSearchField1 = new AssetGroupSearchField();
    assetGroupSearchField1.setKey(ConfigSearchField.GUID);
    assetGroupSearchField1.setValue(asset1.getAssetId().getGuid());
    assetGroup.getSearchFields().add(assetGroupSearchField1);
    // Create Group
    assetGroup = AssetTestHelper.createAssetGroup(assetGroup);
    List<AssetGroup> assetGroups = AssetJMSHelper.getAssetGroupListByAssetGuid(asset1.getAssetId().getGuid());
    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)

Example 43 with Asset

use of eu.europa.ec.fisheries.wsdl.asset.types.Asset in project UVMS-Docker by UnionVMS.

the class AssetRestIT method getAssetListTest.

/**
 * Gets the asset list test.
 *
 * @return the asset list test
 * @throws Exception
 *             the exception
 */
@Test
public void getAssetListTest() 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);
    ListAssetResponse assetListResponse = AssetTestHelper.assetListQuery(assetListQuery);
    List<Asset> assets = assetListResponse.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)

Example 44 with Asset

use of eu.europa.ec.fisheries.wsdl.asset.types.Asset in project UVMS-Docker by UnionVMS.

the class AssetRestIT method createAssetAuditLogCreatedTest.

@Test
public void createAssetAuditLogCreatedTest() throws Exception {
    Date fromDate = DateUtils.getNowDateUTC();
    Asset asset = AssetTestHelper.createTestAsset();
    AssetTestHelper.assertAssetAuditLogCreated(asset.getAssetId().getGuid(), AuditOperationEnum.CREATE, 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 45 with Asset

use of eu.europa.ec.fisheries.wsdl.asset.types.Asset in project UVMS-Docker by UnionVMS.

the class AssetRestIT method getAssetListWithLikeSearchValue_CHANGE_KEY_AND_FAIL.

@Test
public void getAssetListWithLikeSearchValue_CHANGE_KEY_AND_FAIL() throws Exception {
    Asset asset = AssetTestHelper.createTestAsset();
    String guid = asset.getAssetId().getGuid();
    String theValue = UUID.randomUUID().toString();
    String newName = asset.getName() + "Changed";
    asset.setName(newName);
    asset.setIccat(theValue);
    AssetTestHelper.updateAsset(asset);
    AssetListQuery assetListQuery = AssetTestHelper.getBasicAssetQuery();
    AssetListCriteriaPair assetListCriteriaPair_ICCAT = new AssetListCriteriaPair();
    assetListCriteriaPair_ICCAT.setKey(ConfigSearchField.ICCAT);
    assetListCriteriaPair_ICCAT.setValue(theValue);
    AssetListCriteriaPair assetListCriteriaPair_UUID = new AssetListCriteriaPair();
    assetListCriteriaPair_UUID.setKey(ConfigSearchField.GUID);
    assetListCriteriaPair_UUID.setValue(guid);
    assetListQuery.getAssetSearchCriteria().getCriterias().add(assetListCriteriaPair_ICCAT);
    assetListQuery.getAssetSearchCriteria().getCriterias().add(assetListCriteriaPair_UUID);
    ListAssetResponse listAssetResponse = AssetTestHelper.assetListQuery(assetListQuery);
    List<Asset> fetchedAsssets = listAssetResponse.getAsset();
    assertFalse(fetchedAsssets.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