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

Visit classes when passed as argument to methods. #6041

Merged
merged 3 commits into from
Jul 11, 2019
Merged

Conversation

manolo
Copy link
Member

@manolo manolo commented Jul 9, 2019

Fixes Dynamic Routes #5509
Fixes components instantiated in FactoryBeans #5658


This change is Reviewable

@project-bot project-bot bot added this to Review in progress in OLD Vaadin Flow ongoing work (Vaadin 10+) Jul 9, 2019
@manolo manolo self-assigned this Jul 9, 2019
@manolo manolo changed the title Visit classes when passed as argument to methods. WIP: Visit classes when passed as argument to methods. Jul 9, 2019
@mehdi-vaadin
Copy link
Contributor

Please check #5658 to see if it's resolved or not.

@manolo manolo changed the title WIP: Visit classes when passed as argument to methods. Visit classes when passed as argument to methods. Jul 10, 2019
@manolo manolo force-pushed the mcm/npm/dynamic-route branch 6 times, most recently from c7b4117 to e7e2098 Compare July 10, 2019 18:29
Copy link
Contributor

@ujoni ujoni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this change catch a situation where the user has, for some reason, a service class. Something like:

public class SomeView extends HorizontalLayoyt {
    public SomeView() {
        String userId = getUserId();
        UserRouteService.registerUserRoute(RouteConfiguration.forSessionScope(), userId);
    }
}

public class UserRouteService {
    public static void registerUserRoute(RouteConfiguration config, String userId) {
        config.setRoute(userId, UserView.class, null);
        // some logic
    }
}

The example is a bit forced, but regardless: would something like that be caught?

Reviewed 1 of 1 files at r2.
Reviewable status: all discussions resolved, 0 of 1 LGTMs obtained (waiting on @mehdi-vaadin and @ujoni)

Copy link
Member Author

@manolo manolo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When SomeView.class is visited because it's in a route, UserView.class should be visited as well.
Added a test that demonstrates it

Reviewable status: all discussions resolved, 0 of 1 LGTMs obtained (waiting on @mehdi-vaadin)

Copy link
Contributor

@mehdi-vaadin mehdi-vaadin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 of 1 files at r2.
Reviewable status: 3 unresolved discussions, 0 of 1 LGTMs obtained (waiting on @manolo and @mehdi-vaadin)


flow-server/src/test/java/com/vaadin/flow/server/frontend/scanner/ScannerDependenciesTest.java, line 130 at r2 (raw file):

should_visit_Constructor

Method names don't follow the naming convention. It should follow subjectOfTheTest_input_expectedOutput. E.g. for this case, the name of the method should be like grtFrontendDependencies_viewWithComponentsInCtor_depsShouldBeAdded.


flow-server/src/test/java/com/vaadin/flow/server/frontend/scanner/ScannerTestComponents.java, line 114 at r2 (raw file):

        public RouterLayout1() {
        }

What's the purpose of this?


flow-server/src/test/java/com/vaadin/flow/server/frontend/scanner/ScannerTestComponents.java, line 125 at r2 (raw file):

        public RouterLayout2(String a) {
        }

What's the purpose of this?

Copy link
Member Author

@manolo manolo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 3 unresolved discussions, 0 of 1 LGTMs obtained (waiting on @manolo and @mehdi-vaadin)


flow-server/src/test/java/com/vaadin/flow/server/frontend/scanner/ScannerDependenciesTest.java, line 130 at r2 (raw file):

Previously, mehdi-vaadin (Mehdi Javan) wrote…
should_visit_Constructor

Method names don't follow the naming convention. It should follow subjectOfTheTest_input_expectedOutput. E.g. for this case, the name of the method should be like grtFrontendDependencies_viewWithComponentsInCtor_depsShouldBeAdded.

There are many conventions for test names. I follow the ‘should’ one, the same used in may Vaadin products like Connect, Components, etc


flow-server/src/test/java/com/vaadin/flow/server/frontend/scanner/ScannerTestComponents.java, line 114 at r2 (raw file):

Previously, mehdi-vaadin (Mehdi Javan) wrote…
        public RouterLayout1() {
        }

What's the purpose of this?

Proly constructor was used for some case in the past and left empty after that. Removed but unrelated with this PR


flow-server/src/test/java/com/vaadin/flow/server/frontend/scanner/ScannerTestComponents.java, line 125 at r2 (raw file):

Previously, mehdi-vaadin (Mehdi Javan) wrote…
        public RouterLayout2(String a) {
        }

What's the purpose of this?

Done.

Copy link
Contributor

@ujoni ujoni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewed 2 of 3 files at r1, 1 of 2 files at r3.
Reviewable status: 3 unresolved discussions, 1 of 1 LGTMs obtained (waiting on @mehdi-vaadin and @ujoni)


flow-server/src/test/java/com/vaadin/flow/server/frontend/scanner/ScannerDependenciesTest.java, line 130 at r2 (raw file):

Previously, manolo (Manuel Carrasco Moñino) wrote…

There are many conventions for test names. I follow the ‘should’ one, the same used in may Vaadin products like Connect, Components, etc

The other tests seems to use should_somethingInCamelCase. Otherwise I am fine with this.

OLD Vaadin Flow ongoing work (Vaadin 10+) automation moved this from Review in progress to Reviewer approved Jul 11, 2019
Copy link
Contributor

@mehdi-vaadin mehdi-vaadin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewed 2 of 2 files at r3.
Reviewable status: :shipit: complete! all discussions resolved, 2 of 1 LGTMs obtained

@ujoni ujoni merged commit 41ff6ed into master Jul 11, 2019
OLD Vaadin Flow ongoing work (Vaadin 10+) automation moved this from Reviewer approved to Done - pending release Jul 11, 2019
@ujoni ujoni deleted the mcm/npm/dynamic-route branch July 11, 2019 13:26
@ujoni ujoni added this to the 2.0.3 milestone Jul 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
OLD Vaadin Flow ongoing work (Vaadin ...
  
Done - pending release
Development

Successfully merging this pull request may close these issues.

None yet

3 participants