Skip to content

Commit

Permalink
Resolved comments
Browse files Browse the repository at this point in the history
  • Loading branch information
heesung-sn committed Oct 27, 2023
1 parent 2ae17af commit 025aac7
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,8 @@ public class ExtensibleLoadManagerImplTest extends MockedPulsarServiceBaseTest {

private final String defaultTestNamespace = "public/test";

private LookupService lookupService;

@BeforeClass
@Override
public void setup() throws Exception {
Expand Down Expand Up @@ -195,7 +197,7 @@ public void setup() throws Exception {
admin.namespaces().createNamespace(defaultTestNamespace);
admin.namespaces().setNamespaceReplicationClusters(defaultTestNamespace,
Sets.newHashSet(this.conf.getClusterName()));
}
lookupService = (LookupService) FieldUtils.readDeclaredField(pulsarClient, "lookup", true);
}

@Override
Expand All @@ -208,9 +210,10 @@ protected void cleanup() throws Exception {
}

@BeforeMethod(alwaysRun = true)
protected void initializeState() throws PulsarAdminException {
protected void initializeState() throws PulsarAdminException, IllegalAccessException {
admin.namespaces().unload(defaultTestNamespace);
reset(primaryLoadManager, secondaryLoadManager);
FieldUtils.writeDeclaredField(pulsarClient, "lookup", lookupService, true);
}

@Test
Expand Down Expand Up @@ -506,8 +509,7 @@ public void testUnloadClientReconnectionWithLookup(boolean isPersistentTopicTest

private LookupService spyLookupService(AtomicInteger lookupCount, TopicName topicName)
throws IllegalAccessException {
var lookup = spy((LookupService)
FieldUtils.readDeclaredField(pulsarClient, "lookup", true));
var lookup = spy(lookupService);
FieldUtils.writeDeclaredField(pulsarClient, "lookup", lookup, true);
doAnswer(invocationOnMock -> {
lookupCount.incrementAndGet();
Expand Down

0 comments on commit 025aac7

Please sign in to comment.