public static DatasetGraphTxn build(Location location, StoreParams appParams) { StoreParams locParams = StoreParamsCodec.read(location); StoreParams dftParams = StoreParams.getDftStoreParams(); // This can write the chosen parameters if necessary (new database, appParams != null, locParams == null) boolean newArea = isNewDatabaseArea(location); if ( newArea ) { } StoreParams params = StoreParamsFactory.decideStoreParams(location, newArea, appParams, locParams, dftParams); return create(location, params).build$(); }
@Test public void params_choose_existing_1() { StoreParams p = StoreParamsFactory.decideStoreParams(Location.mem(), false, null, null, pDft) ; // p is pDft. assertTrue(StoreParams.sameValues(p, pDft)) ; }
@Test public void params_choose_new_1() { StoreParams p = StoreParamsFactory.decideStoreParams(Location.mem(), true, null, null, pDft) ; // New store, no pLoc, no pApp so pDft. assertTrue(StoreParams.sameValues(p, pDft)) ; }
@Test public void params_choose_existing_3() { StoreParams p = StoreParamsFactory.decideStoreParams(Location.mem(), false, null, pLoc, pDft) ; // p is pLoc assertTrue(StoreParams.sameValues(p, pLoc)) ; }
@Test public void params_choose_existing_1() { StoreParams p = StoreParamsFactory.decideStoreParams(Location.mem(), false, null, null, pDft) ; // p is pDft. assertTrue(StoreParams.sameValues(p, pDft)) ; }
@Test public void params_choose_new_3() { StoreParams p = StoreParamsFactory.decideStoreParams(Location.mem(), true, null, pLoc, pDft) ; // New store, pLoc, no pApp, so pLoc is the entire settings. assertEquals(0, p.getBlockSize().intValue()) ; assertTrue(StoreParams.sameValues(p, pLoc)) ; }
@Test public void params_choose_existing_3() { StoreParams p = StoreParamsFactory.decideStoreParams(Location.mem(), false, null, pLoc, pDft) ; // p is pLoc assertTrue(StoreParams.sameValues(p, pLoc)) ; }
@Test public void params_choose_new_1() { StoreParams p = StoreParamsFactory.decideStoreParams(Location.mem(), true, null, null, pDft) ; // New store, no pLoc, no pApp so pDft. assertTrue(StoreParams.sameValues(p, pDft)) ; }
@Test public void params_choose_new_2() { StoreParams p = StoreParamsFactory.decideStoreParams(Location.mem(), true, pApp, null, pDft) ; // New store, no pLoc, so pApp is the enire settings. assertEquals(12, p.getBlockSize().intValue()) ; assertTrue(StoreParams.sameValues(p, pApp)) ; }
@Test public void params_choose_new_3() { StoreParams p = StoreParamsFactory.decideStoreParams(Location.mem(), true, null, pLoc, pDft) ; // New store, pLoc, no pApp, so pLoc is the entire settings. assertEquals(0, p.getBlockSize().intValue()) ; assertTrue(StoreParams.sameValues(p, pLoc)) ; }
@Test public void params_choose_new_2() { StoreParams p = StoreParamsFactory.decideStoreParams(Location.mem(), true, pApp, null, pDft) ; // New store, no pLoc, so pApp is the enire settings. assertEquals(12, p.getBlockSize().intValue()) ; assertTrue(StoreParams.sameValues(p, pApp)) ; }
@Test public void params_choose_existing_4() { StoreParams p = StoreParamsFactory.decideStoreParams(Location.mem(), false, pApp, pLoc, pDft) ; // p is pLoc modifed by pApp. assertFalse(StoreParams.sameValues(p, pApp)) ; assertFalse(StoreParams.sameValues(p, pLoc)) ; assertFalse(StoreParams.sameValues(p, pDft)) ; assertEquals(0, p.getBlockSize().intValue()) ; assertEquals(12, p.getNodeMissCacheSize().intValue()) ; }
@Test public void params_choose_new_4() { StoreParams p = StoreParamsFactory.decideStoreParams(Location.mem(), true, pApp, pLoc, pDft) ; // New store, pLoc, no pApp, so pLoc is the entire settings. assertFalse(StoreParams.sameValues(p, pApp)) ; assertFalse(StoreParams.sameValues(p, pLoc)) ; assertFalse(StoreParams.sameValues(p, pDft)) ; assertEquals(0, p.getBlockSize().intValue()) ; assertEquals(12, p.getNodeMissCacheSize().intValue()) ; }
@Test public void params_choose_existing_4() { StoreParams p = StoreParamsFactory.decideStoreParams(Location.mem(), false, pApp, pLoc, pDft) ; // p is pLoc modifed by pApp. assertFalse(StoreParams.sameValues(p, pApp)) ; assertFalse(StoreParams.sameValues(p, pLoc)) ; assertFalse(StoreParams.sameValues(p, pDft)) ; assertEquals(0, p.getBlockSize().intValue()) ; assertEquals(12, p.getNodeMissCacheSize().intValue()) ; }
@Test public void params_choose_new_4() { StoreParams p = StoreParamsFactory.decideStoreParams(Location.mem(), true, pApp, pLoc, pDft) ; // New store, pLoc, no pApp, so pLoc is the entire settings. assertFalse(StoreParams.sameValues(p, pApp)) ; assertFalse(StoreParams.sameValues(p, pLoc)) ; assertFalse(StoreParams.sameValues(p, pDft)) ; assertEquals(0, p.getBlockSize().intValue()) ; assertEquals(12, p.getNodeMissCacheSize().intValue()) ; }
@Test public void params_choose_existing_2() { StoreParams p = StoreParamsFactory.decideStoreParams(Location.mem(), false, pApp, null, pDft) ; // p is pLoc modified by pApp assertFalse(StoreParams.sameValues(p, pApp)) ; assertFalse(StoreParams.sameValues(p, pDft)) ; // Existing store, no pLoc, so pDft is implicit pLoc and fixed the block size. assertEquals(pDft.getBlockSize(), p.getBlockSize()) ; assertEquals(12, p.getNodeMissCacheSize().intValue()) ; }
@Test public void params_choose_existing_2() { StoreParams p = StoreParamsFactory.decideStoreParams(Location.mem(), false, pApp, null, pDft) ; // p is pLoc modified by pApp assertFalse(StoreParams.sameValues(p, pApp)) ; assertFalse(StoreParams.sameValues(p, pDft)) ; // Existing store, no pLoc, so pDft is implicit pLoc and fixed the block size. assertEquals(pDft.getBlockSize(), p.getBlockSize()) ; assertEquals(12, p.getNodeMissCacheSize().intValue()) ; }
@Test public void params_choose_new_persist_1() { // new database, app defined. Location loc = Location.create(DIR) ; FileOps.clearAll(loc.getDirectoryPath()); // Clear. StoreParams p = StoreParamsFactory.decideStoreParams(loc, true, pApp, null, pDft) ; // Check location now has a pLoc. String fn = loc.getPath(Names.TDB_CONFIG_FILE) ; assertTrue(FileOps.exists(fn)) ; StoreParams pLoc2 = StoreParamsCodec.read(loc) ; assertTrue(StoreParams.sameValues(pLoc2, p)) ; }
@Test public void params_choose_new_persist_1() { // new database, app defined. Location loc = Location.create(DIR) ; FileOps.clearAll(loc.getDirectoryPath()); // Clear. StoreParams p = StoreParamsFactory.decideStoreParams(loc, true, pApp, null, pDft) ; // Check location now has a pLoc. String fn = loc.getPath(Names.TDB_CONFIG_FILE) ; assertTrue(FileOps.exists(fn)) ; StoreParams pLoc2 = StoreParamsCodec.read(loc) ; assertTrue(StoreParams.sameValues(pLoc2, p)) ; }
@Test public void params_choose_new_persist_2() { // new database, location defined. Location loc = Location.create(DIR) ; FileOps.clearAll(loc.getDirectoryPath()); StoreParamsCodec.write(loc, pLoc); // Clear. StoreParams p = StoreParamsFactory.decideStoreParams(loc, true, null, pLoc, pDft) ; // Check location still has a pLoc. String fn = loc.getPath(Names.TDB_CONFIG_FILE) ; assertTrue(FileOps.exists(fn)) ; StoreParams pLoc2 = StoreParamsCodec.read(loc) ; assertTrue(StoreParams.sameValues(pLoc, p)) ; }