Skip to content

Commit

Permalink
check style
Browse files Browse the repository at this point in the history
  • Loading branch information
heesung-sn committed Nov 2, 2024
1 parent c3ebcf9 commit e7369a9
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 30 deletions.
6 changes: 6 additions & 0 deletions pulsar-inttest-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@
<artifactId>pulsar-client-admin-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.awaitility</groupId>
<artifactId>awaitility</artifactId>
<version>${awaitility.version}</version>
<scope>compile</scope>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
*/
package org.apache.pulsar.tests.integration.messaging;

import java.nio.charset.StandardCharsets;
import java.util.UUID;
import java.util.concurrent.TimeUnit;
import lombok.Cleanup;
import lombok.extern.slf4j.Slf4j;
import org.apache.pulsar.client.admin.PulsarAdmin;
Expand All @@ -26,11 +29,8 @@
import org.apache.pulsar.client.api.Producer;
import org.apache.pulsar.client.api.PulsarClient;
import org.apache.pulsar.tests.integration.GeoRepIntegTest;
import org.testcontainers.shaded.org.awaitility.Awaitility;
import org.awaitility.Awaitility;
import org.testng.Assert;
import java.nio.charset.StandardCharsets;
import java.util.UUID;
import java.util.concurrent.TimeUnit;

