Skip to content

Commit

Permalink
Merge branch 'post-3.7-fixes' into support-3.7
Browse files Browse the repository at this point in the history
  • Loading branch information
semancik committed Feb 26, 2018
2 parents 7a91fb5 + 9ec8abd commit 8ce2d23
Show file tree
Hide file tree
Showing 24 changed files with 915 additions and 323 deletions.
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2017 Evolveum
* Copyright (c) 2010-2018 Evolveum
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -16,6 +16,7 @@
package com.evolveum.midpoint.schema;

import com.evolveum.midpoint.prism.path.ItemPath;
import com.evolveum.midpoint.util.ShortDumpable;
import com.evolveum.midpoint.xml.ns._public.common.common_3.GetOperationOptionsType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.IterationMethodType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType;
Expand All @@ -33,7 +34,7 @@
* @author semancik
*
*/
public class GetOperationOptions extends AbstractOptions implements Serializable, Cloneable {
public class GetOperationOptions extends AbstractOptions implements Serializable, Cloneable, ShortDumpable {
private static final long serialVersionUID = 1L;

/**
Expand Down Expand Up @@ -797,6 +798,13 @@ public GetOperationOptions clone() {
@Override
public String toString() {
StringBuilder sb = new StringBuilder("GetOperationOptions(");
shortDump(sb);
sb.append(")");
return sb.toString();
}

@Override
public void shortDump(StringBuilder sb) {
appendFlag(sb, "resolve", resolve);
appendFlag(sb, "resolveNames", resolveNames);
appendFlag(sb, "noFetch", noFetch);
Expand All @@ -811,8 +819,6 @@ public String toString() {
appendVal(sb, "relationalValueSearchQuery", relationalValueSearchQuery);
appendVal(sb, "definitionProcessing", definitionProcessing);
removeLastComma(sb);
sb.append(")");
return sb.toString();
}


Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2013 Evolveum
* Copyright (c) 2010-2018 Evolveum
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -16,14 +16,15 @@
package com.evolveum.midpoint.schema;

import com.evolveum.midpoint.prism.path.ItemPath;
import com.evolveum.midpoint.util.ShortDumpable;

import java.io.Serializable;

/**
* @author semancik
*
*/
public class ObjectSelector implements Serializable {
public class ObjectSelector implements Serializable, ShortDumpable {

private ItemPath path;

Expand All @@ -41,4 +42,9 @@ public String toString() {
return "ObjectSelector(" + path + ")";
}

@Override
public void shortDump(StringBuilder sb) {
sb.append(path);
}

}
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2017 Evolveum
* Copyright (c) 2010-2018 Evolveum
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -27,6 +27,7 @@
import com.evolveum.midpoint.prism.path.ItemPathSegment;
import com.evolveum.midpoint.prism.path.NameItemPathSegment;
import com.evolveum.midpoint.util.DebugDumpable;
import com.evolveum.midpoint.util.ShortDumpable;
import com.evolveum.midpoint.xml.ns._public.common.common_3.*;
import org.apache.commons.collections4.CollectionUtils;
import org.jetbrains.annotations.NotNull;
Expand All @@ -35,7 +36,8 @@
* @author semancik
*
*/
public class SelectorOptions<T> implements Serializable, DebugDumpable {
public class SelectorOptions<T> implements Serializable, DebugDumpable, ShortDumpable {
private static final long serialVersionUID = 1L;

private ObjectSelector selector;
private T options;
Expand Down Expand Up @@ -374,17 +376,32 @@ public boolean equals(Object obj) {

@Override
public String toString() {
return "ObjectOperationOptions(" + selector + ": " + options + ")";
StringBuilder sb = new StringBuilder("ObjectOperationOptions(");
shortDump(sb);
sb.append(")");
return sb.toString();
}

@Override
public String debugDump() {
return debugDump(0);
public String debugDump(int indent) {
return toString();
}

@Override
public String debugDump(int indent) {
return toString();
public void shortDump(StringBuilder sb) {
if (selector == null) {
sb.append("/");
} else {
selector.shortDump(sb);
}
sb.append(":");
if (options == null) {
sb.append("null");
} else if (options instanceof ShortDumpable) {
((ShortDumpable)options).shortDump(sb);
} else {
sb.append(options);
}
}

//endregion
Expand Down
Expand Up @@ -799,6 +799,26 @@ public static String prettyPrint(SynchronizationSituationDescriptionType syncDes
return sb.toString();
}

public static String prettyPrint(ObjectDeltaType deltaType) {
if (deltaType == null) {
return "null";
}
StringBuilder sb = new StringBuilder("ObjectDeltaType(");
sb.append(prettyPrint(deltaType.getObjectType())).append(" ");
sb.append(prettyPrint(deltaType.getOid())).append(" ");
sb.append(deltaType.getChangeType()).append(": ");
com.evolveum.prism.xml.ns._public.types_3.ObjectType objectToAdd = deltaType.getObjectToAdd();
if (objectToAdd != null) {
sb.append(prettyPrint(objectToAdd));
}
List<ItemDeltaType> itemDelta = deltaType.getItemDelta();
if (itemDelta != null && !itemDelta.isEmpty()) {
sb.append(prettyPrint(itemDelta));
}
sb.append(")");
return sb.toString();
}

public static String prettyPrint(ObjectDeltaOperationType deltaOpType) {
if (deltaOpType == null) {
return "null";
Expand Down
Expand Up @@ -14578,52 +14578,101 @@
<xsd:complexType name="CredentialsResetPolicyType">
<xsd:annotation>
<xsd:documentation>
Credentials reset management policy. It specifies the management details for each supported
credentials reset type. It defines parameters such as reset method.
<p>
Credentials reset management policy. It specifies the management details for each supported
credentials reset type. It defines parameters such as reset method.
</p>
<p>
The idea is that all the password reset mechanisms have the same parts:
request, authentication, credential source, delivery.
This data structure is meant to configure those steps.
</p>
</xsd:documentation>
<xsd:appinfo>
<a:container/>
</xsd:appinfo>
</xsd:annotation>
<xsd:sequence>
<xsd:element name="name" type="xsd:string" minOccurs="0">
<xsd:annotation>
<xsd:documentation>
Name of the password reset scheme. This is a short name that acts both as an
identifier of the scheme and also as a short name used for diagnostics.
</xsd:documentation>
<xsd:appinfo>
<a:since>3.7.1</a:since>
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="forceChange" type="xsd:boolean" minOccurs="0" maxOccurs="1" default="false">
</xsd:element>
<!-- Later: authentication -->
<xsd:element name="newCredentialSource" type="tns:CredentialSourceType" minOccurs="0" maxOccurs="1">
<xsd:annotation>
<xsd:documentation>
Source of a new credential value. This setting specifies whether the new credential
value should be provided by the user, randomly generated, derived by a key-exchange
protocol and so on.
</xsd:documentation>
<xsd:appinfo>
<a:since>3.7.1</a:since>
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<!-- TODO: delivery, authentication -->
<xsd:element name="forceChange" type="xsd:boolean" minOccurs="0" maxOccurs="1" default="false">
<xsd:annotation>
<xsd:documentation>
If set to true then the new credential will have the forceChange flag set.
Which usualy means that the user will have to change the credential on next logon.
</xsd:documentation>
<xsd:appinfo>
<a:since>3.7.1</a:since>
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<!-- Later: delivery -->
<xsd:element name="securityQuestionReset" type="tns:SecurityQuestionsResetPolicyType" minOccurs="0">
<!-- This will be deprecated soon -->
</xsd:element>
<xsd:element name="mailReset" type="tns:MailResetPolicyType" minOccurs="0">
<!-- This will be deprecated soon -->
</xsd:element>
<xsd:element name="smsReset" type="tns:SmsResetPolicyType" minOccurs="0">
<!-- This will be deprecated soon -->
</xsd:element>
</xsd:sequence>
</xsd:complexType>

<xsd:complexType name="CredentialSourceType">
<xsd:annotation>
<xsd:documentation>
TODO
Source of a new credential value. This setting specifies whether the new credential
value should be provided by the user, randomly generated, derived by a key-exchange
protocol and so on.
</xsd:documentation>
<xsd:appinfo>
<a:container/>
<a:since>3.7.1</a:since>
</xsd:appinfo>
</xsd:annotation>
<xsd:sequence>
<xsd:element name="userEntry" type="tns:UserEntryCredentialSourceType" minOccurs="0">
<xsd:annotation>
<xsd:documentation>
New credential value is entered by the user.
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<!-- Later: generate, key-exchange, PKI, ... -->
</xsd:sequence>
</xsd:complexType>

<xsd:complexType name="UserEntryCredentialSourceType">
<xsd:annotation>
<xsd:documentation>
TODO
Specifies the details of a new credential entered manually by a user.
</xsd:documentation>
<xsd:appinfo>
<a:container/>
<a:since>3.7.1</a:since>
</xsd:appinfo>
</xsd:annotation>
<xsd:sequence>
Expand Down
Expand Up @@ -107,8 +107,12 @@ public static String debugDump(Collection<?> dumpables) {
}

public static String debugDump(Collection<?> dumpables, int indent) {
return debugDump(dumpables, indent, true);
}

public static String debugDump(Collection<?> dumpables, int indent, boolean openCloseSymbols) {
StringBuilder sb = new StringBuilder();
debugDump(sb, dumpables, indent, true);
debugDump(sb, dumpables, indent, openCloseSymbols);
return sb.toString();
}

Expand Down Expand Up @@ -639,6 +643,40 @@ public String toString() {
}
};
}

public static String shortDump(ShortDumpable sd) {
if (sd == null) {
return null;
} else {
return sd.shortDump();
}
}

public static void shortDump(StringBuilder sb, ShortDumpable sd) {
if (sd != null) {
sd.shortDump(sb);
}
}

public static void shortDump(StringBuilder sb, Collection<? extends ShortDumpable> sds) {
if (sds == null) {
return;
}
sb.append("[");
Iterator<? extends ShortDumpable> iterator = sds.iterator();
while (iterator.hasNext()) {
ShortDumpable sd = iterator.next();
if (sd == null) {
sb.append("null");
} else {
sd.shortDump(sb);
}
if (iterator.hasNext()) {
sb.append(", ");
}
}
sb.append("]");
}

public static Object shortDumpLazily(ShortDumpable dumpable) {
if (dumpable == null) {
Expand Down
Expand Up @@ -916,9 +916,7 @@ private <T extends ObjectType, F extends ObjectType> void executeDelta(ObjectDel

} finally {

LOGGER.info("RRRR1: {}", result);
result.computeStatus();
LOGGER.info("RRRR2: {}", result);
if (objectContext != null) {
if (!objectDelta.hasCompleteDefinition()) {
throw new SchemaException("object delta does not have complete definition");
Expand Down
Expand Up @@ -85,7 +85,7 @@ public void stringPolicyUtilsMinimalTest() throws JAXBException, SchemaException
StringPolicyUtils.normalize(sp);
AssertJUnit.assertNotNull(sp.getCharacterClass());
AssertJUnit.assertNotNull(sp.getLimitations().getLimit());
AssertJUnit.assertTrue(-1 == sp.getLimitations().getMaxLength());
AssertJUnit.assertTrue(Integer.MAX_VALUE == sp.getLimitations().getMaxLength());
AssertJUnit.assertTrue(0 == sp.getLimitations().getMinLength());
AssertJUnit.assertTrue(0 == " !\"#$%&'()*+,-.01234567890:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"
.compareTo(sp.getCharacterClass().getValue()));
Expand Down

0 comments on commit 8ce2d23

Please sign in to comment.