private void compareChildren(CompareContext context) { Set<String> legacyChildTypes = context.getLegacyDefinition().getChildTypes(); Set<String> currentChildTypes = context.getCurrentDefinition().getChildTypes(); compareSetsAndRemoveMissing(context, "child types", currentChildTypes, legacyChildTypes); for (String type : legacyChildTypes) { Map<String, ModelNode> legacyChildren = context.getLegacyDefinition().getChildren(type); Map<String, ModelNode> currentChildren = context.getCurrentDefinition().getChildren(type); compareKeySetsAndRemoveMissing( context, "child names for type=" + type, currentChildren, legacyChildren); for (Map.Entry<String, ModelNode> legacyChildEntry : legacyChildren.entrySet()) { String name = legacyChildEntry.getKey(); ModelNode legacyChildDescription = legacyChildEntry.getValue(); ModelNode currentChildDescription = currentChildren.get(name); CompareContext childContext; try { childContext = new CompareContext( context.getRootAddress(), context.getPathAddress().append(PathElement.pathElement(type, name)), context.isCore(), new ResourceDefinition(currentChildDescription, currentModelVersions), new ResourceDefinition(legacyChildDescription, legacyModelVersions)); } catch (RuntimeException e) { System.out.println(context.getPathAddress() + " + " + type + "=" + name); throw e; } compareModel(childContext); } } }
private void compareOperations(CompareContext context) { Map<String, ModelNode> legacyOperations = context.getLegacyDefinition().getOperations(); Map<String, ModelNode> currentOperations = context.getCurrentDefinition().getOperations(); compareKeySetsAndRemoveMissing(context, "operations", currentOperations, legacyOperations); for (Map.Entry<String, ModelNode> legacyOpEntry : legacyOperations.entrySet()) { String operationName = legacyOpEntry.getKey(); ModelNode legacyOperation = legacyOpEntry.getValue(); ModelNode currentOperation = currentOperations.get(operationName); Map<String, ModelNode> legacyParameters = context.getLegacyDefinition().getOperationParameters(operationName); Map<String, ModelNode> currentParameters = context.getCurrentDefinition().getOperationParameters(operationName); compareKeySetsAndRemoveMissing( context, "parameters for operation '" + operationName + "'", currentParameters, legacyParameters); for (Map.Entry<String, ModelNode> legacyParamEntry : legacyParameters.entrySet()) { ModelNode legacyParameter = legacyParamEntry.getValue(); ModelNode currentParameter = currentParameters.get(legacyParamEntry.getKey()); String id = "parameter '" + legacyParamEntry.getKey() + "' of operation '" + operationName + "'"; compareAttributeOrOperationParameter(context, id, currentParameter, legacyParameter); } ModelNode legacyReply = legacyOperation.get(REPLY_PROPERTIES); ModelNode currentReply = currentOperation.get(REPLY_PROPERTIES); compareAttributeOrOperationParameter( context, "'reply-properties' for operation '" + operationName + "'", currentReply, legacyReply); // if (!currentReply.equals(legacyReply)) { // context.println("Different 'reply-properties' for operation '" + // operationName + "'. Current: " + currentReply + "; legacy: " + legacyReply); // } } }
private void compareAttributes(CompareContext context) { Map<String, ModelNode> legacyAttributes = context.getLegacyDefinition().getAttributes(); Map<String, ModelNode> currentAttributes = context.getCurrentDefinition().getAttributes(); compareKeySetsAndRemoveMissing(context, "attributes", currentAttributes, legacyAttributes); // TODO compare types, expressions etc. for (Map.Entry<String, ModelNode> legacyEntry : legacyAttributes.entrySet()) { ModelNode legacyAttribute = legacyEntry.getValue(); ModelNode currentAttribute = currentAttributes.get(legacyEntry.getKey()); String id = "attribute '" + legacyEntry.getKey() + "'"; compareAttributeOrOperationParameter(context, id, currentAttribute, legacyAttribute); compareAccessType(context, id, currentAttribute, legacyAttribute); compareStorage(context, id, currentAttribute, legacyAttribute); compareDefault(context, id, currentAttribute, legacyAttribute); } }