<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Hi Ivan,<br>
<br>
Glad you decided to resume your work on the servlet security addon.
<br>
<br>
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.
<br>
<br>
What are the inputs returned in your test after you call
initialize() (commandController.getInputs()) ? <br>
<br>
Best Regards,<br>
<br>
George Gastaldi<br>
<br>
<div class="moz-cite-prefix">On 07/03/2015 09:36 AM, Ivan St. Ivanov
wrote:<br>
</div>
<blockquote
cite="mid:CACYLA9EQDXUeb+nH5QQdL85qdAUmGcM3=70ztece+PbCWwCzSw@mail.gmail.com"
type="cite">
<div dir="ltr">Hi everybody,
<div><br>
</div>
<div>Believe it or not, but I resumed my work on the Servlet
Security addon for Forge (<a moz-do-not-send="true"
href="https://issues.jboss.org/browse/FORGEPLUGINS-152"
target="_blank">https://issues.jboss.org/browse/FORGEPLUGINS-152</a>)
:)</div>
<div><br>
</div>
<div>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:</div>
<div><br>
</div>
<div>
<div>try (CommandController commandController = testHarness</div>
<div>
.createCommandController(SecuritySetupCommand.class,
project.getRoot()))</div>
<div> {</div>
<div> commandController.initialize();</div>
<div> commandController.setValueFor("securityRealm",
realm);</div>
<div> commandController.setValueFor("authMethod",
authenticationMethod);</div>
<div> commandController.execute();</div>
<div> }</div>
</div>
<div><br>
</div>
<div>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.</div>
<div><br>
</div>
<div>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.</div>
<div><br>
</div>
<div>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?</div>
<div><br>
</div>
<div>Thanks,</div>
<div>Ivan</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
forge-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:forge-dev@lists.jboss.org">forge-dev@lists.jboss.org</a>
<a class="moz-txt-link-freetext" href="https://lists.jboss.org/mailman/listinfo/forge-dev">https://lists.jboss.org/mailman/listinfo/forge-dev</a></pre>
</blockquote>
<br>
</body>
</html>