Skip to content
Permalink
Browse files
Making beatCheckRate configurable so that it can be increased in test.
  • Loading branch information
mifosio-04-04-2018 committed May 17, 2017
1 parent 4e57a89 commit 853a677cd0d6e221f453233236f1270564baa97c
Showing 3 changed files with 13 additions and 3 deletions.
@@ -50,7 +50,7 @@
@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT,
classes = {AbstractRhythmTest.TestConfiguration.class},
properties = "rhythm.user=homer"
properties = {"rhythm.user=homer", "rhythm.beatCheckRate=4000"}
)
public class AbstractRhythmTest {

@@ -18,13 +18,16 @@
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

import java.util.concurrent.TimeUnit;

/**
* @author Myrle Krantz
*/
@Component
@ConfigurationProperties(prefix="rhythm")
public class RhythmProperties {
private String user;
private Long beatCheckRate = TimeUnit.MINUTES.toMillis(5);

public RhythmProperties() {
}
@@ -36,4 +39,12 @@ public void setUser(String user) {
public String getUser() {
return user;
}

public Long getBeatCheckRate() {
return beatCheckRate;
}

public void setBeatCheckRate(Long beatCheckRate) {
this.beatCheckRate = beatCheckRate;
}
}
@@ -51,8 +51,7 @@ public Drummer(
this.logger = logger;
}

//@Scheduled(initialDelay = 300_000, fixedRate = 300_000) //TimeUnit.MINUTES.toMillis(5)
@Scheduled(initialDelay = 4_000, fixedRate = 4_000)
@Scheduled(initialDelayString = "${rhythm.beatCheckRate}", fixedRateString = "${rhythm.beatCheckRate}")
public void checkForBeatsNeeded() {
try {
final LocalDateTime now = LocalDateTime.now(ZoneId.of("UTC"));

0 comments on commit 853a677

Please sign in to comment.