Search in sources :

Example 31 with LookupTableRowType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.LookupTableRowType in project midpoint by Evolveum.

the class TestEditSchema method test166LookupLanguagesDeleteRowIdOnly.

@Test
public void test166LookupLanguagesDeleteRowIdOnly() throws Exception {
    final String TEST_NAME = "test166LookupLanguagesDeleteRowIdOnly";
    TestUtil.displayTestTile(this, TEST_NAME);
    // GIVEN
    Task task = taskManager.createTaskInstance(TestEditSchema.class.getName() + "." + TEST_NAME);
    OperationResult result = task.getResult();
    LookupTableRowType row = new LookupTableRowType();
    row.setId(2L);
    ObjectDelta<LookupTableType> delta = ObjectDelta.createModificationDeleteContainer(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", 4, tableContainer.size());
    assertLookupRow(tableContainer, "gi_GI", "gi", "Gibberish");
    assertLookupRow(tableContainer, "gi_GO", null, "Gobbledygook");
    assertLookupRow(tableContainer, "gi_HU", "gi", "Humbug");
    assertLookupRow(tableContainer, "tr_TR", "tr", "Turkish");
    assertSteadyResources();
}
Also used : Task(com.evolveum.midpoint.task.api.Task) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) PolyString(com.evolveum.midpoint.prism.polystring.PolyString) LookupTableRowType(com.evolveum.midpoint.xml.ns._public.common.common_3.LookupTableRowType) LookupTableType(com.evolveum.midpoint.xml.ns._public.common.common_3.LookupTableType) Test(org.testng.annotations.Test)

Example 32 with LookupTableRowType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.LookupTableRowType in project midpoint by Evolveum.

the class TestEditSchema method test152LookupLanguagesAddRowKeyLabel.

@Test
public void test152LookupLanguagesAddRowKeyLabel() throws Exception {
    final String TEST_NAME = "test152LookupLanguagesAddRowKeyLabel";
    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_GO");
    row.setLabel(PrismTestUtil.createPolyStringType("Gobbledygook"));
    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", 6, 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");
    assertSteadyResources();
}
Also used : Task(com.evolveum.midpoint.task.api.Task) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) PolyString(com.evolveum.midpoint.prism.polystring.PolyString) LookupTableRowType(com.evolveum.midpoint.xml.ns._public.common.common_3.LookupTableRowType) LookupTableType(com.evolveum.midpoint.xml.ns._public.common.common_3.LookupTableType) Test(org.testng.annotations.Test)

Example 33 with LookupTableRowType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.LookupTableRowType in project midpoint by Evolveum.

the class TestEditSchema method test168LookupLanguagesDeleteRowByKey.

@Test
public void test168LookupLanguagesDeleteRowByKey() throws Exception {
    final String TEST_NAME = "test168LookupLanguagesDeleteRowByKey";
    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");
    ObjectDelta<LookupTableType> delta = ObjectDelta.createModificationDeleteContainer(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", 3, tableContainer.size());
    assertLookupRow(tableContainer, "gi_GO", null, "Gobbledygook");
    assertLookupRow(tableContainer, "gi_HU", "gi", "Humbug");
    assertLookupRow(tableContainer, "tr_TR", "tr", "Turkish");
    assertSteadyResources();
}
Also used : Task(com.evolveum.midpoint.task.api.Task) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) PolyString(com.evolveum.midpoint.prism.polystring.PolyString) LookupTableRowType(com.evolveum.midpoint.xml.ns._public.common.common_3.LookupTableRowType) LookupTableType(com.evolveum.midpoint.xml.ns._public.common.common_3.LookupTableType) Test(org.testng.annotations.Test)

Example 34 with LookupTableRowType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.LookupTableRowType in project midpoint by Evolveum.

the class TestEditSchema method test100LookupLanguagesGet.

@Test
public void test100LookupLanguagesGet() throws Exception {
    final String TEST_NAME = "test100LookupLanguagesGet";
    TestUtil.displayTestTile(this, TEST_NAME);
    // GIVEN
    Task task = taskManager.createTaskInstance(TestEditSchema.class.getName() + "." + TEST_NAME);
    OperationResult result = task.getResult();
    // WHEN
    TestUtil.displayWhen(TEST_NAME);
    PrismObject<LookupTableType> lookup = modelService.getObject(LookupTableType.class, LOOKUP_LANGUAGES_OID, null, 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();
}
Also used : Task(com.evolveum.midpoint.task.api.Task) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) PolyString(com.evolveum.midpoint.prism.polystring.PolyString) LookupTableRowType(com.evolveum.midpoint.xml.ns._public.common.common_3.LookupTableRowType) LookupTableType(com.evolveum.midpoint.xml.ns._public.common.common_3.LookupTableType) Test(org.testng.annotations.Test)

Aggregations

LookupTableRowType (com.evolveum.midpoint.xml.ns._public.common.common_3.LookupTableRowType)34 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)23 LookupTableType (com.evolveum.midpoint.xml.ns._public.common.common_3.LookupTableType)23 Test (org.testng.annotations.Test)22 PolyString (com.evolveum.midpoint.prism.polystring.PolyString)17 Task (com.evolveum.midpoint.task.api.Task)14 ItemDelta (com.evolveum.midpoint.prism.delta.ItemDelta)10 RLookupTableRow (com.evolveum.midpoint.repo.sql.data.common.other.RLookupTableRow)4 ArrayList (java.util.ArrayList)3 RelationalValueSearchQuery (com.evolveum.midpoint.schema.RelationalValueSearchQuery)2 SelectorOptions (com.evolveum.midpoint.schema.SelectorOptions)2 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)2 QName (javax.xml.namespace.QName)2 ModelExecuteOptions (com.evolveum.midpoint.model.api.ModelExecuteOptions)1 PrismContainerValue (com.evolveum.midpoint.prism.PrismContainerValue)1 PrismObject (com.evolveum.midpoint.prism.PrismObject)1 PrismProperty (com.evolveum.midpoint.prism.PrismProperty)1 ContainerDelta (com.evolveum.midpoint.prism.delta.ContainerDelta)1 ItemPath (com.evolveum.midpoint.prism.path.ItemPath)1 ObjectPaging (com.evolveum.midpoint.prism.query.ObjectPaging)1