Search in sources :

Example 1 with DescribeConfigsResourceResult

use of org.apache.kafka.common.message.DescribeConfigsResponseData.DescribeConfigsResourceResult in project kafka by apache.

the class RequestResponseTest method verifyDescribeConfigsResponse.

private void verifyDescribeConfigsResponse(DescribeConfigsResponse expected, DescribeConfigsResponse actual, short version) {
    for (Map.Entry<ConfigResource, DescribeConfigsResult> resource : expected.resultMap().entrySet()) {
        List<DescribeConfigsResourceResult> actualEntries = actual.resultMap().get(resource.getKey()).configs();
        List<DescribeConfigsResourceResult> expectedEntries = expected.resultMap().get(resource.getKey()).configs();
        assertEquals(expectedEntries.size(), actualEntries.size());
        for (int i = 0; i < actualEntries.size(); ++i) {
            DescribeConfigsResourceResult actualEntry = actualEntries.get(i);
            DescribeConfigsResourceResult expectedEntry = expectedEntries.get(i);
            assertEquals(expectedEntry.name(), actualEntry.name());
            assertEquals(expectedEntry.value(), actualEntry.value(), "Non-matching values for " + actualEntry.name() + " in version " + version);
            assertEquals(expectedEntry.readOnly(), actualEntry.readOnly(), "Non-matching readonly for " + actualEntry.name() + " in version " + version);
            assertEquals(expectedEntry.isSensitive(), actualEntry.isSensitive(), "Non-matching isSensitive for " + actualEntry.name() + " in version " + version);
            if (version < 3) {
                assertEquals(ConfigType.UNKNOWN.id(), actualEntry.configType(), "Non-matching configType for " + actualEntry.name() + " in version " + version);
            } else {
                assertEquals(expectedEntry.configType(), actualEntry.configType(), "Non-matching configType for " + actualEntry.name() + " in version " + version);
            }
            if (version == 0) {
                assertEquals(DescribeConfigsResponse.ConfigSource.STATIC_BROKER_CONFIG.id(), actualEntry.configSource(), "Non matching configSource for " + actualEntry.name() + " in version " + version);
            } else {
                assertEquals(expectedEntry.configSource(), actualEntry.configSource(), "Non-matching configSource for " + actualEntry.name() + " in version " + version);
            }
        }
    }
}
Also used : DescribeConfigsResult(org.apache.kafka.common.message.DescribeConfigsResponseData.DescribeConfigsResult) Map(java.util.Map) LinkedHashMap(java.util.LinkedHashMap) HashMap(java.util.HashMap) DescribeConfigsResourceResult(org.apache.kafka.common.message.DescribeConfigsResponseData.DescribeConfigsResourceResult) ConfigResource(org.apache.kafka.common.config.ConfigResource) UpdateMetadataEndpoint(org.apache.kafka.common.message.UpdateMetadataRequestData.UpdateMetadataEndpoint)

Aggregations

HashMap (java.util.HashMap)1 LinkedHashMap (java.util.LinkedHashMap)1 Map (java.util.Map)1 ConfigResource (org.apache.kafka.common.config.ConfigResource)1 DescribeConfigsResourceResult (org.apache.kafka.common.message.DescribeConfigsResponseData.DescribeConfigsResourceResult)1 DescribeConfigsResult (org.apache.kafka.common.message.DescribeConfigsResponseData.DescribeConfigsResult)1 UpdateMetadataEndpoint (org.apache.kafka.common.message.UpdateMetadataRequestData.UpdateMetadataEndpoint)1