Skip to content

Commit

Permalink
Remove indent
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasCAI-mlv committed Oct 7, 2024
1 parent 0331bcc commit 5631c84
Showing 1 changed file with 59 additions and 59 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -436,35 +436,35 @@ void shouldNotDeleteStreamsWhenNotOwner() {
@Test
void shouldDeleteMultipleStreams() {
Namespace ns = Namespace.builder()
.metadata(Metadata.builder()
.name("test")
.cluster("local")
.build())
.build();
.metadata(Metadata.builder()
.name("test")
.cluster("local")
.build())
.build();

KafkaStream stream1 = KafkaStream.builder()
.metadata(Metadata.builder()
.name("test_stream1")
.build())
.build();
.metadata(Metadata.builder()
.name("test_stream1")
.build())
.build();

KafkaStream stream2 = KafkaStream.builder()
.metadata(Metadata.builder()
.name("test_stream2")
.build())
.build();
.metadata(Metadata.builder()
.name("test_stream2")
.build())
.build();

when(namespaceService.findByName("test"))
.thenReturn(Optional.of(ns));
.thenReturn(Optional.of(ns));

when(streamService.isNamespaceOwnerOfKafkaStream(ns, "test_stream1"))
.thenReturn(true);
.thenReturn(true);

when(streamService.isNamespaceOwnerOfKafkaStream(ns, "test_stream2"))
.thenReturn(true);
.thenReturn(true);

when(streamService.findByWildcardName(ns, "test_stream*"))
.thenReturn(List.of(stream1, stream2));
.thenReturn(List.of(stream1, stream2));

when(securityService.username()).thenReturn(Optional.of("test-user"));
when(securityService.hasRole(ResourceBasedSecurityRule.IS_ADMIN)).thenReturn(false);
Expand All @@ -478,35 +478,35 @@ void shouldDeleteMultipleStreams() {
@Test
void shouldDeleteMultipleStreamsInDryRunMode() {
Namespace ns = Namespace.builder()
.metadata(Metadata.builder()
.name("test")
.cluster("local")
.build())
.build();
.metadata(Metadata.builder()
.name("test")
.cluster("local")
.build())
.build();

KafkaStream stream1 = KafkaStream.builder()
.metadata(Metadata.builder()
.name("test_stream1")
.build())
.build();
.metadata(Metadata.builder()
.name("test_stream1")
.build())
.build();

KafkaStream stream2 = KafkaStream.builder()
.metadata(Metadata.builder()
.name("test_stream2")
.build())
.build();
.metadata(Metadata.builder()
.name("test_stream2")
.build())
.build();

when(namespaceService.findByName("test"))
.thenReturn(Optional.of(ns));
.thenReturn(Optional.of(ns));

when(streamService.isNamespaceOwnerOfKafkaStream(ns, "test_stream1"))
.thenReturn(true);
.thenReturn(true);

when(streamService.isNamespaceOwnerOfKafkaStream(ns, "test_stream2"))
.thenReturn(true);
.thenReturn(true);

when(streamService.findByWildcardName(ns, "test_stream*"))
.thenReturn(List.of(stream1, stream2));
.thenReturn(List.of(stream1, stream2));

var response = streamController.bulkDelete("test", "test_stream*", true);
verify(streamService, never()).delete(any(), any());
Expand All @@ -516,17 +516,17 @@ void shouldDeleteMultipleStreamsInDryRunMode() {
@Test
void shouldNotDeleteMultipleStreamsWhenNotFound() {
Namespace ns = Namespace.builder()
.metadata(Metadata.builder()
.name("test")
.cluster("local")
.build())
.build();
.metadata(Metadata.builder()
.name("test")
.cluster("local")
.build())
.build();

when(namespaceService.findByName("test"))
.thenReturn(Optional.of(ns));
.thenReturn(Optional.of(ns));

when(streamService.findByWildcardName(ns, "test_stream*"))
.thenReturn(List.of());
.thenReturn(List.of());

var response = streamController.bulkDelete("test", "test_stream*", false);
verify(streamService, never()).delete(any(), any());
Expand All @@ -537,38 +537,38 @@ void shouldNotDeleteMultipleStreamsWhenNotFound() {
@Test
void shouldNotDeleteMultipleStreamsWhenNotOwner() {
Namespace ns = Namespace.builder()
.metadata(Metadata.builder()
.name("test")
.cluster("local")
.build())
.build();
.metadata(Metadata.builder()
.name("test")
.cluster("local")
.build())
.build();

KafkaStream stream1 = KafkaStream.builder()
.metadata(Metadata.builder()
.name("test_stream1")
.build())
.build();
.metadata(Metadata.builder()
.name("test_stream1")
.build())
.build();

KafkaStream stream2 = KafkaStream.builder()
.metadata(Metadata.builder()
.name("test_stream2")
.build())
.build();
.metadata(Metadata.builder()
.name("test_stream2")
.build())
.build();

when(namespaceService.findByName("test"))
.thenReturn(Optional.of(ns));
.thenReturn(Optional.of(ns));

when(streamService.isNamespaceOwnerOfKafkaStream(ns, "test_stream1"))
.thenReturn(true);
.thenReturn(true);

when(streamService.isNamespaceOwnerOfKafkaStream(ns, "test_stream2"))
.thenReturn(false);
.thenReturn(false);

when(streamService.findByWildcardName(ns, "test_stream*"))
.thenReturn(List.of(stream1, stream2));
.thenReturn(List.of(stream1, stream2));

assertThrows(ResourceValidationException.class, () ->
streamController.bulkDelete("test", "test_stream*", false));
streamController.bulkDelete("test", "test_stream*", false));
verify(streamService, never()).delete(any(), any());
}
}

0 comments on commit 5631c84

Please sign in to comment.