Package org.sonar.core.properties

Examples of org.sonar.core.properties.PropertyDto


    byte[] dbContent = dryRunCache.getDatabaseForPreview(null);
    assertThat(new String(dbContent)).isEqualTo("fake db content 1");

    // Emulate invalidation of cache
    Thread.sleep(100);
    when(propertiesDao.selectGlobalProperty(PreviewCache.SONAR_PREVIEW_CACHE_LAST_UPDATE_KEY)).thenReturn(new PropertyDto().setValue("" + System.currentTimeMillis()));

    dbContent = dryRunCache.getDatabaseForPreview(null);
    assertThat(new String(dbContent)).isEqualTo("fake db content 2");

    verify(dryRunDatabaseFactory, times(2)).createNewDatabaseForDryRun(anyLong(), any(File.class), anyString());
View Full Code Here


    byte[] dbContent = dryRunCache.getDatabaseForPreview(123L);
    assertThat(new String(dbContent)).isEqualTo("fake db content 1");

    // Emulate invalidation of cache
    Thread.sleep(100);
    when(propertiesDao.selectProjectProperty(123L, PreviewCache.SONAR_PREVIEW_CACHE_LAST_UPDATE_KEY)).thenReturn(new PropertyDto().setValue("" + System.currentTimeMillis()));

    dbContent = dryRunCache.getDatabaseForPreview(123L);
    assertThat(new String(dbContent)).isEqualTo("fake db content 2");

    verify(dryRunDatabaseFactory, times(2)).createNewDatabaseForDryRun(anyLong(), any(File.class), anyString());
View Full Code Here

    when(resourceDao.getRootProjectByComponentKey("foo")).thenReturn(new ResourceDto().setId(456L));

    dryRunCache.reportResourceModification("foo");

    verify(propertiesDao).setProperty(
      new PropertyDto()
        .setKey(PreviewCache.SONAR_PREVIEW_CACHE_LAST_UPDATE_KEY)
        .setValue(anyString())
        .setResourceId(456L));
  }
View Full Code Here

    settings = new Settings();
    settings.setProperty(DatabaseProperties.PROP_URL, "jdbc:postgresql://localhost/foo");
    settings.setProperty(DatabaseProperties.PROP_USER, "bar");

    propertiesDao = mock(PropertiesDao.class);
    when(propertiesDao.selectGlobalProperty(CoreProperties.SERVER_ID)).thenReturn(new PropertyDto().setValue("123456"));

    mode = mock(AnalysisMode.class);

    databaseVersion = mock(DatabaseVersion.class);
  }
View Full Code Here

    new DatabaseCompatibility(databaseVersion, server, settings, propertiesDao, mode).start();
  }

  @Test
  public void shouldFailIfNotSameServerId() throws Exception {
    when(propertiesDao.selectGlobalProperty(CoreProperties.SERVER_ID)).thenReturn(new PropertyDto().setValue("11111111"));

    thrown.expect(MessageException.class);
    thrown.expectMessage("The current batch process and the configured remote server do not share the same DB configuration.");
    thrown.expectMessage("- Batch side: jdbc:postgresql://localhost/foo (bar / *****)");
    thrown.expectMessage("- Server side: check the configuration at http://localhost:9000/system");
View Full Code Here

    new DatabaseCompatibility(databaseVersion, server, settings, propertiesDao, mode).start();
  }

  @Test
  public void shouldUseDefaultUserNameWhenFaillingIfNotSameServerIdAndNoUserNameFound() throws Exception {
    when(propertiesDao.selectGlobalProperty(CoreProperties.SERVER_ID)).thenReturn(new PropertyDto().setValue("11111111"));

    settings.removeProperty(DatabaseProperties.PROP_USER);

    thrown.expect(MessageException.class);
    thrown.expectMessage("- Batch side: jdbc:postgresql://localhost/foo (sonar / *****)");
 
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.