use of com.evolveum.midpoint.xml.ns._public.common.common_3.RoleType in project midpoint by Evolveum.
the class TestSchemaDelta method testDeleteInducementValidIdSameValueApplyToObject.
@Test
public void testDeleteInducementValidIdSameValueApplyToObject() throws Exception {
final String TEST_NAME = "testDeleteInducementValidIdSameValueApplyToObject";
displayTestTile(TEST_NAME);
// GIVEN
PrismObject<RoleType> role = PrismTestUtil.parseObject(ROLE_CONSTRUCTION_FILE);
//Delta
ConstructionType construction = new ConstructionType();
ObjectReferenceType resourceRef = new ObjectReferenceType();
resourceRef.setOid(ROLE_CONSTRUCTION_RESOURCE_OID);
construction.setResourceRef(resourceRef);
AssignmentType inducement = new AssignmentType();
inducement.setConstruction(construction);
inducement.setId(ROLE_CONSTRUCTION_INDUCEMENT_ID);
ObjectDelta<RoleType> roleDelta = ObjectDelta.createModificationDeleteContainer(RoleType.class, ROLE_CONSTRUCTION_OID, RoleType.F_INDUCEMENT, getPrismContext(), inducement);
// WHEN
roleDelta.applyTo(role);
// THEN
System.out.println("Role after delta application:");
System.out.println(role.debugDump());
assertEquals("Wrong OID", ROLE_CONSTRUCTION_OID, role.getOid());
PrismAsserts.assertPropertyValue(role, UserType.F_NAME, PrismTestUtil.createPolyString("Construction"));
PrismContainer<AssignmentType> assignment = role.findContainer(RoleType.F_INDUCEMENT);
assertNull("Unexpected inducement", assignment);
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.RoleType in project midpoint by Evolveum.
the class TestSchemaDelta method testDeleteInducementValidIdEmptyValueApplyToObjectStatic.
@Test
public void testDeleteInducementValidIdEmptyValueApplyToObjectStatic() throws Exception {
final String TEST_NAME = "testDeleteInducementValidIdEmptyValueApplyToObjectStatic";
displayTestTile(TEST_NAME);
// GIVEN
PrismObject<RoleType> role = PrismTestUtil.parseObject(ROLE_CONSTRUCTION_FILE);
System.out.println("Role before delta application:");
System.out.println(role.debugDump());
//Delta
AssignmentType inducement = new AssignmentType();
inducement.setId(ROLE_CONSTRUCTION_INDUCEMENT_ID);
ObjectDelta<RoleType> roleDelta = ObjectDelta.createModificationDeleteContainer(RoleType.class, ROLE_CONSTRUCTION_OID, RoleType.F_INDUCEMENT, getPrismContext(), inducement);
// WHEN
PropertyDelta.applyTo(roleDelta.getModifications(), role);
// THEN
System.out.println("Role after delta application:");
System.out.println(role.debugDump());
assertEquals("Wrong OID", ROLE_CONSTRUCTION_OID, role.getOid());
PrismAsserts.assertPropertyValue(role, UserType.F_NAME, PrismTestUtil.createPolyString("Construction"));
PrismContainer<AssignmentType> assignment = role.findContainer(RoleType.F_INDUCEMENT);
assertNull("Unexpected inducement", assignment);
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.RoleType in project midpoint by Evolveum.
the class TestParseScriptingExpressionXsiType method assertPrismPropertyValueLocal.
@SuppressWarnings("unchecked")
@Override
protected void assertPrismPropertyValueLocal(PrismPropertyValue<ExpressionPipelineType> value) throws SchemaException {
ExpressionPipelineType pipe = value.getValue();
JAXBElement<ExpressionSequenceType> sequenceJaxb1 = (JAXBElement<ExpressionSequenceType>) pipe.getScriptingExpression().get(0);
assertEquals("Wrong element name (1)", SchemaConstants.S_SEQUENCE, sequenceJaxb1.getName());
assertEquals("Wrong element type (1)", ExpressionSequenceType.class, sequenceJaxb1.getValue().getClass());
JAXBElement<SearchExpressionType> searchJaxb1_1 = (JAXBElement<SearchExpressionType>) sequenceJaxb1.getValue().getScriptingExpression().get(0);
assertEquals("Wrong first element name", SchemaConstants.S_SEARCH, searchJaxb1_1.getName());
assertEquals("Wrong element type (1.1)", SearchExpressionType.class, searchJaxb1_1.getValue().getClass());
assertEquals(new QName("RoleType"), searchJaxb1_1.getValue().getType());
assertNotNull(searchJaxb1_1.getValue().getSearchFilter());
JAXBElement<ActionExpressionType> actionJaxb1_2 = (JAXBElement<ActionExpressionType>) sequenceJaxb1.getValue().getScriptingExpression().get(1);
assertEquals("Wrong element type (1.2)", ActionExpressionType.class, actionJaxb1_2.getValue().getClass());
assertEquals("log", actionJaxb1_2.getValue().getType());
JAXBElement<ExpressionSequenceType> sequenceJaxb2 = (JAXBElement<ExpressionSequenceType>) pipe.getScriptingExpression().get(1);
assertEquals("Wrong second element name", SchemaConstants.S_SEQUENCE, sequenceJaxb2.getName());
assertEquals("Wrong element type (2)", ExpressionSequenceType.class, sequenceJaxb2.getValue().getClass());
JAXBElement<ActionExpressionType> actionJaxb2_1 = (JAXBElement<ActionExpressionType>) sequenceJaxb2.getValue().getScriptingExpression().get(0);
JAXBElement<ActionExpressionType> actionJaxb2_2 = (JAXBElement<ActionExpressionType>) sequenceJaxb2.getValue().getScriptingExpression().get(1);
JAXBElement<SearchExpressionType> searchJaxb2_3 = (JAXBElement<SearchExpressionType>) sequenceJaxb2.getValue().getScriptingExpression().get(2);
assertEquals("Wrong element name (2.1)", SchemaConstants.S_ACTION, actionJaxb2_1.getName());
assertEquals("Wrong element type (2.1)", ActionExpressionType.class, actionJaxb2_1.getValue().getClass());
assertEquals("Wrong element name (2.2)", SchemaConstants.S_ACTION, actionJaxb2_2.getName());
assertEquals("Wrong element type (2.2)", ActionExpressionType.class, actionJaxb2_2.getValue().getClass());
assertEquals("Wrong element name (2.3)", SchemaConstants.S_SEARCH, searchJaxb2_3.getName());
assertEquals("Wrong element type (2.3)", SearchExpressionType.class, searchJaxb2_3.getValue().getClass());
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.RoleType in project midpoint by Evolveum.
the class TestEditSchema method test250EditSchemaRole.
@Test
public void test250EditSchemaRole() throws Exception {
final String TEST_NAME = "test250EditSchemaRole";
TestUtil.displayTestTile(this, TEST_NAME);
// GIVEN
Task task = taskManager.createTaskInstance(TestEditSchema.class.getName() + "." + TEST_NAME);
OperationResult result = task.getResult();
PrismObjectDefinition<RoleType> roleDef = prismContext.getSchemaRegistry().findObjectDefinitionByCompileTimeClass(RoleType.class);
PrismObject<RoleType> role = roleDef.instantiate();
// WHEN
TestUtil.displayWhen(TEST_NAME);
PrismObjectDefinition<RoleType> editDef = getEditObjectDefinition(role);
// THEN
TestUtil.displayThen(TEST_NAME);
// TODO
PrismPropertyDefinition requestableDef = editDef.findPropertyDefinition(RoleType.F_REQUESTABLE);
assertNotNull("No definition for requestable in role", requestableDef);
assertEquals("Wrong requestable displayName", "Can request", requestableDef.getDisplayName());
assertSteadyResources();
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.RoleType in project midpoint by Evolveum.
the class TestRbac method test802AddGlobalImmutableRole.
/**
* This should go well. The global immutable role has enforced modification,
* but not addition.
*/
@Test
public void test802AddGlobalImmutableRole() throws Exception {
final String TEST_NAME = "test802AddGlobalImmutableRole";
TestUtil.displayTestTile(this, TEST_NAME);
assumeAssignmentPolicy(AssignmentPolicyEnforcementType.FULL);
Task task = taskManager.createTaskInstance(TestRbac.class.getName() + "." + TEST_NAME);
OperationResult result = task.getResult();
PrismObject<RoleType> role = PrismTestUtil.parseObject(ROLE_IMMUTABLE_GLOBAL_FILE);
display("Role before", role);
// WHEN
TestUtil.displayWhen(TEST_NAME);
addObject(role, task, result);
// THEN
TestUtil.displayThen(TEST_NAME);
result.computeStatus();
TestUtil.assertSuccess(result);
PrismObject<RoleType> roleAfter = getObject(RoleType.class, ROLE_IMMUTABLE_GLOBAL_OID);
display("Role before", roleAfter);
assertNotNull("No role added", roleAfter);
}
Aggregations