001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */
017:
018: /**
019: * @author Serguei S.Zapreyev
020: * @version $Revision$
021: */package java.lang;
022:
023: import junit.framework.TestCase;
024: import java.io.IOException;
025:
026: /*
027: * Created on March 29, 2006
028: *
029: * This RuntimeAdditionalTest class is used to test the Core API Runtime class
030: *
031: */
032:
033: /**
034: * ###############################################################################
035: * ###############################################################################
036: * TODO: 1.
037: * ###############################################################################
038: * ###############################################################################
039: */
040:
041: public class RuntimeAdditionalTest15 extends TestCase {
042: /**
043: * creation and destroying a lot of jvm-processes getting their streams
044: */
045: public void test_15() {
046: System.out.println("==test_15===");
047: if (RuntimeAdditionalTest0.os.equals("Unk")) {
048: fail("WARNING (test_15): unknown operating system.");
049: }
050: int ia = 0;
051: String cmnd = RuntimeAdditionalTest0.javaStarter;
052: while (ia++ < 5/*100*//*300*//*3000*/) {
053: try {
054: Process pi3 = Runtime.getRuntime().exec(cmnd);
055: pi3.getOutputStream();
056: pi3.getErrorStream();
057: java.io.InputStream is = pi3.getInputStream();
058: Process pi32 = Runtime.getRuntime().exec(cmnd);
059: pi3.getOutputStream();
060: pi3.getErrorStream();
061: pi3.getInputStream();
062: Process pi33 = Runtime.getRuntime().exec(cmnd);
063: pi3.getOutputStream();
064: pi3.getErrorStream();
065: pi3.getInputStream();
066: Process pi34 = Runtime.getRuntime().exec(cmnd);
067: pi3.getOutputStream();
068: pi3.getErrorStream();
069: pi3.getInputStream();
070: Process pi35 = Runtime.getRuntime().exec(cmnd);
071: pi3.getOutputStream();
072: pi3.getErrorStream();
073: pi3.getInputStream();
074: Process pi36 = Runtime.getRuntime().exec(cmnd);
075: pi3.getOutputStream();
076: pi3.getErrorStream();
077: pi3.getInputStream();
078: pi3.destroy();
079: pi32.destroy();
080: pi33.destroy();
081: pi34.destroy();
082: pi35.destroy();
083: pi36.destroy();
084: Thread.sleep(50);
085: pi3.getOutputStream();
086: pi3.getErrorStream();
087: is = pi3.getInputStream();
088: try {
089: is.available();
090: } catch (IOException _) {
091: }
092: } catch (Exception eeee) {
093: System.out.println("==" + ia + "===");
094: eeee.printStackTrace();
095: if (ia == 1)
096: fail("ERROR (test_15): unexpected exception just at the first java invocation.");
097: }
098: }
099: }
100: }
|