Search in sources :

Example 6 with CheckstyleProjectService

use of org.infernus.idea.checkstyle.CheckstyleProjectService in project checkstyle-idea by jshiell.

the class OpLoadConfigurationTest method testLoadFromString.

@Test
public void testLoadFromString() throws IOException, URISyntaxException {
    CheckstyleProjectService projectService = mock(CheckstyleProjectService.class);
    when(projectService.underlyingClassLoader()).thenReturn(getClass().getClassLoader());
    final String configXml = FileUtil.readFile("cmd/config-ok.xml");
    CheckstyleInternalObject csConfig = new CheckstyleActionsImpl(PROJECT, projectService).loadConfiguration(configXml);
    Assert.assertNotNull(csConfig);
}
Also used : CheckstyleActionsImpl(org.infernus.idea.checkstyle.service.CheckstyleActionsImpl) CheckstyleInternalObject(org.infernus.idea.checkstyle.csapi.CheckstyleInternalObject) CheckstyleProjectService(org.infernus.idea.checkstyle.CheckstyleProjectService) Test(org.junit.Test)

Example 7 with CheckstyleProjectService

use of org.infernus.idea.checkstyle.CheckstyleProjectService in project checkstyle-idea by jshiell.

the class OpLoadConfigurationTest method testLoadBundledGoogleChecks.

@Test
public void testLoadBundledGoogleChecks() {
    final ConfigurationLocationFactory clf = new ConfigurationLocationFactory();
    CheckstyleProjectService projectService = mock(CheckstyleProjectService.class);
    when(projectService.underlyingClassLoader()).thenReturn(getClass().getClassLoader());
    CheckstyleInternalObject csConfig = new CheckstyleActionsImpl(PROJECT, projectService).loadConfiguration(clf.create(BundledConfig.GOOGLE_CHECKS, mock(Project.class)), true, null);
    Assert.assertNotNull(csConfig);
}
Also used : CheckstyleActionsImpl(org.infernus.idea.checkstyle.service.CheckstyleActionsImpl) ConfigurationLocationFactory(org.infernus.idea.checkstyle.model.ConfigurationLocationFactory) CheckstyleInternalObject(org.infernus.idea.checkstyle.csapi.CheckstyleInternalObject) CheckstyleProjectService(org.infernus.idea.checkstyle.CheckstyleProjectService) Test(org.junit.Test)

Example 8 with CheckstyleProjectService

use of org.infernus.idea.checkstyle.CheckstyleProjectService in project checkstyle-idea by jshiell.

the class CodeStyleImporterTest method setUp.

@Override
protected void setUp() throws Exception {
    super.setUp();
    PluginConfigurationManager mockPluginConfig = mock(PluginConfigurationManager.class);
    final PluginConfiguration mockConfigDto = PluginConfigurationBuilder.testInstance("8.0").build();
    when(mockPluginConfig.getCurrent()).thenReturn(mockConfigDto);
    when(project.getService(PluginConfigurationManager.class)).thenReturn(mockPluginConfig);
    csService = new CheckstyleProjectService(project);
    codeStyleSettings = CodeStyleSettingsManager.createTestSettings(CodeStyleSettings.getDefaults());
    javaSettings = codeStyleSettings.getCommonSettings(JavaLanguage.INSTANCE);
}
Also used : PluginConfigurationManager(org.infernus.idea.checkstyle.config.PluginConfigurationManager) PluginConfiguration(org.infernus.idea.checkstyle.config.PluginConfiguration) CheckstyleProjectService(org.infernus.idea.checkstyle.CheckstyleProjectService)

Aggregations

CheckstyleProjectService (org.infernus.idea.checkstyle.CheckstyleProjectService)8 Test (org.junit.Test)5 CheckstyleInternalObject (org.infernus.idea.checkstyle.csapi.CheckstyleInternalObject)3 CheckstyleActionsImpl (org.infernus.idea.checkstyle.service.CheckstyleActionsImpl)3 PluginConfiguration (org.infernus.idea.checkstyle.config.PluginConfiguration)2 PluginConfigurationManager (org.infernus.idea.checkstyle.config.PluginConfigurationManager)2 ConfigurationLocationFactory (org.infernus.idea.checkstyle.model.ConfigurationLocationFactory)2 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 CheckstyleException (com.puppycrawl.tools.checkstyle.api.CheckstyleException)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 URLClassLoader (java.net.URLClassLoader)1 Before (org.junit.Before)1 BeforeClass (org.junit.BeforeClass)1