aloyszhang commented on code in PR #8941: URL: https://github.com/apache/inlong/pull/8941#discussion_r1368320380
########## inlong-manager/manager-service/src/test/java/org/apache/inlong/manager/service/queue/PulsarUtilsTest.java: ########## @@ -17,39 +17,161 @@ package org.apache.inlong.manager.service.queue; +import org.apache.inlong.manager.pojo.cluster.pulsar.PulsarClusterInfo; +import org.apache.inlong.manager.pojo.queue.pulsar.PulsarTopicMetadata; import org.apache.inlong.manager.service.resource.queue.pulsar.PulsarUtils; -import org.apache.pulsar.client.admin.PulsarAdmin; -import org.apache.pulsar.client.admin.internal.PulsarAdminImpl; -import org.apache.pulsar.client.api.Authentication; -import org.apache.pulsar.client.api.PulsarClientException; -import org.apache.pulsar.client.impl.auth.AuthenticationDisabled; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.springframework.util.ReflectionUtils; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Disabled; +import org.springframework.http.ResponseEntity; +import org.springframework.web.client.RestTemplate; -import java.lang.reflect.Field; +import java.util.List; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; /** * Test class for Pulsar utils. */ public class PulsarUtilsTest { - @Test - public void testGetPulsarAdmin() { - final String defaultServiceUrl = "http://127.0.0.1:10080"; - try { - PulsarAdmin admin = PulsarUtils.getPulsarAdmin(defaultServiceUrl); - Assertions.assertEquals(defaultServiceUrl, admin.getServiceUrl()); - Field auth = ReflectionUtils.findField(PulsarAdminImpl.class, "auth"); - assert auth != null; - auth.setAccessible(true); - Authentication authentication = (Authentication) auth.get(admin); - Assertions.assertNotNull(authentication); - Assertions.assertTrue(authentication instanceof AuthenticationDisabled); - } catch (PulsarClientException | IllegalAccessException e) { - Assertions.fail(); + private static final String DEFAULT_SERVICE_URL = "http://127.0.0.1:8080"; + + private static final PulsarClusterInfo PULSAR_CLUSTER_INFO = new PulsarClusterInfo(); + + private static final String DEFAULT_TENANT = "public"; + + private static final String DEFAULT_NAMESPACE = "default"; + + private static final String DEFAULT_TOPIC = "testtopic"; + + private static final int DEFAULT_PARTITIONS_NUM = 3; + + private static final String DEFAULT_TOPIC_PATH = DEFAULT_TENANT + "/" + DEFAULT_NAMESPACE + "/" + DEFAULT_TOPIC; + + private static RestTemplate restTemplate; + + @BeforeAll + public static void before() { + PULSAR_CLUSTER_INFO.setAdminUrl(DEFAULT_SERVICE_URL); + restTemplate = new RestTemplate(); + } + + /** + * Just using in local test. + */ + @Disabled Review Comment: why all tests are disabled? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@inlong.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org