[jboss-svn-commits] JBL Code SVN: r24480 - in labs/jbossesb/trunk/product/rosetta: tests/src/org/jboss/soa/esb/services/security/auth/ws and 1 other directory.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Tue Dec 23 09:45:05 EST 2008


Author: beve
Date: 2008-12-23 09:45:05 -0500 (Tue, 23 Dec 2008)
New Revision: 24480

Modified:
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/JBossRemotingGatewayListener.java
   labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/services/security/auth/ws/WSSecurityInfoExtractorUnitTest.java
Log:
Work for https://jira.jboss.org/jira/browse/JBESB-2252 "JBossRemotingMessageComposer should have the security extractors as fields and not create them everytime."


Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/JBossRemotingGatewayListener.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/JBossRemotingGatewayListener.java	2008-12-23 14:31:22 UTC (rev 24479)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/JBossRemotingGatewayListener.java	2008-12-23 14:45:05 UTC (rev 24480)
@@ -487,6 +487,10 @@
     public static class JBossRemotingMessageComposer<T extends InvocationRequest> extends AbstractMessageComposer<T> {
 
         private MessagePayloadProxy payloadProxy;
+        
+        private JbrHttpSecurityInfoExtractor jbrHttpSecurityExtractor = new JbrHttpSecurityInfoExtractor();
+        
+        private WSSecurityInfoExtractor wsSecurityExtractor = new WSSecurityInfoExtractor();
 
         @Override
         public void setConfiguration(ConfigTree config) {
@@ -516,11 +520,11 @@
 
             if (properties != null) {
                 //	Extract any jbr http security information that may exist
-                AuthenticationRequest authRequest = new JbrHttpSecurityInfoExtractor().extractSecurityInfo(properties);
+                AuthenticationRequest authRequest = jbrHttpSecurityExtractor.extractSecurityInfo(properties);
 
                 // Extract any ws security information that may exist
                 if ( authRequest == null ) {
-                	authRequest = new WSSecurityInfoExtractor().extractSecurityInfo((String) invocationRequest.getParameter());
+                	authRequest = wsSecurityExtractor.extractSecurityInfo((String) invocationRequest.getParameter());
                 }
 
                 if ( authRequest != null ) {

Modified: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/services/security/auth/ws/WSSecurityInfoExtractorUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/services/security/auth/ws/WSSecurityInfoExtractorUnitTest.java	2008-12-23 14:31:22 UTC (rev 24479)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/services/security/auth/ws/WSSecurityInfoExtractorUnitTest.java	2008-12-23 14:45:05 UTC (rev 24480)
@@ -36,6 +36,7 @@
 import org.jboss.soa.esb.ConfigurationException;
 import org.jboss.soa.esb.services.security.auth.AuthenticationRequest;
 import org.jboss.soa.esb.util.ClassUtil;
+import org.junit.Before;
 import org.junit.Test;
 import org.xml.sax.SAXException;
 
@@ -49,10 +50,11 @@
  */
 public class WSSecurityInfoExtractorUnitTest
 {
-	@Test
+	private WSSecurityInfoExtractor extractor;
+
+    @Test
 	public void extractUserPassSecurityInfo() throws SAXException, IOException, ParserConfigurationException, ConfigurationException
 	{
-		WSSecurityInfoExtractor extractor = new WSSecurityInfoExtractor("smooks-config.xml");
 		String soap = createUserPassSoapString();
 		AuthenticationRequest authRequest = extractor.extractSecurityInfo(soap);
 		assertNotNull(authRequest);
@@ -62,7 +64,6 @@
 	@Test
 	public void extractKeySecurityInfo() throws SAXException, IOException, ParserConfigurationException, ConfigurationException
 	{
-		WSSecurityInfoExtractor extractor = new WSSecurityInfoExtractor("smooks-config.xml");
 		String soap = createKeySoapString("soap-keys-example.xml");
 		AuthenticationRequest authRequest = extractor.extractSecurityInfo(soap);
 		assertNotNull(authRequest);
@@ -74,7 +75,6 @@
 	@Test
 	public void extractKeySecurityInfo2() throws SAXException, IOException, ParserConfigurationException, ConfigurationException
 	{
-		WSSecurityInfoExtractor extractor = new WSSecurityInfoExtractor("smooks-config.xml");
 		String soap = createKeySoapString("soap-keys-example2.xml");
 		AuthenticationRequest authRequest = extractor.extractSecurityInfo(soap);
 		assertNotNull(authRequest);
@@ -86,7 +86,6 @@
 	@Test
 	public void extractKeySecurityInfoUsingStringInput() throws SAXException, IOException, ParserConfigurationException, ConfigurationException
 	{
-		WSSecurityInfoExtractor extractor = new WSSecurityInfoExtractor("smooks-config.xml");
 		String soap = "some payload";
 		AuthenticationRequest authRequest = extractor.extractSecurityInfo(soap);
 		assertNull(authRequest);
@@ -95,7 +94,6 @@
 	@Test
 	public void extractKeySecurityInfoUsingNullInput() throws SAXException, IOException, ParserConfigurationException, ConfigurationException
 	{
-		WSSecurityInfoExtractor extractor = new WSSecurityInfoExtractor("smooks-config.xml");
 		String soap = null;
 		AuthenticationRequest authRequest = extractor.extractSecurityInfo(soap);
 		assertNull(authRequest);
@@ -116,6 +114,12 @@
 		InputStream inputStream = ClassUtil.getResourceAsStream(fileName, getClass() );
 		return new String(StreamUtils.readStream(inputStream));
 	}
+	
+	@Before
+	public void createInstance()
+	{
+		extractor = new WSSecurityInfoExtractor("smooks-config.xml");
+	}
 
 	public static junit.framework.Test suite()
 	{




More information about the jboss-svn-commits mailing list