Package org.springframework.core.env

Examples of org.springframework.core.env.MutablePropertySources.precedenceOf()


    assertThat(sources.precedenceOf(PropertySource.named("b")), is(1));
    assertThat(sources.precedenceOf(PropertySource.named("c")), is(2));
    assertThat(sources.precedenceOf(PropertySource.named("d")), is(3));
    assertThat(sources.precedenceOf(PropertySource.named("e")), is(4));
    assertThat(sources.precedenceOf(PropertySource.named("f")), is(5));
    assertThat(sources.precedenceOf(PropertySource.named("g")), is(6));

    assertEquals(sources.remove("a"), PropertySource.named("a"));
    assertThat(sources.size(), equalTo(6));
    assertThat(sources.contains("a"), is(false));
View Full Code Here


          equalTo(format(NON_EXISTENT_PROPERTY_SOURCE_MESSAGE, bogusPS)));
    }

    sources.addFirst(new MockPropertySource("a"));
    assertThat(sources.size(), equalTo(7));
    assertThat(sources.precedenceOf(PropertySource.named("a")), is(0));
    assertThat(sources.precedenceOf(PropertySource.named("b")), is(1));
    assertThat(sources.precedenceOf(PropertySource.named("c")), is(2));

    sources.replace("a", new MockPropertySource("a-replaced"));
    assertThat(sources.size(), equalTo(7));
View Full Code Here

    }

    sources.addFirst(new MockPropertySource("a"));
    assertThat(sources.size(), equalTo(7));
    assertThat(sources.precedenceOf(PropertySource.named("a")), is(0));
    assertThat(sources.precedenceOf(PropertySource.named("b")), is(1));
    assertThat(sources.precedenceOf(PropertySource.named("c")), is(2));

    sources.replace("a", new MockPropertySource("a-replaced"));
    assertThat(sources.size(), equalTo(7));
    assertThat(sources.precedenceOf(PropertySource.named("a-replaced")), is(0));
View Full Code Here

    sources.addFirst(new MockPropertySource("a"));
    assertThat(sources.size(), equalTo(7));
    assertThat(sources.precedenceOf(PropertySource.named("a")), is(0));
    assertThat(sources.precedenceOf(PropertySource.named("b")), is(1));
    assertThat(sources.precedenceOf(PropertySource.named("c")), is(2));

    sources.replace("a", new MockPropertySource("a-replaced"));
    assertThat(sources.size(), equalTo(7));
    assertThat(sources.precedenceOf(PropertySource.named("a-replaced")), is(0));
    assertThat(sources.precedenceOf(PropertySource.named("b")), is(1));
View Full Code Here

    assertThat(sources.precedenceOf(PropertySource.named("b")), is(1));
    assertThat(sources.precedenceOf(PropertySource.named("c")), is(2));

    sources.replace("a", new MockPropertySource("a-replaced"));
    assertThat(sources.size(), equalTo(7));
    assertThat(sources.precedenceOf(PropertySource.named("a-replaced")), is(0));
    assertThat(sources.precedenceOf(PropertySource.named("b")), is(1));
    assertThat(sources.precedenceOf(PropertySource.named("c")), is(2));

    sources.replace("a-replaced", new MockPropertySource("a"));
View Full Code Here

    assertThat(sources.precedenceOf(PropertySource.named("c")), is(2));

    sources.replace("a", new MockPropertySource("a-replaced"));
    assertThat(sources.size(), equalTo(7));
    assertThat(sources.precedenceOf(PropertySource.named("a-replaced")), is(0));
    assertThat(sources.precedenceOf(PropertySource.named("b")), is(1));
    assertThat(sources.precedenceOf(PropertySource.named("c")), is(2));

    sources.replace("a-replaced", new MockPropertySource("a"));

    try {
View Full Code Here

    sources.replace("a", new MockPropertySource("a-replaced"));
    assertThat(sources.size(), equalTo(7));
    assertThat(sources.precedenceOf(PropertySource.named("a-replaced")), is(0));
    assertThat(sources.precedenceOf(PropertySource.named("b")), is(1));
    assertThat(sources.precedenceOf(PropertySource.named("c")), is(2));

    sources.replace("a-replaced", new MockPropertySource("a"));

    try {
      sources.replace(bogusPS, new MockPropertySource("bogus-replaced"));
View Full Code Here

    assertNotNull( sources );
    assertEquals( 8, sources.size() );

    assertEquals( 4, sources.precedenceOf( sources.get( StandardEnvironment.SYSTEM_PROPERTIES_PROPERTY_SOURCE_NAME ) ) );
    assertEquals( 5, sources.precedenceOf( sources.get( StandardEnvironment.SYSTEM_ENVIRONMENT_PROPERTY_SOURCE_NAME ) ) );
    assertEquals( 7, sources.precedenceOf( sources.get( "PropertiesModuleSettings: default values" ) ) );
  }

  @Configuration
  @org.springframework.context.annotation.PropertySource(
      value = "com/foreach/across/test/TestParentProperties.properties")
View Full Code Here

    MutablePropertySources sources = env.getPropertySources();
    assertNotNull( sources );
    assertEquals( 8, sources.size() );

    assertEquals( 4, sources.precedenceOf( sources.get( StandardEnvironment.SYSTEM_PROPERTIES_PROPERTY_SOURCE_NAME ) ) );
    assertEquals( 5, sources.precedenceOf( sources.get( StandardEnvironment.SYSTEM_ENVIRONMENT_PROPERTY_SOURCE_NAME ) ) );
    assertEquals( 7, sources.precedenceOf( sources.get( "PropertiesModuleSettings: default values" ) ) );
  }

  @Configuration
View Full Code Here

    MutablePropertySources sources = env.getPropertySources();
    assertNotNull( sources );
    assertEquals( 8, sources.size() );

    assertEquals( 4, sources.precedenceOf( sources.get( StandardEnvironment.SYSTEM_PROPERTIES_PROPERTY_SOURCE_NAME ) ) );
    assertEquals( 5, sources.precedenceOf( sources.get( StandardEnvironment.SYSTEM_ENVIRONMENT_PROPERTY_SOURCE_NAME ) ) );
    assertEquals( 7, sources.precedenceOf( sources.get( "PropertiesModuleSettings: default values" ) ) );
  }

  @Configuration
  @org.springframework.context.annotation.PropertySource(
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.