use of com.evolveum.midpoint.prism.path.ItemPath in project midpoint by Evolveum.
the class TestFind method testFindString.
@Test
public void testFindString() throws SchemaException, SAXException, IOException {
final String TEST_NAME = "testFindString";
System.out.println("===[ " + TEST_NAME + " ]===");
// GIVEN
PrismObject<UserType> user = createUser();
ItemPath path = new ItemPath(UserType.F_DESCRIPTION);
// WHEN
PrismProperty<String> nameProperty = findProperty(user, path);
// THEN
assertEquals("Wrong property value (path=" + path + ")", USER_JACK_DESCRIPTION, nameProperty.getRealValue());
assertTrue("QName found something other", nameProperty == (PrismProperty) user.findProperty(UserType.F_DESCRIPTION));
}
use of com.evolveum.midpoint.prism.path.ItemPath in project midpoint by Evolveum.
the class TestFind method testFindExtensionBar.
@Test
public void testFindExtensionBar() throws SchemaException, SAXException, IOException {
final String TEST_NAME = "testFindExtensionBar";
System.out.println("===[ " + TEST_NAME + " ]===");
// GIVEN
ItemPath path = new ItemPath(UserType.F_EXTENSION, EXTENSION_BAR_ELEMENT);
// WHEN
PrismProperty<String> property = findUserProperty(path);
// THEN
assertEquals("Wrong property value (path=" + path + ")", "BAR", property.getAnyRealValue());
}
use of com.evolveum.midpoint.prism.path.ItemPath in project midpoint by Evolveum.
the class TestFind method testFindAssignment.
@Test
public void testFindAssignment() throws SchemaException, SAXException, IOException {
final String TEST_NAME = "testFindAssignment";
System.out.println("===[ " + TEST_NAME + " ]===");
// GIVEN
ItemPath path = new ItemPath(new NameItemPathSegment(UserType.F_ASSIGNMENT));
// WHEN
PrismContainer<AssignmentType> container = findUserContainer(path);
// THEN
PrismContainerValue<AssignmentType> value2 = container.getValue(USER_ASSIGNMENT_2_ID);
assertEquals("Wrong value2 description (path=" + path + ")", "Assignment 2", value2.findProperty(AssignmentType.F_DESCRIPTION).getRealValue());
}
use of com.evolveum.midpoint.prism.path.ItemPath in project midpoint by Evolveum.
the class TestFind method testFindPolyString.
@Test
public void testFindPolyString() throws SchemaException, SAXException, IOException {
final String TEST_NAME = "testFindPolyString";
System.out.println("===[ " + TEST_NAME + " ]===");
// GIVEN
PrismObject<UserType> user = createUser();
ItemPath path = new ItemPath(UserType.F_POLY_NAME);
// WHEN
PrismProperty<PolyString> nameProperty = findProperty(user, path);
// THEN
assertEquals("Wrong property value (path=" + path + ")", PrismTestUtil.createPolyString(USER_JACK_POLYNAME_ORIG), nameProperty.getRealValue());
assertTrue("QName found something other", nameProperty == (PrismProperty) user.findProperty(UserType.F_POLY_NAME));
}
use of com.evolveum.midpoint.prism.path.ItemPath in project midpoint by Evolveum.
the class TestPath method testPathNormalize.
@Test
public void testPathNormalize() throws Exception {
System.out.println("\n\n===[ testPathNormalize ]===\n");
// GIVEN
ItemPath path1 = new ItemPath(new QName(NS, "foo"), new QName(NS, "bar"));
ItemPath path2 = new ItemPath(new NameItemPathSegment(new QName(NS, "foo")), new IdItemPathSegment(123L), new NameItemPathSegment(new QName(NS, "bar")));
ItemPath path22 = new ItemPath(new NameItemPathSegment(new QName(NS, "foo")), new IdItemPathSegment(123L), new NameItemPathSegment(new QName(NS, "bar")), new IdItemPathSegment(null));
ItemPath path3 = new ItemPath(new NameItemPathSegment(new QName(NS, "foo")), new IdItemPathSegment(123L), new NameItemPathSegment(new QName(NS, "bar")), new IdItemPathSegment(333L));
ItemPath path4 = new ItemPath(new QName(NS, "x"));
ItemPath path5 = new ItemPath(new NameItemPathSegment(new QName(NS, "foo")), new IdItemPathSegment(123L));
ItemPath pathE = new ItemPath();
// WHEN
ItemPath normalized1 = path1.normalize();
ItemPath normalized2 = path2.normalize();
ItemPath normalized22 = path22.normalize();
ItemPath normalized3 = path3.normalize();
ItemPath normalized4 = path4.normalize();
ItemPath normalized5 = path5.normalize();
ItemPath normalizedE = pathE.normalize();
// THEN
System.out.println("Normalized path 1:" + normalized1);
System.out.println("Normalized path 2:" + normalized2);
System.out.println("Normalized path 22:" + normalized22);
System.out.println("Normalized path 3:" + normalized3);
System.out.println("Normalized path 4:" + normalized4);
System.out.println("Normalized path 5:" + normalized5);
System.out.println("Normalized path E:" + normalizedE);
assertNormalizedPath(normalized1, "foo", null, "bar");
assertNormalizedPath(normalized2, "foo", 123L, "bar");
assertNormalizedPath(normalized22, "foo", 123L, "bar", null);
assertNormalizedPath(normalized3, "foo", 123L, "bar", 333L);
assertNormalizedPath(normalized4, "x");
assertNormalizedPath(normalized5, "foo", 123L);
assert normalizedE.isEmpty() : "normalizedE is not empty";
}
Aggregations