use of eu.europa.ec.fisheries.wsdl.asset.types.AssetHistoryId 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.AssetHistoryId 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());
}
}
Aggregations