//
//  ========================================================================
//  Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
//  ------------------------------------------------------------------------
//  All rights reserved. This program and the accompanying materials
//  are made available under the terms of the Eclipse Public License v1.0
//  and Apache License v2.0 which accompanies this distribution.
//
//      The Eclipse Public License is available at
//      http://www.eclipse.org/legal/epl-v10.html
//
//      The Apache License v2.0 is available at
//      http://www.opensource.org/licenses/apache2.0.php
//
//  You may elect to redistribute this code under either of these licenses.
//  ========================================================================
//

package org.eclipse.jetty.server.session;

import java.io.File;

import junit.framework.Assert;

import org.eclipse.jetty.toolchain.test.MavenTestingUtils;
import org.junit.Test;

public class HashSessionManagerTest
{

    @Test
    public void testDangerousSessionId() throws Exception
    {
        final HashSessionManager manager = new HashSessionManager();
        manager.setDeleteUnrestorableSessions(true);
        manager.setLazyLoad(true);
        File testDir = MavenTestingUtils.getTargetTestingDir("hashes");
        testDir.mkdirs();
        manager.setStoreDirectory(testDir);
        
        MavenTestingUtils.getTargetFile("dangerFile.session").createNewFile();
        
        Assert.assertTrue("File should exist!", MavenTestingUtils.getTargetFile("dangerFile.session").exists());
        
        manager.getSession("../../dangerFile.session");
        
        Assert.assertTrue("File should exist!", MavenTestingUtils.getTargetFile("dangerFile.session").exists());

    }
}

@@ -914,104 +914,649 @@
 tty.
-toolchain.test.MavenTestingUtils;%0Aimport org.junit.Test;%0A%0Apublic class HashSessionManagerTest%0A%7B%0A
+server.SessionManager;%0Aimport org.eclipse.jetty.toolchain.test.MavenTestingUtils;%0Aimport org.eclipse.jetty.util.log.Log;%0Aimport org.eclipse.jetty.util.log.StdErrLog;%0Aimport org.junit.After;%0Aimport org.junit.Before;%0Aimport org.junit.Test;%0A%0Apublic class HashSessionManagerTest%0A%7B%0A    %0A    @After%0A    public void enableStacks()%0A    %7B%0A        enableStacks(true);%0A    %7D%0A%0A    @Before%0A    public void quietStacks()%0A    %7B%0A        enableStacks(false);%0A    %7D%0A    %0A    protected void enableStacks(boolean enabled)%0A    %7B%0A        StdErrLog log = (StdErrLog)Log.getLogger(%22org.eclipse.jetty.server.session%22);%0A        log.setHideStacks(!enabled);%0A    %7D%0A    
 %0A   
@@ -1600,16 +1600,23 @@
 essionId
+Removal
 () throw
@@ -2142,24 +2142,16 @@
 sts());%0A
-        
 %0A       
@@ -2318,20 +2318,747 @@
 exists());%0A%0A
+    %7D%0A    %0A    @Test%0A    public void testValidSessionIdRemoval() throws Exception%0A    %7B%0A        final HashSessionManager manager = new HashSessionManager();%0A        manager.setDeleteUnrestorableSessions(true);%0A        manager.setLazyLoad(true);%0A        File testDir = MavenTestingUtils.getTargetTestingDir(%22hashes%22);%0A        testDir.mkdirs();%0A        manager.setStoreDirectory(testDir);%0A        %0A        new File(testDir, %22validFile.session%22).createNewFile();%0A        %0A        Assert.assertTrue(%22File should exist!%22, new File(testDir, %22validFile.session%22).exists());%0A       %0A        manager.getSession(%22validFile.session%22);%0A%0A        Assert.assertTrue(%22File shouldn't exist!%22, !new File(testDir,%22validFile.session%22).exists());%0A%0A
     %7D%0A%7D%0A

add corresponding correct file removal check