info.magnolia.module.model.Version.parseVersion()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(9.6k)|赞(0)|评价(0)|浏览(83)

本文整理了Java中info.magnolia.module.model.Version.parseVersion()方法的一些代码示例,展示了Version.parseVersion()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Version.parseVersion()方法的具体详情如下:
包路径:info.magnolia.module.model.Version
类名称:Version
方法名:parseVersion

Version.parseVersion介绍

[英]Factory method that will parse a version string and return the correct Version implementation.
[中]工厂方法,该方法将解析版本字符串并返回正确的版本实现。

代码示例

代码示例来源:origin: info.magnolia/magnolia-core

private Version newVersionOrStar(String rangeDef, Version ifUndefined) {
  if ("*".equals(rangeDef.trim())) {
    return ifUndefined;
  }
  return Version.parseVersion(rangeDef);
}

代码示例来源:origin: info.magnolia/magnolia-core

@Test
public void test3and300shouldBeEquivalent() {
  assertTrue(Version.parseVersion("3").isEquivalent(Version.parseVersion("3.0.0")));
  assertFalse(Version.parseVersion("3.0.1").isEquivalent(Version.parseVersion("3.0.0")));
  assertFalse(Version.parseVersion("3.1.1").isEquivalent(Version.parseVersion("3.0.0")));
  assertFalse(Version.parseVersion("4.1.1").isEquivalent(Version.parseVersion("3.0.0")));
  assertFalse(Version.parseVersion("3.0.1").isEquivalent(Version.parseVersion("3.0.2")));
  assertFalse(Version.parseVersion("3.0.1").isEquivalent(Version.parseVersion("3.2.2")));
  assertFalse(Version.parseVersion("3.0.1").isEquivalent(Version.parseVersion("2.2.2")));
}

代码示例来源:origin: info.magnolia/magnolia-core

@Test
public void testShouldSupportAlphanumericClassifiers() {
  assertVersion(3, 0, 0, "x", Version.parseVersion("3.0.0-x"));
  assertVersion(3, 0, 0, "Y", Version.parseVersion("3.0.0-Y"));
  assertVersion(3, 0, 0, "5", Version.parseVersion("3.0.0-5"));
  assertVersion(3, 0, 0, "20060622gregYO", Version.parseVersion("3.0.0-20060622gregYO"));
}

代码示例来源:origin: info.magnolia/magnolia-core

@Test
public void testShouldSupportUnderscoresAndDashesInClassifiersToo() {
  assertVersion(3, 4, 5, "20060622-greg-YO", Version.parseVersion("3.4.5-20060622-greg-YO"));
  assertVersion(3, 4, 5, "20071102_fixed", Version.parseVersion("3.4.5-20071102_fixed"));
}

代码示例来源:origin: info.magnolia/magnolia-core

private Map buildModulesMapWithDependencyOn(String dependencyDefinitionVersion) {
  final Map modules = new HashMap();
  modules.put("module1", new ModuleDefinition("module1", Version.parseVersion("3.0"), null, null));
  final ModuleDefinition module2 = new ModuleDefinition("module2", Version.parseVersion("1.2"), null, null);
  module2.addDependency(new DependencyDefinition("module1", dependencyDefinitionVersion, false));
  modules.put("module2", module2);
  return modules;
}

代码示例来源:origin: info.magnolia.ui/magnolia-ui-admincentral

@Test
public void updateFrom50RemovesConfigurationAppDuplicateActionsGroup() throws Exception {
  // GIVEN
  configActionbarFolderGroups.addNode("duplicateActions", NodeTypes.ContentNode.NAME);
  assertTrue(configActionbarFolderGroups.hasNode("duplicateActions"));
  // WHEN
  executeUpdatesAsIfTheCurrentlyInstalledVersionWas(Version.parseVersion("5.0"));
  // THEN
  assertFalse(configActionbarFolderGroups.hasNode("duplicateActions"));
}

