Search in sources :

Example 61 with ByteArrayResource

use of org.springframework.core.io.ByteArrayResource in project spring-framework by spring-projects.

the class ResourceRegionEncoderTests method shouldEncodeMultipleResourceRegionsByteArrayResource.

@Test
public void shouldEncodeMultipleResourceRegionsByteArrayResource() throws Exception {
    String content = "Spring Framework test resource content.";
    shouldEncodeMultipleResourceRegions(new ByteArrayResource(content.getBytes(StandardCharsets.UTF_8)));
}
Also used : ByteArrayResource(org.springframework.core.io.ByteArrayResource) Test(org.junit.Test)

Example 62 with ByteArrayResource

use of org.springframework.core.io.ByteArrayResource in project spring-boot by spring-projects.

the class ResourceBannerTests method renderWithoutFormattedVersions.

@Test
public void renderWithoutFormattedVersions() throws Exception {
    Resource resource = new ByteArrayResource("banner ${a}${spring-boot.formatted-version}${application.formatted-version}".getBytes());
    String banner = printBanner(resource, null, null, null);
    assertThat(banner).startsWith("banner 1");
}
Also used : ByteArrayResource(org.springframework.core.io.ByteArrayResource) Resource(org.springframework.core.io.Resource) ByteArrayResource(org.springframework.core.io.ByteArrayResource) Test(org.junit.Test)

Example 63 with ByteArrayResource

use of org.springframework.core.io.ByteArrayResource in project spring-boot by spring-projects.

the class ResourceBannerTests method renderVersions.

@Test
public void renderVersions() throws Exception {
    Resource resource = new ByteArrayResource("banner ${a} ${spring-boot.version} ${application.version}".getBytes());
    String banner = printBanner(resource, "10.2", "2.0", null);
    assertThat(banner).startsWith("banner 1 10.2 2.0");
}
Also used : ByteArrayResource(org.springframework.core.io.ByteArrayResource) Resource(org.springframework.core.io.Resource) ByteArrayResource(org.springframework.core.io.ByteArrayResource) Test(org.junit.Test)

Example 64 with ByteArrayResource

use of org.springframework.core.io.ByteArrayResource in project spring-boot by spring-projects.

the class ResourceBannerTests method renderWithTitle.

@Test
public void renderWithTitle() throws Exception {
    Resource resource = new ByteArrayResource("banner ${application.title} ${a}".getBytes());
    String banner = printBanner(resource, null, null, "title");
    assertThat(banner).startsWith("banner title 1");
}
Also used : ByteArrayResource(org.springframework.core.io.ByteArrayResource) Resource(org.springframework.core.io.Resource) ByteArrayResource(org.springframework.core.io.ByteArrayResource) Test(org.junit.Test)

Example 65 with ByteArrayResource

use of org.springframework.core.io.ByteArrayResource in project spring-boot by spring-projects.

the class ResourceBannerTests method renderWithColorsButDisabled.

@Test
public void renderWithColorsButDisabled() throws Exception {
    Resource resource = new ByteArrayResource("${Ansi.RED}This is red.${Ansi.NORMAL}".getBytes());
    AnsiOutput.setEnabled(AnsiOutput.Enabled.NEVER);
    String banner = printBanner(resource, null, null, null);
    assertThat(banner).startsWith("This is red.");
}
Also used : ByteArrayResource(org.springframework.core.io.ByteArrayResource) Resource(org.springframework.core.io.Resource) ByteArrayResource(org.springframework.core.io.ByteArrayResource) Test(org.junit.Test)

Aggregations

ByteArrayResource (org.springframework.core.io.ByteArrayResource)95 Test (org.junit.Test)67 Resource (org.springframework.core.io.Resource)32 Properties (java.util.Properties)26 IOException (java.io.IOException)6 InputStream (java.io.InputStream)6 JmsNorthbounderConfig (org.opennms.netmgt.alarmd.northbounder.jms.JmsNorthbounderConfig)6 JmsNorthbounderConfigDao (org.opennms.netmgt.alarmd.northbounder.jms.JmsNorthbounderConfigDao)6 InetAddress (java.net.InetAddress)5 ArrayList (java.util.ArrayList)5 LinkedList (java.util.LinkedList)5 Before (org.junit.Before)5 NorthboundAlarm (org.opennms.netmgt.alarmd.api.NorthboundAlarm)5 JmsDestination (org.opennms.netmgt.alarmd.northbounder.jms.JmsDestination)5 OnmsAlarm (org.opennms.netmgt.model.OnmsAlarm)5 OnmsIpInterface (org.opennms.netmgt.model.OnmsIpInterface)5 OnmsNode (org.opennms.netmgt.model.OnmsNode)5 LinkedHashMap (java.util.LinkedHashMap)4 Map (java.util.Map)4 MutablePropertySources (org.springframework.core.env.MutablePropertySources)4