@Test public void testDirectoryChanged() { final String path1 = VAR + "/ahoy/file"; TestPathRef pathRefRepName = new TestPathRef(); pathRefRepName.setSpecification( ObjectLocationSpecificationMethod.REPOSITORY_BY_NAME ); pathRefRepName.setPath( path1 ); TestPathRef pathRefRepRef = new TestPathRef(); pathRefRepRef.setSpecification( ObjectLocationSpecificationMethod.REPOSITORY_BY_REFERENCE ); pathRefRepRef.setPath( VAR ); TestPathRef pathRefFile = new TestPathRef(); pathRefFile.setSpecification( ObjectLocationSpecificationMethod.FILENAME ); pathRefFile.setPath( path1 ); EntryCurrentDirectoryChangedListener listener = new EntryCurrentDirectoryChangedListener( pathRefRepName, pathRefRepRef, pathRefFile ); listener.directoryChanged( new Object(), "/home/user", "/home/user/ahoy" ); final String path1After = VAR + "/file"; assertEquals( path1After, pathRefRepName.getPath() ); assertEquals( path1After, pathRefFile.getPath() ); assertEquals( VAR, pathRefRepRef.getPath() ); }
@Override public void directoryChanged( Object origin, String oldCurrentDir, String newCurrentDir ) { for ( PathReference ref : references ) { ObjectLocationSpecificationMethod specMethod = ref.getSpecification(); String path = ref.getPath(); if ( ( specMethod == ObjectLocationSpecificationMethod.REPOSITORY_BY_NAME || specMethod == ObjectLocationSpecificationMethod.FILENAME ) && StringUtils.contains( path, Const.INTERNAL_VARIABLE_ENTRY_CURRENT_DIRECTORY ) && !Objects.equal( oldCurrentDir, newCurrentDir ) ) { path = reapplyCurrentDir( oldCurrentDir, newCurrentDir, path ); ref.setPath( path ); } } }
EntryCurrentDirectoryChangedListener implements CurrentDirectoryChangedListener { @Override public void directoryChanged( Object origin, String oldCurrentDir, String newCurrentDir ) { for ( PathReference ref : references ) { ObjectLocationSpecificationMethod specMethod = ref.getSpecification(); String path = ref.getPath(); if ( ( specMethod == ObjectLocationSpecificationMethod.REPOSITORY_BY_NAME || specMethod == ObjectLocationSpecificationMethod.FILENAME ) && StringUtils.contains( path, Const.INTERNAL_VARIABLE_ENTRY_CURRENT_DIRECTORY ) && !Objects.equal( oldCurrentDir, newCurrentDir ) ) { path = reapplyCurrentDir( oldCurrentDir, newCurrentDir, path ); ref.setPath( path ); } } } }
EntryCurrentDirectoryChangedListener implements CurrentDirectoryChangedListener { @Override public void directoryChanged( Object origin, String oldCurrentDir, String newCurrentDir ) { for ( PathReference ref : references ) { ObjectLocationSpecificationMethod specMethod = ref.getSpecification(); String path = ref.getPath(); if ( ( specMethod == ObjectLocationSpecificationMethod.REPOSITORY_BY_NAME || specMethod == ObjectLocationSpecificationMethod.FILENAME ) && StringUtils.contains( path, Const.INTERNAL_VARIABLE_ENTRY_CURRENT_DIRECTORY ) && !Objects.equal( oldCurrentDir, newCurrentDir ) ) { path = reapplyCurrentDir( oldCurrentDir, newCurrentDir, path ); ref.setPath( path ); } } } EntryCurrentDirectoryChangedListener( PathReference... refs );  EntryCurrentDirectoryChangedListener(
      Supplier<ObjectLocationSpecificationMethod> specMethodGetter,
      Supplier<String> pathGetter,
      Consumer<String> pathSetter ); }
EntryCurrentDirectoryChangedListener implements CurrentDirectoryChangedListener { @Override public void directoryChanged( Object origin, String oldCurrentDir, String newCurrentDir ) { for ( PathReference ref : references ) { ObjectLocationSpecificationMethod specMethod = ref.getSpecification(); String path = ref.getPath(); if ( ( specMethod == ObjectLocationSpecificationMethod.REPOSITORY_BY_NAME || specMethod == ObjectLocationSpecificationMethod.FILENAME ) && StringUtils.contains( path, Const.INTERNAL_VARIABLE_ENTRY_CURRENT_DIRECTORY ) && !Objects.equal( oldCurrentDir, newCurrentDir ) ) { path = reapplyCurrentDir( oldCurrentDir, newCurrentDir, path ); ref.setPath( path ); } } } EntryCurrentDirectoryChangedListener( PathReference... refs );  EntryCurrentDirectoryChangedListener(
      Supplier<ObjectLocationSpecificationMethod> specMethodGetter,
      Supplier<String> pathGetter,
      Consumer<String> pathSetter ); @Override void directoryChanged( Object origin, String oldCurrentDir, String newCurrentDir ); }
EntryCurrentDirectoryChangedListener implements CurrentDirectoryChangedListener { @Override public void directoryChanged( Object origin, String oldCurrentDir, String newCurrentDir ) { for ( PathReference ref : references ) { ObjectLocationSpecificationMethod specMethod = ref.getSpecification(); String path = ref.getPath(); if ( ( specMethod == ObjectLocationSpecificationMethod.REPOSITORY_BY_NAME || specMethod == ObjectLocationSpecificationMethod.FILENAME ) && StringUtils.contains( path, Const.INTERNAL_VARIABLE_ENTRY_CURRENT_DIRECTORY ) && !Objects.equal( oldCurrentDir, newCurrentDir ) ) { path = reapplyCurrentDir( oldCurrentDir, newCurrentDir, path ); ref.setPath( path ); } } } EntryCurrentDirectoryChangedListener( PathReference... refs );  EntryCurrentDirectoryChangedListener(
      Supplier<ObjectLocationSpecificationMethod> specMethodGetter,
      Supplier<String> pathGetter,
      Consumer<String> pathSetter ); @Override void directoryChanged( Object origin, String oldCurrentDir, String newCurrentDir );  }