Package org.sonar.core.properties

Examples of org.sonar.core.properties.PropertyDto


  ConvertIssueDebtToMinutesMigration migration;

  @Before
  public void setUp() throws Exception {
    when(system2.now()).thenReturn(DateUtils.parseDateTime("2014-02-19T19:10:03+0100").getTime());
    when(propertiesDao.selectGlobalProperty(WorkDurationConvertor.HOURS_IN_DAY_PROPERTY)).thenReturn(new PropertyDto().setValue("8"));

    migration = new ConvertIssueDebtToMinutesMigration(db.database(), propertiesDao, system2);
  }
View Full Code Here


  TechnicalDebtMeasuresMigration migration;

  @Before
  public void setUp() throws Exception {
    when(propertiesDao.selectGlobalProperty(WorkDurationConvertor.HOURS_IN_DAY_PROPERTY)).thenReturn(new PropertyDto().setValue("8"));

    migration = new TechnicalDebtMeasuresMigration(db.database(), propertiesDao);
  }
View Full Code Here

  IssueChangelogMigration migration;

  @Before
  public void setUp() throws Exception {
    when(system2.now()).thenReturn(DateUtils.parseDateTime("2014-02-19T19:10:03+0100").getTime());
    when(propertiesDao.selectGlobalProperty(WorkDurationConvertor.HOURS_IN_DAY_PROPERTY)).thenReturn(new PropertyDto().setValue("8"));

    WorkDurationConvertor convertor = new WorkDurationConvertor(propertiesDao);
    convertor.init();
    migration = new IssueChangelogMigration(db.database(), system2, convertor);
  }
View Full Code Here

  DevelopmentCostMeasuresMigration migration;

  @Before
  public void setUp() throws Exception {
    when(propertiesDao.selectGlobalProperty(WorkDurationConvertor.HOURS_IN_DAY_PROPERTY)).thenReturn(new PropertyDto().setValue("8"));

    migration = new DevelopmentCostMeasuresMigration(db.database(), propertiesDao);
  }
View Full Code Here

  WorkDurationConvertor convertor = new WorkDurationConvertor(propertiesDao);

  @Test
  public void convert_from_long() throws Exception {
    convertor.init();
    when(propertiesDao.selectGlobalProperty(WorkDurationConvertor.HOURS_IN_DAY_PROPERTY)).thenReturn(new PropertyDto().setValue(Integer.toString(HOURS_IN_DAY)));

    assertThat(convertor.createFromLong(1)).isEqualTo(ONE_MINUTE);
    assertThat(convertor.createFromLong(100)).isEqualTo(ONE_HOUR_IN_MINUTES);
    assertThat(convertor.createFromLong(10000)).isEqualTo(ONE_DAY_IN_MINUTES);
    assertThat(convertor.createFromLong(10101)).isEqualTo(ONE_DAY_IN_MINUTES + ONE_HOUR_IN_MINUTES + ONE_MINUTE);
View Full Code Here

    assertThat(convertor.createFromLong(1)).isEqualTo(ONE_MINUTE);
  }

  @Test
  public void fail_convert_from_long_on_bad_hours_in_day_property() throws Exception {
    when(propertiesDao.selectGlobalProperty(WorkDurationConvertor.HOURS_IN_DAY_PROPERTY)).thenReturn(new PropertyDto().setValue("-2"));
    WorkDurationConvertor workDurationConvertor = new WorkDurationConvertor(propertiesDao);
    try {
      workDurationConvertor.init();
      fail();
    } catch (Exception e) {
View Full Code Here

  }

  @Test
  public void convert_from_days() throws Exception {
    convertor.init();
    when(propertiesDao.selectGlobalProperty(WorkDurationConvertor.HOURS_IN_DAY_PROPERTY)).thenReturn(new PropertyDto().setValue(Integer.toString(HOURS_IN_DAY)));

    assertThat(convertor.createFromDays(1.0)).isEqualTo(ONE_DAY_IN_MINUTES);
    assertThat(convertor.createFromDays(0.1)).isEqualTo(48L);

    // Should be 4.8 but as it's a long it's truncated after comma
View Full Code Here

    assertThat(convertor.createFromDays(0.01)).isEqualTo(4L);
  }

  @Test
  public void fail_it_init_has_not_been_called() throws Exception {
    when(propertiesDao.selectGlobalProperty(WorkDurationConvertor.HOURS_IN_DAY_PROPERTY)).thenReturn(new PropertyDto().setValue(Integer.toString(HOURS_IN_DAY)));

    try {
      assertThat(convertor.createFromLong(1L));
      fail();
    } catch (Exception e) {
View Full Code Here

      .setPath("src/main/java/org/sonar/api/Plugin.java")
      .setSubProjectId(5L);
    when(componentDao.getNullableByKey(session, COMPONENT_KEY)).thenReturn(file);
    when(componentDao.getById(5L, session)).thenReturn(new ComponentDto().setId(5L).setLongName("SonarQube :: Plugin API").setKey(SUB_PROJECT_KEY));
    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.json");
  }
View Full Code Here

    String componentKey = "org.codehaus.sonar:sonar";
    MockUserSession.set().setLogin("john").addComponentPermission(UserRole.USER, componentKey, componentKey);

    when(componentDao.getNullableByKey(session, componentKey)).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", componentKey);
    request.execute().assertJson(getClass(), "app_without_sub_project.json");
  }
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.