Search in sources :

Example 1 with ListAssetResponse

use of eu.europa.ec.fisheries.wsdl.asset.types.ListAssetResponse 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 2 with ListAssetResponse

use of eu.europa.ec.fisheries.wsdl.asset.types.ListAssetResponse 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)

Example 3 with ListAssetResponse

use of eu.europa.ec.fisheries.wsdl.asset.types.ListAssetResponse 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 4 with ListAssetResponse

use of eu.europa.ec.fisheries.wsdl.asset.types.ListAssetResponse 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)

Example 5 with ListAssetResponse

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

the class AssetRestIT method getAssetListUpdatedIRCSNotFoundTest.

@Test
public void getAssetListUpdatedIRCSNotFoundTest() throws Exception {
    Asset testAsset = AssetTestHelper.createTestAsset();
    AssetListQuery assetListQuery = AssetTestHelper.getBasicAssetQuery();
    AssetListCriteriaPair assetListCriteriaPair = new AssetListCriteriaPair();
    assetListCriteriaPair.setKey(ConfigSearchField.IRCS);
    assetListCriteriaPair.setValue(testAsset.getIrcs());
    assetListQuery.getAssetSearchCriteria().getCriterias().add(assetListCriteriaPair);
    ListAssetResponse assetList = AssetTestHelper.assetListQuery(assetListQuery);
    List<Asset> assets = assetList.getAsset();
    assertTrue(assets.contains(testAsset));
    testAsset.setIrcs(testAsset.getIrcs() + "NEW");
    AssetTestHelper.updateAsset(testAsset);
    // Search with same query, the asset should not be found
    assetList = AssetTestHelper.assetListQuery(assetListQuery);
    assets = assetList.getAsset();
    assertFalse(assets.contains(testAsset));
}
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)9 ListAssetResponse (eu.europa.ec.fisheries.wsdl.asset.types.ListAssetResponse)9 AbstractRestServiceTest (eu.europa.ec.fisheries.uvms.docker.validation.common.AbstractRestServiceTest)8 AssetListCriteriaPair (eu.europa.ec.fisheries.wsdl.asset.types.AssetListCriteriaPair)8 AssetListQuery (eu.europa.ec.fisheries.wsdl.asset.types.AssetListQuery)8 Test (org.junit.Test)8