⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 runtest.java

📁 derby database source code.good for you.
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
            	if (jvmName.equals("j9_foundation"))            		testJVM = "foundation";            	else            		testJVM = "j9";            }            runwithjvm = ap.getProperty("runwith" + testJVM);            if  ((runwithjvm != null) && (runwithjvm.equalsIgnoreCase("false")))            {				skiptest = true;				addSkiptestReason("Test skipped: test cannot run with jvm: " +								  jvmName + ".  " + scriptFileName);			}			// startServer will determine whether the server will be started 			// for network server tests or that will be left to the test.			String startServerProp = ap.getProperty("startServer");			if (startServerProp != null &&				startServerProp.equalsIgnoreCase("false"))				startServer =false;				        // Check for jvmflags (like "-nojit -ms32M -mx32M")	        // These may have been set as a system property already	        if (jvmflags == null)	        {	            jvmflags = ap.getProperty("jvmflags");	            // If set in app props to up the memory, this	            // is only meant to be applied to 11x vms	            if ( (jvmflags != null) && (!jvmName.equals("currentjvm")) )	            {	                if (jvmflags.startsWith("-ms"))	                    jvmflags = "";	            }	        }	        	            		// Also check for supportfiles    		String suppFiles = ap.getProperty("supportfiles");			boolean copySupportFiles = ((suppFiles != null) && (suppFiles.length()>0));			boolean createExtDirs= new Boolean(ap.getProperty("useextdirs","false")).booleanValue();			    		if (copySupportFiles || createExtDirs)    		{				File copyOutDir = null;    		    if (testType.equals("sql2"))    		    {    		        if ( (isSuiteRun) || (framework.length()>0) )						copyOutDir = outDir;    		        else if ( (runDir != null) && (runDir.exists()) )						copyOutDir = runDir;    		        else						copyOutDir = outDir;    		    }    		    else if ( testType.equals("multi") )    		    {    		        if ( (isSuiteRun) || (mtestdir == null) || (mtestdir.length()==0) )    		        {						copyOutDir = outDir;    		        }    		        else    		        {    		            File multiDir = new File(mtestdir);						copyOutDir = multiDir;    		        }    		    }                else if ( outcopy == true )                    copyOutDir = outDir;                else if ( (runDir != null) && (runDir.exists()) )                {                    if (jvmName.startsWith("j9")&&  testType.equals("java"))                    {                        // for some reason, not picking up from rundir                        copyOutDir = outDir;                    }else					    copyOutDir = runDir;                }                else                    copyOutDir = outDir;				if(createExtDirs)				{					extInDir = copyOutDir;					//create the support file directory for input files					extInDir = new File(copyOutDir , "extin");					if(!extInDir.exists())						extInDir.mkdirs();					//create the support file directory for output files.					extOutDir = new File(copyOutDir , "extout");					if(!extOutDir.exists())						extOutDir.mkdirs();					//create the support file directory for input output files.					extInOutDir = new File(copyOutDir , "extinout");					if(!extInOutDir.exists())						extInOutDir.mkdirs();					copyOutDir = extInDir;				}				if(copySupportFiles)				   CopySuppFiles.copyFiles(copyOutDir, suppFiles);    		}			    	}        return propString;    }    public static String setTestJavaFlags(String tflags)    {        StringBuffer sb = new StringBuffer();	    if (verbose) System.out.println("testJavaflags: " + tflags);	    String dintro = "-D";        try        {            dintro = jvm.getJvm(jvmName).getDintro();        }        catch (Exception e)        {            System.out.println("Problem getting jvm "+jvmName+" Dintro: ");            e.printStackTrace(System.out);		    System.exit(1);        }	    // Parse because there could be a list of flags	    StringTokenizer st = new StringTokenizer(tflags,"^");        while (st.hasMoreTokens())        {	        String token = st.nextToken();            if ( ! (token.startsWith("-D") || token.startsWith("-X"))) { sb.append(dintro); }            sb.append(token);            sb.append(" ");        }        if (verbose) System.out.println("setTestJavaFlags returning: " + sb.toString());        return sb.toString();    }	private static void loadProps(Properties p, File f) throws Exception	{		if (f.canRead())		{			FileInputStream fis = new FileInputStream(f);			p.load(fis);			fis.close();		}	}	private static void mergeProps(Properties to, Properties from)	{		for (Enumeration e = from.propertyNames(); e.hasMoreElements(); )		{			String key = (String)e.nextElement();			to.put(key, from.getProperty(key));		}	}    private static void frameworkProtocol(Properties p) throws Exception    {        if (p == null)        {            // No properties            return;        }		for (Enumeration e = p.propertyNames(); e.hasMoreElements(); )		{			String key = (String)e.nextElement();			String value = p.getProperty(key);			if (key.equals("driver") || key.equals("ij.driver") || key.equals("jdbc.drivers"))			{			    p.put(key, driverName);			}			else if (key.startsWith("ij.protocol") || key.equals("protocol"))			{			    value = NetServer.alterURL(framework,value);			    p.put(key, value);			}			else if (key.equals("database") || key.equals("ij.database") || key.startsWith("ij.connection") || key.equals("jdbc.url"))			{			    dbName = value.substring(value.lastIndexOf(':') + 1 ,						     value.length());			    value = NetServer.alterURL(framework,value);			    p.put(key, value);			}			else // for any other properties, just copy them			    p.put(key, value);					}				// jcc default requires userid		// derby client will default to "APP" so doesn't need harness		// to set a user.		if (NetServer.isJCCConnection(framework))		{			String user = System.getProperty("ij.user");			if (user == null) user = "APP";		    p.put("ij.user",user);		}		// both jcc and client require password for the moment		if (NetServer.isClientConnection(framework))		{				String password = System.getProperty("ij.password");			if (password == null) password = "APP";		    p.put("ij.password",password);		}				if (NetServer.isJCCConnection(framework))		{			// force messages to show			p.put("ij.retrieveMessagesFromServerOnGetMessage","true");			}		// If this is not a known protocol for ij we		// need to set the driver		if (driverName != null)		    p.put("ij.driver",driverName);	}		private static void encryptionProtocol(Properties p) throws Exception	{        String encryptUrl = "dataEncryption=true;bootPassword=Thursday";        if (p == null)        {            // No properties            return;        }        // add encryption algorithm and provider to database creation URL        String v = p.getProperty("testEncryptionAlgorithm");        if (v != null)            encryptUrl += ";" + Attribute.CRYPTO_ALGORITHM + "=" + v;        v = p.getProperty("testEncryptionProvider");        if (v != null)            encryptUrl += ";" + Attribute.CRYPTO_PROVIDER + "=" + v;		for (Enumeration e = p.propertyNames(); e.hasMoreElements(); )		{			String key = (String)e.nextElement();			String value = p.getProperty(key);			if (key.equals("database") || key.equals("ij.database") || key.startsWith("ij.connection") || key.equals("jdbc.url"))			{				// edit the url if necessary				int index = value.indexOf(encryptUrl);				if ( index == -1)				{				    value = value + ";" + encryptUrl;			    }				p.put(key, value);			}            else if (key.equals("testEncryptionAlgorithm") || key.equals("testEncryptionProvider"))                {} // ignore, do not copy			else // for any other properties, just copy them			    p.put(key, value);		}	}    private static void cleanupBaseDir(File baseDir)    {        // Some tests rely on no cleanup being done on the baseDir        boolean okToDelete = false;        if ( (usesystem == null) || (usesystem.length()==0) )            okToDelete = true;        else if (usesystem.equals("nist"))        {            if (testBase.equals("schema1"))                okToDelete = true;        }        else if (usesystem.equals("puzzles"))        {            if (testBase.equals("puzzleschema"))                okToDelete = true;        }        if (useCommonDB) okToDelete = false;        if (okToDelete == true)        {           //System.out.println("Should be deleting the baseDir for a clean run");           deleteFile(baseDir);           if (baseDir.exists())               System.out.println("baseDir did not get deleted which could cause test failures");           else               baseDir.mkdir();        }    }    private static void doCleanup(String javaVersion)        throws IOException    {        boolean status = true;        // The output files cannot be deleted if there        // is still a reference to them -- even doing        // this is not a guarantee that they will be deleted        // It seems to depend on the Java environment        //printWriter.close();        //printWriter = null;        //Always cleanup the script files - except when keepfiles is true        if ( !(script == null) && (script.exists()) && (!keepfiles) )        {            status = script.delete();            //System.out.println("Status was: " + status);        }	    String endTime = CurrentTime.getTime();	    StringBuffer sbend = new StringBuffer();	    sbend.append("*** End:   " + testBase + " jdk" + javaVersion + " ");	    if ( (framework.length()>0) && (!framework.startsWith("embedded")) )	        sbend.append(framework + " ");	    if ( (suiteName != null) && (suiteName.length()>0) )	        sbend.append(suiteName + " ");	    sbend.append(endTime + " ***");	    System.out.println(sbend.toString());	    pwDiff.println(sbend.toString());        pwDiff.flush();        pwDiff.close();        pwDiff = null;        // This could be true if set by user or there were diffs        if (keepfiles == false)        {            // Delete the out and diff files            status = tmpOutFile.delete();            if (status == false)                tmpOutFile = null;            status = finalOutFile.delete();            if (skiptest == false)                status = diffFile.delete();            // delete the copied (and, for network server, modified) master file            tempMasterFile = new File(outDir, tempMasterName);            status = tempMasterFile.delete();            if (deleteBaseDir)            {                if (useCommonDB == false)                 {                	//System.out.println("Should delete the baseDir: " + baseDir.getPath());                	deleteFile(baseDir);		        }		        else 		        {			        status = appPropFile.delete();			        //no permission in Java to drop derby.log			        //File logfile = new File(baseDir, "derby.log");			        //System.out.println("delete derby.log ");			        //System.out.println(logfile.getPath());			        //status = logfile.delete();		        }            }			//delete the directories where external input/output files were created			if(extInDir!=null)				deleteFile(extInDir);			if(extOutDir!=null)				deleteFile(extOutDir);			if(extInDir!=null)				deleteFile(extInOutDir);        }	    // reset for next test	    // the next line is a bug fix to get cleanup working correctly when

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -