• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Version类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.sonar.api.utils.Version的典型用法代码示例。如果您正苦于以下问题:Java Version类的具体用法?Java Version怎么用?Java Version使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Version类属于org.sonar.api.utils包,在下文中一共展示了Version类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: test

import org.sonar.api.utils.Version; //导入依赖的package包/类
@Test
public void test() {
	final PackageAnalyzerPlugin subject = new PackageAnalyzerPlugin();
	final Plugin.Context context = new Plugin.Context(SonarRuntimeImpl.forSonarQube(Version.create(5, 6), SonarQubeSide.SERVER));

	Assert.assertEquals(0, context.getExtensions().size());
	subject.define(context);
	
	// Rules
	Assert.assertTrue(context.getExtensions().contains(AbstractnessRule.class));
	Assert.assertTrue(context.getExtensions().contains(AfferentCouplingRule.class));
	Assert.assertTrue(context.getExtensions().contains(EfferentCouplingRule.class));
	Assert.assertTrue(context.getExtensions().contains(InstabilityRule.class));
	Assert.assertTrue(context.getExtensions().contains(MissingPackageInfoRule.class));
	Assert.assertTrue(context.getExtensions().contains(NumberOfClassesAndInterfacesRule.class));
	Assert.assertTrue(context.getExtensions().contains(PackageDependencyCyclesRule.class));
	
	// Java
	Assert.assertTrue(context.getExtensions().contains(JavaRules.class));
	Assert.assertTrue(context.getExtensions().contains(JavaSensor.class));
	
}
 
开发者ID:willemsrb,项目名称:sonar-packageanalyzer-plugin,代码行数:23,代码来源:PackageAnalyzerPluginTest.java


示例2: getMockContext

import org.sonar.api.utils.Version; //导入依赖的package包/类
private Context getMockContext() {
	return new Context(new SonarRuntime() {
		@Override
		public Version getApiVersion() {
			return null;
		}

		@Override
		public SonarProduct getProduct() {
			return null;
		}

		@Override
		public SonarQubeSide getSonarQubeSide() {
			return null;
		}
	});
}
 
开发者ID:Wikia,项目名称:sonar-php-rules,代码行数:19,代码来源:PluginTest.java


示例3: doBeforeStart

import org.sonar.api.utils.Version; //导入依赖的package包/类
@Override
protected void doBeforeStart() {
  Version version = ApiVersion.load(System2.INSTANCE);
  add(
    StandalonePluginIndex.class,
    PluginRepository.class,
    PluginCacheLoader.class,
    PluginLoader.class,
    PluginClassloaderFactory.class,
    DefaultPluginJarExploder.class,
    ExtensionInstaller.class,
    new SonarQubeVersion(version),
    SonarRuntimeImpl.forSonarQube(version, SonarQubeSide.SCANNER),

    new GlobalTempFolderProvider(),
    UriReader.class,
    new PluginCacheProvider(),
    System2.INSTANCE);
}
 
开发者ID:instalint-org,项目名称:instalint,代码行数:20,代码来源:StandaloneGlobalContainer.java


示例4: testExtensions

import org.sonar.api.utils.Version; //导入依赖的package包/类
@Test
@SuppressWarnings("rawtypes")
public void testExtensions() {

	final SonarRuntime runtime = SonarRuntimeImpl.forSonarQube(Version.create(6, 7),
			SonarQubeSide.SCANNER);
	final Plugin.Context context = new Plugin.Context(runtime);
	new XanitizerSonarQubePlugin().define(context);

	final List extensions = context.getExtensions();
	assertNotNull(extensions);

	assertTrue(extensions.contains(XanitizerSensor.class));
	assertTrue(extensions.contains(XanitizerMetrics.class));
	assertTrue(extensions.contains(XanitizerRulesDefinition.class));
}
 
开发者ID:RIGS-IT,项目名称:sonar-xanitizer,代码行数:17,代码来源:PluginTest.java


示例5: InputFileContentExtractor

import org.sonar.api.utils.Version; //导入依赖的package包/类
public InputFileContentExtractor(SensorContext sensorContext) {
  Version version = sensorContext.getSonarQubeVersion();
  if (version.isGreaterThanOrEqual(V6_2)) {
    this.sonarQubeAdapter = new SonarQube62Adapter();
  } else if (version.isGreaterThanOrEqual(V6_0)) {
    this.sonarQubeAdapter = new SonarQube60Adapter();
  } else {
    this.sonarQubeAdapter = new SonarQube56Adapter(sensorContext.fileSystem().encoding());
  }
}
 
开发者ID:SonarSource,项目名称:sonar-analyzer-commons,代码行数:11,代码来源:InputFileContentExtractor.java


示例6: sq56

