Package org.sonar.wsclient.services

Examples of org.sonar.wsclient.services.Source


            @Override
            public List<Violation> compute() {
                return file.getProject().getComponent(SonarProjectComponent.class).getSonarCache().getViolations(file.getVirtualFile());
            }
        });
        Source source = ApplicationManager.getApplication().runReadAction(new Computable<Source>() {
            @Override
            public Source compute() {
                return file.getProject().getComponent(SonarProjectComponent.class).getSonarCache().getSource(file.getVirtualFile());
            }
        });
View Full Code Here


        Assert.assertNull(model.getCurrentVirtualFile());

        model.setViolations(file1, new ArrayList<Violation>());
        Assert.assertEquals(file1, model.getCurrentVirtualFile());

        model.setSource(file2, new Source());
        Assert.assertEquals(file2, model.getCurrentVirtualFile());
    }
View Full Code Here

        violations.add(new Violation());
        model.setViolations(file1, violations);
        Assert.assertSame(violations, model.violations);
        Assert.assertNull(model.source);

        Source source = new Source();
        model.setSource(file2, source);
        Assert.assertNotSame(violations, model.violations);
        Assert.assertSame(source, model.source);
    }
View Full Code Here

        Assert.assertEquals(model.getValueAt(1, 3), "UNKNOWN");
        Assert.assertEquals(model.getValueAt(1, 4), "This violation has a line associated with it");


        // Add source code
        Source source = new Source();
        source.addLine(10, "x = 123");

        model.setSource(file, source);

        Assert.assertEquals(model.getValueAt(0, 0), "Major");
        Assert.assertEquals(model.getValueAt(0, 1), "A rule");
View Full Code Here

public class SourceUnmarshallerTest extends UnmarshallerTestCase {

  @Test
  public void toModel() {
    Source source = new SourceUnmarshaller().toModel("[]");
    assertThat(source, nullValue());

    source = new SourceUnmarshaller().toModel(loadFile("/sources/source.json"));
    assertThat(source.getLines().size(), is(236));
    assertThat(source.getLine(3), is(" * Copyright (C) 2008-2014 SonarSource"));
  }
View Full Code Here

    assertThat(source.getLine(3), is(" * Copyright (C) 2008-2014 SonarSource"));
  }

  @Test
  public void fromLineToLine() {
    Source source = new SourceUnmarshaller().toModel(loadFile("/sources/from_line_to_line.json"));
    assertThat(source.getLines().size(), is(15));
    assertThat(source.getLine(1), nullValue());
    assertThat(source.getLine(3), is(" * Copyright (C) 2008-2014 SonarSource"));
  }
View Full Code Here

public class SourceUnmarshaller extends AbstractUnmarshaller<Source> {

  @Override
  protected Source parse(Object json) {
    WSUtils utils = WSUtils.getINSTANCE();
    Source source = new Source();

    for (String field : utils.getFields(json)) {
      source.addLine(Integer.parseInt(field), utils.getString(json, field));
    }

    return source;
  }
View Full Code Here

TOP

Related Classes of org.sonar.wsclient.services.Source

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.