Package org.sonar.api.config

Examples of org.sonar.api.config.Settings


  @Rule
  public TemporaryFolder temporaryFolder = new TemporaryFolder();

  @Before
  public void setUp() throws Exception {
    localDatabaseFactory = new PreviewDatabaseFactory(getDatabase(), new Profiling(new Settings()));
  }
View Full Code Here


  }

  private BasicDataSource createDatabase(byte[] db) throws IOException {
    File file = temporaryFolder.newFile("db.h2.db");
    Files.write(db, file);
    return new DbTemplate(new Profiling(new Settings())).dataSource("org.h2.Driver", "sonar", "sonar", "jdbc:h2:" + file.getAbsolutePath().replaceAll(".h2.db", ""));
  }
View Full Code Here

  private static final String BASIC_MESSAGE = "Basic message";
  private static final String FULL_MESSAGE = "Full message";

  @Before
  public void prepare() {
    settings = new Settings();
    logFactory = mock(ProfilingLogFactory.class);
    logger = mock(Logger.class);
    Mockito.when(logFactory.getLogger(Mockito.anyString())).thenReturn(logger);
    profiling = new Profiling(settings, logFactory);
  }
View Full Code Here

  @Before
  public void initResourcePermissions() {
    session = getMyBatis().openSession(false);
    project = new Project("project").setId(PROJECT_ID.intValue());
    settings = new Settings();
    permissionFacade = new PermissionFacade(new RoleDao(), new UserDao(getMyBatis()), new ResourceDao(getMyBatis(), System2.INSTANCE),
      new PermissionTemplateDao(getMyBatis(), System2.INSTANCE), settings);
    permissions = new DefaultResourcePermissions(getMyBatis(), permissionFacade);
  }
View Full Code Here

    return this;
  }

  @Override
  protected void before() throws Throwable {
    Settings settings = new Settings().setProperties(Maps.fromProperties(System.getProperties()));
    if (settings.hasKey("orchestrator.configUrl")) {
      loadOrchestratorSettings(settings);
    }
    for (String key : settings.getKeysStartingWith("sonar.jdbc")) {
      LOG.info(key + ": " + settings.getString(key));
    }
    boolean hasDialect = settings.hasKey("sonar.jdbc.dialect");
    if (hasDialect) {
      db = new DefaultDatabase(settings);
    } else {
      db = new H2Database("h2Tests" + DigestUtils.md5Hex(StringUtils.defaultString(schemaPath)), schemaPath == null);
    }
View Full Code Here

  protected void doBeforeStart() {
    projectBootstrap();
    addBatchComponents();
    fixMavenExecutor();
    addBatchExtensions();
    Settings settings = getComponentByType(Settings.class);
    if (settings != null && settings.getBoolean(CoreProperties.PROFILING_LOG_PROPERTY)) {
      add(PhasesSumUpTimeProfiler.class);
    }
  }
View Full Code Here

    // Views pass a custom ProjectReactor
    ProjectReactor reactor = getComponentByType(ProjectReactor.class);
    if (reactor == null) {
      // OK, not present, so look for a deprecated custom ProjectBootstrapper for old versions of SQ Runner
      ProjectBootstrapper bootstrapper = getComponentByType(ProjectBootstrapper.class);
      Settings settings = getComponentByType(Settings.class);
      if (bootstrapper == null
        // Starting from Maven plugin 2.3 then only DefaultProjectBootstrapper should be used.
        || "true".equals(settings.getString("sonar.mojoUseRunner"))) {
        // Use default SonarRunner project bootstrapper
        ProjectReactorBuilder builder = getComponentByType(ProjectReactorBuilder.class);
        reactor = builder.execute();
      } else {
        reactor = bootstrapper.bootstrap();
View Full Code Here

    assertThat(JavaUtils.abbreviatePackage("com.foo..bar"), is("com.f.b"));
  }

  @Test
  public void shouldReturnDefaultJavaVersion() {
    Settings configuration = new Settings();
    Project project = new Project("").setSettings(configuration);

    assertThat(JavaUtils.getSourceVersion(project), is("1.5"));
    assertThat(JavaUtils.getTargetVersion(project), is("1.5"));
  }
View Full Code Here

    assertThat(JavaUtils.getTargetVersion(project), is("1.5"));
  }

  @Test
  public void shouldReturnSpecifiedJavaVersion() {
    Settings configuration = new Settings();
    Project project = new Project("").setSettings(configuration);
    configuration.setProperty(JavaUtils.JAVA_SOURCE_PROPERTY, "1.4");
    configuration.setProperty(JavaUtils.JAVA_TARGET_PROPERTY, "1.6");

    assertThat(JavaUtils.getSourceVersion(project), is("1.4"));
    assertThat(JavaUtils.getTargetVersion(project), is("1.6"));
  }
View Full Code Here

  @Before
  public void setUp() {
    IndexFactory indexFactory = mock(IndexFactory.class);
    sonarEngine = new JavaCpdEngine(indexFactory, null, null);
    sonarBridgeEngine = new DefaultCpdEngine(indexFactory, new CpdMappings(), null, null, mock(BlockCache.class));
    settings = new Settings(new PropertyDefinitions(CpdPlugin.class));

    DefaultFileSystem fs = new DefaultFileSystem();
    sensor = new CpdSensor(sonarEngine, sonarBridgeEngine, settings, fs);
  }
View Full Code Here

TOP

Related Classes of org.sonar.api.config.Settings

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.