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