import org.sonar.api.utils.Version; //导入依赖的package包/类
@Test
public void sq56() throws Exception {
  setRuntime(Version.create(5, 6));
  setFileSystemEncoding(StandardCharsets.UTF_8);
  when(inputFile.file()).thenReturn(file);
  Assertions.assertThat(content(inputFile)).isEqualTo("Hello!\n");
}
 
开发者ID:SonarSource,项目名称:sonar-analyzer-commons,代码行数:8,代码来源:InputFileContentExtractorTest.java


示例7: sq60

import org.sonar.api.utils.Version; //导入依赖的package包/类
@Test
public void sq60() throws Exception {
  setRuntime(Version.create(6, 0));
  setFileSystemEncoding(StandardCharsets.UTF_16);
  when(inputFile.file()).thenReturn(file);
  when(inputFile.charset()).thenReturn(StandardCharsets.UTF_8);
  Assertions.assertThat(content(inputFile)).isEqualTo("Hello!\n");
}
 
开发者ID:SonarSource,项目名称:sonar-analyzer-commons,代码行数:9,代码来源:InputFileContentExtractorTest.java


示例8: test

import org.sonar.api.utils.Version; //导入依赖的package包/类
@Test
public void test() {
	final IssueResolverPlugin subject = new IssueResolverPlugin();
	final Plugin.Context context = new Plugin.Context(SonarRuntimeImpl.forSonarQube(Version.create(5, 6), SonarQubeSide.SERVER));

	Assert.assertEquals(0, context.getExtensions().size());
	subject.define(context);
	Assert.assertEquals(5, context.getExtensions().size());
}
 
开发者ID:willemsrb,项目名称:sonar-issueresolver-plugin,代码行数:10,代码来源:IssueResolverPluginTest.java


示例9: testGetters

import org.sonar.api.utils.Version; //导入依赖的package包/类
@Test
public void testGetters() {
  when(sqRuntime.getApiVersion()).thenReturn(Version.create(6, 1));

  assertThat(ctx.activeRules()).isEqualTo(activeRules);
  assertThat(ctx.settings()).isEqualTo(settings);
  assertThat(ctx.fileSystem()).isEqualTo(fs);
  assertThat(ctx.module()).isEqualTo(module);
  assertThat(ctx.runtime()).isEqualTo(sqRuntime);

  assertThat(ctx.getSonarQubeVersion()).isEqualTo(Version.create(6, 1));

  // no ops
  assertThat(ctx.newCpdTokens()).isInstanceOf(NoOpNewCpdTokens.class);
  assertThat(ctx.newMeasure()).isInstanceOf(NoOpNewMeasure.class);
  assertThat(ctx.newCoverage()).isInstanceOf(NoOpNewCoverage.class);
  assertThat(ctx.isCancelled()).isFalse();
  ctx.addContextProperty(null, null);
  ctx.markForPublishing(null);

  verify(sqRuntime).getApiVersion();

  verifyNoMoreInteractions(sqRuntime);
  verifyZeroInteractions(module);
  verifyZeroInteractions(settings);
  verifyZeroInteractions(fs);
  verifyZeroInteractions(activeRules);
  verifyZeroInteractions(sensorStorage);
}
 
开发者ID:instalint-org,项目名称:instalint,代码行数:30,代码来源:DefaultSensorContextTest.java


示例10: should_get_the_right_version

import org.sonar.api.utils.Version; //导入依赖的package包/类
@Test
public void should_get_the_right_version() {
  Context context = new Context(Version.create(5, 6));
  new Plugin().define(context);
  assertThat(context.getSonarQubeVersion().major()).isEqualTo(5);
  assertThat(context.getSonarQubeVersion().minor()).isEqualTo(6);
}
 
开发者ID:racodond,项目名称:sonar-css-plugin,代码行数:8,代码来源:PluginTest.java


示例11: should_get_the_right_version

import org.sonar.api.utils.Version; //导入依赖的package包/类
@Test
public void should_get_the_right_version() {
  Plugin.Context context = new Plugin.Context(Version.create(5, 6));
  new MyCssCustomRulesPlugin().define(context);
  assertThat(context.getSonarQubeVersion().major()).isEqualTo(5);
  assertThat(context.getSonarQubeVersion().minor()).isEqualTo(6);
}
 
开发者ID:racodond,项目名称:sonar-css-custom-rules-plugin,代码行数:8,代码来源:MyCssCustomRulesPluginTest.java


示例12: test

import org.sonar.api.utils.Version; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Test
public void test() {
    SonarRuntime runtime = SonarRuntimeImpl.forSonarQube(Version.create(5, 6), SonarQubeSide.SERVER);
    Plugin.Context context = new Plugin.Context(runtime);
    new PerlPlugin().define(context);
    assertThat(context.getExtensions()).hasSize(7);
}
 
开发者ID:sonar-perl,项目名称:sonar-perl,代码行数:9,代码来源:PerlPluginTest.java


示例13: testDefine

import org.sonar.api.utils.Version; //导入依赖的package包/类
@Test
public void testDefine() {
  GherkinLangPlugin plugin = new GherkinLangPlugin();
  Plugin.Context context = new Plugin.Context(Version.create(0, 0));
  plugin.define(context);
  assertThat(context.getExtensions()).hasSize(5);
}
 
开发者ID:silverbulleters,项目名称:sonar-gherkin,代码行数:8,代码来源:GherkinLangPluginTest.java


示例14: should_get_the_right_version

import org.sonar.api.utils.Version; //导入依赖的package包/类
@Test
public void should_get_the_right_version() {
  Plugin.Context context = new Plugin.Context(Version.create(5, 6));
  new MyGherkinCustomRulesPlugin().define(context);
  assertThat(context.getSonarQubeVersion().major()).isEqualTo(5);
  assertThat(context.getSonarQubeVersion().minor()).isEqualTo(6);
}
 
开发者ID:racodond,项目名称:sonar-gherkin-plugin,代码行数:8,代码来源:MyGherkinCustomRulesPluginTest.java


示例15: should_get_the_right_version

import org.sonar.api.utils.Version; //导入依赖的package包/类
@Test
public void should_get_the_right_version() {
  Plugin.Context context = new Plugin.Context(Version.create(5, 6));
  new GherkinPlugin().define(context);
  assertThat(context.getSonarQubeVersion().major()).isEqualTo(5);
  assertThat(context.getSonarQubeVersion().minor()).isEqualTo(6);
}
 
开发者ID:racodond,项目名称:sonar-gherkin-plugin,代码行数:8,代码来源:GherkinPluginTest.java


示例16: getExtensions

import org.sonar.api.utils.Version; //导入依赖的package包/类
@Test
public void getExtensions() {
  SonarRuntime runtime = SonarRuntimeImpl.forSonarQube(Version.create(5, 6), SonarQubeSide.SCANNER);
  Plugin.Context context = new Plugin.Context(runtime);
  new GitPlugin().define(context);
  assertThat(context.getExtensions()).hasSize(2);
}
 
开发者ID:SonarSource,项目名称:sonar-scm-git,代码行数:8,代码来源:GitPluginTest.java


示例17: getExtensions

import org.sonar.api.utils.Version; //导入依赖的package包/类
@Test
public void getExtensions() {
  SonarRuntime runtime = SonarRuntimeImpl.forSonarQube(Version.create(5, 6), SonarQubeSide.SCANNER);
  Plugin.Context context = new Plugin.Context(runtime);
  new SvnPlugin().define(context);
  assertThat(context.getExtensions()).hasSize(7);
}
 
开发者ID:SonarSource,项目名称:sonar-scm-svn,代码行数:8,代码来源:SvnPluginTest.java


示例18: should_get_the_right_version

import org.sonar.api.utils.Version; //导入依赖的package包/类
@Test
public void should_get_the_right_version() {
  Plugin.Context context = new Plugin.Context(Version.create(5, 6));
  new JavaPropertiesPlugin().define(context);
  assertThat(context.getSonarQubeVersion().major()).isEqualTo(5);
  assertThat(context.getSonarQubeVersion().minor()).isEqualTo(6);
}
 
开发者ID:racodond,项目名称:sonar-jproperties-plugin,代码行数:8,代码来源:JavaPropertiesPluginTest.java


示例19: should_get_the_right_version

import org.sonar.api.utils.Version; //导入依赖的package包/类
@Test
public void should_get_the_right_version() {
  Plugin.Context context = new Plugin.Context(Version.create(5, 6));
  new JSONPlugin().define(context);
  assertThat(context.getSonarQubeVersion().major()).isEqualTo(5);
  assertThat(context.getSonarQubeVersion().minor()).isEqualTo(6);
}
 
开发者ID:racodond,项目名称:sonar-json-plugin,代码行数:8,代码来源:JSONPluginTest.java


示例20: wrap

import org.sonar.api.utils.Version; //导入依赖的package包/类
public static Collection<CompatibleInputFile> wrap(Iterable<InputFile> inputFiles, SensorContext context) {
  Version version = context.getSonarQubeVersion();
  if (version.isGreaterThanOrEqual(V6_2)) {
    return inputFileStream(inputFiles).map(CompatibleInputFile::new).collect(Collectors.toList());
  }
  if (version.isGreaterThanOrEqual(V6_0)) {
    return inputFileStream(inputFiles).map(InputFileV60Compat::new).collect(Collectors.toList());
  }
  return inputFileStream(inputFiles).map(f -> new InputFileV56Compat(f, context)).collect(Collectors.toList());
}
 
开发者ID:SonarSource,项目名称:sonar-xml,代码行数:11,代码来源:CompatibilityHelper.java



注:本文中的org.sonar.api.utils.Version类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java MultiViewElementCallback类代码示例发布时间:2022-05-21
下一篇:
Java GameMath类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap