1/* Licensed to the Apache Software Foundation (ASF) under one or more
2 * contributor license agreements.  See the NOTICE file distributed with
3 * this work for additional information regarding copyright ownership.
4 * The ASF licenses this file to You under the Apache License, Version 2.0
5 * (the "License"); you may not use this file except in compliance with
6 * the License.  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 org.apache.harmony.tests.java.nio.channels.spi;
18
19import java.io.IOException;
20import java.nio.channels.SelectionKey;
21import java.nio.channels.Selector;
22import java.nio.channels.spi.AbstractSelectableChannel;
23import java.nio.channels.spi.AbstractSelectionKey;
24import java.nio.channels.spi.AbstractSelector;
25import java.nio.channels.spi.SelectorProvider;
26import java.util.Set;
27
28public class MockAbstractSelector extends AbstractSelector {
29
30    public boolean isImplCloseSelectorCalled = false;
31
32	public MockAbstractSelector(SelectorProvider arg0) {
33		super(arg0);
34	}
35
36	public static MockAbstractSelector openSelector() {
37		return new MockAbstractSelector(SelectorProvider.provider());
38	}
39
40	public Set getCancelledKeys() {
41		return super.cancelledKeys();
42	}
43
44	protected void implCloseSelector() throws IOException {
45        isImplCloseSelectorCalled = true;
46	}
47
48	protected SelectionKey register(AbstractSelectableChannel arg0, int arg1,
49			Object arg2) {
50		return null;
51	}
52
53	public void superBegin() {
54		super.begin();
55	}
56
57	public void superEnd() {
58		super.end();
59	}
60
61	protected void mockDeregister(AbstractSelectionKey key) {
62		super.deregister(key);
63	}
64
65	public Set<SelectionKey> keys() {
66		return null;
67	}
68
69	public Set<SelectionKey> selectedKeys() {
70		return null;
71	}
72
73	public int selectNow() throws IOException {
74		return 0;
75	}
76
77	public int select(long arg0) throws IOException {
78		return 0;
79	}
80
81	public int select() throws IOException {
82		return 0;
83	}
84
85	public Selector wakeup() {
86		return null;
87	}
88
89}
90