1561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes/* Licensed to the Apache Software Foundation (ASF) under one or more 2561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes * contributor license agreements. See the NOTICE file distributed with 3561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes * this work for additional information regarding copyright ownership. 4561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes * The ASF licenses this file to You under the Apache License, Version 2.0 5561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes * (the "License"); you may not use this file except in compliance with 6561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes * the License. You may obtain a copy of the License at 7fc95c99cfa4921fef424f3f411d013b821589e69Elliott Hughes * 8561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes * http://www.apache.org/licenses/LICENSE-2.0 9fc95c99cfa4921fef424f3f411d013b821589e69Elliott Hughes * 10561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes * Unless required by applicable law or agreed to in writing, software 11561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes * distributed under the License is distributed on an "AS IS" BASIS, 12561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes * See the License for the specific language governing permissions and 14561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes * limitations under the License. 15561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes */ 16561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes 17561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughespackage org.apache.harmony.nio.tests.java.nio.channels; 18561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes 19561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughesimport java.io.IOException; 20561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughesimport java.net.NetPermission; 21561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughesimport java.nio.channels.Pipe; 22561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughesimport java.nio.channels.Pipe.SinkChannel; 23561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughesimport java.nio.channels.Pipe.SourceChannel; 24561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughesimport java.security.Permission; 25561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes 26561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughesimport junit.framework.TestCase; 27561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes 28561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes/* 29561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes * Tests for Pipe and its default implementation 30561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes */ 31561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughespublic class PipeTest extends TestCase { 32fc95c99cfa4921fef424f3f411d013b821589e69Elliott Hughes 33561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes /** 34561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes * @tests java.nio.channels.Pipe#open() 35561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes */ 36561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes public void test_open() throws IOException{ 37561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes Pipe pipe = Pipe.open(); 38561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes assertNotNull(pipe); 39561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes } 40561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes 41561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes /** 42561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes * @tests java.nio.channels.Pipe#sink() 43561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes */ 44561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes public void test_sink() throws IOException { 45561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes Pipe pipe = Pipe.open(); 46561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes SinkChannel sink = pipe.sink(); 47561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes assertTrue(sink.isBlocking()); 48561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes } 49561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes 50561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes /** 51561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes * @tests java.nio.channels.Pipe#source() 52561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes */ 53561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes public void test_source() throws IOException { 54561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes Pipe pipe = Pipe.open(); 55561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes SourceChannel source = pipe.source(); 56561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes assertTrue(source.isBlocking()); 57561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes } 58561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes 59561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes} 60