@Test public void testGetOsgiVersion() { assertThat( Version.getOsgiVersion( "1.0" ), equalTo( "1.0" ) ); assertThat( Version.getOsgiVersion( "1_2_3" ), equalTo( "1.2.3" ) ); assertThat( Version.getOsgiVersion( "1-2.3beta4" ), equalTo( "1.2.3.beta4" ) ); assertThat( Version.getOsgiVersion( "1.2.3.4.beta" ), equalTo( "1.2.3.4-beta" ) ); assertThat( Version.getOsgiVersion( "12.4-beta" ), equalTo( "12.4.0.beta" ) ); assertThat( Version.getOsgiVersion( "-beta1" ), equalTo( "-beta1" ) ); assertThat( Version.getOsgiVersion( "12.beta1_3-5.hello" ), equalTo( "12.0.0.beta1_3-5-hello" ) ); assertThat( Version.getOsgiVersion( "1.0.0.Final-t20170516223844555-redhat-1" ), equalTo( "1.0.0.Final-t20170516223844555-redhat-1" ) ); assertThat ( Version.getOsgiVersion( "1-0-3.4-beta2.1" ), equalTo( "1.0.3.4-beta2-1" )); assertThat ( Version.getOsgiVersion( "4.8-2" ), equalTo( "4.8.2" )); assertThat ( Version.getOsgiVersion( "4.5.1-1" ), equalTo( "4.5.1.1" )); assertThat ( Version.getOsgiVersion( "4.5.1-1.redhat-1" ), equalTo( "4.5.1.1-redhat-1" )); }
public static String getOsgiVersion(String version) { String qualifier = getQualifier( version ); if ( !isEmpty( qualifier ) ) { qualifier = OSGI_VERSION_DELIMITER + qualifier.replace( OSGI_VERSION_DELIMITER, OSGI_QUALIFIER_DELIMITER ); } String mmm = getOsgiMMM( version, !isEmpty( qualifier ) ); if ( isEmpty( mmm ) ) { logger.warn( "Unable to parse version for OSGi: {}", version ); return version; } return mmm + qualifier; }
Version { public static String getOsgiVersion(String version) { String qualifier = getQualifier( version ); if ( !isEmpty( qualifier ) ) { qualifier = OSGI_VERSION_DELIMITER + qualifier.replace( OSGI_VERSION_DELIMITER, OSGI_QUALIFIER_DELIMITER ); } String mmm = getOsgiMMM( version, !isEmpty( qualifier ) ); if ( isEmpty( mmm ) ) { logger.warn( "Unable to parse version for OSGi: {}", version ); return version; } return mmm + qualifier; } }
Version { public static String getOsgiVersion(String version) { String qualifier = getQualifier( version ); if ( !isEmpty( qualifier ) ) { qualifier = OSGI_VERSION_DELIMITER + qualifier.replace( OSGI_VERSION_DELIMITER, OSGI_QUALIFIER_DELIMITER ); } String mmm = getOsgiMMM( version, !isEmpty( qualifier ) ); if ( isEmpty( mmm ) ) { logger.warn( "Unable to parse version for OSGi: {}", version ); return version; } return mmm + qualifier; } private  Version(); }
Version { public static String getOsgiVersion(String version) { String qualifier = getQualifier( version ); if ( !isEmpty( qualifier ) ) { qualifier = OSGI_VERSION_DELIMITER + qualifier.replace( OSGI_VERSION_DELIMITER, OSGI_QUALIFIER_DELIMITER ); } String mmm = getOsgiMMM( version, !isEmpty( qualifier ) ); if ( isEmpty( mmm ) ) { logger.warn( "Unable to parse version for OSGi: {}", version ); return version; } return mmm + qualifier; } private  Version(); static String getBuildNumber(String version); static int getBuildNumberPadding( int incrementalSerialSuffixPadding, Set<String> versions ); static String getMMM(String version); static String getOsgiVersion(String version); static String getQualifier(String version); static String getQualifierBase(String version); static String getQualifierWithDelim(String version); static String getSnapshot( String version ); static String getSnapshotWithDelim( String version ); static boolean hasBuildNumber( String version ); static boolean hasQualifier( String version ); static boolean isEmpty( String string ); static boolean isSnapshot( String version ); static boolean isValidOSGi(String version); static String removeBuildNumber( String version ); static String removeSnapshot( String version ); static String appendQualifierSuffix( final String version, final String suffix ); static String setBuildNumber( String version, String buildNumber ); static String setSnapshot( String version, boolean snapshot ); static int findHighestMatchingBuildNumber(String version, Set<String> versionSet ); static int getIntegerBuildNumber( String version ); }
Version { public static String getOsgiVersion(String version) { String qualifier = getQualifier( version ); if ( !isEmpty( qualifier ) ) { qualifier = OSGI_VERSION_DELIMITER + qualifier.replace( OSGI_VERSION_DELIMITER, OSGI_QUALIFIER_DELIMITER ); } String mmm = getOsgiMMM( version, !isEmpty( qualifier ) ); if ( isEmpty( mmm ) ) { logger.warn( "Unable to parse version for OSGi: {}", version ); return version; } return mmm + qualifier; } private  Version(); static String getBuildNumber(String version); static int getBuildNumberPadding( int incrementalSerialSuffixPadding, Set<String> versions ); static String getMMM(String version); static String getOsgiVersion(String version); static String getQualifier(String version); static String getQualifierBase(String version); static String getQualifierWithDelim(String version); static String getSnapshot( String version ); static String getSnapshotWithDelim( String version ); static boolean hasBuildNumber( String version ); static boolean hasQualifier( String version ); static boolean isEmpty( String string ); static boolean isSnapshot( String version ); static boolean isValidOSGi(String version); static String removeBuildNumber( String version ); static String removeSnapshot( String version ); static String appendQualifierSuffix( final String version, final String suffix ); static String setBuildNumber( String version, String buildNumber ); static String setSnapshot( String version, boolean snapshot ); static int findHighestMatchingBuildNumber(String version, Set<String> versionSet ); static int getIntegerBuildNumber( String version ); static final String PROJECT_VERSION; }