use of com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowAttributesType in project midpoint by Evolveum.
the class AbstractTestForExchangeConnector method dumpAttributes.
protected void dumpAttributes(ShadowType shadowType) {
ShadowAttributesType attributes = shadowType.getAttributes();
System.out.println("Attributes for " + shadowType.getObjectClass().getLocalPart() + " " + getOrig(shadowType.getName()) + " {" + attributes.getAny().size() + " entries):");
for (Object item : attributes.getAny()) {
if (item instanceof Element) {
Element e = (Element) item;
System.out.println(" - " + e.getLocalName() + ": " + e.getTextContent());
} else if (item instanceof JAXBElement) {
JAXBElement je = (JAXBElement) item;
String typeInfo = je.getValue() instanceof String ? "" : (" (" + je.getValue().getClass().getSimpleName() + ")");
System.out.println(" - " + je.getName().getLocalPart() + ": " + je.getValue() + typeInfo);
} else {
System.out.println(" - " + item);
}
}
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowAttributesType in project midpoint by Evolveum.
the class AbstractTestForExchangeConnector method getAttributesAsMap.
protected Map<String, Object> getAttributesAsMap(ShadowType shadowType) {
Map<String, Object> rv = new HashMap<>();
ShadowAttributesType attributes = shadowType.getAttributes();
for (Object item : attributes.getAny()) {
if (item instanceof Element) {
Element e = (Element) item;
put(rv, e.getLocalName(), e.getTextContent());
} else if (item instanceof JAXBElement) {
JAXBElement je = (JAXBElement) item;
put(rv, je.getName().getLocalPart(), je.getValue());
} else {
// nothing to do here
}
}
return rv;
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowAttributesType in project midpoint by Evolveum.
the class AbstractTestForExchangeConnector method createGlobalAddressList.
protected String createGlobalAddressList(String name, String valueToExpect) throws FaultMessage {
Document doc = ModelClientUtil.getDocumnent();
ShadowType shadow = new ShadowType();
shadow.setName(ModelClientUtil.createPolyStringType(name, doc));
shadow.setResourceRef(createObjectReferenceType(ResourceType.class, getResourceOid()));
shadow.setObjectClass(OC_GLOBAL_ADDRESS_LIST);
shadow.setKind(ShadowKindType.GENERIC);
shadow.setIntent("global-address-list");
ShadowAttributesType attributes = new ShadowAttributesType();
attributes.getAny().add(ModelClientUtil.createTextElement(new QName(NS_ICFS, "name"), name, doc));
attributes.getAny().add(ModelClientUtil.createTextElement(new QName(NS_RI, "RecipientFilter"), galFilter(valueToExpect), doc));
shadow.setAttributes(attributes);
return createShadow(shadow);
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowAttributesType in project midpoint by Evolveum.
the class TestExchangeConnectorLow method test220ModifyingNonexistingAccount.
@Test
public void test220ModifyingNonexistingAccount() 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_ACCOUNT);
shadow.setKind(ShadowKindType.ACCOUNT);
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"), "CN=wrong-GUID," + getContainer(), 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...");
ObjectDeltaOperationType odo = modifyObject(ShadowType.class, oid, "attributes/sn", ModificationTypeType.REPLACE, "xxxxxx", 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.ShadowAttributesType in project midpoint by Evolveum.
the class AbstractTestForExchangeConnector method createAddressList.
protected String createAddressList(String name, String valueToExpect, AddressListType type) throws FaultMessage {
Document doc = ModelClientUtil.getDocumnent();
ShadowType shadow = new ShadowType();
shadow.setName(ModelClientUtil.createPolyStringType(name, doc));
shadow.setResourceRef(createObjectReferenceType(ResourceType.class, getResourceOid()));
shadow.setObjectClass(OC_ADDRESS_LIST);
shadow.setKind(ShadowKindType.GENERIC);
shadow.setIntent(type.getIntent());
ShadowAttributesType attributes = new ShadowAttributesType();
attributes.getAny().add(ModelClientUtil.createTextElement(new QName(NS_ICFS, "name"), name, doc));
attributes.getAny().add(ModelClientUtil.createTextElement(new QName(NS_RI, "RecipientFilter"), type.createFilter(valueToExpect), doc));
shadow.setAttributes(attributes);
return createShadow(shadow);
}
Aggregations