use of com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType in project midpoint by Evolveum.
the class AbstractDummyTest method initSystem.
@Override
public void initSystem(Task initTask, OperationResult initResult) throws Exception {
// We need to switch off the encryption checks. Some values cannot be encrypted as we do
// not have a definition here
InternalsConfig.encryptionChecks = false;
provisioningService.postInit(initResult);
resource = addResourceFromFile(getResourceDummyFilename(), IntegrationTestTools.DUMMY_CONNECTOR_TYPE, initResult);
resourceType = resource.asObjectable();
dummyResourceCtl = DummyResourceContoller.create(null);
dummyResourceCtl.setResource(resource);
dummyResourceCtl.extendSchemaPirate();
dummyResource = dummyResourceCtl.getDummyResource();
extraDummyResourceInit();
DummyAccount dummyAccountDaemon = new DummyAccount(ACCOUNT_DAEMON_USERNAME);
dummyAccountDaemon.setEnabled(true);
dummyAccountDaemon.addAttributeValues("fullname", "Evil Daemon");
dummyResource.addAccount(dummyAccountDaemon);
daemonIcfUid = dummyAccountDaemon.getId();
PrismObject<ShadowType> shadowDaemon = PrismTestUtil.parseObject(ACCOUNT_DAEMON_FILE);
if (!isIcfNameUidSame()) {
setIcfUid(shadowDaemon, dummyAccountDaemon.getId());
}
repositoryService.addObject(shadowDaemon, null, initResult);
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType in project midpoint by Evolveum.
the class AbstractDummyTest method rememberConnectorInstance.
protected void rememberConnectorInstance(PrismObject<ResourceType> resource) throws ObjectNotFoundException, SchemaException, CommunicationException, ConfigurationException {
OperationResult result = new OperationResult(TestDummyResourceAndSchemaCaching.class.getName() + ".rememberConnectorInstance");
rememberConnectorInstance(resourceManager.getConfiguredConnectorInstance(resource, ReadCapabilityType.class, false, result));
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType in project midpoint by Evolveum.
the class AbstractBasicDummyTest method test000Integrity.
@Test
public void test000Integrity() throws Exception {
final String TEST_NAME = "test000Integrity";
TestUtil.displayTestTile(TEST_NAME);
display("Dummy resource instance", dummyResource.toString());
assertNotNull("Resource is null", resource);
assertNotNull("ResourceType is null", resourceType);
OperationResult result = new OperationResult(AbstractBasicDummyTest.class.getName() + "." + TEST_NAME);
ResourceType resource = repositoryService.getObject(ResourceType.class, RESOURCE_DUMMY_OID, null, result).asObjectable();
String connectorOid = resource.getConnectorRef().getOid();
ConnectorType connector = repositoryService.getObject(ConnectorType.class, connectorOid, null, result).asObjectable();
assertNotNull(connector);
display("Dummy Connector", connector);
result.computeStatus();
display("getObject result", result);
TestUtil.assertSuccess(result);
// Check connector schema
IntegrationTestTools.assertConnectorSchemaSanity(connector, prismContext);
IntegrationTestTools.assertNoSchema(resource);
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType in project midpoint by Evolveum.
the class AbstractBasicDummyTest method test021Configuration.
@Test
public void test021Configuration() throws Exception {
final String TEST_NAME = "test021Configuration";
TestUtil.displayTestTile(TEST_NAME);
// GIVEN
OperationResult result = new OperationResult(AbstractBasicDummyTest.class.getName() + "." + TEST_NAME);
// WHEN
resource = provisioningService.getObject(ResourceType.class, RESOURCE_DUMMY_OID, null, null, result);
resourceType = resource.asObjectable();
// THEN
result.computeStatus();
display("getObject result", result);
TestUtil.assertSuccess(result);
// There may be one parse. Previous test have changed the resource version
// Schema for this version will not be re-parsed until getObject is tried
assertResourceSchemaParseCountIncrement(1);
assertResourceCacheMissesIncrement(1);
PrismContainer<Containerable> configurationContainer = resource.findContainer(ResourceType.F_CONNECTOR_CONFIGURATION);
assertNotNull("No configuration container", configurationContainer);
PrismContainerDefinition confContDef = configurationContainer.getDefinition();
assertNotNull("No configuration container definition", confContDef);
PrismContainer confingurationPropertiesContainer = configurationContainer.findContainer(SchemaConstants.CONNECTOR_SCHEMA_CONFIGURATION_PROPERTIES_ELEMENT_QNAME);
assertNotNull("No configuration properties container", confingurationPropertiesContainer);
PrismContainerDefinition confPropsDef = confingurationPropertiesContainer.getDefinition();
assertNotNull("No configuration properties container definition", confPropsDef);
List<PrismProperty<?>> configurationProperties = confingurationPropertiesContainer.getValue().getItems();
assertFalse("No configuration properties", configurationProperties.isEmpty());
for (PrismProperty<?> confProp : configurationProperties) {
PrismPropertyDefinition confPropDef = confProp.getDefinition();
assertNotNull("No definition for configuration property " + confProp, confPropDef);
assertFalse("Configuration property " + confProp + " is raw", confProp.isRaw());
assertConfigurationProperty(confProp);
}
// The useless configuration variables should be reflected to the resource now
assertEquals("Wrong useless string", "Shiver me timbers!", dummyResource.getUselessString());
assertEquals("Wrong guarded useless string", "Dead men tell no tales", dummyResource.getUselessGuardedString());
resource.checkConsistence();
rememberSchemaMetadata(resource);
rememberConnectorInstance(resource);
assertSteadyResource();
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType in project midpoint by Evolveum.
the class TestSanityLegacy method test006reimportResourceDummy.
@Test
public void test006reimportResourceDummy() throws Exception {
TestUtil.displayTestTile("test006reimportResourceDummy");
//get object from repo (with version set and try to add it - it should be re-added, without error)
OperationResult repoResult = new OperationResult("getObject");
PrismObject<ResourceType> resource = repositoryService.getObject(ResourceType.class, RESOURCE_DUMMY_OID, null, repoResult);
assertNotNull(resource);
ModelExecuteOptionsType options = new ModelExecuteOptionsType();
options.setOverwrite(Boolean.TRUE);
options.setIsImport(Boolean.TRUE);
addObjectViaModelWS(resource.asObjectable(), options, new Holder<String>(), new Holder<OperationResultType>());
//TODO: add some asserts
//parse object from file again and try to add it - this should fail, becasue the same object already exists)
resource = PrismTestUtil.parseObject(new File(RESOURCE_DUMMY_FILENAME));
try {
Holder<OperationResultType> resultHolder = new Holder<OperationResultType>();
options = new ModelExecuteOptionsType();
options.setIsImport(Boolean.TRUE);
addObjectViaModelWS(resource.asObjectable(), options, new Holder<String>(), resultHolder);
OperationResultType result = resultHolder.value;
TestUtil.assertFailure(result);
fail("Expected object already exists exception, but haven't got one.");
} catch (FaultMessage ex) {
LOGGER.info("fault {}", ex.getFaultInfo());
LOGGER.info("fault {}", ex.getCause());
if (ex.getFaultInfo() instanceof ObjectAlreadyExistsFaultType) {
// this is OK, we expect this
} else {
fail("Expected object already exists exception, but haven't got one.");
}
}
// ResourceType resourceType = uObject.asObjectable();
// assertNotNull("Reference on the connector must not be null in resource.",resourceType.getConnectorRef());
// assertNotNull("Missing oid reference on the connector",resourceType.getConnectorRef().getOid());
}
Aggregations