/* * JBoss, Home of Professional Open Source. * Copyright 2008, Red Hat Middleware LLC, and individual contributors * as indicated by the @author tags. See the copyright.txt file in the * distribution for a full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.ws.jaxws.jbws2325; import java.io.File; import java.net.MalformedURLException; import java.net.URL; import javax.xml.namespace.QName; import org.jboss.test.ws.tools.sei.StandardJavaTypes; import org.jboss.ws.core.jaxws.handler.MessageContextJAXWS; import org.jboss.ws.core.soap.Style; import org.jboss.ws.metadata.umdm.EndpointMetaData; import org.jboss.ws.metadata.umdm.OperationMetaData; import org.jboss.ws.metadata.umdm.ServiceMetaData; import org.jboss.ws.metadata.umdm.UnifiedMetaData; import org.jboss.ws.metadata.wsdl.WSDLUtils; import org.jboss.ws.tools.metadata.ToolsUnifiedMetaDataBuilder; import org.jboss.wsf.test.JBossWSTest; /** * [JBWS-2325] Each request results to an open file descriptor * * @author jcosta@redhat.com * @since 2008-03-24 * @see https://jira.jboss.org/jira/browse/JBWS-2325 */ public class JBWS2325TestCase extends JBossWSTest { private static final int FILES_TO_OPEN = 10000; public void testCall() throws Exception { File file = new File("/opt/projects/tags/jbossws-native-2.0.1.SP2_CP05/src/test/resources/tools/jbws2325/StandardJavaTypesServiceJBWS2325.wsdl"); URL url = null; try { url = file.toURI().toURL(); } catch (MalformedURLException e) { fail(e.getMessage()); } assertTrue("Resource file StandardJavaTypesServiceJBWS2325.wsdl should exist!", file.exists()); Class seiClass = StandardJavaTypes.class; String sname = WSDLUtils.getJustClassName(seiClass) + "Service"; String targetNamespace = "http://org.jboss.ws"; Style style = Style.DOCUMENT; UnifiedMetaData umd = new ToolsUnifiedMetaDataBuilder(seiClass, targetNamespace, null, sname, style, null, null).getUnifiedMetaData(); ServiceMetaData serviceMetaData = umd.getServices().get(0); serviceMetaData.setWsdlLocation(url); EndpointMetaData epMetaData = serviceMetaData.getEndpoints().get(0); OperationMetaData omd = new OperationMetaData(epMetaData, new QName("jbws2325"), "jbws2325"); MessageContextJAXWS mc = new MessageContextJAXWS() { // just implementing the abstract class }; int i = 0; while (i < FILES_TO_OPEN) { mc.setOperationMetaData(omd); i++; } assertTrue(i == FILES_TO_OPEN); } }