Skip to content

Commit

Permalink
Verify that only valid table options are used with LoggingService tab…
Browse files Browse the repository at this point in the history
…les.
  • Loading branch information
Randy Guck authored and Randy Guck committed Sep 5, 2015
1 parent e8b8dac commit 0ea3887
Showing 1 changed file with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import com.dell.doradus.common.HttpDefs;
import com.dell.doradus.common.HttpMethod;
import com.dell.doradus.common.RESTResponse;
import com.dell.doradus.common.RetentionAge;
import com.dell.doradus.common.TableDefinition;
import com.dell.doradus.common.UNode;
import com.dell.doradus.common.Utils;
Expand Down Expand Up @@ -262,9 +263,22 @@ private void validateApplication(ApplicationDefinition appDef) {
}

for(TableDefinition tableDef: appDef.getTableDefinitions().values()) {
Utils.require(tableDef.getFieldDefinitions().size() == 0,
"Field definitions are not allowed with the LoggingService");
validateTable(tableDef);
}
}

private void validateTable(TableDefinition tableDef) {
for (String optName : tableDef.getOptionNames()) {
switch (optName) {
case CommonDefs.OPT_RETENTION_AGE:
new RetentionAge(tableDef.getOption(optName));
break;
default:
Utils.require(false, "Unknown LoggingService table option: %s", optName);
}
}
Utils.require(tableDef.getFieldDefinitions().size() == 0,
"Field definitions are not allowed with the LoggingService");
}

} // class LoggingService

0 comments on commit 0ea3887

Please sign in to comment.