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();
}
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());
}
}
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;
}
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;
}
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);
}
Aggregations