use of com.evolveum.midpoint.xml.ns._public.common.common_3.ModelExecuteOptionsType in project midpoint by Evolveum.
the class AbstractTestForExchangeConnector method createRaw.
protected ModelExecuteOptionsType createRaw() {
ModelExecuteOptionsType options = new ModelExecuteOptionsType();
options.setRaw(true);
return options;
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.ModelExecuteOptionsType in project midpoint by Evolveum.
the class AbstractTestForExchangeConnector method modifyObject.
// values: path -> value or collection of values
protected ObjectDeltaOperationType modifyObject(Class objectType, String oid, ModificationTypeType modType, Map<String, Object> values, ModelExecuteOptionsType optionsType, boolean assertSuccess) throws Exception {
System.out.println("Modifying " + objectType.getSimpleName() + " " + oid + " (values: " + values + ")");
ObjectDeltaType deltaType = new ObjectDeltaType();
deltaType.setObjectType(ModelClientUtil.getTypeQName(objectType));
deltaType.setChangeType(ChangeTypeType.MODIFY);
deltaType.setOid(oid);
for (Map.Entry<String, Object> entry : values.entrySet()) {
ItemDeltaType itemDelta = new ItemDeltaType();
itemDelta.setModificationType(modType);
itemDelta.setPath(createNonDefaultItemPathType(entry.getKey()));
if (!(entry.getValue() instanceof Collection)) {
itemDelta.getValue().add(entry.getValue());
} else {
itemDelta.getValue().addAll((Collection) (entry.getValue()));
}
deltaType.getItemDelta().add(itemDelta);
}
ObjectDeltaListType deltaListType = new ObjectDeltaListType();
deltaListType.getDelta().add(deltaType);
ObjectDeltaOperationListType odolist = modelPort.executeChanges(deltaListType, optionsType);
return assertExecuteChangesSuccess(odolist, deltaType, assertSuccess);
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.ModelExecuteOptionsType in project midpoint by Evolveum.
the class AbstractTestForExchangeConnector method createObject.
protected String createObject(Class clazz, ObjectType objectType, ModelExecuteOptionsType options, boolean assertSuccess) throws FaultMessage {
ObjectDeltaType deltaType = new ObjectDeltaType();
deltaType.setObjectType(ModelClientUtil.getTypeQName(clazz));
deltaType.setChangeType(ChangeTypeType.ADD);
deltaType.setObjectToAdd(objectType);
ObjectDeltaListType deltaListType = new ObjectDeltaListType();
deltaListType.getDelta().add(deltaType);
ObjectDeltaOperationListType operationListType = modelPort.executeChanges(deltaListType, options);
lastOdo = assertExecuteChangesSuccess(operationListType, null, assertSuccess);
// }
return ModelClientUtil.getOidFromDeltaOperationList(operationListType, deltaType);
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.ModelExecuteOptionsType in project midpoint by Evolveum.
the class TestExchangeConnectorLow method test210ModifyingNonexistingPowerShellObject.
@Test
public void test210ModifyingNonexistingPowerShellObject() throws Exception {
// create shadow with non-existing GUID
System.out.println("Creating shadow with non-existing GUID...");
Document doc = ModelClientUtil.getDocumnent();
String name = "Wrong GUID shadow";
ShadowType shadow = new ShadowType();
shadow.setName(ModelClientUtil.createPolyStringType(name, doc));
shadow.setResourceRef(createObjectReferenceType(ResourceType.class, getResourceOid()));
shadow.setObjectClass(OC_ACCEPTED_DOMAIN);
shadow.setKind(ShadowKindType.GENERIC);
shadow.setIntent("custom-accepted-domain");
ShadowAttributesType attributes = new ShadowAttributesType();
attributes.getAny().add(ModelClientUtil.createTextElement(new QName(NS_ICFS, "name"), name, doc));
attributes.getAny().add(ModelClientUtil.createTextElement(new QName(NS_ICFS, "uid"), "wrong-GUID", doc));
shadow.setAttributes(attributes);
String oid = createObject(ShadowType.class, shadow, createRaw());
System.out.println("Done, reading it back...");
ShadowType shadowReadAgain = getObjectNoFetch(ShadowType.class, oid);
dumpAttributes(shadowReadAgain);
System.out.println("Now launching modifyObject operation...");
//Class objectType, String oid, String path, ModificationTypeType modType, Object value, ModelExecuteOptionsType optionsType, boolean assertSuccess
ObjectDeltaOperationType odo = modifyObject(ShadowType.class, oid, "attributes/DomainType", ModificationTypeType.REPLACE, "InternalRelay", null, false);
OperationResultType r = odo.getExecutionResult();
System.out.println("Done: " + r.getStatus() + ":" + r.getMessage());
OperationResultType found = findOperationResult(r, new OperationResultMatcher() {
@Override
public boolean match(OperationResultType r) {
return r.getDetails() != null && r.getDetails().contains("UnknownUidException");
}
});
AssertJUnit.assertNotNull("UnknownUidException was not detected", found);
System.out.println("======================================================================================================");
System.out.println("Details: " + found.getDetails());
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.ModelExecuteOptionsType in project midpoint by Evolveum.
the class TestSanityLegacy method test005resolveConnectorRef.
@Test
public void test005resolveConnectorRef() throws Exception {
TestUtil.displayTestTile("test005resolveConnectorRef");
PrismObject<ResourceType> resource = PrismTestUtil.parseObject(new File(RESOURCE_DUMMY_FILENAME));
ModelExecuteOptionsType options = new ModelExecuteOptionsType();
options.setIsImport(Boolean.TRUE);
addObjectViaModelWS(resource.asObjectable(), options, new Holder<String>(), new Holder<OperationResultType>());
OperationResult repoResult = new OperationResult("getObject");
PrismObject<ResourceType> uObject = repositoryService.getObject(ResourceType.class, RESOURCE_DUMMY_OID, null, repoResult);
assertNotNull(uObject);
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