Skip to content

Commit 1c60998

Browse files
authored
Merge branch 'main' into issues/477
2 parents 48aaa53 + 2bb9d5c commit 1c60998

File tree

6 files changed

+46
-35
lines changed

6 files changed

+46
-35
lines changed

.github/workflows/e2e-run.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,8 @@ jobs:
103103
run: |
104104
mkdir -p ./e2e-tests/target/selenoid-results/video
105105
mkdir -p ./e2e-tests/target/selenoid-results/logs
106-
docker-compose -f ./e2e-tests/selenoid/selenoid-ci.yaml up -d
107-
docker-compose -f ./documentation/compose/e2e-tests.yaml up -d
106+
docker compose -f ./e2e-tests/selenoid/selenoid-ci.yaml up -d
107+
docker compose -f ./documentation/compose/e2e-tests.yaml up -d
108108
109109
- name: Dump Docker logs on failure
110110
if: failure()

api/src/main/java/io/kafbat/ui/controller/AccessController.java

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -45,33 +45,34 @@ public Mono<ResponseEntity<AuthenticationInfoDTO>> getUserAuthInfo(ServerWebExch
4545
.map(SecurityContext::getAuthentication)
4646
.map(Principal::getName);
4747

48+
var builder = AuthenticationInfoDTO.builder()
49+
.rbacEnabled(accessControlService.isRbacEnabled());
50+
4851
return userName
4952
.zipWith(permissions)
50-
.map(data -> {
51-
var dto = new AuthenticationInfoDTO(accessControlService.isRbacEnabled());
52-
dto.setUserInfo(new UserInfoDTO(data.getT1(), data.getT2()));
53-
return dto;
54-
})
55-
.switchIfEmpty(Mono.just(new AuthenticationInfoDTO(accessControlService.isRbacEnabled())))
53+
.map(data -> (AuthenticationInfoDTO) builder
54+
.userInfo(new UserInfoDTO(data.getT1(), data.getT2()))
55+
.build()
56+
)
57+
.switchIfEmpty(Mono.just(builder.build()))
5658
.map(ResponseEntity::ok);
5759
}
5860

5961
private List<UserPermissionDTO> mapPermissions(List<Permission> permissions, List<String> clusters) {
6062
return permissions
6163
.stream()
62-
.map(permission -> {
63-
UserPermissionDTO dto = new UserPermissionDTO();
64-
dto.setClusters(clusters);
65-
dto.setResource(ResourceTypeDTO.fromValue(permission.getResource().toString().toUpperCase()));
66-
dto.setValue(permission.getValue());
67-
dto.setActions(permission.getParsedActions()
68-
.stream()
69-
.map(p -> p.name().toUpperCase())
70-
.map(this::mapAction)
71-
.filter(Objects::nonNull)
72-
.toList());
73-
return dto;
74-
})
64+
.map(permission -> (UserPermissionDTO) UserPermissionDTO.builder()
65+
.clusters(clusters)
66+
.resource(ResourceTypeDTO.fromValue(permission.getResource().toString().toUpperCase()))
67+
.value(permission.getValue())
68+
.actions(permission.getParsedActions()
69+
.stream()
70+
.map(p -> p.name().toUpperCase())
71+
.map(this::mapAction)
72+
.filter(Objects::nonNull)
73+
.toList())
74+
.build()
75+
)
7576
.toList();
7677
}
7778

api/src/main/java/io/kafbat/ui/controller/KsqlController.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ public Mono<ResponseEntity<KsqlCommandV2ResponseDTO>> executeKsql(String cluster
5353
}
5454

5555
@Override
56+
@SuppressWarnings("unchecked")
5657
public Mono<ResponseEntity<Flux<KsqlResponseDTO>>> openKsqlResponsePipe(String clusterName,
5758
String pipeId,
5859
ServerWebExchange exchange) {

api/src/main/java/io/kafbat/ui/controller/TopicsController.java

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -350,18 +350,12 @@ private Comparator<InternalTopic> getComparatorForTopic(
350350
if (orderBy == null) {
351351
return defaultComparator;
352352
}
353-
switch (orderBy) {
354-
case TOTAL_PARTITIONS:
355-
return Comparator.comparing(InternalTopic::getPartitionCount);
356-
case OUT_OF_SYNC_REPLICAS:
357-
return Comparator.comparing(t -> t.getReplicas() - t.getInSyncReplicas());
358-
case REPLICATION_FACTOR:
359-
return Comparator.comparing(InternalTopic::getReplicationFactor);
360-
case SIZE:
361-
return Comparator.comparing(InternalTopic::getSegmentSize);
362-
case NAME:
363-
default:
364-
return defaultComparator;
365-
}
353+
return switch (orderBy) {
354+
case TOTAL_PARTITIONS -> Comparator.comparing(InternalTopic::getPartitionCount);
355+
case OUT_OF_SYNC_REPLICAS -> Comparator.comparing(t -> t.getReplicas() - t.getInSyncReplicas());
356+
case REPLICATION_FACTOR -> Comparator.comparing(InternalTopic::getReplicationFactor);
357+
case SIZE -> Comparator.comparing(InternalTopic::getSegmentSize);
358+
default -> defaultComparator;
359+
};
366360
}
367361
}

api/src/test/java/io/kafbat/ui/emitter/MessageFiltersTest.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,10 @@ void testBase64DecodingWorks() {
199199
}
200200

201201
private TopicMessageDTO msg() {
202-
return new TopicMessageDTO(1, -1L, OffsetDateTime.now());
202+
return TopicMessageDTO.builder()
203+
.partition(1)
204+
.offset(-1L)
205+
.timestamp(OffsetDateTime.now())
206+
.build();
203207
}
204208
}

contract/pom.xml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,11 @@
4646
<artifactId>javax.annotation-api</artifactId>
4747
<version>1.3.2</version>
4848
</dependency>
49+
<dependency>
50+
<groupId>org.projectlombok</groupId>
51+
<artifactId>lombok</artifactId>
52+
<version>${org.projectlombok.version}</version>
53+
</dependency>
4954
</dependencies>
5055

5156
<build>
@@ -100,6 +105,12 @@
100105
<useTags>true</useTags>
101106
<useSpringBoot3>true</useSpringBoot3>
102107
<dateLibrary>java8</dateLibrary>
108+
<generatedConstructorWithRequiredArgs>false</generatedConstructorWithRequiredArgs>
109+
<additionalModelTypeAnnotations>
110+
@lombok.experimental.SuperBuilder
111+
@lombok.NoArgsConstructor
112+
@lombok.AllArgsConstructor
113+
</additionalModelTypeAnnotations>
103114
</configOptions>
104115
</configuration>
105116
</execution>

0 commit comments

Comments
 (0)