diff --git a/autobot/build.gradle.kts b/autobot/build.gradle.kts index dee3e96..16080f9 100644 --- a/autobot/build.gradle.kts +++ b/autobot/build.gradle.kts @@ -178,6 +178,8 @@ dependencies { ) .forEach { implementation(it) } + implementation(libs.java.faker) { exclude(group = "org.yaml") } + listOf("org.springframework.boot:spring-boot-properties-migrator").forEach { runtimeOnly(it) } // listOf( diff --git a/autobot/src/main/java/com/jdpgrailsdev/oasis/timeline/controller/EventPublisherController.java b/autobot/src/main/java/com/jdpgrailsdev/oasis/timeline/controller/EventPublisherController.java index a439b3f..b55e0b1 100644 --- a/autobot/src/main/java/com/jdpgrailsdev/oasis/timeline/controller/EventPublisherController.java +++ b/autobot/src/main/java/com/jdpgrailsdev/oasis/timeline/controller/EventPublisherController.java @@ -19,6 +19,7 @@ package com.jdpgrailsdev.oasis.timeline.controller; +import com.github.javafaker.Faker; import com.jdpgrailsdev.oasis.timeline.data.Post; import com.jdpgrailsdev.oasis.timeline.data.PostException; import com.jdpgrailsdev.oasis.timeline.data.PostTarget; @@ -47,6 +48,8 @@ public class EventPublisherController { private final PostFormatUtils postFormatUtils; + private final Faker faker; + public EventPublisherController( final PostTimelineEventScheduler postTimelineEventScheduler, final List> publishers, @@ -54,6 +57,7 @@ public EventPublisherController( this.postTimelineEventScheduler = postTimelineEventScheduler; this.publishers = publishers; this.postFormatUtils = postFormatUtils; + this.faker = new Faker(); } @RequestMapping("events") @@ -74,7 +78,12 @@ public void publishTestEventsToSocialNetwork( @PathVariable("postTarget") final PostTarget postTarget, @RequestParam(value = "type", required = false) final TimelineDataType type) throws PostException { - final String description = "some text with Test Mention and some hash tags #tag1 and #tag2."; + + final String description = + "Some text with Test Mention and some hash tags #tag1 and #tag2." + + "\n" + + faker.lorem().characters(postTarget.getLimit() * 3); + final Post post = postFormatUtils.generatePost( description, diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index faab0fb..737c319 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -32,6 +32,7 @@ commons-io = { module = "commons-io:commons-io", version.ref = "commons-io" } google-java-format = { module = "com.google.googlejavaformat:google-java-format", version.ref = "google-java-format"} guava = { module = "com.google.guava:guava", version.ref = "guava"} jackson-datatype-jsr310 = { module = "com.fasterxml.jackson.datatype:jackson-datatype-jsr310", version.ref = "jackson-datatype-jsr310" } +java-faker = { module = "com.github.javafaker:javafaker", version = "1.0.2" } jedis = { module = "redis.clients:jedis", version.ref = "jedis" } jedis-mock = { module = "com.github.fppt:jedis-mock", version.ref = "jedis-mock" } junit-bom = { module = "org.junit:junit-bom", version.ref = "junit" }