@Test public void testMakeProviderScmRepository() throws Exception { assertAccurevRepo( "", null, null ); assertAccurevRepo( "aStream:/project/dir", "aStream", "project/dir" ); assertAccurevRepo( "/project/dir", null, "project/dir" ); assertAccurevRepo( "my_QA_Stream", "my_QA_Stream", null ); }
public ScmProviderRepository makeProviderScmRepository( String scmSpecificUrl, char delimiter ) throws ScmRepositoryException { List<String> validationMessages = new ArrayList<String>(); String[] tokens = StringUtils.split( scmSpecificUrl, Character.toString( delimiter ) ); String basisStream = null; String projectPath = null; int port = AccuRev.DEFAULT_PORT; String host = null; String user = null; String password = null; Map<String, String> properties = new HashMap<String, String>(); properties.put( TAG_FORMAT_PROPERTY, AccuRevScmProviderRepository.DEFAULT_TAG_FORMAT ); properties.put( ACCUREV_EXECUTABLE_PROPERTY, AccuRev.DEFAULT_ACCUREV_EXECUTABLE ); fillSystemProperties( properties ); int i = 0; while ( i < tokens.length ) { int at = tokens[i].indexOf( '@' ); int slash = tokens[i].indexOf( '/' ); slash = slash < 0 ? tokens[i].indexOf( '\\' ) : slash; int qMark = tokens[i].indexOf( '?' ); if ( qMark == 0 ) { QuotedPropertyParser.parse( tokens[i].substring( 1 ), properties ); } else if ( slash == 0 ) { projectPath = tokens[i].substring( 1 ); break; } else if ( ( slash > 0 || ( at >= 0 ) ) && host == null && user == null ) { int len = tokens[i].length(); if ( at >= 0 && len > at ) { host = tokens[i].substring( at + 1 ); } if ( slash > 0 ) { user = tokens[i].substring( 0, slash ); password = tokens[i].substring( slash + 1, at < 0 ? len : at ); } else { user = tokens[i].substring( 0, at < 0 ? len : at ); } } else if ( host != null && tokens[i].matches( "^[0-9]+$" ) ) { port = Integer.parseInt( tokens[i] ); } else { basisStream = tokens[i]; } i++; } if ( i < tokens.length ) { validationMessages.add( "Unknown tokens in URL " + scmSpecificUrl ); } AccuRevScmProviderRepository repo = new AccuRevScmProviderRepository(); repo.setLogger( getLogger() ); if ( !StringUtils.isEmpty( user ) ) { repo.setUser( user ); } if ( !StringUtils.isEmpty( password ) ) { repo.setPassword( password ); } if ( !StringUtils.isEmpty( basisStream ) ) { repo.setStreamName( basisStream ); } if ( !StringUtils.isEmpty( projectPath ) ) { repo.setProjectPath( projectPath ); } if ( !StringUtils.isEmpty( host ) ) { repo.setHost( host ); } repo.setPort( port ); repo.setTagFormat( properties.get( TAG_FORMAT_PROPERTY ) ); AccuRevCommandLine accuRev = new AccuRevCommandLine( host, port ); accuRev.setLogger( getLogger() ); accuRev.setExecutable( properties.get( ACCUREV_EXECUTABLE_PROPERTY ) ); repo.setAccuRev( accuRev ); return repo; }
AccuRevScmProvider extends AbstractScmProvider { public ScmProviderRepository makeProviderScmRepository( String scmSpecificUrl, char delimiter ) throws ScmRepositoryException { List<String> validationMessages = new ArrayList<String>(); String[] tokens = StringUtils.split( scmSpecificUrl, Character.toString( delimiter ) ); String basisStream = null; String projectPath = null; int port = AccuRev.DEFAULT_PORT; String host = null; String user = null; String password = null; Map<String, String> properties = new HashMap<String, String>(); properties.put( TAG_FORMAT_PROPERTY, AccuRevScmProviderRepository.DEFAULT_TAG_FORMAT ); properties.put( ACCUREV_EXECUTABLE_PROPERTY, AccuRev.DEFAULT_ACCUREV_EXECUTABLE ); fillSystemProperties( properties ); int i = 0; while ( i < tokens.length ) { int at = tokens[i].indexOf( '@' ); int slash = tokens[i].indexOf( '/' ); slash = slash < 0 ? tokens[i].indexOf( '\\' ) : slash; int qMark = tokens[i].indexOf( '?' ); if ( qMark == 0 ) { QuotedPropertyParser.parse( tokens[i].substring( 1 ), properties ); } else if ( slash == 0 ) { projectPath = tokens[i].substring( 1 ); break; } else if ( ( slash > 0 || ( at >= 0 ) ) && host == null && user == null ) { int len = tokens[i].length(); if ( at >= 0 && len > at ) { host = tokens[i].substring( at + 1 ); } if ( slash > 0 ) { user = tokens[i].substring( 0, slash ); password = tokens[i].substring( slash + 1, at < 0 ? len : at ); } else { user = tokens[i].substring( 0, at < 0 ? len : at ); } } else if ( host != null && tokens[i].matches( "^[0-9]+$" ) ) { port = Integer.parseInt( tokens[i] ); } else { basisStream = tokens[i]; } i++; } if ( i < tokens.length ) { validationMessages.add( "Unknown tokens in URL " + scmSpecificUrl ); } AccuRevScmProviderRepository repo = new AccuRevScmProviderRepository(); repo.setLogger( getLogger() ); if ( !StringUtils.isEmpty( user ) ) { repo.setUser( user ); } if ( !StringUtils.isEmpty( password ) ) { repo.setPassword( password ); } if ( !StringUtils.isEmpty( basisStream ) ) { repo.setStreamName( basisStream ); } if ( !StringUtils.isEmpty( projectPath ) ) { repo.setProjectPath( projectPath ); } if ( !StringUtils.isEmpty( host ) ) { repo.setHost( host ); } repo.setPort( port ); repo.setTagFormat( properties.get( TAG_FORMAT_PROPERTY ) ); AccuRevCommandLine accuRev = new AccuRevCommandLine( host, port ); accuRev.setLogger( getLogger() ); accuRev.setExecutable( properties.get( ACCUREV_EXECUTABLE_PROPERTY ) ); repo.setAccuRev( accuRev ); return repo; } }
AccuRevScmProvider extends AbstractScmProvider { public ScmProviderRepository makeProviderScmRepository( String scmSpecificUrl, char delimiter ) throws ScmRepositoryException { List<String> validationMessages = new ArrayList<String>(); String[] tokens = StringUtils.split( scmSpecificUrl, Character.toString( delimiter ) ); String basisStream = null; String projectPath = null; int port = AccuRev.DEFAULT_PORT; String host = null; String user = null; String password = null; Map<String, String> properties = new HashMap<String, String>(); properties.put( TAG_FORMAT_PROPERTY, AccuRevScmProviderRepository.DEFAULT_TAG_FORMAT ); properties.put( ACCUREV_EXECUTABLE_PROPERTY, AccuRev.DEFAULT_ACCUREV_EXECUTABLE ); fillSystemProperties( properties ); int i = 0; while ( i < tokens.length ) { int at = tokens[i].indexOf( '@' ); int slash = tokens[i].indexOf( '/' ); slash = slash < 0 ? tokens[i].indexOf( '\\' ) : slash; int qMark = tokens[i].indexOf( '?' ); if ( qMark == 0 ) { QuotedPropertyParser.parse( tokens[i].substring( 1 ), properties ); } else if ( slash == 0 ) { projectPath = tokens[i].substring( 1 ); break; } else if ( ( slash > 0 || ( at >= 0 ) ) && host == null && user == null ) { int len = tokens[i].length(); if ( at >= 0 && len > at ) { host = tokens[i].substring( at + 1 ); } if ( slash > 0 ) { user = tokens[i].substring( 0, slash ); password = tokens[i].substring( slash + 1, at < 0 ? len : at ); } else { user = tokens[i].substring( 0, at < 0 ? len : at ); } } else if ( host != null && tokens[i].matches( "^[0-9]+$" ) ) { port = Integer.parseInt( tokens[i] ); } else { basisStream = tokens[i]; } i++; } if ( i < tokens.length ) { validationMessages.add( "Unknown tokens in URL " + scmSpecificUrl ); } AccuRevScmProviderRepository repo = new AccuRevScmProviderRepository(); repo.setLogger( getLogger() ); if ( !StringUtils.isEmpty( user ) ) { repo.setUser( user ); } if ( !StringUtils.isEmpty( password ) ) { repo.setPassword( password ); } if ( !StringUtils.isEmpty( basisStream ) ) { repo.setStreamName( basisStream ); } if ( !StringUtils.isEmpty( projectPath ) ) { repo.setProjectPath( projectPath ); } if ( !StringUtils.isEmpty( host ) ) { repo.setHost( host ); } repo.setPort( port ); repo.setTagFormat( properties.get( TAG_FORMAT_PROPERTY ) ); AccuRevCommandLine accuRev = new AccuRevCommandLine( host, port ); accuRev.setLogger( getLogger() ); accuRev.setExecutable( properties.get( ACCUREV_EXECUTABLE_PROPERTY ) ); repo.setAccuRev( accuRev ); return repo; }  }
AccuRevScmProvider extends AbstractScmProvider { public ScmProviderRepository makeProviderScmRepository( String scmSpecificUrl, char delimiter ) throws ScmRepositoryException { List<String> validationMessages = new ArrayList<String>(); String[] tokens = StringUtils.split( scmSpecificUrl, Character.toString( delimiter ) ); String basisStream = null; String projectPath = null; int port = AccuRev.DEFAULT_PORT; String host = null; String user = null; String password = null; Map<String, String> properties = new HashMap<String, String>(); properties.put( TAG_FORMAT_PROPERTY, AccuRevScmProviderRepository.DEFAULT_TAG_FORMAT ); properties.put( ACCUREV_EXECUTABLE_PROPERTY, AccuRev.DEFAULT_ACCUREV_EXECUTABLE ); fillSystemProperties( properties ); int i = 0; while ( i < tokens.length ) { int at = tokens[i].indexOf( '@' ); int slash = tokens[i].indexOf( '/' ); slash = slash < 0 ? tokens[i].indexOf( '\\' ) : slash; int qMark = tokens[i].indexOf( '?' ); if ( qMark == 0 ) { QuotedPropertyParser.parse( tokens[i].substring( 1 ), properties ); } else if ( slash == 0 ) { projectPath = tokens[i].substring( 1 ); break; } else if ( ( slash > 0 || ( at >= 0 ) ) && host == null && user == null ) { int len = tokens[i].length(); if ( at >= 0 && len > at ) { host = tokens[i].substring( at + 1 ); } if ( slash > 0 ) { user = tokens[i].substring( 0, slash ); password = tokens[i].substring( slash + 1, at < 0 ? len : at ); } else { user = tokens[i].substring( 0, at < 0 ? len : at ); } } else if ( host != null && tokens[i].matches( "^[0-9]+$" ) ) { port = Integer.parseInt( tokens[i] ); } else { basisStream = tokens[i]; } i++; } if ( i < tokens.length ) { validationMessages.add( "Unknown tokens in URL " + scmSpecificUrl ); } AccuRevScmProviderRepository repo = new AccuRevScmProviderRepository(); repo.setLogger( getLogger() ); if ( !StringUtils.isEmpty( user ) ) { repo.setUser( user ); } if ( !StringUtils.isEmpty( password ) ) { repo.setPassword( password ); } if ( !StringUtils.isEmpty( basisStream ) ) { repo.setStreamName( basisStream ); } if ( !StringUtils.isEmpty( projectPath ) ) { repo.setProjectPath( projectPath ); } if ( !StringUtils.isEmpty( host ) ) { repo.setHost( host ); } repo.setPort( port ); repo.setTagFormat( properties.get( TAG_FORMAT_PROPERTY ) ); AccuRevCommandLine accuRev = new AccuRevCommandLine( host, port ); accuRev.setLogger( getLogger() ); accuRev.setExecutable( properties.get( ACCUREV_EXECUTABLE_PROPERTY ) ); repo.setAccuRev( accuRev ); return repo; }  String getScmType(); ScmProviderRepository makeProviderScmRepository( String scmSpecificUrl, char delimiter ); @Override ScmProviderRepository makeProviderScmRepository( File path ); @Override AddScmResult add( ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters ); }
AccuRevScmProvider extends AbstractScmProvider { public ScmProviderRepository makeProviderScmRepository( String scmSpecificUrl, char delimiter ) throws ScmRepositoryException { List<String> validationMessages = new ArrayList<String>(); String[] tokens = StringUtils.split( scmSpecificUrl, Character.toString( delimiter ) ); String basisStream = null; String projectPath = null; int port = AccuRev.DEFAULT_PORT; String host = null; String user = null; String password = null; Map<String, String> properties = new HashMap<String, String>(); properties.put( TAG_FORMAT_PROPERTY, AccuRevScmProviderRepository.DEFAULT_TAG_FORMAT ); properties.put( ACCUREV_EXECUTABLE_PROPERTY, AccuRev.DEFAULT_ACCUREV_EXECUTABLE ); fillSystemProperties( properties ); int i = 0; while ( i < tokens.length ) { int at = tokens[i].indexOf( '@' ); int slash = tokens[i].indexOf( '/' ); slash = slash < 0 ? tokens[i].indexOf( '\\' ) : slash; int qMark = tokens[i].indexOf( '?' ); if ( qMark == 0 ) { QuotedPropertyParser.parse( tokens[i].substring( 1 ), properties ); } else if ( slash == 0 ) { projectPath = tokens[i].substring( 1 ); break; } else if ( ( slash > 0 || ( at >= 0 ) ) && host == null && user == null ) { int len = tokens[i].length(); if ( at >= 0 && len > at ) { host = tokens[i].substring( at + 1 ); } if ( slash > 0 ) { user = tokens[i].substring( 0, slash ); password = tokens[i].substring( slash + 1, at < 0 ? len : at ); } else { user = tokens[i].substring( 0, at < 0 ? len : at ); } } else if ( host != null && tokens[i].matches( "^[0-9]+$" ) ) { port = Integer.parseInt( tokens[i] ); } else { basisStream = tokens[i]; } i++; } if ( i < tokens.length ) { validationMessages.add( "Unknown tokens in URL " + scmSpecificUrl ); } AccuRevScmProviderRepository repo = new AccuRevScmProviderRepository(); repo.setLogger( getLogger() ); if ( !StringUtils.isEmpty( user ) ) { repo.setUser( user ); } if ( !StringUtils.isEmpty( password ) ) { repo.setPassword( password ); } if ( !StringUtils.isEmpty( basisStream ) ) { repo.setStreamName( basisStream ); } if ( !StringUtils.isEmpty( projectPath ) ) { repo.setProjectPath( projectPath ); } if ( !StringUtils.isEmpty( host ) ) { repo.setHost( host ); } repo.setPort( port ); repo.setTagFormat( properties.get( TAG_FORMAT_PROPERTY ) ); AccuRevCommandLine accuRev = new AccuRevCommandLine( host, port ); accuRev.setLogger( getLogger() ); accuRev.setExecutable( properties.get( ACCUREV_EXECUTABLE_PROPERTY ) ); repo.setAccuRev( accuRev ); return repo; }  String getScmType(); ScmProviderRepository makeProviderScmRepository( String scmSpecificUrl, char delimiter ); @Override ScmProviderRepository makeProviderScmRepository( File path ); @Override AddScmResult add( ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters ); static final String ACCUREV_EXECUTABLE_PROPERTY; static final String TAG_FORMAT_PROPERTY; static final String SYSTEM_PROPERTY_PREFIX; }