@Test public void testComputeUrlRewriter() { ContentLocation bulkLocation = mock( ContentLocation.class ); ContentLocation bodyContentLocation = mock( ContentLocation.class ); NameGenerator bulkNameGenerator = mock( NameGenerator.class ); URLRewriter urlRewriter = mock( URLRewriter.class ); Repository bulkRepository = mock( UrlRepository.class ); Repository bodyRepository = mock( UrlRepository.class ); CheckerProcessTask task = new CheckerProcessTask(); task.setBulkNameGenerator( bulkNameGenerator ); task.setBodyContentLocation( bodyContentLocation ); doReturn( bulkRepository ).when( bodyContentLocation ).getRepository(); URLRewriter result = task.computeUrlRewriter(); assertThat( result, instanceOf( SingleRepositoryURLRewriter.class ) ); task.setBulkLocation( bulkLocation ); doReturn( bulkRepository ).when( bulkLocation ).getRepository(); result = task.computeUrlRewriter(); assertThat( result, instanceOf( SingleRepositoryURLRewriter.class ) ); doReturn( bodyRepository ).when( bodyContentLocation ).getRepository(); result = task.computeUrlRewriter(); assertThat( result, instanceOf( FileSystemURLRewriter.class ) ); doReturn( mock( DummyRepository.class ) ).when( bulkLocation ).getRepository(); result = task.computeUrlRewriter(); assertThat( result, instanceOf( SingleRepositoryURLRewriter.class ) ); doReturn( bulkRepository ).when( bulkLocation ).getRepository(); doReturn( mock( DummyRepository.class ) ).when( bodyContentLocation ).getRepository(); result = task.computeUrlRewriter(); assertThat( result, instanceOf( SingleRepositoryURLRewriter.class ) ); task.setUrlRewriter( urlRewriter ); result = task.computeUrlRewriter(); assertThat( result, is( equalTo( urlRewriter ) ) ); }
protected URLRewriter computeUrlRewriter() { final URLRewriter userRewriter = getUrlRewriter(); if ( userRewriter != null ) { return ( userRewriter ); } else { final ContentLocation bulkLocation = getBulkLocation(); if ( bulkLocation == null ) { return ( new SingleRepositoryURLRewriter() ); } else { final Repository bulkRepository = bulkLocation.getRepository(); final Repository bodyRepository = getBodyContentLocation().getRepository(); if ( bulkRepository == bodyRepository ) { return ( new SingleRepositoryURLRewriter() ); } else if ( bulkRepository instanceof UrlRepository && bodyRepository instanceof UrlRepository ) { return ( new FileSystemURLRewriter() ); } else { return ( new SingleRepositoryURLRewriter() ); } } } }
AbstractMultiStreamReportProcessTask extends AbstractReportProcessTask implements
    MultiStreamReportProcessTask { protected URLRewriter computeUrlRewriter() { final URLRewriter userRewriter = getUrlRewriter(); if ( userRewriter != null ) { return ( userRewriter ); } else { final ContentLocation bulkLocation = getBulkLocation(); if ( bulkLocation == null ) { return ( new SingleRepositoryURLRewriter() ); } else { final Repository bulkRepository = bulkLocation.getRepository(); final Repository bodyRepository = getBodyContentLocation().getRepository(); if ( bulkRepository == bodyRepository ) { return ( new SingleRepositoryURLRewriter() ); } else if ( bulkRepository instanceof UrlRepository && bodyRepository instanceof UrlRepository ) { return ( new FileSystemURLRewriter() ); } else { return ( new SingleRepositoryURLRewriter() ); } } } } }
AbstractMultiStreamReportProcessTask extends AbstractReportProcessTask implements
    MultiStreamReportProcessTask { protected URLRewriter computeUrlRewriter() { final URLRewriter userRewriter = getUrlRewriter(); if ( userRewriter != null ) { return ( userRewriter ); } else { final ContentLocation bulkLocation = getBulkLocation(); if ( bulkLocation == null ) { return ( new SingleRepositoryURLRewriter() ); } else { final Repository bulkRepository = bulkLocation.getRepository(); final Repository bodyRepository = getBodyContentLocation().getRepository(); if ( bulkRepository == bodyRepository ) { return ( new SingleRepositoryURLRewriter() ); } else if ( bulkRepository instanceof UrlRepository && bodyRepository instanceof UrlRepository ) { return ( new FileSystemURLRewriter() ); } else { return ( new SingleRepositoryURLRewriter() ); } } } } protected  AbstractMultiStreamReportProcessTask(); }
AbstractMultiStreamReportProcessTask extends AbstractReportProcessTask implements
    MultiStreamReportProcessTask { protected URLRewriter computeUrlRewriter() { final URLRewriter userRewriter = getUrlRewriter(); if ( userRewriter != null ) { return ( userRewriter ); } else { final ContentLocation bulkLocation = getBulkLocation(); if ( bulkLocation == null ) { return ( new SingleRepositoryURLRewriter() ); } else { final Repository bulkRepository = bulkLocation.getRepository(); final Repository bodyRepository = getBodyContentLocation().getRepository(); if ( bulkRepository == bodyRepository ) { return ( new SingleRepositoryURLRewriter() ); } else if ( bulkRepository instanceof UrlRepository && bodyRepository instanceof UrlRepository ) { return ( new FileSystemURLRewriter() ); } else { return ( new SingleRepositoryURLRewriter() ); } } } } protected  AbstractMultiStreamReportProcessTask(); ContentLocation getBulkLocation(); void setBulkLocation( final ContentLocation bulkLocation ); NameGenerator getBulkNameGenerator(); void setBulkNameGenerator( final NameGenerator bulkNameGenerator ); URLRewriter getUrlRewriter(); void setUrlRewriter( final URLRewriter urlRewriter ); }
AbstractMultiStreamReportProcessTask extends AbstractReportProcessTask implements
    MultiStreamReportProcessTask { protected URLRewriter computeUrlRewriter() { final URLRewriter userRewriter = getUrlRewriter(); if ( userRewriter != null ) { return ( userRewriter ); } else { final ContentLocation bulkLocation = getBulkLocation(); if ( bulkLocation == null ) { return ( new SingleRepositoryURLRewriter() ); } else { final Repository bulkRepository = bulkLocation.getRepository(); final Repository bodyRepository = getBodyContentLocation().getRepository(); if ( bulkRepository == bodyRepository ) { return ( new SingleRepositoryURLRewriter() ); } else if ( bulkRepository instanceof UrlRepository && bodyRepository instanceof UrlRepository ) { return ( new FileSystemURLRewriter() ); } else { return ( new SingleRepositoryURLRewriter() ); } } } } protected  AbstractMultiStreamReportProcessTask(); ContentLocation getBulkLocation(); void setBulkLocation( final ContentLocation bulkLocation ); NameGenerator getBulkNameGenerator(); void setBulkNameGenerator( final NameGenerator bulkNameGenerator ); URLRewriter getUrlRewriter(); void setUrlRewriter( final URLRewriter urlRewriter );  }