This is an automated email from the ASF dual-hosted git repository.

billblough pushed a commit to branch RAMPART-426
in repository https://gitbox.apache.org/repos/asf/axis-axis2-java-rampart.git

commit a14e7203a1566e011cb2791bd1606cc0b84d5fd4
Merge: 7516f46 d7fea53
Author: Andreas Veithen <veit...@apache.org>
AuthorDate: Sun Jan 29 10:45:09 2017 +0000

    Merge latest changes from trunk.

 .../java/org/apache/rampart/RampartEngineTest.java | 62 +++++++++++-----------
 1 file changed, 31 insertions(+), 31 deletions(-)

diff --cc 
modules/rampart-tests/src/test/java/org/apache/rampart/RampartEngineTest.java
index 603dae1,77e54d7..05f14c9
--- 
a/modules/rampart-tests/src/test/java/org/apache/rampart/RampartEngineTest.java
+++ 
b/modules/rampart-tests/src/test/java/org/apache/rampart/RampartEngineTest.java
@@@ -26,63 -26,42 +26,63 @@@ import org.apache.axis2.context.Message
  import org.apache.neethi.Policy;
  import org.apache.ws.security.WSConstants;
  import org.apache.ws.security.WSSecurityEngineResult;
+ import org.junit.Test;
+ import org.junit.runner.RunWith;
+ import org.junit.runners.JUnit4;
  
+ @RunWith(JUnit4.class)
  public class RampartEngineTest extends MessageBuilderTestBase {
- 
-     public RampartEngineTest(String name) {
-         super(name);
-     }
- 
+     /**
+      * Tests that Rampart complains about missing security header in request.
+      * 
+      * @throws Exception
+      */
+     @Test(expected=RampartException.class)
      public void testEmptySOAPMessage() throws Exception {
+         MessageContext ctx = getMsgCtx();
  
-         try {
-             MessageContext ctx = getMsgCtx();
+         String policyXml = 
"test-resources/policy/rampart-asymm-binding-6-3des-r15.xml";
+         Policy policy = this.loadPolicy(policyXml);
  
-             String policyXml = 
"test-resources/policy/rampart-asymm-binding-6-3des-r15.xml";
-             Policy policy = this.loadPolicy(policyXml);
- 
-             ctx.setProperty(RampartMessageData.KEY_RAMPART_POLICY, policy);
+         ctx.setProperty(RampartMessageData.KEY_RAMPART_POLICY, policy);
  
-             RampartEngine engine = new RampartEngine();
-             engine.process(ctx);
-         }
-         catch (RampartException e) {
-             assertEquals("Expected rampart to complain about missing security 
header",
-                          "Missing wsse:Security header in request", 
e.getMessage());
-         }
+         RampartEngine engine = new RampartEngine();
+         engine.process(ctx);
      }
  
+     @Test
      public void testValidSOAPMessage() throws Exception {
-       runValidRampartProcessing(getMsgCtx(), 
"test-resources/policy/rampart-asymm-binding-6-3des-r15.xml");
+         runRampartEngine(getMsgCtx(), 
"test-resources/policy/rampart-asymm-binding-6-3des-r15.xml");
      }
  
+     @Test
      public void testValidSOAP12Message() throws Exception {
-         runValidRampartProcessing(getMsgCtx12(), 
"test-resources/policy/rampart-asymm-binding-6-3des-r15.xml");
+         runRampartEngine(getMsgCtx12(), 
"test-resources/policy/rampart-asymm-binding-6-3des-r15.xml");
      }
 -
 +    
++    @Test
 +    public void testValidSOAPMessageWithActor() throws Exception {
-       runValidRampartProcessing(getMsgCtx(), 
"test-resources/policy/rampart-asymm-binding-6-3des-r15-inbound-outbound-actor.xml");
++        runRampartEngine(getMsgCtx(), 
"test-resources/policy/rampart-asymm-binding-6-3des-r15-inbound-outbound-actor.xml");
 +    }
 +    
++    @Test
 +    public void testValidSOAP12MessageWithRole() throws Exception {
-       runValidRampartProcessing(getMsgCtx12(), 
"test-resources/policy/rampart-asymm-binding-6-3des-r15-inbound-outbound-actor.xml");
++        runRampartEngine(getMsgCtx12(), 
"test-resources/policy/rampart-asymm-binding-6-3des-r15-inbound-outbound-actor.xml");
 +    }
 +    
++    @Test
 +    public void testMissingSOAPInboundActor() throws Exception {
-       runValidRampartProcessing(getMsgCtx(), 
"test-resources/policy/rampart-asymm-binding-6-3des-r15-outbound-actor.xml");
++        runRampartEngine(getMsgCtx(), 
"test-resources/policy/rampart-asymm-binding-6-3des-r15-outbound-actor.xml");
 +    }
 +    
++    // Failure is expected because no outbound actor is set.
++    @Test(expected=RampartException.class)
 +    public void testMissingSOAPOutboundActor() throws Exception {
-       try{
-               runValidRampartProcessing(getMsgCtx(), 
"test-resources/policy/rampart-asymm-binding-6-3des-r15-inbound-actor.xml");
-               fail("Failure is expected because no outbound actor is set.");
-       }catch(RampartException e){
-               assertNotNull(e);
-       }
++        runRampartEngine(getMsgCtx(), 
"test-resources/policy/rampart-asymm-binding-6-3des-r15-inbound-actor.xml");
 +    }
 +    
-     private void runValidRampartProcessing(MessageContext ctx, String 
policyXmlPath) throws Exception{        
-         Policy policy = loadPolicy(policyXmlPath);
+     private void runRampartEngine(MessageContext ctx, String policyXml) 
throws Exception {
+         Policy policy = loadPolicy(policyXml);
  
          ctx.setProperty(RampartMessageData.KEY_RAMPART_POLICY, policy);
  

Reply via email to