use of eu.europa.ec.fisheries.schema.exchange.v1.TypeRefType in project UVMS-ExchangeModule-APP by UnionVMS.
the class LogMapperTest method toNewEntityWhenLogTypeIsSendMovement.
@Test
public void toNewEntityWhenLogTypeIsSendMovement() throws Exception {
// data set
String typeRefGuid = "trg";
TypeRefType typeRefType = TypeRefType.MOVEMENT;
Date dateReceived = new Date();
String senderOrReceiver = "BEL";
ExchangeLogStatusTypeType status = ExchangeLogStatusTypeType.SUCCESSFUL;
String message = "<xml></xml>";
LogRefType logRefType = new LogRefType();
logRefType.setRefGuid(typeRefGuid);
logRefType.setType(typeRefType);
logRefType.setMessage(message);
Date fwdDate = new Date();
String fwdRule = "fantastic rules and where to find them";
String recipient = "potter@wb.com";
SendMovementType input = new SendMovementType();
input.setType(LogType.SEND_MOVEMENT);
input.setTypeRef(logRefType);
input.setDateRecieved(dateReceived);
input.setSenderReceiver(senderOrReceiver);
input.setStatus(status);
input.setFwdDate(fwdDate);
input.setFwdRule(fwdRule);
input.setRecipient(recipient);
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());
assertEquals(fwdDate, result.getFwdDate());
assertEquals(fwdRule, result.getFwdRule());
assertEquals(recipient, result.getRecipient());
assertFalse(result.getTransferIncoming());
assertEquals(LogType.SEND_MOVEMENT, result.getType());
}
use of eu.europa.ec.fisheries.schema.exchange.v1.TypeRefType in project UVMS-ExchangeModule-APP by UnionVMS.
the class LogMapperTest method toNewEntityWhenLogTypeIsReceiveSalesQuery.
@Test
public void toNewEntityWhenLogTypeIsReceiveSalesQuery() throws Exception {
// data set
String typeRefGuid = "trg";
TypeRefType typeRefType = TypeRefType.SALES_QUERY;
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_QUERY);
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_QUERY, result.getType());
assertEquals(destination, result.getDestination());
}
use of eu.europa.ec.fisheries.schema.exchange.v1.TypeRefType in project UVMS-ExchangeModule-APP by UnionVMS.
the class LogMapperTest method toNewEntityWhenLogTypeIsReceiveSalesResponse.
@Test
public void toNewEntityWhenLogTypeIsReceiveSalesResponse() throws Exception {
// data set
String typeRefGuid = "trg";
TypeRefType typeRefType = TypeRefType.SALES_RESPONSE;
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_RESPONSE);
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_RESPONSE, result.getType());
assertEquals(destination, result.getDestination());
}
use of eu.europa.ec.fisheries.schema.exchange.v1.TypeRefType in project UVMS-ExchangeModule-APP by UnionVMS.
the class LogMapperTest method toNewEntityWhenLogTypeIsSendSalesReport.
@Test
public void toNewEntityWhenLogTypeIsSendSalesReport() 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.SEND_SALES_REPORT);
input.setTypeRef(logRefType);
input.setDateRecieved(dateReceived);
input.setSenderReceiver(senderOrReceiver);
input.setStatus(status);
input.setIncoming(false);
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());
assertFalse(result.getTransferIncoming());
assertEquals(LogType.SEND_SALES_REPORT, result.getType());
assertEquals(destination, result.getDestination());
}
use of eu.europa.ec.fisheries.schema.exchange.v1.TypeRefType in project UVMS-ExchangeModule-APP by UnionVMS.
the class LogMapperTest method toNewEntityWhenLogTypeIsSendPoll.
@Test
public void toNewEntityWhenLogTypeIsSendPoll() throws Exception {
// data set
String typeRefGuid = "trg";
TypeRefType typeRefType = TypeRefType.POLL;
Date dateReceived = new Date();
String senderOrReceiver = "BEL";
ExchangeLogStatusTypeType status = ExchangeLogStatusTypeType.SUCCESSFUL;
String message = "<xml></xml>";
LogRefType logRefType = new LogRefType();
logRefType.setRefGuid(typeRefGuid);
logRefType.setType(typeRefType);
logRefType.setMessage(message);
Date fwdDate = new Date();
String recipient = "potter@wb.com";
SendPollType input = new SendPollType();
input.setType(LogType.SEND_POLL);
input.setTypeRef(logRefType);
input.setDateRecieved(dateReceived);
input.setSenderReceiver(senderOrReceiver);
input.setStatus(status);
input.setFwdDate(fwdDate);
input.setRecipient(recipient);
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());
assertEquals(fwdDate, result.getFwdDate());
assertEquals(recipient, result.getRecipient());
assertFalse(result.getTransferIncoming());
assertEquals(LogType.SEND_POLL, result.getType());
}
Aggregations