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) {
151151 }
152152 }
153153
154- private String pathFor (String input ) {
154+ protected String pathFor (String input ) {
155155 return UUIDConverter .getUUID (input ).toString ();
156156 }
157157
Original file line number Diff line number Diff line change @@ -613,6 +613,26 @@ void testUnlockAfterLockStatusHasBeenExpiredAndDeleted() throws Exception {
613613 .isThrownBy (lock ::unlock );
614614 }
615615
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+
616636 @ SuppressWarnings ("unchecked" )
617637 private static Map <String , Lock > getRegistryLocks (JdbcLockRegistry registry ) {
618638 return TestUtils .getPropertyValue (registry , "locks" , Map .class );
You can’t perform that action at this time.
0 commit comments