private SecondaryDatabase openSecondaryDb( TupleSerialFactory factory, String keyName, Database primary, String file, Database foreignStore) throws Exception { TupleSerialMarshalledKeyCreator keyCreator = factory.getKeyCreator(MarshalledObject.class, keyName); SecondaryConfig secConfig = new SecondaryConfig(); DbCompat.setTypeBtree(secConfig); secConfig.setTransactional(testEnv.isTxnMode()); secConfig.setAllowCreate(true); secConfig.setKeyCreator(keyCreator); if (foreignStore != null) { secConfig.setForeignKeyDatabase(foreignStore); secConfig.setForeignKeyDeleteAction(onDelete); if (onDelete == ForeignKeyDeleteAction.NULLIFY) { secConfig.setForeignKeyNullifier(keyCreator); } } return DbCompat.testOpenSecondaryDatabase(env, null, file, null, primary, secConfig); }
public ForeignKeyTest(TestEnv testEnv, ForeignKeyDeleteAction onDelete, String onDeleteLabel) { customName = "ForeignKeyTest-" + testEnv.getName() + '-' + onDeleteLabel; this.testEnv = testEnv; this.onDelete = onDelete; }
@Before public void setUp() throws Exception { super.setUp(); SharedTestUtils.printTestName(customName); env = testEnv.open(customName); createDatabase(); }
private Database openDb(String file) throws Exception { DatabaseConfig config = new DatabaseConfig(); DbCompat.setTypeBtree(config); config.setTransactional(testEnv.isTxnMode()); config.setAllowCreate(true); return DbCompat.testOpenDatabase(env, null, file, null, config); }