Class PersistenceTest
- java.lang.Object
-
- test.de.iip_ecosphere.platform.support.aas.PersistenceTest
-
public abstract class PersistenceTest extends java.lang.ObjectTestsPersistenceRecipe. This class only implements the basics and must be completed by the respective AAS abstraction implementation.- Author:
- Holger Eichelberger, SSE
-
-
Constructor Summary
Constructors Constructor Description PersistenceTest()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description private static voidassertAas(java.util.List<de.iip_ecosphere.platform.support.aas.Aas> aasIn, boolean justFirst, boolean testAsset)Asserts the expected contents in read AAS.protected abstract booleanassertAsset(java.io.File file)Returns whether the asset/properties shall be asserted.protected abstract booleanassertOnlyFirst(java.io.File file)Returns whether only the first AAS shall be asserted.protected abstract java.io.File[]filesToTest()Returns the files to test.protected static java.io.FileobtainTmpFile(java.lang.String name)Obtains the name of a file in the temporary directory and tries to ensure that it does not exist.protected abstract java.util.List<de.iip_ecosphere.platform.support.aas.Aas>selectedAas(java.io.File file, java.util.List<de.iip_ecosphere.platform.support.aas.Aas> aas)Returns the AAS to test, as a selection ofaas.voidtestWriteRead()Tests writing/reading.
-
-
-
Method Detail
-
testWriteRead
public void testWriteRead() throws java.io.IOExceptionTests writing/reading.- Throws:
java.io.IOException- shall not occur
-
filesToTest
protected abstract java.io.File[] filesToTest()
Returns the files to test.- Returns:
- the files to test
-
selectedAas
protected abstract java.util.List<de.iip_ecosphere.platform.support.aas.Aas> selectedAas(java.io.File file, java.util.List<de.iip_ecosphere.platform.support.aas.Aas> aas)Returns the AAS to test, as a selection ofaas. This may be required if a certain persistence recipe does not take multiple AAS.- Parameters:
file- the file to write as an indicator of the current test process, one of the files fromfilesToTest()aas- the AAS to select from (unmodifiable)- Returns:
- the selected AAS
-
assertOnlyFirst
protected abstract boolean assertOnlyFirst(java.io.File file)
Returns whether only the first AAS shall be asserted. This may be required ifselectedAas(File, List)selects AAS.- Parameters:
file- the file to write as an indicator of the current test process, one of the files fromfilesToTest()- Returns:
truefor asserting only the first,falsefor asserting all
-
assertAsset
protected abstract boolean assertAsset(java.io.File file)
Returns whether the asset/properties shall be asserted.- Parameters:
file- the file to write as an indicator of the current test process, one of the files fromfilesToTest()- Returns:
truefor asserting the asset/properties,falsefor ignoring the asset
-
obtainTmpFile
protected static java.io.File obtainTmpFile(java.lang.String name)
Obtains the name of a file in the temporary directory and tries to ensure that it does not exist. We go for file names so that debugging becomes possible (rather than for random names).- Parameters:
name- the name of the file- Returns:
- the file
-
assertAas
private static void assertAas(java.util.List<de.iip_ecosphere.platform.support.aas.Aas> aasIn, boolean justFirst, boolean testAsset)Asserts the expected contents in read AAS.- Parameters:
aasIn- the input/read AASjustFirst- consider only the first AAStestAsset- consider the asset during testing
-
-