[jboss-svn-commits] JBL Code SVN: r23746 - in labs/jbossesb/branches/JBESB_4_2_1_GA_CP: product/rosetta and 8 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Thu Nov 6 06:35:12 EST 2008
Author: kevin.conner at jboss.com
Date: 2008-11-06 06:35:11 -0500 (Thu, 06 Nov 2008)
New Revision: 23746
Added:
labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/aop/java/org/jboss/internal/soa/esb/services/registry/aspect/JUDDIAspect.java
labs/jbossesb/branches/JBESB_4_2_1_GA_CP/qa/junit/resources/server/aop/
labs/jbossesb/branches/JBESB_4_2_1_GA_CP/qa/junit/resources/server/aop/META-INF/
labs/jbossesb/branches/JBESB_4_2_1_GA_CP/qa/junit/resources/server/aop/META-INF/jboss-service.xml
labs/jbossesb/branches/JBESB_4_2_1_GA_CP/qa/junit/src/org/jboss/soa/esb/server/aop/
labs/jbossesb/branches/JBESB_4_2_1_GA_CP/qa/junit/src/org/jboss/soa/esb/server/aop/AOPServer.java
labs/jbossesb/branches/JBESB_4_2_1_GA_CP/qa/junit/src/org/jboss/soa/esb/server/aop/AOPServerMBean.java
labs/jbossesb/branches/JBESB_4_2_1_GA_CP/qa/junit/src/org/jboss/soa/esb/server/aop/AOPUnitTest.java
Removed:
labs/jbossesb/branches/JBESB_4_2_1_GA_CP/qa/junit/resources/server/aop/META-INF/
labs/jbossesb/branches/JBESB_4_2_1_GA_CP/qa/junit/resources/server/aop/META-INF/jboss-service.xml
labs/jbossesb/branches/JBESB_4_2_1_GA_CP/qa/junit/src/org/jboss/soa/esb/server/aop/AOPServer.java
labs/jbossesb/branches/JBESB_4_2_1_GA_CP/qa/junit/src/org/jboss/soa/esb/server/aop/AOPServerMBean.java
labs/jbossesb/branches/JBESB_4_2_1_GA_CP/qa/junit/src/org/jboss/soa/esb/server/aop/AOPUnitTest.java
Modified:
labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/build-distr.xml
labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/aop/resources/META-INF/jboss-aop.xml
labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/build.xml
labs/jbossesb/branches/JBESB_4_2_1_GA_CP/qa/junit/build.xml
Log:
Fix juddi XML parsing: JBESB-2166
Modified: labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/build-distr.xml
===================================================================
--- labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/build-distr.xml 2008-11-06 11:26:55 UTC (rev 23745)
+++ labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/build-distr.xml 2008-11-06 11:35:11 UTC (rev 23746)
@@ -99,14 +99,18 @@
<fileset dir="${lib.ext.dir}" includes="jbossts-common.jar"/>
<fileset dir="${build.lib.dir}" includes="jbossesb*.jar"/>
<!-- We use AOP on scout to get around an issue, use the modified jar for now
- <fileset dir="${lib.dir}" includes="scout-*.jar"/>
+ <fileset dir="${lib.ext.dir}" includes="scout-*.jar"/>
-->
<!-- scout -->
<fileset dir="${aoplib.dir}" includes="scout-*.jar"/>
<!-- xbean for reading/marchalling xml for configuration, and scout -->
<fileset dir="${lib.ext.dir}" includes="xbean.jar,stax-api-1.0.1.jar,xmlpublic.jar"/>
<!-- jUDDI Registry, we're one -->
+ <!-- We use AOP on juddi to get around an issue, use the modified jar for now
<fileset dir="${lib.ext.dir}" includes="juddi-*.jar,juddi-client-*.jar"/>
+ -->
+ <fileset dir="${aoplib.dir}" includes="juddi-*.jar"/>
+ <fileset dir="${lib.ext.dir}" includes="juddi-client*.jar"/>
<!-- smooks for transformation -->
<fileset dir="${lib.ext.dir}"
includes="opencsv-*.jar,ognl-*.jar,groovy-*.jar,commons-lang-2.1.jar,stringtemplate-3.0.jar,antlr-2.7.6.jar"/>
Copied: labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/aop/java/org/jboss/internal/soa/esb/services/registry/aspect/JUDDIAspect.java (from rev 23257, labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/aop/java/org/jboss/internal/soa/esb/services/registry/aspect/JUDDIAspect.java)
===================================================================
--- labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/aop/java/org/jboss/internal/soa/esb/services/registry/aspect/JUDDIAspect.java (rev 0)
+++ labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/aop/java/org/jboss/internal/soa/esb/services/registry/aspect/JUDDIAspect.java 2008-11-06 11:35:11 UTC (rev 23746)
@@ -0,0 +1,57 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, 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.internal.soa.esb.services.registry.aspect;
+
+import org.jboss.aop.joinpoint.MethodInvocation;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+/**
+ * Aspect used to support CDATA sections from within jUDDI.
+ *
+ * @author <a href='mailto:Kevin.Conner at jboss.com'>Kevin Conner</a>
+ */
+public class JUDDIAspect
+{
+ public Object getText(final MethodInvocation invocation)
+ throws Throwable
+ {
+ final Object[] args = invocation.getArguments() ;
+ final Element element = (Element)args[0] ;
+ final StringBuffer sb = new StringBuffer();
+
+ final NodeList nodeList = element.getChildNodes() ;
+ final int numNodes = nodeList.getLength() ;
+ for(int count = 0 ; count < numNodes ; count++)
+ {
+ final Node node = nodeList.item(count) ;
+ final short type = node.getNodeType() ;
+ if ((type == Element.TEXT_NODE) || (type == Element.CDATA_SECTION_NODE))
+ {
+ sb.append(node.getNodeValue()) ;
+ }
+ }
+
+ return sb.toString().trim();
+ }
+}
Modified: labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/aop/resources/META-INF/jboss-aop.xml
===================================================================
--- labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/aop/resources/META-INF/jboss-aop.xml 2008-11-06 11:26:55 UTC (rev 23745)
+++ labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/aop/resources/META-INF/jboss-aop.xml 2008-11-06 11:35:11 UTC (rev 23746)
@@ -5,9 +5,14 @@
<aop>
<aspect class="org.jboss.internal.soa.esb.services.registry.aspect.ScoutAspect" scope="PER_VM"/>
+ <aspect class="org.jboss.internal.soa.esb.services.registry.aspect.JUDDIAspect" scope="PER_VM"/>
<bind pointcut="withincode(* org.apache.ws.scout.registry.BusinessQueryManagerImpl->findServiceBindings(..)) AND call(* org.apache.ws.scout.registry.BusinessQueryManagerImpl->getRegistryObject(..))">
<advice name="getRegistryObject" aspect="org.jboss.internal.soa.esb.services.registry.aspect.ScoutAspect"/>
</bind>
+
+ <bind pointcut="execution(* org.apache.juddi.util.xml.XMLUtils->getText(..))">
+ <advice name="getText" aspect="org.jboss.internal.soa.esb.services.registry.aspect.JUDDIAspect"/>
+ </bind>
</aop>
Modified: labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/build.xml
===================================================================
--- labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/build.xml 2008-11-06 11:26:55 UTC (rev 23745)
+++ labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/build.xml 2008-11-06 11:35:11 UTC (rev 23746)
@@ -5,7 +5,8 @@
<property name="org.jboss.esb.rosetta.distrib.dir" location="${org.jboss.esb.internal.dest}/jbossesb"/>
<property name="org.jboss.esb.rosetta.classes.dir" location="${org.jboss.esb.internal.dest}/classes/rosetta"/>
<property name="org.jboss.esb.rosetta.aop.classes.dir" location="${org.jboss.esb.rosetta.classes.dir}-aop"/>
- <property name="org.jboss.esb.rosetta.aopc.classes.dir" location="${org.jboss.esb.rosetta.classes.dir}-aopc"/>
+ <property name="org.jboss.esb.rosetta.aopc.scout.classes.dir" location="${org.jboss.esb.rosetta.classes.dir}-scout-aopc"/>
+ <property name="org.jboss.esb.rosetta.aopc.juddi.classes.dir" location="${org.jboss.esb.rosetta.classes.dir}-juddi-aopc"/>
<property name="org.jboss.esb.rosetta.src.dir" location="src"/>
<property name="org.jboss.esb.root.dir" location="../"/>
<property name="gendir" location="${org.jboss.esb.internal.dest}/schema-model" />
@@ -145,19 +146,30 @@
<target name="aop" depends="aop-jar">
<taskdef name="aopc" classname="org.jboss.aop.ant.AopC" classpathref="aop-classpath"/>
- <delete dir="${org.jboss.esb.rosetta.aopc.classes.dir}" quiet="true"/>
- <mkdir dir="${org.jboss.esb.rosetta.aopc.classes.dir}"/>
+ <delete dir="${org.jboss.esb.rosetta.aopc.scout.classes.dir}" quiet="true"/>
+ <delete dir="${org.jboss.esb.rosetta.aopc.juddi.classes.dir}" quiet="true"/>
+ <mkdir dir="${org.jboss.esb.rosetta.aopc.scout.classes.dir}"/>
+ <mkdir dir="${org.jboss.esb.rosetta.aopc.juddi.classes.dir}"/>
- <unzip src="${org.jboss.esb.ext.lib.dir}/scout-1.0rc1.jar" dest="${org.jboss.esb.rosetta.aopc.classes.dir}"/>
+ <unzip src="${org.jboss.esb.ext.lib.dir}/scout-1.0rc1.jar" dest="${org.jboss.esb.rosetta.aopc.scout.classes.dir}"/>
+ <unzip src="${org.jboss.esb.ext.lib.dir}/juddi-2.0rc5.jar" dest="${org.jboss.esb.rosetta.aopc.juddi.classes.dir}"/>
+
<aopc compilerclasspathref="aop-classpath">
- <classpath path="${org.jboss.esb.rosetta.aopc.classes.dir}"/>
- <src path="${org.jboss.esb.rosetta.aopc.classes.dir}"/>
+ <classpath path="${org.jboss.esb.rosetta.aopc.scout.classes.dir}"/>
+ <src path="${org.jboss.esb.rosetta.aopc.scout.classes.dir}"/>
<include name="org/apache/ws/scout/registry/BusinessQueryManagerImpl.class"/>
-
<aoppath path="aop/resources/META-INF/jboss-aop.xml"/>
<aopclasspath path="${org.jboss.esb.rosetta.aop.classes.dir}"/>
</aopc>
- <zip destfile="${org.jboss.esb.aoplib.dir}/scout-1.0rc1.aop.jar" basedir="${org.jboss.esb.rosetta.aopc.classes.dir}"/>
+ <aopc compilerclasspathref="aop-classpath">
+ <classpath path="${org.jboss.esb.rosetta.aopc.juddi.classes.dir}"/>
+ <src path="${org.jboss.esb.rosetta.aopc.juddi.classes.dir}"/>
+ <include name="org/apache/juddi/util/xml/XMLUtils.class"/>
+ <aoppath path="aop/resources/META-INF/jboss-aop.xml"/>
+ <aopclasspath path="${org.jboss.esb.rosetta.aop.classes.dir}"/>
+ </aopc>
+ <zip destfile="${org.jboss.esb.aoplib.dir}/scout-1.0rc1.aop.jar" basedir="${org.jboss.esb.rosetta.aopc.scout.classes.dir}"/>
+ <zip destfile="${org.jboss.esb.aoplib.dir}/juddi-2.0rc5.aop.jar" basedir="${org.jboss.esb.rosetta.aopc.juddi.classes.dir}"/>
</target>
<target name="aop-jar" depends="aop-compile">
Modified: labs/jbossesb/branches/JBESB_4_2_1_GA_CP/qa/junit/build.xml
===================================================================
--- labs/jbossesb/branches/JBESB_4_2_1_GA_CP/qa/junit/build.xml 2008-11-06 11:26:55 UTC (rev 23745)
+++ labs/jbossesb/branches/JBESB_4_2_1_GA_CP/qa/junit/build.xml 2008-11-06 11:35:11 UTC (rev 23746)
@@ -133,6 +133,12 @@
<include name="META-INF/*.xml"/>
</fileset>
</jar>
+ <jar jarfile="${qa.build.lib}/aop-test.sar">
+ <fileset dir="${qa.junit.classes}">
+ <include name="org/jboss/soa/esb/server/aop/*.class"/>
+ </fileset>
+ <fileset dir="${qa.junit.resources}/server/aop"/>
+ </jar>
</target>
<target name="one-test" if="test" depends="jars"
Copied: labs/jbossesb/branches/JBESB_4_2_1_GA_CP/qa/junit/resources/server/aop (from rev 23257, labs/jbossesb/branches/JBESB_4_4_GA_CP/qa/junit/resources/server/aop)
Copied: labs/jbossesb/branches/JBESB_4_2_1_GA_CP/qa/junit/resources/server/aop/META-INF (from rev 23257, labs/jbossesb/branches/JBESB_4_4_GA_CP/qa/junit/resources/server/aop/META-INF)
Deleted: labs/jbossesb/branches/JBESB_4_2_1_GA_CP/qa/junit/resources/server/aop/META-INF/jboss-service.xml
===================================================================
--- labs/jbossesb/branches/JBESB_4_4_GA_CP/qa/junit/resources/server/aop/META-INF/jboss-service.xml 2008-10-02 10:30:52 UTC (rev 23257)
+++ labs/jbossesb/branches/JBESB_4_2_1_GA_CP/qa/junit/resources/server/aop/META-INF/jboss-service.xml 2008-11-06 11:35:11 UTC (rev 23746)
@@ -1,5 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<server>
- <mbean name="jboss.esb:test=AOPServer" code="org.jboss.soa.esb.server.aop.AOPServer"/>
-</server>
Copied: labs/jbossesb/branches/JBESB_4_2_1_GA_CP/qa/junit/resources/server/aop/META-INF/jboss-service.xml (from rev 23257, labs/jbossesb/branches/JBESB_4_4_GA_CP/qa/junit/resources/server/aop/META-INF/jboss-service.xml)
===================================================================
--- labs/jbossesb/branches/JBESB_4_2_1_GA_CP/qa/junit/resources/server/aop/META-INF/jboss-service.xml (rev 0)
+++ labs/jbossesb/branches/JBESB_4_2_1_GA_CP/qa/junit/resources/server/aop/META-INF/jboss-service.xml 2008-11-06 11:35:11 UTC (rev 23746)
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<server>
+ <mbean name="jboss.esb:test=AOPServer" code="org.jboss.soa.esb.server.aop.AOPServer"/>
+</server>
Copied: labs/jbossesb/branches/JBESB_4_2_1_GA_CP/qa/junit/src/org/jboss/soa/esb/server/aop (from rev 23257, labs/jbossesb/branches/JBESB_4_4_GA_CP/qa/junit/src/org/jboss/soa/esb/server/aop)
Deleted: labs/jbossesb/branches/JBESB_4_2_1_GA_CP/qa/junit/src/org/jboss/soa/esb/server/aop/AOPServer.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_4_GA_CP/qa/junit/src/org/jboss/soa/esb/server/aop/AOPServer.java 2008-10-02 10:30:52 UTC (rev 23257)
+++ labs/jbossesb/branches/JBESB_4_2_1_GA_CP/qa/junit/src/org/jboss/soa/esb/server/aop/AOPServer.java 2008-11-06 11:35:11 UTC (rev 23746)
@@ -1,189 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, JBoss Inc., and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * 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,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * (C) 2005-2006, JBoss Inc.
- */
-package org.jboss.soa.esb.server.aop;
-
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.util.Collection;
-
-import javax.xml.registry.BulkResponse;
-import javax.xml.registry.BusinessQueryManager;
-import javax.xml.registry.Connection;
-import javax.xml.registry.JAXRException;
-import javax.xml.registry.JAXRResponse;
-import javax.xml.registry.RegistryService;
-import javax.xml.registry.infomodel.Service;
-import javax.xml.registry.infomodel.ServiceBinding;
-
-import org.jboss.internal.soa.esb.addressing.helpers.EPRHelper;
-import org.jboss.internal.soa.esb.services.registry.JAXRConnectionFactory;
-import org.jboss.internal.soa.esb.services.registry.JAXRRegistryImpl;
-import org.jboss.soa.esb.ConfigurationException;
-import org.jboss.soa.esb.MarshalException;
-import org.jboss.soa.esb.addressing.eprs.LogicalEPR;
-import org.jboss.soa.esb.services.registry.Registry;
-import org.jboss.soa.esb.services.registry.RegistryException;
-import org.jboss.soa.esb.services.registry.RegistryFactory;
-import org.jboss.soa.esb.services.registry.ServiceNotFoundException;
-
-
-/**
- * MBean to manage AOP tests.
- *
- * @author <a href='mailto:kevin.conner at jboss.com'>Kevin Conner</a>
- */
-public class AOPServer implements AOPServerMBean
-{
- public AOPServer()
- {
- System.out.println("AOP test MBean deployed") ;
- }
-
- public String verifyScoutPerformanceIssue()
- throws JAXRException, ConfigurationException
- {
- return new TestScoutRegistryImpl().checkService() ;
- }
-
- public String verifyJUDDICDataIssue()
- throws RegistryException, MarshalException, ServiceNotFoundException
- {
- final Registry registry = RegistryFactory.getRegistry() ;
- final String category = "DummyAOPCategory" ;
- final String serviceName = "DummyAOPServiceName" ;
- final String serviceDescription = "Dummy AOP Service Description" ;
- final LogicalEPR epr = new LogicalEPR(category, serviceName) ;
- for (char name = 'a' ; name <= 'z' ; name++)
- {
- final String val = new String(new char[] {name}) ;
- epr.getAddr().addExtension(val, val) ;
- }
- final String eprAsXML = EPRHelper.toXMLString(epr) ;
- final String heuristic = verifyHeuristic(eprAsXML) ;
- if (heuristic != null)
- {
- return null ;
- }
-
- final String eprDescription = "Dummy AOP EPR Description" ;
-
- registry.registerEPR(category, serviceName, serviceDescription, epr, eprDescription) ;
- try
- {
- registry.findEPR(category, serviceName) ;
- }
- catch (final Throwable th)
- {
- final StringWriter sw = new StringWriter() ;
- final PrintWriter pw = new PrintWriter(sw) ;
- th.printStackTrace(pw) ;
- pw.flush() ;
- return sw.toString() ;
- }
-
- return null ;
- }
-
- private String verifyHeuristic(final String value)
- {
- final char[] contents = value.toCharArray() ;
- final int numChars = contents.length ;
- int counter = 0 ;
- for(int index = 0 ; index < numChars ; index++)
- {
- final char ch = contents[index] ;
- if ((ch == '<') || (ch == '&'))
- {
- counter++;
- }
- }
- if ((numChars > 32) && (counter > 5) &&
- (((counter * 100) / numChars) > 1))
- {
- return null ;
- }
- else
- {
- return "Heuristic failure" ;
- }
- }
-
- private static final class TestScoutRegistryImpl extends JAXRRegistryImpl
- {
- public TestScoutRegistryImpl()
- throws ConfigurationException
- {
- }
-
- public String checkService()
- throws JAXRException, ConfigurationException
- {
- final Service service = findService("JBossESB-Internal", "DeadLetterService") ;
-
- if (service == null)
- {
- return "Service not found" ;
- }
-
- final ScoutConnectionFactory scoutConnectionFactory = new ScoutConnectionFactory() ;
- final Connection connection = scoutConnectionFactory.getConnection();
- final RegistryService rs = connection.getRegistryService();
- final BusinessQueryManager bqm = rs.getBusinessQueryManager();
- final BulkResponse bulkResponse = bqm.findServiceBindings(service.getKey(),null,null,null);
- if (bulkResponse.getStatus()!=JAXRResponse.STATUS_SUCCESS)
- {
- return "findServiceBindings failed" ;
- }
- final Collection<ServiceBinding> serviceBindings = (Collection<ServiceBinding>)bulkResponse.getCollection();
- if ((serviceBindings == null) || (serviceBindings.size() == 0))
- {
- return "could not find service bindings for DeadLetterService" ;
- }
-
- for(ServiceBinding serviceBinding: serviceBindings)
- {
- final Service bindingService = serviceBinding.getService() ;
- if (bindingService == null)
- {
- return "Could not find service associated with binding" ;
- }
- if (bindingService.getProvidingOrganization() != null)
- {
- return "FAILED: Organization is present in service binding" ;
- }
- }
-
- return null ;
- }
- }
-
- private static class ScoutConnectionFactory extends JAXRConnectionFactory
- {
- public ScoutConnectionFactory()
- throws ConfigurationException
- {
- }
-
- public Connection getConnection()
- {
- return super.getConnection() ;
- }
- }
-}
Copied: labs/jbossesb/branches/JBESB_4_2_1_GA_CP/qa/junit/src/org/jboss/soa/esb/server/aop/AOPServer.java (from rev 23257, labs/jbossesb/branches/JBESB_4_4_GA_CP/qa/junit/src/org/jboss/soa/esb/server/aop/AOPServer.java)
===================================================================
--- labs/jbossesb/branches/JBESB_4_2_1_GA_CP/qa/junit/src/org/jboss/soa/esb/server/aop/AOPServer.java (rev 0)
+++ labs/jbossesb/branches/JBESB_4_2_1_GA_CP/qa/junit/src/org/jboss/soa/esb/server/aop/AOPServer.java 2008-11-06 11:35:11 UTC (rev 23746)
@@ -0,0 +1,189 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2006, JBoss Inc.
+ */
+package org.jboss.soa.esb.server.aop;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.util.Collection;
+
+import javax.xml.registry.BulkResponse;
+import javax.xml.registry.BusinessQueryManager;
+import javax.xml.registry.Connection;
+import javax.xml.registry.JAXRException;
+import javax.xml.registry.JAXRResponse;
+import javax.xml.registry.RegistryService;
+import javax.xml.registry.infomodel.Service;
+import javax.xml.registry.infomodel.ServiceBinding;
+
+import org.jboss.internal.soa.esb.addressing.helpers.EPRHelper;
+import org.jboss.internal.soa.esb.services.registry.JAXRConnectionFactory;
+import org.jboss.internal.soa.esb.services.registry.JAXRRegistryImpl;
+import org.jboss.soa.esb.ConfigurationException;
+import org.jboss.soa.esb.MarshalException;
+import org.jboss.soa.esb.addressing.eprs.LogicalEPR;
+import org.jboss.soa.esb.services.registry.Registry;
+import org.jboss.soa.esb.services.registry.RegistryException;
+import org.jboss.soa.esb.services.registry.RegistryFactory;
+import org.jboss.soa.esb.services.registry.ServiceNotFoundException;
+
+
+/**
+ * MBean to manage AOP tests.
+ *
+ * @author <a href='mailto:kevin.conner at jboss.com'>Kevin Conner</a>
+ */
+public class AOPServer implements AOPServerMBean
+{
+ public AOPServer()
+ {
+ System.out.println("AOP test MBean deployed") ;
+ }
+
+ public String verifyScoutPerformanceIssue()
+ throws JAXRException, ConfigurationException
+ {
+ return new TestScoutRegistryImpl().checkService() ;
+ }
+
+ public String verifyJUDDICDataIssue()
+ throws RegistryException, MarshalException, ServiceNotFoundException
+ {
+ final Registry registry = RegistryFactory.getRegistry() ;
+ final String category = "DummyAOPCategory" ;
+ final String serviceName = "DummyAOPServiceName" ;
+ final String serviceDescription = "Dummy AOP Service Description" ;
+ final LogicalEPR epr = new LogicalEPR(category, serviceName) ;
+ for (char name = 'a' ; name <= 'z' ; name++)
+ {
+ final String val = new String(new char[] {name}) ;
+ epr.getAddr().addExtension(val, val) ;
+ }
+ final String eprAsXML = EPRHelper.toXMLString(epr) ;
+ final String heuristic = verifyHeuristic(eprAsXML) ;
+ if (heuristic != null)
+ {
+ return null ;
+ }
+
+ final String eprDescription = "Dummy AOP EPR Description" ;
+
+ registry.registerEPR(category, serviceName, serviceDescription, epr, eprDescription) ;
+ try
+ {
+ registry.findEPR(category, serviceName) ;
+ }
+ catch (final Throwable th)
+ {
+ final StringWriter sw = new StringWriter() ;
+ final PrintWriter pw = new PrintWriter(sw) ;
+ th.printStackTrace(pw) ;
+ pw.flush() ;
+ return sw.toString() ;
+ }
+
+ return null ;
+ }
+
+ private String verifyHeuristic(final String value)
+ {
+ final char[] contents = value.toCharArray() ;
+ final int numChars = contents.length ;
+ int counter = 0 ;
+ for(int index = 0 ; index < numChars ; index++)
+ {
+ final char ch = contents[index] ;
+ if ((ch == '<') || (ch == '&'))
+ {
+ counter++;
+ }
+ }
+ if ((numChars > 32) && (counter > 5) &&
+ (((counter * 100) / numChars) > 1))
+ {
+ return null ;
+ }
+ else
+ {
+ return "Heuristic failure" ;
+ }
+ }
+
+ private static final class TestScoutRegistryImpl extends JAXRRegistryImpl
+ {
+ public TestScoutRegistryImpl()
+ throws ConfigurationException
+ {
+ }
+
+ public String checkService()
+ throws JAXRException, ConfigurationException
+ {
+ final Service service = findService("JBossESB-Internal", "DeadLetterService") ;
+
+ if (service == null)
+ {
+ return "Service not found" ;
+ }
+
+ final ScoutConnectionFactory scoutConnectionFactory = new ScoutConnectionFactory() ;
+ final Connection connection = scoutConnectionFactory.getConnection();
+ final RegistryService rs = connection.getRegistryService();
+ final BusinessQueryManager bqm = rs.getBusinessQueryManager();
+ final BulkResponse bulkResponse = bqm.findServiceBindings(service.getKey(),null,null,null);
+ if (bulkResponse.getStatus()!=JAXRResponse.STATUS_SUCCESS)
+ {
+ return "findServiceBindings failed" ;
+ }
+ final Collection<ServiceBinding> serviceBindings = (Collection<ServiceBinding>)bulkResponse.getCollection();
+ if ((serviceBindings == null) || (serviceBindings.size() == 0))
+ {
+ return "could not find service bindings for DeadLetterService" ;
+ }
+
+ for(ServiceBinding serviceBinding: serviceBindings)
+ {
+ final Service bindingService = serviceBinding.getService() ;
+ if (bindingService == null)
+ {
+ return "Could not find service associated with binding" ;
+ }
+ if (bindingService.getProvidingOrganization() != null)
+ {
+ return "FAILED: Organization is present in service binding" ;
+ }
+ }
+
+ return null ;
+ }
+ }
+
+ private static class ScoutConnectionFactory extends JAXRConnectionFactory
+ {
+ public ScoutConnectionFactory()
+ throws ConfigurationException
+ {
+ }
+
+ public Connection getConnection()
+ {
+ return super.getConnection() ;
+ }
+ }
+}
Deleted: labs/jbossesb/branches/JBESB_4_2_1_GA_CP/qa/junit/src/org/jboss/soa/esb/server/aop/AOPServerMBean.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_4_GA_CP/qa/junit/src/org/jboss/soa/esb/server/aop/AOPServerMBean.java 2008-10-02 10:30:52 UTC (rev 23257)
+++ labs/jbossesb/branches/JBESB_4_2_1_GA_CP/qa/junit/src/org/jboss/soa/esb/server/aop/AOPServerMBean.java 2008-11-06 11:35:11 UTC (rev 23746)
@@ -1,43 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, JBoss Inc., and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * 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,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * (C) 2005-2006, JBoss Inc.
- */
-package org.jboss.soa.esb.server.aop;
-
-import javax.xml.registry.JAXRException;
-
-import org.jboss.soa.esb.ConfigurationException;
-import org.jboss.soa.esb.MarshalException;
-import org.jboss.soa.esb.services.registry.RegistryException;
-import org.jboss.soa.esb.services.registry.ServiceNotFoundException;
-
-/**
- * MBean to manage AOP tests.
- *
- * @author <a href='mailto:kevin.conner at jboss.com'>Kevin Conner</a>
- */
-public interface AOPServerMBean
-{
- public static final String OBJECT_NAME="jboss.esb:test=AOPServer" ;
-
- public String verifyScoutPerformanceIssue()
- throws JAXRException, ConfigurationException ;
-
- public String verifyJUDDICDataIssue()
- throws RegistryException, MarshalException, ServiceNotFoundException ;
-}
Copied: labs/jbossesb/branches/JBESB_4_2_1_GA_CP/qa/junit/src/org/jboss/soa/esb/server/aop/AOPServerMBean.java (from rev 23257, labs/jbossesb/branches/JBESB_4_4_GA_CP/qa/junit/src/org/jboss/soa/esb/server/aop/AOPServerMBean.java)
===================================================================
--- labs/jbossesb/branches/JBESB_4_2_1_GA_CP/qa/junit/src/org/jboss/soa/esb/server/aop/AOPServerMBean.java (rev 0)
+++ labs/jbossesb/branches/JBESB_4_2_1_GA_CP/qa/junit/src/org/jboss/soa/esb/server/aop/AOPServerMBean.java 2008-11-06 11:35:11 UTC (rev 23746)
@@ -0,0 +1,43 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2006, JBoss Inc.
+ */
+package org.jboss.soa.esb.server.aop;
+
+import javax.xml.registry.JAXRException;
+
+import org.jboss.soa.esb.ConfigurationException;
+import org.jboss.soa.esb.MarshalException;
+import org.jboss.soa.esb.services.registry.RegistryException;
+import org.jboss.soa.esb.services.registry.ServiceNotFoundException;
+
+/**
+ * MBean to manage AOP tests.
+ *
+ * @author <a href='mailto:kevin.conner at jboss.com'>Kevin Conner</a>
+ */
+public interface AOPServerMBean
+{
+ public static final String OBJECT_NAME="jboss.esb:test=AOPServer" ;
+
+ public String verifyScoutPerformanceIssue()
+ throws JAXRException, ConfigurationException ;
+
+ public String verifyJUDDICDataIssue()
+ throws RegistryException, MarshalException, ServiceNotFoundException ;
+}
Deleted: labs/jbossesb/branches/JBESB_4_2_1_GA_CP/qa/junit/src/org/jboss/soa/esb/server/aop/AOPUnitTest.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_4_GA_CP/qa/junit/src/org/jboss/soa/esb/server/aop/AOPUnitTest.java 2008-10-02 10:30:52 UTC (rev 23257)
+++ labs/jbossesb/branches/JBESB_4_2_1_GA_CP/qa/junit/src/org/jboss/soa/esb/server/aop/AOPUnitTest.java 2008-11-06 11:35:11 UTC (rev 23746)
@@ -1,100 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, JBoss Inc., and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * 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,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * (C) 2005-2006, JBoss Inc.
- */
-package org.jboss.soa.esb.server.aop;
-
-import javax.management.ObjectName;
-
-import junit.framework.Test;
-
-import org.jboss.test.JBossTestCase;
-
-/**
- * Test asynchronous callbacks for jBPM processes.
- *
- * @author <a href='mailto:kevin.conner at jboss.com'>Kevin Conner</a>
- */
-public class AOPUnitTest extends JBossTestCase
-{
- /**
- * The name of the deployment archive.
- */
- private static final String SAR_ARCHIVE = "aop-test.sar" ;
-
- /**
- * Construct the test case with the specified name.
- * @param name The name of the test case.
- */
- public AOPUnitTest(final String name)
- {
- super(name) ;
- }
-
- /**
- * Test for scout performance issue.
- * @throws Exception For any failures.
- */
- public void testScoutPerformanceIssue()
- throws Exception
- {
- final String result = (String)execute("verifyScoutPerformanceIssue", null, null) ;
- if (result != null)
- {
- fail(result) ;
- }
- }
-
- /**
- * Test for juddi CDATA issue..
- * @throws Exception For any failures.
- */
- public void testJUDDICDataIssue()
- throws Exception
- {
- final String result = (String)execute("verifyJUDDICDataIssue", null, null) ;
- if (result != null)
- {
- fail(result) ;
- }
- }
-
- /**
- * Execute the specified method on the mbean.
- * @param method The method name.
- * @param values The parmeter values.
- * @param types The parameter types.
- * @return The method return value.
- * @throws Exception For errors during invocation.
- */
- private Object execute(final String method, final Object[] values, final String[] types)
- throws Exception
- {
- return getServer().invoke(new ObjectName(AOPServerMBean.OBJECT_NAME), method, values, types) ;
- }
-
- /**
- * Create the test suite.
- * @return The suite representing this test case.
- */
- public static Test suite()
- throws Exception
- {
- return getDeploySetup(AOPUnitTest.class, SAR_ARCHIVE);
- }
-}
Copied: labs/jbossesb/branches/JBESB_4_2_1_GA_CP/qa/junit/src/org/jboss/soa/esb/server/aop/AOPUnitTest.java (from rev 23257, labs/jbossesb/branches/JBESB_4_4_GA_CP/qa/junit/src/org/jboss/soa/esb/server/aop/AOPUnitTest.java)
===================================================================
--- labs/jbossesb/branches/JBESB_4_2_1_GA_CP/qa/junit/src/org/jboss/soa/esb/server/aop/AOPUnitTest.java (rev 0)
+++ labs/jbossesb/branches/JBESB_4_2_1_GA_CP/qa/junit/src/org/jboss/soa/esb/server/aop/AOPUnitTest.java 2008-11-06 11:35:11 UTC (rev 23746)
@@ -0,0 +1,100 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2006, JBoss Inc.
+ */
+package org.jboss.soa.esb.server.aop;
+
+import javax.management.ObjectName;
+
+import junit.framework.Test;
+
+import org.jboss.test.JBossTestCase;
+
+/**
+ * Test asynchronous callbacks for jBPM processes.
+ *
+ * @author <a href='mailto:kevin.conner at jboss.com'>Kevin Conner</a>
+ */
+public class AOPUnitTest extends JBossTestCase
+{
+ /**
+ * The name of the deployment archive.
+ */
+ private static final String SAR_ARCHIVE = "aop-test.sar" ;
+
+ /**
+ * Construct the test case with the specified name.
+ * @param name The name of the test case.
+ */
+ public AOPUnitTest(final String name)
+ {
+ super(name) ;
+ }
+
+ /**
+ * Test for scout performance issue.
+ * @throws Exception For any failures.
+ */
+ public void testScoutPerformanceIssue()
+ throws Exception
+ {
+ final String result = (String)execute("verifyScoutPerformanceIssue", null, null) ;
+ if (result != null)
+ {
+ fail(result) ;
+ }
+ }
+
+ /**
+ * Test for juddi CDATA issue..
+ * @throws Exception For any failures.
+ */
+ public void testJUDDICDataIssue()
+ throws Exception
+ {
+ final String result = (String)execute("verifyJUDDICDataIssue", null, null) ;
+ if (result != null)
+ {
+ fail(result) ;
+ }
+ }
+
+ /**
+ * Execute the specified method on the mbean.
+ * @param method The method name.
+ * @param values The parmeter values.
+ * @param types The parameter types.
+ * @return The method return value.
+ * @throws Exception For errors during invocation.
+ */
+ private Object execute(final String method, final Object[] values, final String[] types)
+ throws Exception
+ {
+ return getServer().invoke(new ObjectName(AOPServerMBean.OBJECT_NAME), method, values, types) ;
+ }
+
+ /**
+ * Create the test suite.
+ * @return The suite representing this test case.
+ */
+ public static Test suite()
+ throws Exception
+ {
+ return getDeploySetup(AOPUnitTest.class, SAR_ARCHIVE);
+ }
+}
More information about the jboss-svn-commits
mailing list