public static VersionValidity isValidVersion( final int prptVersionMajorRaw, final int prptVersionMinorRaw, final int prptVersionPatchRaw ) { return getInstance().isValidVersion( prptVersionMajorRaw, prptVersionMinorRaw, prptVersionPatchRaw, ClassicEngineInfo.getInstance() ); }
private void validateVersionNumbers( final int prptVersionMajorRaw, final int prptVersionMinorRaw, final int prptVersionPatchRaw ) throws ParseException { final ClassicEngineBoot.VersionValidity v = ClassicEngineBoot.isValidVersion( prptVersionMajorRaw, prptVersionMinorRaw, prptVersionPatchRaw ); if ( v == ClassicEngineBoot.VersionValidity.INVALID_RELEASE ) { throw new ParseException( String.format( "The report file you are trying to load was created with " + "Pentaho Reporting %d.%d but you are trying to run it with Pentaho Reporting %s. " + "Please update your reporting installation to match the report designer that was used " + "to create this file.", prptVersionMajorRaw, prptVersionMinorRaw, ClassicEngineInfo.getInstance() .getVersion() ) ); } else if ( v == ClassicEngineBoot.VersionValidity.INVALID_PATCH ) { logger.warn( String.format( "The report file you are trying to load was created with Pentaho " + "Reporting %d.%d.%d but you are trying to run it with Pentaho Reporting %s. " + "Your reporting engine version may not have all features or bug-fixes required to display " + "this report properly.", prptVersionMajorRaw, prptVersionMinorRaw, prptVersionPatchRaw, ClassicEngineInfo .getInstance().getVersion() ) ); } }
public void testTrunkIsValid() { // Set current version to 3.3.3 final ProjectInformation projectInfo = Mockito.mock( ProjectInformation.class ); Mockito.when( projectInfo.getReleaseMajor() ).thenReturn( "999" ); Mockito.when( projectInfo.getReleaseMinor() ).thenReturn( "999" ); Mockito.when( projectInfo.getReleaseMilestone() ).thenReturn( "999" ); final int[] trunk = parseVersionId( ClassicEngineBoot.VERSION_TRUNK ); Assert.assertEquals( "TRUNK version must be valid", ClassicEngineBoot.VersionValidity.VALID, ClassicEngineBoot .getInstance().isValidVersion( trunk[0], trunk[1], trunk[2], projectInfo ) ); Assert.assertEquals( "The same version must be valid", ClassicEngineBoot.VersionValidity.VALID, ClassicEngineBoot .getInstance().isValidVersion( 3, 3, 3, projectInfo ) ); Assert.assertEquals( "Older version must be valid", ClassicEngineBoot.VersionValidity.VALID, ClassicEngineBoot .getInstance().isValidVersion( 2, 2, 2, projectInfo ) ); Assert.assertEquals( "Newer major version must be release valid", ClassicEngineBoot.VersionValidity.VALID, ClassicEngineBoot.getInstance().isValidVersion( 4, 3, 3, projectInfo ) ); Assert.assertEquals( "Newer minor version must be release valid", ClassicEngineBoot.VersionValidity.VALID, ClassicEngineBoot.getInstance().isValidVersion( 3, 4, 3, projectInfo ) ); Assert.assertEquals( "Newer patch version must be patch valid", ClassicEngineBoot.VersionValidity.VALID, ClassicEngineBoot.getInstance().isValidVersion( 3, 3, 4, projectInfo ) ); }
public void testIsValidVersion() { // Set current version to 3.3.3 final ProjectInformation projectInfo = Mockito.mock( ProjectInformation.class ); Mockito.when( projectInfo.getReleaseMajor() ).thenReturn( "3" ); Mockito.when( projectInfo.getReleaseMinor() ).thenReturn( "3" ); Mockito.when( projectInfo.getReleaseMilestone() ).thenReturn( "3" ); final int[] trunk = parseVersionId( ClassicEngineBoot.VERSION_TRUNK ); Assert.assertEquals( "TRUNK version must be valid", ClassicEngineBoot.VersionValidity.VALID, ClassicEngineBoot .getInstance().isValidVersion( trunk[0], trunk[1], trunk[2], projectInfo ) ); Assert.assertEquals( "The same version must be valid", ClassicEngineBoot.VersionValidity.VALID, ClassicEngineBoot .getInstance().isValidVersion( 3, 3, 3, projectInfo ) ); Assert.assertEquals( "Older version must be valid", ClassicEngineBoot.VersionValidity.VALID, ClassicEngineBoot .getInstance().isValidVersion( 2, 2, 2, projectInfo ) ); Assert.assertEquals( "Newer major version must be release invalid", ClassicEngineBoot.VersionValidity.INVALID_RELEASE, ClassicEngineBoot.getInstance().isValidVersion( 4, 3, 3, projectInfo ) ); Assert.assertEquals( "Newer minor version must be release invalid", ClassicEngineBoot.VersionValidity.INVALID_RELEASE, ClassicEngineBoot.getInstance().isValidVersion( 3, 4, 3, projectInfo ) ); Assert.assertEquals( "Newer patch version must be patch invalid", ClassicEngineBoot.VersionValidity.INVALID_PATCH, ClassicEngineBoot.getInstance().isValidVersion( 3, 3, 4, projectInfo ) ); }