use of eu.europa.ec.fisheries.schema.exchange.v1.ExchangeLogType in project UVMS-ExchangeModule-APP by UnionVMS.
the class LogMapperTest method toNewEntityWhenLogTypeIsReceiveSalesReportAndUsernameIsNull.
@Test
public void toNewEntityWhenLogTypeIsReceiveSalesReportAndUsernameIsNull() throws Exception {
// data set
Date dateReceived = new Date();
String senderOrReceiver = "BEL";
ExchangeLogStatusTypeType status = ExchangeLogStatusTypeType.SUCCESSFUL;
String destination = "destination";
ExchangeLogType input = new ExchangeLogType();
input.setType(LogType.RECEIVE_SALES_REPORT);
input.setDateRecieved(dateReceived);
input.setSenderReceiver(senderOrReceiver);
input.setStatus(status);
input.setIncoming(true);
input.setDestination(destination);
// execute
ExchangeLog result = LogMapper.toNewEntity(input, null);
// assert
assertEquals(dateReceived, result.getDateReceived());
assertEquals(senderOrReceiver, result.getSenderReceiver());
assertEquals(status, result.getStatus());
assertEquals(1, result.getStatusHistory().size());
assertEquals(result, result.getStatusHistory().get(0).getLog());
assertEquals(status, result.getStatusHistory().get(0).getStatus());
assertNotNull(result.getStatusHistory().get(0).getStatusTimestamp());
assertEquals("SYSTEM", result.getStatusHistory().get(0).getUpdatedBy());
assertNotNull(result.getStatusHistory().get(0).getUpdateTime());
assertEquals("SYSTEM", result.getUpdatedBy());
assertNotNull(result.getUpdateTime());
assertTrue(result.getTransferIncoming());
assertEquals(LogType.RECEIVE_SALES_REPORT, result.getType());
assertEquals(destination, result.getDestination());
}
use of eu.europa.ec.fisheries.schema.exchange.v1.ExchangeLogType in project UVMS-ExchangeModule-APP by UnionVMS.
the class LogMapperTest method toNewEntityWhenLogTypeIsReceiveSalesReportAndTypeRefIsNotFilledIn.
@Test
public void toNewEntityWhenLogTypeIsReceiveSalesReportAndTypeRefIsNotFilledIn() throws Exception {
// data set
Date dateReceived = new Date();
String senderOrReceiver = "BEL";
ExchangeLogStatusTypeType status = ExchangeLogStatusTypeType.SUCCESSFUL;
String destination = "destination";
ExchangeLogType input = new ExchangeLogType();
input.setType(LogType.RECEIVE_SALES_REPORT);
input.setDateRecieved(dateReceived);
input.setSenderReceiver(senderOrReceiver);
input.setStatus(status);
input.setIncoming(true);
input.setDestination(destination);
String username = "stainii";
// execute
ExchangeLog result = LogMapper.toNewEntity(input, username);
// assert
assertEquals(dateReceived, result.getDateReceived());
assertEquals(senderOrReceiver, result.getSenderReceiver());
assertEquals(status, result.getStatus());
assertEquals(1, result.getStatusHistory().size());
assertEquals(result, result.getStatusHistory().get(0).getLog());
assertEquals(status, result.getStatusHistory().get(0).getStatus());
assertNotNull(result.getStatusHistory().get(0).getStatusTimestamp());
assertEquals(username, result.getStatusHistory().get(0).getUpdatedBy());
assertNotNull(result.getStatusHistory().get(0).getUpdateTime());
assertEquals(username, result.getUpdatedBy());
assertNotNull(result.getUpdateTime());
assertTrue(result.getTransferIncoming());
assertEquals(LogType.RECEIVE_SALES_REPORT, result.getType());
assertEquals(destination, result.getDestination());
}
use of eu.europa.ec.fisheries.schema.exchange.v1.ExchangeLogType in project UVMS-ExchangeModule-APP by UnionVMS.
the class LogMapperTest method toModelWhenEntityIsSendSalesReport.
@Test
public void toModelWhenEntityIsSendSalesReport() {
Date dateReceived = new Date();
String guid = "Paradise";
String senderReceiver = "Chris Martin";
boolean incoming = true;
ExchangeLogStatusTypeType status = ExchangeLogStatusTypeType.PROBABLY_TRANSMITTED;
String destination = "destination";
ExchangeLog entity = new ExchangeLog();
entity.setDateReceived(dateReceived);
entity.setGuid(guid);
entity.setSenderReceiver(senderReceiver);
entity.setTransferIncoming(incoming);
entity.setStatus(status);
entity.setType(LogType.SEND_SALES_REPORT);
entity.setDestination(destination);
ExchangeLogType model = LogMapper.toModel(entity);
assertEquals(LogType.SEND_SALES_REPORT, model.getType());
assertEquals(dateReceived, model.getDateRecieved());
assertEquals(guid, model.getGuid());
assertEquals(senderReceiver, model.getSenderReceiver());
assertEquals(incoming, model.isIncoming());
assertEquals(status, model.getStatus());
assertEquals(destination, model.getDestination());
}
use of eu.europa.ec.fisheries.schema.exchange.v1.ExchangeLogType in project UVMS-ExchangeModule-APP by UnionVMS.
the class LogMapperTest method toNewEntityWhenLogTypeIsReceiveSalesReportAndTypeRefAndStatusAreFilledIn.
@Test
public void toNewEntityWhenLogTypeIsReceiveSalesReportAndTypeRefAndStatusAreFilledIn() throws Exception {
// data set
String typeRefGuid = "trg";
TypeRefType typeRefType = TypeRefType.SALES_REPORT;
Date dateReceived = new Date();
String senderOrReceiver = "BEL";
ExchangeLogStatusTypeType status = ExchangeLogStatusTypeType.SUCCESSFUL;
String message = "<xml></xml>";
String destination = "destination";
LogRefType logRefType = new LogRefType();
logRefType.setRefGuid(typeRefGuid);
logRefType.setType(typeRefType);
logRefType.setMessage(message);
ExchangeLogType input = new ExchangeLogType();
input.setType(LogType.RECEIVE_SALES_REPORT);
input.setTypeRef(logRefType);
input.setDateRecieved(dateReceived);
input.setSenderReceiver(senderOrReceiver);
input.setStatus(status);
input.setIncoming(true);
input.setDestination(destination);
String username = "stainii";
// execute
ExchangeLog result = LogMapper.toNewEntity(input, username);
// assert
assertEquals(typeRefGuid, result.getTypeRefGuid());
assertEquals(typeRefType, result.getTypeRefType());
assertEquals(dateReceived, result.getDateReceived());
assertEquals(senderOrReceiver, result.getSenderReceiver());
assertEquals(status, result.getStatus());
assertEquals(1, result.getStatusHistory().size());
assertEquals(result, result.getStatusHistory().get(0).getLog());
assertEquals(status, result.getStatusHistory().get(0).getStatus());
assertNotNull(result.getStatusHistory().get(0).getStatusTimestamp());
assertEquals(username, result.getStatusHistory().get(0).getUpdatedBy());
assertNotNull(result.getStatusHistory().get(0).getUpdateTime());
assertEquals(username, result.getUpdatedBy());
assertNotNull(result.getUpdateTime());
assertTrue(result.getTransferIncoming());
assertEquals(LogType.RECEIVE_SALES_REPORT, result.getType());
assertEquals(destination, result.getDestination());
}
use of eu.europa.ec.fisheries.schema.exchange.v1.ExchangeLogType in project UVMS-ExchangeModule-APP by UnionVMS.
the class LogMapperTest method toModelWhenEntityIsReceiveMovementLog.
@Test
public void toModelWhenEntityIsReceiveMovementLog() {
Date dateReceived = new Date();
String guid = "Paradise";
String senderReceiver = "Chris Martin";
boolean incoming = true;
ExchangeLogStatusTypeType status = ExchangeLogStatusTypeType.PROBABLY_TRANSMITTED;
String source = "Coldplay";
String recipient = "Viva la vida";
ExchangeLog entity = new ExchangeLog();
entity.setDateReceived(dateReceived);
entity.setGuid(guid);
entity.setSenderReceiver(senderReceiver);
entity.setTransferIncoming(incoming);
entity.setStatus(status);
entity.setSource(source);
entity.setRecipient(recipient);
entity.setType(LogType.RECEIVE_MOVEMENT);
ExchangeLogType model = LogMapper.toModel(entity);
assertEquals(LogType.RECEIVE_MOVEMENT, model.getType());
assertEquals(dateReceived, model.getDateRecieved());
assertEquals(guid, model.getGuid());
assertEquals(senderReceiver, model.getSenderReceiver());
assertEquals(incoming, model.isIncoming());
assertEquals(status, model.getStatus());
assertEquals(source, ((ReceiveMovementType) model).getSource());
assertEquals(recipient, ((ReceiveMovementType) model).getRecipient());
}
Aggregations