hbase-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nicolas Liochon (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HBASE-8810) Bring in code constants in line with default xml's
Date Fri, 05 Jul 2013 08:59:50 GMT

    [ https://issues.apache.org/jira/browse/HBASE-8810?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13700544#comment-13700544
] 

Nicolas Liochon commented on HBASE-8810:
----------------------------------------

I've written this
{code}
package org.apache.hadoop.hbase;


import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.conf.Configuration;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import java.lang.reflect.Field;
import java.util.Map;

@Category(SmallTests.class)
public class TestDefaultSettings {

  public static final Log LOG =
      LogFactory.getLog(TestDefaultSettings.class);

  private String codeNameFromXMLName(String xmlName){
    String codeName = "DEFAULT_" + xmlName.toUpperCase().replace('.', '_').trim();

    return codeName;
  }

  @Test
  public void testDefaultSettings() throws IllegalAccessException {
    Configuration codeConf = new Configuration();
    Configuration xmlConf  = HBaseConfiguration.create();

    Class<?> hcc = HConstants.class;

    for (Map.Entry<String, String> e : xmlConf){
      String xmlName =  e.getKey();
      String codeName =  codeNameFromXMLName(xmlName);
      try {
        Field f = hcc.getField(codeName);
        String codeVal = ("" + f.get(null)).trim();

        if (e.getValue().equals(codeVal)){
          System.out.println("OK  xmlName: " + xmlName + ", codeConf: code=" + codeVal + "
  xml=" + e.getValue());
        }else {
          System.err.println("NOK xmlName: " + xmlName + ", codeConf: code=" + codeVal + "
  xml=" + e.getValue());
        }
      } catch (NoSuchFieldException e1) {
        System.out.println("               NoSuchFieldException: xmlName: " + xmlName + ",
" + "codeConf: code=" + codeName + "   xml=" + e.getKey());
      }
    }
  }
}
{code}

But it's not a huge success because the naming differs in most cases.
                
> Bring in code constants in line with default xml's
> --------------------------------------------------
>
>                 Key: HBASE-8810
>                 URL: https://issues.apache.org/jira/browse/HBASE-8810
>             Project: HBase
>          Issue Type: Bug
>          Components: Usability
>            Reporter: Elliott Clark
>            Assignee: Elliott Clark
>             Fix For: 0.95.2
>
>         Attachments: 8810.txt, 8810v2.txt, hbase-default_to_java_constants.xsl, HBaseDefaultXMLConstants.java
>
>
> After the defaults were changed in the xml some constants were left the same.
> DEFAULT_HBASE_CLIENT_PAUSE for example.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message