org.springframework.cloud.deployer.resource.support.DelegatingResourceLoader Java Examples
The following examples show how to use
org.springframework.cloud.deployer.resource.support.DelegatingResourceLoader.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AppDeploymentRequestFactoryTests.java From spring-cloud-skipper with Apache License 2.0 | 6 votes |
@Test public void testGetResourceExceptionHandler() { DelegatingResourceLoader resourceLoader = mock(DelegatingResourceLoader.class); AppDeploymentRequestFactory appDeploymentRequestFactory = new AppDeploymentRequestFactory(resourceLoader); when(resourceLoader.getResource(anyString())).thenThrow(RuntimeException.class); SpringCloudDeployerApplicationManifest applicationSpec = mock(SpringCloudDeployerApplicationManifest.class); SpringCloudDeployerApplicationSpec springCloudDeployerApplicationSpec = mock(SpringCloudDeployerApplicationSpec.class); when(applicationSpec.getSpec()).thenReturn(springCloudDeployerApplicationSpec); String specResource = "http://test"; when(springCloudDeployerApplicationSpec.getResource()).thenReturn(specResource); when(springCloudDeployerApplicationSpec.getApplicationProperties()).thenReturn(null); try { appDeploymentRequestFactory.createAppDeploymentRequest(applicationSpec, "release1", "1.0.0"); fail("SkipperException is expected to be thrown."); } catch (SkipperException e) { assertThat(e.getMessage()).contains("Could not load Resource " + specResource + "."); } }
Example #2
Source File: CloudFoundryManifestApplicationDeployer.java From spring-cloud-skipper with Apache License 2.0 | 5 votes |
public CloudFoundryManifestApplicationDeployer(CloudFoundryApplicationManifestReader cfApplicationManifestReader, PlatformCloudFoundryOperations platformCloudFoundryOperations, DelegatingResourceLoader delegatingResourceLoader) { this.cfApplicationManifestReader = cfApplicationManifestReader; this.platformCloudFoundryOperations = platformCloudFoundryOperations; this.delegatingResourceLoader = delegatingResourceLoader; }
Example #3
Source File: ResourceLoadingAutoConfigurationTests.java From spring-cloud-deployer with Apache License 2.0 | 5 votes |
@Test public void testAutoConfigNoProperties() { this.contextRunner .run((context) -> { assertThat(context).hasSingleBean(DelegatingResourceLoader.class); assertThat(context).getBean(DelegatingResourceLoader.class).has(mavenCondition); }); }
Example #4
Source File: ResourceLoadingAutoConfigurationTests.java From spring-cloud-deployer with Apache License 2.0 | 5 votes |
@Test public void testBuilderRegistration() { this.contextRunner .withUserConfiguration(CustomBuilderCustomizerConfig.class) .run((context) -> { assertThat(context).getBean(DelegatingResourceLoader.class).has(foobarCondition); }); }
Example #5
Source File: ResourceLoadingAutoConfigurationTests.java From spring-cloud-deployer with Apache License 2.0 | 5 votes |
@Test public void testBuilderOrderRegistration() { this.contextRunner .withUserConfiguration(MavenReplacingBuilderCustomizerConfig.class) .run((context) -> { assertThat(context).getBean(DelegatingResourceLoader.class).has(mavenReplacedCondition); }); }
Example #6
Source File: YarnDeployerAutoConfiguration.java From spring-cloud-deployer-yarn with Apache License 2.0 | 5 votes |
@Bean public DelegatingResourceLoader delegatingResourceLoader(org.apache.hadoop.conf.Configuration configuration) { DefaultResourceLoader defaultLoader = new DefaultResourceLoader(); Map<String, ResourceLoader> loaders = new HashMap<>(); loaders.put("hdfs", new HdfsResourceLoader(configuration)); if (mavenResourceLoader != null) { loaders.put("maven", mavenResourceLoader); } loaders.put("file", defaultLoader); loaders.put("http", defaultLoader); return new DelegatingResourceLoader(loaders); }
Example #7
Source File: TestDependencies.java From spring-cloud-dashboard with Apache License 2.0 | 5 votes |
@Bean public ResourceLoader resourceLoader() { MavenProperties mavenProperties = new MavenProperties(); mavenProperties.setRemoteRepositories(new HashMap<>(Collections.singletonMap("springRepo", new MavenProperties.RemoteRepository("https://repo.spring.io/libs-snapshot")))); Map<String, ResourceLoader> resourceLoaders = new HashMap<>(); resourceLoaders.put("maven", new MavenResourceLoader(mavenProperties)); resourceLoaders.put("file", new FileSystemResourceLoader()); DelegatingResourceLoader delegatingResourceLoader = new DelegatingResourceLoader(resourceLoaders); return delegatingResourceLoader; }
Example #8
Source File: DataFlowControllerAutoConfiguration.java From spring-cloud-dashboard with Apache License 2.0 | 5 votes |
@Bean @ConditionalOnMissingBean(DelegatingResourceLoader.class) public DelegatingResourceLoader delegatingResourceLoader(MavenResourceLoader mavenResourceLoader) { Map<String, ResourceLoader> loaders = new HashMap<>(); loaders.put("maven", mavenResourceLoader); return new DelegatingResourceLoader(loaders); }
Example #9
Source File: LocalConfigurationTests.java From spring-cloud-dataflow with Apache License 2.0 | 5 votes |
@Test public void testLocalAutoConfigApplied() throws Exception { SpringApplication app = new SpringApplication(LocalTestDataFlowServer.class); context = app.run(new String[] { "--spring.cloud.kubernetes.enabled=false", "--server.port=0" }); // LocalDataFlowServerAutoConfiguration also adds docker and maven resource loaders. DelegatingResourceLoader delegatingResourceLoader = context.getBean(DelegatingResourceLoader.class); Map<String, ResourceLoader> loaders = TestUtils.readField("loaders", delegatingResourceLoader); assertThat(loaders.size(), is(2)); assertThat(loaders.get("maven"), notNullValue()); assertThat(loaders.get("docker"), notNullValue()); }
Example #10
Source File: CloudFoundrySkipperServerConfiguration.java From spring-cloud-skipper with Apache License 2.0 | 5 votes |
@Bean public CloudFoundryManifestApplicationDeployer cfApplicationDeployer(CloudFoundryApplicationManifestReader cfApplicationManifestReader, PlatformCloudFoundryOperations platformCloudFoundryOperations, DelegatingResourceLoader delegatingResourceLoader) { return new CloudFoundryManifestApplicationDeployer(cfApplicationManifestReader, platformCloudFoundryOperations, delegatingResourceLoader); }
Example #11
Source File: LocalDataFlowServerAutoConfiguration.java From spring-cloud-dataflow with Apache License 2.0 | 5 votes |
@Bean public DelegatingResourceLoader delegatingResourceLoader(MavenProperties mavenProperties) { DockerResourceLoader dockerLoader = new DockerResourceLoader(); MavenResourceLoader mavenResourceLoader = new MavenResourceLoader(mavenProperties); Map<String, ResourceLoader> loaders = new HashMap<>(); loaders.put("docker", dockerLoader); loaders.put("maven", mavenResourceLoader); return new DelegatingResourceLoader(loaders); }
Example #12
Source File: ServerDependencies.java From spring-cloud-skipper with Apache License 2.0 | 5 votes |
@Bean public DelegatingResourceLoader delegatingResourceLoader(MavenProperties mavenProperties) { DockerResourceLoader dockerLoader = new DockerResourceLoader(); MavenResourceLoader mavenResourceLoader = new MavenResourceLoader(mavenProperties); Map<String, ResourceLoader> loaders = new HashMap<>(); loaders.put("docker", dockerLoader); loaders.put("maven", mavenResourceLoader); return new DelegatingResourceLoader(loaders); }
Example #13
Source File: TestDependencies.java From spring-cloud-dataflow with Apache License 2.0 | 5 votes |
@Bean public DelegatingResourceLoader resourceLoader(MavenProperties mavenProperties) { Map<String, ResourceLoader> resourceLoaders = new HashMap<>(); resourceLoaders.put("maven", new MavenResourceLoader(mavenProperties)); resourceLoaders.put("file", new FileSystemResourceLoader()); DelegatingResourceLoader delegatingResourceLoader = new DelegatingResourceLoader(resourceLoaders); return delegatingResourceLoader; }
Example #14
Source File: SkipperServerConfiguration.java From spring-cloud-skipper with Apache License 2.0 | 5 votes |
@Bean public DelegatingResourceLoader delegatingResourceLoader(MavenProperties mavenProperties) { DockerResourceLoader dockerLoader = new DockerResourceLoader(); MavenResourceLoader mavenResourceLoader = new MavenResourceLoader(mavenProperties); Map<String, ResourceLoader> loaders = new HashMap<>(); loaders.put("docker", dockerLoader); loaders.put("maven", mavenResourceLoader); return new DelegatingResourceLoader(loaders); }
Example #15
Source File: DeployerConfiguration.java From spring-cloud-cli with Apache License 2.0 | 4 votes |
@Bean public DelegatingResourceLoader delegatingResourceLoader(MavenResourceLoader mavenResourceLoader) { HashMap<String, ResourceLoader> map = new HashMap<>(); map.put("maven", mavenResourceLoader); return new DelegatingResourceLoader(map); }
Example #16
Source File: AbstractMigrateUriRegistrySqlCommand.java From spring-cloud-dataflow with Apache License 2.0 | 4 votes |
/** * Creates a migration data from URI_REGISTRY table to get inserted * into app_registration table. We're working on a raw data level * thus no use hibernate, spring repositories nor entity classes. * * @param jdbcTemplate the jdbc template * @return the list */ protected List<AppRegistrationMigrationData> createAppRegistrationMigrationData(JdbcTemplate jdbcTemplate) { Map<String, AppRegistrationMigrationData> data = new HashMap<>(); // to get version using same existing logic AppResourceCommon arc = new AppResourceCommon(new MavenProperties(), new DelegatingResourceLoader()); // track that we only add default version for one by just giving it to first one // just to be on a safe side Collection<String> defaultVersions = new HashSet<>(); // format for old URI_REGISTRY is: // +-------------------------------+-------------------------------------------------------------------------------------------------+ // | NAME | URI | // +-------------------------------+-------------------------------------------------------------------------------------------------+ // | processor.bridge | maven://org.springframework.cloud.stream.app:bridge-processor-rabbit:2.0.1.RELEASE | // | processor.bridge.metadata | maven://org.springframework.cloud.stream.app:bridge-processor-rabbit:jar:metadata:2.0.1.RELEASE | // // this needs to go to a new app_registration table structure where // uri and metadata and other fields are within same record. // AppRegistrationMigrationData is base of that info which then // gets actually updates with updateAppRegistration method. jdbcTemplate.query("select NAME, URI from URI_REGISTRY", rs -> { AppRegistrationMigrationData armd; String name = rs.getString(1); String uri = rs.getString(2); // we assume i.e processor.bridge and processor.bridge.metadata belong together String[] split = name.split("\\."); if (split.length == 2 || split.length == 3) { String key = split[0] + split[1]; armd = data.getOrDefault(key, new AppRegistrationMigrationData()); if (!defaultVersions.contains(key)) { armd.setDefaultVersion(true); defaultVersions.add(key); } if (split.length == 2) { // we got *.* first armd.setName(split[1]); armd.setType(ApplicationType.valueOf(split[0]).ordinal()); armd.setUri(uri); try { armd.setVersion(arc.getResourceVersion(arc.getResource(uri))); } catch (Exception e) { logger.warn("Skipping URI_REGISTRY item {} migration with URI {} due to lack of version number in the URI", name, uri, e); } } else { // we got *.*.metadata first armd.setName(split[1]); armd.setType(ApplicationType.valueOf(split[0]).ordinal()); armd.setMetadataUri(uri); } // either *.* or *.*.metadata, put it to map, either initial // insert or update data.put(key, armd); } }); // if we skipper version errors, filter those out return data.values().stream().filter(i -> !ObjectUtils.isEmpty(i.getVersion())).collect(Collectors.toList()); }
Example #17
Source File: DataFlowControllerAutoConfiguration.java From spring-cloud-dataflow with Apache License 2.0 | 4 votes |
@Bean public AppResourceCommon appResourceCommon(@Nullable MavenProperties mavenProperties, DelegatingResourceLoader delegatingResourceLoader) { return new AppResourceCommon(mavenProperties, delegatingResourceLoader); }
Example #18
Source File: TestDependencies.java From spring-cloud-dataflow with Apache License 2.0 | 4 votes |
@Bean public AppResourceCommon appResourceService(MavenProperties mavenProperties, DelegatingResourceLoader delegatingResourceLoader) { return new AppResourceCommon(mavenProperties, delegatingResourceLoader); }
Example #19
Source File: ResourceLoadingAutoConfiguration.java From spring-cloud-deployer with Apache License 2.0 | 4 votes |
@Bean public DelegatingResourceLoader delegatingResourceLoader() { DelegatingResourceLoaderBuilder builder = new DelegatingResourceLoaderBuilder(); this.loaderBuilderCustomizers.orderedStream().forEach(customizer -> customizer.customize(builder)); return builder.build(); }
Example #20
Source File: DataFlowControllerAutoConfiguration.java From spring-cloud-dashboard with Apache License 2.0 | 4 votes |
@Bean public AppRegistry appRegistry(UriRegistry uriRegistry, DelegatingResourceLoader resourceLoader, EavRegistryRepository eavRegistryRepository) { return new AppRegistry(uriRegistry, resourceLoader, eavRegistryRepository); }
Example #21
Source File: ServerDependencies.java From spring-cloud-skipper with Apache License 2.0 | 4 votes |
@Bean public AppDeploymentRequestFactory appDeploymentRequestFactory(DelegatingResourceLoader delegatingResourceLoader) { return new AppDeploymentRequestFactory(delegatingResourceLoader); }
Example #22
Source File: ServerDependencies.java From spring-cloud-skipper with Apache License 2.0 | 4 votes |
@Bean public ReleaseAnalyzer releaseAnalysisService( SpringCloudDeployerApplicationManifestReader applicationManifestReader, DelegatingResourceLoader delegatingResourceLoader) { return new ReleaseAnalyzer(applicationManifestReader, delegatingResourceLoader); }
Example #23
Source File: ReleaseAnalyzer.java From spring-cloud-skipper with Apache License 2.0 | 4 votes |
public ReleaseAnalyzer(SpringCloudDeployerApplicationManifestReader applicationManifestReader, DelegatingResourceLoader delegatingResourceLoader) { this.applicationManifestReader = applicationManifestReader; this.delegatingResourceLoader = delegatingResourceLoader; }
Example #24
Source File: SkipperServerConfiguration.java From spring-cloud-skipper with Apache License 2.0 | 4 votes |
@Bean public AppDeploymentRequestFactory appDeploymentRequestFactory(DelegatingResourceLoader delegatingResourceLoader) { return new AppDeploymentRequestFactory(delegatingResourceLoader); }
Example #25
Source File: SkipperServerConfiguration.java From spring-cloud-skipper with Apache License 2.0 | 4 votes |
@Bean public ReleaseAnalyzer releaseAnalysisService( SpringCloudDeployerApplicationManifestReader applicationManifestReader, DelegatingResourceLoader delegatingResourceLoader) { return new ReleaseAnalyzer(applicationManifestReader, delegatingResourceLoader); }
Example #26
Source File: DelegatingResourceLoaderBuilder.java From spring-cloud-deployer with Apache License 2.0 | 2 votes |
/** * Builds a {@link DelegatingResourceLoader}. * * @return the built delegating resource loader */ public DelegatingResourceLoader build() { return new DelegatingResourceLoader(this.loaders); }
Example #27
Source File: AppDeploymentRequestFactory.java From spring-cloud-skipper with Apache License 2.0 | 2 votes |
/** * Instantiates a new {@code AppDeploymentRequestFactory}. * * @param delegatingResourceLoader the delegating resource loader */ public AppDeploymentRequestFactory(DelegatingResourceLoader delegatingResourceLoader) { Assert.notNull(delegatingResourceLoader, "'delegatingResourceLoader' must be set"); this.delegatingResourceLoader = delegatingResourceLoader; }