File tree Expand file tree Collapse file tree 2 files changed +21
-1
lines changed
spring-integration-jdbc/src
main/java/org/springframework/integration/jdbc/lock
test/java/org/springframework/integration/jdbc/lock Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -151,7 +151,7 @@ public DistributedLock obtain(Object lockKey) {
151
151
}
152
152
}
153
153
154
- private String pathFor (String input ) {
154
+ protected String pathFor (String input ) {
155
155
return UUIDConverter .getUUID (input ).toString ();
156
156
}
157
157
Original file line number Diff line number Diff line change @@ -613,6 +613,26 @@ void testUnlockAfterLockStatusHasBeenExpiredAndDeleted() throws Exception {
613
613
.isThrownBy (lock ::unlock );
614
614
}
615
615
616
+ @ Test
617
+ void testPathForCanBeOverridden () {
618
+ DefaultLockRepository client = new DefaultLockRepository (dataSource );
619
+ client .setApplicationContext (this .context );
620
+ client .afterPropertiesSet ();
621
+ client .afterSingletonsInstantiated ();
622
+ JdbcLockRegistry registry = new JdbcLockRegistry (client ) {
623
+ @ Override
624
+ protected String pathFor (String input ) {
625
+ return input ;
626
+ }
627
+ };
628
+
629
+ final String lockKey = "foo" ;
630
+ Lock lock = registry .obtain (lockKey );
631
+ String lockPath = TestUtils .getPropertyValue (lock , "path" , String .class );
632
+
633
+ assertThat (lockPath ).isEqualTo (lockKey );
634
+ }
635
+
616
636
@ SuppressWarnings ("unchecked" )
617
637
private static Map <String , Lock > getRegistryLocks (JdbcLockRegistry registry ) {
618
638
return TestUtils .getPropertyValue (registry , "locks" , Map .class );
You can’t perform that action at this time.
0 commit comments