@Test public void testResolve_mavenUrl() throws Exception { MavenResolver mavenResolver = Mockito.mock( MavenResolver.class ); MavenUrlResolver mavenUrlResolver = new MavenUrlResolver( mavenResolver ); File f = new File( "test" ); Mockito.when( mavenResolver.resolve( Mockito.anyString())).thenReturn( f ); String url = "mvn:net.roboconf/my-app/1.0"; ResolvedFile resolvedFile = mavenUrlResolver.resolve( url ); Assert.assertEquals( f, resolvedFile.getFile()); Assert.assertFalse( resolvedFile.existedBefore()); Mockito.verify( mavenResolver ).resolve( url ); }
@Override public ResolvedFile resolve( String url ) throws IOException { ResolvedFile resolvedFile; if( url.toLowerCase().startsWith( "mvn:" )) { if( this.mavenResolver == null ) throw new IOException( "No Maven resolver was available." ); this.logger.fine( "Resolving a Maven URL: " + url ); File f = this.mavenResolver.resolve( url ); resolvedFile = new ResolvedFile( f, false ); } else { resolvedFile = super.resolve( url ); } return resolvedFile; }
MavenUrlResolver extends DefaultUrlResolver { @Override public ResolvedFile resolve( String url ) throws IOException { ResolvedFile resolvedFile; if( url.toLowerCase().startsWith( "mvn:" )) { if( this.mavenResolver == null ) throw new IOException( "No Maven resolver was available." ); this.logger.fine( "Resolving a Maven URL: " + url ); File f = this.mavenResolver.resolve( url ); resolvedFile = new ResolvedFile( f, false ); } else { resolvedFile = super.resolve( url ); } return resolvedFile; } }
MavenUrlResolver extends DefaultUrlResolver { @Override public ResolvedFile resolve( String url ) throws IOException { ResolvedFile resolvedFile; if( url.toLowerCase().startsWith( "mvn:" )) { if( this.mavenResolver == null ) throw new IOException( "No Maven resolver was available." ); this.logger.fine( "Resolving a Maven URL: " + url ); File f = this.mavenResolver.resolve( url ); resolvedFile = new ResolvedFile( f, false ); } else { resolvedFile = super.resolve( url ); } return resolvedFile; } MavenUrlResolver( MavenResolver mavenResolver ); }
MavenUrlResolver extends DefaultUrlResolver { @Override public ResolvedFile resolve( String url ) throws IOException { ResolvedFile resolvedFile; if( url.toLowerCase().startsWith( "mvn:" )) { if( this.mavenResolver == null ) throw new IOException( "No Maven resolver was available." ); this.logger.fine( "Resolving a Maven URL: " + url ); File f = this.mavenResolver.resolve( url ); resolvedFile = new ResolvedFile( f, false ); } else { resolvedFile = super.resolve( url ); } return resolvedFile; } MavenUrlResolver( MavenResolver mavenResolver ); @Override ResolvedFile resolve( String url ); }
MavenUrlResolver extends DefaultUrlResolver { @Override public ResolvedFile resolve( String url ) throws IOException { ResolvedFile resolvedFile; if( url.toLowerCase().startsWith( "mvn:" )) { if( this.mavenResolver == null ) throw new IOException( "No Maven resolver was available." ); this.logger.fine( "Resolving a Maven URL: " + url ); File f = this.mavenResolver.resolve( url ); resolvedFile = new ResolvedFile( f, false ); } else { resolvedFile = super.resolve( url ); } return resolvedFile; } MavenUrlResolver( MavenResolver mavenResolver ); @Override ResolvedFile resolve( String url );  }