Skip to content

Commit

Permalink
Merge pull request #957 from apache/fix/WW-5250-todo
Browse files Browse the repository at this point in the history
WW-5250 Addresses TODO in test and stops using Mock Objects
  • Loading branch information
lukaszlenart authored Jun 10, 2024
2 parents cf34f0d + 03db4f1 commit 444e4d4
Show file tree
Hide file tree
Showing 3 changed files with 187 additions and 193 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public interface ActionValidatorManager {
* @param method the name of the method being invoked on the action - can be <tt>null</tt>.
* @return a list of all validators for the given class and context.
*/
List<Validator> getValidators(Class clazz, String context, String method);
List<Validator> getValidators(Class<?> clazz, String context, String method);

/**
* Returns a list of validators for the given class and context. This is the primary
Expand All @@ -46,7 +46,7 @@ public interface ActionValidatorManager {
* @param context the context of the action class - can be <tt>null</tt>.
* @return a list of all validators for the given class and context.
*/
List<Validator> getValidators(Class clazz, String context);
List<Validator> getValidators(Class<?> clazz, String context);

/**
* Validates the given object using action and its context.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public void validate(Object object, String context, ValidatorContext validatorCo
* @param context context
* @return a validator key which is the class name plus context.
*/
protected String buildValidatorKey(Class clazz, String context) {
protected String buildValidatorKey(Class<?> clazz, String context) {
return clazz.getName() + "/" + context;
}

Expand All @@ -137,7 +137,7 @@ protected Validator getValidatorFromValidatorConfig(ValidatorConfig config, Valu
}

@Override
public synchronized List<Validator> getValidators(Class clazz, String context, String method) {
public synchronized List<Validator> getValidators(Class<?> clazz, String context, String method) {
String validatorKey = buildValidatorKey(clazz, context);

if (!validatorCache.containsKey(validatorKey)) {
Expand All @@ -158,7 +158,7 @@ public synchronized List<Validator> getValidators(Class clazz, String context, S
}

@Override
public synchronized List<Validator> getValidators(Class clazz, String context) {
public synchronized List<Validator> getValidators(Class<?> clazz, String context) {
return getValidators(clazz, context, null);
}

Expand Down Expand Up @@ -277,7 +277,7 @@ public void validate(Object object, String context, ValidatorContext validatorCo
* @param checked the set of previously checked class-contexts, null if none have been checked
* @return a list of validator configs for the given class and context.
*/
protected List<ValidatorConfig> buildValidatorConfigs(Class clazz, String context, boolean checkFile, Set<String> checked) {
protected List<ValidatorConfig> buildValidatorConfigs(Class<?> clazz, String context, boolean checkFile, Set<String> checked) {
List<ValidatorConfig> validatorConfigs = new ArrayList<>();

if (checked == null) {
Expand All @@ -287,7 +287,7 @@ protected List<ValidatorConfig> buildValidatorConfigs(Class clazz, String contex
}

if (clazz.isInterface()) {
for (Class anInterface : clazz.getInterfaces()) {
for (Class<?> anInterface : clazz.getInterfaces()) {
validatorConfigs.addAll(buildValidatorConfigs(anInterface, context, checkFile, checked));
}
} else {
Expand All @@ -297,7 +297,7 @@ protected List<ValidatorConfig> buildValidatorConfigs(Class clazz, String contex
}

// look for validators for implemented interfaces
for (Class anInterface1 : clazz.getInterfaces()) {
for (Class<?> anInterface1 : clazz.getInterfaces()) {
if (checked.contains(anInterface1.getName())) {
continue;
}
Expand All @@ -317,17 +317,17 @@ protected List<ValidatorConfig> buildValidatorConfigs(Class clazz, String contex
return validatorConfigs;
}

protected List<ValidatorConfig> buildAliasValidatorConfigs(Class aClass, String context, boolean checkFile) {
protected List<ValidatorConfig> buildAliasValidatorConfigs(Class<?> aClass, String context, boolean checkFile) {
String fileName = aClass.getName().replace('.', '/') + "-" + context + VALIDATION_CONFIG_SUFFIX;
return loadFile(fileName, aClass, checkFile);
}

protected List<ValidatorConfig> buildClassValidatorConfigs(Class aClass, boolean checkFile) {
protected List<ValidatorConfig> buildClassValidatorConfigs(Class<?> aClass, boolean checkFile) {
String fileName = aClass.getName().replace('.', '/') + VALIDATION_CONFIG_SUFFIX;
return loadFile(fileName, aClass, checkFile);
}

protected List<ValidatorConfig> loadFile(String fileName, Class clazz, boolean checkFile) {
protected List<ValidatorConfig> loadFile(String fileName, Class<?> clazz, boolean checkFile) {
List<ValidatorConfig> retList = Collections.emptyList();

URL fileUrl = ClassLoaderUtil.getResource(fileName, clazz);
Expand Down
Loading

0 comments on commit 444e4d4

Please sign in to comment.