Example usage for org.springframework.mock.env MockPropertySource MockPropertySource

List of usage examples for org.springframework.mock.env MockPropertySource MockPropertySource

Introduction

In this page you can find the example usage for org.springframework.mock.env MockPropertySource MockPropertySource.

Prototype

public MockPropertySource() 

Source Link

Document

Create a new MockPropertySource named #MOCK_PROPERTIES_PROPERTY_SOURCE_NAME that will maintain its own internal Properties instance.

Usage

From source file:com.cisco.cta.taxii.adapter.settings.PropertySourceHelper.java

public static MockPropertySource validProperties() {
    return new MockPropertySource().withProperty("taxiiService.pollEndpoint", "http://taxii")
            .withProperty("taxiiService.username", "smith").withProperty("taxiiService.password", "secret")
            .withProperty("taxiiService.feeds[0]", "alpha-feed")
            .withProperty("taxiiService.statusFile", "taxii-status.xml")
            .withProperty("schedule.cron", "* * * * * *").withProperty("transform.stylesheet", "transform.xsl")
            .withProperty("proxy.url", "http://localhost:8001/")
            .withProperty("proxy.authenticationType", "NONE");
}

From source file:com.cisco.cta.taxii.adapter.settings.PropertySourceHelper.java

public static MockPropertySource exclude(MockPropertySource all, String excludePrefix) {
    MockPropertySource source = new MockPropertySource();
    for (String key : all.getPropertyNames()) {
        if (!key.startsWith(excludePrefix)) {
            source.setProperty(key, all.getProperty(key));
        }/*from   w w  w  .  j a va 2s .co m*/
    }
    return source;
}

From source file:com.cisco.cta.taxii.adapter.settings.SettingsConfigurationTest.java

private MockPropertySource validProperties() {
    return new MockPropertySource().withProperty("taxiiService.pollEndpoint", "http://taxii")
            .withProperty("taxiiService.username", "smith").withProperty("taxiiService.password", "secret")
            .withProperty("taxiiService.feeds[0]", "alpha-feed")
            .withProperty("taxiiService.statusFile", "taxii-status.xml")
            .withProperty("schedule.cron", "* * * * * *").withProperty("transform.stylesheet", "transform.xsl")
            .withProperty("proxy.url", "http://localhost:8001/")
            .withProperty("proxy.authenticationType", "NONE");
}

From source file:io.bitsquare.app.BitsquareEnvironmentTests.java

@Test
public void bitsquareVersionShouldBeAvailable() {
    // we cannot actually test for the value because (a) it requires Gradle's
    // processResources task filtering (which does not happen within IDEA) and
    // (b) because we do not know the specific version to test for. Instead just
    // test that the property has been made available.
    Environment env = new BitsquareEnvironment(new MockPropertySource());
    assertThat(env.containsProperty(APP_VERSION_KEY), is(true));
    assertThat(env.getProperty(UserAgent.VERSION_KEY), equalTo(env.getProperty(APP_VERSION_KEY)));
}

From source file:com.cisco.cta.taxii.adapter.settings.SettingsConfigurationTest.java

private MockPropertySource exclude(MockPropertySource all, String excludePrefix) {
    MockPropertySource source = new MockPropertySource();
    for (String key : all.getPropertyNames()) {
        if (!key.startsWith(excludePrefix)) {
            source.setProperty(key, all.getProperty(key));
        }/*w  ww  .  ja  v  a  2s  .  co  m*/
    }
    return source;
}

From source file:org.talend.dataprep.transformation.service.TransformationServiceBaseTests.java

@Before
public void setUp() {

    // Overrides connection information with random port value
    MockPropertySource connectionInformation = new MockPropertySource()
            .withProperty("dataset.service.url", "http://localhost:" + port)
            .withProperty("transformation.service.url", "http://localhost:" + port)
            .withProperty("preparation.service.url", "http://localhost:" + port);
    environment.getPropertySources().addFirst(connectionInformation);

    urlUpdater.setUp();/*from  w w  w . j av  a  2 s  . c o  m*/

    home = folderRepository.getHome();
}