remove more old tests
diff --git a/src/share/classes/test/AppletTest.java b/src/share/classes/test/AppletTest.java deleted file mode 100644 index 47af861..0000000 --- a/src/share/classes/test/AppletTest.java +++ /dev/null
@@ -1,485 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - */ - -package test; - -import java.applet.*; -import java.awt.*; -import java.beans.*; -import java.io.*; -import java.net.*; -import javax.activation.*; - -public class AppletTest - extends Applet -{ - -public AppletTest() -{ - - mTextArea = new TextArea(10, 40); - mTextArea.setEditable(false); - - add(mTextArea); -} - -public void init() -{ - StringWriter lWriter = new StringWriter(); - try - { - String lTest = getParameter("test"); - - String[] lArgs = { "file", "" }; - lArgs[1] = getParameter(lArgs[0]); - - if(lArgs[1] == null) - { - lArgs[0] = "url"; - lArgs[1] = getParameter(lArgs[0]); - } - - lWriter.write("Test: " + lTest + " " + lArgs[0] + " " + lArgs[1] + "\n\n"); - - if(lTest.equals("CommandMapTest")) - { - doCommandMapTest(lWriter, lArgs); - } - else if(lTest.equals("RelCommandMapTest")) - { - doRelCommandMapTest(lWriter, lArgs); - } - else if(lTest.equals("DSWriteTest")) - { - doDSWriteTest(lWriter, lArgs); - } - else if(lTest.equals("RelDSWriteTest")) - { - doRelDSWriteTest(lWriter, lArgs); - } - } - catch(Exception inException) - { - lWriter.write(inException.toString() + "\n"); - } - - mTextArea.setText(lWriter.toString()); - mTextArea.repaint(); -} - -private void doCommandMapTest(Writer outWriter, String[] inArguments) throws MalformedURLException, IOException -{ - CommandMap lCommandMap = CommandMap.getDefaultCommandMap(); - - if(inArguments.length >= 2) - { - if(inArguments[0].equals("file")) - { - for(int lIndex = 1; lIndex < inArguments.length; ++lIndex) - { - File lFile = new File(inArguments[lIndex]); - FileDataSource lFileSource = new FileDataSource(lFile); - DataHandler ldh = new DataHandler (lFileSource); - - outWriter.write("Name: " + lFileSource.getName() + "\n"); - - String lMIMEType = lFileSource.getContentType(); - outWriter.write("Type: " + lFileSource.getContentType() + "\n"); - - processType(outWriter, lCommandMap, lMIMEType, ldh); - - outWriter.write("\n"); - } - } - else if(inArguments[0].equals("url")) { - System.out.println("url option not supported!!"); - - // for(int lIndex = 1; lIndex < inArguments.length; ++lIndex){ - // URL lURL = new URL(inArguments[lIndex]); - // URLConnection lURLSource = lURL.openConnection(); - - // lURLSource.connect(); - // outWriter.write("Name: " + lURLSource.getName() + "\n"); - - // String lMIMEType = lURLSource.getContentType(); - // outWriter.write("Type: " + lURLSource.getContentType() + "\n"); - - // processType(outWriter, lCommandMap, lMIMEType); - - // outWriter.write("\n"); - // } - } - } - else - { - outWriter.write("usage: CommandMapTest <sourcetype> <sources>\n"); - } -} - -private void doRelCommandMapTest(Writer outWriter, String[] inArguments) throws MalformedURLException, IOException -{ - CommandMap lCommandMap = CommandMap.getDefaultCommandMap(); - - if(inArguments.length >= 2) - { - if(inArguments[0].equals("file")) - { - for(int lIndex = 1; lIndex < inArguments.length; ++lIndex) - { - File lFile = new File(inArguments[lIndex]); - FileDataSource lFileSource = new FileDataSource(lFile); - DataHandler ldh = new DataHandler (lFileSource); - - outWriter.write("Name: " + lFileSource.getName() + "\n"); - - String lMIMEType = lFileSource.getContentType(); - outWriter.write("Type: " + lFileSource.getContentType() + "\n"); - - processType(outWriter, lCommandMap, lMIMEType, ldh); - - outWriter.write("\n"); - } - } - else if(inArguments[0].equals("url")) { - // for(int lIndex = 1; lIndex < inArguments.length; ++lIndex){ -// URL lDoc = getDocumentBase(); -// URL lURL = new URL(lDoc, inArguments[lIndex]); -// URLConnection lURLSource = lURL.openConnection(); - -// lURLSource.connect(); -// outWriter.write("Name: " + lURLSource.getName() + "\n"); - -// String lMIMEType = lURLSource.getContentType(); -// outWriter.write("Type: " + lURLSource.getContentType() + "\n"); - -// processType(outWriter, lCommandMap, lMIMEType); - -// outWriter.write("\n"); -// } - } - } - else - { - outWriter.write("usage: CommandMapTest <sourcetype> <sources>\n"); - } -} - -private static void processType(Writer outWriter, CommandMap inCmdMap, String inType, DataHandler dh) throws IOException -{ - Object lBean; - Class lBeanClass; - - // grab the preferred commands and enumerate them - outWriter.write("Preferred commands:\n"); - CommandInfo[] lPreferredCmds = inCmdMap.getPreferredCommands(inType); - for(int lCmdIndex = 0; lCmdIndex < lPreferredCmds.length; ++lCmdIndex) - { - lBean = dh.getBean(lPreferredCmds[lCmdIndex]); - if (lBean != null) - { - lBeanClass = lBean.getClass(); - outWriter.write(" " + lBeanClass.getName() + "\n"); - } - else - { - outWriter.write("No Bean for command " + lPreferredCmds[lCmdIndex].getCommandName()); - } - } - - // grab all commands and enumerate them - outWriter.write("All commands:\n"); - CommandInfo[] lAllCmds = inCmdMap.getAllCommands(inType); - for(int lCmdIndex = 0; lCmdIndex < lAllCmds.length; ++lCmdIndex) - { - lBean = dh.getBean(lAllCmds[lCmdIndex]); - if (lBean != null) - { - lBeanClass = lBean.getClass(); - outWriter.write(" " + lBeanClass.getName() + "\n"); - } - else - { - outWriter.write("No Bean for command " + lAllCmds[lCmdIndex].getCommandName()); - } - } - - // grab the commands for the default three verbs view, edit & print - outWriter.write("View:\n"); - CommandInfo lCmd = inCmdMap.getCommand(inType, "view"); - if(lCmd != null) - { - lBean = dh.getBean(lCmd); - if (lBean != null) - { - lBeanClass = lBean.getClass(); - outWriter.write(" " + lBeanClass.getName() + "\n"); - } - else - { - outWriter.write("No Bean for command " + lCmd.getCommandName()); - } - } - else - { - outWriter.write(" None\n"); - } - - outWriter.write("Edit:\n"); - lCmd = inCmdMap.getCommand(inType, "edit"); - if(lCmd != null) - { - lBean = dh.getBean(lCmd); - if (lBean != null) - { - lBeanClass = lBean.getClass(); - outWriter.write(" " + lBeanClass.getName() + "\n"); - } - else - { - outWriter.write("No Bean for command " + lCmd.getCommandName()); - } - } - else - { - outWriter.write(" None\n"); - } - - outWriter.write("Print:\n"); - lCmd = inCmdMap.getCommand(inType, "print"); - if(lCmd != null) - { - lBean = dh.getBean(lCmd); - if (lBean != null) - { - lBeanClass = lBean.getClass(); - outWriter.write(" " + lBeanClass.getName() + "\n"); - } - else - { - outWriter.write("No Bean for command " + lCmd.getCommandName()); - } - } - else - { - outWriter.write(" None\n"); - } -} - -private void doRelDSWriteTest(Writer outWriter, String[] inArguments) throws Exception, MalformedURLException, IOException -{ - if(inArguments.length >= 2) - { - if(inArguments[0].equals("file")) - { - for(int lFileIndex = 1; lFileIndex < inArguments.length; ++lFileIndex) - { - File lFile = new File(inArguments[lFileIndex]); - FileDataSource lFileSource = new FileDataSource(lFile); - - String lName = lFileSource.getName(); - outWriter.write("Name: " + lName + "\n"); - outWriter.write("Type: " + lFileSource.getContentType() + "\n"); - - // write some data - OutputStream lFileOStream = lFileSource.getOutputStream(); - if(lFileOStream != null) - { - byte[] lFileBuffer = { 34, 35, 36, 37 }; - lFileOStream.write(lFileBuffer); - lFileOStream.flush(); - lFileOStream.close(); - lFileOStream = null; - - // read the same data - InputStream lFileIStream = lFileSource.getInputStream(); - lFileIStream.read(lFileBuffer); - if((lFileBuffer[0] == 34) && (lFileBuffer[1] == 35) && (lFileBuffer[2] == 36) &&(lFileBuffer[3] == 37)) - { - outWriter.write("Test Succeeded\n"); - } - else - { - outWriter.write("Test Failed\n"); - } - lFileIStream = null; - - if(!lFile.delete()) - { - outWriter.write("couldn't delete " + lName + "\n"); - } - } - else - { - outWriter.write("Test Failed because an OutputStream couldn't be created.\n"); - } - } - } - else if(inArguments[0].equals("url")) { - // URL lDoc = getDocumentBase(); -// for(int lURLIndex = 1; lURLIndex < inArguments.length; ++lURLIndex) -// { -// URL lURL = new URL(lDoc, inArguments[lURLIndex]); - -// outWriter.write("Name: " + lURL.getName() + "\n"); -// outWriter.write("Type: " + lURL.getContentType() + "\n"); - -// // write some data -// OutputStream lURLOStream = lURL.getOutputStream(); -// if(lURLOStream != null) { -// byte[] lURLBuffer = { 34, 35, 36, 37 }; -// lURLOStream.write(lURLBuffer); -// lURLOStream.flush(); -// lURLOStream.close(); - -// // read the same data -// InputStream lURLIStream = lURL.getInputStream(); -// lURLIStream.read(lURLBuffer); -// if((lURLBuffer[0] == 34) && (lURLBuffer[1] == 35) && (lURLBuffer[2] == 36) &&(lURLBuffer[3] == 37)) { -// outWriter.write("Test Succeeded\n"); -// } -// else { -// outWriter.write("Test Failed\n"); -// } -// } -// else { -// outWriter.write("Test Failed because an OutputStream couldn't be created.\n"); -// } -// } - } - } - else - { - outWriter.write("usage: DataSourceTest <kind of source> <name of source>\n"); - } -} - -private void doDSWriteTest(Writer outWriter, String[] inArguments) throws Exception, MalformedURLException, IOException -{ - if(inArguments.length >= 2) - { - if(inArguments[0].equals("file")) - { - for(int lFileIndex = 1; lFileIndex < inArguments.length; ++lFileIndex) - { - File lFile = new File(inArguments[lFileIndex]); - FileDataSource lFileSource = new FileDataSource(lFile); - - String lName = lFileSource.getName(); - outWriter.write("Name: " + lName + "\n"); - outWriter.write("Type: " + lFileSource.getContentType() + "\n"); - - // write some data - OutputStream lFileOStream = lFileSource.getOutputStream(); - if(lFileOStream != null) - { - byte[] lFileBuffer = { 34, 35, 36, 37 }; - lFileOStream.write(lFileBuffer); - lFileOStream.flush(); - lFileOStream.close(); - lFileOStream = null; - - // read the same data - InputStream lFileIStream = lFileSource.getInputStream(); - lFileIStream.read(lFileBuffer); - if((lFileBuffer[0] == 34) && (lFileBuffer[1] == 35) && (lFileBuffer[2] == 36) &&(lFileBuffer[3] == 37)) - { - outWriter.write("Test Succeeded\n"); - } - else - { - outWriter.write("Test Failed\n"); - } - lFileIStream = null; - - if(!lFile.delete()) - { - outWriter.write("couldn't delete " + lName + "\n"); - } - } - else - { - outWriter.write("Test Failed because an OutputStream couldn't be created.\n"); - } - } - } - else if(inArguments[0].equals("url")) { - // for(int lURLIndex = 1; lURLIndex < inArguments.length; ++lURLIndex) { -// URL lURL = new URL(inArguments[lURLIndex]); - -// outWriter.write("Name: " + lURL.getName() + "\n"); -// outWriter.write("Type: " + lURL.getContentType() + "\n"); - -// // write some data -// OutputStream lURLOStream = lURL.getOutputStream(); -// if(lURLOStream != null) -// { -// byte[] lURLBuffer = { 34, 35, 36, 37 }; -// lURLOStream.write(lURLBuffer); -// lURLOStream.flush(); -// lURLOStream.close(); - -// // read the same data -// InputStream lURLIStream = lURL.getInputStream(); -// lURLIStream.read(lURLBuffer); -// if((lURLBuffer[0] == 34) && (lURLBuffer[1] == 35) && (lURLBuffer[2] == 36) &&(lURLBuffer[3] == 37)) -// { -// outWriter.write("Test Succeeded\n"); -// } -// else -// { -// outWriter.write("Test Failed\n"); -// } -// } -// else -// { -// outWriter.write("Test Failed because an OutputStream couldn't be created.\n"); -// } -// } - } - } - else - { - outWriter.write("usage: DataSourceTest <kind of source> <name of source>\n"); - } -} - -private TextArea mTextArea; - -}
diff --git a/src/share/classes/test/CLTest.java b/src/share/classes/test/CLTest.java deleted file mode 100644 index 88dde8b..0000000 --- a/src/share/classes/test/CLTest.java +++ /dev/null
@@ -1,64 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - */ - -/** - * NOTE: This test only works on JDK 1.2!! - */ -package test; - -import java.net.*; - -class CLTest -{ - -public static void main(String[] inArgs) -{ - URL[] lURLs = ClassLoader.getSystemResources(inArgs[0]); - - System.out.println("Looking for resources named " + inArgs[0]); - System.out.println("Found:"); - - for(int lIndex = 0; lIndex < lURLs.length; ++lIndex) - { - System.out.println(" " + lURLs[lIndex].toString()); - } -} - -}
diff --git a/src/share/classes/test/CommandMapTest.java b/src/share/classes/test/CommandMapTest.java deleted file mode 100644 index 40ddb14..0000000 --- a/src/share/classes/test/CommandMapTest.java +++ /dev/null
@@ -1,184 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - */ - -package test; - -import java.beans.*; -import java.io.*; -import java.net.*; -import javax.activation.*; -public class CommandMapTest -{ - -public static void main(String[] inArguments) throws MalformedURLException, IOException -{ - CommandMap lCommandMap = CommandMap.getDefaultCommandMap(); - - if(inArguments.length >= 2) - { - if(inArguments[0].equals("file")) - { - for(int lIndex = 1; lIndex < inArguments.length; ++lIndex) - { - File lFile = new File(inArguments[lIndex]); - FileDataSource lFileSource = new FileDataSource(lFile); - DataHandler ldh = new DataHandler(lFileSource); - - System.out.println("Name: " + lFileSource.getName()); - - String lMIMEType = lFileSource.getContentType(); - System.out.println("Type: " + lFileSource.getContentType()); - - processType(lCommandMap, lMIMEType, ldh); - - System.out.println(""); - } - } - else if(inArguments[0].equals("url")) - { - - System.out.println("URL not supported..."); -// for(int lIndex = 1; lIndex < inArguments.length; ++lIndex) -// { -// URL lURL = new URL(inArguments[lIndex]); -// URLConnection lURLSource = lURL.openConnection(); - -// lURLSource.connect(); -// System.out.println("Name: " + lURLSource.getName()); - -// String lMIMEType = lURLSource.getContentType(); -// System.out.println("Type: " + lURLSource.getContentType()); - -// processType(lCommandMap, lMIMEType); - -// System.out.println(""); -// } - } - } - else - { - System.out.println("usage: CommandMapTest <sourcetype> <sources>"); - } -} - -// MH we now passed in a dh, currently there's no acccessor for CommandInfo.className. -// so use dh.getBean().getClass().getClassName(). if/when there is an accessor just do: -// System.out.println(" " + lPreferredCmds[lCmdIndex].getClassName()); -private static void processType(CommandMap inCmdMap, String inType, DataHandler dh) -{ - Object lBean; - Class lBeanClass; - - // grab the preferred commands and enumerate them - System.out.println("Preferred commands:"); - CommandInfo[] lPreferredCmds = inCmdMap.getPreferredCommands(inType); - for(int lCmdIndex = 0; lCmdIndex < lPreferredCmds.length; ++lCmdIndex) - { - lBean = dh.getBean(lPreferredCmds[lCmdIndex]); - if (lBean != null) - { - lBeanClass = lBean.getClass(); - System.out.println(" " + lBeanClass.getName()); - } - else - { - System.out.print("No Bean for command " + lPreferredCmds[lCmdIndex].getCommandName()); - } - } - - // grab all commands and enumerate them - System.out.println("All commands:"); - CommandInfo[] lAllCmds = inCmdMap.getAllCommands(inType); - for(int lCmdIndex = 0; lCmdIndex < lAllCmds.length; ++lCmdIndex) - { - lBean = dh.getBean(lAllCmds[lCmdIndex]); - if (lBean != null) - { - lBeanClass = lBean.getClass(); - System.out.println(" " + lBeanClass.getName()); - } - else - { - System.out.print("No Bean for command " + lAllCmds[lCmdIndex].getCommandName()); - } - } - - // grab the commands for the default three verbs view, edit & print - System.out.println("View:"); - CommandInfo lCmd = inCmdMap.getCommand(inType, "view"); - if(lCmd != null) - { - lBean = dh.getBean(lCmd); - lBeanClass = lBean.getClass(); - System.out.println(" " + lBeanClass.getName()); - } - else - { - System.out.println(" None"); - } - - System.out.println("Edit:"); - lCmd = inCmdMap.getCommand(inType, "edit"); - if(lCmd != null) - { - lBean = dh.getBean(lCmd); - lBeanClass = lBean.getClass(); - System.out.println(" " + lBeanClass.getName()); - } - else - { - System.out.println(" None"); - } - - System.out.println("Print:"); - lCmd = inCmdMap.getCommand(inType, "print"); - if(lCmd != null) - { - lBean = dh.getBean(lCmd); - lBeanClass = lBean.getClass(); - System.out.println(" " + lBeanClass.getName()); - } - else - { - System.out.println(" None"); - } -} - -}
diff --git a/src/share/classes/test/DHTransferableTest.java b/src/share/classes/test/DHTransferableTest.java deleted file mode 100644 index 5f4d3da..0000000 --- a/src/share/classes/test/DHTransferableTest.java +++ /dev/null
@@ -1,124 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - */ - -package test; - -import java.beans.*; -import java.io.*; -import java.net.*; -import java.awt.datatransfer.*; -import javax.activation.*; - -public class DHTransferableTest -{ - -public static final DataFlavor sImageJPEGFlavor = new DataFlavor("image/jpeg", "JPEG image"); -public static final DataFlavor sImageGIFFlavor = new DataFlavor("image/gif", "GIF image"); -public static final DataFlavor sTextFlavor = new DataFlavor("text/*", "text"); -public static final DataFlavor sTextPlainFlavor = new DataFlavor("text/plain", "plain text"); -public static final DataFlavor sTextHTMLFlavor = new DataFlavor("text/html", "HTML document"); - -public static void main(String[] inArguments) throws MalformedURLException, IOException -{ - DataHandler lDataHandler; - - if(inArguments.length >= 2) - { - if(inArguments[0].equals("file")) - { - for(int lIndex = 1; lIndex < inArguments.length; ++lIndex) - { - processDataHandler(new DataHandler(new FileDataSource(new File(inArguments[lIndex])))); - } - } - else if(inArguments[0].equals("url")) { - System.out.println("URL not supported..."); - // for(int lIndex = 1; lIndex < inArguments.length; ++lIndex) - // { - // processDataHandler(new URL(inArguments[lIndex])); - // } - } - } - else - { - System.out.println("usage: DataHandlerTest <sourcetype> <sources>"); - } -} - -private static void processDataHandler(DataHandler inDataHandler) throws IOException -{ - System.out.println("Name: " + inDataHandler.getName()); - System.out.println("Type: " + inDataHandler.getContentType()); - - // find out what flavors the handler thinks are supported - System.out.println("Says it supports:"); - DataFlavor[] lFlavors = inDataHandler.getTransferDataFlavors(); - for(int lIndex = 0; lIndex < lFlavors.length; ++lIndex) - { - System.out.println(" " + lFlavors[lIndex].getHumanPresentableName() + " (" + lFlavors[lIndex].getMimeType() + ")"); - } - - // now query to see what of our basic flavors are supported - queryFlavor(inDataHandler, DataFlavor.plainTextFlavor); - queryFlavor(inDataHandler, DataFlavor.stringFlavor); - queryFlavor(inDataHandler, sImageJPEGFlavor); - queryFlavor(inDataHandler, sImageGIFFlavor); - queryFlavor(inDataHandler, sTextFlavor); - queryFlavor(inDataHandler, sTextPlainFlavor); - queryFlavor(inDataHandler, sTextHTMLFlavor); - - System.out.println(""); -} - -private static void queryFlavor(DataHandler inDataHandler, DataFlavor inFlavor) -{ - - if(inDataHandler.isDataFlavorSupported(inFlavor)) - { - System.out.print("Supports "); - } - else - { - System.out.print("Doesn't support "); - } - System.out.println(inFlavor.getHumanPresentableName() + " (" + inFlavor.getMimeType() + ")"); -} - -}
diff --git a/src/share/classes/test/DSWriteTest.java b/src/share/classes/test/DSWriteTest.java deleted file mode 100644 index 3486cd3..0000000 --- a/src/share/classes/test/DSWriteTest.java +++ /dev/null
@@ -1,144 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - */ - -package test; - -import java.beans.*; -import java.io.*; -import java.net.*; -import javax.activation.*; - -public class DSWriteTest -{ - -public static void main(String[] inArguments) throws Exception, MalformedURLException, IOException -{ - if(inArguments.length >= 2) - { - if(inArguments[0].equals("file")) - { - for(int lFileIndex = 1; lFileIndex < inArguments.length; ++lFileIndex) - { - File lFile = new File(inArguments[lFileIndex]); - FileDataSource lFileSource = new FileDataSource(lFile); - - String lName = lFileSource.getName(); - System.out.println("Name: " + lName); - System.out.println("Type: " + lFileSource.getContentType()); - - // write some data - OutputStream lFileOStream = lFileSource.getOutputStream(); - if(lFileOStream != null) - { - byte[] lFileBuffer = { 34, 35, 36, 37 }; - lFileOStream.write(lFileBuffer); - lFileOStream.flush(); - lFileOStream.close(); - lFileOStream = null; - - // read the same data - InputStream lFileIStream = lFileSource.getInputStream(); - lFileIStream.read(lFileBuffer); - if((lFileBuffer[0] == 34) && (lFileBuffer[1] == 35) && (lFileBuffer[2] == 36) &&(lFileBuffer[3] == 37)) - { - System.out.println("Test Succeeded"); - } - else - { - System.out.println("Test Failed"); - } - lFileIStream = null; - - if(!lFile.delete()) - { - System.out.println("couldn't delete " + lName); - } - } - else - { - System.out.println("Test Failed because an OutputStream couldn't be created."); - } - } - } - else if(inArguments[0].equals("url")) - { - System.out.println("URL not supported..."); -// for(int lURLIndex = 1; lURLIndex < inArguments.length; ++lURLIndex) -// { -// URL lURL = new URL(inArguments[lURLIndex]); - -// System.out.println("Name: " + lURL.getName()); -// System.out.println("Type: " + lURL.getContentType()); - -// // write some data -// OutputStream lURLOStream = lURL.getOutputStream(); -// if(lURLOStream != null) -// { -// byte[] lURLBuffer = { 34, 35, 36, 37 }; -// lURLOStream.write(lURLBuffer); -// lURLOStream.flush(); -// lURLOStream.close(); - -// // read the same data -// InputStream lURLIStream = lURL.getInputStream(); -// lURLIStream.read(lURLBuffer); -// if((lURLBuffer[0] == 34) && (lURLBuffer[1] == 35) && (lURLBuffer[2] == 36) &&(lURLBuffer[3] == 37)) -// { -// System.out.println("Test Succeeded"); -// } -// else -// { -// System.out.println("Test Failed"); -// } -// } -// else -// { -// System.out.println("Test Failed because an OutputStream couldn't be created."); -// } -// } - } - } - else - { - System.out.println("usage: DataSourceTest <kind of source> <name of source>"); - } -} - -}
diff --git a/src/share/classes/test/DataHandlerTest.java b/src/share/classes/test/DataHandlerTest.java deleted file mode 100644 index f0be7c8..0000000 --- a/src/share/classes/test/DataHandlerTest.java +++ /dev/null
@@ -1,203 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - */ - -package test; - -import java.beans.*; -import java.io.*; -import java.net.*; -import javax.activation.*; - -public class DataHandlerTest -{ - -public static void main(String[] inArguments) throws MalformedURLException, IOException -{ - DataHandler lDataHandler; - - if(inArguments.length >= 2) - { - if(inArguments[0].equals("file")) - { - for(int lIndex = 1; lIndex < inArguments.length; ++lIndex) - { - processDataHandler(new DataHandler(new FileDataSource(new File(inArguments[lIndex])))); - } - } - else if(inArguments[0].equals("url")) - { - System.out.println("URL not supported..."); -// for(int lIndex = 1; lIndex < inArguments.length; ++lIndex) -// { -// processDataHandler(new URL(inArguments[lIndex])); -// } - } - } - else - { - System.out.println("usage: DataHandlerTest <sourcetype> <sources>"); - } -} - -private static void processDataHandler(DataHandler inDataHandler) throws IOException -{ - System.out.println("Name: " + inDataHandler.getName()); - System.out.println("Type: " + inDataHandler.getContentType()); - - Object lBean; - Class lBeanClass; - String lType = inDataHandler.getContentType(); - - // grab the preferred commands and enumerate them - System.out.println("Preferred commands:"); - CommandInfo[] lPreferredCmds = inDataHandler.getPreferredCommands(); - for(int lCmdIndex = 0; lCmdIndex < lPreferredCmds.length; ++lCmdIndex) - { - lBean = inDataHandler.getBean(lPreferredCmds[lCmdIndex]); - if (lBean != null) - { - lBeanClass = lBean.getClass(); - System.out.println(" " + lBeanClass.getName()); - } - else - { - System.out.print("No Bean for command " + lPreferredCmds[lCmdIndex].getCommandName()); - } - } - - // grab all commands and enumerate them - System.out.println("All commands:"); - CommandInfo[] lAllCmds = inDataHandler.getAllCommands(); - for(int lCmdIndex = 0; lCmdIndex < lAllCmds.length; ++lCmdIndex) - { - lBean = inDataHandler.getBean(lAllCmds[lCmdIndex]); - if (lBean != null) - { - lBeanClass = lBean.getClass(); - System.out.println(" " + lBeanClass.getName()); - } - else - { - System.out.print("No Bean for command " + lAllCmds[lCmdIndex].getCommandName()); - } - } - - // grab the commands for the default three verbs view, edit & print - System.out.println("View:"); - CommandInfo lCmd = inDataHandler.getCommand("view"); - if(lCmd != null) - { - lBean = inDataHandler.getBean(lCmd); - if (lBean != null) - { - lBeanClass = lBean.getClass(); - System.out.println(" " + lBeanClass.getName()); - } - else - { - System.out.print("No Bean for command " + lCmd.getCommandName()); - } - } - else - { - System.out.println(" None"); - } - - System.out.println("Edit:"); - lCmd = inDataHandler.getCommand("edit"); - if(lCmd != null) - { - lBean = inDataHandler.getBean(lCmd); - if (lBean != null) - { - lBeanClass = lBean.getClass(); - System.out.println(" " + lBeanClass.getName()); - } - else - { - System.out.print("No Bean for command " + lCmd.getCommandName()); - } - } - else - { - System.out.println(" None"); - } - - System.out.println("Print:"); - lCmd = inDataHandler.getCommand("print"); - if(lCmd != null) - { - lBean = inDataHandler.getBean(lCmd); - if (lBean != null) - { - lBeanClass = lBean.getClass(); - System.out.println(" " + lBeanClass.getName()); - } - else - { - System.out.print("No Bean for command " + lCmd.getCommandName()); - } - } - else - { - System.out.println(" None"); - } - - // read some data - - InputStream lInputStream = null; - try { - lInputStream= inDataHandler.getInputStream(); - } catch (Exception e) { - System.out.println("ERROR: Caught an exception: " + e); - } - System.out.print("Byte 0: "); - System.out.println(lInputStream.read()); - System.out.print("Byte 1: "); - System.out.println(lInputStream.read()); - System.out.print("Byte 2: "); - System.out.println(lInputStream.read()); - System.out.print("Byte 3: "); - System.out.println(lInputStream.read()); - - System.out.println(""); -} - -}
diff --git a/src/share/classes/test/DataSourceTest.java b/src/share/classes/test/DataSourceTest.java deleted file mode 100644 index ae56cab..0000000 --- a/src/share/classes/test/DataSourceTest.java +++ /dev/null
@@ -1,92 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - */ - -package test; - -import java.beans.*; -import java.io.*; -import java.net.*; -import javax.activation.*; - -public class DataSourceTest -{ - - public static void main(String[] inArguments) throws Exception, MalformedURLException, IOException { - if(inArguments.length >= 2) { - if(inArguments[0].equals("file")){ - for(int lIndex = 1; lIndex < inArguments.length; ++lIndex) { - processSource(new FileDataSource(new File(inArguments[lIndex]))); - } - } - else if(inArguments[0].equals("url")) - { - System.out.println("URL is not supported..."); - // for(int lIndex = 1; lIndex < inArguments.length; ++lIndex) -// { -// processSource((new URL(inArguments[lIndex])).openConnection()); -// } - } - } - else - { - System.out.println("usage: DataSourceTest <test> <sources>"); - } -} - -private static void processSource(DataSource inSource) throws Exception, IOException -{ - System.out.println("Name: " + inSource.getName()); - System.out.println("Type: " + inSource.getContentType()); - - // read some data - InputStream lInputStream = inSource.getInputStream(); - System.out.print("Byte 0: "); - System.out.println(lInputStream.read()); - System.out.print("Byte 1: "); - System.out.println(lInputStream.read()); - System.out.print("Byte 2: "); - System.out.println(lInputStream.read()); - System.out.print("Byte 3: "); - System.out.println(lInputStream.read()); - - System.out.println(""); -} - -}
diff --git a/src/share/classes/test/SerMaker.java b/src/share/classes/test/SerMaker.java deleted file mode 100644 index a6564ed..0000000 --- a/src/share/classes/test/SerMaker.java +++ /dev/null
@@ -1,75 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - */ - -package test; - -import java.beans.*; -import java.io.*; -import java.net.*; - -class SerMaker -{ - -public static void main(String[] inArgs) throws IOException, MalformedURLException -{ - if(inArgs.length == 1) - { - // first set up the output stream - File lFile = new File(inArgs[0]); - FileOutputStream lFileStream = new FileOutputStream(lFile); - ObjectOutputStream lObjectStream = new ObjectOutputStream(lFileStream); - - // now create a URL - URL lURL = new URL("http://java.sun.com/"); - - // serialize it - lObjectStream.writeObject(lURL); - - // clean up the stream - lObjectStream.flush(); - lObjectStream.close(); - } - else - { - System.out.println("usage: SerMaker <name of output file>"); - } -} - -}
diff --git a/src/share/classes/test/SerMaker11.java b/src/share/classes/test/SerMaker11.java deleted file mode 100644 index 32b9ca6..0000000 --- a/src/share/classes/test/SerMaker11.java +++ /dev/null
@@ -1,75 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - */ - -package test; - -import java.beans.*; -import java.io.*; -import java.net.*; - -class SerMaker11 -{ - -public static void main(String[] inArgs) throws IOException, MalformedURLException -{ - if(inArgs.length == 1) - { - // first set up the output stream - File lFile = new File(inArgs[0]); - FileOutputStream lFileStream = new FileOutputStream(lFile); - ObjectOutputStream lObjectStream = new ObjectOutputStream(lFileStream); - - // now create a URL - URL lURL = new URL("http://java.sun.com/"); - - // serialize it - lObjectStream.writeObject(lURL); - - // clean up the stream - lObjectStream.flush(); - lObjectStream.close(); - } - else - { - System.out.println("usage: SerMaker <name of output file>"); - } -} - -}
diff --git a/src/share/classes/test/SerReader.java b/src/share/classes/test/SerReader.java deleted file mode 100644 index 1ef2500..0000000 --- a/src/share/classes/test/SerReader.java +++ /dev/null
@@ -1,78 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - */ - -package test; - -import java.beans.*; -import java.io.*; -import java.net.*; - -class SerReader -{ - -public static void main(String[] inArgs) throws FileNotFoundException, StreamCorruptedException, IOException, ClassNotFoundException, OptionalDataException -{ - if(inArgs.length == 1) - { - // first set up the input stream - File lFile = new File(inArgs[0]); - FileInputStream lFileStream = new FileInputStream(lFile); - ObjectInputStream lObjectStream = new ObjectInputStream(lFileStream); - - // now read a URL - URL lURL = (URL)lObjectStream.readObject(); - - // verify it is the correct url - if(lURL.toString().equals("http://java.sun.com/")) - { - System.out.println("Test succeeded"); - } - else - { - System.out.println("Test failed"); - } - } - else - { - System.out.println("usage: SerReader <name of input file>"); - } -} - -}
diff --git a/src/share/classes/test/SerReader11.java b/src/share/classes/test/SerReader11.java deleted file mode 100644 index 4fb9664..0000000 --- a/src/share/classes/test/SerReader11.java +++ /dev/null
@@ -1,78 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - */ - -package test; - -import java.beans.*; -import java.io.*; -import java.net.*; - -class SerReader11 -{ - -public static void main(String[] inArgs) throws FileNotFoundException, StreamCorruptedException, IOException, ClassNotFoundException, OptionalDataException -{ - if(inArgs.length == 1) - { - // first set up the input stream - File lFile = new File(inArgs[0]); - FileInputStream lFileStream = new FileInputStream(lFile); - ObjectInputStream lObjectStream = new ObjectInputStream(lFileStream); - - // now read a URL - URL lURL = (URL)lObjectStream.readObject(); - - // verify it is the correct url - if(lURL.toString().equals("http://java.sun.com/")) - { - System.out.println("Test succeeded"); - } - else - { - System.out.println("Test failed"); - } - } - else - { - System.out.println("usage: SerReader <name of input file>"); - } -} - -}
diff --git a/src/share/classes/test/UrlCheck.java b/src/share/classes/test/UrlCheck.java deleted file mode 100644 index e7ce6b2..0000000 --- a/src/share/classes/test/UrlCheck.java +++ /dev/null
@@ -1,170 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - */ - -/** - * This is an application built to check the URL additions to the JAF - */ -package test; - -import java.awt.*; -import java.awt.event.*; -import java.net.*; -import java.beans.*; -import java.io.IOException; -import javax.activation.*; - -public class UrlCheck extends Frame implements WindowListener { - private URL url; - private Object command = null; - - //////////////////////////////////////////////////////////// - //-- ctor - public UrlCheck(URL url) { - super("UrlCheck"); - this.url = url; - - initMe(); - - if(checkURLData()) { // if we can get a DS - System.out.println("\n\n...Looking for a bean to display the content"); - - CommandInfo ci[] = url.getPreferredCommands(url.getContentType()); - if(ci != null && (ci.length > 0)) { - System.out.println("\tfound a bean"); - // i'm going to make an assumption about the semantics - // of the default cmd map for now, --bhc - // I'm also assuming all beans implement cmdobject - System.out.print("\tadding bean to frame..."); - command =((DataHandler) url).getBean(ci[0]); - if(command instanceof Component) { - this.add((Component)command); - System.out.println("done."); - this.setSize(((Container)command).getPreferredSize()); - this.doLayout(); - } - else { - System.out.println("*failed* not a Component!"); - } - show(); - - } - else { - System.out.println("\tcouldn't find a bean"); - } - } - - } - //////////////////////////////////////////////////////////// - // init me - private void initMe() { - setSize(400,400); - setLayout(new BorderLayout()); - this.addWindowListener(this); - } - //////////////////////////////////////////////////////////// - // get url data - // Print all the DH stuff we know about the URL - private boolean checkURLData() - { - DataSource ds = null; - - // Printout the content type - System.out.println( "URL = " + url.toString() ); - System.out.println( "\tContent Type: " + url.getContentType()); - System.out.println( "\tName: " + url.getName()); - System.out.print("\n...getting the DataSource..."); - - try { - ds = url.getDataSource(); - } catch (IOException e) { - System.out.println("IOException caught in checkURL Data"); - System.exit(1); - } - - if(ds == null) { - System.out.println("<failed>\n"); - return false; - } - else { - System.out.println("done.\n"); - - System.out.println("\tDataSource.getName(): " + - ds.getName()); - System.out.println("\tDataSource.getContentType(): " + - ds.getContentType()); - return true; - } - - } - //////////////////////////////////////////////////////////// - // mainline - public static void main(String args[]) { - URL new_url = null; - UrlCheck appFrame = null; - - if(args.length == 0) { - System.out.println("usage: UrlCheck <url>"); - System.exit(1); - } - - try { - new_url = new URL(args[0]); - } catch (MalformedURLException e) { - System.out.println("ERROR: The syntax of the URL was incorrect!"); - System.out.println("Check it and try again!"); - System.exit(1); - } - - appFrame = new UrlCheck( new_url ); - - } - - /////////////****WindowListener****////////////////// - public void windowOpened(WindowEvent e) {} - public void windowClosing(WindowEvent e) { - System.exit(0); - } - public void windowClosed(WindowEvent e) { } - public void windowIconified(WindowEvent e) {} - public void windowDeiconified(WindowEvent e) {} - public void windowActivated(WindowEvent e) {} - public void windowDeactivated(WindowEvent e) {} -} -