shorted the validator check classes to normal length.
This commit is contained in:
parent
8833933ebe
commit
4f6f7286c0
|
@ -35,7 +35,7 @@ import net.forwardfire.tpquery.model.TPQueryParameter;
|
|||
* @author Willem Cazander
|
||||
* @version 1.0 June 1, 2015
|
||||
*/
|
||||
public abstract class AbstractTPQConfigValidatorParameterPattern implements TPQConfigValidatorCheck {
|
||||
public abstract class AbstractTPQCheckParameterPattern implements TPQConfigValidatorCheck {
|
||||
|
||||
private final String pattern;
|
||||
private final Function<TPQueryParameter,String> patternValue;
|
||||
|
@ -45,7 +45,7 @@ public abstract class AbstractTPQConfigValidatorParameterPattern implements TPQC
|
|||
* @param pattern The pattern to check.
|
||||
* @param patternValue The function to get value to check.
|
||||
*/
|
||||
public AbstractTPQConfigValidatorParameterPattern(String pattern,Function<TPQueryParameter,String> patternValue) {
|
||||
public AbstractTPQCheckParameterPattern(String pattern,Function<TPQueryParameter,String> patternValue) {
|
||||
Validate.notNull(patternValue);
|
||||
this.pattern=pattern;
|
||||
this.patternValue=patternValue;
|
|
@ -32,7 +32,7 @@ import net.forwardfire.tpquery.model.TPQuery;
|
|||
* @author Willem Cazander
|
||||
* @version 1.0 June 1, 2015
|
||||
*/
|
||||
public final class TPQConfigValidatorCheckDescriptionNotBlank implements TPQConfigValidatorCheck {
|
||||
public final class TPQCheckDescriptionNotBlank implements TPQConfigValidatorCheck {
|
||||
|
||||
@Override
|
||||
public void validateQuery(TPQuery query) {
|
|
@ -32,7 +32,7 @@ import net.forwardfire.tpquery.model.TPQuery;
|
|||
* @author Willem Cazander
|
||||
* @version 1.0 June 1, 2015
|
||||
*/
|
||||
public final class TPQConfigValidatorCheckNamePattern implements TPQConfigValidatorCheck {
|
||||
public final class TPQCheckNamePattern implements TPQConfigValidatorCheck {
|
||||
|
||||
private final String pattern;
|
||||
|
||||
|
@ -40,7 +40,7 @@ public final class TPQConfigValidatorCheckNamePattern implements TPQConfigValida
|
|||
* Creates an name pattern checker.
|
||||
* @param pattern The pattern to check the name against.
|
||||
*/
|
||||
public TPQConfigValidatorCheckNamePattern(String pattern) {
|
||||
public TPQCheckNamePattern(String pattern) {
|
||||
Validate.matchesPattern("", pattern);
|
||||
this.pattern=pattern;
|
||||
}
|
|
@ -32,7 +32,7 @@ import net.forwardfire.tpquery.model.TPQuery;
|
|||
* @author Willem Cazander
|
||||
* @version 1.0 June 1, 2015
|
||||
*/
|
||||
public final class TPQConfigValidatorCheckParameterDefaultValueNotBlank implements TPQConfigValidatorCheck {
|
||||
public final class TPQCheckParameterDefaultValueNotBlank implements TPQConfigValidatorCheck {
|
||||
|
||||
@Override
|
||||
public void validateQuery(TPQuery query) {
|
|
@ -28,13 +28,13 @@ package net.forwardfire.tpquery.config.validate;
|
|||
* @author Willem Cazander
|
||||
* @version 1.0 June 1, 2015
|
||||
*/
|
||||
public final class TPQConfigValidatorCheckParameterNamePattern extends AbstractTPQConfigValidatorParameterPattern {
|
||||
public final class TPQCheckParameterNamePattern extends AbstractTPQCheckParameterPattern {
|
||||
|
||||
/**
|
||||
* Creates an name pattern checker.
|
||||
* @param pattern The pattern to check the name against.
|
||||
*/
|
||||
public TPQConfigValidatorCheckParameterNamePattern(String pattern) {
|
||||
public TPQCheckParameterNamePattern(String pattern) {
|
||||
super(pattern,p -> p.getName());
|
||||
}
|
||||
}
|
|
@ -28,13 +28,13 @@ package net.forwardfire.tpquery.config.validate;
|
|||
* @author Willem Cazander
|
||||
* @version 1.0 June 1, 2015
|
||||
*/
|
||||
public final class TPQConfigValidatorCheckParameterTypePattern extends AbstractTPQConfigValidatorParameterPattern {
|
||||
public final class TPQCheckParameterTypePattern extends AbstractTPQCheckParameterPattern {
|
||||
|
||||
/**
|
||||
* Creates an type pattern checker.
|
||||
* @param pattern The pattern to check the type against.
|
||||
*/
|
||||
public TPQConfigValidatorCheckParameterTypePattern(String pattern) {
|
||||
public TPQCheckParameterTypePattern(String pattern) {
|
||||
super(pattern,p -> p.getType());
|
||||
}
|
||||
}
|
|
@ -28,13 +28,13 @@ package net.forwardfire.tpquery.config.validate;
|
|||
* @author Willem Cazander
|
||||
* @version 1.0 June 1, 2015
|
||||
*/
|
||||
public final class TPQConfigValidatorCheckParameterValueTypePattern extends AbstractTPQConfigValidatorParameterPattern {
|
||||
public final class TPQCheckParameterValueTypePattern extends AbstractTPQCheckParameterPattern {
|
||||
|
||||
/**
|
||||
* Creates an value type pattern checker.
|
||||
* @param pattern The pattern to check the value type against.
|
||||
*/
|
||||
public TPQConfigValidatorCheckParameterValueTypePattern(String pattern) {
|
||||
public TPQCheckParameterValueTypePattern(String pattern) {
|
||||
super(pattern,p -> p.getValueType());
|
||||
}
|
||||
}
|
|
@ -8,12 +8,12 @@ import net.forwardfire.tpquery.TPQManager;
|
|||
import net.forwardfire.tpquery.TPQFactory;
|
||||
import net.forwardfire.tpquery.config.validate.TPQConfigValidator;
|
||||
import net.forwardfire.tpquery.config.validate.TPQConfigValidatorCheck;
|
||||
import net.forwardfire.tpquery.config.validate.TPQConfigValidatorCheckDescriptionNotBlank;
|
||||
import net.forwardfire.tpquery.config.validate.TPQConfigValidatorCheckNamePattern;
|
||||
import net.forwardfire.tpquery.config.validate.TPQConfigValidatorCheckParameterDefaultValueNotBlank;
|
||||
import net.forwardfire.tpquery.config.validate.TPQConfigValidatorCheckParameterNamePattern;
|
||||
import net.forwardfire.tpquery.config.validate.TPQConfigValidatorCheckParameterTypePattern;
|
||||
import net.forwardfire.tpquery.config.validate.TPQConfigValidatorCheckParameterValueTypePattern;
|
||||
import net.forwardfire.tpquery.config.validate.TPQCheckDescriptionNotBlank;
|
||||
import net.forwardfire.tpquery.config.validate.TPQCheckNamePattern;
|
||||
import net.forwardfire.tpquery.config.validate.TPQCheckParameterDefaultValueNotBlank;
|
||||
import net.forwardfire.tpquery.config.validate.TPQCheckParameterNamePattern;
|
||||
import net.forwardfire.tpquery.config.validate.TPQCheckParameterTypePattern;
|
||||
import net.forwardfire.tpquery.config.validate.TPQCheckParameterValueTypePattern;
|
||||
import net.forwardfire.tpquery.model.TPQuery;
|
||||
|
||||
public class TPQueryStoreConfigValidatorTest {
|
||||
|
@ -41,10 +41,10 @@ public class TPQueryStoreConfigValidatorTest {
|
|||
.build()
|
||||
.build();
|
||||
|
||||
config.addConfigValidator(".*", new TPQConfigValidatorCheckNamePattern(".*"));
|
||||
config.addConfigValidator(".*", new TPQConfigValidatorCheckParameterNamePattern(".*"));
|
||||
config.addConfigValidator(".*", new TPQConfigValidatorCheckParameterTypePattern(".*"));
|
||||
config.addConfigValidator(".*", new TPQConfigValidatorCheckParameterValueTypePattern(".*"));
|
||||
config.addConfigValidator(".*", new TPQCheckNamePattern(".*"));
|
||||
config.addConfigValidator(".*", new TPQCheckParameterNamePattern(".*"));
|
||||
config.addConfigValidator(".*", new TPQCheckParameterTypePattern(".*"));
|
||||
config.addConfigValidator(".*", new TPQCheckParameterValueTypePattern(".*"));
|
||||
config.addConfigValidator(".*", new TPQConfigValidatorCheck() {
|
||||
@Override
|
||||
public void validateQuery(TPQuery query) {
|
||||
|
@ -70,10 +70,10 @@ public class TPQueryStoreConfigValidatorTest {
|
|||
.build()
|
||||
.build();
|
||||
|
||||
TPQConfigValidator t = config.addConfigValidator("junit.test", new TPQConfigValidatorCheckDescriptionNotBlank());
|
||||
TPQConfigValidator t = config.addConfigValidator("junit.test", new TPQCheckDescriptionNotBlank());
|
||||
config.removeConfigValidator(t);
|
||||
|
||||
config.addConfigValidator(".*", new TPQConfigValidatorCheckDescriptionNotBlank());
|
||||
config.addConfigValidator(".*", new TPQCheckDescriptionNotBlank());
|
||||
TPQManager manager = TPQFactory.createManager(config);
|
||||
assertNotNull(manager);
|
||||
}
|
||||
|
@ -98,7 +98,7 @@ public class TPQueryStoreConfigValidatorTest {
|
|||
.build()
|
||||
.build()
|
||||
.build();
|
||||
config.addConfigValidator(".*", new TPQConfigValidatorCheckParameterDefaultValueNotBlank());
|
||||
config.addConfigValidator(".*", new TPQCheckParameterDefaultValueNotBlank());
|
||||
TPQManager manager = TPQFactory.createManager(config);
|
||||
assertNotNull(manager);
|
||||
}
|
||||
|
@ -123,7 +123,7 @@ public class TPQueryStoreConfigValidatorTest {
|
|||
.build()
|
||||
.build()
|
||||
.build();
|
||||
config.addConfigValidator("junit.test-f.*", new TPQConfigValidatorCheckParameterTypePattern("!RAW"));
|
||||
config.addConfigValidator("junit.test-f.*", new TPQCheckParameterTypePattern("!RAW"));
|
||||
TPQManager manager = TPQFactory.createManager(config);
|
||||
assertNotNull(manager);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue