Skip to content

Commit

Permalink
module descriptors for easy to do impl modules
Browse files Browse the repository at this point in the history
Signed-off-by: Lukas Jungmann <lukas.jungmann@oracle.com>
  • Loading branch information
lukasj committed Mar 30, 2022
1 parent fa35240 commit eb8a358
Show file tree
Hide file tree
Showing 10 changed files with 100 additions and 43 deletions.
1 change: 1 addition & 0 deletions wsit/metro-cm/metro-cm-api/src/main/java/module-info.java
Expand Up @@ -12,5 +12,6 @@

requires transitive com.sun.xml.ws.rt;

exports com.sun.xml.ws.config.management;
exports com.sun.xml.ws.metro.api.config.management;
}
16 changes: 16 additions & 0 deletions wsit/metro-cm/metro-cm-impl/src/main/java/module-info.java
@@ -0,0 +1,16 @@
/*
* Copyright (c) 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Distribution License v. 1.0, which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: BSD-3-Clause
*/

module org.glassfish.metro.cm.impl {
requires org.glassfish.metro.cm.api;

provides com.sun.xml.ws.api.config.management.ManagedEndpointFactory with
com.sun.xml.ws.config.management.server.EndpointFactoryImpl;
}
Expand Up @@ -126,7 +126,7 @@ public Metadata retrieveMetadata(@NotNull final String address) {
public Metadata retrieveMetadata(
@NotNull final MetadataReference reference) {

final List nodes = reference.getAny();
final List<Object> nodes = reference.getAny();
for (Object o : nodes) {
final Node node = (Node) o;
if (node.getLocalName().equals("Address")) {
Expand Down
Expand Up @@ -69,7 +69,8 @@ public Message invoke(Message requestMsg) {
throw new WebServiceException("Malformed MEX Request");
}

WSEndpoint wsEndpoint = (WSEndpoint) wsContext.getMessageContext().get(JAXWSProperties.WSENDPOINT);
@SuppressWarnings({"unchecked"})
WSEndpoint<?> wsEndpoint = (WSEndpoint<?>) wsContext.getMessageContext().get(JAXWSProperties.WSENDPOINT);
SOAPVersion soapVersion = wsEndpoint.getBinding().getSOAPVersion();

// try w3c version of ws-a first, then member submission version
Expand Down
Expand Up @@ -55,7 +55,7 @@ public class MetadataServerPipe extends AbstractFilterTubeImpl {
private static final Logger logger =
Logger.getLogger(MetadataServerPipe.class.getName());

public MetadataServerPipe(WSEndpoint endpoint, Pipe next) {
public MetadataServerPipe(WSEndpoint<?> endpoint, Pipe next) {
super(PipeAdapter.adapt(next));
wsdlRetriever = new WSDLRetriever(endpoint);
soapVersion = endpoint.getBinding().getSOAPVersion();
Expand Down
18 changes: 18 additions & 0 deletions wsit/ws-mex/src/main/java/module-info.java
@@ -0,0 +1,18 @@
/*
* Copyright (c) 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Distribution License v. 1.0, which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: BSD-3-Clause
*/

module org.glassfish.metro.ws.mex {

requires com.sun.xml.ws.rt;
requires com.sun.xml.ws.servlet;

provides com.sun.xml.ws.api.wsdl.parser.MetadataResolverFactory with
com.sun.xml.ws.mex.client.MetadataResolverFactoryImpl;
}
5 changes: 5 additions & 0 deletions wsit/xmlfilter/pom.xml
Expand Up @@ -39,6 +39,11 @@
</exclusions>
</dependency>

<dependency>
<groupId>org.glassfish.gmbal</groupId>
<artifactId>gmbal</artifactId>
</dependency>

<dependency>
<groupId>com.sun.istack</groupId>
<artifactId>istack-commons-runtime</artifactId>
Expand Down
Expand Up @@ -94,7 +94,7 @@ public Object invoke(final Object proxy, final Method method, final Object[] arg

Object result = null;
try {
final Class declaringClass = method.getDeclaringClass();
final Class<?> declaringClass = method.getDeclaringClass();
if (declaringClass == Object.class) {
return handleObjectMethodCall(proxy, method, args);
} else {
Expand Down
17 changes: 17 additions & 0 deletions wsit/xmlfilter/src/main/java/module-info.java
@@ -0,0 +1,17 @@
/*
* Copyright (c) 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Distribution License v. 1.0, which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: BSD-3-Clause
*/

module org.glassfish.metro.xmlfilter {

requires transitive java.xml;
requires com.sun.xml.ws.rt;

exports com.sun.xml.ws.xmlfilter;
}
Expand Up @@ -20,39 +20,34 @@
import javax.xml.stream.XMLStreamWriter;
import java.lang.reflect.Method;
import junit.framework.TestCase;
import org.junit.Assert;
import org.junit.Test;

/**
*
* @author Marek Potociar (marek.potociar at sun.com)
*/
public class InvocationTest extends TestCase {
public class InvocationTest {

public InvocationTest(String testName) {
super(testName);
}

@Override
protected void setUp() {
}

@Override
protected void tearDown() {
public InvocationTest() {
}

/**
* Test of createInvocation method, of class com.sun.xml.ws.policy.jaxws.xmlstreamwriter.Invocation.
*/
@Test
public void testCreateInvocation() throws Exception {
Method method = XMLStreamWriter.class.getMethod(XmlStreamWriterMethodType.WRITE_START_ELEMENT.getMethodName(), String.class);
Object[] args = new Object[] {"test"};
Invocation result = Invocation.createInvocation(method, args);

assertNotNull(result);
Assert.assertNotNull(result);
}

/**
* Test of getMethodName method, of class com.sun.xml.ws.policy.jaxws.xmlstreamwriter.Invocation.
*/
@Test
public void testGetMethodName() throws Exception {
String methodName;
Method method;
Expand All @@ -63,57 +58,58 @@ public void testGetMethodName() throws Exception {
method = XMLStreamWriter.class.getMethod(methodName, String.class);
args = new Object[] {"test"};
result = Invocation.createInvocation(method, args);
assertEquals(methodName, result.getMethodName());
Assert.assertEquals(methodName, result.getMethodName());
method = XMLStreamWriter.class.getMethod(methodName, String.class, String.class);
args = new Object[] {"test", "test"};
result = Invocation.createInvocation(method, args);
assertEquals(methodName, result.getMethodName());
Assert.assertEquals(methodName, result.getMethodName());
method = XMLStreamWriter.class.getMethod(methodName, String.class, String.class, String.class);
args = new Object[] {"test", "test", "test"};
result = Invocation.createInvocation(method, args);
assertEquals(methodName, result.getMethodName());
Assert.assertEquals(methodName, result.getMethodName());

methodName = XmlStreamWriterMethodType.WRITE_END_ELEMENT.getMethodName();
method = XMLStreamWriter.class.getMethod(methodName);
args = null;
result = Invocation.createInvocation(method, args);
assertEquals(methodName, result.getMethodName());
Assert.assertEquals(methodName, result.getMethodName());

methodName = XmlStreamWriterMethodType.WRITE_ATTRIBUTE.getMethodName();
method = XMLStreamWriter.class.getMethod(methodName, String.class, String.class);
args = new Object[] {"test", "test"};
result = Invocation.createInvocation(method, args);
assertEquals(methodName, result.getMethodName());
Assert.assertEquals(methodName, result.getMethodName());
method = XMLStreamWriter.class.getMethod(methodName, String.class, String.class, String.class);
args = new Object[] {"test", "test", "test"};
result = Invocation.createInvocation(method, args);
assertEquals(methodName, result.getMethodName());
Assert.assertEquals(methodName, result.getMethodName());
method = XMLStreamWriter.class.getMethod(methodName, String.class, String.class, String.class, String.class);
args = new Object[] {"test", "test", "test", "test"};
result = Invocation.createInvocation(method, args);
assertEquals(methodName, result.getMethodName());
Assert.assertEquals(methodName, result.getMethodName());

methodName = XmlStreamWriterMethodType.WRITE_CHARACTERS.getMethodName();
method = XMLStreamWriter.class.getMethod(methodName, String.class);
args = new Object[] {"test"};
result = Invocation.createInvocation(method, args);
assertEquals(methodName, result.getMethodName());
Assert.assertEquals(methodName, result.getMethodName());
method = XMLStreamWriter.class.getMethod(methodName, char[].class, int.class, int.class);
args = new Object[] {new char[] {'t', 'e', 's', 't'}, 0, 4};
result = Invocation.createInvocation(method, args);
assertEquals(methodName, result.getMethodName());
Assert.assertEquals(methodName, result.getMethodName());

methodName = XmlStreamWriterMethodType.FLUSH.getMethodName();
method = XMLStreamWriter.class.getMethod(methodName);
args = null;
result = Invocation.createInvocation(method, args);
assertEquals(methodName, result.getMethodName());
Assert.assertEquals(methodName, result.getMethodName());

}

/**
* Test of getMethodType method, of class com.sun.xml.ws.policy.jaxws.xmlstreamwriter.Invocation.
*/
@Test
public void testGetMethodType() throws Exception {
String methodName;
XmlStreamWriterMethodType methodType;
Expand All @@ -126,60 +122,61 @@ public void testGetMethodType() throws Exception {
method = XMLStreamWriter.class.getMethod(methodName, String.class);
args = new Object[] {"test"};
result = Invocation.createInvocation(method, args);
assertEquals(methodType, result.getMethodType());
Assert.assertEquals(methodType, result.getMethodType());
method = XMLStreamWriter.class.getMethod(methodName, String.class, String.class);
args = new Object[] {"test", "test"};
result = Invocation.createInvocation(method, args);
assertEquals(methodType, result.getMethodType());
Assert.assertEquals(methodType, result.getMethodType());
method = XMLStreamWriter.class.getMethod(methodName, String.class, String.class, String.class);
args = new Object[] {"test", "test", "test"};
result = Invocation.createInvocation(method, args);
assertEquals(methodType, result.getMethodType());
Assert.assertEquals(methodType, result.getMethodType());

methodName = XmlStreamWriterMethodType.WRITE_END_ELEMENT.getMethodName();
methodType = XmlStreamWriterMethodType.WRITE_END_ELEMENT;
method = XMLStreamWriter.class.getMethod(methodName);
args = null;
result = Invocation.createInvocation(method, args);
assertEquals(methodType, result.getMethodType());
Assert.assertEquals(methodType, result.getMethodType());

methodName = XmlStreamWriterMethodType.WRITE_ATTRIBUTE.getMethodName();
methodType = XmlStreamWriterMethodType.WRITE_ATTRIBUTE;
method = XMLStreamWriter.class.getMethod(methodName, String.class, String.class);
args = new Object[] {"test", "test"};
result = Invocation.createInvocation(method, args);
assertEquals(methodType, result.getMethodType());
Assert.assertEquals(methodType, result.getMethodType());
method = XMLStreamWriter.class.getMethod(methodName, String.class, String.class, String.class);
args = new Object[] {"test", "test", "test"};
result = Invocation.createInvocation(method, args);
assertEquals(methodType, result.getMethodType());
Assert.assertEquals(methodType, result.getMethodType());
method = XMLStreamWriter.class.getMethod(methodName, String.class, String.class, String.class, String.class);
args = new Object[] {"test", "test", "test", "test"};
result = Invocation.createInvocation(method, args);
assertEquals(methodType, result.getMethodType());
Assert.assertEquals(methodType, result.getMethodType());

methodName = XmlStreamWriterMethodType.WRITE_CHARACTERS.getMethodName();
methodType = XmlStreamWriterMethodType.WRITE_CHARACTERS;
method = XMLStreamWriter.class.getMethod(methodName, String.class);
args = new Object[] {"test"};
result = Invocation.createInvocation(method, args);
assertEquals(methodType, result.getMethodType());
Assert.assertEquals(methodType, result.getMethodType());
method = XMLStreamWriter.class.getMethod(methodName, char[].class, int.class, int.class);
args = new Object[] {new char[] {'t', 'e', 's', 't'}, 0, 4};
result = Invocation.createInvocation(method, args);
assertEquals(methodType, result.getMethodType());
Assert.assertEquals(methodType, result.getMethodType());

methodName = "flush";
methodType = XmlStreamWriterMethodType.FLUSH;
method = XMLStreamWriter.class.getMethod(methodName);
args = null;
result = Invocation.createInvocation(method, args);
assertEquals(methodType, result.getMethodType());
Assert.assertEquals(methodType, result.getMethodType());
}

/**
* Test of getArgument method, of class com.sun.xml.ws.policy.jaxws.xmlstreamwriter.Invocation.
*/
@Test
public void testGetArgument() throws Exception {
String methodName;
Method method;
Expand All @@ -191,7 +188,7 @@ public void testGetArgument() throws Exception {
args = new Object[] {"aaa", "bbb", "ccc"};
result = Invocation.createInvocation(method, args);
for (int i = 0; i < args.length; i++) {
assertEquals(args[i], result.getArgument(i));
Assert.assertEquals(args[i], result.getArgument(i));
}

methodName = "flush";
Expand All @@ -200,7 +197,7 @@ public void testGetArgument() throws Exception {
result = Invocation.createInvocation(method, args);
try {
result.getArgument(1);
fail("ArrayIndexOutOfBoundsException expected.");
Assert.fail("ArrayIndexOutOfBoundsException expected.");
} catch (ArrayIndexOutOfBoundsException e) {
// ok
}
Expand All @@ -209,6 +206,7 @@ public void testGetArgument() throws Exception {
/**
* Test of getArgumentsLength method, of class com.sun.xml.ws.policy.jaxws.xmlstreamwriter.Invocation.
*/
@Test
public void testGetArgumentsLength() throws Exception {
String methodName;
Method method;
Expand All @@ -219,18 +217,19 @@ public void testGetArgumentsLength() throws Exception {
method = XMLStreamWriter.class.getMethod(methodName, String.class, String.class, String.class);
args = new Object[] {"aaa", "bbb", "ccc"};
result = Invocation.createInvocation(method, args);
assertEquals(args.length, result.getArgumentsCount());
Assert.assertEquals(args.length, result.getArgumentsCount());

methodName = "flush";
method = XMLStreamWriter.class.getMethod(methodName);
args = null;
result = Invocation.createInvocation(method, args);
assertEquals(0, result.getArgumentsCount());
Assert.assertEquals(0, result.getArgumentsCount());
}

/**
* Tests proper behaviour of defence copying of arguments of writeCharacters() method
*/
@Test
public void testDefenceCopyInWriteCharactersMethod() throws Exception {
String methodName = XmlStreamWriterMethodType.WRITE_CHARACTERS.getMethodName();
Method method = XMLStreamWriter.class.getMethod(methodName, char[].class, int.class, int.class);
Expand All @@ -252,11 +251,11 @@ public void testDefenceCopyInWriteCharactersMethod() throws Exception {
// modifying the original char array to test defence copy
originalChars[2] = 'w';

assertEquals(expectedStart, result.getArgument(1));
assertEquals(expectedLength, result.getArgument(2));
Assert.assertEquals(expectedStart, result.getArgument(1));
Assert.assertEquals(expectedLength, result.getArgument(2));
char[] resultChars = (char[]) result.getArgument(0);
for (int i = expectedStart; i < expectedLength; i++) {
assertEquals(expectedChars[i], resultChars[i]);
Assert.assertEquals(expectedChars[i], resultChars[i]);
}

}
Expand Down

0 comments on commit eb8a358

Please sign in to comment.