Skip to content

Commit

Permalink
Test replies
Browse files Browse the repository at this point in the history
  • Loading branch information
jdpgrailsdev committed Dec 23, 2024
1 parent d7e422a commit 9d04031
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
2 changes: 2 additions & 0 deletions autobot/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -47,13 +48,16 @@ public class EventPublisherController {

private final PostFormatUtils postFormatUtils;

private final Faker faker;

public EventPublisherController(
final PostTimelineEventScheduler postTimelineEventScheduler,
final List<PostPublisherService<?>> publishers,
final PostFormatUtils postFormatUtils) {
this.postTimelineEventScheduler = postTimelineEventScheduler;
this.publishers = publishers;
this.postFormatUtils = postFormatUtils;
this.faker = new Faker();
}

@RequestMapping("events")
Expand All @@ -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,
Expand Down
1 change: 1 addition & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down

0 comments on commit 9d04031

Please sign in to comment.