[forge-dev] Interesting behavior of CommandController (bug or feature ; ))
Ivan St. Ivanov
ivan.st.ivanov at gmail.com
Fri Jul 3 16:31:51 EDT 2015
Hey George,
Thanks for your answer! :)
Well, maybe I am mismatching two concepts. So, my command that
implements PrerequisiteCommandsProvider
does this:
@Override
public NavigationResult getPrerequisiteCommands(UIContext context) {
NavigationResultBuilder builder = NavigationResultBuilder.create();
builder.add(ServletSetupWizard.class);
return builder.build();
}
Then, just before I execute the command controller thing, I install the
Servlet facet for the corresponding Servlet version.
But most probably installing a facet does not disable the prerequisite
command?
Cheers,
Ivan
On Fri, Jul 3, 2015 at 5:23 PM, George Gastaldi <ggastald at redhat.com> wrote:
> Hi Ivan,
>
> Glad you decided to resume your work on the servlet security addon.
>
> When your command use a PreRequisiteCommandProvider, the initial step
> might not be your command in question, but the commands to be executed
> before that. That's why your setValueFor method might fail.
>
> What are the inputs returned in your test after you call initialize()
> (commandController.getInputs()) ?
>
> Best Regards,
>
> George Gastaldi
>
>
> On 07/03/2015 09:36 AM, Ivan St. Ivanov wrote:
>
> Hi everybody,
>
> Believe it or not, but I resumed my work on the Servlet Security addon
> for Forge (https://issues.jboss.org/browse/FORGEPLUGINS-152) :)
>
> And I found something that I don't know whether is a bug or a feature.
> If my Command class implements the PrerequisiteCommandsProvider and if I
> try to use the CommandController in my integration test, then I have a
> problem. Here is a sample code:
>
> try (CommandController commandController = testHarness
> .createCommandController(SecuritySetupCommand.class,
> project.getRoot()))
> {
> commandController.initialize();
> commandController.setValueFor("securityRealm", realm);
> commandController.setValueFor("authMethod", authenticationMethod);
> commandController.execute();
> }
>
> This code fails at the setValueFor method simply because the UI was not
> initialized in the initialize method above it and there are no such inputs
> like securityRealm and authMethod.
>
> I did some debugging and found that if SecuritySetupCommand implements
> the PrerequisiteCommandsProvider interface, the
> commandController.initialize() method does not
> call PrerequisiteCommandsProvider#initializeUI method. Instead it
> triggeres PrerequisiteCommandTransformer.DelegateWizard#initializeUI. Which
> is empty and does nothing. And that's the reason why there are no
> securityRealm and authMethod controls.
>
> I guess that it is caused by some CDI "magic"? So I wonder is it a bug
> or a feature? Can I use CommandController to test commands that implement
> PrerequisiteCommandsProvider?
>
> Thanks,
> Ivan
>
>
> _______________________________________________
> forge-dev mailing listforge-dev at lists.jboss.orghttps://lists.jboss.org/mailman/listinfo/forge-dev
>
>
>
> _______________________________________________
> forge-dev mailing list
> forge-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/forge-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/forge-dev/attachments/20150703/5527b351/attachment-0001.html
More information about the forge-dev
mailing list