Package org.sonar.core.properties

Examples of org.sonar.core.properties.PropertyDto


    when(componentDao.getNullableRootProjectByKey(subModule.key(), session)).thenReturn(project);
    when(componentDao.getParentModuleByKey(module.key(), session)).thenReturn(project);
    when(componentDao.getParentModuleByKey(subModule.key(), session)).thenReturn(module);

    when(propertiesDao.selectProjectProperties(project.key(), session)).thenReturn(newArrayList(
      new PropertyDto().setKey("sonar.jira.login.secured").setValue("john"),
      new PropertyDto().setKey("sonar.coverage.exclusions").setValue("**/*.java")
      ));

    when(propertiesDao.selectProjectProperties(module.key(), session)).thenReturn(newArrayList(
      new PropertyDto().setKey("sonar.jira.project.key").setValue("SONAR-SERVER")
      ));

    // No settings on sub module -> All setting should come from the project and the module

    WsTester.TestRequest request = tester.newGetRequest("batch", "project").setParam("key", subModule.key());
View Full Code Here


    assertThat(propertyMap).isEmpty();
  }

  @Test
  public void transform_list_of_properties_in_map_key_value() throws Exception {
    PropertyDto property1 = new PropertyDto().setKey("1").setValue("val1");
    PropertyDto property2 = new PropertyDto().setKey("2").setValue("val2");
    PropertyDto property3 = new PropertyDto().setKey("3").setValue("val3");

    Map<String, String> propertyMap = sut.getPropertyMap(newArrayList(property1, property2, property3));

    assertThat(propertyMap.get("1")).isEqualTo("val1");
    assertThat(propertyMap.get("2")).isEqualTo("val2");
View Full Code Here

    return ((Double) (days * hoursInDay * ONE_HOUR)).longValue();
  }

  void init() {
    PropertyDto propertyDto = propertiesDao.selectGlobalProperty(HOURS_IN_DAY_PROPERTY);
    String value = propertyDto != null ? propertyDto.getValue() : "8";
    hoursInDay = Integer.valueOf(value);
    if (hoursInDay < 0) {
      throw new IllegalArgumentException(String.format("Bad value of %s: %d", HOURS_IN_DAY_PROPERTY, hoursInDay));
    }
  }
View Full Code Here

  }

  @Test
  public void load_database_properties_at_startup() {
    when(dao.selectGlobalProperties()).thenReturn(Arrays.asList(
      new PropertyDto().setKey("in_db").setValue("bar")
      ));

    PersistentSettings persistentSettings = new PersistentSettings(dao, settings);
    persistentSettings.start();
View Full Code Here

    // kept in memory cache and persisted in db
    assertThat(settings.getString("foo")).isEqualTo("bar");
    verify(dao).setProperty(argThat(new ArgumentMatcher<PropertyDto>() {
      @Override
      public boolean matches(Object o) {
        PropertyDto dto = (PropertyDto) o;
        return dto.getKey().equals("foo");
      }
    }));
  }
View Full Code Here

    // Global property
    settings.appendProperty("sonar.core.version", "3.6");

    // Project property
    List<PropertyDto> projectProperties = newArrayList(new PropertyDto().setKey("sonar.jira.project.key").setValue("STRUTS"));
    when(propertiesDao.selectProjectProperties("struts")).thenReturn(projectProperties);

    Settings result = actionService.getProjectSettings(project);
    assertThat(result).isNotNull();
    assertThat(result.hasKey("sonar.core.version")).isTrue();
View Full Code Here

    return true;
  }

  private long getModificationTimestamp(@Nullable Long projectId) {
    if (projectId == null) {
      PropertyDto dto = propertiesDao.selectGlobalProperty(SONAR_PREVIEW_CACHE_LAST_UPDATE_KEY);
      if (dto == null) {
        return 0;
      }
      return Long.valueOf(dto.getValue());
    }
    // For modules look for root project last modification timestamp
    ResourceDto rootProject = resourceDao.getRootProjectByComponentId(projectId);
    if (rootProject == null) {
      throw new SonarException("Unable to find root project for project with [id=" + projectId + "]");
    }
    PropertyDto dto = propertiesDao.selectProjectProperty(rootProject.getId(), SONAR_PREVIEW_CACHE_LAST_UPDATE_KEY);
    if (dto == null) {
      return 0;
    }
    return Long.valueOf(dto.getValue());
  }
View Full Code Here

      MyBatis.closeQuietly(session);
    }
  }

  public void reportGlobalModification(SqlSession session) {
    propertiesDao.setProperty(new PropertyDto().setKey(SONAR_PREVIEW_CACHE_LAST_UPDATE_KEY).setValue(String.valueOf(System.currentTimeMillis())), session);
  }
View Full Code Here

  public void reportResourceModification(String resourceKey) {
    ResourceDto rootProject = resourceDao.getRootProjectByComponentKey(resourceKey);
    if (rootProject == null) {
      throw new SonarException("Unable to find root project for component with [key=" + resourceKey + "]");
    }
    propertiesDao.setProperty(new PropertyDto().setKey(SONAR_PREVIEW_CACHE_LAST_UPDATE_KEY).setResourceId(rootProject.getId())
      .setValue(String.valueOf(System.currentTimeMillis())));
  }
View Full Code Here

  }

  @Test
  public void renaming_is_applied_to_default_profile_properties() {
    QualityProfileDto p1 = factory.create(dbSession, new QProfileName("xoo", "P1"));
    db.propertiesDao().setProperty(new PropertyDto().setKey("sonar.profile.xoo").setValue("P1"), dbSession);
    db.propertiesDao().setProperty(new PropertyDto().setKey("sonar.profile.java").setValue("P1"), dbSession);
    db.propertiesDao().setProperty(new PropertyDto().setKey("sonar.profile.js").setValue("JS1"), dbSession);
    dbSession.commit();
    dbSession.clearCache();

    factory.rename(p1.getKey(), "P2");
    dbSession.clearCache();
View Full Code Here

TOP

Related Classes of org.sonar.core.properties.PropertyDto

Copyright © 2018 www.massapicom. 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.