Examples of CachingDataStore


Examples of com.sun.sgs.impl.service.data.store.cache.CachingDataStore

      Field serverPortField =
    DataStoreClient.class.getDeclaredField("serverPort");
      serverPortField.setAccessible(true);
      return (Integer) serverPortField.get(dsClient);
  } else if (dataStore instanceof CachingDataStore) {
      CachingDataStore cachingDataStore = (CachingDataStore) dataStore;
      Field localServerField =
    CachingDataStore.class.getDeclaredField("localServer");
      localServerField.setAccessible(true);
      CachingDataStoreServerImpl server = (CachingDataStoreServerImpl)
    localServerField.get(cachingDataStore);
View Full Code Here

Examples of com.sun.sgs.impl.service.data.store.cache.CachingDataStore

    /** Create a {@link CachingDataStore}. */
    @Override
    protected DataStore createDataStore(Properties props) throws Exception {
  DataStore store = new DataStoreProfileProducer(
      new CachingDataStore(props, systemRegistry, txnProxy),
      DummyProfileCoordinator.getCollector());
  DummyProfileCoordinator.startProfiling();
  store.ready();
  return store;
    }
View Full Code Here

Examples of com.sun.sgs.impl.service.data.store.cache.CachingDataStore

  props.setProperty(NODE_TYPE, nodeType);
  props.setProperty(SERVER_HOST_PROPERTY, host);
  props.setProperty(SERVER_PORT_PROPERTY, String.valueOf(port));
  props.setProperty(DIRECTORY_PROPERTY, directory);
  DataStore store = new DataStoreProfileProducer(
      new CachingDataStore(props, env.systemRegistry, txnProxy),
      DummyProfileCoordinator.getCollector());
  DummyProfileCoordinator.startProfiling();
  return store;
    }
View Full Code Here

Examples of org.apache.jackrabbit.core.data.CachingDataStore

        return dataStore;
    }

    private DataStore wrapInCachingDataStore(final DataStore dataStore, BlobStoreConfiguration config) throws Exception {
        CachingDataStore cachingStore = new CachingDataStore() {
            @Override
            protected Backend createBackend() {
                return new DataStoreWrapperBackend(dataStore);
            }

            @Override
            protected String getMarkerFile() {
                return "db.init.done";
            }
        };

        BeanUtils.populate(cachingStore, config.getConfigMap());
        cachingStore.init(null);

        return cachingStore;
    }
View Full Code Here

Examples of org.apache.jackrabbit.core.data.CachingDataStore

        }

    }
   
    private CachingDataStore createDataStore() throws RepositoryException {
        CachingDataStore ds = memoryBackend
                ? new InMemoryDataStore()
                : new S3DataStore();
        ds.setConfig(config);
        if (noCache) {
            ds.setCacheSize(0);
        }
        ds.init(TEST_DIR);
        return ds;
    }
View Full Code Here

Examples of org.apache.jackrabbit.core.data.CachingDataStore

    /**
     * Test {@link DataStore#addRecord(InputStream)} and assert length of added
     * record.
     */
    protected void doAddRecordTest() throws Exception {
        CachingDataStore ds = createDataStore();
        byte[] data = new byte[12345];
        new Random(12345).nextBytes(data);
        DataRecord rec = ds.addRecord(new ByteArrayInputStream(data));
        assertEquals(data.length, rec.getLength());
        assertRecord(data, rec);
        ds.close();
    }
View Full Code Here

Examples of org.apache.jackrabbit.core.data.CachingDataStore

    /**
     * Test {@link DataStore#getRecord(DataIdentifier)} and assert length and
     * inputstream.
     */
    protected void doGetRecordTest() throws Exception {
        CachingDataStore ds = createDataStore();
        byte[] data = new byte[12345];
        new Random(12345).nextBytes(data);
        DataRecord rec = ds.addRecord(new ByteArrayInputStream(data));
        rec = ds.getRecord(rec.getIdentifier());
        assertEquals(data.length, rec.getLength());
        assertRecord(data, rec);
        ds.close();
    }
View Full Code Here

