-
Notifications
You must be signed in to change notification settings - Fork 188
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MID-8842 ninja - improved parsing and looging, getting rid of few todos
- Loading branch information
Showing
6 changed files
with
63 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
tools/ninja/src/main/java/com/evolveum/midpoint/ninja/util/InputParameterException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* | ||
* Copyright (C) 2010-2023 Evolveum and contributors | ||
* | ||
* This work is dual-licensed under the Apache License 2.0 | ||
* and European Union Public License. See LICENSE file for details. | ||
*/ | ||
|
||
package com.evolveum.midpoint.ninja.util; | ||
|
||
/** | ||
* Exception that is thrown when action execution is in progress and input parameters combination is invalid, | ||
* e.g. when two mutually exclusive parameters are specified | ||
* | ||
* Not to be used for validation of individual parameters, parameter parsing using {@link com.beust.jcommander.IParameterValidator} | ||
* that happens in JCommander throws {@link com.beust.jcommander.ParameterException} for that. | ||
*/ | ||
public class InputParameterException extends RuntimeException { | ||
|
||
public InputParameterException(String message) { | ||
super(message); | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
tools/ninja/src/main/java/com/evolveum/midpoint/ninja/util/NonBlankValidator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* | ||
* Copyright (C) 2010-2023 Evolveum and contributors | ||
* | ||
* This work is dual-licensed under the Apache License 2.0 | ||
* and European Union Public License. See LICENSE file for details. | ||
*/ | ||
|
||
package com.evolveum.midpoint.ninja.util; | ||
|
||
import com.beust.jcommander.IParameterValidator; | ||
import com.beust.jcommander.ParameterException; | ||
import org.apache.commons.lang3.StringUtils; | ||
|
||
public class NonBlankValidator implements IParameterValidator { | ||
|
||
@Override | ||
public void validate(String name, String value) throws ParameterException { | ||
if (StringUtils.isBlank(value)) { | ||
throw new ParameterException("Parameter " + name + " should not be empty"); | ||
} | ||
} | ||
} |