@Test void testGetResourceWithVersionId() { AmazonS3 amazonS3 = mock(AmazonS3.class); SimpleStorageProtocolResolver resourceLoader = new SimpleStorageProtocolResolver( amazonS3); ObjectMetadata metadata = new ObjectMetadata(); when(amazonS3.getObjectMetadata(any(GetObjectMetadataRequest.class))) .thenReturn(metadata); String resourceName = "s3: Resource resource = resourceLoader.resolve(resourceName, new DefaultResourceLoader()); assertThat(resource).isNotNull(); }
@Override public Resource resolve(String location, ResourceLoader resourceLoader) { if (SimpleStorageNameUtils.isSimpleStorageResource(location)) { return new SimpleStorageResource(this.getAmazonS3(), SimpleStorageNameUtils.getBucketNameFromLocation(location), SimpleStorageNameUtils.getObjectNameFromLocation(location), this.taskExecutor, SimpleStorageNameUtils.getVersionIdFromLocation(location)); } else { return null; } }
SimpleStorageProtocolResolver implements ProtocolResolver, InitializingBean, BeanFactoryAware { @Override public Resource resolve(String location, ResourceLoader resourceLoader) { if (SimpleStorageNameUtils.isSimpleStorageResource(location)) { return new SimpleStorageResource(this.getAmazonS3(), SimpleStorageNameUtils.getBucketNameFromLocation(location), SimpleStorageNameUtils.getObjectNameFromLocation(location), this.taskExecutor, SimpleStorageNameUtils.getVersionIdFromLocation(location)); } else { return null; } } }
SimpleStorageProtocolResolver implements ProtocolResolver, InitializingBean, BeanFactoryAware { @Override public Resource resolve(String location, ResourceLoader resourceLoader) { if (SimpleStorageNameUtils.isSimpleStorageResource(location)) { return new SimpleStorageResource(this.getAmazonS3(), SimpleStorageNameUtils.getBucketNameFromLocation(location), SimpleStorageNameUtils.getObjectNameFromLocation(location), this.taskExecutor, SimpleStorageNameUtils.getVersionIdFromLocation(location)); } else { return null; } } SimpleStorageProtocolResolver();   SimpleStorageProtocolResolver(AmazonS3 amazonS3); }
SimpleStorageProtocolResolver implements ProtocolResolver, InitializingBean, BeanFactoryAware { @Override public Resource resolve(String location, ResourceLoader resourceLoader) { if (SimpleStorageNameUtils.isSimpleStorageResource(location)) { return new SimpleStorageResource(this.getAmazonS3(), SimpleStorageNameUtils.getBucketNameFromLocation(location), SimpleStorageNameUtils.getObjectNameFromLocation(location), this.taskExecutor, SimpleStorageNameUtils.getVersionIdFromLocation(location)); } else { return null; } } SimpleStorageProtocolResolver();   SimpleStorageProtocolResolver(AmazonS3 amazonS3); @RuntimeUse void setTaskExecutor(TaskExecutor taskExecutor); @Override void afterPropertiesSet(); @Override Resource resolve(String location, ResourceLoader resourceLoader); AmazonS3 getAmazonS3(); @Override void setBeanFactory(BeanFactory beanFactory); }
SimpleStorageProtocolResolver implements ProtocolResolver, InitializingBean, BeanFactoryAware { @Override public Resource resolve(String location, ResourceLoader resourceLoader) { if (SimpleStorageNameUtils.isSimpleStorageResource(location)) { return new SimpleStorageResource(this.getAmazonS3(), SimpleStorageNameUtils.getBucketNameFromLocation(location), SimpleStorageNameUtils.getObjectNameFromLocation(location), this.taskExecutor, SimpleStorageNameUtils.getVersionIdFromLocation(location)); } else { return null; } } SimpleStorageProtocolResolver();   SimpleStorageProtocolResolver(AmazonS3 amazonS3); @RuntimeUse void setTaskExecutor(TaskExecutor taskExecutor); @Override void afterPropertiesSet(); @Override Resource resolve(String location, ResourceLoader resourceLoader); AmazonS3 getAmazonS3(); @Override void setBeanFactory(BeanFactory beanFactory);  }