Search in sources :

Example 16 with Host

use of com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.ScriptCapabilityType.Host in project midpoint by Evolveum.

the class AbstractAdLdapMultidomainTest method test600AssignAccountSubman.

@Test
public void test600AssignAccountSubman() throws Exception {
    final String TEST_NAME = "test600AssignAccountSubman";
    TestUtil.displayTestTile(this, TEST_NAME);
    // GIVEN
    Task task = taskManager.createTaskInstance(this.getClass().getName() + "." + TEST_NAME);
    OperationResult result = task.getResult();
    long tsStart = System.currentTimeMillis();
    // WHEN
    TestUtil.displayWhen(TEST_NAME);
    assignRole(USER_SUBMAN_OID, ROLE_SUBMISSIVE_OID, task, result);
    // THEN
    TestUtil.displayThen(TEST_NAME);
    result.computeStatus();
    TestUtil.assertSuccess(result);
    long tsEnd = System.currentTimeMillis();
    Entry entry = assertLdapSubAccount(USER_SUBMAN_USERNAME, USER_SUBMAN_FULL_NAME);
    display("Sub entry", entry);
    assertAttribute(entry, "title", null);
    PrismObject<UserType> userAfter = getUser(USER_SUBMAN_OID);
    String shadowOid = getSingleLinkOid(userAfter);
    PrismObject<ShadowType> shadow = getShadowModel(shadowOid);
    display("Shadow (model)", shadow);
    accountSubmanOid = shadow.getOid();
    Collection<ResourceAttribute<?>> identifiers = ShadowUtil.getPrimaryIdentifiers(shadow);
    String accountBarbossaIcfUid = (String) identifiers.iterator().next().getRealValue();
    assertNotNull("No identifier in " + shadow, accountBarbossaIcfUid);
    assertEquals("Wrong ICFS UID", AdUtils.formatGuidToDashedNotation(MiscUtil.binaryToHex(entry.get(getPrimaryIdentifierAttributeName()).getBytes())), accountBarbossaIcfUid);
    assertLdapPassword(getSubLdapConnectionConfig(), USER_SUBMAN_USERNAME, USER_SUBMAN_FULL_NAME, USER_SUBMAN_PASSWORD);
    assertAttribute(entry, ATTRIBUTE_USER_ACCOUNT_CONTROL_NAME, "512");
    ResourceAttribute<Long> createTimestampAttribute = ShadowUtil.getAttribute(shadow, new QName(MidPointConstants.NS_RI, "createTimeStamp"));
    assertNotNull("No createTimestamp in " + shadow, createTimestampAttribute);
    Long createTimestamp = createTimestampAttribute.getRealValue();
    // LDAP server may be on a different host. Allow for some clock offset.
    TestUtil.assertBetween("Wrong createTimestamp in " + shadow, roundTsDown(tsStart) - 120000, roundTsUp(tsEnd) + 120000, createTimestamp);
//        assertLdapConnectorInstances(2);
}
Also used : Task(com.evolveum.midpoint.task.api.Task) ShadowType(com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType) QName(javax.xml.namespace.QName) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) DefaultEntry(org.apache.directory.api.ldap.model.entry.DefaultEntry) Entry(org.apache.directory.api.ldap.model.entry.Entry) ResourceAttribute(com.evolveum.midpoint.schema.processor.ResourceAttribute) UserType(com.evolveum.midpoint.xml.ns._public.common.common_3.UserType) Test(org.testng.annotations.Test)

Example 17 with Host

use of com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.ScriptCapabilityType.Host in project midpoint by Evolveum.

the class CapabilityScriptPanel method prepareOnResourceModel.

private IModel prepareOnResourceModel() {
    CapabilityDto dto = (CapabilityDto) getModel().getObject();
    ScriptCapabilityType script = (ScriptCapabilityType) dto.getCapability();
    for (ScriptCapabilityType.Host host : script.getHost()) {
        if (ProvisioningScriptHostType.RESOURCE.equals(host.getType())) {
            return new PropertyModel<List<String>>(host, "language");
        }
    }
    List<String> emptyList = new ArrayList<>();
    return Model.of(emptyList);
}
Also used : ScriptCapabilityType(com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.ScriptCapabilityType) CapabilityDto(com.evolveum.midpoint.web.component.wizard.resource.dto.CapabilityDto) PropertyModel(org.apache.wicket.model.PropertyModel) ArrayList(java.util.ArrayList)

Example 18 with Host

use of com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.ScriptCapabilityType.Host in project midpoint by Evolveum.

the class CapabilityScriptPanel method prepareOnConnectorModel.

private IModel prepareOnConnectorModel() {
    CapabilityDto dto = (CapabilityDto) getModel().getObject();
    ScriptCapabilityType script = (ScriptCapabilityType) dto.getCapability();
    for (ScriptCapabilityType.Host host : script.getHost()) {
        if (ProvisioningScriptHostType.CONNECTOR.equals(host.getType())) {
            return new PropertyModel<List<String>>(host, "language");
        }
    }
    List<String> emptyList = new ArrayList<>();
    return Model.of(emptyList);
}
Also used : ScriptCapabilityType(com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.ScriptCapabilityType) CapabilityDto(com.evolveum.midpoint.web.component.wizard.resource.dto.CapabilityDto) PropertyModel(org.apache.wicket.model.PropertyModel) ArrayList(java.util.ArrayList)

