001: /*
002:
003: Derby - Class org.apache.derbyTesting.functionTests.harness.j9_foundation
004:
005: Licensed to the Apache Software Foundation (ASF) under one or more
006: contributor license agreements. See the NOTICE file distributed with
007: this work for additional information regarding copyright ownership.
008: The ASF licenses this file to You under the Apache License, Version 2.0
009: (the "License"); you may not use this file except in compliance with
010: the License. You may obtain a copy of the License at
011:
012: http://www.apache.org/licenses/LICENSE-2.0
013:
014: Unless required by applicable law or agreed to in writing, software
015: distributed under the License is distributed on an "AS IS" BASIS,
016: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
017: See the License for the specific language governing permissions and
018: limitations under the License.
019:
020: */
021:
022: package org.apache.derbyTesting.functionTests.harness;
023:
024: import java.util.Vector;
025: import java.util.StringTokenizer;
026: import java.util.Properties;
027:
028: /**
029: <p>This class is for IBM's J9 jdk 1.3., foundation class library; v 2.2 (wctme5.7)
030:
031: @author mayrna
032: */
033: public class j9_foundation extends jvm {
034:
035: public String getName() {
036: return "j9_foundation";
037: }
038:
039: public j9_foundation(boolean noasyncgc, boolean verbosegc,
040: boolean noclassgc, long ss, long oss, long ms, long mx,
041: String classpath, String prof, boolean verify,
042: boolean noverify, boolean nojit, Vector D) {
043: super (noasyncgc, verbosegc, noclassgc, ss, oss, ms, mx,
044: classpath, prof, verify, noverify, nojit, D);
045: }
046:
047: // more typical use:
048: public j9_foundation(String classpath, Vector D) {
049: super (classpath, D);
050: }
051:
052: // more typical use:
053: public j9_foundation(long ms, long mx, String classpath, Vector D) {
054: super (ms, mx, classpath, D);
055: }
056:
057: // actual use
058: public j9_foundation() {
059: Properties sp = System.getProperties();
060: String srvJvm = sp.getProperty("serverJvm");
061: if ((srvJvm != null) && (srvJvm.toUpperCase().startsWith("J9"))) {
062: String wshome = guessWSHome();
063: // note, may have to use separator instead of hardcoding the slashes...
064: setJavaCmd(wshome + "/wctme5.7/ive/bin/j9");
065: } else
066: setJavaCmd("j9");
067: }
068:
069: // return the command line to invoke this VM. The caller then adds
070: // the class and program arguments.
071: public Vector getCommandLine() {
072: StringBuffer sb = new StringBuffer();
073: Vector v = super .getCommandLine();
074: appendOtherFlags(sb);
075: String s = sb.toString();
076: StringTokenizer st = new StringTokenizer(s);
077: while (st.hasMoreTokens()) {
078: v.addElement(st.nextToken());
079: }
080: return v;
081: }
082:
083: public void appendOtherFlags(StringBuffer sb) {
084: Properties sp = System.getProperties();
085: String bootcp = sp.getProperty("bootcp");
086: String srvJvm = sp.getProperty("serverJvm");
087: // if we're coming in to be the server jvm for networkserver testing on j9,
088: // bootcp is null, so we need to try to setup the bootclasspath from scratch
089: // for now, assume we're only interested in doing this for wctme5.7_foundation, worry about
090: // newer versions, multiple class libraries, or multiple releases later.
091: sb.append(" -jcl:foun10");
092:
093: if ((srvJvm != null) && (srvJvm.toUpperCase().startsWith("J9"))) {
094: String pathsep = System.getProperty("path.separator");
095: String wshome = guessWSHome();
096: // note, assuming jclFoundation classes sit under wctme5.7/ive/lib/jclFoundation10
097: // and that jdbc.jar sits under wctme5.7/ive/lib
098: // note, may have to switch to sep instead of hardcoding the slashes...
099: sb.append(" -Xbootclasspath/a:" + wshome
100: + "/wctme5.7/ive/lib/jclFoundation10/classes.zip"
101: + pathsep + wshome
102: + "/wctme5.7/ive/lib/jclFoundation10/locale.zip"
103: + pathsep + wshome + "/wctme5.7/ive/lib/jdbc.jar");
104: } else
105: sb.append(" -Xbootclasspath/a:" + bootcp);
106: if (noasyncgc)
107: warn("j9_foundation does not support noasyncgc");
108: if (verbosegc)
109: sb.append(" -verbose:gc");
110: if (noclassgc)
111: warn("j9_foundation does not support noclassgc");
112: if (ss >= 0)
113: warn("j9_foundation does not support ss");
114: if (oss >= 0)
115: warn("j9_foundation does not support oss");
116: if (ms >= 0) {
117: sb.append(" -Xss");
118: sb.append(ms);
119: //sb.append("k");
120: }
121: if (mx >= 0) {
122: sb.append(" -Xmx");
123: sb.append(mx);
124: //sb.append("k");
125: }
126: if (classpath != null)
127: warn("j9_foundation does not support classpath, use -Xbootclasspath,-Xbootclasspath/p,-Xbootclasspath/a");
128: if (prof != null)
129: warn("j9_foundation does not support prof");
130: if (verify)
131: sb.append(" -verify");
132: if (noverify)
133: warn("j9_foundation does not support noverify");
134: if (nojit)
135: sb.append(" -Xnojit");
136: if (D != null)
137: for (int i = 0; i < D.size(); i++) {
138: sb.append(" -D");
139: sb.append((String) (D.elementAt(i)));
140: }
141: }
142:
143: public String getDintro() {
144: return "-D";
145: }
146:
147: // Having the following method overload the one in jvm.java causes problems when running
148: // the junit tests - they *do* successfully run with securityManager.
149: // Foundation class tests actually run ok with security manager - except when useprocess
150: // is false. This is caused by a bug in the jvm. See also DERBY-885 and DERBY-1785.
151: // protected void setSecurityProps()
152: // {
153: // System.out.println("Note: J9 (foundation) tests do not run with security manager");
154: // }
155:
156: }
|