public final class CoreTestHelper extends Object
Session
s for test
cases.
This includes instantiation of databases plus resources.Modifier and Type | Class and Description |
---|---|
static class |
CoreTestHelper.Holder |
static class |
CoreTestHelper.PATHS
Paths where the data is stored to.
|
Modifier and Type | Field and Description |
---|---|
static Random |
random
Common random instance for generating common tag names.
|
static String |
RESOURCENAME |
Constructor and Description |
---|
CoreTestHelper() |
Modifier and Type | Method and Description |
---|---|
static void |
checkStructure(List<org.treetank.bucket.DumbDataFactory.DumbData> pDatas,
org.treetank.api.IBucketReadTrx pRtx,
long startKey)
Checking the transaction with datas written sequentially.
|
static void |
checkStructure(List<Map.Entry<org.treetank.bucket.DumbMetaEntryFactory.DumbKey,org.treetank.bucket.DumbMetaEntryFactory.DumbValue>> pEntries,
org.treetank.api.IBucketReadTrx pRtx,
boolean pWorkOnClone)
Checking the transaction with meta entries written.
|
static void |
closeEverything()
Closing all resources as defined in the enum
CoreTestHelper.PATHS . |
static List<org.treetank.bucket.DumbDataFactory.DumbData> |
combineDatas(org.treetank.bucket.DumbDataFactory.DumbData[][] pDatas)
Combining multiple datas to one overall list.
|
static org.treetank.bucket.DumbDataFactory.DumbData[][] |
createDatas(int[] pDatasPerRevision)
Generating new atas passed on a given number of datas within a revision
|
static List<Map.Entry<org.treetank.bucket.DumbMetaEntryFactory.DumbKey,org.treetank.bucket.DumbMetaEntryFactory.DumbValue>> |
createMetaEntries(int pNumbers)
Creating a list of meta entries for testing the meta-bucket stuff
|
static boolean |
createResource(org.treetank.access.conf.ResourceConfiguration resConf) |
static org.treetank.bucket.DumbDataFactory.DumbData[][] |
createTestData(CoreTestHelper.Holder pHolder)
Create datas in different versions in Treetank and check directly afterwards the structure.
|
static List<List<Map.Entry<org.treetank.bucket.DumbMetaEntryFactory.DumbKey,org.treetank.bucket.DumbMetaEntryFactory.DumbValue>>> |
createTestMeta(CoreTestHelper.Holder pHolder)
Create datas in different versions in Treetank and check directly afterwards the structure.
|
static void |
deleteEverything()
Deleting all resources as defined in the enum
CoreTestHelper.PATHS . |
static org.treetank.bucket.DumbDataFactory.DumbData |
generateOne()
Generating one single
DumbDataFactory.DumbData with random values. |
static byte[] |
generateRandomBytes(int pSize)
Generating random bytes.
|
static com.google.common.hash.HashCode |
generateRandomHash() |
static org.treetank.bucket.DataBucket |
getDataBucket(int offset,
int length,
long databucketKey,
long lastBucketKey)
Getting a data buckets filled with datas.
|
static org.treetank.io.IBackendReader |
getFakedStructure(int[] offsets)
Getting a fake structure for testing consisting of different arranged buckets.
|
static org.treetank.api.IStorage |
getStorage(File file)
Getting a database and create one of not existing.
|
static org.treetank.bucket.DumbDataFactory.DumbData[][] |
insertDatasWithTransaction(int[] pDatasPerRevision,
org.treetank.api.IBucketWriteTrx pWtx)
Utility method to create datas per revision.
|
static List<Map.Entry<org.treetank.bucket.DumbMetaEntryFactory.DumbKey,org.treetank.bucket.DumbMetaEntryFactory.DumbValue>> |
insertMetaWithTransaction(int pNumbers,
org.treetank.api.IBucketWriteTrx pWtx,
List<Map.Entry<org.treetank.bucket.DumbMetaEntryFactory.DumbKey,org.treetank.bucket.DumbMetaEntryFactory.DumbValue>> pAlreadyExistingEntries)
Utility method to create datas per revision.
|
public static final String RESOURCENAME
public static final Random random
public static final org.treetank.api.IStorage getStorage(File file) throws org.treetank.exception.TTException
file
- to be createdorg.treetank.exception.TTException
public static final boolean createResource(org.treetank.access.conf.ResourceConfiguration resConf) throws org.treetank.exception.TTException
org.treetank.exception.TTException
public static final void deleteEverything() throws org.treetank.exception.TTException
CoreTestHelper.PATHS
.org.treetank.exception.TTException
public static final void closeEverything() throws org.treetank.exception.TTException
CoreTestHelper.PATHS
.org.treetank.exception.TTException
public static final byte[] generateRandomBytes(int pSize)
public static final org.treetank.bucket.DataBucket getDataBucket(int offset, int length, long databucketKey, long lastBucketKey)
offset
- offset to start within the bucketlength
- length of the bucketdatabucketKey
- key of the databucketlastBucketKey
- key of the former bucketDataBucket
filledpublic static final org.treetank.bucket.DumbDataFactory.DumbData generateOne()
DumbDataFactory.DumbData
with random values.DumbDataFactory.DumbData
with random values.public static final org.treetank.io.IBackendReader getFakedStructure(int[] offsets) throws org.treetank.exception.TTIOException
offsets
- an array with offsets internally of the tree.IBackendReader
-mockorg.treetank.exception.TTIOException
public static final List<List<Map.Entry<org.treetank.bucket.DumbMetaEntryFactory.DumbKey,org.treetank.bucket.DumbMetaEntryFactory.DumbValue>>> createTestMeta(CoreTestHelper.Holder pHolder) throws org.treetank.exception.TTException
pHolder
- for getting the transactionorg.treetank.exception.TTException
public static final org.treetank.bucket.DumbDataFactory.DumbData[][] createTestData(CoreTestHelper.Holder pHolder) throws org.treetank.exception.TTException
pHolder
- for getting the transactionorg.treetank.exception.TTException
public static final org.treetank.bucket.DumbDataFactory.DumbData[][] insertDatasWithTransaction(int[] pDatasPerRevision, org.treetank.api.IBucketWriteTrx pWtx) throws org.treetank.exception.TTException
pDatasPerRevision
- to createpWtx
- to store to.org.treetank.exception.TTException
public static final List<Map.Entry<org.treetank.bucket.DumbMetaEntryFactory.DumbKey,org.treetank.bucket.DumbMetaEntryFactory.DumbValue>> insertMetaWithTransaction(int pNumbers, org.treetank.api.IBucketWriteTrx pWtx, List<Map.Entry<org.treetank.bucket.DumbMetaEntryFactory.DumbKey,org.treetank.bucket.DumbMetaEntryFactory.DumbValue>> pAlreadyExistingEntries) throws org.treetank.exception.TTException
pNumbers
- number to createpWtx
- to store to.pAlreadyExistingEntries
- already existing entriesorg.treetank.exception.TTException
public static final List<Map.Entry<org.treetank.bucket.DumbMetaEntryFactory.DumbKey,org.treetank.bucket.DumbMetaEntryFactory.DumbValue>> createMetaEntries(int pNumbers)
pNumbers
- of entriespublic static final org.treetank.bucket.DumbDataFactory.DumbData[][] createDatas(int[] pDatasPerRevision)
pDatasPerRevision
- denote the number of datas within all versionspublic static final void checkStructure(List<Map.Entry<org.treetank.bucket.DumbMetaEntryFactory.DumbKey,org.treetank.bucket.DumbMetaEntryFactory.DumbValue>> pEntries, org.treetank.api.IBucketReadTrx pRtx, boolean pWorkOnClone) throws org.treetank.exception.TTIOException
pEntries
- to be compared withpRtx
- to checkpWorkOnClone
- parameter if the check should occur on cloned structureorg.treetank.exception.TTIOException
public static final void checkStructure(List<org.treetank.bucket.DumbDataFactory.DumbData> pDatas, org.treetank.api.IBucketReadTrx pRtx, long startKey) throws org.treetank.exception.TTIOException
pDatas
- to be compared withpRtx
- to checkorg.treetank.exception.TTIOException
public static final List<org.treetank.bucket.DumbDataFactory.DumbData> combineDatas(org.treetank.bucket.DumbDataFactory.DumbData[][] pDatas)
pDatas
- to be combinedpublic static final com.google.common.hash.HashCode generateRandomHash()
Copyright © 2013. All Rights Reserved.