use of com.evolveum.midpoint.model.common.expression.functions.BasicExpressionFunctions in project midpoint by Evolveum.
the class TestExpressionFunctions method testParseDateTime.
@Test
public void testParseDateTime() throws Exception {
final String TEST_NAME = "testParseDateTime";
TestUtil.displayTestTile(TEST_NAME);
// GIVEN
BasicExpressionFunctions f = createBasicFunctions();
// WHEN
XMLGregorianCalendar resultValue = f.parseDateTime("yyyy MM dd HH:mm:ss.SSS zzzz", "1975 05 30 22:30:00.000 Central European Time");
// THEN
assertNotNull("Result value is null", resultValue);
System.out.println("Resulting value: " + resultValue);
XMLGregorianCalendar xmlCal = XmlTypeConverter.createXMLGregorianCalendar(1975, 5, 30, 21, 30, 0);
assertEquals("Wrong result value", xmlCal, resultValue);
}
use of com.evolveum.midpoint.model.common.expression.functions.BasicExpressionFunctions in project midpoint by Evolveum.
the class TestExpressionFunctions method testGetExtensionPropertyValueNotPresent.
@Test
public void testGetExtensionPropertyValueNotPresent() throws Exception {
final String TEST_NAME = "testGetExtensionPropertyValueNotPresent";
TestUtil.displayTestTile(TEST_NAME);
// GIVEN
BasicExpressionFunctions f = createBasicFunctions();
PrismObject<UserType> userJack = PrismTestUtil.parseObject(USER_JACK_FILE);
// WHEN
String extensionVal = f.getExtensionPropertyValue(userJack.asObjectable(), new QName(SchemaTestConstants.NS_EXTENSION, "kajdsfhklfdsjh"));
// THEN
assertNull("Unexpected value for extension " + SchemaTestConstants.EXTENSION_SHIP_ELEMENT + ": " + extensionVal, extensionVal);
}
use of com.evolveum.midpoint.model.common.expression.functions.BasicExpressionFunctions in project midpoint by Evolveum.
the class TestExpressionFunctions method testToAscii.
@Test
public void testToAscii() throws Exception {
final String TEST_NAME = "testToAscii";
TestUtil.displayTestTile(TEST_NAME);
BasicExpressionFunctions basic = createBasicFunctions();
assertEquals("foo", basic.toAscii("foo"));
assertEquals("foo", basic.toAscii(poly("foo")));
assertEquals("foo", basic.toAscii(PrismTestUtil.createPolyStringType("foo")));
assertEquals("Cortuv hrad, tam Strasa!", basic.toAscii("Čórtův hrád, tam Strašá!"));
assertEquals("hrabe Teleke z Toloko", basic.toAscii(poly("hrabě Teleke z Tölökö")));
assertEquals("Vedeckotechnicka revoluce neni zadna idyla!", basic.toAscii(PrismTestUtil.createPolyStringType("Vědeckotechnická revoluce není žádná idyla!")));
assertEquals(null, basic.toAscii(null));
assertEquals("", basic.toAscii(""));
}
use of com.evolveum.midpoint.model.common.expression.functions.BasicExpressionFunctions in project midpoint by Evolveum.
the class TestExpressionFunctions method testGetExtensionPropertyValue.
@Test
public void testGetExtensionPropertyValue() throws Exception {
final String TEST_NAME = "testGetExtensionPropertyValue";
TestUtil.displayTestTile(TEST_NAME);
// GIVEN
BasicExpressionFunctions f = createBasicFunctions();
PrismObject<UserType> userJack = PrismTestUtil.parseObject(USER_JACK_FILE);
// WHEN
String shipExtension = f.getExtensionPropertyValue(userJack.asObjectable(), SchemaTestConstants.EXTENSION_SHIP_ELEMENT);
// THEN
assertEquals("Wrong value for extension " + SchemaTestConstants.EXTENSION_SHIP_ELEMENT, "Black Pearl", shipExtension);
}
use of com.evolveum.midpoint.model.common.expression.functions.BasicExpressionFunctions in project midpoint by Evolveum.
the class TestExpressionFunctions method testGetExtensionPropertyValueParts.
@Test
public void testGetExtensionPropertyValueParts() throws Exception {
final String TEST_NAME = "testGetExtensionPropertyValueParts";
TestUtil.displayTestTile(TEST_NAME);
// GIVEN
BasicExpressionFunctions f = createBasicFunctions();
PrismObject<UserType> userJack = PrismTestUtil.parseObject(USER_JACK_FILE);
// WHEN
String shipExtension = f.getExtensionPropertyValue(userJack.asObjectable(), SchemaTestConstants.EXTENSION_SHIP_ELEMENT.getNamespaceURI(), SchemaTestConstants.EXTENSION_SHIP_ELEMENT.getLocalPart());
// THEN
assertEquals("Wrong value for extension " + SchemaTestConstants.EXTENSION_SHIP_ELEMENT, "Black Pearl", shipExtension);
}
Aggregations