Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
mederly committed Jul 3, 2023
2 parents 066abb2 + 830fe55 commit 2fed5fb
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ public class BaseOptions {
public static final String P_VERSION = "-V";
public static final String P_VERSION_LONG = "--version";

public static final String P_BATCH_MODE = "-B";
public static final String P_BATCH_MODE_LONG= "--batch-mode";

@Parameter(names = { P_HELP, P_HELP_LONG }, help = true, descriptionKey = "base.help")
private boolean help = false;

Expand All @@ -52,6 +55,10 @@ public class BaseOptions {
@ParametersDelegate
private PolyStringNormalizerOptions polyStringNormalizerOptions = new PolyStringNormalizerOptions();

// todo implement support for this
@Parameter(names = { P_BATCH_MODE, P_BATCH_MODE_LONG }, descriptionKey = "base.batchMode")
private boolean batchMode = false;

public boolean isHelp() {
return help;
}
Expand Down Expand Up @@ -99,4 +106,12 @@ public void setVersion(Boolean version) {
public void setPolyStringNormalizerOptions(PolyStringNormalizerOptions polyStringNormalizerOptions) {
this.polyStringNormalizerOptions = polyStringNormalizerOptions;
}

public boolean isBatchMode() {
return batchMode;
}

public void setBatchMode(boolean batchMode) {
this.batchMode = batchMode;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ public VerificationCategoryConverter() {
public static final String P_CONTINUE_VERIFICATION_ON_ERROR = "--continue-verification-on-error";

public static final String P_FILES = "--files";
public static final String P_PLANNED_REMOVAL_VERSION = "--planned-removal-version";

@Parameter(names = { P_VERIFICATION_CATEGORY_LONG }, descriptionKey = "verify.verificationCategory",
converter = VerificationCategoryConverter.class, validateWith = VerificationCategoryConverter.class,
Expand All @@ -76,6 +77,9 @@ public VerificationCategoryConverter() {
@Parameter(names = { P_FILES }, descriptionKey = "verify.files", variableArity = true)
private List<File> files = new ArrayList<>();

@Parameter(names = { P_PLANNED_REMOVAL_VERSION }, descriptionKey = "verify.plannedRemovalVersion")
private String plannedRemovalVersion;

public List<VerificationCategory> getVerificationCategories() {
return verificationCategories;
}
Expand Down Expand Up @@ -112,4 +116,12 @@ public List<File> getFiles() {
public void setFiles(List<File> files) {
this.files = files;
}

public String getPlannedRemovalVersion() {
return plannedRemovalVersion;
}

public void setPlannedRemovalVersion(String plannedRemovalVersion) {
this.plannedRemovalVersion = plannedRemovalVersion;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ public VerificationReporter(@NotNull VerifyOptions options, @NotNull PrismContex
private void init() {
validator = new ObjectUpgradeValidator(prismContext);

validator.setWarnPlannedRemovalVersion(options.getPlannedRemovalVersion());

List<VerifyOptions.VerificationCategory> categories = options.getVerificationCategories();
if (categories.isEmpty()) {
validator.showAllWarnings();
Expand Down Expand Up @@ -120,15 +122,14 @@ private static CSVFormat createCsvFormat() {
public <T extends Objectable> void verify(Writer writer, PrismObject<T> object) throws IOException {
UpgradeValidationResult result = validator.validate((PrismObject) object);

for (UpgradeValidationItem item :result.getItems()) {
if (item.getPriority() == null){
for (UpgradeValidationItem item : result.getItems()) {
if (item.getPriority() == null) {
continue;
}

this.result.incrementPriorityItemCount(item.getPriority());
}


switch (options.getReportStyle()) {
case PLAIN:
verifyAsPlain(writer, object, result);
Expand Down
7 changes: 4 additions & 3 deletions tools/ninja/src/main/resources/messages.properties
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ base.verbose=Verbose output
base.type=Object type, case insensitive value, e.g. "user". Do not use "Type" suffix.
base.filter=Value of object filter used to search objects. If you start the filter with the \
letter @, the rest should be a filename. Start the filter with % to use Axiom query language.
base.batchMode=Run in non-interactive (batch) mode (disables output color)
import=Imports objects into MidPoint
import.input=Input file for import
import.overwrite=Overwrite input file
Expand Down Expand Up @@ -52,7 +53,7 @@ export.business.role.archetype.oid=Detects a business role based on a specific a
export.application.role.archetype.oid=Detects an application role based on a specific archetype, provided by its OID.
info=Shows information about the repository for the provided midPoint home
verify=Verify objects in midPoint repository
verify.warn=List of displayed warning categories, e.g. deprecated, plannedRemoval, uuid
verify.plannedRemovalVersion=Version value to warn about planned removal
passwordReset=Command will reset password of user specified by OID
passwordReset.oid=OID of the user to have password reset
testResource=Test resource
Expand Down Expand Up @@ -86,8 +87,8 @@ for a-acute character with NFKD processing the output will be plain "a" characte
Without NFKD processing the whole character will be removed.
base.psn.trimWhitespace=PolyString normalizer trim whitespace
base.psn.lowercase=PolyString normalizer lowercase
verify.reportStyle=Report format
verify.verificationCategory=Verification category
verify.reportStyle=Report format. Allowed values CSV, PLAIN.
verify.verificationCategory=Verification category. Allowed values DEPRECATED, PLANNED_REMOVAL, INCORRECT_OIDS.
upgradeDistribution=Upgrade midPoint distribution and related DB schema
upgradeDistribution.tempDir=Temp directory. By default, JVM temp directory is used.
upgradeDistribution.distributionArchive=Distribution archive file. This can be used to skip downloading archive.
Expand Down

0 comments on commit 2fed5fb

Please sign in to comment.