public static void checkModelAgainstDefinition(final ModelNode model, ManagementResourceRegistration rr) { checkModelAgainstDefinition(model, rr, new Stack<PathElement>()); }
Assert.assertNotNull("Could not load legacy dmr for subsystem '" + mainSubsystemName + "' version: '" + modelVersion + "' please add it", rd); ManagementResourceRegistration rr = ManagementResourceRegistration.Factory.forProcessType(getProcessType()).createRegistration(rd); ModelTestUtils.checkModelAgainstDefinition(transformed, rr); return legacyModel;
Assert.assertNotNull("Could not load legacy dmr for subsystem '" + mainSubsystemName + "' version: '" + modelVersion + "' please add it", rd); ManagementResourceRegistration rr = ManagementResourceRegistration.Factory.forProcessType(getProcessType()).createRegistration(rd); ModelTestUtils.checkModelAgainstDefinition(transformed, rr); return legacyModel;
/** * Checks that the transformed model is the same as the model built up in the legacy subsystem controller via the transformed operations, * and that the transformed model is valid according to the resource definition in the legacy subsystem controller. * * @param kernelServices the main kernel services * @param modelVersion the model version of the targetted legacy subsystem * @param legacyModelFixer use to touch up the model read from the legacy controller, use sparingly when the legacy model is just wrong. May be {@code null} * @return the whole model of the legacy controller */ ModelNode checkSubsystemModelTransformation(KernelServices kernelServices, ModelVersion modelVersion, ModelFixer legacyModelFixer) throws IOException { KernelServices legacy = kernelServices.getLegacyServices(modelVersion); ModelNode legacyModel = legacy.readWholeModel(); ModelNode legacySubsystem = legacyModel.require(SUBSYSTEM); legacySubsystem = legacySubsystem.require(mainSubsystemName); if (legacyModelFixer != null) { legacySubsystem = legacyModelFixer.fixModel(legacySubsystem); } //1) Check that the transformed model is the same as the whole model read from the legacy controller. //The transformed model is done via the resource transformers //The model in the legacy controller is built up via transformed operations ModelNode transformed = kernelServices.readTransformedModel(modelVersion).get(SUBSYSTEM, mainSubsystemName); ModelTestUtils.compare(legacySubsystem, transformed, true); //2) Check that the transformed model is valid according to the resource definition in the legacy subsystem controller ResourceDefinition rd = TransformerRegistry.loadSubsystemDefinitionFromFile(this.getClass(), mainSubsystemName, modelVersion); Assert.assertNotNull("Could not load legacy dmr for subsystem '" + mainSubsystemName + "' version: '" + modelVersion + "' please add it", rd); ManagementResourceRegistration rr = ManagementResourceRegistration.Factory.create(rd); ModelTestUtils.checkModelAgainstDefinition(transformed, rr); return legacyModel; }
if (value.isDefined()) { stack.push(pe); checkModelAgainstDefinition(value, sub, stack); stack.pop(); if (value.isDefined()) { stack.push(pe); checkModelAgainstDefinition(value, sub, stack); stack.pop();