@Test void canGetS3AttachmentServiceServiceBean() throws IOException { final AttachmentServiceProperties properties = new AttachmentServiceProperties(); Assertions .assertThat( this.servicesAutoConfiguration.attachmentService( Mockito.mock(S3ClientFactory.class), properties, Mockito.mock(MeterRegistry.class) ) ) .isInstanceOf(LocalFileSystemAttachmentServiceImpl.class); properties.setLocationPrefix(URI.create("s3: Assertions .assertThat( this.servicesAutoConfiguration.attachmentService( Mockito.mock(S3ClientFactory.class), properties, Mockito.mock(MeterRegistry.class) ) ) .isInstanceOf(S3AttachmentServiceImpl.class); }
@Bean @ConditionalOnMissingBean(AttachmentService.class) public AttachmentService attachmentService( final S3ClientFactory s3ClientFactory, final AttachmentServiceProperties attachmentServiceProperties, final MeterRegistry meterRegistry ) throws IOException { final @NotNull URI location = attachmentServiceProperties.getLocationPrefix(); final String scheme = location.getScheme(); if ("s3".equals(scheme)) { return new S3AttachmentServiceImpl(s3ClientFactory, attachmentServiceProperties, meterRegistry); } else if ("file".equals(scheme)) { return new LocalFileSystemAttachmentServiceImpl(attachmentServiceProperties); } else { throw new IllegalStateException( "Unknown attachment service implementation to use for location: " + location ); } }
ServicesAutoConfiguration { @Bean @ConditionalOnMissingBean(AttachmentService.class) public AttachmentService attachmentService( final S3ClientFactory s3ClientFactory, final AttachmentServiceProperties attachmentServiceProperties, final MeterRegistry meterRegistry ) throws IOException { final @NotNull URI location = attachmentServiceProperties.getLocationPrefix(); final String scheme = location.getScheme(); if ("s3".equals(scheme)) { return new S3AttachmentServiceImpl(s3ClientFactory, attachmentServiceProperties, meterRegistry); } else if ("file".equals(scheme)) { return new LocalFileSystemAttachmentServiceImpl(attachmentServiceProperties); } else { throw new IllegalStateException( "Unknown attachment service implementation to use for location: " + location ); } } }
ServicesAutoConfiguration { @Bean @ConditionalOnMissingBean(AttachmentService.class) public AttachmentService attachmentService( final S3ClientFactory s3ClientFactory, final AttachmentServiceProperties attachmentServiceProperties, final MeterRegistry meterRegistry ) throws IOException { final @NotNull URI location = attachmentServiceProperties.getLocationPrefix(); final String scheme = location.getScheme(); if ("s3".equals(scheme)) { return new S3AttachmentServiceImpl(s3ClientFactory, attachmentServiceProperties, meterRegistry); } else if ("file".equals(scheme)) { return new LocalFileSystemAttachmentServiceImpl(attachmentServiceProperties); } else { throw new IllegalStateException( "Unknown attachment service implementation to use for location: " + location ); } }  }
ServicesAutoConfiguration { @Bean @ConditionalOnMissingBean(AttachmentService.class) public AttachmentService attachmentService( final S3ClientFactory s3ClientFactory, final AttachmentServiceProperties attachmentServiceProperties, final MeterRegistry meterRegistry ) throws IOException { final @NotNull URI location = attachmentServiceProperties.getLocationPrefix(); final String scheme = location.getScheme(); if ("s3".equals(scheme)) { return new S3AttachmentServiceImpl(s3ClientFactory, attachmentServiceProperties, meterRegistry); } else if ("file".equals(scheme)) { return new LocalFileSystemAttachmentServiceImpl(attachmentServiceProperties); } else { throw new IllegalStateException( "Unknown attachment service implementation to use for location: " + location ); } }  @Bean JobsProperties jobsProperties(
        final JobsForwardingProperties forwarding,
        final JobsLocationsProperties locations,
        final JobsMemoryProperties memory,
        final JobsUsersProperties users,
        final JobsActiveLimitProperties activeLimit
    ); @Bean @ConditionalOnMissingBean(AttachmentService.class) AttachmentService attachmentService(
        final S3ClientFactory s3ClientFactory,
        final AttachmentServiceProperties attachmentServiceProperties,
        final MeterRegistry meterRegistry
    ); @Bean @ConditionalOnMissingBean(JobResolverService.class) JobResolverServiceImpl jobResolverService(
        final DataServices dataServices,
        @NotEmpty final List<ClusterSelector> clusterSelectors,
        final CommandSelector commandSelector,
        final MeterRegistry registry,
        final JobsProperties jobsProperties,
        final Environment environment
    ); @Bean @ConditionalOnMissingBean(JobDirectoryServerService.class) JobDirectoryServerServiceImpl jobDirectoryServerService(
        final ResourceLoader resourceLoader,
        final DataServices dataServices,
        final AgentFileStreamService agentFileStreamService,
        final ArchivedJobService archivedJobService,
        final MeterRegistry meterRegistry,
        final AgentRoutingService agentRoutingService
    ); @Bean @ConditionalOnMissingBean(JobLaunchService.class) JobLaunchServiceImpl jobLaunchService(
        final DataServices dataServices,
        final JobResolverService jobResolverService,
        final AgentLauncher agentLauncher,
        final MeterRegistry registry
    ); @Bean @ConditionalOnMissingBean(ArchivedJobService.class) ArchivedJobServiceImpl archivedJobService(
        final DataServices dataServices,
        final ResourceLoader resourceLoader,
        final MeterRegistry meterRegistry
    ); }
ServicesAutoConfiguration { @Bean @ConditionalOnMissingBean(AttachmentService.class) public AttachmentService attachmentService( final S3ClientFactory s3ClientFactory, final AttachmentServiceProperties attachmentServiceProperties, final MeterRegistry meterRegistry ) throws IOException { final @NotNull URI location = attachmentServiceProperties.getLocationPrefix(); final String scheme = location.getScheme(); if ("s3".equals(scheme)) { return new S3AttachmentServiceImpl(s3ClientFactory, attachmentServiceProperties, meterRegistry); } else if ("file".equals(scheme)) { return new LocalFileSystemAttachmentServiceImpl(attachmentServiceProperties); } else { throw new IllegalStateException( "Unknown attachment service implementation to use for location: " + location ); } }  @Bean JobsProperties jobsProperties(
        final JobsForwardingProperties forwarding,
        final JobsLocationsProperties locations,
        final JobsMemoryProperties memory,
        final JobsUsersProperties users,
        final JobsActiveLimitProperties activeLimit
    ); @Bean @ConditionalOnMissingBean(AttachmentService.class) AttachmentService attachmentService(
        final S3ClientFactory s3ClientFactory,
        final AttachmentServiceProperties attachmentServiceProperties,
        final MeterRegistry meterRegistry
    ); @Bean @ConditionalOnMissingBean(JobResolverService.class) JobResolverServiceImpl jobResolverService(
        final DataServices dataServices,
        @NotEmpty final List<ClusterSelector> clusterSelectors,
        final CommandSelector commandSelector,
        final MeterRegistry registry,
        final JobsProperties jobsProperties,
        final Environment environment
    ); @Bean @ConditionalOnMissingBean(JobDirectoryServerService.class) JobDirectoryServerServiceImpl jobDirectoryServerService(
        final ResourceLoader resourceLoader,
        final DataServices dataServices,
        final AgentFileStreamService agentFileStreamService,
        final ArchivedJobService archivedJobService,
        final MeterRegistry meterRegistry,
        final AgentRoutingService agentRoutingService
    ); @Bean @ConditionalOnMissingBean(JobLaunchService.class) JobLaunchServiceImpl jobLaunchService(
        final DataServices dataServices,
        final JobResolverService jobResolverService,
        final AgentLauncher agentLauncher,
        final MeterRegistry registry
    ); @Bean @ConditionalOnMissingBean(ArchivedJobService.class) ArchivedJobServiceImpl archivedJobService(
        final DataServices dataServices,
        final ResourceLoader resourceLoader,
        final MeterRegistry meterRegistry
    );  }