chennaji9 opened a new issue, #11286:
URL: https://github.com/apache/rocketmq/issues/11286

   ### Description
   
   `store/src/main/java/org/apache/rocketmq/store/StoreType.java`'s tolerant 
parsing has no direct unit test:
   
   ```java
   public static Set<StoreType> fromString(String str) {
       if (str == null || str.trim().isEmpty()) {
           return Collections.emptySet();
       }
       return Arrays.stream(str.split(";"))
           .map(String::trim)
           .filter(s -> !s.isEmpty())
           .map(s -> Arrays.stream(StoreType.values())
               .filter(type -> type.getStoreType().equalsIgnoreCase(s))
               .findFirst()
               .orElse(null))
           .filter(Objects::nonNull)
           .collect(Collectors.toSet());
   }
   ```
   
   `fromString` is the parsing path behind the `storeType` broker configuration 
(used by `CombineConsumeQueueStore` to select the consume-queue 
implementation), and its behavior is full of deliberate edge cases that nothing 
currently pins down:
   
   - `null` / empty string / all-whitespace input → empty set
   - case-insensitive matching (`DEFAULT`, `default`, `DefaultRocksDB`, ...)
   - surrounding whitespace trimmed per segment
   - empty segments between semicolons skipped (`"default;;rocksdb"`)
   - duplicate entries deduplicated by the returned `Set`
   - unknown tokens silently dropped (`"default;unknown"` → `{default}`)
   
   There is no `StoreTypeTest` in the repo, and no existing test calls 
`fromString` directly. A future refactor of this method (e.g. switching to an 
enum `valueOf` or changing separator handling) would silently change broker 
store-type parsing with no failing test.
   
   ### Expected behavior
   
   Add a `StoreTypeTest` covering the behaviors above so the parsing contract 
is locked (e.g. `" default ; DEFAULTROCKSDB;default;unknown;; "` → `{DEFAULT, 
DEFAULTROCKSDB}`).


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to