private void appendTraceHeader( StringBuilder sb, ExpressionEvaluationContext context, ExpressionVariables processedVariables) { sb.append("---[ EXPRESSION in "); sb.append(context.getContextDescription()); sb.append("]---------------------------"); sb.append("\nSources:"); Collection<Source<?, ?>> sources = context.getSources(); if (sources == null) { sb.append(" null"); } else { for (Source<?, ?> source : sources) { sb.append("\n"); sb.append(source.debugDump(1)); } } sb.append("\nVariables:"); if (processedVariables == null) { sb.append(" null"); } else { sb.append("\n"); sb.append(processedVariables.debugDump(1)); } sb.append("\nOutput definition: ").append(MiscUtil.toString(outputDefinition)); sb.append("\nEvaluators: "); sb.append(shortDebugDump()); }
private OperationResult findSimilarSubresult(OperationResult subresult) { OperationResult similar = null; for (OperationResult sub : getSubresults()) { if (sub == subresult) { continue; } if (!sub.operation.equals(subresult.operation)) { continue; } if (sub.status != subresult.status) { continue; } if (!MiscUtil.equals(sub.message, subresult.message)) { continue; } if (similar == null || (similar.count < sub.count)) { similar = sub; } } return similar; }
private void mergeMap(Map<String, Serializable> targetMap, Map<String, Serializable> sourceMap) { for (Entry<String, Serializable> targetEntry : targetMap.entrySet()) { String targetKey = targetEntry.getKey(); Serializable targetValue = targetEntry.getValue(); if (targetValue != null && targetValue instanceof VariousValues) { continue; } Serializable sourceValue = sourceMap.get(targetKey); if (MiscUtil.equals(targetValue, sourceValue)) { // Entries match, nothing to do continue; } // Entries do not match. The target entry needs to be marked as VariousValues targetEntry.setValue(new VariousValues()); } for (Entry<String, Serializable> sourceEntry : sourceMap.entrySet()) { String sourceKey = sourceEntry.getKey(); if (!targetMap.containsKey(sourceKey)) { targetMap.put(sourceKey, new VariousValues()); } } }
@Override public void initSystem(Task initTask, OperationResult initResult) throws Exception { super.initSystem(initTask, initResult); LOGGER.trace("initSystem"); // Resources File targetDir = new File(TEST_TARGET_DIR); if (!targetDir.exists()) { targetDir.mkdirs(); } MiscUtil.copyFile(new File(BROKEN_CSV_SOURCE_FILE_NAME), new File(BROKEN_CSV_TARGET_FILE_NAME)); repoAddObjectFromFile(CONNECTOR_DUMMY_NOJARS_FILENAME, ConnectorType.class, initResult); dummyResourceCtl = DummyResourceContoller.create(null); dummyResourceCtl.extendSchemaPirate(); dummyResource = dummyResourceCtl.getDummyResource(); resourceDummy = importAndGetObjectFromFile( ResourceType.class, RESOURCE_DUMMY_FILE, RESOURCE_DUMMY_OID, initTask, initResult); resourceDummyType = resourceDummy.asObjectable(); dummyResourceCtl.setResource(resourceDummy); importObjectFromFile(RESOURCE_CSVFILE_BROKEN_FILENAME, initResult); importObjectFromFile(RESOURCE_CSVFILE_NOTFOUND_FILENAME, initResult); importObjectFromFile(RESOURCE_DUMMY_NOJARS_FILENAME, initResult); // Accounts repoAddObjectFromFile(ACCOUNT_SHADOW_MURRAY_CSVFILE_FILENAME, ShadowType.class, initResult); // Users userTypeJack = repoAddObjectFromFile(USER_JACK_FILE, UserType.class, initResult).asObjectable(); assumeAssignmentPolicy(AssignmentPolicyEnforcementType.NONE); }
private void assertEquals( String message, Object expected, Object actual, OperationResult result) { if (!MiscUtil.equals(expected, actual)) { fail(message + "; expected " + expected + ", actual " + actual, result); } }
/** * Returns all values regardless of whether they are added or removed or replaced. Useful for * iterating over all the changed values. */ public <T> Collection<PrismPropertyValue<T>> getValues(Class<T> type) { if (valuesToReplace != null) { return (Collection) valuesToReplace; } return (Collection) MiscUtil.union(valuesToAdd, valuesToDelete); }