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
AF-1987: Create a client side version of all appformer gwt startup services #724
Conversation
cc @ederign @tiagobento would you please review this PR? Thanks. |
nativeRegisterGwtEditorProvider(); | ||
} | ||
|
||
private native void nativeRegisterGwtEditorProvider() /*-{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mind moving the native code to a separate class? Having it here decreases the readability of the ActivityBeansCache
presenter.addPart(workbenchPartPresenter); | ||
verify(placeManager).tryClosePlace(any(), any()); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lines
@Inherited | ||
@Retention(RetentionPolicy.RUNTIME) | ||
@Target({ElementType.METHOD}) | ||
public @interface GetContent { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please add JavaDoc for this annotation?
@Inherited | ||
@Retention(RetentionPolicy.RUNTIME) | ||
@Target({ElementType.METHOD}) | ||
public @interface SetContent { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please add JavaDoc for this annotation?
|
||
/** | ||
* | ||
* This annotation works like {@code @WorkbenchEditor}, and can be used for editors client side only editors. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
..used for editors client side only editors. -> ...used for client side only editors
public <U extends BasePreference<U>, T extends BasePreferencePortable<U>> void save(final T portablePreference, | ||
final Command successCallback, | ||
final ParameterizedCommand<Throwable> errorCallback) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick: maybe we could add comments on why save is not implemented here
@Inherited | ||
@Retention(RetentionPolicy.RUNTIME) | ||
@Target({ElementType.TYPE}) | ||
public @interface IsClientEditor { |
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
@Inherited | ||
@Retention(RetentionPolicy.RUNTIME) | ||
@Target({ElementType.TYPE}) | ||
public @interface IsTemplatePerspective { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we please add JavaDoc for these annotation?
* An Editor is an activity that is associated with a VFS path. It is expected that the editor will provide the end user | ||
* some means of editing and saving the resource represented by the VFS path. | ||
*/ | ||
public interface WorkbenchClientEditorActivity extends WorkbenchActivity { |
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
@@ -69,4 +69,6 @@ | |||
* Disable support to close parts. | |||
*/ | |||
void disableClosePart(); | |||
|
|||
void disableExpandPart(); |
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
|
||
String identifier = null; | ||
|
||
for (final AnnotationMirror am : classElement.getAnnotationMirrors()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
imho this for-cycle
could be extracted to a private method (getIdentifier
) for better readability
onStartup1ParameterMethodName = onStartupMethod.getSimpleName().toString(); | ||
} | ||
|
||
final String onMayCloseMethodName = GeneratorUtils.getOnMayCloseMethodName(classElement, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you could construct map of Map<String, ExecutableElement>
and then the following parts of code could just process this map in cycle. The map could be created in separate method for better readability.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I didn't understand exactly how this could be changed. I think the code for this was based on EditorActivityGenerator
. I could make some changes if you want. One example is this if/else to determine if there's a startup method and if it has params, it looks like a boolean logic to me, where 1 is the method name and 0 null, so:
startup exists startup has params noParam withParam
0 0 0 0
1 0 1 0
0 1 0 0
1 1 0 1
So the resulting code:
final String onStartup0ParameterMethodName = (onStartupMethod != null && onStartupMethod.getParameters().isEmpty()) ?
onStartupMethod.getSimpleName().toString()
: null;
final String onStartup1ParameterMethodName = (onStartupMethod != null && !onStartupMethod.getParameters().isEmpty()) ?
onStartupMethod.getSimpleName().toString()
: null;
which looks worse.
The whole method could be condensed in a map, and late a for in the map fill the methods accordingly, but I would vote to avoid change it because it is, as I said, based on EditorActivityGenerator. What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I meant something like this
Map<String, String> methodNameMap = ... // or ExecutableElement and you could call setContentMethod.getSimpleName().toString(); on each value of the map later
// but I see that GeneratorUtils is not uniform and returns String in some cases and ExecutableElement in others
map.put("onCloseMethodName", onCloseMethodName);
/** | ||
* A source code generator for Activities | ||
*/ | ||
public class ClientEditorActivityGenerator extends AbstractGenerator { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am missing test for this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also missed the test for this, however, I noticed that it is tested by the processor itself. The processor calls the activity generator and when testing it we can check the activity generator results from there ( see WorkbenchClientEditorProcessorTest). I did not find specific tests for Activity Generators, but I break this in smaller methods (as you mentioned above) and unit test them. Please let me know what you think about it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, I was thinking more unit level, like testing that calling generate with some values returns expected StringBuffer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But I see your point, would it be possible to extend it to cover Lines 87 - 92? those two branches are not covered.
qualifiers)); | ||
} | ||
|
||
//Validate getWidgetMethodName and isWidget |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion: we could validate all 6 cases, collect errors and only throw exception afterwards. Instead of fixing one problem at a time, you could fix them all at once.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, but as I said above, it is looks to be based on the EditorActivityGenerator hence I was resistant to modify this class specifically
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Imho, if we have an opportunity to improve, we should take it. Why copy old patterns when they can be improved?
After some closer code inspection I would leave this part as is and maybe improved the setup as i suggested here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left some comments to start with, once the build passes I will continue with local testing
I see enforcer rules issues, I am checking it locally and will update the PR soon and then trigger a new build |
@@ -66,4 +66,4 @@ errai.marshalling.serializableTypes=org.dashbuilder.dataprovider.StaticProviderT | |||
org.dashbuilder.dataset.sort.ColumnSort \ | |||
org.dashbuilder.dataset.sort.DataSetSort \ | |||
org.dashbuilder.dataset.sort.SortedList | |||
|
|||
errai.ioc.enabled.alternatives=org.uberfire.preferences.client.store.PreferenceBeanStoreClientImpl |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this work? I can be mistaken, but I think uberfire-security-client-backend
already has an alternative enabled for a PreferenceBeanStore
.. don't they conflict during GWT compilation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I remove it I have the following error:
Unsatisfied constructor dependency @Default org.uberfire.preferences.shared.bean.PreferenceBeanStore for Class @Any @org.uberfire.ext.preferences.client.central.tree.TreeView() org.uberfire.ext.preferences.client.central.tree.TreeHierarchyStructurePresenter. Some beans were found that satisfied this dependency, but must be enabled:
[INFO] org.uberfire.preferences.client.store.PreferenceBeanStoreClientImpl
I did change from uberfire-preference-client-backend
to uberfire-preference-client
, perhaps I should keep uberfire-preference-client-backend
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed by also adding uberfire-preference-client
dependency.
@domhanak Thanks for your comments, I addressed most of them in #373cbaa246c3f99ed80e62e0b297feca5a6c3472 I am not changing the I need also to test more apps with the changes (part of AF-2018), but if you see any issue please let me know. |
Jenkins execute full downstream build |
Jenkins execute full downstream build |
Jenkins please retest this |
Jenkins execute full downstream build |
Jenkins please retest this |
thanks @tiagobento |
@@ -296,6 +323,9 @@ private boolean activitySupportsPath(ActivityAndMetaInfo activity, Path path) { | |||
return new ArrayList<String>(activitiesById.keySet()); | |||
} | |||
|
|||
public void noOp() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A small comments inside of this method explaining it could help with readiability
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Does nothing, simulates...
Jenkins execute full downstream build |
Jenkins execute full downstream build |
jenkins retest this |
Looks like something is wrong. But I am not sure if it has something to do with the changes in the PR yet. |
The dashbuilder failures should probably be a lack of rebase. |
Jenkins execute full downstream build |
jenkins execute full downstream build |
I will trigger another build, but please notice that the failing tests seems unrelated |
Jenkins execute full downstream build |
These tests failed, but they don't look related to me.
@jesuino @ederign @domhanak If you agree, it looks good for me to merge. |
@tiagobento I also think that these tests failures are unrelated to this PR, hence I would vote to merge it - also merge all the other related PRs,please |
Jenkins execute full downstream build |
Testing failures are not related: org.jbpm.executor.impl.wih.AsyncContinuationSupportTest.testAsyncModeWithParallelGateway |
This is the work for AF-1987. Dependencies that requires a server side dependency have a
*-client-backend
version:Additional an annotation
@WorkbenchClientEditor
was created and a processor for this annotation generates the necessary activity.Later work (jesuino' commits) include fixing tests, fixing webapps and adding new tests to cover the processor and a new panel.
During our tests we found that the dependency
uberfire-preference-client-backend
should be added to the webapps so it will work correctly. Otherwise the webapp fails during GWT compilationThese are the PRs that must be merged with this:
kiegroup/kie-wb-common#2738
kiegroup/kie-wb-distributions#944
kiegroup/jbpm-wb#1365
kiegroup/drools-wb#1181
kiegroup/optaplanner-wb#340
This PR is declaring some new dependencies versions introduced by this PR: kiegroup/droolsjbpm-build-bootstrap#985