use of com.evolveum.midpoint.prism.schema.PrismSchema in project midpoint by Evolveum.
the class TestUcfDummy method test000PrismContextSanity.
@Test
public void test000PrismContextSanity() throws Exception {
final String TEST_NAME = "test000PrismContextSanity";
TestUtil.displayTestTile(TEST_NAME);
SchemaRegistry schemaRegistry = PrismTestUtil.getPrismContext().getSchemaRegistry();
PrismSchema schemaIcfc = schemaRegistry.findSchemaByNamespace(SchemaConstants.NS_ICF_CONFIGURATION);
assertNotNull("ICFC schema not found in the context (" + SchemaConstants.NS_ICF_CONFIGURATION + ")", schemaIcfc);
PrismContainerDefinition<ConnectorConfigurationType> configurationPropertiesDef = schemaIcfc.findContainerDefinitionByElementName(SchemaConstants.CONNECTOR_SCHEMA_CONFIGURATION_PROPERTIES_ELEMENT_QNAME);
assertNotNull("icfc:configurationProperties not found in icfc schema (" + SchemaConstants.CONNECTOR_SCHEMA_CONFIGURATION_PROPERTIES_ELEMENT_QNAME + ")", configurationPropertiesDef);
PrismSchema schemaIcfs = schemaRegistry.findSchemaByNamespace(SchemaConstants.NS_ICF_SCHEMA);
assertNotNull("ICFS schema not found in the context (" + SchemaConstants.NS_ICF_SCHEMA + ")", schemaIcfs);
}
use of com.evolveum.midpoint.prism.schema.PrismSchema in project midpoint by Evolveum.
the class TestRbac method test149JackUnAssignRoleBlackSeaPirateWithSeaInAssignment.
@Test
public void test149JackUnAssignRoleBlackSeaPirateWithSeaInAssignment() throws Exception {
final String TEST_NAME = "test149JackUnAssignRoleBlackSeaPirateWithSeaInAssignment";
TestUtil.displayTestTile(this, TEST_NAME);
Task task = taskManager.createTaskInstance(TestRbac.class.getName() + "." + TEST_NAME);
OperationResult result = task.getResult();
PrismContainer<?> extension = getAssignmentExtensionInstance();
PrismSchema piracySchema = getPiracySchema();
PrismPropertyDefinition<String> seaPropDef = piracySchema.findPropertyDefinitionByElementName(PIRACY_SEA_QNAME);
PrismProperty<String> seaProp = seaPropDef.instantiate();
seaProp.setRealValue("Caribbean");
extension.add(seaProp);
// WHEN
unassignRole(USER_JACK_OID, ROLE_BLACK_SEA_PIRATE_OID, extension, task, result);
// THEN
result.computeStatus();
TestUtil.assertSuccess(result);
PrismObject<UserType> userJack = getUser(USER_JACK_OID);
display("User after", userJack);
assertAssignments(userJack, 0);
assertRoleMembershipRef(userJack);
assertDelegatedRef(userJack);
assertNoDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME);
}
use of com.evolveum.midpoint.prism.schema.PrismSchema in project midpoint by Evolveum.
the class TestRbac method test132JackUnAssignRolePirateWithSeaInAssignment.
@Test
public void test132JackUnAssignRolePirateWithSeaInAssignment() throws Exception {
final String TEST_NAME = "test132JackUnAssignRolePirateWithSeaInAssignment";
TestUtil.displayTestTile(this, TEST_NAME);
Task task = taskManager.createTaskInstance(TestRbac.class.getName() + "." + TEST_NAME);
OperationResult result = task.getResult();
PrismContainer<?> extension = getAssignmentExtensionInstance();
PrismSchema piracySchema = getPiracySchema();
PrismPropertyDefinition<String> seaPropDef = piracySchema.findPropertyDefinitionByElementName(PIRACY_SEA_QNAME);
PrismProperty<String> seaProp = seaPropDef.instantiate();
seaProp.setRealValue("Caribbean");
extension.add(seaProp);
// WHEN
unassignRole(USER_JACK_OID, ROLE_PIRATE_OID, extension, task, result);
// THEN
result.computeStatus();
TestUtil.assertSuccess(result);
PrismObject<UserType> userJack = getUser(USER_JACK_OID);
display("User after", userJack);
assertAssignments(userJack, 0);
assertRoleMembershipRef(userJack);
assertDelegatedRef(userJack);
assertNoDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME);
}
use of com.evolveum.midpoint.prism.schema.PrismSchema in project midpoint by Evolveum.
the class TestRbac method test137JackAssignRoleAdriaticPirateWithSeaInAssignment.
/**
* Even though we assign Adriatic Pirate role which has a sea set in its extension the
* sea set in user's extension should override it.
*/
@Test
public void test137JackAssignRoleAdriaticPirateWithSeaInAssignment() throws Exception {
final String TEST_NAME = "test137JackAssignRoleAdriaticPirateWithSeaInAssignment";
TestUtil.displayTestTile(this, TEST_NAME);
Task task = taskManager.createTaskInstance(TestRbac.class.getName() + "." + TEST_NAME);
OperationResult result = task.getResult();
PrismContainer<?> extension = getAssignmentExtensionInstance();
PrismSchema piracySchema = getPiracySchema();
PrismPropertyDefinition<String> seaPropDef = piracySchema.findPropertyDefinitionByElementName(PIRACY_SEA_QNAME);
PrismProperty<String> seaProp = seaPropDef.instantiate();
seaProp.setRealValue("Caribbean");
extension.add(seaProp);
// WHEN
assignRole(USER_JACK_OID, ROLE_ADRIATIC_PIRATE_OID, extension, task, result);
// THEN
result.computeStatus();
TestUtil.assertSuccess(result);
PrismObject<UserType> userAfter = getUser(USER_JACK_OID);
display("User jack after", userAfter);
assertAssignedRole(userAfter, ROLE_ADRIATIC_PIRATE_OID, task, result);
assertRoleMembershipRef(userAfter, ROLE_ADRIATIC_PIRATE_OID, ROLE_PIRATE_OID);
assertDelegatedRef(userAfter);
assertDefaultDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME, ACCOUNT_JACK_DUMMY_FULLNAME, true);
assertDefaultDummyAccountAttribute(ACCOUNT_JACK_DUMMY_USERNAME, "title", "Bloody Pirate");
assertDefaultDummyAccountAttribute(ACCOUNT_JACK_DUMMY_USERNAME, "location", "Tortuga");
// Outbound mapping for weapon is weak, therefore the mapping in role should override it
assertDefaultDummyAccountAttribute(ACCOUNT_JACK_DUMMY_USERNAME, "weapon", "cutlass");
assertDefaultDummyAccountAttribute(ACCOUNT_JACK_DUMMY_USERNAME, DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_GOSSIP_NAME, "Jack Sparrow is the best pirate Tortuga has ever seen");
assertDefaultDummyAccountAttribute(ACCOUNT_JACK_DUMMY_USERNAME, DUMMY_ACCOUNT_ATTRIBUTE_SEA_NAME, "jack sailed Caribbean, immediately Adriatic, role , with this The Seven Seas while focused on Caribbean (in Pirate)");
}
use of com.evolveum.midpoint.prism.schema.PrismSchema in project midpoint by Evolveum.
the class TestRbac method test147JackAssignRoleBlackSeaPirateWithSeaInAssignment.
@Test
public void test147JackAssignRoleBlackSeaPirateWithSeaInAssignment() throws Exception {
final String TEST_NAME = "test147JackAssignRoleBlackSeaPirateWithSeaInAssignment";
TestUtil.displayTestTile(this, TEST_NAME);
Task task = taskManager.createTaskInstance(TestRbac.class.getName() + "." + TEST_NAME);
OperationResult result = task.getResult();
PrismContainer<?> extension = getAssignmentExtensionInstance();
PrismSchema piracySchema = getPiracySchema();
PrismPropertyDefinition<String> seaPropDef = piracySchema.findPropertyDefinitionByElementName(PIRACY_SEA_QNAME);
PrismProperty<String> seaProp = seaPropDef.instantiate();
seaProp.setRealValue("Caribbean");
extension.add(seaProp);
// WHEN
assignRole(USER_JACK_OID, ROLE_BLACK_SEA_PIRATE_OID, extension, task, result);
// THEN
result.computeStatus();
TestUtil.assertSuccess(result);
PrismObject<UserType> userAfter = getUser(USER_JACK_OID);
display("User jack after", userAfter);
assertAssignedRole(userAfter, ROLE_BLACK_SEA_PIRATE_OID, task, result);
assertRoleMembershipRef(userAfter, ROLE_BLACK_SEA_PIRATE_OID, ROLE_PIRATE_OID);
assertDelegatedRef(userAfter);
assertDefaultDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME, ACCOUNT_JACK_DUMMY_FULLNAME, true);
assertDefaultDummyAccountAttribute(ACCOUNT_JACK_DUMMY_USERNAME, "title", "Bloody Pirate");
assertDefaultDummyAccountAttribute(ACCOUNT_JACK_DUMMY_USERNAME, "location", "Tortuga");
// Outbound mapping for weapon is weak, therefore the mapping in role should override it
assertDefaultDummyAccountAttribute(ACCOUNT_JACK_DUMMY_USERNAME, "weapon", "cutlass");
assertDefaultDummyAccountAttribute(ACCOUNT_JACK_DUMMY_USERNAME, DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_GOSSIP_NAME, "Jack Sparrow is the best pirate Tortuga has ever seen");
assertDefaultDummyAccountAttribute(ACCOUNT_JACK_DUMMY_USERNAME, DUMMY_ACCOUNT_ATTRIBUTE_SEA_NAME, "jack sailed Caribbean, immediately Marmara Sea, role Black Sea, with this The Seven Seas while focused on Caribbean (in Pirate)");
}
Aggregations