use of com.evolveum.midpoint.model.common.expression.functions.BasicExpressionFunctions in project midpoint by Evolveum.
the class TestExpressionFunctions method testGetAttributeValueParts.
@Test
public void testGetAttributeValueParts() throws Exception {
final String TEST_NAME = "testGetAttributeValueParts";
TestUtil.displayTestTile(TEST_NAME);
// GIVEN
BasicExpressionFunctions f = createBasicFunctions();
PrismObject<ShadowType> accountJack = PrismTestUtil.parseObject(ACCOUNT_JACK_FILE);
// WHEN
String attrVal = f.getAttributeValue(accountJack.asObjectable(), MidPointConstants.NS_RI, ATTR_FULLNAME_LOCAL_PART);
// THEN
assertEquals("Wrong value for attribute " + ATTR_FULLNAME_LOCAL_PART, "Jack Sparrow", attrVal);
}
use of com.evolveum.midpoint.model.common.expression.functions.BasicExpressionFunctions in project midpoint by Evolveum.
the class TestExpressionFunctions method testDetermineLdapSingleAttributeValueFallback.
@Test
public void testDetermineLdapSingleAttributeValueFallback() throws Exception {
System.out.println("\n===[ testDetermineLdapSingleAttributeValueFallback ]===\n");
// GIVEN
BasicExpressionFunctions f = createBasicFunctions();
String dn = "cn=jack, ou=People, dc=example,dc=com";
String attributeName = "uid";
Collection<String> values = MiscUtil.createCollection("foo", "bar", "foobar");
// WHEN
String resultValue = f.determineLdapSingleAttributeValue(dn, attributeName, values);
// THEN
assertNotNull("Result value is null", resultValue);
System.out.println("Resulting value: " + resultValue);
assertEquals("Wrong result value", "bar", resultValue);
}
use of com.evolveum.midpoint.model.common.expression.functions.BasicExpressionFunctions in project midpoint by Evolveum.
the class TestExpressionFunctions method testGetExtensionPropertyValueNullObject.
@Test
public void testGetExtensionPropertyValueNullObject() throws Exception {
final String TEST_NAME = "testGetExtensionPropertyValueNullObject";
TestUtil.displayTestTile(TEST_NAME);
// GIVEN
BasicExpressionFunctions f = createBasicFunctions();
// WHEN
String shipExtension = f.getExtensionPropertyValue(null, SchemaTestConstants.EXTENSION_SHIP_ELEMENT);
// THEN
assertNull("Unexpected value for extension " + SchemaTestConstants.EXTENSION_SHIP_ELEMENT + ": " + shipExtension, shipExtension);
}
use of com.evolveum.midpoint.model.common.expression.functions.BasicExpressionFunctions in project midpoint by Evolveum.
the class TestExpressionFunctions method testParseFullName.
@Test
public void testParseFullName() throws Exception {
final String TEST_NAME = "testParseFullName";
TestUtil.displayTestTile(TEST_NAME);
BasicExpressionFunctions basic = createBasicFunctions();
assertEquals(null, basic.parseGivenName(null));
assertEquals(null, basic.parseGivenName(" "));
assertEquals("Jack", basic.parseGivenName("Jack Sparrow"));
assertEquals("Jack", basic.parseGivenName(" Jack Sparrow "));
assertEquals("Jack", basic.parseGivenName(new PolyString("Jack Sparrow")));
assertEquals("Sparrow", basic.parseFamilyName("Jack Sparrow"));
assertEquals("Sparrow", basic.parseFamilyName(" Jack Sparrow "));
assertEquals("Tim", basic.parseGivenName("Tim Berners-Lee"));
assertEquals("Berners-Lee", basic.parseFamilyName("Tim Berners-Lee"));
assertEquals("Cassius", basic.parseGivenName("Cassius Marcellus \"Muhammad Ali\" Clay, Jr."));
assertEquals("Marcellus", basic.parseAdditionalName("Cassius Marcellus \"Muhammad Ali\" Clay, Jr."));
assertEquals("Clay", basic.parseFamilyName("Cassius Marcellus \"Muhammad Ali\" Clay, Jr."));
assertEquals("Muhammad Ali", basic.parseNickName("Cassius Marcellus \"Muhammad Ali\" Clay, Jr."));
assertEquals("Jr.", basic.parseHonorificSuffix("Cassius Marcellus \"Muhammad Ali\" Clay, Jr."));
assertEquals("Radovan", basic.parseGivenName("Ing. Radovan Semančík, PhD."));
assertEquals("Semančík", basic.parseFamilyName("Ing. Radovan Semančík, PhD."));
assertEquals("Ing.", basic.parseHonorificPrefix("Ing. Radovan Semančík, PhD."));
assertEquals("PhD.", basic.parseHonorificSuffix("Ing. Radovan Semančík, PhD."));
}
use of com.evolveum.midpoint.model.common.expression.functions.BasicExpressionFunctions in project midpoint by Evolveum.
the class TestExpressionFunctions method testgetResourceIcfConfigurationPropertyValueStringPort.
@Test
public void testgetResourceIcfConfigurationPropertyValueStringPort() throws Exception {
final String TEST_NAME = "testgetResourceIcfConfigurationPropertyValueStringPort";
TestUtil.displayTestTile(TEST_NAME);
// GIVEN
BasicExpressionFunctions f = createBasicFunctions();
PrismObject<ResourceType> resource = PrismTestUtil.parseObject(RESOURCE_OPENDJ_FILE);
// WHEN
int val = f.getResourceIcfConfigurationPropertyValue(resource.asObjectable(), "port");
// THEN
assertEquals("Wrong value of ICF configuration property", 10389, val);
}
Aggregations