1   /*
2    * $Id: UsernameTokenTestCase.java 11366 2008-03-14 11:48:22Z dirk.olmes $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com
5    *
6    * The software in this package is published under the terms of the CPAL v1.0
7    * license, a copy of which has been included with this distribution in the
8    * LICENSE.txt file.
9    */
10  
11  package org.mule.transport.cxf.wssec;
12  import org.mule.tck.FunctionalTestCase;
13  
14  import org.apache.hello_world_soap_http.GreeterImpl;
15  
16  public class UsernameTokenTestCase extends FunctionalTestCase
17  {
18      public void testUsernameToken() throws Exception
19      {
20          ClientPasswordCallback.setPassword("password");
21          
22          GreeterImpl impl = getGreeter();
23          
24          int i = 0;
25          while (i < 100)
26          {
27              if (impl.getInvocationCount() > 0)
28              {
29                  break;
30              }
31              Thread.sleep(50);
32          }
33          
34          assertEquals(1, impl.getInvocationCount());
35      }
36  
37      private GreeterImpl getGreeter() throws Exception
38      {
39          Object instance = getComponent("greeterService");
40          
41          return (GreeterImpl) instance;
42      }
43  
44      protected String getConfigResources()
45      {
46          return "org/mule/transport/cxf/wssec/username-token-conf.xml";
47      }
48      
49  }
50  
51