Skip to content

Commit bee8fb4

Browse files
committed
Remove some OAuth 2 integration tests
They were supposed to be manual tests. (cherry picked from commit 7b50067)
1 parent e58fca1 commit bee8fb4

File tree

1 file changed

+2
-55
lines changed

1 file changed

+2
-55
lines changed

src/test/java/com/rabbitmq/client/impl/DefaultCredentialsRefreshServiceTest.java

Lines changed: 2 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,13 @@
1515

1616
package com.rabbitmq.client.impl;
1717

18-
import com.rabbitmq.client.Channel;
19-
import com.rabbitmq.client.Connection;
20-
import com.rabbitmq.client.ConnectionFactory;
21-
import com.rabbitmq.client.test.TestUtils;
2218
import org.junit.After;
2319
import org.junit.Test;
2420
import org.junit.runner.RunWith;
2521
import org.mockito.Mock;
2622
import org.mockito.junit.MockitoJUnitRunner;
2723
import org.mockito.stubbing.Answer;
2824

29-
import java.io.IOException;
3025
import java.time.Duration;
3126
import java.util.List;
3227
import java.util.concurrent.Callable;
@@ -37,7 +32,8 @@
3732
import java.util.function.Function;
3833
import java.util.stream.IntStream;
3934

40-
import static com.rabbitmq.client.impl.DefaultCredentialsRefreshService.*;
35+
import static com.rabbitmq.client.impl.DefaultCredentialsRefreshService.fixedDelayBeforeExpirationRefreshDelayStrategy;
36+
import static com.rabbitmq.client.impl.DefaultCredentialsRefreshService.fixedTimeNeedRefreshStrategy;
4137
import static java.time.Duration.ofSeconds;
4238
import static org.assertj.core.api.Assertions.assertThat;
4339
import static org.mockito.Mockito.*;
@@ -60,55 +56,6 @@ public void tearDown() {
6056
}
6157
}
6258

63-
@Test public void renew() {
64-
ConnectionFactory cf = new ConnectionFactory();
65-
OAuth2ClientCredentialsGrantCredentialsProvider provider = new OAuth2ClientCredentialsGrantCredentialsProvider.OAuth2ClientCredentialsGrantCredentialsProviderBuilder()
66-
.tokenEndpointUri("http://localhost:" + 8080 + "/uaa/oauth/token")
67-
.clientId("rabbit_client").clientSecret("rabbit_secret")
68-
.grantType("password")
69-
.parameter("username", "rabbit_super")
70-
.parameter("password", "rabbit_super")
71-
.build();
72-
cf.setCredentialsProvider(provider);
73-
74-
75-
}
76-
77-
@Test public void connect() throws Exception {
78-
ConnectionFactory cf = new ConnectionFactory();
79-
OAuth2ClientCredentialsGrantCredentialsProvider provider = new OAuth2ClientCredentialsGrantCredentialsProvider.OAuth2ClientCredentialsGrantCredentialsProviderBuilder()
80-
.tokenEndpointUri("http://localhost:" + 8080 + "/uaa/oauth/token")
81-
.clientId("rabbit_client").clientSecret("rabbit_secret")
82-
.grantType("password")
83-
.parameter("username", "rabbit_super")
84-
.parameter("password", "rabbit_super")
85-
.build();
86-
cf.setCredentialsProvider(provider);
87-
refreshService = new DefaultCredentialsRefreshService.DefaultCredentialsRefreshServiceBuilder()
88-
// .refreshDelayStrategy(ttl -> Duration.ofSeconds(60))
89-
.refreshDelayStrategy(ratioRefreshDelayStrategy(0.8))
90-
.needRefreshStrategy(expiration -> false)
91-
.build();
92-
cf.setCredentialsRefreshService(refreshService);
93-
try (Connection c = cf.newConnection()) {
94-
95-
while (true) {
96-
try {
97-
Channel ch = c.createChannel();
98-
String queue = ch.queueDeclare().getQueue();
99-
TestUtils.sendAndConsumeMessage("", queue, queue, c);
100-
System.out.println("Message sent and consumed");
101-
ch.close();
102-
} catch (IOException e) {
103-
System.out.println(e.getCause().getMessage());
104-
}
105-
Thread.sleep(10_000L);
106-
}
107-
}
108-
109-
110-
}
111-
11259
@Test
11360
public void scheduling() throws Exception {
11461
refreshService = new DefaultCredentialsRefreshService.DefaultCredentialsRefreshServiceBuilder()

0 commit comments

Comments
 (0)