@@ -29,6 +29,9 @@ import org.apache.kafka.common.protocol.Errors
29
29
import org .junit .{After , Test }
30
30
import org .junit .Assert .assertEquals
31
31
import org .junit .Assert .assertFalse
32
+ import org .junit .Assert .assertNotNull
33
+ import org .junit .Assert .assertNotEquals
34
+ import java .util .Properties
32
35
33
36
class AdminManagerTest {
34
37
@@ -80,4 +83,33 @@ class AdminManagerTest {
80
83
assertEquals(Errors .NONE .code, results.head.errorCode())
81
84
assertFalse(" Should return configs" , results.head.configs().isEmpty)
82
85
}
86
+
87
+ @ Test
88
+ def testDescribeConfigsWithDocumentation (): Unit = {
89
+ EasyMock .expect(zkClient.getEntityConfigs(ConfigType .Topic , topic)).andReturn(new Properties )
90
+ EasyMock .expect(zkClient.getEntityConfigs(ConfigType .Broker , brokerId.toString)).andReturn(new Properties )
91
+ EasyMock .expect(metadataCache.contains(topic)).andReturn(true )
92
+ EasyMock .replay(zkClient, metadataCache)
93
+
94
+ val adminManager = createAdminManager()
95
+
96
+ val resources = List (
97
+ new DescribeConfigsRequestData .DescribeConfigsResource ()
98
+ .setResourceName(topic)
99
+ .setResourceType(ConfigResource .Type .TOPIC .id),
100
+ new DescribeConfigsRequestData .DescribeConfigsResource ()
101
+ .setResourceName(brokerId.toString)
102
+ .setResourceType(ConfigResource .Type .BROKER .id))
103
+
104
+ val results : List [DescribeConfigsResponseData .DescribeConfigsResult ] = adminManager.describeConfigs(resources, true , true )
105
+ assertEquals(2 , results.size)
106
+ results.foreach(r => {
107
+ assertEquals(Errors .NONE .code, r.errorCode)
108
+ assertFalse(" Should return configs" , r.configs.isEmpty)
109
+ r.configs.forEach(c => {
110
+ assertNotNull(s " Config ${c.name} should have non null documentation " , c.documentation)
111
+ assertNotEquals(s " Config ${c.name} should have non blank documentation " , " " , c.documentation.trim)
112
+ })
113
+ })
114
+ }
83
115
}
0 commit comments