PageRenderTime 24ms CodeModel.GetById 8ms app.highlight 11ms RepoModel.GetById 2ms app.codeStats 0ms

/hazelcast/src/test/java/com/hazelcast/core/IListPerformance.java

https://bitbucket.org/gabral6_gmailcom/hazelcast
Java | 69 lines | 46 code | 8 blank | 15 comment | 5 complexity | 574f1e052c13e14967ef652dc3f636b1 MD5 | raw file
 1/*
 2 * Copyright (c) 2008-2013, Hazelcast, Inc. All Rights Reserved.
 3 *
 4 * Licensed under the Apache License, Version 2.0 (the "License");
 5 * you may not use this file except in compliance with the License.
 6 * You may obtain a copy of the License at
 7 *
 8 * http://www.apache.org/licenses/LICENSE-2.0
 9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package com.hazelcast.core;
18
19import org.junit.After;
20import org.junit.Test;
21import org.junit.runner.RunWith;
22
23import static junit.framework.Assert.assertTrue;
24
25@RunWith(com.hazelcast.util.RandomBlockJUnit4ClassRunner.class)
26public class IListPerformance extends PerformanceTest {
27    private IList<Integer> list = Hazelcast.getList("IListPerformance");
28
29    @After
30    public void clear() {
31        t.stop();
32        t.printResult();
33        list.clear();
34        assertTrue(list.isEmpty());
35    }
36
37    @Test
38    public void testListAdd() {
39        String test = "testListAdd";
40        t = new PerformanceTimer(test, ops);
41        for (int i = 0; i < ops; ++i) {
42            list.add(i);
43        }
44    }
45
46    @Test
47    public void testListContains() {
48        String test = "testListContains";
49        for (int i = 0; i < ops; ++i) {
50            list.add(i);
51        }
52        t = new PerformanceTimer(test, ops);
53        for (int i = 0; i < ops; ++i) {
54            list.contains(i);
55        }
56    }
57
58    @Test
59    public void testListIterator() {
60        String test = "testListIterator";
61        for (int i = 0; i < ops; ++i) {
62            list.add(i);
63        }
64        t = new PerformanceTimer(test, ops);
65        for (Integer aList : list) {
66            int a = aList;
67        }
68    }
69}