org.hd.d.pg2k.test.dev
Class BackCompatTest

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by org.hd.d.pg2k.test.dev.BackCompatTest
All Implemented Interfaces:
junit.framework.Test

public final class BackCompatTest
extends junit.framework.TestCase

Simple tests of backward compatibility. This tests for things that we explicitly want to keep compatible, or alternatively do not expect nor want to needlessly break.

This is also used for testing the handling of accession data, since that is stuff that we need to be able to handle for a long time.


Field Summary
private static boolean CALC_COMPRESSION_STATS
          If true, print out some compression stats to help with tuning.
static java.util.List<java.lang.String> frozenAEPs
          Immutable set of usable (GZIPed) serialised AEP files in date order.
static java.util.List<java.lang.String> frozenEVVSs
          Immutable set of usable (GZIPed) serialised event-history files in approximate date order.
static java.util.List<java.lang.String> JIB_SER_GZ_FILES
          Historical GZIPped serialised JIndexBean instances, newest last, for checking backward compatibility.
private static java.util.Random rnd
          Private source of OK pseudo-random numbers.
static java.lang.String testDataDir
          Test data directory (project-relative) not ending in '/' for frozen AEP and test/event data; not null.
 
Constructor Summary
BackCompatTest(java.lang.String name)
           
 
Method Summary
static java.util.Map<CompressionLevel,byte[]> showCompression(byte[] raw, java.io.PrintStream out)
          Give some indication of compression available in supplied raw data.
static void testAccessionHashes()
          Test generation of hashes for AccessionData.
static void testAEPDeserialise()
          Check that we can deserialise older snapshots of our exhibit data.
static void testAEPDiffs()
          Check that we can compute diffs between AEPs successfully.
static void testEVVSDeserialise()
          Check that we can deserialise older snapshots of our EventVariableValueSet data.
static void testEVVSHistoryLoad()
          Test history load.
static void testJIBLegacyDeser()
          Test that deserialisation of old JIB frozen instances is still possible.
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, runTest, setName, setUp, tearDown, toString
 
Methods inherited from class junit.framework.Assert
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CALC_COMPRESSION_STATS

private static final boolean CALC_COMPRESSION_STATS
If true, print out some compression stats to help with tuning. These stats DO NOT form part of the official test suite.

See Also:
Constant Field Values

testDataDir

public static final java.lang.String testDataDir
Test data directory (project-relative) not ending in '/' for frozen AEP and test/event data; not null.

See Also:
Constant Field Values

frozenAEPs

public static final java.util.List<java.lang.String> frozenAEPs
Immutable set of usable (GZIPed) serialised AEP files in date order. Manually kept up-to-date.

These are AllExhibitProperties objects.

The last entry is the most recent (and usually the largest).


frozenEVVSs

public static final java.util.List<java.lang.String> frozenEVVSs
Immutable set of usable (GZIPed) serialised event-history files in approximate date order. Manually kept up-to-date.

These are EventVariableValueSet objects.

The last entry is the most recent and/or largest and thus a good performance benchmark for algorithm/representation tweaks.


JIB_SER_GZ_FILES

public static final java.util.List<java.lang.String> JIB_SER_GZ_FILES
Historical GZIPped serialised JIndexBean instances, newest last, for checking backward compatibility.


rnd

private static final java.util.Random rnd
Private source of OK pseudo-random numbers.

Constructor Detail

BackCompatTest

public BackCompatTest(java.lang.String name)
Method Detail

testAEPDeserialise

public static void testAEPDeserialise()
                               throws java.lang.Exception
Check that we can deserialise older snapshots of our exhibit data. This includes snapshots of real Gallery meta-data, and snapshots of test set meta-data.

We take advantage of multiple CPUs to load these in parallel, which should be safe.

Throws:
java.lang.Exception

testEVVSDeserialise

public static void testEVVSDeserialise()
                                throws java.lang.Exception
Check that we can deserialise older snapshots of our EventVariableValueSet data. This includes snapshots of real Gallery meta-data.

Throws:
java.lang.Exception

testEVVSHistoryLoad

public static void testEVVSHistoryLoad()
                                throws java.lang.Exception
Test history load. Ensures that we can load the history from the test directory.

Throws:
java.lang.Exception

showCompression

public static java.util.Map<CompressionLevel,byte[]> showCompression(byte[] raw,
                                                                     java.io.PrintStream out)
Give some indication of compression available in supplied raw data. Produces a map from compression level to compressed data, and can optionally write what it is doing on System.out.

The input data is not altered, and is returned in the result under the "NONE" tag.

Note that not all compression levels may be implemented/tested, eg due to resource constraints.


testAccessionHashes

public static void testAccessionHashes()
                                throws java.lang.Exception
Test generation of hashes for AccessionData. We test simple streams against some known or previously-computed values.

Throws:
java.lang.Exception

testAEPDiffs

public static final void testAEPDiffs()
                               throws java.lang.Exception
Check that we can compute diffs between AEPs successfully. Potentially for every pair of frozen AEPs that we have available, test that we can generate a diff between them and that we can recreate a new AEP using the old AEP and a diff.

It is acceptable for the diff routine to refuse to create a diff/delta for whatever reason (unless the force flag is true).

Throws:
java.lang.Exception

testJIBLegacyDeser

public static void testJIBLegacyDeser()
                               throws java.lang.Exception
Test that deserialisation of old JIB frozen instances is still possible. While we don't promise that the serialised form of a JIndexBean will be long-lived (and it may always be relatively easy to regenerate from current input data) checking that we don't accidentally break something is useful, and this also allows us to check how fast and memory-efficient new versions are.

Throws:
java.lang.Exception

DHD Multimedia Gallery V1.53.0

Copyright (c) 1996-2009, Damon Hart-Davis. All rights reserved.