Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GROUP-63 Update API Endpoints to Use /api Prefix #17

Merged
merged 7 commits into from
Dec 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,10 @@ dependencies {
testImplementation("io.cucumber:cucumber-spring")

// Lombok Dependencies
compileOnly "org.projectlombok:lombok:1.18.30"
annotationProcessor "org.projectlombok:lombok:1.18.30"
testCompileOnly "org.projectlombok:lombok:1.18.30"
testAnnotationProcessor "org.projectlombok:lombok:1.18.30"
compileOnly "org.projectlombok:lombok"
annotationProcessor "org.projectlombok:lombok"
testCompileOnly "org.projectlombok:lombok"
testAnnotationProcessor "org.projectlombok:lombok"
}

dependencyManagement {
Expand Down
4 changes: 4 additions & 0 deletions k8s/base/deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ spec:
volumeMounts:
- name: group-service-config-volume
mountPath: /workspace/config
resources:
requests:
cpu: "1"
memory: 756Mi
imagePullSecrets:
- name: ghcr-secret
volumes:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ SecurityWebFilterChain filterChain(ServerHttpSecurity httpSecurity) {
return httpSecurity
.authorizeExchange(authorizeExchangeSpec -> authorizeExchangeSpec
.pathMatchers("/actuator/**").permitAll()
.pathMatchers("/groups/**").permitAll()
.pathMatchers("/api/groups/**").permitAll()
.anyExchange().authenticated())
.csrf(ServerHttpSecurity.CsrfSpec::disable)
.build();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.grouphq.groupservice.group.demo;

import java.time.Duration;
import java.time.Instant;
import java.time.temporal.ChronoUnit;
import java.util.UUID;
Expand Down Expand Up @@ -61,6 +62,7 @@ public Flux<Void> loadGroups(int initialGroupSize,
}

return Flux.just(createRequestEvents)
.delayElements(Duration.ofSeconds(1))
.flatMap(groupService::createGroup)
.onErrorResume(throwable -> {
log.error("Error creating group", throwable);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* A controller containing endpoints for accessing and managing group info.
*/
@RestController
@RequestMapping("groups")
@RequestMapping("api/groups")
@RequiredArgsConstructor
@Slf4j
public class GroupController {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public void thereAreActiveGroups() {
public void iRequestGroups() {
groupResponse = webTestClient
.get()
.uri("/groups")
.uri("/api/groups")
.exchange()
.expectStatus().is2xxSuccessful()
.expectBodyList(Group.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,12 @@ void loadsGroups(
StepVerifier.create(
groupDemoLoader.loadGroups(initialGroupSize, periodicGroupAdditionCount))
.expectComplete()
.verify(Duration.ofSeconds(1));
.verify();

StepVerifier.create(
groupDemoLoader.loadGroups(initialGroupSize, periodicGroupAdditionCount))
.expectComplete()
.verify(Duration.ofSeconds(1));
.verify();

StepVerifier.create(groupRepository.getAllGroups())
.expectNextCount(initialGroupSize + periodicGroupAdditionCount)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ void loaderTest() {

StepVerifier.create(groupDemoLoader.loadGroups(3, 1))
.expectComplete()
.verify(Duration.ofSeconds(1));
.verify();

verify(groupService, times(3)).generateGroup();
verify(groupService, times(3)).createGroup(any(GroupCreateRequestEvent.class));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ void returnActiveGroups() {

webTestClient
.get()
.uri("/groups")
.uri("/api/groups")
.exchange()
.expectStatus().is2xxSuccessful()
.expectBodyList(Group.class).value(retrievedGroups -> {
Expand Down Expand Up @@ -132,7 +132,7 @@ void retrieveActiveGroupMembersAsPublic() {

webTestClient
.get()
.uri("/groups/" + groupId + "/members")
.uri("/api/groups/" + groupId + "/members")
.exchange()
.expectStatus().is2xxSuccessful()
.expectBodyList(PublicMember.class).value(retrievedMembers -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
@Tag("IntegrationTest")
class GroupControllerTest {

private static final String GROUPS_ENDPOINT = "/groups";
private static final String GROUPS_ENDPOINT = "/api/groups";

@Autowired
private WebTestClient webTestClient;
Expand Down Expand Up @@ -89,7 +89,7 @@ void retrieveActiveGroupMembersAsPublic() {

webTestClient
.get()
.uri("/groups/1234/members")
.uri("/api/groups/1234/members")
.exchange()
.expectStatus().is2xxSuccessful()
.expectBodyList(PublicMember.class).value(retrievedMembers ->
Expand Down