~ubuntu-branches/ubuntu/trusty/ehcache/trusty

« back to all changes in this revision

Viewing changes to src/test/java/net/sf/ehcache/writer/TestCacheWriterSlow.java

  • Committer: Package Import Robot
  • Author(s): Emmanuel Bourg
  • Date: 2013-05-06 14:53:07 UTC
  • mfrom: (1.1.7) (2.1.8 sid)
  • Revision ID: package-import@ubuntu.com-20130506145307-v5bhw5yu70re00l3
Tags: 2.6.7-1
* Team upload.
* New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/**
2
 
 *  Copyright 2003-2010 Terracotta, Inc.
 
2
 *  Copyright Terracotta, Inc.
3
3
 *
4
4
 *  Licensed under the Apache License, Version 2.0 (the "License");
5
5
 *  you may not use this file except in compliance with the License.
16
16
package net.sf.ehcache.writer;
17
17
 
18
18
import java.util.Collection;
19
 
import java.util.HashMap;
20
 
import java.util.Map;
 
19
import java.util.Properties;
21
20
 
22
21
import net.sf.ehcache.CacheEntry;
23
22
import net.sf.ehcache.CacheException;
24
23
import net.sf.ehcache.Element;
25
24
 
26
 
public class TestCacheWriterSlow extends AbstractTestCacheWriter {
27
 
    private final Map<Object, Element> writtenElements = new HashMap<Object, Element>();
28
 
    private final Map<Object, Element> deletedElements = new HashMap<Object, Element>();
 
25
public class TestCacheWriterSlow extends TestCacheWriter {
29
26
 
30
27
    public TestCacheWriterSlow() {
31
 
    }
32
 
 
33
 
    public Map<Object, Element> getWrittenElements() {
34
 
        return writtenElements;
35
 
    }
36
 
 
37
 
    public Map<Object, Element> getDeletedElements() {
38
 
        return deletedElements;
 
28
        super(new Properties());
39
29
    }
40
30
 
41
31
    @Override
45
35
        } catch (InterruptedException e) {
46
36
            throw new CacheException(e);
47
37
        }
48
 
        writtenElements.put(element.getObjectKey(), element);
 
38
        super.write(element);
49
39
    }
50
40
 
51
41
    @Override
55
45
        } catch (InterruptedException e) {
56
46
            throw new CacheException(e);
57
47
        }
58
 
        for (Element element : elements) {
59
 
            writtenElements.put(element.getObjectKey() + "-batched", element);
60
 
        }
 
48
        super.writeAll(elements);
61
49
    }
62
50
 
63
51
    @Override
67
55
        } catch (InterruptedException e) {
68
56
            throw new CacheException(e);
69
57
        }
70
 
        deletedElements.put(entry.getKey(), entry.getElement());
 
58
        super.delete(entry);
71
59
    }
72
60
 
73
61
    @Override
77
65
        } catch (InterruptedException e) {
78
66
            throw new CacheException(e);
79
67
        }
80
 
        for (CacheEntry entry : entries) {
81
 
            deletedElements.put(entry.getKey() + "-batched", entry.getElement());
82
 
        }
 
68
        super.deleteAll(entries);
83
69
    }
84
70
}