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

The following examples show how to use org.apache.hadoop.conf.Configuration#addDeprecation() . 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 File: TestDeprecatedKeys.java    From hadoop with 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 File: TestDeprecatedKeys.java    From big-c with 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 File: LogicalPlanConfiguration.java    From Bats with 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 File: TestDeprecatedKeys.java    From hadoop with 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 File: TestDeprecatedKeys.java    From big-c with 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
Source File: ImmutableConfiguration.java    From titan1withtp3.1 with Apache License 2.0 4 votes vote down vote up
@Deprecated
public static void addDeprecation(String key, String[] newKeys, String customMessage) {
    Configuration.addDeprecation(key, newKeys, customMessage);
}
 
Example 7
Source File: ImmutableConfiguration.java    From titan1withtp3.1 with Apache License 2.0 4 votes vote down vote up
public static void addDeprecation(String key, String newKey, String customMessage) {
    Configuration.addDeprecation(key, newKey, customMessage);
}
 
Example 8
Source File: ImmutableConfiguration.java    From titan1withtp3.1 with Apache License 2.0 4 votes vote down vote up
@Deprecated
public static void addDeprecation(String key, String[] newKeys) {
    Configuration.addDeprecation(key, newKeys);
}
 
Example 9
Source File: ImmutableConfiguration.java    From titan1withtp3.1 with Apache License 2.0 4 votes vote down vote up
public static void addDeprecation(String key, String newKey) {
    Configuration.addDeprecation(key, newKey);
}
 
Example 10
Source File: LogicalPlanConfiguration.java    From attic-apex-core with 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 11
Source File: DeprecatedKeys.java    From incubator-tez with 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 File: DeprecatedKeys.java    From tez with Apache License 2.0 4 votes vote down vote up
@SuppressWarnings("unused")
private static void _(String mrKey, String tezKey) {
  Configuration.addDeprecation(mrKey, tezKey);
}