Package org.sonar.core.properties

Examples of org.sonar.core.properties.PropertyDto


      .setPath("src/main/java/org/sonar/api/Plugin.java")
      .setSubProjectId(1L);
    when(componentDao.getNullableByKey(session, COMPONENT_KEY)).thenReturn(file);
    when(componentDao.getById(project.getId(), session)).thenReturn(project);
    when(componentDao.getByUuid(session, project.uuid())).thenReturn(project);
    when(propertiesDao.selectByQuery(any(PropertyQuery.class), eq(session))).thenReturn(newArrayList(new PropertyDto()));

    WsTester.TestRequest request = tester.newGetRequest("api/components", "app").setParam("key", COMPONENT_KEY);
    request.execute().assertJson(getClass(), "app_with_sub_project_equals_to_project.json");
  }
View Full Code Here


    setDefault(dbSession, profile);
    dbSession.commit();
  }

  private void setDefault(DbSession session, QualityProfileDto profile) {
    PropertyDto property = new PropertyDto()
      .setKey(PROFILE_PROPERTY_PREFIX + profile.getLanguage())
      .setValue(profile.getName());
    db.propertiesDao().setProperty(property, session);
  }
View Full Code Here

    logServerId(LoggerFactory.getLogger(LogServerId.class));
  }

  @VisibleForTesting
  protected void logServerId(Logger logger) {
    PropertyDto serverIdProp = propertiesDao.selectGlobalProperty(CoreProperties.PERMANENT_SERVER_ID);
    if (serverIdProp != null) {
      // a server ID has been generated, let's print out the other useful informations that can help debugging license issues
      PropertyDto organisationProp = propertiesDao.selectGlobalProperty(CoreProperties.ORGANISATION);
      PropertyDto ipAddressProp = propertiesDao.selectGlobalProperty(CoreProperties.SERVER_ID_IP_ADDRESS);

      StringBuilder message = new StringBuilder("Server information:\n");
      message.append("  - ID            : ");
      addQuotedValue(serverIdProp, message);
      message.append("  - Organisation  : ");
View Full Code Here

  void addProject(int profileId, long projectId, UserSession userSession, DbSession session) {
    ComponentDto project = db.componentDao().getById(projectId, session);
    checkPermission(userSession, project.key());
    QualityProfileDto qualityProfile = findNotNull(profileId, session);

    db.propertiesDao().setProperty(new PropertyDto().setKey(
      QProfileProjectLookup.PROFILE_PROPERTY_PREFIX + qualityProfile.getLanguage()).setValue(qualityProfile.getName()).setResourceId(project.getId()), session);
    session.commit();
  }
View Full Code Here

    // nothing to do
  }

  public PersistentSettings saveProperty(String key, @Nullable String value) {
    settings.setProperty(key, value);
    propertiesDao.setProperty(new PropertyDto().setKey(key).setValue(value));
    return this;
  }
View Full Code Here

    // do not fail
  }

  private void verifyProperty(String key, String value) {
    PropertyDto prop = dbClient().propertiesDao().selectGlobalProperty(key);
    assertThat(prop).isNotNull();
    assertThat(prop.getValue()).isEqualTo(value);
  }
View Full Code Here

  public void should_delete_qgate_if_non_default() throws Exception {
    long idToDelete = 42L;
    String name = "To Delete";
    QualityGateDto toDelete = new QualityGateDto().setId(idToDelete).setName(name);
    when(dao.selectById(idToDelete)).thenReturn(toDelete);
    when(propertiesDao.selectGlobalProperty("sonar.qualitygate")).thenReturn(new PropertyDto().setValue("666"));
    DbSession session = mock(DbSession.class);
    when(myBatis.openSession(false)).thenReturn(session);
    qGates.delete(idToDelete);
    verify(dao).selectById(idToDelete);
    verify(propertiesDao).deleteProjectProperties("sonar.qualitygate", "42", session);
View Full Code Here

  public void should_delete_qgate_even_if_default() throws Exception {
    long idToDelete = 42L;
    String name = "To Delete";
    QualityGateDto toDelete = new QualityGateDto().setId(idToDelete).setName(name);
    when(dao.selectById(idToDelete)).thenReturn(toDelete);
    when(propertiesDao.selectGlobalProperty("sonar.qualitygate")).thenReturn(new PropertyDto().setValue("42"));
    DbSession session = mock(DbSession.class);
    when(myBatis.openSession(false)).thenReturn(session);
    qGates.delete(idToDelete);
    verify(dao).selectById(idToDelete);
    verify(propertiesDao).deleteGlobalProperty("sonar.qualitygate", session);
View Full Code Here

  @Test
  public void should_return_default_qgate_if_set() throws Exception {
    String defaultName = "Sonar way";
    long defaultId = 42L;
    when(propertiesDao.selectGlobalProperty("sonar.qualitygate")).thenReturn(new PropertyDto().setValue(Long.toString(defaultId)));
    QualityGateDto defaultQgate = new QualityGateDto().setId(defaultId).setName(defaultName);
    when(dao.selectById(defaultId)).thenReturn(defaultQgate);
    assertThat(qGates.getDefault()).isEqualTo(defaultQgate);
  }
View Full Code Here

    assertThat(qGates.getDefault()).isEqualTo(defaultQgate);
  }

  @Test
  public void should_return_null_default_qgate_if_unset() throws Exception {
    when(propertiesDao.selectGlobalProperty("sonar.qualitygate")).thenReturn(new PropertyDto().setValue(""));
    assertThat(qGates.getDefault()).isNull();
  }
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.