Uploaded image for project: 'Spring Tool Suite'
  1. Spring Tool Suite
  2. STS-1209

Grails: Refactor of Domain class doesn't update controller or unit test files

    Details

    • Type: Task
    • Status: Resolved
    • Priority: Major
    • Resolution: Duplicate
    • Affects Version/s: 2.3.3.M2
    • Fix Version/s: 2.5.0.RC1
    • Component/s: GRAILS
    • Labels:
      None
    • Environment:
      Windows 7

      Description

      While trying to refactor Domain classes (Class name change), I noticed that unit test files and controllers are not refactored as well.

        Activity

        Hide
        aeisenberg Andrew Eisenberg added a comment -

        Can you please be more specific?

        Are you seeing that references to the original Domain Class are not being updated, or are you expecting that when a Domain class is renamed, its associated controller, views, taglib, etc, should be renamed as well?

        A concrete example would be helpful.

        Show
        aeisenberg Andrew Eisenberg added a comment - Can you please be more specific? Are you seeing that references to the original Domain Class are not being updated, or are you expecting that when a Domain class is renamed, its associated controller, views, taglib, etc, should be renamed as well? A concrete example would be helpful.
        Hide
        hzaccak Henry Zaccak added a comment - - edited

        When I do a Refactor (ex. rename Auto.groovy to Car.groovy) of a Domain class I see the following behavior:

        1. The Groovy Class name is updated and all references (in other domain classes) are updated to the new class name. (File is now Car.groovy) This is working correctly.
        2. The Controller is not renamed (AutoController.groovy is not changed to CarController.groovy).
        3. The unit tests for the domain class are not updated (AutoTest.groovy is not renamed to CarTest.groovy)
        ...etc

        I believe that a refactor should update all references (associated controller, views, taglib, etc,) and not just the domain references.

        Thanks,
        Henry

        Show
        hzaccak Henry Zaccak added a comment - - edited When I do a Refactor (ex. rename Auto.groovy to Car.groovy) of a Domain class I see the following behavior: 1. The Groovy Class name is updated and all references (in other domain classes) are updated to the new class name. (File is now Car.groovy) This is working correctly. 2. The Controller is not renamed (AutoController.groovy is not changed to CarController.groovy). 3. The unit tests for the domain class are not updated (AutoTest.groovy is not renamed to CarTest.groovy) ...etc I believe that a refactor should update all references (associated controller, views, taglib, etc,) and not just the domain references. Thanks, Henry
        Hide
        aeisenberg Andrew Eisenberg added a comment -

        This is a duplicate of STS-1180 and STS-1181.

        Show
        aeisenberg Andrew Eisenberg added a comment - This is a duplicate of STS-1180 and STS-1181 .

          People

          • Assignee:
            Unassigned
            Reporter:
            hzaccak Henry Zaccak
          • Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: