Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WFCORE-7036] TransformationUtils.modelToResource() should not return… #6226

Merged
merged 2 commits into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,6 @@ private static Resource modelToResource(final PathAddress startAddress, final Im
}
allFields.remove(name);
}
if (!value.isDefined() && model.isDefined() && reg.getChildAddresses(PathAddress.EMPTY_ADDRESS).isEmpty()) {
value.setEmptyObject();
}
res.writeModel(value);

for (String childType : reg.getChildNames(PathAddress.EMPTY_ADDRESS)) {
if (model.hasDefined(childType)) {
Expand All @@ -113,6 +109,12 @@ private static Resource modelToResource(final PathAddress startAddress, final Im
allFields.remove(childType);
}

if (!value.isDefined() && model.isDefined() && (reg.getChildAddresses(PathAddress.EMPTY_ADDRESS).isEmpty() || res.getChildTypes().isEmpty())) {
value.setEmptyObject();
}
res.writeModel(value);


if (!allFields.isEmpty()){
throw ControllerLogger.ROOT_LOGGER.modelFieldsNotKnown(allFields, startAddress.append(fullPath));
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
* Copyright The WildFly Authors
* SPDX-License-Identifier: Apache-2.0
*
*/

package org.jboss.as.subsystem.test;

import org.jboss.as.controller.registry.ImmutableManagementResourceRegistration;
import org.jboss.as.controller.registry.Resource;
import org.jboss.dmr.ModelNode;

/**
* For tests to call package protected methods in this package
*/
public class InternalPackageProtectedAccess {
public static Resource modelToResource(final ImmutableManagementResourceRegistration reg, final ModelNode model, boolean includeUndefined) {
return TransformationUtils.modelToResource(reg, model, includeUndefined);
}
}
Loading
Loading