use of com.evolveum.midpoint.xml.ns._public.common.common_3.LookupTableRowType in project midpoint by Evolveum.
the class TestEditSchema method test180LookupLanguagesReplaceObject.
@Test
public void test180LookupLanguagesReplaceObject() throws Exception {
final String TEST_NAME = "test180LookupLanguagesReplaceObject";
TestUtil.displayTestTile(this, TEST_NAME);
// GIVEN
Task task = taskManager.createTaskInstance(TestEditSchema.class.getName() + "." + TEST_NAME);
OperationResult result = task.getResult();
PrismObject<LookupTableType> replacement = PrismTestUtil.parseObject(LOOKUP_LANGUAGES_REPLACEMENT_FILE);
ObjectDelta<LookupTableType> delta = ObjectDelta.createAddDelta(replacement);
// WHEN
TestUtil.displayWhen(TEST_NAME);
ModelExecuteOptions options = ModelExecuteOptions.createOverwrite();
options.setRaw(true);
modelService.executeChanges(MiscSchemaUtil.createCollection(delta), options, task, result);
// THEN
TestUtil.displayThen(TEST_NAME);
result.computeStatus();
TestUtil.assertSuccess(result);
PrismObject<LookupTableType> lookup = getLookupTableAll(LOOKUP_LANGUAGES_OID, task, result);
result.computeStatus();
TestUtil.assertSuccess(result);
IntegrationTestTools.display("Languages", lookup);
assertEquals("Wrong lang lookup name", "Languages Replaced", lookup.asObjectable().getName().getOrig());
PrismContainer<LookupTableRowType> tableContainer = lookup.findContainer(LookupTableType.F_ROW);
assertNotNull("Table container missing", tableContainer);
assertEquals("Unexpected table container size", 1, tableContainer.size());
assertLookupRow(tableContainer, "fr_FR", "fr", "Français");
assertSteadyResources();
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.LookupTableRowType in project midpoint by Evolveum.
the class TestEditSchema method test150LookupLanguagesAddRowFull.
@Test
public void test150LookupLanguagesAddRowFull() throws Exception {
final String TEST_NAME = "test150LookupLanguagesAddRow";
TestUtil.displayTestTile(this, TEST_NAME);
// GIVEN
Task task = taskManager.createTaskInstance(TestEditSchema.class.getName() + "." + TEST_NAME);
OperationResult result = task.getResult();
LookupTableRowType row = new LookupTableRowType();
row.setKey("gi_GI");
row.setValue("gi");
row.setLabel(PrismTestUtil.createPolyStringType("Gibberish"));
ObjectDelta<LookupTableType> delta = ObjectDelta.createModificationAddContainer(LookupTableType.class, LOOKUP_LANGUAGES_OID, LookupTableType.F_ROW, prismContext, row);
// WHEN
TestUtil.displayWhen(TEST_NAME);
modelService.executeChanges(MiscSchemaUtil.createCollection(delta), null, task, result);
// THEN
TestUtil.displayThen(TEST_NAME);
result.computeStatus();
TestUtil.assertSuccess(result);
PrismObject<LookupTableType> lookup = getLookupTableAll(LOOKUP_LANGUAGES_OID, task, result);
result.computeStatus();
TestUtil.assertSuccess(result);
IntegrationTestTools.display("Languages", lookup);
assertEquals("Wrong lang lookup name", LOOKUP_LANGUAGES_NAME, lookup.asObjectable().getName().getOrig());
PrismContainer<LookupTableRowType> tableContainer = lookup.findContainer(LookupTableType.F_ROW);
assertNotNull("Table container missing", tableContainer);
assertEquals("Unexpected table container size", 5, tableContainer.size());
assertLookupRow(tableContainer, "en_US", "en", "English (US)");
assertLookupRow(tableContainer, "en_PR", "en", "English (pirate)");
assertLookupRow(tableContainer, "sk_SK", "sk", "Slovak");
assertLookupRow(tableContainer, "tr_TR", "tr", "Turkish");
assertLookupRow(tableContainer, "gi_GI", "gi", "Gibberish");
assertSteadyResources();
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.LookupTableRowType in project midpoint by Evolveum.
the class TestEditSchema method test124LookupLanguagesGetByKeyContainingReturningNothing.
@Test
public void test124LookupLanguagesGetByKeyContainingReturningNothing() throws Exception {
final String TEST_NAME = "test124LookupLanguagesGetByKeyContainingReturningNothing";
TestUtil.displayTestTile(this, TEST_NAME);
// GIVEN
Task task = taskManager.createTaskInstance(TestEditSchema.class.getName() + "." + TEST_NAME);
OperationResult result = task.getResult();
// WHEN
TestUtil.displayWhen(TEST_NAME);
RelationalValueSearchQuery query = new RelationalValueSearchQuery(LookupTableRowType.F_KEY, "xyz", RelationalValueSearchType.SUBSTRING);
Collection<SelectorOptions<GetOperationOptions>> options = SelectorOptions.createCollection(LookupTableType.F_ROW, GetOperationOptions.createRetrieve(query));
PrismObject<LookupTableType> lookup = modelService.getObject(LookupTableType.class, LOOKUP_LANGUAGES_OID, options, task, result);
// THEN
TestUtil.displayThen(TEST_NAME);
result.computeStatus();
TestUtil.assertSuccess(result);
IntegrationTestTools.display("Languages", lookup);
assertEquals("Wrong lang lookup name", LOOKUP_LANGUAGES_NAME, lookup.asObjectable().getName().getOrig());
PrismContainer<LookupTableRowType> tableContainer = lookup.findContainer(LookupTableType.F_ROW);
assertTrue("Unexpected content in tableContainer", tableContainer == null || tableContainer.size() == 0);
assertSteadyResources();
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.LookupTableRowType in project midpoint by Evolveum.
the class TestEditSchema method test102LookupLanguagesGetExclude.
@Test
public void test102LookupLanguagesGetExclude() throws Exception {
final String TEST_NAME = "test102LookupLanguagesGetExclude";
TestUtil.displayTestTile(this, TEST_NAME);
// GIVEN
Task task = taskManager.createTaskInstance(TestEditSchema.class.getName() + "." + TEST_NAME);
OperationResult result = task.getResult();
Collection<SelectorOptions<GetOperationOptions>> options = SelectorOptions.createCollection(LookupTableType.F_ROW, GetOperationOptions.createRetrieve(RetrieveOption.EXCLUDE));
// WHEN
TestUtil.displayWhen(TEST_NAME);
PrismObject<LookupTableType> lookup = modelService.getObject(LookupTableType.class, LOOKUP_LANGUAGES_OID, options, task, result);
// THEN
TestUtil.displayThen(TEST_NAME);
result.computeStatus();
TestUtil.assertSuccess(result);
IntegrationTestTools.display("Languages", lookup);
assertEquals("Wrong lang lookup name", LOOKUP_LANGUAGES_NAME, lookup.asObjectable().getName().getOrig());
PrismContainer<LookupTableRowType> tableContainer = lookup.findContainer(LookupTableType.F_ROW);
assertNull("Table container sneaked in", tableContainer);
assertSteadyResources();
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.LookupTableRowType in project midpoint by Evolveum.
the class TestEditSchema method test154LookupLanguagesAddRowKeyValue.
@Test
public void test154LookupLanguagesAddRowKeyValue() throws Exception {
final String TEST_NAME = "test154LookupLanguagesAddRowKeyValue";
TestUtil.displayTestTile(this, TEST_NAME);
// GIVEN
Task task = taskManager.createTaskInstance(TestEditSchema.class.getName() + "." + TEST_NAME);
OperationResult result = task.getResult();
LookupTableRowType row = new LookupTableRowType();
row.setKey("gi_HU");
row.setValue("gi");
ObjectDelta<LookupTableType> delta = ObjectDelta.createModificationAddContainer(LookupTableType.class, LOOKUP_LANGUAGES_OID, LookupTableType.F_ROW, prismContext, row);
// WHEN
TestUtil.displayWhen(TEST_NAME);
modelService.executeChanges(MiscSchemaUtil.createCollection(delta), null, task, result);
// THEN
TestUtil.displayThen(TEST_NAME);
result.computeStatus();
TestUtil.assertSuccess(result);
PrismObject<LookupTableType> lookup = getLookupTableAll(LOOKUP_LANGUAGES_OID, task, result);
result.computeStatus();
TestUtil.assertSuccess(result);
IntegrationTestTools.display("Languages", lookup);
assertEquals("Wrong lang lookup name", LOOKUP_LANGUAGES_NAME, lookup.asObjectable().getName().getOrig());
PrismContainer<LookupTableRowType> tableContainer = lookup.findContainer(LookupTableType.F_ROW);
assertNotNull("Table container missing", tableContainer);
assertEquals("Unexpected table container size", 7, tableContainer.size());
assertLookupRow(tableContainer, "en_US", "en", "English (US)");
assertLookupRow(tableContainer, "en_PR", "en", "English (pirate)");
assertLookupRow(tableContainer, "sk_SK", "sk", "Slovak");
assertLookupRow(tableContainer, "tr_TR", "tr", "Turkish");
assertLookupRow(tableContainer, "gi_GI", "gi", "Gibberish");
assertLookupRow(tableContainer, "gi_GO", null, "Gobbledygook");
assertLookupRow(tableContainer, "gi_HU", "gi", null);
assertSteadyResources();
}
Aggregations