cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ff...@apache.org
Subject svn commit: r547549 - in /incubator/cxf/trunk/rt/bindings/jbi/src: main/java/org/apache/cxf/binding/jbi/interceptor/Messages.properties test/java/org/apache/cxf/binding/jbi/interceptor/JBIOperationInInterceptorTest.java
Date Fri, 15 Jun 2007 06:39:14 GMT
Author: ffang
Date: Thu Jun 14 23:39:13 2007
New Revision: 547549

URL: http://svn.apache.org/viewvc?view=rev&rev=547549
Log:
enable ignored test for JBI binding

Modified:
    incubator/cxf/trunk/rt/bindings/jbi/src/main/java/org/apache/cxf/binding/jbi/interceptor/Messages.properties
    incubator/cxf/trunk/rt/bindings/jbi/src/test/java/org/apache/cxf/binding/jbi/interceptor/JBIOperationInInterceptorTest.java

Modified: incubator/cxf/trunk/rt/bindings/jbi/src/main/java/org/apache/cxf/binding/jbi/interceptor/Messages.properties
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/jbi/src/main/java/org/apache/cxf/binding/jbi/interceptor/Messages.properties?view=diff&rev=547549&r1=547548&r2=547549
==============================================================================
--- incubator/cxf/trunk/rt/bindings/jbi/src/main/java/org/apache/cxf/binding/jbi/interceptor/Messages.properties
(original)
+++ incubator/cxf/trunk/rt/bindings/jbi/src/main/java/org/apache/cxf/binding/jbi/interceptor/Messages.properties
Thu Jun 14 23:39:13 2007
@@ -44,3 +44,4 @@
 JBI.TRANSPORT.FACTORY.NOT.FULLY.INITIALIZED=JBITransport factory not fully initalised
 CREATE.SERVER.TRANSPORT=creating JBI server transport
 CREATE.CLIENT.TRANSPORT=creating JBI client transport
+UNKNOWN_OPERATION=unknown operation {0}
\ No newline at end of file

Modified: incubator/cxf/trunk/rt/bindings/jbi/src/test/java/org/apache/cxf/binding/jbi/interceptor/JBIOperationInInterceptorTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/jbi/src/test/java/org/apache/cxf/binding/jbi/interceptor/JBIOperationInInterceptorTest.java?view=diff&rev=547549&r1=547548&r2=547549
==============================================================================
--- incubator/cxf/trunk/rt/bindings/jbi/src/test/java/org/apache/cxf/binding/jbi/interceptor/JBIOperationInInterceptorTest.java
(original)
+++ incubator/cxf/trunk/rt/bindings/jbi/src/test/java/org/apache/cxf/binding/jbi/interceptor/JBIOperationInInterceptorTest.java
Thu Jun 14 23:39:13 2007
@@ -19,41 +19,61 @@
 package org.apache.cxf.binding.jbi.interceptor;
 
 
+import java.util.ResourceBundle;
+import java.util.logging.Logger;
+
 import javax.jbi.messaging.MessageExchange;
 import javax.xml.namespace.QName;
 
+import org.apache.cxf.binding.jbi.JBIBindingInfo;
+import org.apache.cxf.binding.jbi.JBIConstants;
 import org.apache.cxf.binding.jbi.JBIMessage;
+import org.apache.cxf.common.i18n.Message;
+import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.endpoint.Endpoint;
+import org.apache.cxf.endpoint.EndpointImpl;
+import org.apache.cxf.interceptor.Fault;
 import org.apache.cxf.message.ExchangeImpl;
 import org.apache.cxf.message.MessageImpl;
 import org.apache.cxf.phase.Phase;
 import org.apache.cxf.phase.PhaseInterceptor;
+import org.apache.cxf.service.model.EndpointInfo;
 import org.easymock.classextension.EasyMock;
 import org.junit.Assert;
-import org.junit.Ignore;
 import org.junit.Test;
 
 public class JBIOperationInInterceptorTest extends Assert {
 
+    private static final Logger LOG = LogUtils.getL7dLogger(JBIOperationInInterceptor.class);
+    private static final ResourceBundle BUNDLE = LOG.getResourceBundle();
+    
     @Test
     public void testPhase() throws Exception {
         PhaseInterceptor<JBIMessage> interceptor = new JBIOperationInInterceptor();
         assertEquals(Phase.PRE_PROTOCOL, interceptor.getPhase());
     }
     
-    @Ignore
-    public void testOperation() throws Exception {
+    @Test
+    public void testUnknownOperation() throws Exception {
         PhaseInterceptor<JBIMessage> interceptor = new JBIOperationInInterceptor();
         JBIMessage msg = new JBIMessage(new MessageImpl());
         MessageExchange me = EasyMock.createMock(MessageExchange.class);
-        EasyMock.expect(me.getOperation()).andReturn(new QName("urn:test", "SayHi"));
+        EasyMock.expect(me.getOperation()).andReturn(new QName("urn:test", "SayHi")).times(4);
         EasyMock.replay(me);
         msg.put(MessageExchange.class, me);
-        Endpoint ep = null;
-        msg.getExchange().put(Endpoint.class, ep);
+        EndpointInfo endpointInfo = new EndpointInfo();
+        endpointInfo.setBinding(new JBIBindingInfo(null, JBIConstants.NS_JBI_BINDING));
+        Endpoint ep = new EndpointImpl(null, null, endpointInfo);
         msg.setExchange(new ExchangeImpl());
-        
-        interceptor.handleMessage(msg);
+        msg.getExchange().put(Endpoint.class, ep);
+        try { 
+            interceptor.handleMessage(msg);
+            fail("shouldn't found SayHi operation");
+        } catch (Fault fault) {
+            LOG.info(fault.getMessage());
+            assertEquals(fault.getMessage(), new Message("UNKNOWN_OPERATION", BUNDLE, 
+                                                 msg.getJbiExchange().getOperation().toString()).toString());
+        }
     }
     
     



Mime
View raw message