@Test public void testIsDefault() { assertNotEquals( "default", repoRequest.getLayout( "test.maven-arch/poms/test-arch-2.0.3-SNAPSHOT.pom" ) ); assertNotEquals("default", repoRequest.getLayout( "directory-clients/poms/ldap-clients-0.9.1-SNAPSHOT.pom" ) ); assertNotEquals("default", repoRequest.getLayout( "commons-lang/jars/commons-lang-2.1-javadoc.jar" ) ); assertEquals("default", repoRequest.getLayout( "test/maven-arch/test-arch/2.0.3-SNAPSHOT/test-arch-2.0.3-SNAPSHOT.jar" ) ); assertEquals("default", repoRequest.getLayout( "org/apache/archiva/archiva-api/1.0/archiva-api-1.0.xml.zip" ) ); assertEquals("default", repoRequest.getLayout( "org/apache/derby/derby/10.2.2.0/derby-10.2.2.0-bin.tar.gz" ) ); assertEquals("default", repoRequest.getLayout( "org/apache/derby/derby/10.2.2.0/derby-10.2.2.0-bin.tar.gz.pgp" ) ); assertEquals("default", repoRequest.getLayout( "org/apache/derby/derby/10.2.2.0/maven-metadata.xml.sha1" ) ); assertEquals("default", repoRequest.getLayout( "eclipse/jdtcore/maven-metadata.xml" ) ); assertEquals("default", repoRequest.getLayout( "eclipse/jdtcore/maven-metadata.xml.sha1" ) ); assertEquals("default", repoRequest.getLayout( "eclipse/jdtcore/maven-metadata.xml.md5" ) ); assertNotEquals("default", repoRequest.getLayout( null ) ); assertNotEquals("default", repoRequest.getLayout( "" ) ); assertNotEquals("default", repoRequest.getLayout( "foo" ) ); assertNotEquals("default", repoRequest.getLayout( "some.short/path" ) ); }
private boolean isDefault( String requestedPath ) { if ( StringUtils.isBlank( requestedPath ) ) { return false; } String pathParts[] = StringUtils.splitPreserveAllTokens( requestedPath, '/' ); if ( pathParts.length > 3 ) { return true; } else if ( pathParts.length == 3 ) { if ( isMetadata( requestedPath ) ) { return true; } else { int idx = requestedPath.lastIndexOf( '.' ); if ( idx > 0 ) { String base = requestedPath.substring( 0, idx ); if ( isMetadata( base ) && isSupportFile( requestedPath ) ) { return true; } } return false; } } else { return false; } }
MavenRepositoryRequestInfo implements RepositoryRequestInfo { private boolean isDefault( String requestedPath ) { if ( StringUtils.isBlank( requestedPath ) ) { return false; } String pathParts[] = StringUtils.splitPreserveAllTokens( requestedPath, '/' ); if ( pathParts.length > 3 ) { return true; } else if ( pathParts.length == 3 ) { if ( isMetadata( requestedPath ) ) { return true; } else { int idx = requestedPath.lastIndexOf( '.' ); if ( idx > 0 ) { String base = requestedPath.substring( 0, idx ); if ( isMetadata( base ) && isSupportFile( requestedPath ) ) { return true; } } return false; } } else { return false; } } }
MavenRepositoryRequestInfo implements RepositoryRequestInfo { private boolean isDefault( String requestedPath ) { if ( StringUtils.isBlank( requestedPath ) ) { return false; } String pathParts[] = StringUtils.splitPreserveAllTokens( requestedPath, '/' ); if ( pathParts.length > 3 ) { return true; } else if ( pathParts.length == 3 ) { if ( isMetadata( requestedPath ) ) { return true; } else { int idx = requestedPath.lastIndexOf( '.' ); if ( idx > 0 ) { String base = requestedPath.substring( 0, idx ); if ( isMetadata( base ) && isSupportFile( requestedPath ) ) { return true; } } return false; } } else { return false; } } MavenRepositoryRequestInfo(ManagedRepository repository); }
MavenRepositoryRequestInfo implements RepositoryRequestInfo { private boolean isDefault( String requestedPath ) { if ( StringUtils.isBlank( requestedPath ) ) { return false; } String pathParts[] = StringUtils.splitPreserveAllTokens( requestedPath, '/' ); if ( pathParts.length > 3 ) { return true; } else if ( pathParts.length == 3 ) { if ( isMetadata( requestedPath ) ) { return true; } else { int idx = requestedPath.lastIndexOf( '.' ); if ( idx > 0 ) { String base = requestedPath.substring( 0, idx ); if ( isMetadata( base ) && isSupportFile( requestedPath ) ) { return true; } } return false; } } else { return false; } } MavenRepositoryRequestInfo(ManagedRepository repository); @Override ItemSelector toItemSelector( String requestPath ); boolean isMetadata( String requestedPath ); boolean isArchetypeCatalog( String requestedPath ); boolean isSupportFile( String requestedPath ); boolean isMetadataSupportFile( String requestedPath ); @Override String getLayout(String requestPath); String toNativePath( String requestedPath); @Override RepositoryFeature<T> getFeature(Class<T> clazz); @Override boolean supportsFeature(Class<T> clazz); }
MavenRepositoryRequestInfo implements RepositoryRequestInfo { private boolean isDefault( String requestedPath ) { if ( StringUtils.isBlank( requestedPath ) ) { return false; } String pathParts[] = StringUtils.splitPreserveAllTokens( requestedPath, '/' ); if ( pathParts.length > 3 ) { return true; } else if ( pathParts.length == 3 ) { if ( isMetadata( requestedPath ) ) { return true; } else { int idx = requestedPath.lastIndexOf( '.' ); if ( idx > 0 ) { String base = requestedPath.substring( 0, idx ); if ( isMetadata( base ) && isSupportFile( requestedPath ) ) { return true; } } return false; } } else { return false; } } MavenRepositoryRequestInfo(ManagedRepository repository); @Override ItemSelector toItemSelector( String requestPath ); boolean isMetadata( String requestedPath ); boolean isArchetypeCatalog( String requestedPath ); boolean isSupportFile( String requestedPath ); boolean isMetadataSupportFile( String requestedPath ); @Override String getLayout(String requestPath); String toNativePath( String requestedPath); @Override RepositoryFeature<T> getFeature(Class<T> clazz); @Override boolean supportsFeature(Class<T> clazz);  }