public List<BreadCrumb> makeBreadCrumbs( final Path path, final List<org.kie.commons.java.nio.file.Path> exclusions, final Map<org.kie.commons.java.nio.file.Path, String> captionSubstitutions ) { final List<BreadCrumb> breadCrumbs = new ArrayList<BreadCrumb>(); org.kie.commons.java.nio.file.Path nioPath = paths.convert( path ); org.kie.commons.java.nio.file.Path nioFileName = nioPath.getFileName(); while ( nioFileName != null ) { if ( includePath( nioPath, exclusions ) ) { String caption = nioFileName.toString(); if ( captionSubstitutions.containsKey( nioPath ) ) { caption = captionSubstitutions.get( nioPath ); } final BreadCrumb breadCrumb = new BreadCrumb( paths.convert( nioPath ), caption ); breadCrumbs.add( 0, breadCrumb ); } nioPath = nioPath.getParent(); nioFileName = nioPath.getFileName(); } breadCrumbs.add( 0, new BreadCrumb( paths.convert( nioPath ), getRootDirectory( nioPath ) ) ); return breadCrumbs; }
breadCrumbIndex--; assertEquals( "test", breadCrumbs.get( breadCrumbIndex ).getCaption() ); assertEquals( makePath( "/ExplorerBackendTestProjectStructureValid/src/main/resources/org/kie/test" ), breadCrumbs.get( breadCrumbIndex ).getPath() ); breadCrumbIndex--; assertEquals( "kie", breadCrumbs.get( breadCrumbIndex ).getCaption() ); assertEquals( makePath( "/ExplorerBackendTestProjectStructureValid/src/main/resources/org/kie" ), breadCrumbs.get( breadCrumbIndex ).getPath() ); breadCrumbIndex--; assertEquals( "org", breadCrumbs.get( breadCrumbIndex ).getCaption() ); assertEquals( makePath( "/ExplorerBackendTestProjectStructureValid/src/main/resources/org" ), breadCrumbs.get( breadCrumbIndex ).getPath() ); breadCrumbIndex--; assertEquals( ItemNames.SOURCE_RESOURCES, breadCrumbs.get( breadCrumbIndex ).getCaption() ); assertEquals( makePath( "/ExplorerBackendTestProjectStructureValid/src/main/resources" ), breadCrumbs.get( breadCrumbIndex ).getPath() ); breadCrumbIndex--; assertEquals( "ExplorerBackendTestProjectStructureValid", breadCrumbs.get( breadCrumbIndex ).getCaption() ); assertEquals( makePath( "/ExplorerBackendTestProjectStructureValid" ), breadCrumbs.get( breadCrumbIndex ).getPath() );
breadCrumbIndex--; assertEquals( ItemNames.SOURCE_RESOURCES, breadCrumbs.get( breadCrumbIndex ).getCaption() ); assertEquals( makePath( "/ExplorerBackendTestProjectStructureValid/src/main/resources" ), breadCrumbs.get( breadCrumbIndex ).getPath() ); breadCrumbIndex--; assertEquals( "ExplorerBackendTestProjectStructureValid", breadCrumbs.get( breadCrumbIndex ).getCaption() ); assertEquals( makePath( "/ExplorerBackendTestProjectStructureValid" ), breadCrumbs.get( breadCrumbIndex ).getPath() );
breadCrumbIndex--; assertEquals( "ExplorerBackendTestProjectStructureValid", breadCrumbs.get( breadCrumbIndex ).getCaption() ); assertEquals( makePath( "/ExplorerBackendTestProjectStructureValid" ), breadCrumbs.get( breadCrumbIndex ).getPath() );