Search in sources :

Example 6 with FeatureLevelRecord

use of org.apache.kafka.common.metadata.FeatureLevelRecord in project kafka by apache.

the class FeatureControlManagerTest method testFeatureControlIterator.

@Test
public void testFeatureControlIterator() throws Exception {
    SnapshotRegistry snapshotRegistry = new SnapshotRegistry(new LogContext());
    FeatureControlManager manager = new FeatureControlManager(rangeMap("foo", 1, 5, "bar", 1, 2), snapshotRegistry);
    ControllerResult<Map<String, ApiError>> result = manager.updateFeatures(rangeMap("foo", 1, 5, "bar", 1, 1), Collections.emptySet(), Collections.emptyMap());
    RecordTestUtils.replayAll(manager, result.records());
    RecordTestUtils.assertBatchIteratorContains(Arrays.asList(Arrays.asList(new ApiMessageAndVersion(new FeatureLevelRecord().setName("foo").setMinFeatureLevel((short) 1).setMaxFeatureLevel((short) 5), (short) 0)), Arrays.asList(new ApiMessageAndVersion(new FeatureLevelRecord().setName("bar").setMinFeatureLevel((short) 1).setMaxFeatureLevel((short) 1), (short) 0))), manager.iterator(Long.MAX_VALUE));
}
Also used : SnapshotRegistry(org.apache.kafka.timeline.SnapshotRegistry) ApiMessageAndVersion(org.apache.kafka.server.common.ApiMessageAndVersion) LogContext(org.apache.kafka.common.utils.LogContext) HashMap(java.util.HashMap) FeatureMap(org.apache.kafka.metadata.FeatureMap) Map(java.util.Map) FeatureLevelRecord(org.apache.kafka.common.metadata.FeatureLevelRecord) Test(org.junit.jupiter.api.Test)

Aggregations

FeatureLevelRecord (org.apache.kafka.common.metadata.FeatureLevelRecord)6 FeatureMap (org.apache.kafka.metadata.FeatureMap)5 ApiMessageAndVersion (org.apache.kafka.server.common.ApiMessageAndVersion)5 HashMap (java.util.HashMap)4 Map (java.util.Map)4 LogContext (org.apache.kafka.common.utils.LogContext)4 SnapshotRegistry (org.apache.kafka.timeline.SnapshotRegistry)4 Test (org.junit.jupiter.api.Test)4 ApiError (org.apache.kafka.common.requests.ApiError)3 ArrayList (java.util.ArrayList)2 FeatureMapAndEpoch (org.apache.kafka.metadata.FeatureMapAndEpoch)2 VersionRange (org.apache.kafka.metadata.VersionRange)2 TreeMap (java.util.TreeMap)1 TimelineHashMap (org.apache.kafka.timeline.TimelineHashMap)1