@Test public void testGetMethodsNonAWS() { final S3Session session = new S3Session(new Host(new S3Protocol(), "s3.cyberduck.io")); final WebsiteCloudFrontDistributionConfiguration configuration = new WebsiteCloudFrontDistributionConfiguration(session, new DisabledX509TrustManager(), new DefaultX509KeyManager(), Collections.emptyMap() ); assertFalse(configuration.getMethods( new Path(new Path("/", EnumSet.of(Path.Type.directory, Path.Type.volume)), "/bbb", EnumSet.of(Path.Type.directory, Path.Type.volume))).contains(Distribution.DOWNLOAD)); assertFalse(configuration.getMethods( new Path(new Path("/", EnumSet.of(Path.Type.directory, Path.Type.volume)), "/bbb", EnumSet.of(Path.Type.directory, Path.Type.volume))).contains(Distribution.STREAMING)); assertFalse(configuration.getMethods( new Path(new Path("/", EnumSet.of(Path.Type.directory, Path.Type.volume)), "/bbb", EnumSet.of(Path.Type.directory, Path.Type.volume))).contains(Distribution.CUSTOM)); assertFalse(configuration.getMethods( new Path(new Path("/", EnumSet.of(Path.Type.directory, Path.Type.volume)), "/bbb", EnumSet.of(Path.Type.directory, Path.Type.volume))).contains(Distribution.WEBSITE_CDN)); assertTrue(configuration.getMethods( new Path(new Path("/", EnumSet.of(Path.Type.directory, Path.Type.volume)), "/bbb", EnumSet.of(Path.Type.directory, Path.Type.volume))).contains(Distribution.WEBSITE)); assertFalse(configuration.getMethods( new Path(new Path("/", EnumSet.of(Path.Type.directory, Path.Type.volume)), "/bbb_b", EnumSet.of(Path.Type.directory, Path.Type.volume))).contains(Distribution.WEBSITE)); }
@Override public List<Distribution.Method> getMethods(final Path container) { if(!ServiceUtils.isBucketNameValidDNSName(container.getName())) { return super.getMethods(container); } final List<Distribution.Method> methods = new ArrayList<Distribution.Method>(); if(S3Session.isAwsHostname(session.getHost().getHostname())) { methods.addAll(super.getMethods(container)); methods.addAll(Arrays.asList(Distribution.WEBSITE, Distribution.WEBSITE_CDN)); } else { methods.add(Distribution.WEBSITE); } return methods; }
WebsiteCloudFrontDistributionConfiguration extends CloudFrontDistributionConfiguration { @Override public List<Distribution.Method> getMethods(final Path container) { if(!ServiceUtils.isBucketNameValidDNSName(container.getName())) { return super.getMethods(container); } final List<Distribution.Method> methods = new ArrayList<Distribution.Method>(); if(S3Session.isAwsHostname(session.getHost().getHostname())) { methods.addAll(super.getMethods(container)); methods.addAll(Arrays.asList(Distribution.WEBSITE, Distribution.WEBSITE_CDN)); } else { methods.add(Distribution.WEBSITE); } return methods; } }
WebsiteCloudFrontDistributionConfiguration extends CloudFrontDistributionConfiguration { @Override public List<Distribution.Method> getMethods(final Path container) { if(!ServiceUtils.isBucketNameValidDNSName(container.getName())) { return super.getMethods(container); } final List<Distribution.Method> methods = new ArrayList<Distribution.Method>(); if(S3Session.isAwsHostname(session.getHost().getHostname())) { methods.addAll(super.getMethods(container)); methods.addAll(Arrays.asList(Distribution.WEBSITE, Distribution.WEBSITE_CDN)); } else { methods.add(Distribution.WEBSITE); } return methods; } WebsiteCloudFrontDistributionConfiguration(final S3Session session, final X509TrustManager trust, final X509KeyManager key,
                                                      final Map<Path, Distribution> distributions); }
WebsiteCloudFrontDistributionConfiguration extends CloudFrontDistributionConfiguration { @Override public List<Distribution.Method> getMethods(final Path container) { if(!ServiceUtils.isBucketNameValidDNSName(container.getName())) { return super.getMethods(container); } final List<Distribution.Method> methods = new ArrayList<Distribution.Method>(); if(S3Session.isAwsHostname(session.getHost().getHostname())) { methods.addAll(super.getMethods(container)); methods.addAll(Arrays.asList(Distribution.WEBSITE, Distribution.WEBSITE_CDN)); } else { methods.add(Distribution.WEBSITE); } return methods; } WebsiteCloudFrontDistributionConfiguration(final S3Session session, final X509TrustManager trust, final X509KeyManager key,
                                                      final Map<Path, Distribution> distributions); @Override List<Distribution.Method> getMethods(final Path container); @Override String getName(final Distribution.Method method); @Override Distribution read(final Path container, final Distribution.Method method, final LoginCallback prompt); @Override void write(final Path container, final Distribution distribution, final LoginCallback prompt); @Override @SuppressWarnings("unchecked") T getFeature(final Class<T> type, final Distribution.Method method); }
WebsiteCloudFrontDistributionConfiguration extends CloudFrontDistributionConfiguration { @Override public List<Distribution.Method> getMethods(final Path container) { if(!ServiceUtils.isBucketNameValidDNSName(container.getName())) { return super.getMethods(container); } final List<Distribution.Method> methods = new ArrayList<Distribution.Method>(); if(S3Session.isAwsHostname(session.getHost().getHostname())) { methods.addAll(super.getMethods(container)); methods.addAll(Arrays.asList(Distribution.WEBSITE, Distribution.WEBSITE_CDN)); } else { methods.add(Distribution.WEBSITE); } return methods; } WebsiteCloudFrontDistributionConfiguration(final S3Session session, final X509TrustManager trust, final X509KeyManager key,
                                                      final Map<Path, Distribution> distributions); @Override List<Distribution.Method> getMethods(final Path container); @Override String getName(final Distribution.Method method); @Override Distribution read(final Path container, final Distribution.Method method, final LoginCallback prompt); @Override void write(final Path container, final Distribution distribution, final LoginCallback prompt); @Override @SuppressWarnings("unchecked") T getFeature(final Class<T> type, final Distribution.Method method);  }