Author: alessio.soldano(a)jboss.com
Date: 2009-08-04 11:36:57 -0400 (Tue, 04 Aug 2009)
New Revision: 10484
Modified:
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws1190/ConfidentialEndpoint.java
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws1190/Endpoint.java
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws1190/EndpointImpl.java
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws1190/JBWS1190TestCase.java
Log:
[JBWS-2247] Rewriting JBWS-1190 testcase leveraging address property in ManagedEndpoint to
support all stacks
Modified:
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws1190/ConfidentialEndpoint.java
===================================================================
---
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws1190/ConfidentialEndpoint.java 2009-08-04
15:10:18 UTC (rev 10483)
+++
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws1190/ConfidentialEndpoint.java 2009-08-04
15:36:57 UTC (rev 10484)
@@ -1,6 +1,6 @@
/*
* JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * Copyright 2009, 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.
*
@@ -36,11 +36,9 @@
@SOAPBinding(style = SOAPBinding.Style.RPC)
public class ConfidentialEndpoint
{
-
// Intentionally no @WebMethod, see above
public String helloWorld(final String message)
{
return message;
}
-
}
Modified:
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws1190/Endpoint.java
===================================================================
---
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws1190/Endpoint.java 2009-08-04
15:10:18 UTC (rev 10483)
+++
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws1190/Endpoint.java 2009-08-04
15:36:57 UTC (rev 10484)
@@ -1,6 +1,6 @@
/*
* JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * Copyright 2009, 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.
*
@@ -38,6 +38,6 @@
{
@WebMethod
- public void testAddress(final String archive, final String service, final String
scheme, final String port);
+ public void test();
}
Modified:
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws1190/EndpointImpl.java
===================================================================
---
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws1190/EndpointImpl.java 2009-08-04
15:10:18 UTC (rev 10483)
+++
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws1190/EndpointImpl.java 2009-08-04
15:36:57 UTC (rev 10484)
@@ -1,6 +1,6 @@
/*
* JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * Copyright 2009, 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.
*
@@ -21,25 +21,8 @@
*/
package org.jboss.test.ws.jaxws.jbws1190;
-import java.io.File;
-import java.io.FilenameFilter;
-import java.util.List;
-import java.util.Map;
-
import javax.jws.WebService;
-import javax.wsdl.Definition;
-import javax.wsdl.Port;
-import javax.wsdl.Service;
-import javax.wsdl.WSDLException;
-import javax.wsdl.extensions.soap.SOAPAddress;
-import javax.wsdl.factory.WSDLFactory;
-import javax.wsdl.xml.WSDLReader;
-import org.jboss.wsf.spi.management.ServerConfig;
-import org.jboss.wsf.spi.management.ServerConfigFactory;
-import org.jboss.wsf.spi.SPIProvider;
-import org.jboss.wsf.spi.SPIProviderResolver;
-
/**
* [JBWS-1190] - WSDL generated for JSR-181 POJO does not take
'transport-guarantee' in web.xml into account
*
@@ -51,84 +34,8 @@
@WebService(serviceName = "EndpointService", targetNamespace =
"http://org.jboss/test/ws/jbws1190", endpointInterface =
"org.jboss.test.ws.jaxws.jbws1190.Endpoint")
public class EndpointImpl implements Endpoint
{
-
- public void testAddress(final String archive, final String service, final String
scheme, final String port)
+ public void test()
{
- SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider();
- ServerConfig serverConfig =
spiProvider.getSPI(ServerConfigFactory.class).getServerConfig();File tmpDir =
serverConfig.getServerTempDir();
-
- File dataDir = serverConfig.getServerDataDir();
- File wsdlDir = new File(dataDir.getAbsolutePath() + File.separator +
"wsdl" + File.separator + archive);
-
- if (wsdlDir.exists() == false)
- {
- throw new JBWS1190Exception(wsdlDir.getAbsolutePath() + " does not
exist.");
- }
-
- File[] wsdls = wsdlDir.listFiles(new FilenameFilter() {
- public boolean accept(File dir, String name)
- {
- return name.startsWith(service);
- }
- });
-
- File wsdlFile = null;
- for (int i = 0; i < wsdls.length; i++)
- {
- if (wsdlFile == null || wsdls[i].compareTo(wsdlFile) > 0)
- {
- wsdlFile = wsdls[i];
- }
- }
- assertTrue("No WSDL files found", wsdlFile != null);
-
- Definition wsdl;
- try
- {
- WSDLReader wsdlReader = WSDLFactory.newInstance().newWSDLReader();
- wsdl = wsdlReader.readWSDL(wsdlFile.getAbsolutePath());
- }
- catch (WSDLException e)
- {
- throw new JBWS1190Exception("Error readin WSDL", e);
- }
-
- Map services = wsdl.getServices();
- assertEquals("No of services", 1, services.size());
-
- Service _service = (Service)services.values().iterator().next();
- Map ports = _service.getPorts();
- assertEquals("No of endpoints", 1, ports.size());
- Port _port = (Port)ports.values().iterator().next();
-
- List extElements = _port.getExtensibilityElements();
- String address = null;
- for (int i = 0; i < extElements.size(); i++)
- {
- if (extElements.get(i) instanceof SOAPAddress)
- {
- SOAPAddress soapAddrExtElement = (SOAPAddress)extElements.get(i);
- address = soapAddrExtElement.getLocationURI();
- }
- }
- assertTrue("Address is null", address != null);
- assertTrue("Expected Scheme '" + scheme + "' from address
'" + address + "'", address.startsWith(scheme + "://"));
- assertTrue("Expected Port '" + port + "' from address
'" + address + "'", address.indexOf(":" + port +
"/") > -1);
+ System.out.println("test");
}
-
- private void assertEquals(final String message, final int expected, final int actual)
- {
- if (expected != actual)
- {
- throw new JBWS1190Exception(message + " expected=" + expected + "
actual=" + actual);
- }
- }
-
- private void assertTrue(final String message, final boolean value)
- {
- if (value == false)
- {
- throw new JBWS1190Exception(message);
- }
- }
}
Modified:
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws1190/JBWS1190TestCase.java
===================================================================
---
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws1190/JBWS1190TestCase.java 2009-08-04
15:10:18 UTC (rev 10483)
+++
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws1190/JBWS1190TestCase.java 2009-08-04
15:36:57 UTC (rev 10484)
@@ -1,6 +1,6 @@
/*
* JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * Copyright 2009, 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.
*
@@ -23,6 +23,8 @@
import java.net.URL;
+import javax.management.MBeanServerConnection;
+import javax.management.ObjectName;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
@@ -37,38 +39,30 @@
*
http://jira.jboss.org/jira/browse/JBWS-1190
*
* @author darran.lofthouse(a)jboss.com
+ * @author alessio.soldano(a)jboss.com
* @since 19-October-2006
*/
public class JBWS1190TestCase extends JBossWSTest
{
- private static final String ARCHIVE_NAME = "jaxws-jbws1190.war";
-
- private static Endpoint port;
-
public static Test suite()
{
- return new JBossWSTestSetup(JBWS1190TestCase.class, ARCHIVE_NAME);
+ return new JBossWSTestSetup(JBWS1190TestCase.class,
"jaxws-jbws1190.war");
}
-
- protected void setUp() throws Exception
+
+ public void testEndpointAddress() throws Exception
{
- if (port == null)
- {
- URL wsdlURL = new URL("http://" + getServerHost() +
":8080/jaxws-jbws1190/Endpoint?wsdl");
- QName qname = new QName("http://org.jboss/test/ws/jbws1190",
"EndpointService");
- Service service = Service.create(wsdlURL, qname);
- port = (Endpoint)service.getPort(Endpoint.class);
- }
+ MBeanServerConnection server = getServer();
+ ObjectName oname = new
ObjectName("jboss.ws:context=jaxws-jbws1190,endpoint=Endpoint");
+ String address = (String)server.getAttribute(oname, "Address");
+ assertTrue("Expected http address, but got: " + address,
address.startsWith("http://"));
}
- public void testEndpoint() throws Exception
+ public void testConfidentialEndpointAddress() throws Exception
{
- port.testAddress(ARCHIVE_NAME, "EndpointService", "http",
"8080");
+ MBeanServerConnection server = getServer();
+ ObjectName oname = new
ObjectName("jboss.ws:context=jaxws-jbws1190,endpoint=ConfidentialEndpoint");
+ String address = (String)server.getAttribute(oname, "Address");
+ assertTrue("Expected https address, but got: " + address,
address.startsWith("https://"));
}
-
- public void testConfidentialEndpoint() throws Exception
- {
- port.testAddress(ARCHIVE_NAME, "ConfidentialService", "https",
"8443");
- }
}