@@ -0,0 +1,1861 @@
+/*%0A * The Alluxio Open Foundation licenses this work under the Apache License, version 2.0%0A * (the %22License%22). You may not use this work except in compliance with the License, which is%0A * available at www.apache.org/licenses/LICENSE-2.0%0A *%0A * This software is distributed on an %22AS IS%22 basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,%0A * either express or implied, as more fully set forth in the License.%0A *%0A * See the NOTICE file distributed with this work for information regarding copyright ownership.%0A */%0A%0Apackage alluxio;%0A%0Aimport org.junit.rules.TestRule;%0Aimport org.junit.runner.Description;%0Aimport org.junit.runners.model.Statement;%0A%0Aimport java.util.HashMap;%0Aimport java.util.Map;%0Aimport java.util.Map.Entry;%0A%0A/**%0A * A rule for modifying Alluxio configuration during a test suite.%0A */%0Apublic class ConfigurationRule implements TestRule %7B%0A  private final Map%3CString, String%3E mKeyValuePairs;%0A%0A  /**%0A   * @param keyValuePairs map from configuration keys to the values to set them to%0A   */%0A  public ConfigurationRule(Map%3CString, String%3E keyValuePairs) %7B%0A    mKeyValuePairs = keyValuePairs;%0A  %7D%0A%0A  @Override%0A  public Statement apply(final Statement statement, Description description) %7B%0A    return new Statement() %7B%0A      @Override%0A      public void evaluate() throws Throwable %7B%0A        Map%3CString, String%3E originalValues = new HashMap%3C%3E();%0A        for (Entry%3CString, String%3E entry : mKeyValuePairs.entrySet()) %7B%0A          String key = entry.getKey();%0A          String value = entry.getValue();%0A          originalValues.put(key, Configuration.get(key));%0A          Configuration.set(key, value);%0A        %7D%0A        try %7B%0A          statement.evaluate();%0A        %7D finally %7B%0A          for (Entry%3CString, String%3E entry : originalValues.entrySet()) %7B%0A            Configuration.set(entry.getKey(), entry.getValue());%0A          %7D%0A        %7D%0A      %7D%0A    %7D;%0A  %7D%0A%7D%0A

Add configuration rule