@Test public void testGetRepositoryURL_Windows() throws Exception { Assume.assumeTrue( Os.isFamily( Os.FAMILY_WINDOWS ) ); ScmLogger logger = mock( ScmLogger.class ); when( logger.isInfoEnabled() ).thenReturn( Boolean.TRUE ); scmProvider.addListener( logger ); File workingDirectory = new File( "." ); String url; try { url = scmProvider.getRepositoryURL( workingDirectory ); assertFalse( url.startsWith( "file: } catch ( ScmException e ) { } verify( logger ).info( "Executing: cmd.exe /X /C \"svn --non-interactive info .\"" ); verify( logger ).info( "Working directory: " + workingDirectory.getCanonicalPath() ); }
protected String getRepositoryURL( File path ) throws ScmException { SvnInfoCommand infoCmd = (SvnInfoCommand) getInfoCommand(); infoCmd.setLogger( this.getLogger() ); InfoScmResult result = infoCmd.executeInfoCommand( null, new ScmFileSet( new File( "" ), path ), null, false, null ); if ( result.getInfoItems().size() != 1 ) { throw new ScmRepositoryException( "Cannot find URL: " + ( result.getInfoItems().size() == 0 ? "no" : "multiple" ) + " items returned by the info command" ); } return result.getInfoItems().get( 0 ).getURL(); }
SvnExeScmProvider extends AbstractSvnScmProvider { protected String getRepositoryURL( File path ) throws ScmException { SvnInfoCommand infoCmd = (SvnInfoCommand) getInfoCommand(); infoCmd.setLogger( this.getLogger() ); InfoScmResult result = infoCmd.executeInfoCommand( null, new ScmFileSet( new File( "" ), path ), null, false, null ); if ( result.getInfoItems().size() != 1 ) { throw new ScmRepositoryException( "Cannot find URL: " + ( result.getInfoItems().size() == 0 ? "no" : "multiple" ) + " items returned by the info command" ); } return result.getInfoItems().get( 0 ).getURL(); } }
SvnExeScmProvider extends AbstractSvnScmProvider { protected String getRepositoryURL( File path ) throws ScmException { SvnInfoCommand infoCmd = (SvnInfoCommand) getInfoCommand(); infoCmd.setLogger( this.getLogger() ); InfoScmResult result = infoCmd.executeInfoCommand( null, new ScmFileSet( new File( "" ), path ), null, false, null ); if ( result.getInfoItems().size() != 1 ) { throw new ScmRepositoryException( "Cannot find URL: " + ( result.getInfoItems().size() == 0 ? "no" : "multiple" ) + " items returned by the info command" ); } return result.getInfoItems().get( 0 ).getURL(); }  }
SvnExeScmProvider extends AbstractSvnScmProvider { protected String getRepositoryURL( File path ) throws ScmException { SvnInfoCommand infoCmd = (SvnInfoCommand) getInfoCommand(); infoCmd.setLogger( this.getLogger() ); InfoScmResult result = infoCmd.executeInfoCommand( null, new ScmFileSet( new File( "" ), path ), null, false, null ); if ( result.getInfoItems().size() != 1 ) { throw new ScmRepositoryException( "Cannot find URL: " + ( result.getInfoItems().size() == 0 ? "no" : "multiple" ) + " items returned by the info command" ); } return result.getInfoItems().get( 0 ).getURL(); }  SvnCommand getInfoCommand(); @Override RemoteInfoScmResult remoteInfo( ScmProviderRepository repository, ScmFileSet fileSet,
                                           CommandParameters parameters ); @Override boolean remoteUrlExist( ScmProviderRepository repository, CommandParameters parameters ); }
SvnExeScmProvider extends AbstractSvnScmProvider { protected String getRepositoryURL( File path ) throws ScmException { SvnInfoCommand infoCmd = (SvnInfoCommand) getInfoCommand(); infoCmd.setLogger( this.getLogger() ); InfoScmResult result = infoCmd.executeInfoCommand( null, new ScmFileSet( new File( "" ), path ), null, false, null ); if ( result.getInfoItems().size() != 1 ) { throw new ScmRepositoryException( "Cannot find URL: " + ( result.getInfoItems().size() == 0 ? "no" : "multiple" ) + " items returned by the info command" ); } return result.getInfoItems().get( 0 ).getURL(); }  SvnCommand getInfoCommand(); @Override RemoteInfoScmResult remoteInfo( ScmProviderRepository repository, ScmFileSet fileSet,
                                           CommandParameters parameters ); @Override boolean remoteUrlExist( ScmProviderRepository repository, CommandParameters parameters );  }