Example 19 with Host

use of com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.ScriptCapabilityType.Host in project midpoint by Evolveum.

the class PageConnectorHosts method initConnectorHostsColumns.

private List<IColumn<ConnectorHostType, String>> initConnectorHostsColumns() {
    List<IColumn<ConnectorHostType, String>> columns = new ArrayList<>();
    IColumn column = new CheckBoxHeaderColumn<ConnectorHostType>();
    columns.add(column);
    column = new LinkColumn<SelectableBean<ConnectorHostType>>(createStringResource("pageResources.connector.name"), "name", "value.name") {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target, IModel<SelectableBean<ConnectorHostType>> rowModel) {
            ConnectorHostType host = rowModel.getObject().getValue();
        // resourceDetailsPerformed(target, host.getOid());
        }
    };
    columns.add(column);
    columns.add(new PropertyColumn(createStringResource("pageResources.connector.hostname"), "value.hostname"));
    columns.add(new PropertyColumn(createStringResource("pageResources.connector.port"), "value.port"));
    columns.add(new PropertyColumn(createStringResource("pageResources.connector.timeout"), "value.timeout"));
    columns.add(new CheckBoxColumn(createStringResource("pageResources.connector.protectConnection"), "value.protectConnection"));
    InlineMenuHeaderColumn menu = new InlineMenuHeaderColumn(initInlineHostsMenu());
    columns.add(menu);
    return columns;
}
Also used : ConnectorHostType(com.evolveum.midpoint.xml.ns._public.common.common_3.ConnectorHostType) InlineMenuHeaderColumn(com.evolveum.midpoint.web.component.data.column.InlineMenuHeaderColumn) PropertyColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn) ArrayList(java.util.ArrayList) CheckBoxColumn(com.evolveum.midpoint.web.component.data.column.CheckBoxColumn) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) CheckBoxHeaderColumn(com.evolveum.midpoint.web.component.data.column.CheckBoxHeaderColumn) SelectableBean(com.evolveum.midpoint.web.component.util.SelectableBean)

Example 20 with Host

use of com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.ScriptCapabilityType.Host in project midpoint by Evolveum.

the class PageConnectorHosts method discoveryRemotePerformed.

private void discoveryRemotePerformed(AjaxRequestTarget target) {
    target.add(getFeedbackPanel());
    PageBase page = (PageBase) getPage();
    Task task = page.createSimpleTask(OPERATION_CONNECTOR_DISCOVERY);
    OperationResult result = task.getResult();
    List<SelectableBean<ConnectorHostType>> selected = WebComponentUtil.getSelectedData(getConnectorHostTable());
    if (selected.isEmpty()) {
        warn(getString("pageResources.message.noHostSelected"));
        return;
    }
    for (SelectableBean<ConnectorHostType> bean : selected) {
        if (bean.getValue() != null) {
            ConnectorHostType host = bean.getValue();
            try {
                getModelService().discoverConnectors(host, task, result);
            } catch (Exception ex) {
                result.recordFatalError("Fail to discover connectors on host '" + host.getHostname() + ":" + host.getPort() + "'", ex);
            }
        }
    }
    result.recomputeStatus();
    showResult(result);
}
Also used : ConnectorHostType(com.evolveum.midpoint.xml.ns._public.common.common_3.ConnectorHostType) Task(com.evolveum.midpoint.task.api.Task) SelectableBean(com.evolveum.midpoint.web.component.util.SelectableBean) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) PageBase(com.evolveum.midpoint.gui.api.page.PageBase)

Aggregations

OperationResult (com.evolveum.midpoint.schema.result.OperationResult)16 Test (org.testng.annotations.Test)11 Task (com.evolveum.midpoint.task.api.Task)8 ScriptCapabilityType (com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.ScriptCapabilityType)8 PrismObject (com.evolveum.midpoint.prism.PrismObject)7 ConnectorType (com.evolveum.midpoint.xml.ns._public.common.common_3.ConnectorType)7 ConnectorHostType (com.evolveum.midpoint.xml.ns._public.common.common_3.ConnectorHostType)6 ResourceType (com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType)6 ResourceAttribute (com.evolveum.midpoint.schema.processor.ResourceAttribute)5 CapabilityCollectionType (com.evolveum.midpoint.xml.ns._public.common.common_3.CapabilityCollectionType)5 ShadowType (com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType)5 UserType (com.evolveum.midpoint.xml.ns._public.common.common_3.UserType)5 ActivationCapabilityType (com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.ActivationCapabilityType)5 QName (javax.xml.namespace.QName)5 Entry (org.apache.directory.api.ldap.model.entry.Entry)5 CommunicationException (com.evolveum.midpoint.util.exception.CommunicationException)3 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)3 SelectableBean (com.evolveum.midpoint.web.component.util.SelectableBean)3 CredentialsCapabilityType (com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.CredentialsCapabilityType)3 TestConnectionCapabilityType (com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.TestConnectionCapabilityType)3