java.lang.ClassNotFoundException Java Examples

The following examples show how to use java.lang.ClassNotFoundException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BadClassFiles.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
private BadClassFiles() throws ClassNotFoundException {
    classes = new Class<?>[] {
        loader.defineClass("EmptyName", EmptyName_bytes),
        loader.defineClass("BadModifiers", BadModifiers_bytes),
        loader.defineClass("BadNameIndex", BadNameIndex_bytes),
        loader.defineClass("NameIndexOutOfBounds", NameIndexOutOfBounds_bytes),
        loader.defineClass("ExtraParams", ExtraParams_bytes),
        // Name with .
        loader.defineClass("BadName1", BadName1_bytes),
        // Name with [
        loader.defineClass("BadName2", BadName2_bytes),
        // Name with ;
        loader.defineClass("BadName3", BadName3_bytes),
        // Name with /
        loader.defineClass("BadName4", BadName4_bytes)
    };
}
 
Example #2
Source File: RunList.java    From gemfirexd-oss with Apache License 2.0 6 votes vote down vote up
/**
* RunList
* suitesToRun: a Vector of suites from RunSuite
* outDir: The output directory for the suite(s)
* pwOut: The output for writing suite and test results
* suiteProperties: From RunSuite for the top suite
* (individual suites in the vector may have their own
* properties which must also be located and applied)
*/

public RunList(Vector suitesToRun, 
    File runDir, File outDir, PrintWriter pwOut,
    Properties suiteProperties, 
    Properties specialProperties, 
    String topParentSuite)
    throws ClassNotFoundException, IOException, Exception
{
    this.runDir = runDir;
    this.outDir = outDir;
    this.pwOut = pwOut;
    this.suiteProperties = suiteProperties; // usual suite props
    this.specialProperties = specialProperties; // for special test Flags
    this.topSuiteName = suiteProperties.getProperty("suitename");
    //System.out.println("----------------------------------------");
    //System.out.println("RunList topSuiteName= " + topSuiteName);
    this.topParentSuite = topParentSuite;
    //System.out.println("topParentSuite= " + topParentSuite);

    // Run the suites
    runSuites(suitesToRun);
}
 
Example #3
Source File: BadClassFiles.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
private BadClassFiles() throws ClassNotFoundException {
    classes = new Class<?>[] {
        loader.defineClass("EmptyName", EmptyName_bytes),
        loader.defineClass("BadModifiers", BadModifiers_bytes),
        loader.defineClass("BadNameIndex", BadNameIndex_bytes),
        loader.defineClass("NameIndexOutOfBounds", NameIndexOutOfBounds_bytes),
        loader.defineClass("ExtraParams", ExtraParams_bytes),
        // Name with .
        loader.defineClass("BadName1", BadName1_bytes),
        // Name with [
        loader.defineClass("BadName2", BadName2_bytes),
        // Name with ;
        loader.defineClass("BadName3", BadName3_bytes),
        // Name with /
        loader.defineClass("BadName4", BadName4_bytes)
    };
}
 
Example #4
Source File: RunTest.java    From gemfirexd-oss with Apache License 2.0 6 votes vote down vote up
static void verifyTestType()
      throws ClassNotFoundException, FileNotFoundException, IOException
  {
      //java requires '/' as separator to look into jar, irrespective of OS
      InputStream is =
          loadTestResource("harness/testtypes.properties");
Properties p = new Properties();
p.load(is);
      String testtypes = p.getProperty("testtypes");
   StringTokenizer st = new StringTokenizer(testtypes,",");
   String ttype = "";
      while (st.hasMoreTokens())
      {
          ttype = st.nextToken();
          if ( testType.equals(ttype) )
              return;
      }
      // Not a known test type
      System.out.println("Unknown test type: " + testType);
      System.exit(1);
  }
 
