@Test public void should_create_sonar_way_profile() { SonarRuntime sonarRuntime = SonarRuntimeImpl.forSonarQube(Version.create(7, 3), SonarQubeSide.SERVER); ValidationMessages validation = ValidationMessages.create(); BuiltInQualityProfilesDefinition.Context context = new BuiltInQualityProfilesDefinition.Context(); XmlSonarWayProfile definition = new XmlSonarWayProfile(sonarRuntime); definition.define(context); BuiltInQualityProfilesDefinition.BuiltInQualityProfile profile = context.profile(Xml.KEY, Xml.SONAR_WAY_PROFILE_NAME); assertThat(profile.language()).isEqualTo(Xml.KEY); assertThat(profile.name()).isEqualTo(Xml.SONAR_WAY_PROFILE_NAME); assertThat(profile.rules().size()).isEqualTo(4); assertThat(profile.rules().size()).isLessThan(CheckList.getCheckClasses().size()); assertThat(validation.hasErrors()).isFalse(); }
@Override public void define(Context context) { NewBuiltInQualityProfile sonarWay = context.createBuiltInQualityProfile(Xml.SONAR_WAY_PROFILE_NAME, Xml.KEY); BuiltInQualityProfileJsonLoader.load(sonarWay, Xml.REPOSITORY_KEY, Xml.SONAR_WAY_PATH, Xml.XML_RESOURCE_PATH, sonarRuntime); sonarWay.done(); }
XmlSonarWayProfile implements BuiltInQualityProfilesDefinition { @Override public void define(Context context) { NewBuiltInQualityProfile sonarWay = context.createBuiltInQualityProfile(Xml.SONAR_WAY_PROFILE_NAME, Xml.KEY); BuiltInQualityProfileJsonLoader.load(sonarWay, Xml.REPOSITORY_KEY, Xml.SONAR_WAY_PATH, Xml.XML_RESOURCE_PATH, sonarRuntime); sonarWay.done(); } }
XmlSonarWayProfile implements BuiltInQualityProfilesDefinition { @Override public void define(Context context) { NewBuiltInQualityProfile sonarWay = context.createBuiltInQualityProfile(Xml.SONAR_WAY_PROFILE_NAME, Xml.KEY); BuiltInQualityProfileJsonLoader.load(sonarWay, Xml.REPOSITORY_KEY, Xml.SONAR_WAY_PATH, Xml.XML_RESOURCE_PATH, sonarRuntime); sonarWay.done(); } XmlSonarWayProfile(SonarRuntime sonarRuntime); }
XmlSonarWayProfile implements BuiltInQualityProfilesDefinition { @Override public void define(Context context) { NewBuiltInQualityProfile sonarWay = context.createBuiltInQualityProfile(Xml.SONAR_WAY_PROFILE_NAME, Xml.KEY); BuiltInQualityProfileJsonLoader.load(sonarWay, Xml.REPOSITORY_KEY, Xml.SONAR_WAY_PATH, Xml.XML_RESOURCE_PATH, sonarRuntime); sonarWay.done(); } XmlSonarWayProfile(SonarRuntime sonarRuntime); @Override void define(Context context); }
XmlSonarWayProfile implements BuiltInQualityProfilesDefinition { @Override public void define(Context context) { NewBuiltInQualityProfile sonarWay = context.createBuiltInQualityProfile(Xml.SONAR_WAY_PROFILE_NAME, Xml.KEY); BuiltInQualityProfileJsonLoader.load(sonarWay, Xml.REPOSITORY_KEY, Xml.SONAR_WAY_PATH, Xml.XML_RESOURCE_PATH, sonarRuntime); sonarWay.done(); } XmlSonarWayProfile(SonarRuntime sonarRuntime); @Override void define(Context context);  }