コード例 #1
0
 @Test
 public void loadDatabaseProperties() {
   setupData("global-properties");
   ProjectConfiguration config = new ProjectConfiguration(getSession(), newProject());
   assertThat(config.getString("key1"), is("value1"));
   assertNull(config.getString("key3"));
 }
コード例 #2
0
  @Test
  public void addPropertyAtRuntime() {
    setupData("global-properties");
    ProjectConfiguration config = new ProjectConfiguration(getSession(), newProject());

    config.getInMemoryConfiguration().setProperty("new-key", "new-value");
    assertThat(config.getString("new-key"), is("new-value"));
  }
コード例 #3
0
 @Test
 public void projectSettingsLoadedBeforeMavenSettings() {
   setupData("project-properties");
   Project project = newProject();
   project.getPom().getProperties().put("key1", "maven1");
   ProjectConfiguration config = new ProjectConfiguration(getSession(), project);
   assertThat(config.getString("key1"), is("overriden_value1"));
 }
コード例 #4
0
 @Test
 public void loadProjectDatabaseProperties() {
   setupData("project-properties");
   ProjectConfiguration config = new ProjectConfiguration(getSession(), newProject());
   assertThat(config.getString("key1"), is("overriden_value1"));
   assertThat(config.getString("key2"), is("value2"));
   assertThat(config.getString("key3"), is("value3"));
 }
コード例 #5
0
  @Test
  public void overridePropertyAtRuntime() {
    setupData("global-properties");
    ProjectConfiguration config = new ProjectConfiguration(getSession(), newProject());

    assertThat(config.getString("key1"), is("value1"));
    config.setProperty("key1", "new1");
    assertThat(config.getString("key1"), is("new1"));
  }
コード例 #6
0
  @Test
  public void loadSystemProperties() {
    System.setProperty("foo", "bar");
    setupData("global-properties");

    ProjectConfiguration config = new ProjectConfiguration(getSession(), newProject());
    assertThat(config.getString("foo"), is("bar"));
    assertNull(config.getString("unknown"));
  }
コード例 #7
0
  @Test
  public void loadModuleDatabaseProperties() {
    setupData("modules-properties");
    ProjectConfiguration moduleConfig = new ProjectConfiguration(getSession(), newModule());

    assertThat(moduleConfig.getString("key1"), is("project_value_1"));
    assertThat(moduleConfig.getString("key2"), is("value_2"));
    assertThat(moduleConfig.getString("key3"), is("module_value_3"));
    assertThat(moduleConfig.getString("key4"), is("module_value_4"));
  }