PipedConnection_Test.java (2be43276) | PipedConnection_Test.java (9cbd97ce) |
---|---|
1/************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance --- 9 unchanged lines hidden (view full) --- 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24package com.sun.star.comp.connections; 25 | 1/************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance --- 9 unchanged lines hidden (view full) --- 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24package com.sun.star.comp.connections; 25 |
26import complexlib.ComplexTestCase; | 26import org.junit.Test; 27import static org.junit.Assert.*; |
27 | 28 |
28public final class PipedConnection_Test extends ComplexTestCase { 29 public String getTestObjectName() { 30 return getClass().getName(); 31 } 32 33 public String[] getTestMethodNames() { 34 return new String[] { "test" }; 35 } 36 | 29public final class PipedConnection_Test { 30 @Test |
37 public void test() throws Exception { 38 PipedConnection rightSide = new PipedConnection(new Object[0]); 39 PipedConnection leftSide = new PipedConnection(new Object[]{rightSide}); 40 41 byte theByte[] = new byte[1]; 42 43 Reader reader = new Reader(rightSide, theByte); 44 Writer writer = new Writer(leftSide, theByte, reader); 45 46 reader.start(); 47 writer.start(); 48 49 Thread.sleep(2000); 50 51 writer.term(); 52 writer.join(); 53 54 reader.join(); 55 | 31 public void test() throws Exception { 32 PipedConnection rightSide = new PipedConnection(new Object[0]); 33 PipedConnection leftSide = new PipedConnection(new Object[]{rightSide}); 34 35 byte theByte[] = new byte[1]; 36 37 Reader reader = new Reader(rightSide, theByte); 38 Writer writer = new Writer(leftSide, theByte, reader); 39 40 reader.start(); 41 writer.start(); 42 43 Thread.sleep(2000); 44 45 writer.term(); 46 writer.join(); 47 48 reader.join(); 49 |
56 assure("", writer._state && reader._state); | 50 assertTrue("", writer._state && reader._state); |
57 } 58 59 static class Reader extends Thread { 60 PipedConnection _pipedConnection; 61 byte _theByte[]; 62 boolean _quit; 63 boolean _state = false; 64 --- 79 unchanged lines hidden --- | 51 } 52 53 static class Reader extends Thread { 54 PipedConnection _pipedConnection; 55 byte _theByte[]; 56 boolean _quit; 57 boolean _state = false; 58 --- 79 unchanged lines hidden --- |