代码示例来源:origin: info.magnolia/magnolia-core

@Before
public void before() throws Exception {
  moduleRegistry = mock(ModuleRegistry.class);
  ctx = spy(new InstallContextImpl(moduleRegistry));
  ctx.setCurrentModule(new ModuleDefinition("test-module", Version.parseVersion("0"), null, null));
}

代码示例来源:origin: info.magnolia/magnolia-core

@Test
  public void testClassifiersAreIgnored() {
    final VersionComparator vc = new VersionComparator();
    assertTrue(vc.compare(Version.parseVersion("1.0-foo"), V100) == 0);
    assertTrue(vc.compare(V100, Version.parseVersion("1.0-bar")) == 0);
    assertTrue(vc.compare(V100, Version.parseVersion("2.0-bar")) < 0);
    assertTrue(vc.compare(Version.parseVersion("2.0.5-foo"), V101) > 0);
  }
}

代码示例来源:origin: info.magnolia.ui/magnolia-ui-admincentral

@Test
public void updateFrom502CreatesNewActionbarSectionInConfigApp() throws Exception {
  // GIVEN
  assertFalse(configActionbarSections.hasNode("multiple"));
  // WHEN
  executeUpdatesAsIfTheCurrentlyInstalledVersionWas(Version.parseVersion("5.0.2"));
  // THEN
  assertTrue(configActionbarSections.hasNode("multiple"));
}

代码示例来源:origin: info.magnolia.ui/magnolia-ui-admincentral

@Test
public void updateFrom533AddsRestorePreviousVersionNode() throws Exception {
  // GIVEN
  Node config = NodeUtil.createPath(session.getRootNode(), "/modules/ui-admincentral/commands/default", NodeTypes.Content.NAME);
  // WHEN
  executeUpdatesAsIfTheCurrentlyInstalledVersionWas(Version.parseVersion("5.3.3"));
  // THEN
  assertThat(config, hasNode("restorePreviousVersion"));
}

代码示例来源:origin: info.magnolia/magnolia-core

@Test
public void testRetrievesTheAppropriateDeltaForIntermediateUnregisteredVersion() {
  final List deltas = versionHandler.getDeltas(makeInstallContext("1.5"), Version.parseVersion("1.2.5"));
  assertEquals(2, deltas.size());
  assertEquals(d5, deltas.get(0));
  assertDefaultUpdateDelta((Delta) deltas.get(1));
}

代码示例来源:origin: info.magnolia/magnolia-core

@Test
public void testReturnsDefaultUpdateDeltaIfNoDeltaWasRegisteredForNewerVersion() {
  final List deltas = versionHandler.getDeltas(makeInstallContext("1.5"), Version.parseVersion("1.4"));
  assertNotNull(deltas);
  assertEquals(1, deltas.size());
  final Delta d = (Delta) deltas.get(0);
  assertDefaultUpdateDelta(d);
}

代码示例来源:origin: info.magnolia/magnolia-core

/**
   * No dependencies.
   */
  @Test
  public void testCalcDependencyLevelWithNoDependencies() {
    final ModuleDefinition modDefA = new ModuleDefinition("mod-a", Version.parseVersion("1"), "fake.Module", null);

    final Map<String, ModuleDefinition> map = new HashMap<String, ModuleDefinition>();
    map.put(modDefA.getName(), modDefA);

    final DependencyLevelComparator reg = new DependencyLevelComparator(map);

    assertEquals(0, reg.calcDependencyDepth(modDefA));
  }
}

代码示例来源:origin: info.magnolia.ui/magnolia-ui-admincentral

@Test
public void updateFrom551SetVerificationCurrentPasswordPropertyAndNewDefinitionClass() throws Exception {
  // GIVEN
  // WHEN
  executeUpdatesAsIfTheCurrentlyInstalledVersionWas(Version.parseVersion("5.5.1"));
  // THEN
  assertThat(session.getNode("/modules/ui-admincentral/dialogs/editUserProfile/form/tabs/user/fields/pswd"), hasProperty("verificationCurrentPassword", Boolean.TRUE));
  assertThat(session.getNode("/modules/ui-admincentral/dialogs/editUserProfile/actions/commit"), hasProperty("class", "info.magnolia.ui.admincentral.usermenu.action.SaveUserProfileDialogAction$Definition"));
}

代码示例来源:origin: info.magnolia/magnolia-core

@Test
public void updateFrom553() throws Exception {
  // GIVEN
  Node mimeMapping = NodeUtil.createPath(configSession.getRootNode(), "/server/MIMEMapping", NodeTypes.Content.NAME);
  // WHEN
  executeUpdatesAsIfTheCurrentlyInstalledVersionWas(Version.parseVersion("5.5.3"));
  // THEN
  assertThat(mimeMapping, hasNode("x-yaml"));
}

代码示例来源:origin: info.magnolia/magnolia-core

@Test
public void updateFrom549AddsKoreanLanguage() throws Exception {
  // GIVEN
  Node languages = NodeUtil.createPath(configSession.getRootNode(), "/server/i18n/system/languages", NodeTypes.ContentNode.NAME, true);
  // WHEN
  executeUpdatesAsIfTheCurrentlyInstalledVersionWas(Version.parseVersion("5.4.9"));
  // THEN
  assertThat(languages, hasNode("ko"));
}

代码示例来源:origin: info.magnolia/magnolia-core

@Test
public void testReturnsEmptyListIfLatestDeltaWasRegisteredForCurrentVersion() {
  final List deltas = versionHandler.getDeltas(makeInstallContext("1.3"), Version.parseVersion("1.3"));
  assertNotNull(deltas);
  assertEquals(0, deltas.size());
}

代码示例来源:origin: info.magnolia/magnolia-core

public static VersionMatcher version(String strVersion) {
  final Version version = Version.parseVersion(strVersion);
  return version().
      withMajor(equalTo(version.getMajor())).
      withMinor(equalTo(version.getMinor())).
      withPatch(equalTo(version.getPatch())).
      withClassifier(equalTo(version.getClassifier()));
}

代码示例来源:origin: info.magnolia.ui/magnolia-ui-admincentral

@Test
public void updateFrom521AddsEmptyItemTypesInToParamsOfActivateAction() throws Exception {
  // GIVEN
  this.setupConfigNode("/modules/ui-admincentral/apps/configuration/subApps/browser/actions/activate");
  // WHEN
  executeUpdatesAsIfTheCurrentlyInstalledVersionWas(Version.parseVersion("5.2.1"));
  // THEN
  assertTrue(session.itemExists("/modules/ui-admincentral/apps/configuration/subApps/browser/actions/activate/params/itemTypes"));
  assertEquals("", session.getProperty("/modules/ui-admincentral/apps/configuration/subApps/browser/actions/activate/params/itemTypes").getString());
}

代码示例来源:origin: info.magnolia/magnolia-core

@Test
public void testCheckModuleAndDeltasToStringForUpdate() {
  final ModuleDefinition mod = new ModuleDefinition("foo", Version.parseVersion("2.3.4"), null, null);
  final Delta d1 = DeltaBuilder.update("1.1", "New version").addTask(new WarnTask("t1", "test 1")).addTask(new WarnTask("t2", "test 2"));
  final Delta d2 = DeltaBuilder.update("2.0", "New version 2").addTask(new WarnTask("t3", "test 3")).addTask(new WarnTask("t3", "test 4"));
  ModuleManager.ModuleAndDeltas mad = new ModuleManager.ModuleAndDeltas(mod, Version.parseVersion("1.0"), Arrays.asList(d1, d2));
  assertEquals("ModuleAndDeltas for foo: current version is 1.0.0, updating to 2.3.4 with 2 deltas.", mad.toString());
}

相关文章