use of org.springframework.core.io.ClassPathResource in project spring-security-oauth by spring-projects.
the class JwtAccessTokenConverterTests method rsaKeyPair.
@Test
public void rsaKeyPair() throws Exception {
KeyStoreKeyFactory factory = new KeyStoreKeyFactory(new ClassPathResource("keystore.jks"), "foobar".toCharArray());
KeyPair keys = factory.getKeyPair("test");
tokenEnhancer.setKeyPair(keys);
tokenEnhancer.afterPropertiesSet();
assertTrue(tokenEnhancer.getKey().get("value").contains("BEGIN PUBLIC"));
}
use of org.springframework.core.io.ClassPathResource in project spring-security-oauth by spring-projects.
the class AbstractIntegrationTests method init.
@Before
public void init() {
String prefix = server.getServletPrefix();
http.setPort(port);
http.setPrefix(prefix);
if (new ClassPathResource("sample.jks").exists()) {
http.setProtocol("https");
}
}
use of org.springframework.core.io.ClassPathResource in project camel by apache.
the class ResourceConverterTest method testNonNullConversion.
public void testNonNullConversion() throws IOException {
Resource resource = new ClassPathResource("testresource.txt", ResourceConverterTest.class);
Assert.assertTrue(resource.exists());
InputStream inputStream = getResourceTypeConverter().convertTo(InputStream.class, resource);
byte[] resourceBytes = IOConverter.toBytes(resource.getInputStream());
byte[] inputStreamBytes = IOConverter.toBytes(inputStream);
Assert.assertArrayEquals(resourceBytes, inputStreamBytes);
}
use of org.springframework.core.io.ClassPathResource in project spring-boot by spring-projects.
the class OriginTrackedYamlLoaderTests method processWithActiveProfile.
@Test
public void processWithActiveProfile() throws Exception {
Resource resource = new ClassPathResource("test-yaml.yml", getClass());
this.loader = new OriginTrackedYamlLoader(resource, "development");
Map<String, Object> result = this.loader.load();
assertThat(result.get("name").toString()).isEqualTo("Test Name");
}
use of org.springframework.core.io.ClassPathResource in project spring-boot by spring-projects.
the class TextResourcePropertyOriginTests method toStringWhenLocationIsNullShouldReturnNiceString.
@Test
public void toStringWhenLocationIsNullShouldReturnNiceString() throws Exception {
ClassPathResource resource = new ClassPathResource("foo.txt");
TextResourcePropertyOrigin origin = new TextResourcePropertyOrigin(resource, null);
assertThat(origin.toString()).isEqualTo("class path resource [foo.txt]");
}
Aggregations