Author: alessio.soldano(a)jboss.com
Date: 2008-08-07 11:28:20 -0400 (Thu, 07 Aug 2008)
New Revision: 8028
Added:
framework/trunk/testsuite/test/java/org/jboss/test/ws/management/
framework/trunk/testsuite/test/java/org/jboss/test/ws/management/recording/
framework/trunk/testsuite/test/java/org/jboss/test/ws/management/recording/CustomRecordProcessorTestCase.java
framework/trunk/testsuite/test/java/org/jboss/test/ws/management/recording/Endpoint.java
framework/trunk/testsuite/test/java/org/jboss/test/ws/management/recording/EndpointImpl.java
framework/trunk/testsuite/test/java/org/jboss/test/ws/management/recording/EndpointWithHandlerImpl.java
framework/trunk/testsuite/test/java/org/jboss/test/ws/management/recording/ExtManagedProcessor.java
framework/trunk/testsuite/test/java/org/jboss/test/ws/management/recording/MemoryBufferRecorderTestCase.java
framework/trunk/testsuite/test/java/org/jboss/test/ws/management/recording/MyManagedProcessor.java
framework/trunk/testsuite/test/java/org/jboss/test/ws/management/recording/MyManagedProcessorMBean.java
framework/trunk/testsuite/test/java/org/jboss/test/ws/management/recording/jaxws-handlers-server.xml
Modified:
framework/trunk/testsuite/test/ant-import/build-jars-jaxws.xml
Log:
[JBWS-2191] Provide junit tests for the record management tools
Modified: framework/trunk/testsuite/test/ant-import/build-jars-jaxws.xml
===================================================================
--- framework/trunk/testsuite/test/ant-import/build-jars-jaxws.xml 2008-08-07 15:27:33 UTC
(rev 8027)
+++ framework/trunk/testsuite/test/ant-import/build-jars-jaxws.xml 2008-08-07 15:28:20 UTC
(rev 8028)
@@ -567,6 +567,23 @@
<include
name="org/jboss/test/ws/jaxws/wrapped/accessor/jaxws/*"/>
</classes>
</war>
+
+ <!-- management-recording.jar -->
+ <jar
destfile="${tests.output.dir}/test-libs/management-recording-native.jar">
+ <fileset dir="${tests.output.dir}/test-classes">
+ <include name="org/jboss/test/ws/management/recording/*.class"/>
+ <exclude
name="org/jboss/test/ws/management/recording/EndpointWithHandlerImpl.class"/>
+ <exclude
name="org/jboss/test/ws/management/recording/*TestCase.class"/>
+ </fileset>
+ </jar>
+ <jar
destfile="${tests.output.dir}/test-libs/management-recording.jar">
+ <fileset dir="${tests.output.dir}/test-classes">
+ <include name="org/jboss/test/ws/management/recording/*.class"/>
+ <include name="org/jboss/test/ws/management/recording/*.xml"/>
+ <exclude
name="org/jboss/test/ws/management/recording/EndpointImpl.class"/>
+ <exclude
name="org/jboss/test/ws/management/recording/*TestCase.class"/>
+ </fileset>
+ </jar>
<!-- Please add alphabetically -->
Added:
framework/trunk/testsuite/test/java/org/jboss/test/ws/management/recording/CustomRecordProcessorTestCase.java
===================================================================
---
framework/trunk/testsuite/test/java/org/jboss/test/ws/management/recording/CustomRecordProcessorTestCase.java
(rev 0)
+++
framework/trunk/testsuite/test/java/org/jboss/test/ws/management/recording/CustomRecordProcessorTestCase.java 2008-08-07
15:28:20 UTC (rev 8028)
@@ -0,0 +1,94 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.management.recording;
+
+import java.net.URL;
+
+import javax.management.MBeanServerConnection;
+import javax.management.ObjectName;
+import javax.xml.namespace.QName;
+import javax.xml.ws.Service;
+
+import org.jboss.wsf.spi.management.recording.RecordProcessor;
+import org.jboss.wsf.test.JBossWSTest;
+import org.jboss.wsf.test.JBossWSTestHelper;
+
+/**
+ * This test case shows how to dynamically add a custom record processor
+ * to a given endpoint.
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 6-Aug-2008
+ */
+public class CustomRecordProcessorTestCase extends JBossWSTest
+{
+ private String endpointURL = "http://" + getServerHost() +
":8080/management-recording/EndpointImpl";
+ private String targetNS = "http://recording.management.ws.test.jboss.org/";
+ private String endpointObjectName;
+
+ protected void setUp() throws Exception
+ {
+ //Native does not require us to set the recording handler on the deployed endpoint
+ boolean isNative = isIntegrationNative();
+ new JBossWSTestHelper().deploy(isNative ?
"management-recording-native.jar" : "management-recording.jar");
+ endpointObjectName = isNative ?
"jboss.ws:context=management-recording,endpoint=EndpointImpl" :
"jboss.ws:context=management-recording,endpoint=EndpointWithHandlerImpl";
+ }
+
+ protected void tearDown() throws Exception
+ {
+ boolean isNative = isIntegrationNative();
+ new JBossWSTestHelper().undeploy(isNative ?
"management-recording-native.jar" : "management-recording.jar");
+ }
+
+ public void testAddCustomProcessor() throws Exception
+ {
+ URL wsdlURL = new URL(endpointURL + "?wsdl");
+ QName serviceName = new QName(targetNS, "EndpointService");
+
+ Service service = Service.create(wsdlURL, serviceName);
+ Endpoint port = (Endpoint)service.getPort(Endpoint.class);
+ addCustomProcessor();
+ Object retObj = port.echo1("Hello");
+ assertEquals("Hello", retObj);
+ checkCustomProcessorJob();
+ }
+
+ private void addCustomProcessor() throws Exception
+ {
+ ObjectName oname = new ObjectName(endpointObjectName);
+ ExtManagedProcessor myProcessor = new ExtManagedProcessor();
+ myProcessor.setName("myExtProcessor");
+ myProcessor.setRecording(true);
+ myProcessor.setAttribute("Attribute value");
+ myProcessor.setExtAttribute("ExtAttribute value");
+ getServer().invoke(oname, "addRecordProcessor", new Object[] {
myProcessor }, new String[] { RecordProcessor.class.getName() });
+ }
+
+ private void checkCustomProcessorJob() throws Exception
+ {
+ MBeanServerConnection server = getServer();
+ ObjectName oname = new ObjectName(endpointObjectName +
",recordProcessor=myExtProcessor");
+ assertEquals(true, server.getAttribute(oname, "Recording"));
+ assertEquals(1, server.getAttribute(oname, "Size"));
+ assertEquals("Attribute value", server.getAttribute(oname,
"Attribute"));
+ }
+}
Property changes on:
framework/trunk/testsuite/test/java/org/jboss/test/ws/management/recording/CustomRecordProcessorTestCase.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
framework/trunk/testsuite/test/java/org/jboss/test/ws/management/recording/Endpoint.java
===================================================================
---
framework/trunk/testsuite/test/java/org/jboss/test/ws/management/recording/Endpoint.java
(rev 0)
+++
framework/trunk/testsuite/test/java/org/jboss/test/ws/management/recording/Endpoint.java 2008-08-07
15:28:20 UTC (rev 8028)
@@ -0,0 +1,33 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.management.recording;
+
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+
+@WebService (name="Endpoint")
+@SOAPBinding(style = SOAPBinding.Style.RPC)
+public interface Endpoint
+{
+ String echo1(String input);
+ String echo2(String input);
+}
Property changes on:
framework/trunk/testsuite/test/java/org/jboss/test/ws/management/recording/Endpoint.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
framework/trunk/testsuite/test/java/org/jboss/test/ws/management/recording/EndpointImpl.java
===================================================================
---
framework/trunk/testsuite/test/java/org/jboss/test/ws/management/recording/EndpointImpl.java
(rev 0)
+++
framework/trunk/testsuite/test/java/org/jboss/test/ws/management/recording/EndpointImpl.java 2008-08-07
15:28:20 UTC (rev 8028)
@@ -0,0 +1,53 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.management.recording;
+
+import javax.ejb.Stateless;
+import javax.jws.WebService;
+
+import org.jboss.logging.Logger;
+import org.jboss.wsf.spi.annotation.WebContext;
+
+/**
+ * author alessio.soldano(a)jboss.org
+ * @since 06-Aug-2008
+ */
+@Stateless
+@WebService(name="Endpoint", serviceName="EndpointService",
endpointInterface = "org.jboss.test.ws.management.recording.Endpoint")
+@WebContext(contextRoot="/management-recording",
urlPattern="/EndpointImpl")
+public class EndpointImpl
+{
+ // Provide logging
+ private static Logger log = Logger.getLogger(EndpointImpl.class);
+
+ public String echo1(String input)
+ {
+ log.info("echo1: " + input);
+ return input;
+ }
+
+ public String echo2(String input)
+ {
+ log.info("echo2: " + input);
+ return input;
+ }
+}
Property changes on:
framework/trunk/testsuite/test/java/org/jboss/test/ws/management/recording/EndpointImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
framework/trunk/testsuite/test/java/org/jboss/test/ws/management/recording/EndpointWithHandlerImpl.java
===================================================================
---
framework/trunk/testsuite/test/java/org/jboss/test/ws/management/recording/EndpointWithHandlerImpl.java
(rev 0)
+++
framework/trunk/testsuite/test/java/org/jboss/test/ws/management/recording/EndpointWithHandlerImpl.java 2008-08-07
15:28:20 UTC (rev 8028)
@@ -0,0 +1,55 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.management.recording;
+
+import javax.ejb.Stateless;
+import javax.jws.HandlerChain;
+import javax.jws.WebService;
+
+import org.jboss.logging.Logger;
+import org.jboss.wsf.spi.annotation.WebContext;
+
+/**
+ * @author alessio.soldano(a)jboss.org
+ * @since 06-Aug-2008
+ */
+@Stateless
+@WebService(name="Endpoint", serviceName="EndpointService",
endpointInterface = "org.jboss.test.ws.management.recording.Endpoint")
+(a)HandlerChain(file="jaxws-handlers-server.xml")
+@WebContext(contextRoot="/management-recording",
urlPattern="/EndpointImpl")
+public class EndpointWithHandlerImpl
+{
+ // Provide logging
+ private static Logger log = Logger.getLogger(EndpointWithHandlerImpl.class);
+
+ public String echo1(String input)
+ {
+ log.info("echo1: " + input);
+ return input;
+ }
+
+ public String echo2(String input)
+ {
+ log.info("echo2: " + input);
+ return input;
+ }
+}
Property changes on:
framework/trunk/testsuite/test/java/org/jboss/test/ws/management/recording/EndpointWithHandlerImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
framework/trunk/testsuite/test/java/org/jboss/test/ws/management/recording/ExtManagedProcessor.java
===================================================================
---
framework/trunk/testsuite/test/java/org/jboss/test/ws/management/recording/ExtManagedProcessor.java
(rev 0)
+++
framework/trunk/testsuite/test/java/org/jboss/test/ws/management/recording/ExtManagedProcessor.java 2008-08-07
15:28:20 UTC (rev 8028)
@@ -0,0 +1,16 @@
+package org.jboss.test.ws.management.recording;
+
+import java.io.Serializable;
+
+public class ExtManagedProcessor extends MyManagedProcessor implements Serializable {
+
+ private String extAttribute;
+
+ public String getExtAttribute() {
+ return extAttribute;
+ }
+
+ public void setExtAttribute(String extAttribute) {
+ this.extAttribute = extAttribute;
+ }
+}
\ No newline at end of file
Property changes on:
framework/trunk/testsuite/test/java/org/jboss/test/ws/management/recording/ExtManagedProcessor.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
framework/trunk/testsuite/test/java/org/jboss/test/ws/management/recording/MemoryBufferRecorderTestCase.java
===================================================================
---
framework/trunk/testsuite/test/java/org/jboss/test/ws/management/recording/MemoryBufferRecorderTestCase.java
(rev 0)
+++
framework/trunk/testsuite/test/java/org/jboss/test/ws/management/recording/MemoryBufferRecorderTestCase.java 2008-08-07
15:28:20 UTC (rev 8028)
@@ -0,0 +1,265 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.management.recording;
+
+import java.net.URL;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import javax.management.Attribute;
+import javax.management.MBeanServerConnection;
+import javax.management.ObjectName;
+import javax.xml.namespace.QName;
+import javax.xml.ws.Service;
+
+import org.jboss.wsf.framework.management.recording.AndFilter;
+import org.jboss.wsf.framework.management.recording.HostFilter;
+import org.jboss.wsf.framework.management.recording.NotFilter;
+import org.jboss.wsf.framework.management.recording.OperationFilter;
+import org.jboss.wsf.spi.management.recording.Record;
+import org.jboss.wsf.spi.management.recording.RecordFilter;
+import org.jboss.wsf.test.JBossWSTest;
+import org.jboss.wsf.test.JBossWSTestHelper;
+
+/**
+ * This tests the MemoryBufferRecorder
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 7-Aug-2008
+ */
+public class MemoryBufferRecorderTestCase extends JBossWSTest
+{
+ private String endpointURL = "http://" + getServerHost() +
":8080/management-recording/EndpointImpl";
+ private String targetNS = "http://recording.management.ws.test.jboss.org/";
+ private String endpointObjectName;
+
+ protected void setUp() throws Exception
+ {
+ //Native does not require us to set the recording handler on the deployed endpoint
+ boolean isNative = isIntegrationNative();
+ new JBossWSTestHelper().deploy(isNative ?
"management-recording-native.jar" : "management-recording.jar");
+ endpointObjectName = isNative ?
"jboss.ws:context=management-recording,endpoint=EndpointImpl" :
"jboss.ws:context=management-recording,endpoint=EndpointWithHandlerImpl";
+ }
+
+ protected void tearDown() throws Exception
+ {
+ boolean isNative = isIntegrationNative();
+ new JBossWSTestHelper().undeploy(isNative ?
"management-recording-native.jar" : "management-recording.jar");
+ }
+
+ public void testRecording() throws Exception
+ {
+ Endpoint port = getPort();
+ MBeanServerConnection server = getServer();
+ ObjectName oname = new ObjectName(endpointObjectName +
",recordProcessor=MemoryBufferRecorder");
+ int startSize = (Integer)server.getAttribute(oname, "Size");
+ setRecording(true);
+ port.echo1("Hello");
+ port.echo1("Hello again");
+ port.echo2("Hi");
+ setRecording(false);
+ port.echo2("Hi again");
+ int endSize = (Integer)server.getAttribute(oname, "Size");
+ assertEquals(3, endSize - startSize);
+ }
+
+ @SuppressWarnings("unchecked")
+ public void testGetRecordsByOperation() throws Exception
+ {
+ if (isIntegrationMetro())
+ {
+ //The WSDL_OPERATION ctx property is required for the operation filter to work
+ System.out.println("FIXME: [JBWS-2204] Implement Metro standard message
context properties");
+ return;
+ }
+ if (isIntegrationCXF())
+ {
+ //The WSDL_OPERATION ctx property is required for the operation filter to work
+ System.out.println("FIXME: [JBWS-2203] Implement CXF standard message
context properties");
+ return;
+ }
+ Endpoint port = getPort();
+ MBeanServerConnection server = getServer();
+ ObjectName oname = new ObjectName(endpointObjectName +
",recordProcessor=MemoryBufferRecorder");
+ setRecording(true);
+
+ port.echo1("Test getRecordsByOperation");
+ port.echo2("Test getRecordsByOperation");
+
+ Map<String, List<Record>> echo1Records = (Map<String,
List<Record>>)server.invoke(oname, "getRecordsByOperation", new
Object[] { targetNS, "echo1" }, new String[] {
+ "java.lang.String", "java.lang.String" });
+ Map<String, List<Record>> echo2Records = (Map<String,
List<Record>>)server.invoke(oname, "getRecordsByOperation", new
Object[] { targetNS, "echo2" }, new String[] {
+ "java.lang.String", "java.lang.String" });
+
+ assertFalse(echo1Records.isEmpty());
+ assertFalse(echo2Records.isEmpty());
+ for (List<Record> list : echo1Records.values())
+ {
+ for (Record record : list)
+ {
+ QName qName = record.getOperation();
+ assertEquals(targetNS, qName.getNamespaceURI());
+ assertEquals("echo1", qName.getLocalPart());
+ assertTrue(record.getEnvelope().contains("echo1"));
+ }
+ }
+ for (List<Record> list : echo2Records.values())
+ {
+ for (Record record : list)
+ {
+ QName qName = record.getOperation();
+ assertEquals(targetNS, qName.getNamespaceURI());
+ assertEquals("echo2", qName.getLocalPart());
+ assertTrue(record.getEnvelope().contains("echo2"));
+ }
+ }
+ }
+
+
+ @SuppressWarnings("unchecked")
+ public void testGetRecordsByClientHost() throws Exception
+ {
+ Endpoint port = getPort();
+ MBeanServerConnection server = getServer();
+ ObjectName oname = new ObjectName(endpointObjectName +
",recordProcessor=MemoryBufferRecorder");
+ setRecording(true);
+
+ port.echo1("Test getRecordsByClientHost");
+
+ //We have client and server on the same host here...
+ String host = "localhost".equals(getServerHost()) ? "127.0.0.1"
: getServerHost();
+ Map<String, List<Record>> localhostRecords = (Map<String,
List<Record>>)server.invoke(oname, "getRecordsByClientHost", new
Object[] { host },
+ new String[] { "java.lang.String" });
+ Map<String, List<Record>> amazonRecords = (Map<String,
List<Record>>)server.invoke(oname, "getRecordsByClientHost", new
Object[] { "72.21.203.1" },
+ new String[] { "java.lang.String" });
+
+ assertTrue(localhostRecords.size() > 0);
+ assertTrue(amazonRecords.size() == 0);
+ }
+
+ @SuppressWarnings("unchecked")
+ public void testGetMatchingRecords() throws Exception
+ {
+ if (isIntegrationMetro())
+ {
+ //The WSDL_OPERATION ctx property is required for the operation filter to work
+ System.out.println("FIXME: [JBWS-2204] Implement Metro standard message
context properties");
+ return;
+ }
+ if (isIntegrationCXF())
+ {
+ //The WSDL_OPERATION ctx property is required for the operation filter to work
+ System.out.println("FIXME: [JBWS-2203] Implement CXF standard message
context properties");
+ return;
+ }
+ Endpoint port = getPort();
+ MBeanServerConnection server = getServer();
+ ObjectName oname = new ObjectName(endpointObjectName +
",recordProcessor=MemoryBufferRecorder");
+ setRecording(true);
+
+ OperationFilter operationFilter = new OperationFilter(new QName(targetNS,
"echo1"));
+ HostFilter hostFilter = new
HostFilter("localhost".equals(getServerHost()) ? "127.0.0.1" :
getServerHost(), false); //destination
+
+ RecordFilter[] filters = new RecordFilter[] {operationFilter, hostFilter};
+ Map<String, List<Record>> startRecords = (Map<String,
List<Record>>)server.invoke(oname, "getMatchingRecords", new Object[] {
filters }, new String[] { filters.getClass().getName() });
+
+ port.echo1("Test getMatchingRecords");
+ port.echo2("Test getMatchingRecords");
+
+ Map<String, List<Record>> stopRecords = (Map<String,
List<Record>>)server.invoke(oname, "getMatchingRecords", new Object[] {
filters }, new String[] { filters.getClass().getName() });
+
+ assertEquals(1, stopRecords.keySet().size() - startRecords.keySet().size());
+ }
+
+ @SuppressWarnings("unchecked")
+ public void testAddRemoveFilter() throws Exception
+ {
+ if (isIntegrationMetro())
+ {
+ //The WSDL_OPERATION ctx property is required for the operation filter to work
+ System.out.println("FIXME: [JBWS-2204] Implement Metro standard message
context properties");
+ return;
+ }
+ if (isIntegrationCXF())
+ {
+ //The WSDL_OPERATION ctx property is required for the operation filter to work
+ System.out.println("FIXME: [JBWS-2203] Implement CXF standard message
context properties");
+ return;
+ }
+ Endpoint port = getPort();
+ MBeanServerConnection server = getServer();
+ ObjectName oname = new ObjectName(endpointObjectName +
",recordProcessor=MemoryBufferRecorder");
+ setRecording(true);
+
+ OperationFilter operationFilter = new OperationFilter(new QName(targetNS,
"echo1"));
+
+ //Adding Operation filter...
+ server.invoke(oname, "addFilter", new Object[] { operationFilter }, new
String[] { RecordFilter.class.getName() });
+ int size = (Integer)server.getAttribute(oname, "Size");
+ port.echo1("Test testAddRemoveFilter");
+ port.echo2("Test testAddRemoveFilter");
+ assertEquals(1, (Integer)server.getAttribute(oname, "Size") - size);
+
+ //Clean filters...
+ server.setAttribute(oname, new Attribute("Filters", new
LinkedList<RecordFilter>()));
+ size = (Integer)server.getAttribute(oname, "Size");
+ port.echo1("Test testAddRemoveFilter");
+ port.echo2("Test testAddRemoveFilter");
+ assertEquals(2, (Integer)server.getAttribute(oname, "Size") - size);
+
+ NotFilter notFilter = new NotFilter(operationFilter);
+ AndFilter andFilter = new AndFilter(operationFilter, notFilter);
+
+ //Adding And filter...
+ server.invoke(oname, "addFilter", new Object[] { andFilter }, new
String[] { RecordFilter.class.getName() });
+ size = (Integer)server.getAttribute(oname, "Size");
+ port.echo1("Test testAddRemoveFilter");
+ port.echo2("Test testAddRemoveFilter");
+ assertEquals(0, (Integer)server.getAttribute(oname, "Size") - size);
+
+ //Clean filters...
+ server.setAttribute(oname, new Attribute("Filters", new
LinkedList<RecordFilter>()));
+ size = (Integer)server.getAttribute(oname, "Size");
+ port.echo1("Test testAddRemoveFilter");
+ port.echo2("Test testAddRemoveFilter");
+ assertEquals(2, (Integer)server.getAttribute(oname, "Size") - size);
+ }
+
+ private void setRecording(boolean recording) throws Exception
+ {
+ MBeanServerConnection server = getServer();
+ ObjectName oname = new ObjectName(endpointObjectName +
",recordProcessor=MemoryBufferRecorder");
+ Attribute attribute = new Attribute("Recording", recording);
+ server.setAttribute(oname, attribute);
+ assertEquals(recording, server.getAttribute(oname, "Recording"));
+ }
+
+ private Endpoint getPort() throws Exception
+ {
+ URL wsdlURL = new URL(endpointURL + "?wsdl");
+ QName serviceName = new QName(targetNS, "EndpointService");
+ Service service = Service.create(wsdlURL, serviceName);
+ Endpoint port = (Endpoint)service.getPort(Endpoint.class);
+ return port;
+ }
+}
Property changes on:
framework/trunk/testsuite/test/java/org/jboss/test/ws/management/recording/MemoryBufferRecorderTestCase.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
framework/trunk/testsuite/test/java/org/jboss/test/ws/management/recording/MyManagedProcessor.java
===================================================================
---
framework/trunk/testsuite/test/java/org/jboss/test/ws/management/recording/MyManagedProcessor.java
(rev 0)
+++
framework/trunk/testsuite/test/java/org/jboss/test/ws/management/recording/MyManagedProcessor.java 2008-08-07
15:28:20 UTC (rev 8028)
@@ -0,0 +1,18 @@
+package org.jboss.test.ws.management.recording;
+
+import java.io.Serializable;
+
+import org.jboss.wsf.framework.management.recording.MemoryBufferRecorder;
+
+public class MyManagedProcessor extends MemoryBufferRecorder implements
MyManagedProcessorMBean, Serializable {
+
+ private String attribute;
+
+ public String getAttribute() {
+ return attribute;
+ }
+
+ public void setAttribute(String attribute) {
+ this.attribute = attribute;
+ }
+}
\ No newline at end of file
Property changes on:
framework/trunk/testsuite/test/java/org/jboss/test/ws/management/recording/MyManagedProcessor.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
framework/trunk/testsuite/test/java/org/jboss/test/ws/management/recording/MyManagedProcessorMBean.java
===================================================================
---
framework/trunk/testsuite/test/java/org/jboss/test/ws/management/recording/MyManagedProcessorMBean.java
(rev 0)
+++
framework/trunk/testsuite/test/java/org/jboss/test/ws/management/recording/MyManagedProcessorMBean.java 2008-08-07
15:28:20 UTC (rev 8028)
@@ -0,0 +1,10 @@
+package org.jboss.test.ws.management.recording;
+
+import org.jboss.wsf.framework.management.recording.MemoryBufferRecorderMBean;
+
+public interface MyManagedProcessorMBean extends MemoryBufferRecorderMBean
+{
+ public String getAttribute();
+ public void setAttribute(String attribute);
+
+}
\ No newline at end of file
Property changes on:
framework/trunk/testsuite/test/java/org/jboss/test/ws/management/recording/MyManagedProcessorMBean.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
framework/trunk/testsuite/test/java/org/jboss/test/ws/management/recording/jaxws-handlers-server.xml
===================================================================
---
framework/trunk/testsuite/test/java/org/jboss/test/ws/management/recording/jaxws-handlers-server.xml
(rev 0)
+++
framework/trunk/testsuite/test/java/org/jboss/test/ws/management/recording/jaxws-handlers-server.xml 2008-08-07
15:28:20 UTC (rev 8028)
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<handler-chains
xmlns="http://java.sun.com/xml/ns/javaee"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
javaee_web_services_1_2.xsd">
+
+ <handler-chain>
+ <handler>
+ <handler-name>Recording Handler</handler-name>
+
<handler-class>org.jboss.wsf.framework.invocation.RecordingServerHandler</handler-class>
+ </handler>
+ </handler-chain>
+</handler-chains>
\ No newline at end of file
Property changes on:
framework/trunk/testsuite/test/java/org/jboss/test/ws/management/recording/jaxws-handlers-server.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF