当前位置: 首页>>代码示例>>Java>>正文


Java TransferFailedException类代码示例

本文整理汇总了Java中org.apache.maven.wagon.TransferFailedException的典型用法代码示例。如果您正苦于以下问题:Java TransferFailedException类的具体用法?Java TransferFailedException怎么用?Java TransferFailedException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


TransferFailedException类属于org.apache.maven.wagon包,在下文中一共展示了TransferFailedException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: get

import org.apache.maven.wagon.TransferFailedException; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
public void get(String s, File file)
    throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException
{
  if (LOG.isTraceEnabled()) {
    LOG.trace(String.format("Fetching [%s] to [%s]", s, file));
  }
  try {
    final Blob blob = getStorage().get(toBlobID(s));
    if (blob == null) {
      throw new ResourceDoesNotExistException(String.format("Not found [%s]", s));
    }
    get(blob, file);
  }
  catch (StorageException se) {
    throw translate(s, se);
  }
  catch (IOException e) {
    throw new TransferFailedException(String.format("Failed to write to file [%s]", file), e);
  }
}
 
开发者ID:drcrallen,项目名称:gswagon-maven-plugin,代码行数:24,代码来源:GSWagon.java

示例2: getIfNewer

import org.apache.maven.wagon.TransferFailedException; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
public boolean getIfNewer(String s, File file, long ts)
    throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException
{
  try {
    final Blob blob = getStorage().get(toBlobID(s));
    if (blob.getCreateTime() <= ts) {
      if (LOG.isTraceEnabled()) {
        LOG.trace(String.format("Not fetching, [%s] at [%s] is older than [%s]", s, blob.getCreateTime(), ts));
      }
      return false;
    }
    get(blob, file);
    return true;
  }
  catch (StorageException se) {
    throw translate(s, se);
  }
  catch (IOException ioe) {
    throw new TransferFailedException(String.format("Unable to write [%s]", file), ioe);
  }
}
 
开发者ID:drcrallen,项目名称:gswagon-maven-plugin,代码行数:25,代码来源:GSWagon.java

示例3: testGetBlobTransferFailedException

import org.apache.maven.wagon.TransferFailedException; //导入依赖的package包/类
@Test
public void testGetBlobTransferFailedException() throws Exception
{
  expectedException.expect(TransferFailedException.class);
  final long size = 100;
  final Blob blob = createStrictMock(Blob.class);
  final ReadChannel readChannel = createStrictMock(ReadChannel.class);
  expect(blob.getName()).andReturn(connectionPOJO.baseId.getName() + "/foo").once();
  expect(blob.getSize()).andReturn(size).once();
  expect(blob.reader()).andReturn(readChannel).once();
  expect(readChannel.read(anyObject()))
      .andReturn(-1).once();
  readChannel.close();
  expectLastCall().once();
  replay(readChannel, blob);
  final File outFile = temporaryFolder.newFile();
  outFile.delete();
  assertFalse(outFile.exists());
  gsWagon.swapAndCloseConnection(connectionPOJO);
  gsWagon.get(blob, outFile);
}
 
开发者ID:drcrallen,项目名称:gswagon-maven-plugin,代码行数:22,代码来源:GSWagonTest.java

示例4: get

import org.apache.maven.wagon.TransferFailedException; //导入依赖的package包/类
@Override
public void get( String s, File file )
    throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException
{
    String sourceFile = getBasedir() + "/target/test-classes/" + s;

    try
    {
        FileUtils.copyFile( new File( sourceFile ), file );
        assert( file.exists() );
    }
    catch( IOException e )
    {
        throw new ResourceDoesNotExistException( e.getMessage() );            
    }
}
 
开发者ID:ruikom,项目名称:apache-archiva,代码行数:17,代码来源:MockWagon.java

示例5: mkdirs

import org.apache.maven.wagon.TransferFailedException; //导入依赖的package包/类
private void mkdirs(String path, int index) throws TransferFailedException {
    int directoryIndex = path.indexOf('/', index) + 1;

    if (directoryIndex != 0) {
        String directory = path.substring(0, directoryIndex);
        PutObjectRequest putObjectRequest = createDirectoryPutObjectRequest(directory);

        try {
            this.amazonS3.putObject(putObjectRequest);
        } catch (AmazonServiceException e) {
            throw new TransferFailedException(String.format("Cannot write directory '%s'", directory), e);
        }

        mkdirs(path, directoryIndex);
    }
}
 
开发者ID:lambadaframework,项目名称:lambadaframework,代码行数:17,代码来源:SimpleStorageServiceWagon.java

示例6: get

import org.apache.maven.wagon.TransferFailedException; //导入依赖的package包/类
@Override
public final void get(String resourceName, File destination) throws TransferFailedException,
        ResourceDoesNotExistException, AuthorizationException {
    Resource resource = new Resource(resourceName);
    this.transferListenerSupport.fireTransferInitiated(resource, TransferEvent.REQUEST_GET);
    this.transferListenerSupport.fireTransferStarted(resource, TransferEvent.REQUEST_GET);

    try {
        getResource(resourceName, destination, new StandardTransferProgress(resource, TransferEvent.REQUEST_GET,
                this.transferListenerSupport));
        this.transferListenerSupport.fireTransferCompleted(resource, TransferEvent.REQUEST_GET);
    } catch (TransferFailedException | ResourceDoesNotExistException | AuthorizationException e) {
        this.transferListenerSupport.fireTransferError(resource, TransferEvent.REQUEST_GET, e);
        throw e;
    }
}
 
开发者ID:lambadaframework,项目名称:lambadaframework,代码行数:17,代码来源:AbstractWagon.java

示例7: getIfNewer

import org.apache.maven.wagon.TransferFailedException; //导入依赖的package包/类
@Override
public final boolean getIfNewer(String resourceName, File destination, long timestamp)
        throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException {
    Resource resource = new Resource(resourceName);
    try {
        if (isRemoteResourceNewer(resourceName, timestamp)) {
            get(resourceName, destination);
            return true;
        }

        return false;
    } catch (TransferFailedException | ResourceDoesNotExistException | AuthorizationException e) {
        this.transferListenerSupport.fireTransferError(resource, TransferEvent.REQUEST_GET, e);
        throw e;
    }
}
 
开发者ID:lambadaframework,项目名称:lambadaframework,代码行数:17,代码来源:AbstractWagon.java

示例8: put

import org.apache.maven.wagon.TransferFailedException; //导入依赖的package包/类
@Override
public final void put(File source, String destination) throws TransferFailedException,
        ResourceDoesNotExistException, AuthorizationException {
    Resource resource = new Resource(destination);
    this.transferListenerSupport.fireTransferInitiated(resource, TransferEvent.REQUEST_PUT);
    this.transferListenerSupport.fireTransferStarted(resource, TransferEvent.REQUEST_PUT);

    try {
        putResource(source, destination, new StandardTransferProgress(resource, TransferEvent.REQUEST_PUT,
                this.transferListenerSupport));
        this.transferListenerSupport.fireTransferCompleted(resource, TransferEvent.REQUEST_PUT);
    } catch (TransferFailedException | ResourceDoesNotExistException | AuthorizationException e) {
        this.transferListenerSupport.fireTransferError(resource, TransferEvent.REQUEST_PUT, e);
        throw e;
    }
}
 
开发者ID:lambadaframework,项目名称:lambadaframework,代码行数:17,代码来源:AbstractWagon.java

示例9: getTransferFailedException

import org.apache.maven.wagon.TransferFailedException; //导入依赖的package包/类
@Test
public void getTransferFailedException() throws ResourceDoesNotExistException, AuthorizationException,
        TransferFailedException {
    TransferFailedException exception = new TransferFailedException("");
    doThrow(exception).when(this.wagon).getResource(eq("foo"), eq(new File("bar")), any(TransferProgress.class));

    try {
        this.wagon.get("foo", new File("bar"));
        fail();
    } catch (TransferFailedException e) {
        verify(this.transferListenerSupport).fireTransferInitiated(new Resource("foo"), TransferEvent.REQUEST_GET);
        verify(this.transferListenerSupport).fireTransferStarted(new Resource("foo"), TransferEvent.REQUEST_GET);
        verify(this.transferListenerSupport).fireTransferError(new Resource("foo"), TransferEvent.REQUEST_GET,
                exception);
    }
}
 
开发者ID:lambadaframework,项目名称:lambadaframework,代码行数:17,代码来源:AbstractWagonTest.java

示例10: getResourceDoesNotExistException

import org.apache.maven.wagon.TransferFailedException; //导入依赖的package包/类
@Test
public void getResourceDoesNotExistException() throws TransferFailedException, ResourceDoesNotExistException,
        AuthorizationException {
    ResourceDoesNotExistException exception = new ResourceDoesNotExistException("");
    doThrow(exception).when(this.wagon).getResource(eq("foo"), eq(new File("bar")), any(TransferProgress.class));

    try {
        this.wagon.get("foo", new File("bar"));
        fail();
    } catch (ResourceDoesNotExistException e) {
        verify(this.transferListenerSupport).fireTransferInitiated(new Resource("foo"), TransferEvent.REQUEST_GET);
        verify(this.transferListenerSupport).fireTransferStarted(new Resource("foo"), TransferEvent.REQUEST_GET);
        verify(this.transferListenerSupport).fireTransferError(new Resource("foo"), TransferEvent.REQUEST_GET,
                exception);
    }
}
 
开发者ID:lambadaframework,项目名称:lambadaframework,代码行数:17,代码来源:AbstractWagonTest.java

示例11: getAuthorizationException

import org.apache.maven.wagon.TransferFailedException; //导入依赖的package包/类
@Test
public void getAuthorizationException() throws TransferFailedException, ResourceDoesNotExistException,
        AuthorizationException {
    AuthorizationException exception = new AuthorizationException("");
    doThrow(exception).when(this.wagon).getResource(eq("foo"), eq(new File("bar")), any(TransferProgress.class));

    try {
        this.wagon.get("foo", new File("bar"));
        fail();
    } catch (AuthorizationException e) {
        verify(this.transferListenerSupport).fireTransferInitiated(new Resource("foo"), TransferEvent.REQUEST_GET);
        verify(this.transferListenerSupport).fireTransferStarted(new Resource("foo"), TransferEvent.REQUEST_GET);
        verify(this.transferListenerSupport).fireTransferError(new Resource("foo"), TransferEvent.REQUEST_GET,
                exception);
    }
}
 
开发者ID:lambadaframework,项目名称:lambadaframework,代码行数:17,代码来源:AbstractWagonTest.java

示例12: putTransferFailedException

import org.apache.maven.wagon.TransferFailedException; //导入依赖的package包/类
@Test
public void putTransferFailedException() throws TransferFailedException, ResourceDoesNotExistException,
        AuthorizationException {
    TransferFailedException exception = new TransferFailedException("");
    doThrow(exception).when(this.wagon).putResource(eq(new File("foo")), eq("bar"), any(TransferProgress.class));

    try {
        this.wagon.put(new File("foo"), "bar");
        fail();
    } catch (TransferFailedException e) {
        verify(this.transferListenerSupport).fireTransferInitiated(new Resource("bar"), TransferEvent.REQUEST_PUT);
        verify(this.transferListenerSupport).fireTransferStarted(new Resource("bar"), TransferEvent.REQUEST_PUT);
        verify(this.transferListenerSupport).fireTransferError(new Resource("bar"), TransferEvent.REQUEST_PUT,
                exception);
    }
}
 
开发者ID:lambadaframework,项目名称:lambadaframework,代码行数:17,代码来源:AbstractWagonTest.java

示例13: putResourceDoesNotExistException

import org.apache.maven.wagon.TransferFailedException; //导入依赖的package包/类
@Test
public void putResourceDoesNotExistException() throws TransferFailedException, ResourceDoesNotExistException,
        AuthorizationException {
    ResourceDoesNotExistException exception = new ResourceDoesNotExistException("");
    doThrow(exception).when(this.wagon).putResource(eq(new File("foo")), eq("bar"), any(TransferProgress.class));

    try {
        this.wagon.put(new File("foo"), "bar");
        fail();
    } catch (ResourceDoesNotExistException e) {
        verify(this.transferListenerSupport).fireTransferInitiated(new Resource("bar"), TransferEvent.REQUEST_PUT);
        verify(this.transferListenerSupport).fireTransferStarted(new Resource("bar"), TransferEvent.REQUEST_PUT);
        verify(this.transferListenerSupport).fireTransferError(new Resource("bar"), TransferEvent.REQUEST_PUT,
                exception);
    }
}
 
开发者ID:lambadaframework,项目名称:lambadaframework,代码行数:17,代码来源:AbstractWagonTest.java

示例14: putAuthorizationException

import org.apache.maven.wagon.TransferFailedException; //导入依赖的package包/类
@Test
public void putAuthorizationException() throws TransferFailedException, ResourceDoesNotExistException,
        AuthorizationException {
    AuthorizationException exception = new AuthorizationException("");
    doThrow(exception).when(this.wagon).putResource(eq(new File("foo")), eq("bar"), any(TransferProgress.class));

    try {
        this.wagon.put(new File("foo"), "bar");
        fail();
    } catch (AuthorizationException e) {
        verify(this.transferListenerSupport).fireTransferInitiated(new Resource("bar"), TransferEvent.REQUEST_PUT);
        verify(this.transferListenerSupport).fireTransferStarted(new Resource("bar"), TransferEvent.REQUEST_PUT);
        verify(this.transferListenerSupport).fireTransferError(new Resource("bar"), TransferEvent.REQUEST_PUT,
                exception);
    }
}
 
开发者ID:lambadaframework,项目名称:lambadaframework,代码行数:17,代码来源:AbstractWagonTest.java

示例15: putDirectory

import org.apache.maven.wagon.TransferFailedException; //导入依赖的package包/类
@Test
public void putDirectory() throws IOException, TransferFailedException, ResourceDoesNotExistException,
        AuthorizationException {
    File directory = new File("target/test");
    directory.mkdirs();
    File file = new File(directory, "test.txt");
    file.createNewFile();

    this.wagon.putDirectory(directory, "foo");

    verify(this.transferListenerSupport).fireTransferInitiated(new Resource("foo/test.txt"),
            TransferEvent.REQUEST_PUT);
    verify(this.transferListenerSupport).fireTransferStarted(new Resource("foo/test.txt"),
            TransferEvent.REQUEST_PUT);
    verify(this.wagon).putResource(eq(new File("target/test/test.txt")), eq("foo/test.txt"),
            any(TransferProgress.class));
    verify(this.transferListenerSupport).fireTransferCompleted(new Resource("foo/test.txt"),
            TransferEvent.REQUEST_PUT);
}
 
开发者ID:lambadaframework,项目名称:lambadaframework,代码行数:20,代码来源:AbstractWagonTest.java


注:本文中的org.apache.maven.wagon.TransferFailedException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。