Example #5
Source File: BadClassFiles.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
private BadClassFiles() throws ClassNotFoundException {
    classes = new Class<?>[] {
        loader.defineClass("EmptyName", EmptyName_bytes),
        loader.defineClass("BadModifiers", BadModifiers_bytes),
        loader.defineClass("BadNameIndex", BadNameIndex_bytes),
        loader.defineClass("NameIndexOutOfBounds", NameIndexOutOfBounds_bytes),
        loader.defineClass("ExtraParams", ExtraParams_bytes),
        // Name with .
        loader.defineClass("BadName1", BadName1_bytes),
        // Name with [
        loader.defineClass("BadName2", BadName2_bytes),
        // Name with ;
        loader.defineClass("BadName3", BadName3_bytes),
        // Name with /
        loader.defineClass("BadName4", BadName4_bytes)
    };
}
 
Example #6
Source File: BadClassFiles.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
private BadClassFiles() throws ClassNotFoundException {
    classes = new Class<?>[] {
        loader.defineClass("EmptyName", EmptyName_bytes),
        loader.defineClass("BadModifiers", BadModifiers_bytes),
        loader.defineClass("BadNameIndex", BadNameIndex_bytes),
        loader.defineClass("NameIndexOutOfBounds", NameIndexOutOfBounds_bytes),
        loader.defineClass("ExtraParams", ExtraParams_bytes),
        // Name with .
        loader.defineClass("BadName1", BadName1_bytes),
        // Name with [
        loader.defineClass("BadName2", BadName2_bytes),
        // Name with ;
        loader.defineClass("BadName3", BadName3_bytes),
        // Name with /
        loader.defineClass("BadName4", BadName4_bytes)
    };
}
 
Example #7
Source File: RunTest.java    From gemfirexd-oss with Apache License 2.0 6 votes vote down vote up
static void verifyTestType()
      throws ClassNotFoundException, FileNotFoundException, IOException
  {
      //java requires '/' as separator to look into jar, irrespective of OS
      InputStream is =
          loadTestResource("harness/testtypes.properties");
Properties p = new Properties();
p.load(is);
      String testtypes = p.getProperty("testtypes");
   StringTokenizer st = new StringTokenizer(testtypes,",");
   String ttype = "";
      while (st.hasMoreTokens())
      {
          ttype = st.nextToken();
          if ( testType.equals(ttype) )
              return;
      }
      // Not a known test type
      System.out.println("Unknown test type: " + testType);
      System.exit(1);
  }
 
Example #8
Source File: RunList.java    From gemfirexd-oss with Apache License 2.0 6 votes vote down vote up
/**
* RunList
* suitesToRun: a Vector of suites from RunSuite
* outDir: The output directory for the suite(s)
* pwOut: The output for writing suite and test results
* suiteProperties: From RunSuite for the top suite
* (individual suites in the vector may have their own
* properties which must also be located and applied)
*/

public RunList(Vector suitesToRun, 
    File runDir, File outDir, PrintWriter pwOut,
    Properties suiteProperties, 
    Properties specialProperties, 
    String topParentSuite)
    throws ClassNotFoundException, IOException, Exception
{
    this.runDir = runDir;
    this.outDir = outDir;
    this.pwOut = pwOut;
    this.suiteProperties = suiteProperties; // usual suite props
    this.specialProperties = specialProperties; // for special test Flags
    this.topSuiteName = suiteProperties.getProperty("suitename");
    //System.out.println("----------------------------------------");
    //System.out.println("RunList topSuiteName= " + topSuiteName);
    this.topParentSuite = topParentSuite;
    //System.out.println("topParentSuite= " + topParentSuite);

    // Run the suites
    runSuites(suitesToRun);
}
 
Example #9
Source File: BadClassFiles.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
private BadClassFiles() throws ClassNotFoundException {
    classes = new Class<?>[] {
        loader.defineClass("EmptyName", EmptyName_bytes),
        loader.defineClass("BadModifiers", BadModifiers_bytes),
        loader.defineClass("BadNameIndex", BadNameIndex_bytes),
        loader.defineClass("NameIndexOutOfBounds", NameIndexOutOfBounds_bytes),
        loader.defineClass("ExtraParams", ExtraParams_bytes),
        // Name with .
        loader.defineClass("BadName1", BadName1_bytes),
        // Name with [
        loader.defineClass("BadName2", BadName2_bytes),
        // Name with ;
        loader.defineClass("BadName3", BadName3_bytes),
        // Name with /
        loader.defineClass("BadName4", BadName4_bytes)
    };
}
 
Example #10
Source File: BadClassFiles.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
private BadClassFiles() throws ClassNotFoundException {
    classes = new Class<?>[] {
        loader.defineClass("EmptyName", EmptyName_bytes),
        loader.defineClass("BadModifiers", BadModifiers_bytes),
        loader.defineClass("BadNameIndex", BadNameIndex_bytes),
        loader.defineClass("NameIndexOutOfBounds", NameIndexOutOfBounds_bytes),
        loader.defineClass("ExtraParams", ExtraParams_bytes),
        // Name with .
        loader.defineClass("BadName1", BadName1_bytes),
        // Name with [
        loader.defineClass("BadName2", BadName2_bytes),
        // Name with ;
        loader.defineClass("BadName3", BadName3_bytes),
        // Name with /
        loader.defineClass("BadName4", BadName4_bytes)
    };
}
 
Example #11
Source File: BadClassFiles.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
private BadClassFiles() throws ClassNotFoundException {
    classes = new Class<?>[] {
        loader.defineClass("EmptyName", EmptyName_bytes),
        loader.defineClass("BadModifiers", BadModifiers_bytes),
        loader.defineClass("BadNameIndex", BadNameIndex_bytes),
        loader.defineClass("NameIndexOutOfBounds", NameIndexOutOfBounds_bytes),
        loader.defineClass("ExtraParams", ExtraParams_bytes),
        // Name with .
        loader.defineClass("BadName1", BadName1_bytes),
        // Name with [
        loader.defineClass("BadName2", BadName2_bytes),
        // Name with ;
        loader.defineClass("BadName3", BadName3_bytes),
        // Name with /
        loader.defineClass("BadName4", BadName4_bytes)
    };
}
 
Example #12
Source File: BadClassFiles.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
private BadClassFiles() throws ClassNotFoundException {
    classes = new Class<?>[] {
        loader.defineClass("EmptyName", EmptyName_bytes),
        loader.defineClass("BadModifiers", BadModifiers_bytes),
        loader.defineClass("BadNameIndex", BadNameIndex_bytes),
        loader.defineClass("NameIndexOutOfBounds", NameIndexOutOfBounds_bytes),
        loader.defineClass("ExtraParams", ExtraParams_bytes),
        // Name with .
        loader.defineClass("BadName1", BadName1_bytes),
        // Name with [
        loader.defineClass("BadName2", BadName2_bytes),
        // Name with ;
        loader.defineClass("BadName3", BadName3_bytes),
        // Name with /
        loader.defineClass("BadName4", BadName4_bytes)
    };
}
 
Example #13
Source File: BadClassFiles.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
private BadClassFiles() throws ClassNotFoundException {
    classes = new Class<?>[] {
        loader.defineClass("EmptyName", EmptyName_bytes),
        loader.defineClass("BadModifiers", BadModifiers_bytes),
        loader.defineClass("BadNameIndex", BadNameIndex_bytes),
        loader.defineClass("NameIndexOutOfBounds", NameIndexOutOfBounds_bytes),
        loader.defineClass("ExtraParams", ExtraParams_bytes),
        loader.defineClass("BadParams", BadParams_bytes),
        // Name with .
        loader.defineClass("BadName1", BadName1_bytes),
        // Name with [
        loader.defineClass("BadName2", BadName2_bytes),
        // Name with ;
        loader.defineClass("BadName3", BadName3_bytes),
        // Name with /
        loader.defineClass("BadName4", BadName4_bytes)
    };
}
 
Example #14
Source File: BadClassFiles.java    From native-obfuscator with GNU General Public License v3.0 6 votes vote down vote up
private BadClassFiles() throws ClassNotFoundException {
    classes = new Class<?>[] {
        loader.defineClass("EmptyName", EmptyName_bytes),
        loader.defineClass("BadModifiers", BadModifiers_bytes),
        loader.defineClass("BadNameIndex", BadNameIndex_bytes),
        loader.defineClass("NameIndexOutOfBounds", NameIndexOutOfBounds_bytes),
        loader.defineClass("ExtraParams", ExtraParams_bytes),
        // Name with .
        loader.defineClass("BadName1", BadName1_bytes),
        // Name with [
        loader.defineClass("BadName2", BadName2_bytes),
        // Name with ;
        loader.defineClass("BadName3", BadName3_bytes),
        // Name with /
        loader.defineClass("BadName4", BadName4_bytes)
    };
}
 
Example #15
Source File: BadClassFiles.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
private BadClassFiles() throws ClassNotFoundException {
    classes = new Class<?>[] {
        loader.defineClass("EmptyName", EmptyName_bytes),
        loader.defineClass("BadModifiers", BadModifiers_bytes),
        loader.defineClass("BadNameIndex", BadNameIndex_bytes),
        loader.defineClass("NameIndexOutOfBounds", NameIndexOutOfBounds_bytes),
        loader.defineClass("ExtraParams", ExtraParams_bytes),
        // Name with .
        loader.defineClass("BadName1", BadName1_bytes),
        // Name with [
        loader.defineClass("BadName2", BadName2_bytes),
        // Name with ;
        loader.defineClass("BadName3", BadName3_bytes),
        // Name with /
        loader.defineClass("BadName4", BadName4_bytes)
    };
}
 
Example #16
Source File: RunList.java    From spliceengine with GNU Affero General Public License v3.0 6 votes vote down vote up
/**
* RunList
* suitesToRun: a Vector of suites from RunSuite
* outDir: The output directory for the suite(s)
* pwOut: The output for writing suite and test results
* suiteProperties: From RunSuite for the top suite
* (individual suites in the vector may have their own
* properties which must also be located and applied)
*/

public RunList(Vector suitesToRun, 
    File runDir, File outDir, PrintWriter pwOut,
    Properties suiteProperties, 
    Properties specialProperties, 
    String topParentSuite)
    throws ClassNotFoundException, IOException, Exception
{
    this.runDir = runDir;
    this.outDir = outDir;
    this.pwOut = pwOut;
    this.suiteProperties = suiteProperties; // usual suite props
    this.specialProperties = specialProperties; // for special test Flags
    this.topSuiteName = suiteProperties.getProperty("suitename");
    //System.out.println("----------------------------------------");
    //System.out.println("RunList topSuiteName= " + topSuiteName);
    this.topParentSuite = topParentSuite;
    //System.out.println("topParentSuite= " + topParentSuite);

    // Run the suites
    runSuites(suitesToRun);
}
 
Example #17
Source File: BadClassFiles.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
private BadClassFiles() throws ClassNotFoundException {
    classes = new Class<?>[] {
        loader.defineClass("EmptyName", EmptyName_bytes),
        loader.defineClass("BadModifiers", BadModifiers_bytes),
        loader.defineClass("BadNameIndex", BadNameIndex_bytes),
        loader.defineClass("NameIndexOutOfBounds", NameIndexOutOfBounds_bytes),
        loader.defineClass("ExtraParams", ExtraParams_bytes),
        // Name with .
        loader.defineClass("BadName1", BadName1_bytes),
        // Name with [
        loader.defineClass("BadName2", BadName2_bytes),
        // Name with ;
        loader.defineClass("BadName3", BadName3_bytes),
        // Name with /
        loader.defineClass("BadName4", BadName4_bytes)
    };
}
 
Example #18
Source File: BadClassFiles.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
private BadClassFiles() throws ClassNotFoundException {
    classes = new Class<?>[] {
        loader.defineClass("EmptyName", EmptyName_bytes),
        loader.defineClass("BadModifiers", BadModifiers_bytes),
        loader.defineClass("BadNameIndex", BadNameIndex_bytes),
        loader.defineClass("NameIndexOutOfBounds", NameIndexOutOfBounds_bytes),
        loader.defineClass("ExtraParams", ExtraParams_bytes),
        // Name with .
        loader.defineClass("BadName1", BadName1_bytes),
        // Name with [
        loader.defineClass("BadName2", BadName2_bytes),
        // Name with ;
        loader.defineClass("BadName3", BadName3_bytes),
        // Name with /
        loader.defineClass("BadName4", BadName4_bytes)
    };
}
 
Example #19
Source File: BadClassFiles.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
private BadClassFiles() throws ClassNotFoundException {
    classes = new Class<?>[] {
        loader.defineClass("EmptyName", EmptyName_bytes),
        loader.defineClass("BadModifiers", BadModifiers_bytes),
        loader.defineClass("BadNameIndex", BadNameIndex_bytes),
        loader.defineClass("NameIndexOutOfBounds", NameIndexOutOfBounds_bytes),
        loader.defineClass("ExtraParams", ExtraParams_bytes),
        // Name with .
        loader.defineClass("BadName1", BadName1_bytes),
        // Name with [
        loader.defineClass("BadName2", BadName2_bytes),
        // Name with ;
        loader.defineClass("BadName3", BadName3_bytes),
        // Name with /
        loader.defineClass("BadName4", BadName4_bytes)
    };
}
 
Example #20
Source File: RegionEventImpl.java    From gemfirexd-oss with Apache License 2.0 5 votes vote down vote up
/**
 * Reads the contents of this message from the given input.
 */
public void fromData(DataInput in) throws IOException, ClassNotFoundException
{
  this.regionPath = DataSerializer.readString(in);
  this.callbackArgument = DataSerializer.readObject(in);
  this.op = Operation.fromOrdinal(in.readByte());
  this.originRemote = in.readBoolean();
  this.distributedMember = DSFIDFactory.readInternalDistributedMember(in);
  this.diskException = DataSerializer.readObject(in);
}
 
Example #21
Source File: TryCatch.java    From pluotsorbet with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Runs the test using the specified harness.
 *
 * @param harness  the test harness (<code>null</code> not permitted).
 */
public void test(TestHarness harness)
{
    // flag that is set when exception is caught
    boolean caught = false;
    try {
        throw new ClassNotFoundException("ClassNotFoundException");
    }
    catch (ClassNotFoundException e) {
        // correct exception was caught
        caught = true;
    }
    harness.check(caught);
}
 
Example #22
Source File: SocketServerExample.java    From journaldev with MIT License 5 votes vote down vote up
public static void main(String args[]) throws IOException, ClassNotFoundException{
    //create the socket server object
    server = new ServerSocket(port);
    //keep listens indefinitely until receives 'exit' call or program terminates
    while(true){
        System.out.println("Waiting for client request");
        //creating socket and waiting for client connection
        Socket socket = server.accept();
        //read from socket to ObjectInputStream object
        ObjectInputStream ois = new ObjectInputStream(socket.getInputStream());
        //convert ObjectInputStream object to String
        String message = (String) ois.readObject();
        System.out.println("Message Received: " + message);
        //create ObjectOutputStream object
        ObjectOutputStream oos = new ObjectOutputStream(socket.getOutputStream());
        //write object to Socket
        oos.writeObject("Hi Client "+message);
        //close resources
        ois.close();
        oos.close();
        socket.close();
        //terminate the server if client sends exit request
        if(message.equalsIgnoreCase("exit")) break;
    }
    System.out.println("Shutting down Socket server!!");
    //close the ServerSocket object
    server.close();
}
 
Example #23
Source File: RunSuite.java    From spliceengine with GNU Affero General Public License v3.0 5 votes vote down vote up
static void BuildSuitesVector(String parent, String subsuites)
    throws ClassNotFoundException, IOException
{
    Properties p;
    StringTokenizer st = new StringTokenizer(subsuites);
    String child = "";
    while (st.hasMoreTokens())
    {
        child = st.nextToken();
        if (child.equals(parent))
        {
            suitesToRun.addElement(parent+":"+child);
            //System.out.println("Add this: " + parent+":"+child);
        }
        else
        {
            p = getSuiteProperties(child, false);
            if ( p.getProperty("suites") == null )
            {
                suitesToRun.addElement(parent+":"+child);
                //System.out.println("Add this: " + parent+":"+child);
            }
            else
            {
                String moresuites = p.getProperty("suites");
                BuildSuitesVector(child, moresuites);
            }
        }
    }
}
 
Example #24
Source File: constructor.java    From pluotsorbet with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Runs the test using the specified harness.
 *
 * @param harness  the test harness (<code>null</code> not permitted).
 */
public void test(TestHarness harness)
{
    ClassNotFoundException object1 = new ClassNotFoundException();
    harness.check(object1 != null);
    harness.check(object1.toString(), "java.lang.ClassNotFoundException");

    ClassNotFoundException object2 = new ClassNotFoundException("nothing happens");
    harness.check(object2 != null);
    harness.check(object2.toString(), "java.lang.ClassNotFoundException: nothing happens");

    ClassNotFoundException object3 = new ClassNotFoundException(null);
    harness.check(object3 != null);
    harness.check(object3.toString(), "java.lang.ClassNotFoundException");
}
 
Example #25
Source File: RunSuite.java    From gemfirexd-oss with Apache License 2.0 5 votes vote down vote up
static void BuildSuitesVector(String parent, String subsuites)
    throws ClassNotFoundException, IOException
{
    Properties p;
    StringTokenizer st = new StringTokenizer(subsuites);
    String child = "";
    while (st.hasMoreTokens())
    {
        child = st.nextToken();
        if (child.equals(parent))
        {
            suitesToRun.addElement(parent+":"+child);
            //System.out.println("Add this: " + parent+":"+child);
        }
        else
        {
            p = getSuiteProperties(child, false);
            if ( p.getProperty("suites") == null )
            {
                suitesToRun.addElement(parent+":"+child);
                //System.out.println("Add this: " + parent+":"+child);
            }
            else
            {
                String moresuites = p.getProperty("suites");
                BuildSuitesVector(child, moresuites);
            }
        }
    }
}
 
Example #26
Source File: RunSuite.java    From gemfirexd-oss with Apache License 2.0 5 votes vote down vote up
static void BuildSuitesVector(String parent, String subsuites)
    throws ClassNotFoundException, IOException
{
    Properties p;
    StringTokenizer st = new StringTokenizer(subsuites);
    String child = "";
    while (st.hasMoreTokens())
    {
        child = st.nextToken();
        if (child.equals(parent))
        {
            suitesToRun.addElement(parent+":"+child);
            //System.out.println("Add this: " + parent+":"+child);
        }
        else
        {
            p = getSuiteProperties(child, false);
            if ( p.getProperty("suites") == null )
            {
                suitesToRun.addElement(parent+":"+child);
                //System.out.println("Add this: " + parent+":"+child);
            }
            else
            {
                String moresuites = p.getProperty("suites");
                BuildSuitesVector(child, moresuites);
            }
        }
    }
}
 
Example #27
Source File: RegionEventImpl.java    From gemfirexd-oss with Apache License 2.0 5 votes vote down vote up
/**
 * Reads the contents of this message from the given input.
 */
public void fromData(DataInput in) throws IOException, ClassNotFoundException
{
  this.regionPath = DataSerializer.readString(in);
  this.callbackArgument = DataSerializer.readObject(in);
  this.op = Operation.fromOrdinal(in.readByte());
  this.originRemote = in.readBoolean();
  this.distributedMember = DSFIDFactory.readInternalDistributedMember(in);
  this.diskException = DataSerializer.readObject(in);
}
 
Example #28
Source File: RunList.java    From gemfirexd-oss with Apache License 2.0 4 votes vote down vote up
/**
* Locate the suite's properties file
*/
public static Properties locateSuiteProperties(String suiteName, 
    Properties parentProps, boolean isParent, boolean isTop)
    throws ClassNotFoundException, IOException, Exception
{
    // Check for suite properties
    //System.out.println("Checking for suite properties");
    String suitePropsName = "suites" + '/' + suiteName + ".properties";

    InputStream is = org.apache.derbyTesting.functionTests.harness.RunTest.loadTestResource(suitePropsName);
    if (is == null)
    {
        // Look in userdir
        suitePropsName = userdir + '/' + suiteName + ".properties";
        is = org.apache.derbyTesting.functionTests.harness.RunTest.loadTestResource(suitePropsName);
    }
    Properties p = new Properties();
    // Reset these properties
    if (isParent)
    {
        usesystem = null;
        upgradetest = null;
        jarfile = null;
        outcopy = null;
        useoutput = null;
        mtestdir = null;
        skipsed = "false";
        //outputdir = outDir.getCanonicalPath();
    }
    if (is != null)
    {
        p.load(is);
        is = null;
    }
    else
    {
        // Reset framework to the parent suite's framework, if any
        // because framework may have been set by previous suite
        testEncoding = parentProps.getProperty("derbyTesting.encoding");
        upgradejarpath = parentProps.getProperty("derbyTesting.jar.path");
        framework = parentProps.getProperty("framework");
        serverJvm = parentProps.getProperty("serverJvm");
        serverJvmName = parentProps.getProperty("serverJvmName");
        // Do the same for ij.defaultResourcePackage
        ijdefaultResourcePackage =
            parentProps.getProperty("ij.defaultResourcePackage");
        // And do the same for encryption
        encryption = parentProps.getProperty("encryption");
        testEncryptionProvider = parentProps.getProperty("testEncryptionProvider");
        testEncryptionAlgorithm = parentProps.getProperty("testEncryptionAlgorithm");
        // And do the same for jdk12test
        jdk12test = parentProps.getProperty("jdk12test");
        jdk12exttest = parentProps.getProperty("jdk12exttest");
     runwithj9 = parentProps.getProperty("runwithj9");
        runwithibmjvm = parentProps.getProperty("runwithibmjvm");
        String testJVM = jvmName;
        if (jvmName.startsWith("j9"))
        	testJVM = (jvmName.startsWith("j9_foundation") ? "foundation" : "j9");            
        runwithjvm = parentProps.getProperty("runwith" + testJVM);
        excludeJCC = parentProps.getProperty("excludeJCC");
    }                
    return p;
}
 
