View Javadoc

1   /*
2    * Copyright 2004-2006 The Apache Software Foundation.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.apache.myfaces.shared.util;
17  
18  import junit.framework.Test;
19  
20  /**
21   * This TestCase uses the the default algorithm/mode/padding of
22   * StateUtils.
23   */
24  
25  public class StateUtilsDefaultTest extends AbstractStateUtilsTest
26  {
27  
28      public StateUtilsDefaultTest(String name) {
29          super(name);
30      }
31  
32      // No longer necessary using junit 4 to run tests
33      //public static Test suite() {
34      //    return null; // keep this method or maven won't run it
35      //}
36  
37      public void setUp() throws Exception
38      {
39          super.setUp();
40  
41          servletContext.addInitParameter(StateUtils.INIT_SECRET, BASE64_KEY_SIZE_8);
42          servletContext.addInitParameter(StateUtils.INIT_ALGORITHM, StateUtils.DEFAULT_ALGORITHM);
43          servletContext.addInitParameter(StateUtils.INIT_ALGORITHM_PARAM, StateUtils.DEFAULT_ALGORITHM_PARAMS);
44          servletContext.addInitParameter(StateUtils.INIT_SECRET_KEY_CACHE, "false");
45          servletContext.addInitParameter(StateUtils.INIT_MAC_SECRET, AbstractStateUtilsTest.BASE64_KEY_SIZE_8);
46          StateUtils.initSecret(servletContext);// should do nothing
47  
48      }
49  }