Examples of org.apache.jackrabbit.core.data.CachingDataStore

    /**
     * Test {@link MultiDataStoreAware#deleteRecord(DataIdentifier)}.
     */
    protected void doDeleteRecordTest() throws Exception {
        CachingDataStore ds = createDataStore();
        Random random = new Random(12345);
        byte[] data1 = new byte[12345];
        random.nextBytes(data1);
        DataRecord rec1 = ds.addRecord(new ByteArrayInputStream(data1));

        byte[] data2 = new byte[12345];
        random.nextBytes(data2);
        DataRecord rec2 = ds.addRecord(new ByteArrayInputStream(data2));

        byte[] data3 = new byte[12345];
        random.nextBytes(data3);
        DataRecord rec3 = ds.addRecord(new ByteArrayInputStream(data3));

        ds.deleteRecord(rec2.getIdentifier());

        assertNull("rec2 should be null",
            ds.getRecordIfStored(rec2.getIdentifier()));
        assertEquals(new ByteArrayInputStream(data1),
            ds.getRecord(rec1.getIdentifier()).getStream());
        assertEquals(new ByteArrayInputStream(data3),
            ds.getRecord(rec3.getIdentifier()).getStream());
        ds.close();
    }
View Full Code Here

Examples of org.apache.jackrabbit.core.data.CachingDataStore

    /**
     * Test {@link DataStore#getAllIdentifiers()} and asserts all identifiers
     * are returned.
     */
    protected void doGetAllIdentifiersTest() throws Exception {
        CachingDataStore ds = createDataStore();
        List<DataIdentifier> list = new ArrayList<DataIdentifier>();
        Random random = new Random(12345);
        byte[] data = new byte[12345];
        random.nextBytes(data);
        DataRecord rec = ds.addRecord(new ByteArrayInputStream(data));
        list.add(rec.getIdentifier());

        data = new byte[12345];
        random.nextBytes(data);
        rec = ds.addRecord(new ByteArrayInputStream(data));
        list.add(rec.getIdentifier());

        data = new byte[12345];
        random.nextBytes(data);
        rec = ds.addRecord(new ByteArrayInputStream(data));
        list.add(rec.getIdentifier());

        Iterator<DataIdentifier> itr = ds.getAllIdentifiers();
        while (itr.hasNext()) {
            assertTrue("record found on list", list.remove(itr.next()));
        }
        assertEquals(0, list.size());
        ds.close();
    }
View Full Code Here

Examples of org.apache.jackrabbit.core.data.CachingDataStore

    /**
     * Asserts that timestamp of all records accessed after
     * {@link DataStore#updateModifiedDateOnAccess(long)} invocation.
     */
    protected void doUpdateLastModifiedOnAccessTest() throws Exception {
        CachingDataStore ds = createDataStore();
        Random random = new Random(12345);
        byte[] data = new byte[12345];
        random.nextBytes(data);
        DataRecord rec1 = ds.addRecord(new ByteArrayInputStream(data));

        data = new byte[12345];
        random.nextBytes(data);
        DataRecord rec2 = ds.addRecord(new ByteArrayInputStream(data));

        Thread.sleep(1000);
        long updateTime = System.currentTimeMillis();
        ds.updateModifiedDateOnAccess(updateTime);
        Thread.sleep(1000);
        data = new byte[12345];
        random.nextBytes(data);
        DataRecord rec3 = ds.addRecord(new ByteArrayInputStream(data));

        data = new byte[12345];
        random.nextBytes(data);
        DataRecord rec4 = ds.addRecord(new ByteArrayInputStream(data));

        rec1 = ds.getRecord(rec1.getIdentifier());

        assertEquals("rec1 touched", true,
            ds.getLastModified(rec1.getIdentifier()) > updateTime);
        assertEquals("rec2 not touched", true,
            ds.getLastModified(rec2.getIdentifier()) < updateTime);
        assertEquals("rec3 touched", true,
            ds.getLastModified(rec3.getIdentifier()) > updateTime);
        assertEquals("rec4 touched", true,
            ds.getLastModified(rec4.getIdentifier()) > updateTime);
        ds.close();

    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.