use of com.evolveum.midpoint.xml.ns._public.common.common_3.XmlSchemaType in project midpoint by Evolveum.
the class TestDummyLegacy method test203LegacyTestResource.
@Test
public void test203LegacyTestResource() throws Exception {
// GIVEN
Task task = getTestTask();
OperationResult result = task.getResult();
// Check that there is no schema before test (pre-condition)
ResourceType resourceBefore = repositoryService.getObject(ResourceType.class, RESOURCE_DUMMY_LEGACY_OID, null, result).asObjectable();
assertNotNull("No connector ref", resourceBefore.getConnectorRef());
assertNotNull("No connector ref OID", resourceBefore.getConnectorRef().getOid());
ConnectorType connector = repositoryService.getObject(ConnectorType.class, resourceBefore.getConnectorRef().getOid(), null, result).asObjectable();
assertNotNull(connector);
XmlSchemaType xmlSchemaTypeBefore = resourceBefore.getSchema();
Element resourceXsdSchemaElementBefore = ResourceTypeUtil.getResourceXsdSchema(resourceBefore);
AssertJUnit.assertNull("Found schema before test connection. Bad test setup?", resourceXsdSchemaElementBefore);
// WHEN
OperationResult testResult = provisioningService.testResource(RESOURCE_DUMMY_LEGACY_OID, task);
// THEN
display("Test result", testResult);
OperationResult connectorResult = assertSingleConnectorTestResult(testResult);
assertTestResourceSuccess(connectorResult, ConnectorTestOperation.CONNECTOR_INITIALIZATION);
assertTestResourceSuccess(connectorResult, ConnectorTestOperation.CONNECTOR_CONFIGURATION);
assertTestResourceSuccess(connectorResult, ConnectorTestOperation.CONNECTOR_CONNECTION);
assertTestResourceSuccess(connectorResult, ConnectorTestOperation.CONNECTOR_CAPABILITIES);
assertSuccess(connectorResult);
assertTestResourceSuccess(testResult, ConnectorTestOperation.RESOURCE_SCHEMA);
assertSuccess(testResult);
PrismObject<ResourceType> resourceRepoAfter = repositoryService.getObject(ResourceType.class, RESOURCE_DUMMY_LEGACY_OID, null, result);
ResourceType resourceTypeRepoAfter = resourceRepoAfter.asObjectable();
display("Resource after test", resourceTypeRepoAfter);
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.XmlSchemaType in project midpoint by Evolveum.
the class ResourceCarefulAntUtil method createNewXmlSchemaDef.
private static SchemaDefinitionType createNewXmlSchemaDef(File resourceFile, int iteration, PrismContext prismContext) throws SchemaException {
PrismObject<ResourceType> resource = parseResource(resourceFile, prismContext);
XmlSchemaType schema = resource.asObjectable().getSchema();
SchemaDefinitionType def;
if (schema == null) {
def = new SchemaDefinitionType();
def.getAny().add(DOMUtil.createElement(DOMUtil.XSD_SCHEMA_ELEMENT));
} else {
def = schema.getDefinition();
// TODO: modify it somehow
}
return def;
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.XmlSchemaType in project midpoint by Evolveum.
the class UcfUtil method getConnectorSchema.
public static PrismSchema getConnectorSchema(ConnectorType connectorType, PrismContext prismContext) throws SchemaException {
XmlSchemaType xmlSchema = connectorType.getSchema();
if (xmlSchema == null) {
return null;
}
Element xsdElement = ObjectTypeUtil.findXsdElement(xmlSchema);
if (xsdElement == null) {
return null;
}
MutablePrismSchema connectorSchema = prismContext.schemaFactory().createPrismSchema(DOMUtil.getSchemaTargetNamespace(xsdElement));
connectorSchema.parseThis(xsdElement, true, connectorType.toString(), prismContext);
return connectorSchema;
}
Aggregations