Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

import com.google.common.collect.Sets;
import io.prometheus.client.Summary;
import java.util.Collections;
import org.apache.pulsar.broker.resourcegroup.ResourceGroup.BytesAndMessagesCount;
import org.apache.pulsar.broker.resourcegroup.ResourceGroup.ResourceGroupMonitoringClass;
import org.apache.pulsar.broker.resourcegroup.ResourceGroupService.ResourceGroupUsageStatsType;
Expand Down Expand Up @@ -59,7 +58,7 @@
// The tenants and namespaces in those topics are associated with a set of resource-groups (RGs).
// After sending/receiving all the messages, traffic usage statistics, and Prometheus-metrics
// are verified on the RGs.
public class RGUsageMTAggrWaitForAllMesgsTest extends ProducerConsumerBase {
public class RGUsageMTAggrWaitForAllMsgsTest extends ProducerConsumerBase {
@BeforeClass
@Override
protected void setup() throws Exception {
Expand Down Expand Up @@ -350,13 +349,12 @@ private boolean tenantRGEqualsNamespaceRG(String[] topicStrings) throws PulsarCl
}
}
if ((numEqualRGs + numUnEqualRGs != numTopics) || (numEqualRGs > 0 && numUnEqualRGs > 0)) {
String errMesg = String.format("Found {} topics with equal RGs and {} with unequal, on {} topics",
String errMesg = String.format("Found %s topics with equal RGs and %s with unequal, on %s topics",
numEqualRGs, numUnEqualRGs, numTopics);
throw new PulsarClientException(errMesg);
} else if (numEqualRGs == numTopics) {
return true;
} else {
return numEqualRGs == numTopics;
}
return false;
}

private void registerTenantsAndNamespaces(String[] topicStrings) throws Exception {
Expand Down Expand Up @@ -788,7 +786,7 @@ private void verifyRGMetrics(String[] topicStrings,
Assert.assertNotEquals(ninetethPercentileValue, 0);
}

private static final Logger log = LoggerFactory.getLogger(RGUsageMTAggrWaitForAllMesgsTest.class);
private static final Logger log = LoggerFactory.getLogger(RGUsageMTAggrWaitForAllMsgsTest.class);

// Empirically, there appears to be a 45-byte overhead for metadata, imposed by Pulsar runtime.
private static final int PER_MESSAGE_METADATA_OHEAD = 45;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ public void acceptResourceUsage(String broker, ResourceUsage resourceUsage) {
.subscriptionType(SubscriptionType.Shared)
.subscribe();
} catch (PulsarClientException p) {
final String errMesg = String.format("Got exception while building consumer: ex={}", p.getMessage());
Assert.assertTrue(false, errMesg);
final String errMsg = String.format("Got exception while building consumer: ex=%s", p.getMessage());
Assert.fail(errMsg);
}

final TopicName myTopic = TopicName.get(topicString);
Expand All @@ -146,16 +146,15 @@ public void acceptResourceUsage(String broker, ResourceUsage resourceUsage) {
int recvdNumBytes = 0;
int recvdNumMsgs = 0;
for (int ix = 0; ix < NumMessagesToSend; ix++) {
MessageId prodMesgId = null;
byte[] mesg;
try {
mesg = String.format("Hi, ix={}", ix).getBytes();
mesg = String.format("Hi, ix=%s", ix).getBytes();
producer.send(mesg);
sentNumBytes += mesg.length;
sentNumMsgs++;
} catch (PulsarClientException p) {
final String errMesg = String.format("Got exception while sending {}-th time: ex={}", ix, p.getMessage());
Assert.assertTrue(false, errMesg);
final String errMsg = String.format("Got exception while sending %s-th time: ex=%s", ix, p.getMessage());
Assert.fail(errMsg);
}
}
producer.close();
Expand All @@ -169,9 +168,9 @@ public void acceptResourceUsage(String broker, ResourceUsage resourceUsage) {
message = consumer.receive();
recvdNumBytes += message.getValue().length;
} catch (PulsarClientException p) {
final String errMesg = String.format("Got exception in while receiving {}-th mesg at consumer: ex={}",
final String errMesg = String.format("Got exception in while receiving %s-th mesg at consumer: ex=%s",
recvdNumMsgs, p.getMessage());
Assert.assertTrue(false, errMesg);
Assert.fail(errMesg);
}
// log.info("consumer received message : {} {}", message.getMessageId(), new String(message.getData()));
recvdNumMsgs++;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import org.apache.pulsar.client.api.PulsarClientException;
import org.apache.pulsar.common.naming.TopicName;
import org.apache.pulsar.common.policies.data.ClusterData;
import org.apache.pulsar.common.policies.data.ClusterDataImpl;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
Expand Down