[jboss-svn-commits] JBL Code SVN: r37374 - in labs/jbossesb/branches/JBESB_4_10_CP/product/rosetta: src/org/jboss/soa/esb/addressing and 3 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Tue Aug 9 23:35:07 EDT 2011
Author: tcunning
Date: 2011-08-09 23:35:07 -0400 (Tue, 09 Aug 2011)
New Revision: 37374
Modified:
labs/jbossesb/branches/JBESB_4_10_CP/product/rosetta/src/org/jboss/internal/soa/esb/addressing/helpers/EPRHelper.java
labs/jbossesb/branches/JBESB_4_10_CP/product/rosetta/src/org/jboss/soa/esb/addressing/EPR.java
labs/jbossesb/branches/JBESB_4_10_CP/product/rosetta/src/org/jboss/soa/esb/addressing/eprs/EmailEpr.java
labs/jbossesb/branches/JBESB_4_10_CP/product/rosetta/src/org/jboss/soa/esb/addressing/eprs/FTPEpr.java
labs/jbossesb/branches/JBESB_4_10_CP/product/rosetta/src/org/jboss/soa/esb/addressing/eprs/FTPSEpr.java
labs/jbossesb/branches/JBESB_4_10_CP/product/rosetta/src/org/jboss/soa/esb/addressing/eprs/FileEpr.java
labs/jbossesb/branches/JBESB_4_10_CP/product/rosetta/src/org/jboss/soa/esb/addressing/eprs/HTTPEpr.java
labs/jbossesb/branches/JBESB_4_10_CP/product/rosetta/src/org/jboss/soa/esb/addressing/eprs/InVMEpr.java
labs/jbossesb/branches/JBESB_4_10_CP/product/rosetta/src/org/jboss/soa/esb/addressing/eprs/JDBCEpr.java
labs/jbossesb/branches/JBESB_4_10_CP/product/rosetta/src/org/jboss/soa/esb/addressing/eprs/JMSEpr.java
labs/jbossesb/branches/JBESB_4_10_CP/product/rosetta/src/org/jboss/soa/esb/addressing/eprs/LogicalEPR.java
labs/jbossesb/branches/JBESB_4_10_CP/product/rosetta/src/org/jboss/soa/esb/addressing/eprs/SFTPEpr.java
labs/jbossesb/branches/JBESB_4_10_CP/product/rosetta/tests/src/org/jboss/soa/esb/addressing/tests/EPRUnitTest.java
labs/jbossesb/branches/JBESB_4_10_CP/product/rosetta/tests/src/org/jboss/soa/esb/addressing/util/tests/EPRHelperUnitTest.java
Log:
JBESB-3574
Check in EPRHelper fixes from one off branch.
Modified: labs/jbossesb/branches/JBESB_4_10_CP/product/rosetta/src/org/jboss/internal/soa/esb/addressing/helpers/EPRHelper.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_10_CP/product/rosetta/src/org/jboss/internal/soa/esb/addressing/helpers/EPRHelper.java 2011-08-09 17:08:52 UTC (rev 37373)
+++ labs/jbossesb/branches/JBESB_4_10_CP/product/rosetta/src/org/jboss/internal/soa/esb/addressing/helpers/EPRHelper.java 2011-08-10 03:35:07 UTC (rev 37374)
@@ -43,7 +43,7 @@
public class EPRHelper
{
- public static final String EPR_TYPE = "type";
+ public static final String EPR_TYPE = EPR.EPR_TYPE;
private static final QName HEADER = new QName("header") ;
@@ -52,7 +52,6 @@
final EPR epr)
throws XMLStreamException
{
- setSpecificEPR(epr) ;
PortReferenceHelper.toXML(out, name, epr.getAddr()) ;
}
@@ -149,46 +148,6 @@
}
}
- private final static void setSpecificEPR(EPR epr)
- {
- String eprType = null;
-
- /*
- * Do not re-order.
- */
-
- if (epr instanceof InVMEpr)
- eprType = InVMEpr.type().toString();
- else if (epr instanceof EmailEpr)
- eprType = EmailEpr.type().toString();
- else if (epr instanceof FTPSEpr)
- eprType = FTPSEpr.type().toString();
- else if (epr instanceof SFTPEpr)
- eprType = SFTPEpr.type().toString();
- else if (epr instanceof HTTPEpr)
- eprType = HTTPEpr.type().toString();
- else if (epr instanceof JDBCEpr)
- eprType = JDBCEpr.type().toString();
- else if (epr instanceof HibernateEpr)
- eprType = HibernateEpr.type().toString();
- else if (epr instanceof JMSEpr)
- eprType = JMSEpr.type().toString();
- else if (epr instanceof FTPEpr)
- eprType = FTPEpr.type().toString();
- else if (epr instanceof FileEpr)
- eprType = FileEpr.type().toString();
- else if (epr instanceof LogicalEPR) {
- eprType = LogicalEPR.type().toString();
- }
-
- if (eprType != null)
- {
- if (epr.getAddr().getExtensionValue(EPR_TYPE) == null) {
- epr.getAddr().addExtension(EPR_TYPE, eprType);
- }
- }
- }
-
public final static EPR getSpecificEPR(EPR epr)
{
String eprType = epr.getAddr().getExtensionValue(EPR_TYPE);
Modified: labs/jbossesb/branches/JBESB_4_10_CP/product/rosetta/src/org/jboss/soa/esb/addressing/EPR.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_10_CP/product/rosetta/src/org/jboss/soa/esb/addressing/EPR.java 2011-08-09 17:08:52 UTC (rev 37373)
+++ labs/jbossesb/branches/JBESB_4_10_CP/product/rosetta/src/org/jboss/soa/esb/addressing/EPR.java 2011-08-10 03:35:07 UTC (rev 37374)
@@ -52,6 +52,15 @@
{
_addr = new PortReference();
}
+
+ /**
+ * Create a new Endpoint Reference with a null address.
+ */
+ protected EPR(final String type)
+ {
+ this() ;
+ setType(type) ;
+ }
/**
* Create a new Endpoint Reference with the specified address.
@@ -76,6 +85,18 @@
}
/**
+ * Create a new Endpoint Reference with the specified address.
+ *
+ * @param uri the specified address.
+ * @param type The EPR type
+ */
+ protected EPR(final URI uri, final String type)
+ {
+ this(uri) ;
+ setType(type) ;
+ }
+
+ /**
* Copy constructor.
*
* @param from
@@ -136,6 +157,15 @@
}
/**
+ * Set the EPR type.
+ * @param type
+ */
+ protected void setType(final String type)
+ {
+ getAddr().addExtension(EPR_TYPE, type) ;
+ }
+
+ /**
* Return a copy of this EPR.
*/
@@ -176,5 +206,6 @@
static protected final Logger _logger = Logger.getLogger(EPR.class);
private PortReference _addr;
+ public static final String EPR_TYPE = "type" ;
}
\ No newline at end of file
Modified: labs/jbossesb/branches/JBESB_4_10_CP/product/rosetta/src/org/jboss/soa/esb/addressing/eprs/EmailEpr.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_10_CP/product/rosetta/src/org/jboss/soa/esb/addressing/eprs/EmailEpr.java 2011-08-09 17:08:52 UTC (rev 37373)
+++ labs/jbossesb/branches/JBESB_4_10_CP/product/rosetta/src/org/jboss/soa/esb/addressing/eprs/EmailEpr.java 2011-08-10 03:35:07 UTC (rev 37374)
@@ -136,6 +136,7 @@
if (password != null)
addr.addExtension(PASSWORD_TAG, password);
+ addr.addExtension(EPR_TYPE, type().toString());
setAddr(addr);
}
else
Modified: labs/jbossesb/branches/JBESB_4_10_CP/product/rosetta/src/org/jboss/soa/esb/addressing/eprs/FTPEpr.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_10_CP/product/rosetta/src/org/jboss/soa/esb/addressing/eprs/FTPEpr.java 2011-08-09 17:08:52 UTC (rev 37373)
+++ labs/jbossesb/branches/JBESB_4_10_CP/product/rosetta/src/org/jboss/soa/esb/addressing/eprs/FTPEpr.java 2011-08-10 03:35:07 UTC (rev 37374)
@@ -133,14 +133,24 @@
*/
public FTPEpr (URI uri)
{
- super(uri);
+ this(uri, type().toString());
}
public FTPEpr (String url) throws URISyntaxException
{
- super(new URI(url));
+ this(new URI(url));
}
+ protected FTPEpr(final URI uri, final String type)
+ {
+ super(uri, type);
+ }
+
+ protected FTPEpr(final String url, final String type) throws URISyntaxException
+ {
+ this(new URI(url), type);
+ }
+
/**
* Set the URL for this endpoint.
*
@@ -151,6 +161,7 @@
public final void setURL (URL url)
{
super.setAddr(new PortReference(url.toString()));
+ setType(type().toString()) ;
}
/**
Modified: labs/jbossesb/branches/JBESB_4_10_CP/product/rosetta/src/org/jboss/soa/esb/addressing/eprs/FTPSEpr.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_10_CP/product/rosetta/src/org/jboss/soa/esb/addressing/eprs/FTPSEpr.java 2011-08-09 17:08:52 UTC (rev 37373)
+++ labs/jbossesb/branches/JBESB_4_10_CP/product/rosetta/src/org/jboss/soa/esb/addressing/eprs/FTPSEpr.java 2011-08-10 03:35:07 UTC (rev 37374)
@@ -89,12 +89,12 @@
public FTPSEpr(URI uri) throws URISyntaxException
{
- super(uri);
+ super(uri, type().toString());
}
public FTPSEpr(URI uri, URI cert, final String name) throws URISyntaxException
{
- super(uri);
+ this(uri);
if (cert != null)
{
@@ -108,7 +108,7 @@
public FTPSEpr(URI uri, String cert, final String name) throws URISyntaxException
{
- super(uri);
+ this(uri);
if (cert != null)
{
@@ -122,7 +122,7 @@
public FTPSEpr(String uri, String cert, final String name) throws URISyntaxException
{
- super(uri);
+ this(new URI(uri));
if(cert != null)
{
@@ -234,4 +234,4 @@
throw new ExceptionInInitializerError(ex.toString());
}
}
-}
\ No newline at end of file
+}
Modified: labs/jbossesb/branches/JBESB_4_10_CP/product/rosetta/src/org/jboss/soa/esb/addressing/eprs/FileEpr.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_10_CP/product/rosetta/src/org/jboss/soa/esb/addressing/eprs/FileEpr.java 2011-08-09 17:08:52 UTC (rev 37373)
+++ labs/jbossesb/branches/JBESB_4_10_CP/product/rosetta/src/org/jboss/soa/esb/addressing/eprs/FileEpr.java 2011-08-10 03:35:07 UTC (rev 37374)
@@ -181,9 +181,14 @@
public FileEpr (String url) throws URISyntaxException
{
- super(new URI(url));
+ this(new URI(url));
}
+ protected FileEpr(final URI uri, final String type)
+ {
+ super(uri, type) ;
+ }
+
/**
* Set the URL for this endpoint.
*
@@ -194,6 +199,7 @@
public void setURL (URL url)
{
super.setAddr(new PortReference(url.toString()));
+ setType(type().toString()) ;
}
/**
@@ -485,7 +491,7 @@
public FileEpr (URI uri)
{
- super(uri);
+ this(uri, type().toString());
}
private boolean inputSet = false;
@@ -513,4 +519,4 @@
throw new ExceptionInInitializerError(ex.toString());
}
}
-}
\ No newline at end of file
+}
Modified: labs/jbossesb/branches/JBESB_4_10_CP/product/rosetta/src/org/jboss/soa/esb/addressing/eprs/HTTPEpr.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_10_CP/product/rosetta/src/org/jboss/soa/esb/addressing/eprs/HTTPEpr.java 2011-08-09 17:08:52 UTC (rev 37373)
+++ labs/jbossesb/branches/JBESB_4_10_CP/product/rosetta/src/org/jboss/soa/esb/addressing/eprs/HTTPEpr.java 2011-08-10 03:35:07 UTC (rev 37374)
@@ -71,12 +71,12 @@
*/
public HTTPEpr (URI uri)
{
- super(uri);
+ super(uri, type().toString());
}
public HTTPEpr (String url) throws URISyntaxException
{
- super(new URI(url));
+ this(new URI(url));
}
/**
@@ -89,6 +89,7 @@
public final void setURL (URL url)
{
super.setAddr(new PortReference(url.toString()));
+ setType(type().toString()) ;
}
/**
@@ -142,4 +143,4 @@
throw new ExceptionInInitializerError(ex.toString());
}
}
-}
\ No newline at end of file
+}
Modified: labs/jbossesb/branches/JBESB_4_10_CP/product/rosetta/src/org/jboss/soa/esb/addressing/eprs/InVMEpr.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_10_CP/product/rosetta/src/org/jboss/soa/esb/addressing/eprs/InVMEpr.java 2011-08-09 17:08:52 UTC (rev 37373)
+++ labs/jbossesb/branches/JBESB_4_10_CP/product/rosetta/src/org/jboss/soa/esb/addressing/eprs/InVMEpr.java 2011-08-10 03:35:07 UTC (rev 37374)
@@ -130,7 +130,7 @@
public InVMEpr(URI uri) throws URISyntaxException
{
- super(uri);
+ super(uri, type().toString());
String serviceId = uri.getHost();
String lockstep = uri.getQuery();
Modified: labs/jbossesb/branches/JBESB_4_10_CP/product/rosetta/src/org/jboss/soa/esb/addressing/eprs/JDBCEpr.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_10_CP/product/rosetta/src/org/jboss/soa/esb/addressing/eprs/JDBCEpr.java 2011-08-09 17:08:52 UTC (rev 37373)
+++ labs/jbossesb/branches/JBESB_4_10_CP/product/rosetta/src/org/jboss/soa/esb/addressing/eprs/JDBCEpr.java 2011-08-10 03:35:07 UTC (rev 37374)
@@ -178,7 +178,7 @@
public JDBCEpr (String url, String sql) throws URISyntaxException
{
- super(new URI(url));
+ this(new URI(url));
setSQL(sql);
}
@@ -190,13 +190,18 @@
public JDBCEpr (String url, boolean postDelete, boolean errorDelete) throws URISyntaxException
{
- super(new URI(url));
+ this(new URI(url));
if (postDelete)
getAddr().addExtension(POST_DEL_TAG,Boolean.toString(postDelete));
if (errorDelete)
getAddr().addExtension(ERROR_DEL_TAG,Boolean.toString(errorDelete));
}
+ protected JDBCEpr(final URI uri)
+ {
+ super(uri, type().toString());
+ }
+
public EPR copy ()
{
return new JDBCEpr(this);
@@ -211,6 +216,7 @@
public final void setURL (String url)
{
super.setAddr(new PortReference(url));
+ setType(type().toString()) ;
}
/**
@@ -578,4 +584,4 @@
}
}
-}
\ No newline at end of file
+}
Modified: labs/jbossesb/branches/JBESB_4_10_CP/product/rosetta/src/org/jboss/soa/esb/addressing/eprs/JMSEpr.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_10_CP/product/rosetta/src/org/jboss/soa/esb/addressing/eprs/JMSEpr.java 2011-08-09 17:08:52 UTC (rev 37373)
+++ labs/jbossesb/branches/JBESB_4_10_CP/product/rosetta/src/org/jboss/soa/esb/addressing/eprs/JMSEpr.java 2011-08-10 03:35:07 UTC (rev 37374)
@@ -577,6 +577,7 @@
addr.addExtension(JMS_SECURITY_CREDENTIAL_TAG, password);
addr.addExtension(TRANSACTED_TAG, String.valueOf(transacted));
+ addr.addExtension(EPR_TYPE, type().toString());
}
else
throw new IllegalArgumentException("Invalid destination type! "+destinationType);
Modified: labs/jbossesb/branches/JBESB_4_10_CP/product/rosetta/src/org/jboss/soa/esb/addressing/eprs/LogicalEPR.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_10_CP/product/rosetta/src/org/jboss/soa/esb/addressing/eprs/LogicalEPR.java 2011-08-09 17:08:52 UTC (rev 37373)
+++ labs/jbossesb/branches/JBESB_4_10_CP/product/rosetta/src/org/jboss/soa/esb/addressing/eprs/LogicalEPR.java 2011-08-10 03:35:07 UTC (rev 37374)
@@ -44,20 +44,22 @@
private ServiceInvoker serviceInvoker;
public LogicalEPR() {
- super();
+ super(type().toString()) ;
}
public LogicalEPR(PortReference addr) {
this(new EPR(addr)) ;
+ setType(type().toString()) ;
}
public LogicalEPR(URI uri) {
- this(new EPR(uri)) ;
+ super(uri, type().toString()) ;
+ assertValidLogicalURI(URI.create(((PortReference)AssertArgument.isNotNull(getAddr(), "addr")).getAddress()));
}
public LogicalEPR(final EPR epr) {
super(epr);
- assertValidLogicalURI(URI.create(((PortReference)AssertArgument.isNotNull(epr.getAddr(), "addr")).getAddress()));
+ assertValidLogicalURI(URI.create(((PortReference)AssertArgument.isNotNull(getAddr(), "addr")).getAddress()));
}
public LogicalEPR(final EPR epr, final Element header) {
@@ -65,7 +67,7 @@
}
public LogicalEPR(String serviceCategory, String serviceName) {
- super(toLogicalURI(serviceCategory, serviceName));
+ this(toLogicalURI(serviceCategory, serviceName));
}
public void setAddr(PortReference addr) {
Modified: labs/jbossesb/branches/JBESB_4_10_CP/product/rosetta/src/org/jboss/soa/esb/addressing/eprs/SFTPEpr.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_10_CP/product/rosetta/src/org/jboss/soa/esb/addressing/eprs/SFTPEpr.java 2011-08-09 17:08:52 UTC (rev 37373)
+++ labs/jbossesb/branches/JBESB_4_10_CP/product/rosetta/src/org/jboss/soa/esb/addressing/eprs/SFTPEpr.java 2011-08-10 03:35:07 UTC (rev 37374)
@@ -96,7 +96,7 @@
*/
public SFTPEpr(URI uri)
{
- super(uri);
+ super(uri, type().toString());
}
/**
@@ -107,7 +107,7 @@
*/
public SFTPEpr(URI uri, URI cert) throws URISyntaxException
{
- super(uri) ;
+ this(uri) ;
setCertificateURI(cert);
}
@@ -121,7 +121,7 @@
*/
public SFTPEpr(URI uri, URI cert, final String passphrase) throws URISyntaxException
{
- super(uri) ;
+ this(uri) ;
setCertificateURI(cert);
setPassphrase(passphrase) ;
@@ -129,14 +129,14 @@
public SFTPEpr(String url, String cert) throws URISyntaxException
{
- super(url);
+ this(new URI(url));
setCertificateURI(new URI(cert));
}
public SFTPEpr(String url, String cert, final String passphrase) throws URISyntaxException
{
- super(url);
+ this(new URI(url));
setCertificateURI(new URI(cert));
setPassphrase(passphrase) ;
Modified: labs/jbossesb/branches/JBESB_4_10_CP/product/rosetta/tests/src/org/jboss/soa/esb/addressing/tests/EPRUnitTest.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_10_CP/product/rosetta/tests/src/org/jboss/soa/esb/addressing/tests/EPRUnitTest.java 2011-08-09 17:08:52 UTC (rev 37373)
+++ labs/jbossesb/branches/JBESB_4_10_CP/product/rosetta/tests/src/org/jboss/soa/esb/addressing/tests/EPRUnitTest.java 2011-08-10 03:35:07 UTC (rev 37374)
@@ -24,7 +24,10 @@
import java.io.StringReader;
import java.io.StringWriter;
+import java.net.MalformedURLException;
import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.Properties;
import javax.xml.namespace.QName;
import javax.xml.stream.XMLStreamReader;
@@ -40,6 +43,16 @@
import org.jboss.soa.esb.addressing.PortReference;
import org.jboss.soa.esb.addressing.XMLUtil;
import org.jboss.soa.esb.addressing.eprs.EmailEpr;
+import org.jboss.soa.esb.addressing.eprs.FTPEpr;
+import org.jboss.soa.esb.addressing.eprs.FTPSEpr;
+import org.jboss.soa.esb.addressing.eprs.FileEpr;
+import org.jboss.soa.esb.addressing.eprs.HTTPEpr;
+import org.jboss.soa.esb.addressing.eprs.InVMEpr;
+import org.jboss.soa.esb.addressing.eprs.JDBCEpr;
+import org.jboss.soa.esb.addressing.eprs.JMSEpr;
+import org.jboss.soa.esb.addressing.eprs.LogicalEPR;
+import org.jboss.soa.esb.addressing.eprs.SFTPEpr;
+import org.jboss.soa.esb.addressing.eprs.JMSEpr.AcknowledgeMode;
import org.jboss.soa.esb.message.tests.XMLMessageUnitTest;
/**
@@ -165,4 +178,109 @@
fail(ex.toString());
}
}
+
+ public void testEmailEprType()
+ {
+ testEprType(EmailEpr.type().toString(), new EmailEpr(EmailEpr.SMTP_PROTOCOL, "host")) ;
+ testEprType(EmailEpr.type().toString(), new EmailEpr(EmailEpr.SMTP_PROTOCOL, "host", "port", "username", "passwod")) ;
+ }
+
+ public void testFileEprType()
+ throws MalformedURLException, URISyntaxException
+ {
+ testEprType(FileEpr.type().toString(), new FileEpr("file://url")) ;
+ testEprType(FileEpr.type().toString(), new FileEpr(URI.create("file://uri"))) ;
+ testEprType(FileEpr.type().toString(), new FileEpr(URI.create("file://url").toURL())) ;
+ }
+
+ public void testFTPEprType()
+ throws MalformedURLException, URISyntaxException
+ {
+ testEprType(FTPEpr.type().toString(), new FTPEpr("file://url")) ;
+ testEprType(FTPEpr.type().toString(), new FTPEpr(URI.create("ftp://uri"))) ;
+ testEprType(FTPEpr.type().toString(), new FTPEpr(URI.create("ftp://url").toURL())) ;
+ }
+
+ public void testFTPSEprType()
+ throws URISyntaxException
+ {
+ testEprType(FTPSEpr.type().toString(), new FTPSEpr("uri", "cert", "name")) ;
+ testEprType(FTPSEpr.type().toString(), new FTPSEpr(URI.create("uri"))) ;
+ testEprType(FTPSEpr.type().toString(), new FTPSEpr(URI.create("uri"), "cert", "name")) ;
+ testEprType(FTPSEpr.type().toString(), new FTPSEpr(URI.create("uri"), URI.create("cert"), "name")) ;
+ }
+
+ public void testSFTPEprType()
+ throws URISyntaxException
+ {
+ testEprType(SFTPEpr.type().toString(), new SFTPEpr("url", "cert")) ;
+ testEprType(SFTPEpr.type().toString(), new SFTPEpr("url", "cert", "passphrase")) ;
+ testEprType(SFTPEpr.type().toString(), new SFTPEpr(URI.create("uri"))) ;
+ testEprType(SFTPEpr.type().toString(), new SFTPEpr(URI.create("uri"), URI.create("cert"))) ;
+ testEprType(SFTPEpr.type().toString(), new SFTPEpr(URI.create("uri"), URI.create("cert"), "passphrase")) ;
+ }
+
+ public void testHTTPEprType()
+ throws URISyntaxException, MalformedURLException
+ {
+ testEprType(HTTPEpr.type().toString(), new HTTPEpr("http://url")) ;
+ testEprType(HTTPEpr.type().toString(), new HTTPEpr(URI.create("http://uri"))) ;
+ testEprType(HTTPEpr.type().toString(), new HTTPEpr(URI.create("http://url").toURL())) ;
+ }
+
+ public void testInVMEprType()
+ throws URISyntaxException
+ {
+ testEprType(InVMEpr.type().toString(), new InVMEpr(URI.create(InVMEpr.INVM_PROTOCOL + "://thread-" + Thread.currentThread().getId()))) ;
+ }
+
+ public void testJDBCEprType()
+ throws URISyntaxException
+ {
+ testEprType(JDBCEpr.type().toString(), new JDBCEpr("url")) ;
+ testEprType(JDBCEpr.type().toString(), new JDBCEpr("url", "sql")) ;
+ testEprType(JDBCEpr.type().toString(), new JDBCEpr("url", true, true)) ;
+ }
+
+ public void testJMSEprType()
+ {
+ testEprType(JMSEpr.type().toString(), new JMSEpr(JMSEpr.QUEUE_TYPE, "destinationName",
+ "connection")) ;
+ testEprType(JMSEpr.type().toString(), new JMSEpr(JMSEpr.QUEUE_TYPE, "destinationName",
+ "connection", new Properties(), "messageSelector")) ;
+ testEprType(JMSEpr.type().toString(), new JMSEpr(JMSEpr.ONE_ONE_PROTOCOL, JMSEpr.QUEUE_TYPE,
+ "destinationName", "connection", new Properties(), "messageSelector")) ;
+ testEprType(JMSEpr.type().toString(), new JMSEpr(JMSEpr.ONE_ONE_PROTOCOL, JMSEpr.QUEUE_TYPE,
+ "destinationName", "connection", new Properties(), "messageSelector", true)) ;
+ testEprType(JMSEpr.type().toString(), new JMSEpr(JMSEpr.ONE_ONE_PROTOCOL, JMSEpr.QUEUE_TYPE,
+ "destinationName", "connection", new Properties(), "messageSelector", true, true)) ;
+ testEprType(JMSEpr.type().toString(), new JMSEpr(JMSEpr.ONE_ONE_PROTOCOL, JMSEpr.QUEUE_TYPE,
+ "destinationName", "connection", new Properties(), "messageSelector", true,
+ AcknowledgeMode.AUTO_ACKNOWLEDGE.name(), true)) ;
+ testEprType(JMSEpr.type().toString(), new JMSEpr(JMSEpr.ONE_ONE_PROTOCOL, JMSEpr.QUEUE_TYPE,
+ "destinationName", "connection", new Properties(), "messageSelector", true,
+ AcknowledgeMode.AUTO_ACKNOWLEDGE.name())) ;
+ testEprType(JMSEpr.type().toString(), new JMSEpr(JMSEpr.ONE_ONE_PROTOCOL, JMSEpr.QUEUE_TYPE,
+ "destinationName", "connection", new Properties(), "messageSelector", true,
+ AcknowledgeMode.AUTO_ACKNOWLEDGE.name(), "username", "password")) ;
+ testEprType(JMSEpr.type().toString(), new JMSEpr(JMSEpr.ONE_ONE_PROTOCOL, JMSEpr.QUEUE_TYPE,
+ "destinationName", "connection", new Properties(), "messageSelector", true,
+ AcknowledgeMode.AUTO_ACKNOWLEDGE.name(), "username", "password", true)) ;
+ }
+
+ public void testLogicalEPRType()
+ throws URISyntaxException
+ {
+ testEprType(LogicalEPR.type().toString(), new LogicalEPR()) ;
+ testEprType(LogicalEPR.type().toString(), new LogicalEPR(new PortReference("logical:category#name"))) ;
+ testEprType(LogicalEPR.type().toString(), new LogicalEPR(new URI("logical:category#name"))) ;
+ testEprType(LogicalEPR.type().toString(), new LogicalEPR("serviceCategory", "serviceName")) ;
+ }
+
+ private void testEprType(final String type, final EPR epr)
+ {
+ final String eprType = epr.getAddr().getExtensionValue(EPR.EPR_TYPE) ;
+ assertNotNull("EPR type not set", eprType) ;
+ assertEquals("EPR type not correct", type, eprType) ;
+ }
}
Modified: labs/jbossesb/branches/JBESB_4_10_CP/product/rosetta/tests/src/org/jboss/soa/esb/addressing/util/tests/EPRHelperUnitTest.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_10_CP/product/rosetta/tests/src/org/jboss/soa/esb/addressing/util/tests/EPRHelperUnitTest.java 2011-08-09 17:08:52 UTC (rev 37373)
+++ labs/jbossesb/branches/JBESB_4_10_CP/product/rosetta/tests/src/org/jboss/soa/esb/addressing/util/tests/EPRHelperUnitTest.java 2011-08-10 03:35:07 UTC (rev 37374)
@@ -22,6 +22,9 @@
package org.jboss.soa.esb.addressing.util.tests;
+import java.net.URI;
+import java.net.URISyntaxException;
+
import junit.framework.TestCase;
import org.apache.log4j.Logger;
@@ -30,6 +33,7 @@
import org.jboss.soa.esb.UnmarshalException;
import org.jboss.soa.esb.addressing.EPR;
import org.jboss.soa.esb.addressing.eprs.EmailEpr;
+import org.jboss.soa.esb.addressing.eprs.InVMEpr;
import org.jboss.soa.esb.message.tests.XMLMessageUnitTest;
/**
@@ -59,4 +63,12 @@
fail();
}
+ public void testModification()
+ throws URISyntaxException, MarshalException
+ {
+ final InVMEpr epr = new InVMEpr(URI.create(InVMEpr.INVM_PROTOCOL + "://thread-" + Thread.currentThread().getId())) ;
+ final InVMEpr clone = new InVMEpr(epr) ;
+ final String xml = EPRHelper.toXMLString(epr) ;
+ assertEquals("EPR modified", clone, epr) ;
+ }
}
More information about the jboss-svn-commits
mailing list