Package eu.admire.ogsadai.datacache

Examples of eu.admire.ogsadai.datacache.DataCacheWriter


        mResource.clear();
    }

    public void testGetWriter() throws Exception
    {
        DataCacheWriter writer = mResource.getWriter();
        String s = "abcdefgh";
        writer.write(s);
        mResource.releaseWriter();
       
        // validate
        ObjectInputStream input =
            new ObjectInputStream(new FileInputStream(mCacheFile));
View Full Code Here


        mResource.releaseWriter();
    }

    public void testGetReader() throws Exception
    {
        DataCacheWriter writer = mResource.getWriter();
        String s = "abcdefgh";
        writer.write(s);
        mResource.releaseWriter();
       
        DataCacheReader reader = mResource.getReader();
        Object obj = reader.read();
        assertTrue(obj instanceof String);
View Full Code Here

       
    }

    public void testGetMultipleReaders() throws Exception
    {
        DataCacheWriter writer = mResource.getWriter();
        String s1 = "1";
        String s2 = "2";
        String s3 = "3";
        writer.write(s1);
        writer.write(s2);
        writer.write(s3);
        mResource.releaseWriter();
       
        DataCacheReader reader1 = mResource.getReader();
        Object obj = reader1.read();
        assertTrue(obj instanceof String);
View Full Code Here

    }


    public void testGetReaderWhileWriting() throws Exception
    {
        DataCacheWriter writer = mResource.getWriter();
        String s1 = "1";
        String s2 = "2";
        String s3 = "3";
        String s4 = "4";
        writer.write(s1);
        writer.write(s2);
       
        DataCacheReader reader1 = mResource.getReader();
        Object obj = reader1.read();
        assertTrue(obj instanceof String);
        assertEquals(s1, (String)obj);
       
        writer.write(s3);
        obj = reader1.read();
        assertTrue(obj instanceof String);
        assertEquals(s2, (String)obj);
        obj = reader1.read();
        assertTrue(obj instanceof String);
        assertEquals(s3, (String)obj);
       
        try
        {
            reader1.read();
        }
        catch (NoSuchElementException e)
        {
            // expected
        }

        reader1.close();

        writer.write(s4);
        mResource.releaseWriter();
       
    }
View Full Code Here

TOP

Related Classes of eu.admire.ogsadai.datacache.DataCacheWriter

Copyright © 2018 www.massapicom. 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.