Search in sources :

Example 1 with RepositoryDiag

use of com.evolveum.midpoint.schema.RepositoryDiag in project midpoint by Evolveum.

the class TestMisc method test100GetRepositoryDiag.

@Test
public void test100GetRepositoryDiag() throws Exception {
    final String TEST_NAME = "test100GetRepositoryDiag";
    TestUtil.displayTestTile(this, TEST_NAME);
    // GIVEN
    Task task = taskManager.createTaskInstance(TestMisc.class.getName() + "." + TEST_NAME);
    OperationResult result = task.getResult();
    // WHEN
    RepositoryDiag diag = modelDiagnosticService.getRepositoryDiag(task, result);
    // THEN
    display("Diag", diag);
    result.computeStatus();
    TestUtil.assertSuccess("getRepositoryDiag result", result);
    assertEquals("Wrong implementationShortName", "SQL", diag.getImplementationShortName());
    assertNotNull("Missing implementationDescription", diag.getImplementationDescription());
// TODO
}
Also used : Task(com.evolveum.midpoint.task.api.Task) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) RepositoryDiag(com.evolveum.midpoint.schema.RepositoryDiag) Test(org.testng.annotations.Test)

Example 2 with RepositoryDiag

use of com.evolveum.midpoint.schema.RepositoryDiag in project midpoint by Evolveum.

the class TestMisc method test100GetRepositoryDiag.

@Test
public void test100GetRepositoryDiag() {
    given();
    Task task = getTestTask();
    OperationResult result = task.getResult();
    when();
    RepositoryDiag diag = modelDiagnosticService.getRepositoryDiag(task, result);
    then();
    displayValue("Diag", diag);
    assertSuccess(result);
    assertThat(diag.getImplementationShortName()).isIn("SQL", "Native");
    assertNotNull("Missing implementationDescription", diag.getImplementationDescription());
}
Also used : Task(com.evolveum.midpoint.task.api.Task) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) RepositoryDiag(com.evolveum.midpoint.schema.RepositoryDiag) Test(org.testng.annotations.Test)

Example 3 with RepositoryDiag

use of com.evolveum.midpoint.schema.RepositoryDiag in project midpoint by Evolveum.

the class InfoRepositoryAction method execute.

@Override
public void execute() {
    MidpointConfiguration config = context.getMidpointConfiguration();
    System.out.println("MidPoint home: " + config.getMidpointHome());
    System.out.println("Java home: " + System.getProperty("java.home"));
    RepositoryService repository = context.getRepository();
    OperationResult repoTestResult = new OperationResult("repo.test");
    repository.repositorySelfTest(repoTestResult);
    repoTestResult.close();
    System.out.println("Repository test: " + repoTestResult.getStatus());
    try {
        RepositoryDiag repositoryDiag = repository.getRepositoryDiag();
        System.out.println("Repository diag:" + "\n Type: " + repositoryDiag.getImplementationShortName() + "\n Description: " + repositoryDiag.getImplementationDescription() + "\n JDBC URL: " + repositoryDiag.getRepositoryUrl() + "\n Driver type: " + repositoryDiag.getDriverShortName() + "\n Driver version: " + repositoryDiag.getDriverVersion() + "\n Additional details:");
        for (LabeledString detail : repositoryDiag.getAdditionalDetails()) {
            System.out.println(" - " + detail.getLabel() + ": " + detail.getData());
        }
    } catch (Exception e) {
        // Fatal crash during Ninja start is more likely than this, but just to be sure...
        System.err.println("Unexpected problem during repo diag: " + e);
    }
}
Also used : MidpointConfiguration(com.evolveum.midpoint.common.configuration.api.MidpointConfiguration) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) RepositoryDiag(com.evolveum.midpoint.schema.RepositoryDiag) LabeledString(com.evolveum.midpoint.schema.LabeledString) RepositoryService(com.evolveum.midpoint.repo.api.RepositoryService)

Example 4 with RepositoryDiag

use of com.evolveum.midpoint.schema.RepositoryDiag in project midpoint by Evolveum.

the class AbstractModelIntegrationTest method isH2.

// just guessing (good enough for testing)
protected boolean isH2() {
    Task task = createTask("isH2");
    RepositoryDiag diag = modelDiagnosticService.getRepositoryDiag(task, task.getResult());
    return diag.isEmbedded() || "org.h2.Driver".equals(diag.getDriverShortName());
}
Also used : Task(com.evolveum.midpoint.task.api.Task) RepositoryDiag(com.evolveum.midpoint.schema.RepositoryDiag)

Example 5 with RepositoryDiag

use of com.evolveum.midpoint.schema.RepositoryDiag in project midpoint by Evolveum.

the class PageAbout method loadRepoDiagModel.

private RepositoryDiag loadRepoDiagModel() {
    OperationResult result = new OperationResult(OPERATION_GET_REPO_DIAG);
    RepositoryDiag diag = null;
    try {
        Task task = createSimpleTask(OPERATION_GET_REPO_DIAG);
        diag = getModelDiagnosticService().getRepositoryDiag(task, result);
        result.recordSuccessIfUnknown();
    } catch (Exception ex) {
        LoggingUtils.logUnexpectedException(LOGGER, "Couldn't get repo diagnostics", ex);
        result.recordFatalError(getString("PageAbout.message.loadRepoDiagModel.fatalError"), ex);
    }
    result.recomputeStatus();
    if (!WebComponentUtil.isSuccessOrHandledError(result)) {
        showResult(result);
    }
    return diag;
}
Also used : Task(com.evolveum.midpoint.task.api.Task) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) RepositoryDiag(com.evolveum.midpoint.schema.RepositoryDiag) RestartResponseException(org.apache.wicket.RestartResponseException)

Aggregations

RepositoryDiag (com.evolveum.midpoint.schema.RepositoryDiag)5 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)4 Task (com.evolveum.midpoint.task.api.Task)4 Test (org.testng.annotations.Test)2 MidpointConfiguration (com.evolveum.midpoint.common.configuration.api.MidpointConfiguration)1 RepositoryService (com.evolveum.midpoint.repo.api.RepositoryService)1 LabeledString (com.evolveum.midpoint.schema.LabeledString)1 RestartResponseException (org.apache.wicket.RestartResponseException)1