|
96 | 96 | import org.testng.Assert;
|
97 | 97 | import org.testng.annotations.AfterMethod;
|
98 | 98 | import org.testng.annotations.BeforeMethod;
|
| 99 | +import org.testng.annotations.DataProvider; |
99 | 100 | import org.testng.annotations.Test;
|
100 | 101 |
|
101 | 102 | @Slf4j
|
@@ -125,6 +126,11 @@ public void cleanup() throws Exception {
|
125 | 126 | super.internalCleanup();
|
126 | 127 | }
|
127 | 128 |
|
| 129 | + @DataProvider(name = "topicDomain") |
| 130 | + public static Object[] topicDomain() { |
| 131 | + return new Object[] { "persistent://", "non-persistent://" }; |
| 132 | + } |
| 133 | + |
128 | 134 | @Test
|
129 | 135 | public void testGetSchemaWhenCreateAutoProduceBytesProducer() throws Exception{
|
130 | 136 | final String tenant = PUBLIC_TENANT;
|
@@ -1336,19 +1342,19 @@ private void testIncompatibleSchema() throws Exception {
|
1336 | 1342 | * the new consumer to register new schema. But before we can solve this problem, we need to modify
|
1337 | 1343 | * "CmdProducer" to let the Broker know that the Producer uses a schema of type "AUTO_PRODUCE_BYTES".
|
1338 | 1344 | */
|
1339 |
| - @Test |
1340 |
| - public void testAutoProduceAndSpecifiedConsumer() throws Exception { |
| 1345 | + @Test(dataProvider = "topicDomain") |
| 1346 | + public void testAutoProduceAndSpecifiedConsumer(String domain) throws Exception { |
1341 | 1347 | final String namespace = PUBLIC_TENANT + "/ns_" + randomName(16);
|
1342 | 1348 | admin.namespaces().createNamespace(namespace, Sets.newHashSet(CLUSTER_NAME));
|
1343 |
| - final String topicName = "persistent://" + namespace + "/tp_" + randomName(16); |
| 1349 | + final String topicName = domain + namespace + "/tp_" + randomName(16); |
1344 | 1350 | admin.topics().createNonPartitionedTopic(topicName);
|
1345 | 1351 |
|
1346 | 1352 | Producer producer = pulsarClient.newProducer(Schema.AUTO_PRODUCE_BYTES()).topic(topicName).create();
|
1347 | 1353 | try {
|
1348 | 1354 | pulsarClient.newConsumer(Schema.STRING).topic(topicName).subscriptionName("sub1").subscribe();
|
1349 |
| - fail("Should throw ex: Topic does not have schema to check"); |
| 1355 | + fail("Should throw ex: Failed to add schema to an active topic with empty(BYTES) schema"); |
1350 | 1356 | } catch (Exception ex){
|
1351 |
| - assertTrue(ex.getMessage().contains("Topic does not have schema to check")); |
| 1357 | + assertTrue(ex.getMessage().contains("Failed to add schema to an active topic with empty(BYTES) schema")); |
1352 | 1358 | }
|
1353 | 1359 |
|
1354 | 1360 | // Cleanup.
|
|
0 commit comments