Java Code Examples for org.apache.hadoop.conf.Configuration#addDeprecation()

The following examples show how to use org.apache.hadoop.conf.Configuration#addDeprecation() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: hadoop   File: TestDeprecatedKeys.java    License: Apache License 2.0 6 votes vote down vote up
public void testReadWriteWithDeprecatedKeys() throws Exception {
   Configuration conf = new Configuration();
   conf.setBoolean("old.config.yet.to.be.deprecated", true);
   Configuration.addDeprecation("old.config.yet.to.be.deprecated", 
new String[]{"new.conf.to.replace.deprecated.conf"});
   ByteArrayOutputStream out=new ByteArrayOutputStream();
   String fileContents;
   try {
     conf.writeXml(out);
     fileContents = out.toString();
   } finally {
     out.close();
   }
   assertTrue(fileContents.contains("old.config.yet.to.be.deprecated"));
   assertTrue(fileContents.contains("new.conf.to.replace.deprecated.conf"));
 }
 
Example 2
Source Project: big-c   File: TestDeprecatedKeys.java    License: Apache License 2.0 6 votes vote down vote up
public void testReadWriteWithDeprecatedKeys() throws Exception {
   Configuration conf = new Configuration();
   conf.setBoolean("old.config.yet.to.be.deprecated", true);
   Configuration.addDeprecation("old.config.yet.to.be.deprecated", 
new String[]{"new.conf.to.replace.deprecated.conf"});
   ByteArrayOutputStream out=new ByteArrayOutputStream();
   String fileContents;
   try {
     conf.writeXml(out);
     fileContents = out.toString();
   } finally {
     out.close();
   }
   assertTrue(fileContents.contains("old.config.yet.to.be.deprecated"));
   assertTrue(fileContents.contains("new.conf.to.replace.deprecated.conf"));
 }
 
Example 3
Source Project: Bats   File: LogicalPlanConfiguration.java    License: Apache License 2.0 4 votes vote down vote up
private static String keyAndDeprecation(Attribute<?> attr)
{
  String key = StreamingApplication.APEX_PREFIX + attr.getName();
  Configuration.addDeprecation(StreamingApplication.DT_PREFIX + attr.getName(), key);
  return key;
}
 
Example 4
Source Project: hadoop   File: TestDeprecatedKeys.java    License: Apache License 2.0 4 votes vote down vote up
@Test
public void testIteratorWithDeprecatedKeysMappedToMultipleNewKeys() {
  Configuration conf = new Configuration();
  Configuration.addDeprecation("dK", new String[]{"nK1", "nK2"});
  conf.set("k", "v");
  conf.set("dK", "V");
  assertEquals("V", conf.get("dK"));
  assertEquals("V", conf.get("nK1"));
  assertEquals("V", conf.get("nK2"));
  conf.set("nK1", "VV");
  assertEquals("VV", conf.get("dK"));
  assertEquals("VV", conf.get("nK1"));
  assertEquals("VV", conf.get("nK2"));
  conf.set("nK2", "VVV");
  assertEquals("VVV", conf.get("dK"));
  assertEquals("VVV", conf.get("nK2"));
  assertEquals("VVV", conf.get("nK1"));
  boolean kFound = false;
  boolean dKFound = false;
  boolean nK1Found = false;
  boolean nK2Found = false;
  for (Map.Entry<String, String> entry : conf) {
    if (entry.getKey().equals("k")) {
      assertEquals("v", entry.getValue());
      kFound = true;
    }
    if (entry.getKey().equals("dK")) {
      assertEquals("VVV", entry.getValue());
      dKFound = true;
    }
    if (entry.getKey().equals("nK1")) {
      assertEquals("VVV", entry.getValue());
      nK1Found = true;
    }
    if (entry.getKey().equals("nK2")) {
      assertEquals("VVV", entry.getValue());
      nK2Found = true;
    }
  }
  assertTrue("regular Key not found", kFound);
  assertTrue("deprecated Key not found", dKFound);
  assertTrue("new Key 1 not found", nK1Found);
  assertTrue("new Key 2 not found", nK2Found);
}
 
Example 5
Source Project: big-c   File: TestDeprecatedKeys.java    License: Apache License 2.0 4 votes vote down vote up
@Test
public void testIteratorWithDeprecatedKeysMappedToMultipleNewKeys() {
  Configuration conf = new Configuration();
  Configuration.addDeprecation("dK", new String[]{"nK1", "nK2"});
  conf.set("k", "v");
  conf.set("dK", "V");
  assertEquals("V", conf.get("dK"));
  assertEquals("V", conf.get("nK1"));
  assertEquals("V", conf.get("nK2"));
  conf.set("nK1", "VV");
  assertEquals("VV", conf.get("dK"));
  assertEquals("VV", conf.get("nK1"));
  assertEquals("VV", conf.get("nK2"));
  conf.set("nK2", "VVV");
  assertEquals("VVV", conf.get("dK"));
  assertEquals("VVV", conf.get("nK2"));
  assertEquals("VVV", conf.get("nK1"));
  boolean kFound = false;
  boolean dKFound = false;
  boolean nK1Found = false;
  boolean nK2Found = false;
  for (Map.Entry<String, String> entry : conf) {
    if (entry.getKey().equals("k")) {
      assertEquals("v", entry.getValue());
      kFound = true;
    }
    if (entry.getKey().equals("dK")) {
      assertEquals("VVV", entry.getValue());
      dKFound = true;
    }
    if (entry.getKey().equals("nK1")) {
      assertEquals("VVV", entry.getValue());
      nK1Found = true;
    }
    if (entry.getKey().equals("nK2")) {
      assertEquals("VVV", entry.getValue());
      nK2Found = true;
    }
  }
  assertTrue("regular Key not found", kFound);
  assertTrue("deprecated Key not found", dKFound);
  assertTrue("new Key 1 not found", nK1Found);
  assertTrue("new Key 2 not found", nK2Found);
}
 
Example 6
@Deprecated
public static void addDeprecation(String key, String[] newKeys, String customMessage) {
    Configuration.addDeprecation(key, newKeys, customMessage);
}
 
Example 7
public static void addDeprecation(String key, String newKey, String customMessage) {
    Configuration.addDeprecation(key, newKey, customMessage);
}
 
Example 8
@Deprecated
public static void addDeprecation(String key, String[] newKeys) {
    Configuration.addDeprecation(key, newKeys);
}
 
Example 9
public static void addDeprecation(String key, String newKey) {
    Configuration.addDeprecation(key, newKey);
}
 
Example 10
private static String keyAndDeprecation(Attribute<?> attr)
{
  String key = StreamingApplication.APEX_PREFIX + attr.getName();
  Configuration.addDeprecation(StreamingApplication.DT_PREFIX + attr.getName(), key);
  return key;
}
 
Example 11
Source Project: incubator-tez   File: DeprecatedKeys.java    License: Apache License 2.0 4 votes vote down vote up
@SuppressWarnings("unused")
private static void _(String mrKey, String tezKey) {
  Configuration.addDeprecation(mrKey, tezKey);
}
 
Example 12
Source Project: tez   File: DeprecatedKeys.java    License: Apache License 2.0 4 votes vote down vote up
@SuppressWarnings("unused")
private static void _(String mrKey, String tezKey) {
  Configuration.addDeprecation(mrKey, tezKey);
}