LayoutVersion { public static int getMinimumCompatibleLayoutVersion( LayoutFeature[] features) { return getLastNonReservedFeature(features).getInfo() .getMinimumCompatibleLayoutVersion(); }  static void updateMap(Map<Integer, SortedSet<LayoutFeature>> map,
      LayoutFeature[] features); String getString(Map<Integer, SortedSet<LayoutFeature>> map,
      LayoutFeature[] values); static boolean supports(Map<Integer, SortedSet<LayoutFeature>> map,
      final LayoutFeature f, final int lv); static int getCurrentLayoutVersion(LayoutFeature[] features); static int getMinimumCompatibleLayoutVersion(
      LayoutFeature[] features); static final int BUGFIX_HDFS_2991_VERSION; }
@Test public void testNameNodeFeatureMinimumCompatibleLayoutVersions() { int baseLV = NameNodeLayoutVersion.Feature.TRUNCATE.getInfo() .getLayoutVersion(); EnumSet<NameNodeLayoutVersion.Feature> compatibleFeatures = EnumSet.of( NameNodeLayoutVersion.Feature.TRUNCATE, NameNodeLayoutVersion.Feature.APPEND_NEW_BLOCK, NameNodeLayoutVersion.Feature.QUOTA_BY_STORAGE_TYPE, NameNodeLayoutVersion.Feature.ERASURE_CODING); for (LayoutFeature f : compatibleFeatures) { assertEquals(String.format("Expected minimum compatible layout version " + "%d for feature %s.", baseLV, f), baseLV, f.getInfo().getMinimumCompatibleLayoutVersion()); } List<LayoutFeature> features = new ArrayList<>(); features.addAll(EnumSet.allOf(LayoutVersion.Feature.class)); features.addAll(EnumSet.allOf(NameNodeLayoutVersion.Feature.class)); for (LayoutFeature f : features) { if (!compatibleFeatures.contains(f)) { assertEquals(String.format("Expected feature %s to have minimum " + "compatible layout version set to itself.", f), f.getInfo().getLayoutVersion(), f.getInfo().getMinimumCompatibleLayoutVersion()); } } }