Search in sources :

Example 6 with ConnectorOperationalStatus

use of com.evolveum.midpoint.schema.statistics.ConnectorOperationalStatus in project midpoint by Evolveum.

the class AbstractBasicDummyTest method test090ConnectorStatsAfterSomeUse.

@Test
public void test090ConnectorStatsAfterSomeUse() throws Exception {
    final String TEST_NAME = "test090ConnectorStatsAfterSomeUse";
    TestUtil.displayTestTile(TEST_NAME);
    // GIVEN
    Task task = createTask(TEST_NAME);
    OperationResult result = task.getResult();
    // WHEN
    List<ConnectorOperationalStatus> operationalStatuses = provisioningService.getConnectorOperationalStatus(RESOURCE_DUMMY_OID, task, result);
    // THEN
    result.computeStatus();
    TestUtil.assertSuccess(result);
    display("Connector operational status", operationalStatuses);
    assertNotNull("null operational status", operationalStatuses);
    assertEquals("Unexpected size of operational status", 1, operationalStatuses.size());
    ConnectorOperationalStatus operationalStatus = operationalStatuses.get(0);
    assertEquals("Wrong connectorClassName", DummyConnector.class.getName(), operationalStatus.getConnectorClassName());
    assertEquals("Wrong poolConfigMinSize", null, operationalStatus.getPoolConfigMinSize());
    assertEquals("Wrong poolConfigMaxSize", (Integer) 10, operationalStatus.getPoolConfigMaxSize());
    assertEquals("Wrong poolConfigMinIdle", (Integer) 1, operationalStatus.getPoolConfigMinIdle());
    assertEquals("Wrong poolConfigMaxIdle", (Integer) 10, operationalStatus.getPoolConfigMaxIdle());
    assertEquals("Wrong poolConfigWaitTimeout", (Long) 150000L, operationalStatus.getPoolConfigWaitTimeout());
    assertEquals("Wrong poolConfigMinEvictableIdleTime", (Long) 120000L, operationalStatus.getPoolConfigMinEvictableIdleTime());
    assertEquals("Wrong poolStatusNumIdle", (Integer) 1, operationalStatus.getPoolStatusNumIdle());
    assertEquals("Wrong poolStatusNumActive", (Integer) 0, operationalStatus.getPoolStatusNumActive());
    assertSteadyResource();
}
Also used : Task(com.evolveum.midpoint.task.api.Task) DummyConnector(com.evolveum.icf.dummy.connector.DummyConnector) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) ConnectorOperationalStatus(com.evolveum.midpoint.schema.statistics.ConnectorOperationalStatus) Test(org.testng.annotations.Test)

Example 7 with ConnectorOperationalStatus

use of com.evolveum.midpoint.schema.statistics.ConnectorOperationalStatus in project midpoint by Evolveum.

the class AbstractLdapTest method assertLdapConnectorInstances.

protected void assertLdapConnectorInstances(int expectedConnectorInstances) throws NumberFormatException, IOException, InterruptedException, SchemaException, ObjectNotFoundException, CommunicationException, ConfigurationException, ExpressionEvaluationException {
    Task task = createTask(AbstractLdapTest.class.getName() + ".assertLdapConnectorInstances");
    OperationResult result = task.getResult();
    List<ConnectorOperationalStatus> stats = provisioningService.getConnectorOperationalStatus(getResourceOid(), task, result);
    display("Resource connector stats", stats);
    result.computeStatus();
    TestUtil.assertSuccess(result);
    assertEquals("unexpected number of stats", 1, stats.size());
    ConnectorOperationalStatus stat = stats.get(0);
    assertEquals("Unexpected number of LDAP connector instances", expectedConnectorInstances, stat.getPoolStatusNumIdle() + stat.getPoolStatusNumActive());
    if (!isAssertOpenFiles()) {
        return;
    }
    if (expectedConnectorInstances == 1) {
        assertStableSystem();
    } else {
        lsof.assertFdIncrease((expectedConnectorInstances - 1) * getNumberOfFdsPerLdapConnectorInstance());
    }
}
Also used : Task(com.evolveum.midpoint.task.api.Task) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) ConnectorOperationalStatus(com.evolveum.midpoint.schema.statistics.ConnectorOperationalStatus)

Example 8 with ConnectorOperationalStatus

use of com.evolveum.midpoint.schema.statistics.ConnectorOperationalStatus in project midpoint by Evolveum.

the class ProvisioningServiceImpl method getConnectorOperationalStatus.

@Override
public List<ConnectorOperationalStatus> getConnectorOperationalStatus(String resourceOid, Task task, OperationResult parentResult) throws SchemaException, ObjectNotFoundException, CommunicationException, ConfigurationException, ExpressionEvaluationException {
    OperationResult result = parentResult.createMinorSubresult(ProvisioningService.class.getName() + ".getConnectorOperationalStatus");
    result.addParam("resourceOid", resourceOid);
    result.addContext(OperationResult.CONTEXT_IMPLEMENTATION_CLASS, ProvisioningServiceImpl.class);
    PrismObject<ResourceType> resource;
    try {
        resource = resourceManager.getResource(resourceOid, null, task, result);
    } catch (SchemaException | ObjectNotFoundException | ExpressionEvaluationException ex) {
        ProvisioningUtil.recordFatalError(LOGGER, result, ex.getMessage(), ex);
        throw ex;
    }
    List<ConnectorOperationalStatus> stats;
    try {
        stats = resourceManager.getConnectorOperationalStatus(resource, result);
    } catch (ObjectNotFoundException | SchemaException | CommunicationException | ConfigurationException ex) {
        ProvisioningUtil.recordFatalError(LOGGER, result, "Getting operations status from connector for resource " + resourceOid + " failed: " + ex.getMessage(), ex);
        throw ex;
    }
    result.computeStatus();
    result.cleanupResult();
    return stats;
}
Also used : SchemaException(com.evolveum.midpoint.util.exception.SchemaException) ExpressionEvaluationException(com.evolveum.midpoint.util.exception.ExpressionEvaluationException) CommunicationException(com.evolveum.midpoint.util.exception.CommunicationException) ConfigurationException(com.evolveum.midpoint.util.exception.ConfigurationException) ObjectNotFoundException(com.evolveum.midpoint.util.exception.ObjectNotFoundException) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) ResourceType(com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType) ConnectorOperationalStatus(com.evolveum.midpoint.schema.statistics.ConnectorOperationalStatus)

Example 9 with ConnectorOperationalStatus

use of com.evolveum.midpoint.schema.statistics.ConnectorOperationalStatus in project midpoint by Evolveum.

the class AbstractManualConnectorInstance method getOperationalStatus.

@Override
public ConnectorOperationalStatus getOperationalStatus() throws ObjectNotFoundException {
    ConnectorOperationalStatus opstatus = new ConnectorOperationalStatus();
    opstatus.setConnectorClassName(this.getClass().getName());
    return opstatus;
}
Also used : ConnectorOperationalStatus(com.evolveum.midpoint.schema.statistics.ConnectorOperationalStatus)

Example 10 with ConnectorOperationalStatus

use of com.evolveum.midpoint.schema.statistics.ConnectorOperationalStatus in project midpoint by Evolveum.

the class ResourceConnectorPanel method initLayout.

private void initLayout(final IModel<PrismObject<ResourceType>> model, final PageBase parentPage) {
    setOutputMarkupId(true);
    IModel<List<ConnectorOperationalStatus>> statsModel = new AbstractReadOnlyModel<List<ConnectorOperationalStatus>>() {

        private static final long serialVersionUID = 1L;

        @Override
        public List<ConnectorOperationalStatus> getObject() {
            PrismObject<ResourceType> resource = model.getObject();
            Task task = parentPage.createSimpleTask(OPERATION_GET_CONNECTOR_OPERATIONAL_STATUS);
            OperationResult result = task.getResult();
            List<ConnectorOperationalStatus> status = null;
            try {
                status = parentPage.getModelInteractionService().getConnectorOperationalStatus(resource.getOid(), task, result);
            } catch (SchemaException | ObjectNotFoundException | CommunicationException | ConfigurationException | ExpressionEvaluationException e) {
                LOGGER.error("Error getting connector status for {}: {}", resource, e.getMessage(), e);
                parentPage.showResult(result);
            }
            return status;
        }
    };
    ListView<ConnectorOperationalStatus> listview = new ListView<ConnectorOperationalStatus>(ID_CONNECTOR_LIST, statsModel) {

        private static final long serialVersionUID = 1L;

        protected void populateItem(ListItem<ConnectorOperationalStatus> item) {
            item.add(new Label("label", item.getModel()));
            IModel<ConnectorOperationalStatus> statModel = item.getModel();
            item.add(createLabel(statModel, ID_CONNECTOR_NAME, ConnectorOperationalStatus.F_CONNECTOR_NAME));
            item.add(createLabel(statModel, ID_CONNECOTR_CLASS, ConnectorOperationalStatus.F_CONNECTOR_CLASS_NAME));
            item.add(createLabel(statModel, ID_POOL_CONFIG_MIN_SIZE, ConnectorOperationalStatus.F_POOL_CONFIG_MIN_SIZE));
            item.add(createLabel(statModel, ID_POOL_CONFIG_MAX_SIZE, ConnectorOperationalStatus.F_POOL_CONFIG_MAX_SIZE));
            item.add(createLabel(statModel, ID_POOL_CONFIG_MIN_IDLE, ConnectorOperationalStatus.F_POOL_CONFIG_MIN_IDLE));
            item.add(createLabel(statModel, ID_POOL_CONFIG_MAX_IDLE, ConnectorOperationalStatus.F_POOL_CONFIG_MAX_IDLE));
            item.add(createLabel(statModel, ID_POOL_CONFIG_WAIT_TIMEOUT, ConnectorOperationalStatus.F_POOL_CONFIG_WAIT_TIMEOUT));
            item.add(createLabel(statModel, ID_POOL_CONFIG_MIN_EVICTABLE_IDLE_TIME, ConnectorOperationalStatus.F_POOL_CONFIG_MIN_EVICTABLE_IDLE_TIME));
            item.add(createLabel(statModel, ID_POOL_STATUS_NUM_IDLE, ConnectorOperationalStatus.F_POOL_STATUS_NUM_IDLE));
            item.add(createLabel(statModel, ID_POOL_STATUS_NUM_ACTIVE, ConnectorOperationalStatus.F_POOL_STATUS_NUM_ACTIVE));
        }
    };
    add(listview);
}
Also used : AbstractReadOnlyModel(org.apache.wicket.model.AbstractReadOnlyModel) SchemaException(com.evolveum.midpoint.util.exception.SchemaException) Task(com.evolveum.midpoint.task.api.Task) ExpressionEvaluationException(com.evolveum.midpoint.util.exception.ExpressionEvaluationException) CommunicationException(com.evolveum.midpoint.util.exception.CommunicationException) Label(org.apache.wicket.markup.html.basic.Label) ResourceType(com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) ListView(org.apache.wicket.markup.html.list.ListView) ConfigurationException(com.evolveum.midpoint.util.exception.ConfigurationException) ObjectNotFoundException(com.evolveum.midpoint.util.exception.ObjectNotFoundException) List(java.util.List) ListItem(org.apache.wicket.markup.html.list.ListItem) ConnectorOperationalStatus(com.evolveum.midpoint.schema.statistics.ConnectorOperationalStatus)

Aggregations

ConnectorOperationalStatus (com.evolveum.midpoint.schema.statistics.ConnectorOperationalStatus)14 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)9 Test (org.testng.annotations.Test)6 Task (com.evolveum.midpoint.task.api.Task)4 ArrayList (java.util.ArrayList)4 DummyConnector (com.evolveum.icf.dummy.connector.DummyConnector)3 PrismObject (com.evolveum.midpoint.prism.PrismObject)3 ObjectQuery (com.evolveum.midpoint.prism.query.ObjectQuery)3 ResultHandler (com.evolveum.midpoint.provisioning.ucf.api.ResultHandler)3 ObjectClassComplexTypeDefinition (com.evolveum.midpoint.schema.processor.ObjectClassComplexTypeDefinition)3 CommunicationException (com.evolveum.midpoint.util.exception.CommunicationException)3 ConfigurationException (com.evolveum.midpoint.util.exception.ConfigurationException)3 ExpressionEvaluationException (com.evolveum.midpoint.util.exception.ExpressionEvaluationException)3 ObjectNotFoundException (com.evolveum.midpoint.util.exception.ObjectNotFoundException)3 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)3 ShadowType (com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType)3 ResourceType (com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType)2 ConnectorInstance (com.evolveum.midpoint.provisioning.ucf.api.ConnectorInstance)1 List (java.util.List)1 Label (org.apache.wicket.markup.html.basic.Label)1