-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #152 from fbrns/issues/112-do-not-lock-all-availab…
…le-events #112 Do not lock all available events
- Loading branch information
Showing
10 changed files
with
102 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
...ring-boot-starter/src/test/java/org/zalando/nakadiproducer/EventLockSizeConfiguredIT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package org.zalando.nakadiproducer; | ||
|
||
import static org.hamcrest.MatcherAssert.assertThat; | ||
import static org.hamcrest.Matchers.hasSize; | ||
|
||
import org.junit.Test; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.test.context.SpringBootTest; | ||
import org.zalando.nakadiproducer.eventlog.EventLogWriter; | ||
import org.zalando.nakadiproducer.transmission.impl.EventTransmissionService; | ||
import org.zalando.nakadiproducer.util.Fixture; | ||
|
||
@SpringBootTest( | ||
properties = {"nakadi-producer.lock-size=3"} | ||
) | ||
public class EventLockSizeConfiguredIT extends BaseMockedExternalCommunicationIT { | ||
|
||
@Autowired | ||
private EventLogWriter eventLogWriter; | ||
|
||
@Autowired | ||
private EventTransmissionService eventTransmissionService; | ||
|
||
@Test | ||
public void eventLockSizeIsRespected() { | ||
|
||
for (int i = 1; i <= 8; i++) { | ||
eventLogWriter.fireBusinessEvent( "myEventType", Fixture.mockPayload(i, "code123")); | ||
} | ||
|
||
assertThat(eventTransmissionService.lockSomeEvents(), hasSize(3)); | ||
assertThat(eventTransmissionService.lockSomeEvents(), hasSize(3)); | ||
assertThat(eventTransmissionService.lockSomeEvents(), hasSize(2)); | ||
} | ||
|
||
} |
30 changes: 30 additions & 0 deletions
30
...-spring-boot-starter/src/test/java/org/zalando/nakadiproducer/EventLockSizeDefaultIT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package org.zalando.nakadiproducer; | ||
|
||
import static org.hamcrest.MatcherAssert.assertThat; | ||
import static org.hamcrest.Matchers.hasSize; | ||
|
||
import org.junit.Test; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.zalando.nakadiproducer.eventlog.EventLogWriter; | ||
import org.zalando.nakadiproducer.transmission.impl.EventTransmissionService; | ||
import org.zalando.nakadiproducer.util.Fixture; | ||
|
||
public class EventLockSizeDefaultIT extends BaseMockedExternalCommunicationIT { | ||
|
||
@Autowired | ||
private EventLogWriter eventLogWriter; | ||
|
||
@Autowired | ||
private EventTransmissionService eventTransmissionService; | ||
|
||
@Test | ||
public void defaultEventLockSizeIsUsed() { | ||
|
||
for (int i = 1; i <= 8; i++) { | ||
eventLogWriter.fireBusinessEvent("myEventType", Fixture.mockPayload(i, "code123")); | ||
} | ||
|
||
assertThat(eventTransmissionService.lockSomeEvents(), hasSize(8)); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters