Search in sources :

Example 21 with StoreParams

use of org.apache.jena.tdb.setup.StoreParams in project jena by apache.

the class TestStoreParams method store_params_20.

// Check that setting gets recorded and propagated.
@Test
public void store_params_20() {
    StoreParams params = StoreParams.builder().blockReadCacheSize(0).build();
    assertTrue(params.isSetBlockReadCacheSize());
    assertFalse(params.isSetBlockWriteCacheSize());
}
Also used : StoreParams(org.apache.jena.tdb.setup.StoreParams) BaseTest(org.apache.jena.atlas.junit.BaseTest) Test(org.junit.Test)

Example 22 with StoreParams

use of org.apache.jena.tdb.setup.StoreParams in project jena by apache.

the class TestStoreParamsCreate method params_reconnect_02.

// Defaults, then reconnect with app modified.
@Test
public void params_reconnect_02() {
    // Create.
    StoreConnection.make(loc, null);
    // Drop.
    StoreConnection.expel(loc, true);
    // Reconnect
    StoreConnection.make(loc, pSpecial);
    //StoreParams pLoc = StoreParamsCodec.read(loc) ;
    //assertNotNull(pLoc) ;
    StoreParams pDB = StoreConnection.getExisting(loc).getBaseDataset().getConfig().params;
    assertNotNull(pDB);
    // Should be the default setup, modified by pApp for cache sizes.
    assertFalse(StoreParams.sameValues(pDft, pDB));
    assertFalse(StoreParams.sameValues(pSpecial, pDB));
    // Check it's default-modified-by-special.
    assertEquals(pSpecial.getBlockReadCacheSize(), pDB.getBlockReadCacheSize());
    assertNotEquals(pDft.getBlockReadCacheSize(), pDB.getBlockReadCacheSize());
    assertNotEquals(pSpecial.getBlockSize(), pDB.getBlockSize());
    assertEquals(pDft.getBlockSize(), pDB.getBlockSize());
}
Also used : StoreParams(org.apache.jena.tdb.setup.StoreParams) Test(org.junit.Test) ConfigTest(org.apache.jena.tdb.ConfigTest) BaseTest(org.apache.jena.atlas.junit.BaseTest)

Example 23 with StoreParams

use of org.apache.jena.tdb.setup.StoreParams in project jena by apache.

the class TestStoreParamsCreate method params_reconnect_03.

// Custom, then reconnect with some special settings.
@Test
public void params_reconnect_03() {
    // Create.
    StoreConnection.make(loc, pApp);
    // Drop.
    StoreConnection.expel(loc, true);
    // Reconnect
    StoreConnection.make(loc, pSpecial);
    //StoreParams pLoc = StoreParamsCodec.read(loc) ;
    //assertNotNull(pLoc) ;
    StoreParams pDB = StoreConnection.getExisting(loc).getBaseDataset().getConfig().params;
    assertNotNull(pDB);
    // Should be the default setup, modified by pApp for cache sizes.
    assertFalse(StoreParams.sameValues(pApp, pDB));
    assertFalse(StoreParams.sameValues(pSpecial, pDB));
    // Check it's default-modified-by-special.
    assertEquals(pSpecial.getBlockReadCacheSize(), pDB.getBlockReadCacheSize());
    assertNotEquals(pApp.getBlockReadCacheSize(), pDB.getBlockReadCacheSize());
    assertNotEquals(pSpecial.getBlockSize(), pDB.getBlockSize());
    assertEquals(pApp.getBlockSize(), pDB.getBlockSize());
}
Also used : StoreParams(org.apache.jena.tdb.setup.StoreParams) Test(org.junit.Test) ConfigTest(org.apache.jena.tdb.ConfigTest) BaseTest(org.apache.jena.atlas.junit.BaseTest)

Example 24 with StoreParams

use of org.apache.jena.tdb.setup.StoreParams in project jena by apache.

the class TestStoreParams method store_params_11.

@Test
public void store_params_11() {
    String xs = "{ \"tdb.block_size\": 2048 }";
    JsonObject x = JSON.parse(xs);
    StoreParams paramsExpected = StoreParams.builder().blockSize(2048).build();
    StoreParams paramsActual = StoreParamsCodec.decode(x);
    assertEqualsStoreParams(paramsExpected, paramsActual);
}
Also used : StoreParams(org.apache.jena.tdb.setup.StoreParams) JsonObject(org.apache.jena.atlas.json.JsonObject) BaseTest(org.apache.jena.atlas.junit.BaseTest) Test(org.junit.Test)

Example 25 with StoreParams

use of org.apache.jena.tdb.setup.StoreParams in project jena by apache.

the class TestStoreParamsChoose method params_choose_existing_2.

@Test
public void params_choose_existing_2() {
    StoreParams p = Build.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());
}
Also used : StoreParams(org.apache.jena.tdb.setup.StoreParams) BaseTest(org.apache.jena.atlas.junit.BaseTest) Test(org.junit.Test) ConfigTest(org.apache.jena.tdb.ConfigTest)

Aggregations

StoreParams (org.apache.jena.tdb.setup.StoreParams)27 BaseTest (org.apache.jena.atlas.junit.BaseTest)26 Test (org.junit.Test)26 ConfigTest (org.apache.jena.tdb.ConfigTest)15 JsonObject (org.apache.jena.atlas.json.JsonObject)5 Location (org.apache.jena.tdb.base.file.Location)3