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

Object not set to instance of object #2215

Merged
merged 14 commits into from
Jul 26, 2024
Merged

Conversation

MrHinsh
Copy link
Member

@MrHinsh MrHinsh commented Jul 26, 2024

  1. Wrapped TrackException in Catch!
  2. Removed Duplicate Version Detection
  3. Stop Crash on version detection with no Git.
  4. Added Unit tests for MigrationToolVersion
  5. Removes TelemetryClient as per AI documentation
  6. Rename WorkItemUpdate to WorkItemBulkEditProcessor

…g and exit

The change replaces a thrown exception with a critical log message and a call to `System.Environment.Exit(-1)`. This ensures that the application logs the critical error before terminating, providing better diagnostics and a clearer shutdown process.
…BulkEditProcessorConfig

Refactor the documentation to replace references to WorkItemUpdateConfig with WorkItemBulkEditProcessorConfig. This change ensures that the documentation accurately reflects the current configuration class names and their associated properties. Additionally, update the Git metadata to reflect the latest commit and branch information. This improves clarity and accuracy in the documentation, making it easier for users to understand and configure the migration tools.

📝 (docs): add documentation for WorkItemBulkEditProcessor

♻️ (config): rename WorkItemUpdateConfig to WorkItemBulkEditProcessorConfig

♻️ (processor): rename WorkItemUpdate to WorkItemBulkEditProcessor

💡 (comments): update comments to reflect new class names

The documentation for the `WorkItemBulkEditProcessor` is added to provide users with configuration details and usage examples. The class `WorkItemUpdateConfig` is renamed to `WorkItemBulkEditProcessorConfig` to better reflect its purpose. Similarly, the processor class `WorkItemUpdate` is renamed to `WorkItemBulkEditProcessor` for consistency. Comments and references in the code are updated to match the new class names, improving code readability and maintainability.
…k items

Introduce `WorkItemBulkEditProcessor` and its configuration class
`WorkItemBulkEditProcessorConfig`. This processor allows bulk updates
to work items, primarily for scenarios like process template changes.

The new processor supports:
- Configurable WIQL queries to select work items.
- Option to filter out work items that already exist in the target.
- Retry mechanism for work item save failures.
- "What If" mode to simulate changes without saving.

These changes enhance the flexibility and robustness of the migration
tool by enabling bulk updates and providing mechanisms to handle
common issues during migration.
Add new members to `MigrationTools.xml` for `WorkItemBulkEditProcessorConfig` properties. Correct the class and options class file paths in `workitembulkeditprocessor.yaml` and `workitembulkeditprocessor.md`. Swap the descriptions for `WorkItemDelete` and `WorkItemBulkEditProcessor` in `VstsSyncMigrator.Core.xml`.

These changes ensure that the documentation accurately reflects the current state of the codebase, providing correct paths and descriptions for better clarity and usability.
Update the XML documentation to reflect the latest commit details,
including the new commit hash, commit date, and version information.

✅ (tests): add unit tests for DetectVersionService2

Add new unit tests to ensure the `GetRunningVersion` method works
correctly for different version types: Release, Preview, and Canary.
This improves test coverage and ensures the method handles various
version formats correctly.

✨ (tests): create FakeMigrationToolVersionInfo for testing

Introduce a `FakeMigrationToolVersionInfo` class to mock version
information in unit tests. This allows for more controlled and
predictable testing of version-related functionality.

♻️ (host): refactor DetectVersionService2 to accept version info

Modify `DetectVersionService2.GetRunningVersion` to accept an
optional `IMigrationToolVersionInfo` parameter. This change
improves testability and flexibility by allowing the method to
use provided version information instead of always fetching it
from the assembly.

♻️ (host): add LoggerHasBeenBuilt flag to MigrationToolHost

Introduce a `LoggerHasBeenBuilt` flag to ensure the logger is
only built once. This prevents potential issues with multiple
logger instances and ensures consistent logging behavior.

✨ (MigrationToolVersionInfo): add MigrationToolVersionInfo service to provide version information

Introduce a new service `MigrationToolVersionInfo` that implements the `IMigrationToolVersionInfo` interface. This service provides version information such as `ProductVersion`, `FileVersion`, and `GitTag`. This addition helps in tracking and displaying the version details of the migration tool, which is useful for debugging and auditing purposes.
Update the MigrationTools.xml documentation to reflect the latest commit details, including the new commit hash, date, and version information.

♻️ (tests): remove redundant version tests in DetectVersionService2Tests

Remove outdated and redundant tests for version detection in DetectVersionService2Tests to streamline the test suite and avoid duplication.

♻️ (commands): refactor version handling in CommandBase and ExecuteMigrationCommand

Refactor the version handling in CommandBase and ExecuteMigrationCommand to use the new IMigrationToolVersion service. This improves code maintainability and centralizes version information.

🔧 (config): add MigrationToolVersion service to DI container

Add the MigrationToolVersion and MigrationToolVersionInfo services to the dependency injection container to ensure they are available throughout the application. This change supports the refactoring of version handling and improves the overall architecture.

♻️ (DetectVersionService2): refactor version detection logic to use IMigrationToolVersion service
✅ (tests): add unit tests for version detection logic

Refactor the `DetectVersionService2` class to use the `IMigrationToolVersion` service for version detection, improving modularity and testability. Remove the `MigrationToolVersionInfo` class and replace it with a new `FakeMigrationToolVersionInfo` class for testing purposes. Add unit tests to ensure the version detection logic works correctly for different version types (Release, Preview, Canary). This change enhances the maintainability and reliability of the version detection functionality.

✨ (MigrationToolVersionInfo.cs): add MigrationToolVersionInfo and MigrationToolVersion classes to provide versioning information
The new MigrationToolVersionInfo class implements the IMigrationToolVersionInfo interface to provide product version, file version, and Git tag information. The MigrationToolVersion class implements the IMigrationToolVersion interface to parse and return the running version of the migration tool. This addition enhances the tool by providing detailed versioning information, which is crucial for debugging, support, and ensuring compatibility.
♻️ (TelemetryClientAdapter): refactor to use dependency injection for TelemetryConfiguration and IMigrationToolVersion
📝 (docs): update MigrationTools.xml with new git commit information

Adding unit tests for `TelemetryClientAdapter` ensures that the functionality is verified and any future changes can be tested. Refactoring `TelemetryClientAdapter` to use dependency injection for `TelemetryConfiguration` and `IMigrationToolVersion` improves testability and adheres to best practices. Updating the `MigrationTools.xml` documentation reflects the latest commit information, ensuring that the documentation is current.
🔧 (MigrationToolHost.cs): change ApplicationInsights configuration to use TelemetryConfiguration
✅ (TelemetryClientAdapterTests): remove incomplete and unused TrackExceptionTest method

The Git metadata in MigrationTools.xml is updated to reflect the latest commit information, ensuring documentation accuracy. The ApplicationInsights configuration is updated to use TelemetryConfiguration instead of TelemetryClient, aligning with the latest best practices. The incomplete and unused TrackExceptionTest method is removed to clean up the test suite and avoid confusion.
@MrHinsh MrHinsh linked an issue Jul 26, 2024 that may be closed by this pull request
@MrHinsh MrHinsh marked this pull request as ready for review July 26, 2024 11:56
@MrHinsh MrHinsh enabled auto-merge July 26, 2024 11:56
…es project for testing

Add a new project, MigrationTools.Fakes, to provide fake implementations
of IMigrationToolVersion and IMigrationToolVersionInfo for testing purposes.
Update solution file and test projects to include references to the new
MigrationTools.Fakes project.

The addition of the MigrationTools.Fakes project allows for more robust
and isolated unit tests by providing controlled, predictable versions
of the IMigrationToolVersion and IMigrationToolVersionInfo interfaces.
This improves the reliability and maintainability of the test suite.

✅ (tests): add project references to MigrationTools.Fakes and update tests

Add references to `MigrationTools.Fakes` in various test projects to utilize fake implementations for testing purposes. Update `DetectVersionService2Tests` to use `FakeMigrationToolVersion`. Remove unused singleton services in `MigrationToolHost`.

These changes improve the testability of the code by using fake implementations, making the tests more isolated and reliable. Removing unused services in `MigrationToolHost` cleans up the codebase and avoids potential confusion.
…rationTools.Fakes import to test file

The import of `MigrationTools.Fakes` is added to the test file to include necessary fake implementations for testing purposes. This ensures that the tests can run with mock data and dependencies, improving test reliability and coverage.
♻️ (tests): remove redundant TestCategory attribute from test methods

The MigrationTools.xml file is updated to reflect the latest commit details, ensuring the documentation is current. The redundant "AzureDevOps.ObjectModel" TestCategory attributes are removed from various test methods to streamline the test annotations and reduce unnecessary repetition.

🐛 (TfsMigrationClient): fix log message formatting for error handling
♻️ (Tests): remove redundant test categories for clarity
🔧 (EngineConfigurationBuilder): change log level to critical for version mismatch

The log message in TfsMigrationClient is reformatted to include the exception message directly, improving readability. Redundant test categories are removed from various test methods to streamline the test suite and avoid unnecessary categorization. The log level in EngineConfigurationBuilder is changed to critical for configuration version mismatches to better reflect the severity of the issue.
- Rename `MigrationTools.Fakes` project to `MigrationTools.Helpers.Tests`
- Add `MigrationTools.Helpers.Tests` project references to various test projects
- Include new fake services in `ServiceProviderHelper` for better test coverage

The changes improve the organization and clarity of test projects by renaming the `MigrationTools.Fakes` project to `MigrationTools.Helpers.Tests`. This better reflects its purpose. Additionally, adding the new project references and fake services enhances test coverage and modularity, making it easier to manage and extend tests.
✅ (tests): add project reference to MigrationTools.Helpers.Tests.csproj

The MigrationTools.xml file is updated to reflect the latest commit details, ensuring the documentation is accurate and up-to-date. The project reference to MigrationTools.Helpers.Tests.csproj is added to the test project file to include additional test helpers, improving the test coverage and maintainability.
Adding the MigrationTools.Helpers.Tests.csproj reference ensures that the tests in MigrationTools.Clients.InMemory.Tests and MigrationTools.Tests projects can utilize the helper methods and utilities defined in MigrationTools.Helpers.Tests. This improves test coverage and code reuse.
@MrHinsh MrHinsh merged commit 27805e7 into main Jul 26, 2024
9 checks passed
@MrHinsh MrHinsh deleted the feature/small-changes-group-1 branch July 26, 2024 14:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rename WorkItemUpdate to Bulk Edit
1 participant