< prev index next >

test/javax/xml/jaxp/functional/test/auctionportal/AuctionController.java

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. --- 1,7 ---- /* ! * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation.
*** 20,41 **** * or visit www.oracle.com if you need additional information or have any * questions. */ package test.auctionportal; ! import static test.auctionportal.HiBidConstants.JAXP_SCHEMA_LANGUAGE; ! import static test.auctionportal.HiBidConstants.JAXP_SCHEMA_SOURCE; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertFalse; import static org.testng.Assert.assertTrue; import java.io.File; import java.io.FileInputStream; import java.io.InputStream; import java.math.BigInteger; import java.nio.file.Paths; import java.util.GregorianCalendar; ! import static javax.xml.XMLConstants.W3C_XML_SCHEMA_NS_URI; import javax.xml.datatype.DatatypeConstants; import javax.xml.datatype.DatatypeFactory; import javax.xml.datatype.Duration; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; --- 20,46 ---- * or visit www.oracle.com if you need additional information or have any * questions. */ package test.auctionportal; ! import static javax.xml.XMLConstants.W3C_XML_SCHEMA_NS_URI; ! import static jaxp.library.JAXPTestUtilities.bomStream; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertFalse; import static org.testng.Assert.assertTrue; + import static test.auctionportal.HiBidConstants.JAXP_SCHEMA_LANGUAGE; + import static test.auctionportal.HiBidConstants.JAXP_SCHEMA_SOURCE; + import static test.auctionportal.HiBidConstants.PORTAL_ACCOUNT_NS; + import static test.auctionportal.HiBidConstants.XML_DIR; + import java.io.File; import java.io.FileInputStream; import java.io.InputStream; import java.math.BigInteger; import java.nio.file.Paths; import java.util.GregorianCalendar; ! import javax.xml.datatype.DatatypeConstants; import javax.xml.datatype.DatatypeFactory; import javax.xml.datatype.Duration; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory;
*** 44,79 **** import javax.xml.transform.dom.DOMResult; import javax.xml.transform.dom.DOMSource; import javax.xml.validation.Schema; import javax.xml.validation.SchemaFactory; import javax.xml.validation.Validator; ! import jaxp.library.JAXPFileReadOnlyBaseTest; ! import static jaxp.library.JAXPTestUtilities.bomStream; import org.testng.annotations.Test; import org.w3c.dom.Attr; import org.w3c.dom.DOMConfiguration; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.NodeList; import org.w3c.dom.TypeInfo; import org.w3c.dom.bootstrap.DOMImplementationRegistry; import org.w3c.dom.ls.DOMImplementationLS; import org.w3c.dom.ls.LSSerializer; - import static test.auctionportal.HiBidConstants.PORTAL_ACCOUNT_NS; - import static test.auctionportal.HiBidConstants.XML_DIR; /** * This is the user controller class for the Auction portal HiBid.com. */ ! public class AuctionController extends JAXPFileReadOnlyBaseTest { /** * Check for DOMErrorHandler handling DOMError. Before fix of bug 4890927 * DOMConfiguration.setParameter("well-formed",true) throws an exception. * * @throws Exception If any errors occur. */ ! @Test(groups = {"readLocalFiles"}) public void testCreateNewItem2Sell() throws Exception { String xmlFile = XML_DIR + "novelsInvalid.xml"; Document document = DocumentBuilderFactory.newInstance() .newDocumentBuilder().parse(xmlFile); --- 49,83 ---- import javax.xml.transform.dom.DOMResult; import javax.xml.transform.dom.DOMSource; import javax.xml.validation.Schema; import javax.xml.validation.SchemaFactory; import javax.xml.validation.Validator; ! ! import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.w3c.dom.Attr; import org.w3c.dom.DOMConfiguration; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.NodeList; import org.w3c.dom.TypeInfo; import org.w3c.dom.bootstrap.DOMImplementationRegistry; import org.w3c.dom.ls.DOMImplementationLS; import org.w3c.dom.ls.LSSerializer; /** * This is the user controller class for the Auction portal HiBid.com. */ ! @Listeners({jaxp.library.FilePolicy.class}) ! public class AuctionController { /** * Check for DOMErrorHandler handling DOMError. Before fix of bug 4890927 * DOMConfiguration.setParameter("well-formed",true) throws an exception. * * @throws Exception If any errors occur. */ ! @Test public void testCreateNewItem2Sell() throws Exception { String xmlFile = XML_DIR + "novelsInvalid.xml"; Document document = DocumentBuilderFactory.newInstance() .newDocumentBuilder().parse(xmlFile);
*** 92,102 **** * Check for DOMErrorHandler handling DOMError. Before fix of bug 4896132 * test throws DOM Level 1 node error. * * @throws Exception If any errors occur. */ ! @Test(groups = {"readLocalFiles"}) public void testCreateNewItem2SellRetry() throws Exception { String xmlFile = XML_DIR + "accountInfo.xml"; DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); dbf.setNamespaceAware(true); --- 96,106 ---- * Check for DOMErrorHandler handling DOMError. Before fix of bug 4896132 * test throws DOM Level 1 node error. * * @throws Exception If any errors occur. */ ! @Test public void testCreateNewItem2SellRetry() throws Exception { String xmlFile = XML_DIR + "accountInfo.xml"; DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); dbf.setNamespaceAware(true);
*** 124,134 **** * Check if setting the attribute to be of type ID works. This will affect * the Attr.isID method according to the spec. * * @throws Exception If any errors occur. */ ! @Test(groups = {"readLocalFiles"}) public void testCreateID() throws Exception { String xmlFile = XML_DIR + "accountInfo.xml"; DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); dbf.setNamespaceAware(true); --- 128,138 ---- * Check if setting the attribute to be of type ID works. This will affect * the Attr.isID method according to the spec. * * @throws Exception If any errors occur. */ ! @Test public void testCreateID() throws Exception { String xmlFile = XML_DIR + "accountInfo.xml"; DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); dbf.setNamespaceAware(true);
*** 145,155 **** /** * Check the user data on the node. * * @throws Exception If any errors occur. */ ! @Test(groups = {"readLocalFiles"}) public void testCheckingUserData() throws Exception { String xmlFile = XML_DIR + "accountInfo.xml"; DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); dbf.setNamespaceAware(true); --- 149,159 ---- /** * Check the user data on the node. * * @throws Exception If any errors occur. */ ! @Test public void testCheckingUserData() throws Exception { String xmlFile = XML_DIR + "accountInfo.xml"; DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); dbf.setNamespaceAware(true);
*** 182,192 **** * Check the UTF-16 XMLEncoding xml file. * * @throws Exception If any errors occur. * @see <a href="content/movies.xml">movies.xml</a> */ ! @Test(groups = {"readLocalFiles"}) public void testCheckingEncoding() throws Exception { // Note since movies.xml is UTF-16 encoding. We're not using stanard XML // file suffix. String xmlFile = XML_DIR + "movies.xml.data"; --- 186,196 ---- * Check the UTF-16 XMLEncoding xml file. * * @throws Exception If any errors occur. * @see <a href="content/movies.xml">movies.xml</a> */ ! @Test public void testCheckingEncoding() throws Exception { // Note since movies.xml is UTF-16 encoding. We're not using stanard XML // file suffix. String xmlFile = XML_DIR + "movies.xml.data";
*** 204,214 **** * used to be testing for the functionalities. * * @throws Exception If any errors occur. * @see <a href="content/userDetails.xsd">userDetails.xsd</a> */ ! @Test(groups = {"readLocalFiles"}) public void testGetOwnerInfo() throws Exception { String schemaFile = XML_DIR + "userDetails.xsd"; String xmlFile = XML_DIR + "userDetails.xml"; try(FileInputStream fis = new FileInputStream(xmlFile)) { --- 208,218 ---- * used to be testing for the functionalities. * * @throws Exception If any errors occur. * @see <a href="content/userDetails.xsd">userDetails.xsd</a> */ ! @Test public void testGetOwnerInfo() throws Exception { String schemaFile = XML_DIR + "userDetails.xsd"; String xmlFile = XML_DIR + "userDetails.xml"; try(FileInputStream fis = new FileInputStream(xmlFile)) {
*** 239,249 **** * * @throws Exception If any errors occur. * @see <a href="content/coins.xsd">coins.xsd</a> * @see <a href="content/coinsImportMe.xsd">coinsImportMe.xsd</a> */ ! @Test(groups = {"readLocalFiles"}) public void testGetOwnerItemList() throws Exception { String xsdFile = XML_DIR + "coins.xsd"; String xmlFile = XML_DIR + "coins.xml"; try(FileInputStream fis = new FileInputStream(xmlFile)) { --- 243,253 ---- * * @throws Exception If any errors occur. * @see <a href="content/coins.xsd">coins.xsd</a> * @see <a href="content/coinsImportMe.xsd">coinsImportMe.xsd</a> */ ! @Test public void testGetOwnerItemList() throws Exception { String xsdFile = XML_DIR + "coins.xsd"; String xmlFile = XML_DIR + "coins.xml"; try(FileInputStream fis = new FileInputStream(xmlFile)) {
*** 275,285 **** * @throws Exception If any errors occur. * @see <a href="content/coins.xsd">coins.xsd</a> * @see <a href="content/coinsImportMe.xsd">coinsImportMe.xsd</a> */ ! @Test(groups = {"readLocalFiles"}) public void testGetOwnerItemList1() throws Exception { String xsdFile = XML_DIR + "coins.xsd"; String xmlFile = XML_DIR + "coins.xml"; SAXParserFactory spf = SAXParserFactory.newInstance(); spf.setNamespaceAware(true); --- 279,289 ---- * @throws Exception If any errors occur. * @see <a href="content/coins.xsd">coins.xsd</a> * @see <a href="content/coinsImportMe.xsd">coinsImportMe.xsd</a> */ ! @Test public void testGetOwnerItemList1() throws Exception { String xsdFile = XML_DIR + "coins.xsd"; String xmlFile = XML_DIR + "coins.xml"; SAXParserFactory spf = SAXParserFactory.newInstance(); spf.setNamespaceAware(true);
*** 297,307 **** /** * Check usage of javax.xml.datatype.Duration class. * * @throws Exception If any errors occur. */ ! @Test(groups = {"readLocalFiles"}) public void testGetItemDuration() throws Exception { String xmlFile = XML_DIR + "itemsDuration.xml"; DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); dbf.setNamespaceAware(true); --- 301,311 ---- /** * Check usage of javax.xml.datatype.Duration class. * * @throws Exception If any errors occur. */ ! @Test public void testGetItemDuration() throws Exception { String xmlFile = XML_DIR + "itemsDuration.xml"; DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); dbf.setNamespaceAware(true);
*** 330,340 **** /** * Check usage of TypeInfo interface introduced in DOM L3. * * @throws Exception If any errors occur. */ ! @Test(groups = {"readLocalFiles"}) public void testGetTypeInfo() throws Exception { String xmlFile = XML_DIR + "accountInfo.xml"; DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); dbf.setNamespaceAware(true); --- 334,344 ---- /** * Check usage of TypeInfo interface introduced in DOM L3. * * @throws Exception If any errors occur. */ ! @Test public void testGetTypeInfo() throws Exception { String xmlFile = XML_DIR + "accountInfo.xml"; DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); dbf.setNamespaceAware(true);
< prev index next >