Fix RSocket samples test
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
package io.spring.cloudevent;
|
package io.spring.cloudevent;
|
||||||
|
|
||||||
|
import java.net.InetSocketAddress;
|
||||||
|
import java.net.Socket;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.concurrent.ArrayBlockingQueue;
|
import java.util.concurrent.ArrayBlockingQueue;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
@@ -64,11 +66,13 @@ public class DemoApplicationTests {
|
|||||||
@Override
|
@Override
|
||||||
public ConditionEvaluationResult evaluateExecutionCondition(ExtensionContext context) {
|
public ConditionEvaluationResult evaluateExecutionCondition(ExtensionContext context) {
|
||||||
try {
|
try {
|
||||||
KafkaAdminClient.create(Collections.singletonMap("bootstrap.servers", "localhost:9092"));
|
Socket socket = new Socket();
|
||||||
|
socket.connect(new InetSocketAddress("localhost", 9092));
|
||||||
|
socket.close();
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
System.out.println("Kafka is not available on localhost:9092");
|
System.out.println("Kafka is not available on localhost:9092");
|
||||||
return ConditionEvaluationResult.enabled("Kafka is not available on localhost, default port");
|
return ConditionEvaluationResult.disabled("Kafka is not available on localhost, default port");
|
||||||
}
|
}
|
||||||
|
|
||||||
return ConditionEvaluationResult.enabled("All is good");
|
return ConditionEvaluationResult.enabled("All is good");
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package io.spring.cloudevent;
|
package io.spring.cloudevent;
|
||||||
|
|
||||||
|
import java.net.InetSocketAddress;
|
||||||
|
import java.net.Socket;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.concurrent.ArrayBlockingQueue;
|
import java.util.concurrent.ArrayBlockingQueue;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
@@ -60,11 +62,13 @@ public class DemoApplicationTests {
|
|||||||
try {
|
try {
|
||||||
new CachingConnectionFactory("localhost").createConnection();
|
new CachingConnectionFactory("localhost").createConnection();
|
||||||
try {
|
try {
|
||||||
KafkaAdminClient.create(Collections.singletonMap("bootstrap.servers", "localhost:9092"));
|
Socket socket = new Socket();
|
||||||
|
socket.connect(new InetSocketAddress("localhost", 9092));
|
||||||
|
socket.close();
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
System.out.println("Kafka is not available on localhost:9092");
|
System.out.println("Kafka is not available on localhost:9092");
|
||||||
return ConditionEvaluationResult.enabled("Kafka is not available on localhost, default port");
|
return ConditionEvaluationResult.disabled("Kafka is not available on localhost, default port");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
|
|||||||
Reference in New Issue
Block a user