Example #29
Source File: RunSuite.java    From spliceengine with GNU Affero General Public License v3.0 4 votes vote down vote up
static Properties getSuiteProperties(String suiteName, boolean isTop)
      throws ClassNotFoundException, IOException
  {
      // Locate the suite's config file and get the properties
      // The file should be in the harness dir or user.dir
      String suiteProps = "suites" + '/' + suiteName + ".properties";
      userdir = System.getProperty("user.dir");

      InputStream is = RunTest.loadTestResource(suiteProps);
      if (is == null)
      {
          // Look in userdir
          suiteProps = userdir + '/' + suiteName + ".properties";
          is = RunTest.loadTestResource(suiteProps);
      }
      Properties p = new Properties();
      if (is == null)
          return p;

      p.load(is);
      // The top level suite may have special properties
      // which get propagated to any subsuites
      if (isTop == true)
      {
	String tmpjvmName=jvmName;	
          jvmName = p.getProperty("jvm");
    if ( (jvmName == null) || (jvmName.isEmpty()) )
    {
        javaVersion = System.getProperty("java.version");
    }
    else
        javaVersion = jvmName;

          // for j9, we cannot just use java.version.
          String javavmVersion;
          if (System.getProperty("java.vm.name").equals("J9"))
              javavmVersion = (System.getProperty("java.vm.version"));
          else
              javavmVersion = javaVersion;
  		    
    JavaVersionHolder jvh = new JavaVersionHolder(javavmVersion);
    String majorVersion = jvh.getMajorVersion();
    String minorVersion = jvh.getMinorVersion();
          int iminor = jvh.getMinorNumber();
          int imajor = jvh.getMajorNumber();
  		
    if ( (iminor < 2) && (imajor < 2) )
        jvmName = "currentjvm";
    else
        jvmName = "jdk" + majorVersion + minorVersion;
if ( tmpjvmName != null)
	jvmName= tmpjvmName;
          javaCmd = p.getProperty("javaCmd");
          jvmflags = p.getProperty("jvmflags");
          testJavaFlags = p.getProperty("testJavaFlags");
          testSpecialProps = p.getProperty("testSpecialProps");
          classpath = p.getProperty("classpath");
          classpathServer = p.getProperty("classpathServer");
          framework = p.getProperty("framework");
    String usepr = p.getProperty("useprocess");
    if (usepr != null)
    {
        usepr = usepr.toLowerCase();
        if (usepr.equals("false"))
            useprocess = false;
        else
            useprocess = true;
    }
    else
        useprocess = true;

          String nosed = p.getProperty("skipsed");
          if (nosed != null)
          {
              nosed = nosed.toLowerCase();
              if (nosed.equals("true"))
                  skipsed = true;
              else
                  skipsed = false;
          }
          else
              skipsed = false;
              
          outputdir = p.getProperty("outputdir");
          canondir = p.getProperty("canondir");
          bootcp = p.getProperty("bootcp");
          hostName = p.getProperty("hostName");
          serverJvm = p.getProperty("serverJvm");
          systemdiff = p.getProperty("systemdiff");
          ijdefaultResourcePackage = p.getProperty("ij.defaultResourcePackage");
          outcopy = p.getProperty("outcopy");
          debug = p.getProperty("verbose");
          reportstderr = p.getProperty("reportstderr");
          timeout = p.getProperty("timeout");
          shutdownurl = p.getProperty("shutdownurl");
          testEncoding = p.getProperty("derbyTesting.encoding");
      }
      suites = p.getProperty("suites");
return p;
  }
 
Example #30
Source File: RunTest.java    From gemfirexd-oss with Apache License 2.0 4 votes vote down vote up
/**
 * Install the default security manager in this JVM for this
 * test, used when useprocess is false.
 * @return true if a security manager was installed
 * @throws ClassNotFoundException
 * @throws IOException
 */
private static boolean installSecurityManager() throws ClassNotFoundException, IOException
{
	// SecurityManager not currently work with older j9 and useProcess=false
	// need to disable to allow tests to run.
if (jvmName.startsWith("j9") && (!jvmName.equals("j9_foundation11")))
	return false;
	
	boolean installedSecurityManager = false;
	// Set up the SecurityManager in this JVM for this test.
	boolean haveSecurityManagerAlready = System.getSecurityManager() != null;
    if (runWithoutSecurityManager)
    {
    	// Test doesn't run with a SecurityManager,
    	// print a warning if one is there already.
    	if (haveSecurityManagerAlready)
    		System.out.println(
    				"noSecurityManager=true,useProcess=false but SecurityManager installed by previous test");
    	else
    	    System.out.println("-- SecurityManager not installed --");
    }     
    else if (!haveSecurityManagerAlready)
	{
    	// Get the set of -D options that would be needed
    	// for a spawned VM and convert them to system properties.
	    Vector propList = jvm.getSecurityProps(null);
	    for (Enumeration e = propList.elements(); e.hasMoreElements();)
	    {
	    	String dashDOpt = (String) e.nextElement();
	    	if ("java.security.manager".equals(dashDOpt))
	    		continue;
	    	
	    	int eq = dashDOpt.indexOf("=");
	    	String key = dashDOpt.substring(0, eq);
	    	String value = dashDOpt.substring(eq + 1);
	    	
	    	System.setProperty(key, value);
	    	
 	    }
  System.setSecurityManager(new SecurityManager());
  installedSecurityManager = true;
	}
    
    return installedSecurityManager;
}