postMarshallHandledOids = new ArrayList<>();
@@ -151,8 +147,6 @@ public void handleGlobalError(OperationResult currentResult) {
@Test
public void notWellFormed() throws Exception {
- System.out.println("\n===[ notWellFormed ]=====");
-
OperationResult result = new OperationResult(this.getClass().getName()+".notWellFormed");
validateFile("not-well-formed.xml",result);
@@ -168,8 +162,6 @@ public void notWellFormed() throws Exception {
@Test
public void undeclaredPrefix() throws Exception {
- System.out.println("\n===[ undeclaredPrefix ]=====");
-
OperationResult result = new OperationResult(this.getClass().getName()+".undeclaredPrefix");
validateFile("undeclared-prefix.xml",result);
@@ -185,8 +177,6 @@ public void undeclaredPrefix() throws Exception {
@Test
public void schemaViolation() throws Exception {
- System.out.println("\n===[ schemaViolation ]=====");
-
OperationResult result = new OperationResult(this.getClass().getName()+".schemaViolation");
validateFile("three-users-schema-violation.xml",result);
@@ -206,8 +196,6 @@ public void schemaViolation() throws Exception {
*/
@Test
public void testStopOnErrors() throws Exception {
- System.out.println("\n===[ testStopOnErrors ]=====");
-
OperationResult result = new OperationResult(this.getClass().getName()+".testStopOnErrors");
LegacyValidator validator = new LegacyValidator(PrismTestUtil.getPrismContext());
@@ -223,8 +211,6 @@ public void testStopOnErrors() throws Exception {
@Test
public void noName() throws Exception {
- System.out.println("\n===[ noName ]=====");
-
OperationResult result = new OperationResult(this.getClass().getName()+".noName");
validateFile("no-name.xml",result);
@@ -250,15 +236,12 @@ private void validateFile(String filename,EventHandler handler, OperationResult
}
private void validateFile(String filename, LegacyValidator validator, OperationResult result) throws FileNotFoundException {
-
String filepath = BASE_PATH + filename;
System.out.println("Validating " + filename);
- FileInputStream fis = null;
-
File file = new File(filepath);
- fis = new FileInputStream(file);
+ FileInputStream fis = new FileInputStream(file);
validator.validate(fis, result, OBJECT_RESULT_OPERATION_NAME);
@@ -269,7 +252,5 @@ private void validateFile(String filename, LegacyValidator validator, OperationR
System.out.println("No errors");
System.out.println(result.debugDump());
}
-
}
-
}
diff --git a/infra/common/src/test/java/com/evolveum/midpoint/validator/test/UnknownNodeSkipSchemaValidationTest.java b/infra/common/src/test/java/com/evolveum/midpoint/validator/test/UnknownNodeSkipSchemaValidationTest.java
index 27098bef824..76da331bce2 100644
--- a/infra/common/src/test/java/com/evolveum/midpoint/validator/test/UnknownNodeSkipSchemaValidationTest.java
+++ b/infra/common/src/test/java/com/evolveum/midpoint/validator/test/UnknownNodeSkipSchemaValidationTest.java
@@ -10,9 +10,9 @@
import com.evolveum.midpoint.common.validator.LegacyValidator;
+// TODO testing: missing from suite, 3 tests failing - so what about that annotation? :-)
public class UnknownNodeSkipSchemaValidationTest extends UnknownNodeValidationTest {
-
@Override
protected void customizeValidator(LegacyValidator validator) {
validator.setValidateSchema(false);
diff --git a/infra/common/src/test/java/com/evolveum/midpoint/validator/test/UnknownNodeValidationTest.java b/infra/common/src/test/java/com/evolveum/midpoint/validator/test/UnknownNodeValidationTest.java
index cd2e50f79e6..bf92b0d683d 100644
--- a/infra/common/src/test/java/com/evolveum/midpoint/validator/test/UnknownNodeValidationTest.java
+++ b/infra/common/src/test/java/com/evolveum/midpoint/validator/test/UnknownNodeValidationTest.java
@@ -16,10 +16,12 @@
import com.evolveum.midpoint.schema.MidPointPrismContextFactory;
import com.evolveum.midpoint.schema.constants.MidPointConstants;
import com.evolveum.midpoint.schema.result.OperationResult;
+import com.evolveum.midpoint.tools.testng.AbstractUnitTest;
import com.evolveum.midpoint.util.PrettyPrinter;
import com.evolveum.midpoint.util.exception.SchemaException;
-public class UnknownNodeValidationTest {
+// TODO testing: missing from suite, all passing
+public class UnknownNodeValidationTest extends AbstractUnitTest {
public static final String BASE_PATH = "src/test/resources/validator/unknown/";
private static final String OBJECT_RESULT_OPERATION_NAME = BasicValidatorTest.class.getName() + ".validateObject";
@@ -87,7 +89,6 @@ public void elementInConnector() throws Exception {
}
protected void validateNodeFailure(String name, String file, String expected) throws Exception {
- System.out.println("\n===[ " + name + " ]=====");
OperationResult result = new OperationResult(this.getClass().getName()+"." + name);
validateFile(file,result);
System.out.println(result.debugDump());
diff --git a/infra/prism-api/src/main/java/com/evolveum/midpoint/prism/util/PrismTestUtil.java b/infra/prism-api/src/main/java/com/evolveum/midpoint/prism/util/PrismTestUtil.java
index d735213bd6b..e3d1cf63b89 100644
--- a/infra/prism-api/src/main/java/com/evolveum/midpoint/prism/util/PrismTestUtil.java
+++ b/infra/prism-api/src/main/java/com/evolveum/midpoint/prism/util/PrismTestUtil.java
@@ -203,6 +203,7 @@ public static PolyStringType createPolyStringType(String orig, String norm) {
return new PolyStringType(createPolyString(orig, norm));
}
+ // TODO inttest: replace with UnitTestMixin (TestUtil?)
public static void displayTestTitle(String testName) {
System.out.println("\n\n===[ "+testName+" ]===\n");
LOGGER.info("===[ {} ]===",testName);
diff --git a/infra/prism-impl/src/main/java/com/evolveum/midpoint/prism/impl/util/JaxbTestUtil.java b/infra/prism-impl/src/main/java/com/evolveum/midpoint/prism/impl/util/JaxbTestUtil.java
index eb8cf9fdb34..e6e797d4b97 100644
--- a/infra/prism-impl/src/main/java/com/evolveum/midpoint/prism/impl/util/JaxbTestUtil.java
+++ b/infra/prism-impl/src/main/java/com/evolveum/midpoint/prism/impl/util/JaxbTestUtil.java
@@ -6,48 +6,28 @@
*/
package com.evolveum.midpoint.prism.impl.util;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.InputStream;
-import java.io.Reader;
-import java.io.StringReader;
-import java.io.StringWriter;
+import java.io.*;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
-
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBElement;
-import javax.xml.bind.JAXBException;
-import javax.xml.bind.Marshaller;
-import javax.xml.bind.Unmarshaller;
+import javax.xml.bind.*;
import javax.xml.namespace.QName;
-import com.evolveum.midpoint.prism.Containerable;
-import com.evolveum.midpoint.prism.PrismContainer;
-import com.evolveum.midpoint.prism.PrismContainerDefinition;
-
-import com.evolveum.midpoint.prism.impl.schema.SchemaRegistryImpl;
-import com.evolveum.midpoint.prism.util.PrismTestUtil;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.Validate;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
-import com.evolveum.midpoint.prism.Objectable;
-import com.evolveum.midpoint.prism.PrismContainerValue;
-import com.evolveum.midpoint.prism.PrismContext;
-import com.evolveum.midpoint.prism.PrismObject;
-import com.evolveum.midpoint.prism.PrismObjectDefinition;
+import com.evolveum.midpoint.prism.*;
+import com.evolveum.midpoint.prism.impl.schema.SchemaRegistryImpl;
import com.evolveum.midpoint.prism.schema.SchemaDescription;
import com.evolveum.midpoint.prism.schema.SchemaRegistry;
+import com.evolveum.midpoint.prism.util.PrismTestUtil;
import com.evolveum.midpoint.prism.xml.DynamicNamespacePrefixMapper;
import com.evolveum.midpoint.util.DOMUtil;
-import com.evolveum.midpoint.util.JAXBUtil;
import com.evolveum.midpoint.util.exception.SchemaException;
import com.evolveum.midpoint.util.exception.SystemException;
import com.evolveum.midpoint.util.logging.Trace;
@@ -58,16 +38,15 @@
* (The last drop was the inability to hide RawType from externally-visible model service WSDL.
* The solution devised, based on @Raw type, prevents JAXB from correctly parsing any structures that
* contain RawType elements.)
- *
+ *
* So, don't use JaxbTestUtil even for testing purposes. Use PrismTestUtil instead.
- *
- * ===
+ *
* Original description:
- *
+ *
* JAXB testing util. Only for use in tests. DO NOT USE IN PRODUCTION CODE.
* This util is used to test the ablility of prism JAXB representation to be used by
* native (Sun) JAXB code.
- *
+ *
* Note: this is what used to be PrismJaxbProcessor. Therefore there may be still a lot of junk to clean up.
*
* @author Radovan Semancik
@@ -143,7 +122,7 @@ public boolean isJaxbClass(Class> clazz) {
// not a JAXB class
return false;
}
- for (Package jaxbPackage: getSchemaRegistry().getCompileTimePackages()) {
+ for (Package jaxbPackage : getSchemaRegistry().getCompileTimePackages()) {
if (jaxbPackage.equals(clazz.getPackage())) {
return true;
}
@@ -246,9 +225,9 @@ public String marshalElementToString(Object element, Map propert
if (element instanceof Element) {
return DOMUtil.serializeDOMToString((Element) element);
} else if (element instanceof JAXBElement) {
- return marshalElementToString((JAXBElement>)element, properties);
+ return marshalElementToString((JAXBElement>) element, properties);
} else {
- throw new IllegalArgumentException("Unsupported element type "+element.getClass().getName());
+ throw new IllegalArgumentException("Unsupported element type " + element.getClass().getName());
}
}
@@ -262,7 +241,7 @@ public String marshalElementToString(Object element, QName elementName) throws J
if (element instanceof Element) {
return DOMUtil.serializeDOMToString((Element) element);
} else if (element instanceof JAXBElement) {
- return marshalElementToString((JAXBElement>)element);
+ return marshalElementToString((JAXBElement>) element);
} else {
JAXBElement jaxbElement = new JAXBElement<>(elementName, Object.class, element);
return marshalElementToString(jaxbElement);
@@ -309,7 +288,7 @@ public Element marshalObjectToDom(T jaxbObject, QName elementQName, Document
}
JAXBElement jaxbElement = new JAXBElement<>(elementQName, (Class) jaxbObject.getClass(),
- jaxbObject);
+ jaxbObject);
Element element = doc.createElementNS(elementQName.getNamespaceURI(), elementQName.getLocalPart());
marshalElementToDom(jaxbElement, element);
@@ -319,7 +298,7 @@ public Element marshalObjectToDom(T jaxbObject, QName elementQName, Document
public void marshalObjectToDom(T jaxbObject, QName elementQName, Element parentElement) throws JAXBException {
JAXBElement jaxbElement = new JAXBElement<>(elementQName, (Class) jaxbObject.getClass(),
- jaxbObject);
+ jaxbObject);
marshalElementToDom(jaxbElement, parentElement);
}
@@ -328,7 +307,7 @@ public Element toDomElement(Object element) throws JAXBException {
}
public Element toDomElement(Object jaxbElement, Document doc) throws JAXBException {
- return toDomElement(jaxbElement,doc,false,false,false);
+ return toDomElement(jaxbElement, doc, false, false, false);
}
@SuppressWarnings({ "rawtypes", "unchecked" })
@@ -356,7 +335,6 @@ public Element toDomElement(Object jaxbElement, Document doc, boolean adopt, boo
}
}
-
public JAXBElement unmarshalElement(String xmlString, Class type) throws JAXBException, SchemaException {
if (xmlString == null) {
return null;
@@ -439,12 +417,12 @@ public T unmarshalObject(File file, Class type) throws JAXBException, Sch
T value = element.getValue();
// adopt not needed, already adopted in unmarshalElement call above
if (!type.isAssignableFrom(value.getClass())) {
- throw new IllegalArgumentException("Unmarshalled "+value.getClass()+" from file "+file+" while "+type+" was expected");
+ throw new IllegalArgumentException("Unmarshalled " + value.getClass() + " from file " + file + " while " + type + " was expected");
}
return value;
}
- public Object unmarshalObjects(File file) throws JAXBException{
+ public Object unmarshalObjects(File file) throws JAXBException {
return createUnmarshaller().unmarshal(file);
}
@@ -488,19 +466,18 @@ private PrismContainer unmarshalSingleValueContaine
return container;
}
-
public T unmarshalObject(Object domOrJaxbElement, Class type) throws SchemaException {
JAXBElement element;
if (domOrJaxbElement instanceof JAXBElement>) {
element = (JAXBElement) domOrJaxbElement;
} else if (domOrJaxbElement instanceof Node) {
try {
- element = unmarshalElement((Node)domOrJaxbElement, type);
+ element = unmarshalElement((Node) domOrJaxbElement, type);
} catch (JAXBException e) {
- throw new SchemaException(e.getMessage(),e);
+ throw new SchemaException(e.getMessage(), e);
}
} else {
- throw new IllegalArgumentException("Unknown element type "+domOrJaxbElement);
+ throw new IllegalArgumentException("Unknown element type " + domOrJaxbElement);
}
if (element == null) {
return null;
@@ -521,7 +498,7 @@ public JAXBElement unmarshalElement(File file, Class type) throws Sche
JAXBElement element = (JAXBElement) getUnmarshaller().unmarshal(is);
adopt(element);
return element;
- } catch (RuntimeException ex){
+ } catch (RuntimeException ex) {
throw new SystemException(ex);
} finally {
if (is != null) {
@@ -627,7 +604,6 @@ private boolean compareElement(Object a, Object b) {
return DOMUtil.compareElement(ae, be, true);
}
-
public T fromElement(Object element, Class type) throws SchemaException {
if (element == null) {
@@ -649,14 +625,14 @@ public T fromElement(Object element, Class type) throws SchemaException {
if (element instanceof Element) {
try {
- JAXBElement unmarshalledElement = unmarshalElement((Element)element, type);
+ JAXBElement unmarshalledElement = unmarshalElement((Element) element, type);
return unmarshalledElement.getValue();
} catch (JAXBException e) {
- throw new IllegalArgumentException("Unmarshall failed: " + e.getMessage(),e);
+ throw new IllegalArgumentException("Unmarshall failed: " + e.getMessage(), e);
}
}
- throw new IllegalArgumentException("Unknown element type "+element.getClass().getName());
+ throw new IllegalArgumentException("Unknown element type " + element.getClass().getName());
}
private QName determineElementQName(Objectable objectable) {
@@ -670,7 +646,7 @@ private QName determineElementQName(Objectable objectable) {
return definition.getItemName();
}
}
- throw new IllegalStateException("Cannot determine element name of "+objectable);
+ throw new IllegalStateException("Cannot determine element name of " + objectable);
}
private QName determineElementQName(Containerable containerable) {
@@ -690,15 +666,15 @@ private boolean isObjectable(Class type) {
private void adopt(T object, Class type) throws SchemaException {
if (object instanceof Objectable) {
- getPrismContext().adopt(((Objectable)object));
+ getPrismContext().adopt(((Objectable) object));
}
}
private void adopt(Object object) throws SchemaException {
if (object instanceof JAXBElement) {
- adopt(((JAXBElement)object).getValue());
+ adopt(((JAXBElement) object).getValue());
} else if (object instanceof Objectable) {
- getPrismContext().adopt(((Objectable)(object)));
+ getPrismContext().adopt(((Objectable) (object)));
}
}
diff --git a/infra/prism-impl/src/test/java/com/evolveum/midpoint/prism/AbstractPrismTest.java b/infra/prism-impl/src/test/java/com/evolveum/midpoint/prism/AbstractPrismTest.java
index 14eaa8edcff..7ddcaf24f5a 100644
--- a/infra/prism-impl/src/test/java/com/evolveum/midpoint/prism/AbstractPrismTest.java
+++ b/infra/prism-impl/src/test/java/com/evolveum/midpoint/prism/AbstractPrismTest.java
@@ -6,9 +6,10 @@
*/
package com.evolveum.midpoint.prism;
-import static com.evolveum.midpoint.prism.PrismInternalTestUtil.DEFAULT_NAMESPACE_PREFIX;
import static org.testng.AssertJUnit.assertEquals;
+import static com.evolveum.midpoint.prism.PrismInternalTestUtil.DEFAULT_NAMESPACE_PREFIX;
+
import java.io.IOException;
import java.util.Collection;
import java.util.function.Function;
@@ -24,6 +25,7 @@
import com.evolveum.midpoint.prism.foo.UserType;
import com.evolveum.midpoint.prism.polystring.PolyString;
import com.evolveum.midpoint.prism.util.PrismTestUtil;
+import com.evolveum.midpoint.tools.testng.AbstractUnitTest;
import com.evolveum.midpoint.util.DebugDumpable;
import com.evolveum.midpoint.util.MiscUtil;
import com.evolveum.midpoint.util.PrettyPrinter;
@@ -31,9 +33,8 @@
/**
* @author semancik
- *
*/
-public class AbstractPrismTest {
+public class AbstractPrismTest extends AbstractUnitTest {
protected static final String USER_FOO_OID = "01234567";
@@ -43,25 +44,12 @@ public class AbstractPrismTest {
protected static final String ASSIGNMENT_ABRAKADABRA_DESCRIPTION = "abra kadabra";
protected static final long ASSIGNMENT_ABRAKADABRA_ID = 222L;
-
@BeforeSuite
- public void setupDebug() throws SchemaException, SAXException, IOException {
+ public void initPrismContext() throws SchemaException, SAXException, IOException {
PrettyPrinter.setDefaultNamespacePrefix(DEFAULT_NAMESPACE_PREFIX);
PrismTestUtil.resetPrismContext(new PrismInternalTestUtil());
}
- protected void displayTestTitle(String testName) {
- PrismTestUtil.displayTestTitle(testName);
- }
-
- protected void displayWhen(String testName) {
- PrismTestUtil.displayWhen(testName);
- }
-
- protected void displayThen(String testName) {
- PrismTestUtil.displayThen(testName);
- }
-
protected void display(String title, String value) {
PrismTestUtil.display(title, value);
}
@@ -82,7 +70,7 @@ protected PolyString createPolyString(String orig) {
return PrismTestUtil.createPolyString(orig);
}
- protected PrismContext getPrismContext() {
+ protected static PrismContext getPrismContext() {
return PrismTestUtil.getPrismContext();
}
@@ -108,7 +96,7 @@ private void assertAssignmentValueCount(ObjectDelta userDelta, int exp
if (expectedValues == 0) {
return;
} else {
- fail("No assignment delta in "+userDelta);
+ fail("No assignment delta in " + userDelta);
}
}
Collection> values = lambda.apply(assignmentDelta);
@@ -116,10 +104,10 @@ private void assertAssignmentValueCount(ObjectDelta userDelta, int exp
if (expectedValues == 0) {
return;
} else {
- fail("No values to delete in assignment "+type+" in "+userDelta);
+ fail("No values to delete in assignment " + type + " in " + userDelta);
}
}
- assertEquals("Wrong number of assignment "+type+" values in "+userDelta, expectedValues, values.size());
+ assertEquals("Wrong number of assignment " + type + " values in " + userDelta, expectedValues, values.size());
}
protected void assertAssignmentDelete(ObjectDelta userDelta, Long expectedId, String expectedDescription) {
@@ -137,18 +125,18 @@ protected void assertAssignmentReplace(ObjectDelta userDelta, Long exp
private void assertAssignmentValue(ObjectDelta userDelta, Long expectedId, String expectedDescription, String type, Function, Collection>> lambda) {
ContainerDelta assignmentDelta = userDelta.findContainerDelta(UserType.F_ASSIGNMENT);
if (assignmentDelta == null) {
- fail("No assignment delta in "+userDelta);
+ fail("No assignment delta in " + userDelta);
}
Collection> valuesToDelete = lambda.apply(assignmentDelta);
if (valuesToDelete == null) {
- fail("No values to "+type+" in assignment delta in "+userDelta);
+ fail("No values to " + type + " in assignment delta in " + userDelta);
}
for (PrismContainerValue valueToDelete : valuesToDelete) {
if (assignmentMatches(valueToDelete, expectedId, expectedDescription)) {
return;
}
}
- fail("Assignment "+expectedId+":"+expectedDescription+" not found in "+userDelta);
+ fail("Assignment " + expectedId + ":" + expectedDescription + " not found in " + userDelta);
}
protected boolean assignmentMatches(PrismContainerValue assignmentValue, Long expectedId, String expectedDescription) {
@@ -202,5 +190,4 @@ protected PrismObject createUserFoo() throws SchemaException {
return user;
}
-
}
diff --git a/infra/prism-impl/src/test/java/com/evolveum/midpoint/prism/PrismInternalTestUtil.java b/infra/prism-impl/src/test/java/com/evolveum/midpoint/prism/PrismInternalTestUtil.java
index 4ce7ee91ada..d5286a82407 100644
--- a/infra/prism-impl/src/test/java/com/evolveum/midpoint/prism/PrismInternalTestUtil.java
+++ b/infra/prism-impl/src/test/java/com/evolveum/midpoint/prism/PrismInternalTestUtil.java
@@ -287,10 +287,6 @@ public static void assertPathVisitor(PathVisitable visitable, final ItemPath pat
assertEquals("Wrong number of visits for path "+path, expectedVisits, visits.size());
}
- public static void displayTestTitle(String testName) {
- PrismTestUtil.displayTestTitle(testName);
- }
-
public static void assertUserJack(PrismObject user, boolean expectRawInConstructions, boolean withIncomplete) throws SchemaException {
assertUserJack(user, expectRawInConstructions, true, withIncomplete);
}
@@ -312,9 +308,6 @@ public static void assertUserJack(PrismObject user, boolean expectRawI
assertPathVisitor(user, ItemPath.create(UserType.F_ASSIGNMENT, null), false, 2);
assertPathVisitor(user, ItemPath.create(UserType.F_ACTIVATION, ActivationType.F_ENABLED), false, 1);
assertPathVisitor(user, UserType.F_EXTENSION, false, 1);
-// assertPathVisitor(user, ItemPath.create(
-// UserType.F_EXTENSION,
-// NameItemPathSegment.WILDCARD), false, 5);
}
public static void assertUserJackContent(PrismObject user, boolean expectRawInConstructions,
@@ -462,7 +455,7 @@ private static void assertLang(Map lang, String key, String expe
assertEquals("Wrong lang in polystring for key "+key, expectedValue, lang.get(key));
}
- private static void assertUserJackExtension(PrismObject user, boolean withIncomplete) throws SchemaException {
+ private static void assertUserJackExtension(PrismObject user, boolean withIncomplete) {
PrismContext prismContext = user.getPrismContext();
PrismContainer> extension = user.getExtension();
assertContainerDefinition(extension, "extension", DOMUtil.XSD_ANY, 0, 1);
diff --git a/infra/prism-impl/src/test/java/com/evolveum/midpoint/prism/TestCompare.java b/infra/prism-impl/src/test/java/com/evolveum/midpoint/prism/TestCompare.java
index 142edbfa703..f7a04dd4294 100644
--- a/infra/prism-impl/src/test/java/com/evolveum/midpoint/prism/TestCompare.java
+++ b/infra/prism-impl/src/test/java/com/evolveum/midpoint/prism/TestCompare.java
@@ -37,7 +37,7 @@
public abstract class TestCompare extends AbstractPrismTest {
private static final QName REF_QNAME = new QName(NS_FOO, "ref");
- private static final QName REF_TYPE_QNAME = new QName(NS_FOO, "RefType");;
+ private static final QName REF_TYPE_QNAME = new QName(NS_FOO, "RefType");
protected abstract String getSubdirName();
@@ -56,22 +56,16 @@ protected File getFile(String baseName) {
*/
@Test
public void testCompareJack() throws SchemaException, SAXException, IOException {
- final String TEST_NAME="testCompareJack";
- displayTestTitle(TEST_NAME);
-
// GIVEN
PrismContext prismContext = constructInitializedPrismContext();
-// Document document = DOMUtil.parseFile(USER_JACK_FILE_XML);
-// Element userElement = DOMUtil.getFirstChildElement(document);
-
PrismObject user1 = prismContext.parseObject(getFile(USER_JACK_FILE_BASENAME));
PrismObject user2 = prismContext.parseObject(getFile(USER_JACK_FILE_BASENAME));
// WHEN, THEN
- assertTrue("Users not the same (PrismObject)(1)", user1.equals(user2));
- assertTrue("Users not the same (PrismObject)(2)", user2.equals(user1));
+ assertEquals("Users not the same (PrismObject)(1)", user2, user1);
+ assertEquals("Users not the same (PrismObject)(2)", user1, user2);
// Following line won't work here. We don't have proper generated classes here.
// It is tested in the "schema" project that has a proper code generation
@@ -87,9 +81,6 @@ public void testCompareJack() throws SchemaException, SAXException, IOException
*/
@Test
public void testDiffJack() throws Exception {
- final String TEST_NAME="testDiffJack";
- displayTestTitle(TEST_NAME);
-
// GIVEN
PrismContext prismContext = constructInitializedPrismContext();
@@ -144,9 +135,6 @@ public void testDiffJack() throws Exception {
*/
@Test
public void testDiffJackLiteral() throws Exception {
- final String TEST_NAME="testDiffJackLiteral";
- displayTestTitle(TEST_NAME);
-
// GIVEN
PrismContext prismContext = constructInitializedPrismContext();
@@ -194,9 +182,6 @@ public void testDiffJackLiteral() throws Exception {
@Test
public void testDiffPatchRoundTrip() throws SchemaException, SAXException, IOException {
- final String TEST_NAME="testDiffPatchRoundTrip";
- displayTestTitle(TEST_NAME);
-
// GIVEN
PrismContext prismContext = constructInitializedPrismContext();
@@ -206,27 +191,18 @@ public void testDiffPatchRoundTrip() throws SchemaException, SAXException, IOExc
ObjectDelta jackDelta = jackOriginal.diff(jackModified);
-// System.out.println("jackOriginal:\n" + prismContext.getXnodeProcessor().serializeObject(jackOriginal).debugDump(1));
-// System.out.println("jackModified:\n" + prismContext.getXnodeProcessor().serializeObject(jackModified).debugDump(1));
-// System.out.println("jackDelta:\n" + jackDelta.debugDump());
-
jackDelta.assertDefinitions();
jackDelta.checkConsistence(true, true, true);
// WHEN
jackDelta.applyTo(jackOriginal);
-// System.out.println("jackOriginal after applying delta:\n" + prismContext.getXnodeProcessor().serializeObject(jackOriginal).debugDump(1));
-
// THEN
assertTrue("Roundtrip failed", jackOriginal.equivalent(jackModified));
}
@Test
public void testEqualsReferenceValues() throws Exception {
- final String TEST_NAME="testEqualsReferenceValues";
- displayTestTitle(TEST_NAME);
-
PrismContext prismContext = constructInitializedPrismContext();
PrismReferenceValue val11 = new PrismReferenceValueImpl("oid1");
@@ -270,7 +246,6 @@ public void testEqualsReferenceValues() throws Exception {
yetAnotherDifferentUser.setPropertyRealValue(UserType.F_FULL_NAME, "John J Random");
val35.setObject(yetAnotherDifferentUser);
-
assertTrue("val11 - val11", val11.equals(val11));
assertTrue("val11 - val12", val11.equals(val12));
assertTrue("val12 - val11", val12.equals(val11));
@@ -299,9 +274,6 @@ public void testEqualsReferenceValues() throws Exception {
@Test
public void testEqualsReferenceValuesSchema() throws Exception {
- final String TEST_NAME="testEqualsReferenceValuesSchema";
- displayTestTitle(TEST_NAME);
-
PrismContext prismContext = constructInitializedPrismContext();
MutablePrismReferenceDefinition ref1Def = prismContext.definitionFactory().createReferenceDefinition(REF_QNAME, REF_TYPE_QNAME);
@@ -389,21 +361,10 @@ public void testEqualsReferenceValuesSchema() throws Exception {
assertFalse("val43 - val21", val43.equals(val21));
assertFalse("val43 - val22", val43.equals(val22));
assertTrue("val43 - val23", val43.equals(val23));
-
-
-// assertTrue("val11 - val11", val11.equals(val11));
-// assertTrue("val11 - val11", val11.equals(val11));
-// assertTrue("val11 - val11", val11.equals(val11));
-// assertTrue("val11 - val11", val11.equals(val11));
-
-
}
@Test
public void testDiffReferences() throws Exception {
- final String TEST_NAME="testDiffReferences";
- displayTestTitle(TEST_NAME);
-
if (!"xml".equals(getFilenameSuffix())) {
return;
}
diff --git a/infra/prism-impl/src/test/java/com/evolveum/midpoint/prism/TestDelta.java b/infra/prism-impl/src/test/java/com/evolveum/midpoint/prism/TestDelta.java
index fcb7ead5e63..60fbcf69145 100644
--- a/infra/prism-impl/src/test/java/com/evolveum/midpoint/prism/TestDelta.java
+++ b/infra/prism-impl/src/test/java/com/evolveum/midpoint/prism/TestDelta.java
@@ -6,15 +6,20 @@
*/
package com.evolveum.midpoint.prism;
-import static com.evolveum.midpoint.prism.PrismInternalTestUtil.*;
import static org.testng.AssertJUnit.*;
-import java.util.Collection;
+import static com.evolveum.midpoint.prism.PrismInternalTestUtil.*;
+import java.util.Collection;
import javax.xml.datatype.XMLGregorianCalendar;
-import com.evolveum.midpoint.prism.delta.*;
+import org.testng.AssertJUnit;
+import org.testng.annotations.Test;
+import com.evolveum.midpoint.prism.delta.*;
+import com.evolveum.midpoint.prism.foo.ActivationType;
+import com.evolveum.midpoint.prism.foo.AssignmentType;
+import com.evolveum.midpoint.prism.foo.UserType;
import com.evolveum.midpoint.prism.impl.PrismPropertyValueImpl;
import com.evolveum.midpoint.prism.impl.PrismReferenceDefinitionImpl;
import com.evolveum.midpoint.prism.impl.PrismReferenceValueImpl;
@@ -23,12 +28,6 @@
import com.evolveum.midpoint.prism.impl.delta.PropertyDeltaImpl;
import com.evolveum.midpoint.prism.impl.delta.ReferenceDeltaImpl;
import com.evolveum.midpoint.prism.path.ItemPath;
-import org.testng.AssertJUnit;
-import org.testng.annotations.Test;
-
-import com.evolveum.midpoint.prism.foo.ActivationType;
-import com.evolveum.midpoint.prism.foo.AssignmentType;
-import com.evolveum.midpoint.prism.foo.UserType;
import com.evolveum.midpoint.prism.polystring.PolyString;
import com.evolveum.midpoint.prism.util.PrismAsserts;
import com.evolveum.midpoint.prism.util.PrismTestUtil;
@@ -43,9 +42,6 @@ public class TestDelta extends AbstractPrismTest {
@Test
public void testDeltaPaths() throws Exception {
- final String TEST_NAME="testDeltaPaths";
- displayTestTitle(TEST_NAME);
-
PrismContext prismContext = getPrismContext();
PrismPropertyDefinition descDefinition = prismContext.definitionFactory().createPropertyDefinition(UserType.F_DESCRIPTION,
@@ -65,8 +61,8 @@ public void testDeltaPaths() throws Exception {
assignmentValue1.setPropertyRealValue(AssignmentType.F_DESCRIPTION, ASSIGNMENT_PATLAMA_DESCRIPTION, PrismTestUtil.getPrismContext());
ObjectDelta assObjDelta1 = PrismTestUtil.getPrismContext().deltaFactory().object()
.createModificationAddContainer(UserType.class, USER_FOO_OID,
- UserType.F_ASSIGNMENT, assignmentValue1);
- ItemDelta,?> assDelta1 = assObjDelta1.getModifications().iterator().next();
+ UserType.F_ASSIGNMENT, assignmentValue1);
+ ItemDelta, ?> assDelta1 = assObjDelta1.getModifications().iterator().next();
assertPath(assDelta1, UserType.F_ASSIGNMENT);
PrismContainerValue assignmentValue2 = prismContext.itemFactory().createContainerValue();
@@ -74,8 +70,8 @@ public void testDeltaPaths() throws Exception {
assignmentValue1.setPropertyRealValue(AssignmentType.F_DESCRIPTION, "jamalalicha patlama paprtala", PrismTestUtil.getPrismContext());
ObjectDelta assObjDelta2 = PrismTestUtil.getPrismContext().deltaFactory().object()
.createModificationAddContainer(UserType.class, USER_FOO_OID,
- UserType.F_ASSIGNMENT, assignmentValue2);
- ItemDelta,?> assDelta2 = assObjDelta2.getModifications().iterator().next();
+ UserType.F_ASSIGNMENT, assignmentValue2);
+ ItemDelta, ?> assDelta2 = assObjDelta2.getModifications().iterator().next();
assertPath(assDelta2, UserType.F_ASSIGNMENT);
PrismPropertyDefinition assDescDefinition = prismContext.definitionFactory().createPropertyDefinition(AssignmentType.F_DESCRIPTION,
@@ -90,18 +86,15 @@ public void testDeltaPaths() throws Exception {
}
- private void assertPath(ItemDelta,?> delta, ItemPath expectedPath) {
- PrismAsserts.assertPathEquivalent("Wrong path in "+delta, expectedPath, delta.getPath());
+ private void assertPath(ItemDelta, ?> delta, ItemPath expectedPath) {
+ PrismAsserts.assertPathEquivalent("Wrong path in " + delta, expectedPath, delta.getPath());
}
@Test
- public void testPropertyDeltaMerge01() throws Exception {
- final String TEST_NAME="testPropertyDeltaMerge01";
- displayTestTitle(TEST_NAME);
-
+ public void testPropertyDeltaMerge01() {
// GIVEN
- PrismPropertyDefinition propertyDefinition = getPrismContext().definitionFactory().createPropertyDefinition(UserType.F_DESCRIPTION,
- DOMUtil.XSD_STRING);
+ PrismPropertyDefinition propertyDefinition = getPrismContext().definitionFactory()
+ .createPropertyDefinition(UserType.F_DESCRIPTION, DOMUtil.XSD_STRING);
PropertyDelta delta1 = new PropertyDeltaImpl(propertyDefinition, PrismTestUtil.getPrismContext());
delta1.addRealValuesToAdd("add1");
@@ -122,13 +115,10 @@ public void testPropertyDeltaMerge01() throws Exception {
}
@Test
- public void testPropertyDeltaMerge02() throws Exception {
- final String TEST_NAME="testPropertyDeltaMerge02";
- displayTestTitle(TEST_NAME);
-
+ public void testPropertyDeltaMerge02() {
// GIVEN
- PrismPropertyDefinition propertyDefinition = getPrismContext().definitionFactory().createPropertyDefinition(UserType.F_DESCRIPTION,
- DOMUtil.XSD_STRING);
+ PrismPropertyDefinition propertyDefinition = getPrismContext().definitionFactory()
+ .createPropertyDefinition(UserType.F_DESCRIPTION, DOMUtil.XSD_STRING);
PropertyDelta delta1 = new PropertyDeltaImpl(propertyDefinition, PrismTestUtil.getPrismContext());
delta1.addRealValuesToDelete("del1");
@@ -149,13 +139,10 @@ public void testPropertyDeltaMerge02() throws Exception {
}
@Test
- public void testPropertyDeltaMerge03() throws Exception {
- final String TEST_NAME="testPropertyDeltaMerge03";
- displayTestTitle(TEST_NAME);
-
+ public void testPropertyDeltaMerge03() {
// GIVEN
- PrismPropertyDefinition propertyDefinition = getPrismContext().definitionFactory().createPropertyDefinition(UserType.F_DESCRIPTION,
- DOMUtil.XSD_STRING);
+ PrismPropertyDefinition propertyDefinition = getPrismContext().definitionFactory()
+ .createPropertyDefinition(UserType.F_DESCRIPTION, DOMUtil.XSD_STRING);
PropertyDelta delta1 = new PropertyDeltaImpl(propertyDefinition, PrismTestUtil.getPrismContext());
delta1.addRealValuesToAdd("add1");
@@ -178,13 +165,10 @@ public void testPropertyDeltaMerge03() throws Exception {
}
@Test
- public void testPropertyDeltaMerge04() throws Exception {
- final String TEST_NAME="testPropertyDeltaMerge04";
- displayTestTitle(TEST_NAME);
-
+ public void testPropertyDeltaMerge04() {
// GIVEN
- PrismPropertyDefinition propertyDefinition = getPrismContext().definitionFactory().createPropertyDefinition(UserType.F_DESCRIPTION,
- DOMUtil.XSD_STRING);
+ PrismPropertyDefinition propertyDefinition = getPrismContext().definitionFactory()
+ .createPropertyDefinition(UserType.F_DESCRIPTION, DOMUtil.XSD_STRING);
PropertyDelta delta1 = new PropertyDeltaImpl(propertyDefinition, PrismTestUtil.getPrismContext());
delta1.addRealValuesToAdd("add1");
@@ -207,13 +191,10 @@ public void testPropertyDeltaMerge04() throws Exception {
}
@Test
- public void testPropertyDeltaMerge05() throws Exception {
- final String TEST_NAME="testPropertyDeltaMerge05";
- displayTestTitle(TEST_NAME);
-
+ public void testPropertyDeltaMerge05() {
// GIVEN
- PrismPropertyDefinition propertyDefinition = getPrismContext().definitionFactory().createPropertyDefinition(UserType.F_DESCRIPTION,
- DOMUtil.XSD_STRING);
+ PrismPropertyDefinition propertyDefinition = getPrismContext().definitionFactory()
+ .createPropertyDefinition(UserType.F_DESCRIPTION, DOMUtil.XSD_STRING);
PropertyDelta delta1 = new PropertyDeltaImpl(propertyDefinition, PrismTestUtil.getPrismContext());
delta1.addRealValuesToAdd("add1");
@@ -235,13 +216,10 @@ public void testPropertyDeltaMerge05() throws Exception {
}
@Test
- public void testPropertyDeltaMerge06() throws Exception {
- final String TEST_NAME="testPropertyDeltaMerge06";
- displayTestTitle(TEST_NAME);
-
+ public void testPropertyDeltaMerge06() {
// GIVEN
- PrismPropertyDefinition propertyDefinition = getPrismContext().definitionFactory().createPropertyDefinition(UserType.F_DESCRIPTION,
- DOMUtil.XSD_STRING);
+ PrismPropertyDefinition propertyDefinition = getPrismContext().definitionFactory()
+ .createPropertyDefinition(UserType.F_DESCRIPTION, DOMUtil.XSD_STRING);
PropertyDelta delta1 = new PropertyDeltaImpl(propertyDefinition, PrismTestUtil.getPrismContext());
delta1.addRealValuesToAdd("add1");
@@ -263,13 +241,10 @@ public void testPropertyDeltaMerge06() throws Exception {
}
@Test
- public void testPropertyDeltaMerge10() throws Exception {
- final String TEST_NAME="testPropertyDeltaMerge10";
- displayTestTitle(TEST_NAME);
-
+ public void testPropertyDeltaMerge10() {
// GIVEN
- PrismPropertyDefinition propertyDefinition = getPrismContext().definitionFactory().createPropertyDefinition(UserType.F_DESCRIPTION,
- DOMUtil.XSD_STRING);
+ PrismPropertyDefinition propertyDefinition = getPrismContext().definitionFactory()
+ .createPropertyDefinition(UserType.F_DESCRIPTION, DOMUtil.XSD_STRING);
PropertyDelta delta1 = new PropertyDeltaImpl(propertyDefinition, PrismTestUtil.getPrismContext());
delta1.setRealValuesToReplace("r1x", "r1y");
@@ -290,13 +265,10 @@ public void testPropertyDeltaMerge10() throws Exception {
}
@Test
- public void testPropertyDeltaMerge11() throws Exception {
- final String TEST_NAME="testPropertyDeltaMerge11";
- displayTestTitle(TEST_NAME);
-
+ public void testPropertyDeltaMerge11() {
// GIVEN
- PrismPropertyDefinition propertyDefinition = getPrismContext().definitionFactory().createPropertyDefinition(UserType.F_DESCRIPTION,
- DOMUtil.XSD_STRING);
+ PrismPropertyDefinition propertyDefinition = getPrismContext().definitionFactory()
+ .createPropertyDefinition(UserType.F_DESCRIPTION, DOMUtil.XSD_STRING);
PropertyDelta delta1 = new PropertyDeltaImpl(propertyDefinition, PrismTestUtil.getPrismContext());
delta1.setRealValuesToReplace("r1x", "r1y");
@@ -318,13 +290,10 @@ public void testPropertyDeltaMerge11() throws Exception {
}
@Test
- public void testPropertyDeltaMerge12() throws Exception {
- final String TEST_NAME="testPropertyDeltaMerge12";
- displayTestTitle(TEST_NAME);
-
+ public void testPropertyDeltaMerge12() {
// GIVEN
- PrismPropertyDefinition propertyDefinition = getPrismContext().definitionFactory().createPropertyDefinition(UserType.F_DESCRIPTION,
- DOMUtil.XSD_STRING);
+ PrismPropertyDefinition propertyDefinition = getPrismContext().definitionFactory()
+ .createPropertyDefinition(UserType.F_DESCRIPTION, DOMUtil.XSD_STRING);
PropertyDelta delta1 = new PropertyDeltaImpl(propertyDefinition, PrismTestUtil.getPrismContext());
delta1.setRealValuesToReplace("r1x", "r1y");
@@ -347,9 +316,6 @@ public void testPropertyDeltaMerge12() throws Exception {
@Test
public void testPropertyDeltaMerge13() throws Exception {
- final String TEST_NAME="testPropertyDeltaMerge13";
- displayTestTitle(TEST_NAME);
-
// GIVEN
PrismPropertyDefinition propertyDefinition = getPrismContext().definitionFactory().createPropertyDefinition(UserType.F_DESCRIPTION,
DOMUtil.XSD_STRING);
@@ -374,9 +340,6 @@ public void testPropertyDeltaMerge13() throws Exception {
@Test
public void testPropertyDeltaMerge20() throws Exception {
- final String TEST_NAME="testPropertyDeltaMerge20";
- displayTestTitle(TEST_NAME);
-
// GIVEN
PrismPropertyDefinition propertyDefinition = getPrismContext().definitionFactory().createPropertyDefinition(UserType.F_DESCRIPTION,
DOMUtil.XSD_STRING);
@@ -402,9 +365,6 @@ public void testPropertyDeltaMerge20() throws Exception {
@Test
public void testPropertyDeltaSwallow01() throws Exception {
- final String TEST_NAME="testPropertyDeltaSwallow01";
- displayTestTitle(TEST_NAME);
-
// GIVEN
PrismPropertyDefinition propertyDefinition = getPrismContext().definitionFactory().createPropertyDefinition(UserType.F_DESCRIPTION,
DOMUtil.XSD_STRING);
@@ -412,7 +372,7 @@ public void testPropertyDeltaSwallow01() throws Exception {
PropertyDelta delta1 = new PropertyDeltaImpl(propertyDefinition, PrismTestUtil.getPrismContext());
delta1.addRealValuesToAdd("add1");
ObjectDelta objectDelta = new ObjectDeltaImpl<>(UserType.class, ChangeType.MODIFY,
- PrismTestUtil.getPrismContext());
+ PrismTestUtil.getPrismContext());
objectDelta.addModification(delta1);
PropertyDelta delta2 = new PropertyDeltaImpl(propertyDefinition, PrismTestUtil.getPrismContext());
@@ -434,9 +394,6 @@ public void testPropertyDeltaSwallow01() throws Exception {
@Test
public void testSummarize01() throws Exception {
- final String TEST_NAME="testSummarize01";
- displayTestTitle(TEST_NAME);
-
// GIVEN
PrismPropertyDefinition propertyDefinition = getPrismContext().definitionFactory().createPropertyDefinition(UserType.F_DESCRIPTION,
DOMUtil.XSD_STRING);
@@ -444,13 +401,13 @@ public void testSummarize01() throws Exception {
PropertyDelta delta1 = new PropertyDeltaImpl(propertyDefinition, PrismTestUtil.getPrismContext());
delta1.addRealValuesToAdd("add1");
ObjectDelta objectDelta1 = new ObjectDeltaImpl<>(UserType.class, ChangeType.MODIFY,
- PrismTestUtil.getPrismContext());
+ PrismTestUtil.getPrismContext());
objectDelta1.addModification(delta1);
PropertyDelta delta2 = new PropertyDeltaImpl(propertyDefinition, PrismTestUtil.getPrismContext());
delta2.addRealValuesToAdd("add2");
ObjectDelta objectDelta2 = new ObjectDeltaImpl<>(UserType.class, ChangeType.MODIFY,
- PrismTestUtil.getPrismContext());
+ PrismTestUtil.getPrismContext());
objectDelta2.addModification(delta2);
// WHEN
@@ -469,9 +426,6 @@ public void testSummarize01() throws Exception {
@Test
public void testSummarize02() throws Exception {
- final String TEST_NAME="testSummarize02";
- displayTestTitle(TEST_NAME);
-
// GIVEN
PrismPropertyDefinition propertyDefinition = getPrismContext().definitionFactory().createPropertyDefinition(UserType.F_DESCRIPTION,
DOMUtil.XSD_STRING);
@@ -479,13 +433,13 @@ public void testSummarize02() throws Exception {
PropertyDelta delta1 = new PropertyDeltaImpl(propertyDefinition, PrismTestUtil.getPrismContext());
delta1.addRealValuesToDelete("del1");
ObjectDelta objectDelta1 = new ObjectDeltaImpl<>(UserType.class, ChangeType.MODIFY,
- PrismTestUtil.getPrismContext());
+ PrismTestUtil.getPrismContext());
objectDelta1.addModification(delta1);
PropertyDelta delta2 = new PropertyDeltaImpl(propertyDefinition, PrismTestUtil.getPrismContext());
delta2.addRealValuesToDelete("del2");
ObjectDelta objectDelta2 = new ObjectDeltaImpl<>(UserType.class, ChangeType.MODIFY,
- PrismTestUtil.getPrismContext());
+ PrismTestUtil.getPrismContext());
objectDelta2.addModification(delta2);
// WHEN
@@ -504,9 +458,6 @@ public void testSummarize02() throws Exception {
@Test
public void testSummarize05() throws Exception {
- final String TEST_NAME="testSummarize05";
- displayTestTitle(TEST_NAME);
-
// GIVEN
PrismPropertyDefinition propertyDefinition = getPrismContext().definitionFactory().createPropertyDefinition(UserType.F_DESCRIPTION,
DOMUtil.XSD_STRING);
@@ -515,14 +466,14 @@ public void testSummarize05() throws Exception {
// Let's complicate the things a bit with origin. This should work even though origins do not match.
delta1.addValueToAdd(new PrismPropertyValueImpl<>("add1", OriginType.OUTBOUND, null));
ObjectDelta objectDelta1 = new ObjectDeltaImpl<>(UserType.class, ChangeType.MODIFY,
- PrismTestUtil.getPrismContext());
+ PrismTestUtil.getPrismContext());
objectDelta1.addModification(delta1);
PropertyDelta delta2 = new PropertyDeltaImpl(propertyDefinition, PrismTestUtil.getPrismContext());
delta2.addRealValuesToAdd("add2");
delta2.addRealValuesToDelete("add1");
ObjectDelta objectDelta2 = new ObjectDeltaImpl<>(UserType.class, ChangeType.MODIFY,
- PrismTestUtil.getPrismContext());
+ PrismTestUtil.getPrismContext());
objectDelta2.addModification(delta2);
// WHEN
@@ -541,9 +492,6 @@ public void testSummarize05() throws Exception {
@Test
public void testSummarize06() throws Exception {
- final String TEST_NAME="testSummarize06";
- displayTestTitle(TEST_NAME);
-
// GIVEN
PrismReferenceDefinition referenceDefinition = new PrismReferenceDefinitionImpl(UserType.F_PARENT_ORG_REF,
OBJECT_REFERENCE_TYPE_QNAME, PrismTestUtil.getPrismContext());
@@ -551,13 +499,13 @@ public void testSummarize06() throws Exception {
ReferenceDelta delta1 = new ReferenceDeltaImpl(referenceDefinition, PrismTestUtil.getPrismContext());
delta1.addValueToAdd(new PrismReferenceValueImpl("oid1"));
ObjectDelta objectDelta1 = new ObjectDeltaImpl<>(UserType.class, ChangeType.MODIFY,
- PrismTestUtil.getPrismContext());
+ PrismTestUtil.getPrismContext());
objectDelta1.addModification(delta1);
ReferenceDelta delta2 = new ReferenceDeltaImpl(referenceDefinition, PrismTestUtil.getPrismContext());
delta2.addValueToAdd(new PrismReferenceValueImpl("oid1")); // here we add the same value
ObjectDelta objectDelta2 = new ObjectDeltaImpl<>(UserType.class, ChangeType.MODIFY,
- PrismTestUtil.getPrismContext());
+ PrismTestUtil.getPrismContext());
objectDelta2.addModification(delta2);
// WHEN
@@ -576,10 +524,7 @@ public void testSummarize06() throws Exception {
@Test
public void testAddPropertyMulti() throws Exception {
- final String TEST_NAME="testAddPropertyMulti";
- displayTestTitle(TEST_NAME);
// GIVEN
-
// User
PrismObject user = createUserFooPatlama();
@@ -601,10 +546,7 @@ public void testAddPropertyMulti() throws Exception {
@Test
public void testAddAssignmentSameNullIdApplyToObject() throws Exception {
- final String TEST_NAME="testAddAssignmentSameNullIdApplyToObject";
- displayTestTitle(TEST_NAME);
// GIVEN
-
// User
PrismObject user = createUserFooPatlama();
@@ -615,7 +557,7 @@ public void testAddAssignmentSameNullIdApplyToObject() throws Exception {
ObjectDelta userDelta = PrismTestUtil.getPrismContext().deltaFactory().object()
.createModificationAddContainer(UserType.class, USER_FOO_OID,
- UserType.F_ASSIGNMENT, assignmentValue);
+ UserType.F_ASSIGNMENT, assignmentValue);
// WHEN
userDelta.applyTo(user);
@@ -632,8 +574,6 @@ public void testAddAssignmentSameNullIdApplyToObject() throws Exception {
@Test
public void testAddAssignmentSameNullIdSwallow() throws Exception {
- final String TEST_NAME="testAddAssignmentSameNullIdSwallow";
- displayTestTitle(TEST_NAME);
// GIVEN
//Delta 1
@@ -643,7 +583,7 @@ public void testAddAssignmentSameNullIdSwallow() throws Exception {
ObjectDelta userDelta1 = PrismTestUtil.getPrismContext().deltaFactory().object()
.createModificationAddContainer(UserType.class, USER_FOO_OID,
- UserType.F_ASSIGNMENT, assignmentValue1);
+ UserType.F_ASSIGNMENT, assignmentValue1);
//Delta 2
PrismContainerValue assignmentValue2 = getPrismContext().itemFactory().createContainerValue();
@@ -674,8 +614,6 @@ public void testAddAssignmentSameNullIdSwallow() throws Exception {
@Test
public void testAddAssignmentDifferentNullIdSwallow() throws Exception {
- final String TEST_NAME="testAddAssignmentDifferentNullIdSwallow";
- displayTestTitle(TEST_NAME);
// GIVEN
//Delta 1
@@ -685,7 +623,7 @@ public void testAddAssignmentDifferentNullIdSwallow() throws Exception {
ObjectDelta userDelta1 = PrismTestUtil.getPrismContext().deltaFactory().object()
.createModificationAddContainer(UserType.class, USER_FOO_OID,
- UserType.F_ASSIGNMENT, assignmentValue1);
+ UserType.F_ASSIGNMENT, assignmentValue1);
//Delta 2
PrismContainerValue assignmentValue2 = getPrismContext().itemFactory().createContainerValue();
@@ -708,14 +646,12 @@ public void testAddAssignmentDifferentNullIdSwallow() throws Exception {
PrismAsserts.assertNoReplace(containerDeltaAfter);
Collection> valuesToAdd = containerDeltaAfter.getValuesToAdd();
assertEquals("Unexpected number of values to add", 2, valuesToAdd.size());
- assertTrue("Value "+assignmentValue1+" missing ", valuesToAdd.contains(assignmentValue1));
- assertTrue("Value "+assignmentValue2+" missing ", valuesToAdd.contains(assignmentValue2));
+ assertTrue("Value " + assignmentValue1 + " missing ", valuesToAdd.contains(assignmentValue1));
+ assertTrue("Value " + assignmentValue2 + " missing ", valuesToAdd.contains(assignmentValue2));
}
@Test
public void testAddAssignmentDifferentFirstIdSwallow() throws Exception {
- final String TEST_NAME="testAddAssignmentDifferentFirstIdSwallow";
- displayTestTitle(TEST_NAME);
// GIVEN
//Delta 1
@@ -725,7 +661,7 @@ public void testAddAssignmentDifferentFirstIdSwallow() throws Exception {
ObjectDelta userDelta1 = PrismTestUtil.getPrismContext().deltaFactory().object()
.createModificationAddContainer(UserType.class, USER_FOO_OID,
- UserType.F_ASSIGNMENT, assignmentValue1);
+ UserType.F_ASSIGNMENT, assignmentValue1);
//Delta 2
PrismContainerValue assignmentValue2 = getPrismContext().itemFactory().createContainerValue();
@@ -747,14 +683,12 @@ public void testAddAssignmentDifferentFirstIdSwallow() throws Exception {
PrismAsserts.assertNoReplace(containerDeltaAfter);
Collection> valuesToAdd = containerDeltaAfter.getValuesToAdd();
assertEquals("Unexpected number of values to add", 2, valuesToAdd.size());
- assertTrue("Value "+assignmentValue1+" missing ", valuesToAdd.contains(assignmentValue1));
- assertTrue("Value "+assignmentValue2+" missing ", valuesToAdd.contains(assignmentValue2));
+ assertTrue("Value " + assignmentValue1 + " missing ", valuesToAdd.contains(assignmentValue1));
+ assertTrue("Value " + assignmentValue2 + " missing ", valuesToAdd.contains(assignmentValue2));
}
@Test
public void testAddAssignmentDifferentSecondIdSwallow() throws Exception {
- final String TEST_NAME="testAddAssignmentDifferentSecondIdSwallow";
- displayTestTitle(TEST_NAME);
// GIVEN
//Delta 1
@@ -764,13 +698,13 @@ public void testAddAssignmentDifferentSecondIdSwallow() throws Exception {
ObjectDelta userDelta1 = PrismTestUtil.getPrismContext().deltaFactory().object()
.createModificationAddContainer(UserType.class, USER_FOO_OID,
- UserType.F_ASSIGNMENT, assignmentValue1);
+ UserType.F_ASSIGNMENT, assignmentValue1);
//Delta 2
PrismContainerValue assignmentValue2 = getPrismContext().itemFactory().createContainerValue();
assignmentValue2.setId(USER_ASSIGNMENT_2_ID);
assignmentValue2.setPropertyRealValue(AssignmentType.F_DESCRIPTION, ASSIGNMENT_ABRAKADABRA_DESCRIPTION, PrismTestUtil.getPrismContext());
- ContainerDelta containerDelta2 = ContainerDeltaImpl.createDelta(UserType.F_ASSIGNMENT,getUserTypeDefinition());
+ ContainerDelta containerDelta2 = ContainerDeltaImpl.createDelta(UserType.F_ASSIGNMENT, getUserTypeDefinition());
containerDelta2.addValueToAdd(assignmentValue2);
// WHEN
@@ -786,14 +720,12 @@ public void testAddAssignmentDifferentSecondIdSwallow() throws Exception {
PrismAsserts.assertNoReplace(containerDeltaAfter);
Collection> valuesToAdd = containerDeltaAfter.getValuesToAdd();
assertEquals("Unexpected number of values to add", 2, valuesToAdd.size());
- assertTrue("Value "+assignmentValue1+" missing ", valuesToAdd.contains(assignmentValue1));
- assertTrue("Value "+assignmentValue2+" missing ", valuesToAdd.contains(assignmentValue2));
+ assertTrue("Value " + assignmentValue1 + " missing ", valuesToAdd.contains(assignmentValue1));
+ assertTrue("Value " + assignmentValue2 + " missing ", valuesToAdd.contains(assignmentValue2));
}
@Test
public void testAddAssignmentDifferentTwoIdsSwallow() throws Exception {
- final String TEST_NAME="testAddAssignmentDifferentTwoIdsSwallow";
- displayTestTitle(TEST_NAME);
// GIVEN
//Delta 1
@@ -803,13 +735,13 @@ public void testAddAssignmentDifferentTwoIdsSwallow() throws Exception {
ObjectDelta userDelta1 = PrismTestUtil.getPrismContext().deltaFactory().object()
.createModificationAddContainer(UserType.class, USER_FOO_OID,
- UserType.F_ASSIGNMENT, assignmentValue1);
+ UserType.F_ASSIGNMENT, assignmentValue1);
//Delta 2
PrismContainerValue assignmentValue2 = getPrismContext().itemFactory().createContainerValue();
assignmentValue2.setId(USER_ASSIGNMENT_2_ID);
assignmentValue2.setPropertyRealValue(AssignmentType.F_DESCRIPTION, ASSIGNMENT_ABRAKADABRA_DESCRIPTION, PrismTestUtil.getPrismContext());
- ContainerDelta containerDelta2 = ContainerDeltaImpl.createDelta(UserType.F_ASSIGNMENT,getUserTypeDefinition());
+ ContainerDelta containerDelta2 = ContainerDeltaImpl.createDelta(UserType.F_ASSIGNMENT, getUserTypeDefinition());
containerDelta2.addValueToAdd(assignmentValue2);
// WHEN
@@ -825,14 +757,12 @@ public void testAddAssignmentDifferentTwoIdsSwallow() throws Exception {
PrismAsserts.assertNoReplace(containerDeltaAfter);
Collection> valuesToAdd = containerDeltaAfter.getValuesToAdd();
assertEquals("Unexpected number of values to add", 2, valuesToAdd.size());
- assertTrue("Value "+assignmentValue1+" missing ", valuesToAdd.contains(assignmentValue1));
- assertTrue("Value "+assignmentValue2+" missing ", valuesToAdd.contains(assignmentValue2));
+ assertTrue("Value " + assignmentValue1 + " missing ", valuesToAdd.contains(assignmentValue1));
+ assertTrue("Value " + assignmentValue2 + " missing ", valuesToAdd.contains(assignmentValue2));
}
@Test
public void testAddAssignmentDifferentIdSameSwallow() throws Exception {
- final String TEST_NAME="testAddAssignmentDifferentIdSameSwallow";
- displayTestTitle(TEST_NAME);
// GIVEN
//Delta 1
@@ -842,13 +772,13 @@ public void testAddAssignmentDifferentIdSameSwallow() throws Exception {
ObjectDelta userDelta1 = PrismTestUtil.getPrismContext().deltaFactory().object()
.createModificationAddContainer(UserType.class, USER_FOO_OID,
- UserType.F_ASSIGNMENT, assignmentValue1);
+ UserType.F_ASSIGNMENT, assignmentValue1);
//Delta 2
PrismContainerValue assignmentValue2 = getPrismContext().itemFactory().createContainerValue();
assignmentValue2.setId(USER_ASSIGNMENT_1_ID);
assignmentValue2.setPropertyRealValue(AssignmentType.F_DESCRIPTION, ASSIGNMENT_PATLAMA_DESCRIPTION, PrismTestUtil.getPrismContext());
- ContainerDelta containerDelta2 = ContainerDeltaImpl.createDelta(UserType.F_ASSIGNMENT,getUserTypeDefinition());
+ ContainerDelta containerDelta2 = ContainerDeltaImpl.createDelta(UserType.F_ASSIGNMENT, getUserTypeDefinition());
containerDelta2.addValueToAdd(assignmentValue2);
// WHEN
@@ -864,14 +794,12 @@ public void testAddAssignmentDifferentIdSameSwallow() throws Exception {
PrismAsserts.assertNoReplace(containerDeltaAfter);
Collection> valuesToAdd = containerDeltaAfter.getValuesToAdd();
assertEquals("Unexpected number of values to add", 1, valuesToAdd.size());
- assertTrue("Value "+assignmentValue1+" missing ", valuesToAdd.contains(assignmentValue1));
+ assertTrue("Value " + assignmentValue1 + " missing ", valuesToAdd.contains(assignmentValue1));
}
// MID-1296
- @Test(enabled=false)
+ @Test(enabled = false)
public void testAddAssignmentDifferentIdConflictSwallow() throws Exception {
- final String TEST_NAME="testAddAssignmentDifferentIdConflictSwallow";
- displayTestTitle(TEST_NAME);
// GIVEN
//Delta 1
@@ -881,7 +809,7 @@ public void testAddAssignmentDifferentIdConflictSwallow() throws Exception {
ObjectDelta userDelta1 = PrismTestUtil.getPrismContext().deltaFactory().object()
.createModificationAddContainer(UserType.class, USER_FOO_OID,
- UserType.F_ASSIGNMENT, assignmentValue1);
+ UserType.F_ASSIGNMENT, assignmentValue1);
//Delta 2
PrismContainerValue assignmentValue2 = getPrismContext().itemFactory().createContainerValue();
@@ -898,8 +826,6 @@ public void testAddAssignmentDifferentIdConflictSwallow() throws Exception {
@Test
public void testAddDeltaAddAssignmentDifferentNoIdSwallow() throws Exception {
- final String TEST_NAME="testAddDeltaAddAssignmentDifferentNoIdSwallow";
- displayTestTitle(TEST_NAME);
// GIVEN
//Delta 1
@@ -910,7 +836,7 @@ public void testAddDeltaAddAssignmentDifferentNoIdSwallow() throws Exception {
PrismContainerValue assignmentValue2 = getPrismContext().itemFactory().createContainerValue();
// null container ID
assignmentValue2.setPropertyRealValue(AssignmentType.F_DESCRIPTION, ASSIGNMENT_ABRAKADABRA_DESCRIPTION, PrismTestUtil.getPrismContext());
- ContainerDelta containerDelta2 = ContainerDeltaImpl.createDelta(UserType.F_ASSIGNMENT,getUserTypeDefinition());
+ ContainerDelta containerDelta2 = ContainerDeltaImpl.createDelta(UserType.F_ASSIGNMENT, getUserTypeDefinition());
containerDelta2.addValueToAdd(assignmentValue2);
// WHEN
@@ -927,16 +853,14 @@ public void testAddDeltaAddAssignmentDifferentNoIdSwallow() throws Exception {
Collection> valuesToAdd = containerDeltaAfter.getValuesToAdd();
assertEquals("Unexpected number of values to add", 2, valuesToAdd.size());
PrismContainer user1AssignmentCont = user.findContainer(UserType.F_ASSIGNMENT);
- for (PrismContainerValue cval: user1AssignmentCont.getValues()) {
- assertTrue("Value "+cval+" missing ", valuesToAdd.contains(cval));
+ for (PrismContainerValue cval : user1AssignmentCont.getValues()) {
+ assertTrue("Value " + cval + " missing ", valuesToAdd.contains(cval));
}
- assertTrue("Value "+assignmentValue2+" missing ", valuesToAdd.contains(assignmentValue2));
+ assertTrue("Value " + assignmentValue2 + " missing ", valuesToAdd.contains(assignmentValue2));
}
@Test
public void testAddDeltaNoAssignmentAddAssignmentDifferentNoIdSwallow() throws Exception {
- final String TEST_NAME="testAddDeltaNoAssignmentAddAssignmentDifferentNoIdSwallow";
- displayTestTitle(TEST_NAME);
// GIVEN
//Delta 1
@@ -947,7 +871,7 @@ public void testAddDeltaNoAssignmentAddAssignmentDifferentNoIdSwallow() throws E
PrismContainerValue assignmentValue2 = getPrismContext().itemFactory().createContainerValue();
// null container ID
assignmentValue2.setPropertyRealValue(AssignmentType.F_DESCRIPTION, ASSIGNMENT_ABRAKADABRA_DESCRIPTION, PrismTestUtil.getPrismContext());
- ContainerDelta containerDelta2 = ContainerDeltaImpl.createDelta(UserType.F_ASSIGNMENT,getUserTypeDefinition());
+ ContainerDelta containerDelta2 = ContainerDeltaImpl.createDelta(UserType.F_ASSIGNMENT, getUserTypeDefinition());
containerDelta2.addValueToAdd(assignmentValue2);
// WHEN
@@ -963,13 +887,11 @@ public void testAddDeltaNoAssignmentAddAssignmentDifferentNoIdSwallow() throws E
PrismAsserts.assertNoReplace(containerDeltaAfter);
Collection> valuesToAdd = containerDeltaAfter.getValuesToAdd();
assertEquals("Unexpected number of values to add", 1, valuesToAdd.size());
- assertTrue("Value "+assignmentValue2+" missing ", valuesToAdd.contains(assignmentValue2));
+ assertTrue("Value " + assignmentValue2 + " missing ", valuesToAdd.contains(assignmentValue2));
}
@Test
public void testAddDeltaNoAssignmentAddAssignmentDifferentIdSwallow() throws Exception {
- final String TEST_NAME="testAddDeltaNoAssignmentAddAssignmentDifferentIdSwallow";
- displayTestTitle(TEST_NAME);
// GIVEN
//Delta 1
@@ -980,7 +902,7 @@ public void testAddDeltaNoAssignmentAddAssignmentDifferentIdSwallow() throws Exc
PrismContainerValue assignmentValue2 = getPrismContext().itemFactory().createContainerValue();
assignmentValue2.setId(USER_ASSIGNMENT_2_ID);
assignmentValue2.setPropertyRealValue(AssignmentType.F_DESCRIPTION, ASSIGNMENT_ABRAKADABRA_DESCRIPTION, PrismTestUtil.getPrismContext());
- ContainerDelta containerDelta2 = ContainerDeltaImpl.createDelta(UserType.F_ASSIGNMENT,getUserTypeDefinition());
+ ContainerDelta containerDelta2 = ContainerDeltaImpl.createDelta(UserType.F_ASSIGNMENT, getUserTypeDefinition());
containerDelta2.addValueToAdd(assignmentValue2);
// WHEN
@@ -996,13 +918,11 @@ public void testAddDeltaNoAssignmentAddAssignmentDifferentIdSwallow() throws Exc
PrismAsserts.assertNoReplace(containerDeltaAfter);
Collection> valuesToAdd = containerDeltaAfter.getValuesToAdd();
assertEquals("Unexpected number of values to add", 1, valuesToAdd.size());
- assertTrue("Value "+assignmentValue2+" missing ", valuesToAdd.contains(assignmentValue2));
+ assertTrue("Value " + assignmentValue2 + " missing ", valuesToAdd.contains(assignmentValue2));
}
@Test
public void testAddAssignmentActivationDifferentNullIdApplyToObject() throws Exception {
- final String TEST_NAME="testAddAssignmentActivationDifferentNullIdApplyToObject";
- displayTestTitle(TEST_NAME);
// GIVEN
// User
@@ -1015,10 +935,10 @@ public void testAddAssignmentActivationDifferentNullIdApplyToObject() throws Exc
ObjectDelta userDelta = PrismTestUtil.getPrismContext().deltaFactory().object()
.createModificationAddContainer(UserType.class, USER_FOO_OID,
- ItemPath.create(UserType.F_ASSIGNMENT,
- // We really need ID here. Otherwise it would not be clear to which assignment to add
- 123L,
- AssignmentType.F_ACTIVATION),
+ ItemPath.create(UserType.F_ASSIGNMENT,
+ // We really need ID here. Otherwise it would not be clear to which assignment to add
+ 123L,
+ AssignmentType.F_ACTIVATION),
activationValue);
// WHEN
@@ -1038,14 +958,12 @@ public void testAddAssignmentActivationDifferentNullIdApplyToObject() throws Exc
@Test
public void testObjectDeltaApplyToAdd() throws Exception {
- final String TEST_NAME="testObjectDeltaApplyToAdd";
- displayTestTitle(TEST_NAME);
// GIVEN
PrismObject user = PrismTestUtil.parseObject(USER_JACK_FILE_XML);
//Delta
ObjectDelta userDelta = PrismTestUtil.getPrismContext().deltaFactory().object()
.createModificationAddProperty(UserType.class, USER_FOO_OID,
- UserType.F_LOCALITY, "Caribbean");
+ UserType.F_LOCALITY, "Caribbean");
// WHEN
userDelta.applyTo(user);
@@ -1058,14 +976,12 @@ public void testObjectDeltaApplyToAdd() throws Exception {
@Test
public void testObjectDeltaApplyToDelete() throws Exception {
- final String TEST_NAME="testObjectDeltaApplyToDelete";
- displayTestTitle(TEST_NAME);
// GIVEN
PrismObject user = PrismTestUtil.parseObject(USER_JACK_FILE_XML);
//Delta
ObjectDelta userDelta = PrismTestUtil.getPrismContext().deltaFactory().object()
.createModificationDeleteProperty(UserType.class, USER_FOO_OID,
- UserType.F_ADDITIONAL_NAMES, "Jackie");
+ UserType.F_ADDITIONAL_NAMES, "Jackie");
// WHEN
userDelta.applyTo(user);
@@ -1078,14 +994,12 @@ public void testObjectDeltaApplyToDelete() throws Exception {
@Test
public void testObjectDeltaApplyToReplace() throws Exception {
- final String TEST_NAME="testObjectDeltaApplyToReplace";
- displayTestTitle(TEST_NAME);
// GIVEN
PrismObject user = PrismTestUtil.parseObject(USER_JACK_FILE_XML);
//Delta
ObjectDelta userDelta = PrismTestUtil.getPrismContext().deltaFactory().object()
.createModificationReplaceProperty(UserType.class, USER_FOO_OID,
- UserType.F_ADDITIONAL_NAMES, "Cpt");
+ UserType.F_ADDITIONAL_NAMES, "Cpt");
// WHEN
userDelta.applyTo(user);
@@ -1098,14 +1012,12 @@ public void testObjectDeltaApplyToReplace() throws Exception {
@Test
public void testObjectDeltaApplyToReplaceEmpty() throws Exception {
- final String TEST_NAME="testObjectDeltaApplyToReplaceEmpty";
- displayTestTitle(TEST_NAME);
// GIVEN
PrismObject user = PrismTestUtil.parseObject(USER_JACK_FILE_XML);
//Delta
ObjectDelta userDelta = PrismTestUtil.getPrismContext().deltaFactory().object()
.createModificationReplaceProperty(UserType.class, USER_FOO_OID,
- UserType.F_ADDITIONAL_NAMES);
+ UserType.F_ADDITIONAL_NAMES);
// WHEN
userDelta.applyTo(user);
@@ -1118,8 +1030,6 @@ public void testObjectDeltaApplyToReplaceEmpty() throws Exception {
@Test
public void testObjectDeltaFindItemDeltaModifyProperty() throws Exception {
- final String TEST_NAME="testObjectDeltaFindItemDeltaModifyProperty";
- displayTestTitle(TEST_NAME);
// GIVEN
ObjectDelta userDelta = createDeltaForFindItem(false);
@@ -1131,17 +1041,15 @@ public void testObjectDeltaFindItemDeltaModifyProperty() throws Exception {
// THEN
PrismAsserts.assertInstanceOf(PropertyDelta.class, itemDelta);
PrismAsserts.assertPathEquivalent("paths are different", itemDeltaPath, itemDelta.getPath());
- PrismAsserts.assertPropertyValues("Wrong replace values in "+itemDelta,
- ((PropertyDelta)itemDelta).getValuesToReplace(), "Guybrush");
+ PrismAsserts.assertPropertyValues("Wrong replace values in " + itemDelta,
+ ((PropertyDelta) itemDelta).getValuesToReplace(), "Guybrush");
}
@Test
public void testObjectDeltaFindItemDeltaModifyPropertyInAddedContainer() throws Exception {
- final String TEST_NAME="testObjectDeltaFindItemDeltaModifyPropertyInAddedContainer";
- displayTestTitle(TEST_NAME);
// GIVEN
ObjectDelta userDelta = createDeltaForFindItem(false);
- System.out.println("Object delta:\n"+userDelta.debugDump());
+ System.out.println("Object delta:\n" + userDelta.debugDump());
ItemPath itemDeltaPath = ItemPath.create(UserType.F_ACTIVATION, ActivationType.F_ENABLED);
@@ -1149,20 +1057,18 @@ public void testObjectDeltaFindItemDeltaModifyPropertyInAddedContainer() throws
ItemDelta itemDelta = userDelta.findItemDelta(itemDeltaPath);
// THEN
- System.out.println("Item delta:\n"+(itemDelta==null?"null":itemDelta.debugDump()));
+ System.out.println("Item delta:\n" + (itemDelta == null ? "null" : itemDelta.debugDump()));
PrismAsserts.assertInstanceOf(PropertyDelta.class, itemDelta);
assertEquals(itemDeltaPath, itemDelta.getPath());
- PrismAsserts.assertPropertyValues("Wrong add values in "+itemDelta,
- ((PropertyDelta)itemDelta).getValuesToAdd(), Boolean.TRUE);
+ PrismAsserts.assertPropertyValues("Wrong add values in " + itemDelta,
+ ((PropertyDelta) itemDelta).getValuesToAdd(), Boolean.TRUE);
}
@Test
public void testObjectDeltaFindItemDeltaModifyNonExistentPropertyInAddedContainer() throws Exception {
- final String TEST_NAME="testObjectDeltaFindItemDeltaModifyNonExistentPropertyInAddedContainer";
- displayTestTitle(TEST_NAME);
// GIVEN
ObjectDelta userDelta = createDeltaForFindItem(false);
- System.out.println("Object delta:\n"+userDelta.debugDump());
+ System.out.println("Object delta:\n" + userDelta.debugDump());
ItemPath itemDeltaPath = ItemPath.create(UserType.F_ACTIVATION, ActivationType.F_VALID_TO); // not present in the delta
@@ -1170,17 +1076,15 @@ public void testObjectDeltaFindItemDeltaModifyNonExistentPropertyInAddedContaine
ItemDelta itemDelta = userDelta.findItemDelta(itemDeltaPath);
// THEN
- System.out.println("Item delta:\n"+(itemDelta==null?"null":itemDelta.debugDump()));
+ System.out.println("Item delta:\n" + (itemDelta == null ? "null" : itemDelta.debugDump()));
assertNull("Found delta even if it shouldn't", itemDelta);
}
@Test
public void testObjectDeltaFindItemDeltaModifyPropertyInReplacedContainer() throws Exception {
- final String TEST_NAME="testObjectDeltaFindItemDeltaModifyPropertyInReplacedContainer";
- displayTestTitle(TEST_NAME);
// GIVEN
ObjectDelta userDelta = createDeltaForFindItem(true);
- System.out.println("Object delta:\n"+userDelta.debugDump());
+ System.out.println("Object delta:\n" + userDelta.debugDump());
ItemPath itemDeltaPath = ItemPath.create(UserType.F_ACTIVATION, ActivationType.F_ENABLED);
@@ -1188,7 +1092,7 @@ public void testObjectDeltaFindItemDeltaModifyPropertyInReplacedContainer() thro
ItemDelta itemDelta = userDelta.findItemDelta(itemDeltaPath);
// THEN
- System.out.println("Item delta:\n"+(itemDelta==null?"null":itemDelta.debugDump()));
+ System.out.println("Item delta:\n" + (itemDelta == null ? "null" : itemDelta.debugDump()));
PrismAsserts.assertInstanceOf(PropertyDelta.class, itemDelta);
assertEquals(itemDeltaPath, itemDelta.getPath());
// TODO
@@ -1204,11 +1108,9 @@ public void testObjectDeltaFindItemDeltaModifyPropertyInReplacedContainer() thro
@Test // MID-4689
public void testObjectDeltaFindItemDeltaModifyNonExistentPropertyInReplacedContainer() throws Exception {
- final String TEST_NAME="testObjectDeltaFindItemDeltaModifyNonExistentPropertyInReplacedContainer";
- displayTestTitle(TEST_NAME);
// GIVEN
ObjectDelta userDelta = createDeltaForFindItem(true);
- System.out.println("Object delta:\n"+userDelta.debugDump());
+ System.out.println("Object delta:\n" + userDelta.debugDump());
ItemPath itemDeltaPath = ItemPath.create(UserType.F_ACTIVATION, ActivationType.F_VALID_TO); // not present in the delta
@@ -1216,14 +1118,14 @@ public void testObjectDeltaFindItemDeltaModifyNonExistentPropertyInReplacedConta
ItemDelta itemDelta = userDelta.findItemDelta(itemDeltaPath);
// THEN
- System.out.println("Item delta:\n"+(itemDelta==null?"null":itemDelta.debugDump()));
+ System.out.println("Item delta:\n" + (itemDelta == null ? "null" : itemDelta.debugDump()));
assertNull("Found delta even if it shouldn't", itemDelta);
}
private ObjectDelta createDeltaForFindItem(boolean containerReplace) throws SchemaException {
ObjectDelta userDelta = PrismTestUtil.getPrismContext().deltaFactory().object()
.createModificationAddProperty(UserType.class, USER_FOO_OID,
- UserType.F_LOCALITY, "Caribbean");
+ UserType.F_LOCALITY, "Caribbean");
userDelta.addModificationReplaceProperty(UserType.F_GIVEN_NAME, "Guybrush");
ContainerDelta activationDelta = userDelta.createContainerModification(UserType.F_ACTIVATION);
@@ -1250,17 +1152,15 @@ private ObjectDelta createDeltaForFindItem(boolean containerReplace) t
*/
@Test
public void testObjectDeltaUnion01Simple() throws Exception {
- final String TEST_NAME="testObjectDeltaUnion01Simple";
- displayTestTitle(TEST_NAME);
// GIVEN
//Delta
ObjectDelta userDelta1 = PrismTestUtil.getPrismContext().deltaFactory().object()
.createModificationAddProperty(UserType.class, USER_FOO_OID,
- UserType.F_FULL_NAME, PrismTestUtil.createPolyString("baz"));
+ UserType.F_FULL_NAME, PrismTestUtil.createPolyString("baz"));
ObjectDelta userDelta2 = PrismTestUtil.getPrismContext().deltaFactory().object()
.createModificationAddProperty(UserType.class, USER_FOO_OID,
- UserType.F_FULL_NAME, PrismTestUtil.createPolyString("baz"));
+ UserType.F_FULL_NAME, PrismTestUtil.createPolyString("baz"));
// WHEN
ObjectDelta userDeltaUnion = ObjectDeltaCollectionsUtil.union(userDelta1, userDelta2);
@@ -1274,14 +1174,11 @@ public void testObjectDeltaUnion01Simple() throws Exception {
*/
@Test
public void testObjectDeltaUnion01Metadata() throws Exception {
- final String TEST_NAME="testObjectDeltaUnion01Metadata";
- displayTestTitle(TEST_NAME);
// GIVEN
ObjectDelta userDelta1 = PrismTestUtil.getPrismContext().deltaFactory().object()
.createModificationAddProperty(UserType.class, USER_FOO_OID,
- UserType.F_FULL_NAME, PrismTestUtil.createPolyString("baz"));
-
+ UserType.F_FULL_NAME, PrismTestUtil.createPolyString("baz"));
PropertyDelta