Skip to content

Commit

Permalink
Dynamic renaming of keys
Browse files Browse the repository at this point in the history
Dynamic renaming of keys
  • Loading branch information
Divyansh Bokadia committed Oct 21, 2024
1 parent 26c2449 commit 1f76593
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,8 @@ private static boolean isValidKey(final String key) {
|| c == '@'
|| c == '/'
|| c == '['
|| c == ']')) {
|| c == ']'
|| c == '|')) {

return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ public String getRenameWhen() {
}

public Pattern getFromKeyCompiledPattern() {
if (fromKeyPattern != null && fromKeyCompiledPattern == null) {
fromKeyCompiledPattern = Pattern.compile(fromKeyPattern);
}
return fromKeyCompiledPattern;
}

Expand All @@ -82,9 +85,6 @@ public Entry(final EventKey fromKey, final String fromKeyPattern, final EventKey
this.toKey = toKey;
this.overwriteIfToKeyExists = overwriteIfKeyExists;
this.renameWhen = renameWhen;
if (fromKeyPattern != null) {
fromKeyCompiledPattern = Pattern.compile(fromKeyPattern);
}
}

public Entry() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,15 @@
import org.mockito.Mock;
import org.mockito.junit.jupiter.MockitoExtension;

import java.util.*;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.UUID;
import java.util.LinkedList;
import java.util.Arrays;
import java.util.Map;
import java.util.ArrayList;
import java.util.HashMap;

import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
Expand Down

0 comments on commit 1f76593

Please sign in to comment.