Skip to content

Move few more message classes to factory#42

Merged
vshcryabets merged 1 commit into
masterfrom
feature/update-messages
Aug 5, 2025
Merged

Move few more message classes to factory#42
vshcryabets merged 1 commit into
masterfrom
feature/update-messages

Conversation

@vshcryabets
Copy link
Copy Markdown
Owner

No description provided.

@vshcryabets vshcryabets requested a review from Copilot August 5, 2025 10:14
@vshcryabets vshcryabets self-assigned this Aug 5, 2025

This comment was marked as outdated.

@vshcryabets vshcryabets force-pushed the feature/update-messages branch from c3c664e to b6983b9 Compare August 5, 2025 11:28
@vshcryabets vshcryabets requested a review from Copilot August 5, 2025 11:29

This comment was marked as outdated.

@vshcryabets vshcryabets force-pushed the feature/update-messages branch from b6983b9 to b2cf69a Compare August 5, 2025 11:36
@vshcryabets vshcryabets requested a review from Copilot August 5, 2025 11:36
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR moves several message classes from direct instantiation to factory-based construction, continuing the refactoring effort to centralize message creation. The changes improve code consistency by ensuring all message construction goes through the factory pattern.

  • Moves 5 message classes (StyxTReadMessage, StyxTCreateMessage, StyxRWriteMessage, StyxRWalkMessage, StyxRReadMessage) from direct instantiation to factory methods
  • Updates message class constructors to protected visibility to enforce factory usage
  • Adds corresponding factory methods to support the new construction pattern

Reviewed Changes

Copilot reviewed 17 out of 17 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
StyxSerializerImplTest.java Updates test cases to use factory methods instead of direct message construction
MessageSerializerImplTest.java Replaces direct StyxRReadMessage instantiation with factory method
FactoryImplTests.java Adds comprehensive test coverage for new factory methods and improves assertion patterns
StyxUnbufferedOutputStream.java Updates import to use moved StyxRWriteMessage from v9p2000 package
StyxUnbufferedInputStream.java Refactors to use factory for TReadMessage construction and adds dependency injection
StyxFileBufferedInputStream.java Updates constructor to accept factory dependency
StyxFile.java Replaces direct TCreateMessage instantiation with factory methods
StyxSerializerImpl.java Removes unused wildcard import
StyxDeserializerImpl.java Updates deserialization to use factory methods for message construction
Message classes Moves classes to v9p2000 package and changes constructors to protected
FactoryImpl.java Implements new factory methods for the moved message types
Factory.java Adds interface methods for new factory constructors
TMessagesProcessor.java Updates message processing to use factory methods
Comments suppressed due to low confidence (1)

java/v2styx-lib/src/main/java/com/v2soft/styxlib/l6/io/StyxUnbufferedInputStream.java:28

  • [nitpick] The field name 'getMessagesFactoryUseCase' uses a verb prefix which is unconventional for field names. Consider renaming to 'messagesFactoryUseCase' or 'factoryUseCase'.
    private GetMessagesFactoryUseCase getMessagesFactoryUseCase;

Assertions.assertNotNull(message);
Assertions.assertEquals(1, message.getTag());
Assertions.assertTrue(message instanceof StyxRErrorMessage);
Assertions.assertInstanceOf(StyxRErrorMessage.class, message);
Copy link

Copilot AI Aug 5, 2025

Choose a reason for hiding this comment

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

[nitpick] The assertInstanceOf check is redundant since the cast on line 52 would already fail if the type is incorrect. Consider removing this assertion or the cast.

Suggested change
Assertions.assertInstanceOf(StyxRErrorMessage.class, message);

Copilot uses AI. Check for mistakes.
Assertions.assertNotNull(message);
Assertions.assertEquals(1, message.getTag());
Assertions.assertTrue(message instanceof StyxRAttachMessage);
Assertions.assertInstanceOf(StyxRAttachMessage.class, message);
Copy link

Copilot AI Aug 5, 2025

Choose a reason for hiding this comment

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

[nitpick] The assertInstanceOf check is redundant since the cast on line 69 would already fail if the type is incorrect. Consider removing this assertion or the cast.

Suggested change
Assertions.assertInstanceOf(StyxRAttachMessage.class, message);

Copilot uses AI. Check for mistakes.
Assertions.assertNotNull(message);
Assertions.assertEquals(1, message.getTag());
Assertions.assertTrue(message instanceof StyxRAuthMessage);
Assertions.assertInstanceOf(StyxRAuthMessage.class, message);
Copy link

Copilot AI Aug 5, 2025

Choose a reason for hiding this comment

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

[nitpick] The assertInstanceOf check is redundant since the cast on line 78 would already fail if the type is incorrect. Consider removing this assertion or the cast.

Suggested change
Assertions.assertInstanceOf(StyxRAuthMessage.class, message);

Copilot uses AI. Check for mistakes.
@vshcryabets vshcryabets merged commit 7227787 into master Aug 5, 2025
2 checks passed
@vshcryabets vshcryabets deleted the feature/update-messages branch September 15, 2025 18:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants