Search in sources :

Example 16 with Version

use of org.fagu.version.Version in project fmv by f-agu.

the class PdfInfoSoftProviderTestCase method testParseOnLinux_popplers.

/**
 * @throws IOException
 */
@Test
public void testParseOnLinux_popplers() throws IOException {
    Parser parser = newParser();
    parser.readLine("pdfinfo version 0.12.4");
    parser.readLine("Copyright 2005-2009 The Poppler Developers - http://poppler.freedesktop.org");
    parser.readLine("Copyright 1996-2004 Glyph & Cog, LLC");
    assertInfo(parser, new Version(0, 12, 4));
}
Also used : Version(org.fagu.version.Version) Parser(org.fagu.fmv.soft.find.ExecSoftFoundFactory.Parser) Test(org.junit.Test)

Example 17 with Version

use of org.fagu.version.Version in project fmv by f-agu.

the class VersionSoftPolicy method byProperties.

/**
 * @param versionSoftInfo
 * @return
 */
private SoftFound byProperties(VersionSoftInfo versionSoftInfo) {
    Optional<String> propertyMinVersion = getProperty(versionSoftInfo, "minversion");
    if (propertyMinVersion.isPresent()) {
        Version minVersion = Version.parse(propertyMinVersion.get());
        SoftPolicy onAllPlatforms = new VersionSoftPolicy().onAllPlatforms(minVersion(minVersion));
        return ((VersionSoftPolicy) onAllPlatforms).byDefined(versionSoftInfo);
    }
    return null;
}
Also used : Version(org.fagu.version.Version) SoftPolicy(org.fagu.fmv.soft.find.SoftPolicy)

Example 18 with Version

use of org.fagu.version.Version in project fmv by f-agu.

the class JavaSoftProviderTestCase method testParse18OnLinux.

/**
 * @throws IOException
 */
@Test
public void testParse18OnLinux() throws IOException {
    Parser parser = newParser();
    parser.readLine("openjdk version \"1.8.0_45\"");
    parser.readLine("OpenJDK Runtime Environment (build 1.8.0_45-b13)");
    parser.readLine("OpenJDK 64-Bit Server VM (build 25.45-b02, mixed mode)");
    assertInfo(parser, new Version(1, 8, 0, 45));
}
Also used : Version(org.fagu.version.Version) Parser(org.fagu.fmv.soft.find.ExecSoftFoundFactory.Parser) Test(org.junit.Test)

Example 19 with Version

use of org.fagu.version.Version in project fmv by f-agu.

the class PdfSoftProvider method getDefaultSoftPolicy.

// ***********************************************************************
/**
 * @return
 */
private static SoftPolicy getDefaultSoftPolicy() {
    Version v012 = new Version(0, 12);
    BiPredicate<SoftInfo, Provider> isProvider = (s, p) -> s instanceof XPdfVersionSoftInfo && ((XPdfVersionSoftInfo) s).getProvider() == p;
    return new VersionSoftPolicy().on("xpdf", s -> isProvider.test(s, Provider.XPDF), minVersion(Version.V3)).on("poppler", s -> isProvider.test(s, Provider.POPPLER), minVersion(v012)).onAllPlatforms(minVersion(v012));
}
Also used : Arrays(java.util.Arrays) VersionParserManager(org.fagu.version.VersionParserManager) SoftFound(org.fagu.fmv.soft.find.SoftFound) ProgramFilesLocatorSupplier(org.fagu.fmv.soft.win32.ProgramFilesLocatorSupplier) ArrayList(java.util.ArrayList) SoftProvider(org.fagu.fmv.soft.find.SoftProvider) BiPredicate(java.util.function.BiPredicate) Matcher(java.util.regex.Matcher) VersionSoftPolicy(org.fagu.fmv.soft.find.policy.VersionSoftPolicy) ObjectUtils(org.apache.commons.lang3.ObjectUtils) ExceptionKnownAnalyzer(org.fagu.fmv.soft.exec.exception.ExceptionKnownAnalyzer) XpdfExceptionKnownAnalyzer(org.fagu.fmv.soft.xpdf.exception.XpdfExceptionKnownAnalyzer) Soft(org.fagu.fmv.soft.Soft) SoftFoundFactory(org.fagu.fmv.soft.find.SoftFoundFactory) SoftLocator(org.fagu.fmv.soft.find.SoftLocator) SoftPolicy(org.fagu.fmv.soft.find.SoftPolicy) SystemUtils(org.apache.commons.lang3.SystemUtils) SoftInfo(org.fagu.fmv.soft.find.SoftInfo) IOException(java.io.IOException) Collectors(java.util.stream.Collectors) File(java.io.File) StandardCharsets(java.nio.charset.StandardCharsets) VersionSoftPolicy.minVersion(org.fagu.fmv.soft.find.policy.VersionSoftPolicy.minVersion) List(java.util.List) Parser(org.fagu.fmv.soft.find.ExecSoftFoundFactory.Parser) Pattern(java.util.regex.Pattern) Version(org.fagu.version.Version) Collections(java.util.Collections) SoftExecutor(org.fagu.fmv.soft.SoftExecutor) SoftInfo(org.fagu.fmv.soft.find.SoftInfo) VersionSoftPolicy(org.fagu.fmv.soft.find.policy.VersionSoftPolicy) VersionSoftPolicy.minVersion(org.fagu.fmv.soft.find.policy.VersionSoftPolicy.minVersion) Version(org.fagu.version.Version) SoftProvider(org.fagu.fmv.soft.find.SoftProvider)

Example 20 with Version

use of org.fagu.version.Version in project fmv by f-agu.

the class FFSoftProvider method addLibVersions.

/**
 * @param map
 * @param matcher
 */
static void addLibVersions(Map<String, Version> map, Matcher matcher) {
    String sver = matcher.group(2).replaceAll(" ", "");
    try {
        Version version = VersionParserManager.parse(sver);
        map.put(matcher.group(1), version);
    } catch (VersionParseException e) {
    // ignore
    }
}
Also used : Version(org.fagu.version.Version) VersionParseException(org.fagu.version.VersionParseException)

Aggregations

Version (org.fagu.version.Version)24 Test (org.junit.Test)16 Parser (org.fagu.fmv.soft.find.ExecSoftFoundFactory.Parser)15 Date (java.util.Date)3 SoftFound (org.fagu.fmv.soft.find.SoftFound)3 ArrayList (java.util.ArrayList)2 Matcher (java.util.regex.Matcher)2 SoftExecutor (org.fagu.fmv.soft.SoftExecutor)2 SoftInfo (org.fagu.fmv.soft.find.SoftInfo)2 SoftPolicy (org.fagu.fmv.soft.find.SoftPolicy)2 VersionSoftPolicy (org.fagu.fmv.soft.find.policy.VersionSoftPolicy)2 VersionSoftPolicy.minVersion (org.fagu.fmv.soft.find.policy.VersionSoftPolicy.minVersion)2 File (java.io.File)1 IOException (java.io.IOException)1 StandardCharsets (java.nio.charset.StandardCharsets)1 LocalDate (java.time.LocalDate)1 Arrays (java.util.Arrays)1 Calendar (java.util.Calendar)1 Collections (java.util.Collections)1 HashMap (java.util.HashMap)1