Search in sources :

Example 21 with Asset

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

the class AssetJMSIT method testGetAssetByMMSI.

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

Example 22 with Asset

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

the class AssetJMSIT method getAssetListByAssetGroups.

@Test
public void getAssetListByAssetGroups() 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 = new ArrayList<AssetGroup>();
    assetGroups.add(assetGroup);
    List<Asset> assets = AssetJMSHelper.getAssetListByAssetGroups(assetGroups);
    setDecimalScaleAndNullNotes(assets);
    assertTrue(assets.contains(asset1));
    assertTrue(assets.contains(asset2));
}
Also used : ArrayList(java.util.ArrayList) 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 23 with Asset

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

the class AssetRestIT method getAssetListWithLikeSearchValue_ICCAT_AND_UVI_GFCM.

@Test
public void getAssetListWithLikeSearchValue_ICCAT_AND_UVI_GFCM() throws Exception {
    Asset asset = AssetTestHelper.createDummyAsset(AssetIdType.GUID);
    String theValue = UUID.randomUUID().toString();
    asset.setIccat(theValue);
    asset.setUvi(theValue);
    asset.setGfcm(theValue);
    asset = AssetTestHelper.createAsset(asset);
    AssetListQuery assetListQuery = AssetTestHelper.getBasicAssetQuery();
    AssetListCriteriaPair assetListCriteriaPair_ICCAT = new AssetListCriteriaPair();
    AssetListCriteriaPair assetListCriteriaPair_UVI = new AssetListCriteriaPair();
    AssetListCriteriaPair assetListCriteriaPair_GFCM = new AssetListCriteriaPair();
    assetListCriteriaPair_ICCAT.setKey(ConfigSearchField.ICCAT);
    assetListCriteriaPair_ICCAT.setValue(theValue);
    assetListQuery.getAssetSearchCriteria().getCriterias().add(assetListCriteriaPair_ICCAT);
    assetListCriteriaPair_UVI.setKey(ConfigSearchField.UVI);
    assetListCriteriaPair_UVI.setValue(theValue);
    assetListQuery.getAssetSearchCriteria().getCriterias().add(assetListCriteriaPair_UVI);
    assetListCriteriaPair_GFCM.setKey(ConfigSearchField.GFCM);
    assetListCriteriaPair_GFCM.setValue(theValue);
    assetListQuery.getAssetSearchCriteria().getCriterias().add(assetListCriteriaPair_GFCM);
    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)

Example 24 with Asset

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

the class AssetRestIT method getAssetListItemCountTest.

@Test
public void getAssetListItemCountTest() throws Exception {
    AssetListQuery assetListQuery = AssetTestHelper.getBasicAssetQuery();
    AssetListCriteriaPair assetListCriteriaPair = new AssetListCriteriaPair();
    assetListCriteriaPair.setKey(ConfigSearchField.FLAG_STATE);
    assetListCriteriaPair.setValue("SWE");
    assetListQuery.getAssetSearchCriteria().getCriterias().add(assetListCriteriaPair);
    Integer countBefore = AssetTestHelper.assetListQueryCount(assetListQuery);
    // Add new asset
    Asset asset = AssetTestHelper.createDummyAsset(AssetIdType.GUID);
    asset.setCountryCode("SWE");
    AssetTestHelper.createAsset(asset);
    Integer countAfter = AssetTestHelper.assetListQueryCount(assetListQuery);
    assertEquals(Integer.valueOf(countBefore + 1), countAfter);
}
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) AbstractRestServiceTest(eu.europa.ec.fisheries.uvms.docker.validation.common.AbstractRestServiceTest)

Example 25 with Asset

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

the class AssetRestIT method getAssetListMultipleAssetsGuidsTest.

@Test
public void getAssetListMultipleAssetsGuidsTest() throws Exception {
    Asset asset1 = AssetTestHelper.createTestAsset();
    Asset asset2 = AssetTestHelper.createTestAsset();
    AssetListQuery assetListQuery = AssetTestHelper.getBasicAssetQuery();
    AssetListCriteriaPair assetListCriteriaPair1 = new AssetListCriteriaPair();
    assetListCriteriaPair1.setKey(ConfigSearchField.GUID);
    assetListCriteriaPair1.setValue(asset1.getAssetId().getGuid());
    assetListQuery.getAssetSearchCriteria().getCriterias().add(assetListCriteriaPair1);
    AssetListCriteriaPair assetListCriteriaPair2 = new AssetListCriteriaPair();
    assetListCriteriaPair2.setKey(ConfigSearchField.GUID);
    assetListCriteriaPair2.setValue(asset2.getAssetId().getGuid());
    assetListQuery.getAssetSearchCriteria().getCriterias().add(assetListCriteriaPair2);
    ListAssetResponse assetListResponse = AssetTestHelper.assetListQuery(assetListQuery);
    List<Asset> assets = assetListResponse.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)

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