List of usage examples for org.apache.commons.configuration BaseConfiguration BaseConfiguration
BaseConfiguration
From source file:org.sonar.plugins.crowd.CrowdConfigurationTest.java
@Before public void setUp() { configuration = new BaseConfiguration(); crowdConfiguration = new CrowdConfiguration(configuration); }
From source file:org.sonar.plugins.csharp.api.CSharpConfigurationTest.java
@Before public void init() { configuration = new BaseConfiguration(); cSharpConfiguration = new CSharpConfiguration(configuration); }
From source file:org.sonar.plugins.csharp.core.CSharpProjectInitializerTest.java
@Before public void initProject() { conf = new BaseConfiguration(); project = mock(Project.class); when(project.getConfiguration()).thenReturn(conf); initializer = new CSharpProjectInitializer(); }
From source file:org.sonar.plugins.csharp.core.VisualStudioProjectBuilderTest.java
@Before public void initBuilder() { microsoftWindowsEnvironment = new MicrosoftWindowsEnvironment(); conf = new BaseConfiguration(); conf.setProperty("sonar.language", "cs"); conf.setProperty(CSharpConstants.DOTNET_4_0_SDK_DIR_KEY, fakeSdkDir.getAbsolutePath()); conf.setProperty(CSharpConstants.SILVERLIGHT_4_MSCORLIB_LOCATION_KEY, fakeSilverlightDir.getAbsolutePath()); solutionBaseDir = TestUtils.getResource("/solution/Example"); root = ProjectDefinition.create(new Properties()).setBaseDir(solutionBaseDir) .setWorkDir(new File(solutionBaseDir, "WORK-DIR")); root.setVersion("1.0"); root.setKey("groupId:artifactId"); reactor = new ProjectReactor(root); projectBuilder = new VisualStudioProjectBuilder(reactor, new CSharpConfiguration(conf), microsoftWindowsEnvironment); }
From source file:org.sonar.plugins.csharp.fxcop.FxCopSensorTest.java
@Test public void testExecuteWithoutRule() throws Exception { RulesProfile rulesProfile = mock(RulesProfile.class); when(rulesProfile.getActiveRulesByRepository(anyString())).thenReturn(new ArrayList<ActiveRule>()); FxCopSensor sensor = new FxCopSensor(null, rulesProfile, null, null, new CSharpConfiguration(new BaseConfiguration()), microsoftWindowsEnvironment); Project project = mock(Project.class); sensor.analyse(project, null);//from w w w .j a v a 2s .c o m verify(project, never()).getName(); }
From source file:org.sonar.plugins.csharp.fxcop.FxCopSensorTest.java
@Test public void testLaunchFxCop() throws Exception { FxCopSensor sensor = new FxCopSensor(fileSystem, null, null, null, new CSharpConfiguration(new BaseConfiguration()), microsoftWindowsEnvironment); FxCopRunner runner = mock(FxCopRunner.class); when(runner.createCommandBuilder(eq(solution), any(VisualStudioProject.class))).thenReturn( FxCopCommandBuilder.createBuilder(null, vsProject1).setExecutable(new File("FxCopCmd.exe"))); Project project = mock(Project.class); when(project.getName()).thenReturn("Project #1"); sensor.launchFxCop(project, runner, TestUtils.getResource("/Sensor/FakeFxCopConfigFile.xml")); verify(runner).execute(any(FxCopCommandBuilder.class), eq(10)); }
From source file:org.sonar.plugins.csharp.fxcop.FxCopSensorTest.java
@Test public void testShouldExecuteOnProject() throws Exception { Configuration conf = new BaseConfiguration(); FxCopSensor sensor = new FxCopSensor(null, null, null, null, new CSharpConfiguration(conf), microsoftWindowsEnvironment); Project project = mock(Project.class); when(project.getName()).thenReturn("Project #1"); when(project.getLanguageKey()).thenReturn("cs"); assertTrue(sensor.shouldExecuteOnProject(project)); conf.addProperty(FxCopConstants.MODE, FxCopConstants.MODE_SKIP); sensor = new FxCopSensor(null, null, null, null, new CSharpConfiguration(conf), microsoftWindowsEnvironment); assertFalse(sensor.shouldExecuteOnProject(project)); }
From source file:org.sonar.plugins.csharp.fxcop.FxCopSensorTest.java
@Test public void testShouldNotExecuteOnProjectUsingPatterns() throws Exception { Configuration conf = new BaseConfiguration(); conf.setProperty(FxCopConstants.ASSEMBLIES_TO_SCAN_KEY, new String[] { "**/*.whatever" }); FxCopSensor sensor = new FxCopSensor(null, null, null, null, new CSharpConfiguration(conf), microsoftWindowsEnvironment); when(solution.getSolutionDir()).thenReturn(TestUtils.getResource("/Sensor")); when(vsProject1.getDirectory()).thenReturn(TestUtils.getResource("/Sensor")); Project project = mock(Project.class); when(project.getName()).thenReturn("Project #1"); when(project.getLanguageKey()).thenReturn("cs"); assertFalse(sensor.shouldExecuteOnProject(project)); }
From source file:org.sonar.plugins.csharp.fxcop.FxCopSensorTest.java
@Test public void testGenerateConfigurationFile() throws Exception { File sonarDir = new File("target/sonar"); sonarDir.mkdirs();//from ww w . ja va2 s. c om ProjectFileSystem fileSystem = mock(ProjectFileSystem.class); when(fileSystem.getSonarWorkingDirectory()).thenReturn(sonarDir); FxCopProfileExporter profileExporter = mock(FxCopProfileExporter.class); doAnswer(new Answer<Object>() { public Object answer(InvocationOnMock invocation) throws IOException { FileWriter writer = (FileWriter) invocation.getArguments()[1]; writer.write("Hello"); return null; } }).when(profileExporter).exportProfile((RulesProfile) anyObject(), (FileWriter) anyObject()); FxCopSensor sensor = new FxCopSensor(fileSystem, null, profileExporter, null, new CSharpConfiguration(new BaseConfiguration()), microsoftWindowsEnvironment); sensor.generateConfigurationFile(); File report = new File(sonarDir, FxCopConstants.FXCOP_RULES_FILE); assertTrue(report.exists()); report.delete(); }
From source file:org.sonar.plugins.csharp.gallio.CoverageDecoratorTest.java
@Test public void testShouldNotExecuteOnProjectIfSkip() throws Exception { Configuration conf = new BaseConfiguration(); conf.setProperty(GallioConstants.MODE, GallioConstants.MODE_SKIP); CoverageDecorator decorator = new CoverageDecorator(new CSharpConfiguration(conf), microsoftWindowsEnvironment); assertFalse(decorator.shouldExecuteOnProject(project)); }