use of eu.europa.ec.fisheries.wsdl.asset.types.Asset in project UVMS-Docker by UnionVMS.
the class AssetHistoryRestIT method getAssetFromAssetIdAndDate.
@Test
public void getAssetFromAssetIdAndDate() throws Exception {
try {
Date eventDate = null;
AssetHistoryId history = null;
// Create asset
Asset asset = AssetTestHelper.createCfrTestAsset();
history = asset.getEventHistory();
eventDate = history.getEventDate();
Thread.sleep(1000);
AssetIdType assetIdType = AssetIdType.CFR;
String value = asset.getCfr();
String type = assetIdType.value();
Asset fetchedAsset = AssetTestHelper.getAssetFromAssetIdAndDate(type, value, eventDate);
Assert.assertEquals(asset.getCfr(), fetchedAsset.getCfr());
} catch (RuntimeException e) {
System.out.println(e.toString());
}
}
use of eu.europa.ec.fisheries.wsdl.asset.types.Asset in project UVMS-Docker by UnionVMS.
the class AssetHistoryRestIT method getAssetHistoryListByAssetIdHistoriesIsRetainedTest.
@Test
public void getAssetHistoryListByAssetIdHistoriesIsRetainedTest() 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);
List<Asset> assetHistories = AssetTestHelper.getAssetHistoryFromAssetGuid(asset3.getAssetId().getGuid());
assertTrue(assetHistories.size() == 3);
assertTrue(assetHistories.contains(asset1));
assertTrue(assetHistories.contains(asset2));
assertTrue(assetHistories.contains(asset3));
}
use of eu.europa.ec.fisheries.wsdl.asset.types.Asset in project UVMS-Docker by UnionVMS.
the class AssetHistoryRestIT method getAssetHistoryByAssetHistGuidTest.
/**
* Gets the asset history by asset hist guid test.
*
* @return the asset history by asset hist guid test
* @throws Exception
* the exception
*/
@Test
// FIXME timeout on jenkins
@Ignore
public void getAssetHistoryByAssetHistGuidTest() throws Exception {
Asset asset = AssetTestHelper.createTestAsset();
Asset assetFromHistory = AssetTestHelper.getAssetHistoryFromHistoryGuid(asset.getEventHistory().getEventId());
assertEquals(asset, assetFromHistory);
}
use of eu.europa.ec.fisheries.wsdl.asset.types.Asset in project UVMS-Docker by UnionVMS.
the class AssetHistoryRestIT method getAssetFlagStateByAssetIdAndDate.
@Test
public void getAssetFlagStateByAssetIdAndDate() throws Exception {
try {
Date eventDate = null;
AssetHistoryId history = null;
Date aNorDate = null;
// Create asset versions
Asset asset = AssetTestHelper.createTestAsset();
String assetGuid = asset.getAssetId().getGuid();
history = asset.getEventHistory();
eventDate = history.getEventDate();
Thread.sleep(1000);
FlagStateType flagState = AssetTestHelper.getFlagStateFromAssetGuidAndDate(assetGuid, eventDate);
String returnedCode = flagState.getCode();
Assert.assertEquals("SWE", returnedCode);
asset.setCountryCode("DNK");
AssetTestHelper.updateAsset(asset);
asset = AssetTestHelper.getAssetByGuid(assetGuid);
history = asset.getEventHistory();
eventDate = history.getEventDate();
flagState = AssetTestHelper.getFlagStateFromAssetGuidAndDate(assetGuid, eventDate);
returnedCode = flagState.getCode();
Assert.assertEquals("DNK", returnedCode);
asset.setCountryCode("NOR");
asset = AssetTestHelper.updateAsset(asset);
history = asset.getEventHistory();
eventDate = history.getEventDate();
aNorDate = history.getEventDate();
Thread.sleep(1000);
flagState = AssetTestHelper.getFlagStateFromAssetGuidAndDate(assetGuid, eventDate);
returnedCode = flagState.getCode();
Assert.assertEquals("NOR", returnedCode);
asset.setCountryCode("DNK");
asset = AssetTestHelper.updateAsset(asset);
history = asset.getEventHistory();
eventDate = history.getEventDate();
Thread.sleep(1000);
flagState = AssetTestHelper.getFlagStateFromAssetGuidAndDate(assetGuid, eventDate);
returnedCode = flagState.getCode();
Assert.assertEquals("DNK", returnedCode);
asset.setCountryCode("SWE");
asset = AssetTestHelper.updateAsset(asset);
history = asset.getEventHistory();
eventDate = history.getEventDate();
Thread.sleep(1000);
flagState = AssetTestHelper.getFlagStateFromAssetGuidAndDate(assetGuid, eventDate);
returnedCode = flagState.getCode();
Assert.assertEquals("SWE", returnedCode);
asset.setCountryCode("DNK");
asset = AssetTestHelper.updateAsset(asset);
history = asset.getEventHistory();
eventDate = history.getEventDate();
Thread.sleep(1000);
flagState = AssetTestHelper.getFlagStateFromAssetGuidAndDate(assetGuid, eventDate);
returnedCode = flagState.getCode();
Assert.assertEquals("DNK", returnedCode);
// here we test a saved norwegian date
flagState = AssetTestHelper.getFlagStateFromAssetGuidAndDate(assetGuid, aNorDate);
returnedCode = flagState.getCode();
Assert.assertEquals("NOR", returnedCode);
} catch (RuntimeException e) {
System.out.println(e.toString());
}
}
use of eu.europa.ec.fisheries.wsdl.asset.types.Asset in project UVMS-Docker by UnionVMS.
the class AssetJMSIT method testGetAssetByCFR.
@Test
public void testGetAssetByCFR() throws Exception {
Asset asset = AssetTestHelper.createDummyCFRAsset();
asset = AssetTestHelper.createAsset(asset);
Asset assetById = AssetJMSHelper.getAssetById(asset.getCfr(), AssetIdType.CFR);
setDecimalScaleAndNullNotes(assetById);
assertEquals(asset, assetById);
}
Aggregations