Package com.urbanairship.datacube

Source Code of com.urbanairship.datacube.SimpleExampleTest

/*
Copyright 2012 Urban Airship and Contributors
*/

package com.urbanairship.datacube;

import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;

import org.junit.Test;

import com.urbanairship.datacube.DbHarness.CommitType;
import com.urbanairship.datacube.dbharnesses.MapDbHarness;
import com.urbanairship.datacube.idservices.CachingIdService;
import com.urbanairship.datacube.idservices.MapIdService;
import com.urbanairship.datacube.ops.LongOp;


public class SimpleExampleTest {

    /**
     * Test the core datacube logic. Don't use a database, use our in-memory pretend storage
     * backend.
     */
    @Test
    public void writeAndRead() throws Exception {
        IdService idService = new CachingIdService(5, new MapIdService(), "test");
        ConcurrentMap<BoxedByteArray,byte[]> backingMap =
                new ConcurrentHashMap<BoxedByteArray,byte[]>();
       
        DbHarness<LongOp> dbHarness = new MapDbHarness<LongOp>(backingMap, LongOp.DESERIALIZER,
                CommitType.READ_COMBINE_CAS, idService);
       
        DbHarnessTests.basicTest(dbHarness);
    }
}
TOP

Related Classes of com.urbanairship.datacube.SimpleExampleTest

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.