This repository has been archived by the owner on Feb 7, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
More fixes to support Tomcat 8. This release drops support for Tomcat 7.
- Loading branch information
Showing
6 changed files
with
89 additions
and
109 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
...a/com/amazonaws/services/dynamodb/sessionmanager/DynamoDBSessionStoreIntegrationTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/* | ||
* Copyright 2011-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"). | ||
* You may not use this file except in compliance with the License. | ||
* A copy of the License is located at | ||
* | ||
* http://aws.amazon.com/apache2.0 | ||
* | ||
* or in the "license" file accompanying this file. This file is distributed | ||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either | ||
* express or implied. See the License for the specific language governing | ||
* permissions and limitations under the License. | ||
*/ | ||
package com.amazonaws.services.dynamodb.sessionmanager; | ||
|
||
import com.amazonaws.services.dynamodb.sessionmanager.converters.SessionConversionException; | ||
|
||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
import org.mockito.Mock; | ||
import org.mockito.runners.MockitoJUnitRunner; | ||
|
||
import static org.junit.Assert.assertNull; | ||
import static org.mockito.Mockito.never; | ||
import static org.mockito.Mockito.times; | ||
import static org.mockito.Mockito.verify; | ||
import static org.mockito.Mockito.when; | ||
|
||
@RunWith(MockitoJUnitRunner.class) | ||
public class DynamoDBSessionStoreIntegrationTest { | ||
|
||
private static final String SESSION_ID = "1234"; | ||
|
||
@Mock | ||
private DynamoSessionStorage storage; | ||
|
||
@Test | ||
public void loadCorruptSession_DeletesSessionWhenDeleteCorruptSessionsEnabled() throws | ||
Exception { | ||
stubLoadCorruptSession(); | ||
final DynamoDBSessionStore sessionStore = new DynamoDBSessionStore(storage, true); | ||
assertNull(sessionStore.load(SESSION_ID)); | ||
verify(storage, times(1)).deleteSession(SESSION_ID); | ||
} | ||
|
||
@Test | ||
public void loadCorruptSession_DoesNotDeletesSessionWhenDeleteCorruptSessionsDisabled() throws | ||
Exception { | ||
stubLoadCorruptSession(); | ||
final DynamoDBSessionStore sessionStore = new DynamoDBSessionStore(storage, false); | ||
assertNull(sessionStore.load(SESSION_ID)); | ||
verify(storage, never()).deleteSession(SESSION_ID); | ||
} | ||
|
||
private void stubLoadCorruptSession() { | ||
when(storage.loadSession(SESSION_ID)) | ||
.thenThrow(new SessionConversionException("Unable to convert session")); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters