Loading vessels-commands/src/main/resources/application-test.properties +1 −1 Original line number Diff line number Diff line spring.kafka.bootstrap-servers=${spring.embedded.kafka.brokers} spring.kafka.properties.schema.registry.url=http://localhost:8081 spring.kafka.properties.schema.registry.url=http://localhost:${schema.registry.port} stream.application.id=${random.value} Loading vessels-commands/src/test/java/es/redmic/test/vesselscommands/integration/vessel/CreateVesselFromRestTest.java +2 −1 Original line number Diff line number Diff line Loading @@ -66,7 +66,8 @@ import es.redmic.vesselslib.events.vessel.update.UpdateVesselEvent; @SpringBootTest(classes = { VesselsCommandsApplication.class }) @ActiveProfiles("test") @DirtiesContext @TestPropertySource(properties = { "spring.kafka.consumer.group-id=CreateVesselFromRestTest" }) @TestPropertySource(properties = { "spring.kafka.consumer.group-id=CreateVesselFromRestTest", "schema.registry.port=18081" }) @KafkaListener(topics = "${broker.topic.vessel}", groupId = "test") public class CreateVesselFromRestTest extends DocumentationCommandBaseTest { Loading vessels-commands/src/test/java/es/redmic/test/vesselscommands/integration/vessel/CreateVesselFromTrackingTest.java +2 −1 Original line number Diff line number Diff line Loading @@ -42,7 +42,8 @@ import es.redmic.vesselslib.dto.VesselDTO; import es.redmic.vesselslib.events.vessel.create.CreateVesselEvent; @RunWith(SpringJUnit4ClassRunner.class) @TestPropertySource(properties = { "spring.kafka.consumer.group-id=CreateVesselFromTrackingTest" }) @TestPropertySource(properties = { "spring.kafka.consumer.group-id=CreateVesselFromTrackingTest", "schema.registry.port=18082" }) @SpringBootTest(classes = { VesselsCommandsApplication.class }) @ActiveProfiles("test") @DirtiesContext Loading vessels-commands/src/test/java/es/redmic/test/vesselscommands/integration/vessel/GetVesselStateFromStoreTest.java +2 −1 Original line number Diff line number Diff line Loading @@ -31,7 +31,8 @@ import es.redmic.vesselslib.dto.VesselDTO; import es.redmic.vesselslib.events.vessel.update.UpdateVesselEvent; @RunWith(SpringJUnit4ClassRunner.class) @TestPropertySource(properties = { "spring.kafka.consumer.group-id=GetVesselStateFromStoreTest" }) @TestPropertySource(properties = { "spring.kafka.consumer.group-id=GetVesselStateFromStoreTest", "schema.registry.port=18083" }) @SpringBootTest(classes = { VesselsCommandsApplication.class }) @ActiveProfiles("test") @DirtiesContext Loading vessels-commands/src/test/java/es/redmic/test/vesselscommands/integration/vessel/VesselCommandHandlerTest.java +7 −4 Original line number Diff line number Diff line Loading @@ -62,7 +62,8 @@ import es.redmic.vesselslib.events.vessel.update.VesselUpdatedEvent; @ActiveProfiles("test") @DirtiesContext @KafkaListener(topics = "${broker.topic.vessel}", groupId = "${random.value}") @TestPropertySource(properties = { "spring.kafka.consumer.group-id=VesselCommandHandlerTest" }) @TestPropertySource(properties = { "spring.kafka.consumer.group-id=VesselCommandHandlerTest", "schema.registry.port=18084" }) public class VesselCommandHandlerTest extends KafkaBaseIntegrationTest { protected static Logger logger = LogManager.getLogger(); Loading Loading @@ -154,7 +155,7 @@ public class VesselCommandHandlerTest extends KafkaBaseIntegrationTest { event); future.addCallback(new SendListener()); Event confirm = (Event) blockingQueue.poll(60, TimeUnit.SECONDS); Event confirm = (Event) blockingQueue.poll(30, TimeUnit.SECONDS); assertNotNull(confirm); assertEquals(VesselEventType.VESSEL_DELETED.toString(), confirm.getType()); Loading Loading @@ -202,13 +203,15 @@ public class VesselCommandHandlerTest extends KafkaBaseIntegrationTest { vesselCreatedEvent.setSessionId(UUID.randomUUID().toString()); vesselCreatedEvent.getVessel().setName("Nombre erroneo al crearlo"); kafkaTemplate.send(VESSEL_TOPIC, vesselCreatedEvent.getAggregateId(), vesselCreatedEvent); blockingQueue.poll(20, TimeUnit.SECONDS); Event created = (Event) blockingQueue.poll(20, TimeUnit.SECONDS); assertNotNull(created); // Envía updated para meterlo en el stream y lo saca de la cola VesselUpdatedEvent vesselUpdatedEvent = VesselDataUtil.getVesselUpdatedEvent(mmsi + 5); vesselUpdatedEvent.setSessionId(UUID.randomUUID().toString()); kafkaTemplate.send(VESSEL_TOPIC, vesselUpdatedEvent.getAggregateId(), vesselUpdatedEvent); blockingQueue.poll(20, TimeUnit.SECONDS); Event updated = (Event) blockingQueue.poll(20, TimeUnit.SECONDS); assertNotNull(updated); // Envía failed y espera un evento de cancelled con el vessel original dentro UpdateVesselFailedEvent event = VesselDataUtil.getUpdateVesselFailedEvent(mmsi + 5); Loading Loading
vessels-commands/src/main/resources/application-test.properties +1 −1 Original line number Diff line number Diff line spring.kafka.bootstrap-servers=${spring.embedded.kafka.brokers} spring.kafka.properties.schema.registry.url=http://localhost:8081 spring.kafka.properties.schema.registry.url=http://localhost:${schema.registry.port} stream.application.id=${random.value} Loading
vessels-commands/src/test/java/es/redmic/test/vesselscommands/integration/vessel/CreateVesselFromRestTest.java +2 −1 Original line number Diff line number Diff line Loading @@ -66,7 +66,8 @@ import es.redmic.vesselslib.events.vessel.update.UpdateVesselEvent; @SpringBootTest(classes = { VesselsCommandsApplication.class }) @ActiveProfiles("test") @DirtiesContext @TestPropertySource(properties = { "spring.kafka.consumer.group-id=CreateVesselFromRestTest" }) @TestPropertySource(properties = { "spring.kafka.consumer.group-id=CreateVesselFromRestTest", "schema.registry.port=18081" }) @KafkaListener(topics = "${broker.topic.vessel}", groupId = "test") public class CreateVesselFromRestTest extends DocumentationCommandBaseTest { Loading
vessels-commands/src/test/java/es/redmic/test/vesselscommands/integration/vessel/CreateVesselFromTrackingTest.java +2 −1 Original line number Diff line number Diff line Loading @@ -42,7 +42,8 @@ import es.redmic.vesselslib.dto.VesselDTO; import es.redmic.vesselslib.events.vessel.create.CreateVesselEvent; @RunWith(SpringJUnit4ClassRunner.class) @TestPropertySource(properties = { "spring.kafka.consumer.group-id=CreateVesselFromTrackingTest" }) @TestPropertySource(properties = { "spring.kafka.consumer.group-id=CreateVesselFromTrackingTest", "schema.registry.port=18082" }) @SpringBootTest(classes = { VesselsCommandsApplication.class }) @ActiveProfiles("test") @DirtiesContext Loading
vessels-commands/src/test/java/es/redmic/test/vesselscommands/integration/vessel/GetVesselStateFromStoreTest.java +2 −1 Original line number Diff line number Diff line Loading @@ -31,7 +31,8 @@ import es.redmic.vesselslib.dto.VesselDTO; import es.redmic.vesselslib.events.vessel.update.UpdateVesselEvent; @RunWith(SpringJUnit4ClassRunner.class) @TestPropertySource(properties = { "spring.kafka.consumer.group-id=GetVesselStateFromStoreTest" }) @TestPropertySource(properties = { "spring.kafka.consumer.group-id=GetVesselStateFromStoreTest", "schema.registry.port=18083" }) @SpringBootTest(classes = { VesselsCommandsApplication.class }) @ActiveProfiles("test") @DirtiesContext Loading
vessels-commands/src/test/java/es/redmic/test/vesselscommands/integration/vessel/VesselCommandHandlerTest.java +7 −4 Original line number Diff line number Diff line Loading @@ -62,7 +62,8 @@ import es.redmic.vesselslib.events.vessel.update.VesselUpdatedEvent; @ActiveProfiles("test") @DirtiesContext @KafkaListener(topics = "${broker.topic.vessel}", groupId = "${random.value}") @TestPropertySource(properties = { "spring.kafka.consumer.group-id=VesselCommandHandlerTest" }) @TestPropertySource(properties = { "spring.kafka.consumer.group-id=VesselCommandHandlerTest", "schema.registry.port=18084" }) public class VesselCommandHandlerTest extends KafkaBaseIntegrationTest { protected static Logger logger = LogManager.getLogger(); Loading Loading @@ -154,7 +155,7 @@ public class VesselCommandHandlerTest extends KafkaBaseIntegrationTest { event); future.addCallback(new SendListener()); Event confirm = (Event) blockingQueue.poll(60, TimeUnit.SECONDS); Event confirm = (Event) blockingQueue.poll(30, TimeUnit.SECONDS); assertNotNull(confirm); assertEquals(VesselEventType.VESSEL_DELETED.toString(), confirm.getType()); Loading Loading @@ -202,13 +203,15 @@ public class VesselCommandHandlerTest extends KafkaBaseIntegrationTest { vesselCreatedEvent.setSessionId(UUID.randomUUID().toString()); vesselCreatedEvent.getVessel().setName("Nombre erroneo al crearlo"); kafkaTemplate.send(VESSEL_TOPIC, vesselCreatedEvent.getAggregateId(), vesselCreatedEvent); blockingQueue.poll(20, TimeUnit.SECONDS); Event created = (Event) blockingQueue.poll(20, TimeUnit.SECONDS); assertNotNull(created); // Envía updated para meterlo en el stream y lo saca de la cola VesselUpdatedEvent vesselUpdatedEvent = VesselDataUtil.getVesselUpdatedEvent(mmsi + 5); vesselUpdatedEvent.setSessionId(UUID.randomUUID().toString()); kafkaTemplate.send(VESSEL_TOPIC, vesselUpdatedEvent.getAggregateId(), vesselUpdatedEvent); blockingQueue.poll(20, TimeUnit.SECONDS); Event updated = (Event) blockingQueue.poll(20, TimeUnit.SECONDS); assertNotNull(updated); // Envía failed y espera un evento de cancelled con el vessel original dentro UpdateVesselFailedEvent event = VesselDataUtil.getUpdateVesselFailedEvent(mmsi + 5); Loading