Search in sources :

Example 11 with ExchangeLogType

use of eu.europa.ec.fisheries.schema.exchange.v1.ExchangeLogType 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());
}
Also used : TypeRefType(eu.europa.ec.fisheries.schema.exchange.v1.TypeRefType) ExchangeLogStatusTypeType(eu.europa.ec.fisheries.schema.exchange.v1.ExchangeLogStatusTypeType) ExchangeLogType(eu.europa.ec.fisheries.schema.exchange.v1.ExchangeLogType) LogRefType(eu.europa.ec.fisheries.schema.exchange.v1.LogRefType) Date(java.util.Date) ExchangeLog(eu.europa.ec.fisheries.uvms.exchange.entity.exchangelog.ExchangeLog) Test(org.junit.Test)

Example 12 with ExchangeLogType

use of eu.europa.ec.fisheries.schema.exchange.v1.ExchangeLogType in project UVMS-ExchangeModule-APP by UnionVMS.

the class LogMapperTest method toModelWhenEntityIsReceiveSalesResponse.

@Test
public void toModelWhenEntityIsReceiveSalesResponse() {
    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.RECEIVE_SALES_RESPONSE);
    entity.setDestination(destination);
    ExchangeLogType model = LogMapper.toModel(entity);
    assertEquals(LogType.RECEIVE_SALES_RESPONSE, 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());
}
Also used : ExchangeLogStatusTypeType(eu.europa.ec.fisheries.schema.exchange.v1.ExchangeLogStatusTypeType) ExchangeLogType(eu.europa.ec.fisheries.schema.exchange.v1.ExchangeLogType) Date(java.util.Date) ExchangeLog(eu.europa.ec.fisheries.uvms.exchange.entity.exchangelog.ExchangeLog) Test(org.junit.Test)

Example 13 with ExchangeLogType

use of eu.europa.ec.fisheries.schema.exchange.v1.ExchangeLogType in project UVMS-ExchangeModule-APP by UnionVMS.

the class LogMapperTest method toModelWhenEntityIsSendSalesResponse.

@Test
public void toModelWhenEntityIsSendSalesResponse() {
    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_RESPONSE);
    entity.setDestination(destination);
    ExchangeLogType model = LogMapper.toModel(entity);
    assertEquals(LogType.SEND_SALES_RESPONSE, 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());
}
Also used : ExchangeLogStatusTypeType(eu.europa.ec.fisheries.schema.exchange.v1.ExchangeLogStatusTypeType) ExchangeLogType(eu.europa.ec.fisheries.schema.exchange.v1.ExchangeLogType) Date(java.util.Date) ExchangeLog(eu.europa.ec.fisheries.uvms.exchange.entity.exchangelog.ExchangeLog) Test(org.junit.Test)

Example 14 with ExchangeLogType

use of eu.europa.ec.fisheries.schema.exchange.v1.ExchangeLogType 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());
}
Also used : TypeRefType(eu.europa.ec.fisheries.schema.exchange.v1.TypeRefType) ExchangeLogStatusTypeType(eu.europa.ec.fisheries.schema.exchange.v1.ExchangeLogStatusTypeType) ExchangeLogType(eu.europa.ec.fisheries.schema.exchange.v1.ExchangeLogType) LogRefType(eu.europa.ec.fisheries.schema.exchange.v1.LogRefType) Date(java.util.Date) ExchangeLog(eu.europa.ec.fisheries.uvms.exchange.entity.exchangelog.ExchangeLog) Test(org.junit.Test)

Example 15 with ExchangeLogType

use of eu.europa.ec.fisheries.schema.exchange.v1.ExchangeLogType in project UVMS-ExchangeModule-APP by UnionVMS.

the class LogMapperTest method toModelWhenEntityIsReceiveSalesReport.

@Test
public void toModelWhenEntityIsReceiveSalesReport() {
    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.RECEIVE_SALES_REPORT);
    entity.setDestination(destination);
    ExchangeLogType model = LogMapper.toModel(entity);
    assertEquals(LogType.RECEIVE_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());
}
Also used : ExchangeLogStatusTypeType(eu.europa.ec.fisheries.schema.exchange.v1.ExchangeLogStatusTypeType) ExchangeLogType(eu.europa.ec.fisheries.schema.exchange.v1.ExchangeLogType) Date(java.util.Date) ExchangeLog(eu.europa.ec.fisheries.uvms.exchange.entity.exchangelog.ExchangeLog) Test(org.junit.Test)

Aggregations

ExchangeLogType (eu.europa.ec.fisheries.schema.exchange.v1.ExchangeLogType)43 ExchangeLog (eu.europa.ec.fisheries.uvms.exchange.entity.exchangelog.ExchangeLog)27 ExchangeLogStatusTypeType (eu.europa.ec.fisheries.schema.exchange.v1.ExchangeLogStatusTypeType)19 Test (org.junit.Test)19 ExchangeLogException (eu.europa.ec.fisheries.uvms.exchange.service.exception.ExchangeLogException)18 Date (java.util.Date)17 LogRefType (eu.europa.ec.fisheries.schema.exchange.v1.LogRefType)13 ExchangeModelException (eu.europa.ec.fisheries.uvms.exchange.model.exception.ExchangeModelException)9 TypeRefType (eu.europa.ec.fisheries.schema.exchange.v1.TypeRefType)8 ExchangeModelMarshallException (eu.europa.ec.fisheries.uvms.exchange.model.exception.ExchangeModelMarshallException)8 ExchangeDaoException (eu.europa.ec.fisheries.uvms.exchange.exception.ExchangeDaoException)5 NotificationMessage (eu.europa.ec.fisheries.uvms.longpolling.notifications.NotificationMessage)5 JMSException (javax.jms.JMSException)5 InputArgumentException (eu.europa.ec.fisheries.uvms.exchange.model.exception.InputArgumentException)4 ArrayList (java.util.ArrayList)4 PluginType (eu.europa.ec.fisheries.schema.exchange.plugin.types.v1.PluginType)3 SendEmailType (eu.europa.ec.fisheries.schema.exchange.v1.SendEmailType)3 SendMovementType (eu.europa.ec.fisheries.schema.exchange.v1.SendMovementType)3 SendPollType (eu.europa.ec.fisheries.schema.exchange.v1.SendPollType)3 ExchangeLogStatus (eu.europa.ec.fisheries.uvms.exchange.entity.exchangelog.ExchangeLogStatus)3