/**
* Geo replication test.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,13 @@ public final void tearDownAfterClass() throws Exception {
cleanup();
}

public static void retryStrategically(Predicate<Void> predicate, int retryCount, long intSleepTimeInMillis) throws Exception {
public static void retryStrategically(Predicate<Void> predicate, int retryCount, long intSleepTimeInMillis)
throws Exception {
retryStrategically(predicate, retryCount, intSleepTimeInMillis, false);
}

public static void retryStrategically(Predicate<Void> predicate, int retryCount, long intSleepTimeInMillis, boolean throwException)
public static void retryStrategically(Predicate<Void> predicate, int retryCount, long intSleepTimeInMillis,
boolean throwException)
throws Exception {

for (int i = 0; i < retryCount; i++) {
Expand All @@ -56,7 +58,7 @@ public static void retryStrategically(Predicate<Void> predicate, int retryCount,
}
}

Thread.sleep(intSleepTimeInMillis + (intSleepTimeInMillis * i));
Thread.sleep(intSleepTimeInMillis + (intSleepTimeInMillis * i));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,14 @@
import static org.apache.pulsar.tests.integration.containers.PulsarContainer.CS_PORT;
import static org.apache.pulsar.tests.integration.containers.PulsarContainer.PULSAR_CONTAINERS_LEAVE_RUNNING;
import static org.apache.pulsar.tests.integration.containers.PulsarContainer.ZK_PORT;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.TreeMap;
import java.util.function.Function;
import lombok.Cleanup;
import lombok.Getter;
Expand All @@ -43,13 +42,13 @@
import org.apache.pulsar.tests.integration.containers.BKContainer;
import org.apache.pulsar.tests.integration.containers.BrokerContainer;
import org.apache.pulsar.tests.integration.containers.CSContainer;
import org.apache.pulsar.tests.integration.containers.OxiaContainer;
import org.apache.pulsar.tests.integration.containers.ProxyContainer;
import org.apache.pulsar.tests.integration.containers.PulsarContainer;
import org.apache.pulsar.tests.integration.containers.PulsarInitMetadataContainer;
import org.apache.pulsar.tests.integration.containers.WorkerContainer;
import org.apache.pulsar.tests.integration.containers.ZKContainer;
import org.apache.pulsar.tests.integration.docker.ContainerExecResult;
import org.apache.pulsar.tests.integration.containers.OxiaContainer;
import org.testcontainers.containers.BindMode;
import org.testcontainers.containers.GenericContainer;
import org.testcontainers.containers.Network;
Expand All @@ -66,7 +65,7 @@ public class PulsarCluster {
public static final String CURL = "/usr/bin/curl";

/**
* Pulsar Cluster Spec
* Pulsar Cluster Spec.
*
* @param spec pulsar cluster spec.
* @return the built pulsar cluster
Expand Down Expand Up @@ -151,9 +150,9 @@ private PulsarCluster(PulsarClusterSpec spec, Network network, CSContainer csCon

this.csContainer = csContainer;

this.bookieContainers = Maps.newTreeMap();
this.brokerContainers = Maps.newTreeMap();
this.workerContainers = Maps.newTreeMap();
this.bookieContainers = new TreeMap<>();
this.brokerContainers = new TreeMap<>();
this.workerContainers = new TreeMap<>();

this.proxyContainer = new ProxyContainer(clusterName, appendClusterName(ProxyContainer.NAME), spec.enableTls)
.withNetwork(network)
Expand Down Expand Up @@ -440,7 +439,7 @@ public static void stopService(String networkAlias,
private static <T extends PulsarContainer> Map<String, T> runNumContainers(String serviceName,
int numContainers,
Function<String, T> containerCreator) {
Map<String, T> containers = Maps.newTreeMap();
Map<String, T> containers = new TreeMap<>();
for (int i = 0; i < numContainers; i++) {
String name = "pulsar-" + serviceName + "-" + i;
T container = containerCreator.apply(name);
Expand Down Expand Up @@ -632,7 +631,7 @@ public synchronized WorkerContainer getWorker(String workerName) {
}

private <T> T getAnyContainer(Map<String, T> containers, String serviceName) {
List<T> containerList = Lists.newArrayList();
List<T> containerList = new ArrayList<>();
containerList.addAll(containers.values());
Collections.shuffle(containerList);
checkArgument(!containerList.isEmpty(), "No " + serviceName + " is alive");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public class PulsarClusterSpec {
int numFunctionWorkers = 0;

/**
* Allow to query the last message
* Allow to query the last message.
*/
@Default
boolean queryLastMessage = false;
Expand All @@ -94,8 +94,7 @@ public class PulsarClusterSpec {
FunctionRuntimeType functionRuntimeType = FunctionRuntimeType.PROCESS;

/**
* Returns the list of external services to start with
* this cluster.
* Returns the list of external services to start with this cluster.
*
* @return the list of external services to start with the cluster.
*/
Expand All @@ -117,19 +116,19 @@ public class PulsarClusterSpec {
boolean enableContainerLog = false;

/**
* Provide a map of paths (in the classpath) to mount as volumes inside the containers
* Provide a map of paths (in the classpath) to mount as volumes inside the containers.
*/
@Default
Map<String, String> classPathVolumeMounts = new TreeMap<>();

/**
* Data container
* Data container.
*/
@Default
GenericContainer<?> dataContainer = null;

/**
* Pulsar Test Image Name
* Pulsar Test Image Name.
*
* @return the version of the pulsar test image to use
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
@Slf4j
public abstract class PulsarClusterTestBase extends PulsarTestBase {

public final static String CLIENT_CONFIG_FILE_PATH_PROPERTY_NAME = "client.config.file.path";
public static final String CLIENT_CONFIG_FILE_PATH_PROPERTY_NAME = "client.config.file.path";

protected final Map<String, String> brokerEnvs = new HashMap<>();
protected final Map<String, String> bookkeeperEnvs = new HashMap<>();
Expand All @@ -46,7 +46,6 @@ public abstract class PulsarClusterTestBase extends PulsarTestBase {
protected final List<Integer> bookieAdditionalPorts = new LinkedList<>();



private Map<String, Object> readClientConfigs(String clientConfFilePath) throws IOException {
Properties prop = new Properties(System.getProperties());
try (FileInputStream input = new FileInputStream(clientConfFilePath)) {
Expand Down Expand Up @@ -91,7 +90,7 @@ protected final void cleanup() throws Exception {

@DataProvider(name = "ServiceUrlAndTopics")
public Object[][] serviceUrlAndTopics() {
return new Object[][] {
return new Object[][]{
// plain text, persistent topic
{
stringSupplier(() -> getPulsarCluster().getPlainTextServiceUrl()),
Expand All @@ -107,7 +106,7 @@ public Object[][] serviceUrlAndTopics() {

@DataProvider(name = "ServiceUrls")
public Object[][] serviceUrls() {
return new Object[][] {
return new Object[][]{
// plain text
{
stringSupplier(() -> getPulsarCluster().getPlainTextServiceUrl())
Expand All @@ -117,7 +116,7 @@ public Object[][] serviceUrls() {

@DataProvider(name = "ServiceAndAdminUrls")
public Object[][] serviceAndAdminUrls() {
return new Object[][] {
return new Object[][]{
// plain text
{
stringSupplier(() -> getPulsarCluster().getPlainTextServiceUrl()),
Expand All @@ -128,7 +127,7 @@ public Object[][] serviceAndAdminUrls() {

@DataProvider
public Object[][] serviceUrlAndTopicDomain() {
return new Object[][] {
return new Object[][]{
{
stringSupplier(() -> getPulsarCluster().getPlainTextServiceUrl()),
TopicDomain.persistent
Expand All @@ -142,7 +141,7 @@ public Object[][] serviceUrlAndTopicDomain() {

@DataProvider(name = "topicDomain")
public Object[][] topicDomain() {
return new Object[][] {
return new Object[][]{
{
TopicDomain.persistent
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public class PulsarGeoCluster {
private final PulsarCluster[] clusters;

/**
* Pulsar Cluster Spec
* Pulsar Cluster Spec.
*
* @param specs each pulsar cluster spec.
* @return the built a pulsar cluster with geo replication
Expand Down

0 comments on commit e7369a9

Please sign in to comment.