test_class.declarator: VALID_SESSION_ID = "sessionidsjdfhgskldjfsghldkfjsgg"
test_class.modifier: private static final
test_class.original_string: private static final String VALID_SESSION_ID = "sessionidsjdfhgskldjfsghldkfjsgg";
test_class.type: String
test_class.var_name: VALID_SESSION_ID
test_class.declarator: ILLEGAL_SESSION_ID = "////////////////////////////////"
test_class.modifier: private static final
test_class.original_string: private static final String ILLEGAL_SESSION_ID = "////////////////////////////////";
test_class.type: String
test_class.var_name: ILLEGAL_SESSION_ID
test_class.declarator: fileSessionStorage
test_class.modifier: private static
test_class.original_string: private static FileSessionStorage fileSessionStorage;
test_class.type: FileSessionStorage
test_class.var_name: fileSessionStorage
test_class.declarator: workingDirectory
test_class.modifier: private static
test_class.original_string: private static String workingDirectory;
test_class.type: String
test_class.var_name: workingDirectory
test_class.file: http/src/test/java/ro/polak/http/session/storage/FileSessionStorageTest.java
test_class.identifier: FileSessionStorageTest
test_case.body: @Test(expected = IOException.class)
      public void shouldThrowExceptionWhenUnableToCreateFile() throws IOException {
          String nonExistentDirectory = "/tmp/nonexistent-" + Math.random() + "/";
          assertThat(new File(nonExistentDirectory).exists(), is(false));
          SessionStorage sessionStorage = new FileSessionStorage(nonExistentDirectory);
          sessionStorage.persistSession(new HttpSessionImpl(VALID_SESSION_ID, System.currentTimeMillis()));
      }
test_case.class_method_signature: FileSessionStorageTest.shouldThrowExceptionWhenUnableToCreateFile()
test_case.full_signature: @Test(expected = IOException.class) public void shouldThrowExceptionWhenUnableToCreateFile()
test_case.identifier: shouldThrowExceptionWhenUnableToCreateFile
test_case.invocations: random assertThat exists is persistSession currentTimeMillis
test_case.modifiers: @Test(expected = IOException.class) public
test_case.parameters: ()
test_case.return: void
test_case.signature: void shouldThrowExceptionWhenUnableToCreateFile()
focal_class.declarator: LOGGER = Logger.getLogger(FileSessionStorage.class.getName())
focal_class.modifier: private static final
focal_class.original_string: private static final Logger LOGGER = Logger.getLogger(FileSessionStorage.class.getName());
focal_class.type: Logger
focal_class.var_name: LOGGER
focal_class.declarator: SESSION_FILE_SUFFIX = "_session"
focal_class.modifier: private static final
focal_class.original_string: private static final String SESSION_FILE_SUFFIX = "_session";
focal_class.type: String
focal_class.var_name: SESSION_FILE_SUFFIX
focal_class.declarator: SESSION_ID_PATTERN = Pattern.compile("[a-z]+")
focal_class.modifier: private static final
focal_class.original_string: private static final Pattern SESSION_ID_PATTERN = Pattern.compile("[a-z]+");
focal_class.type: Pattern
focal_class.var_name: SESSION_ID_PATTERN
focal_class.declarator: SESSION_ID_EXPECTED_LENGTH = 32
focal_class.modifier: private static final
focal_class.original_string: private static final int SESSION_ID_EXPECTED_LENGTH = 32;
focal_class.type: int
focal_class.var_name: SESSION_ID_EXPECTED_LENGTH
focal_class.declarator: tempPath
focal_class.modifier: private final
focal_class.original_string: private final String tempPath;
focal_class.type: String
focal_class.var_name: tempPath
focal_class.file: http/src/main/java/ro/polak/http/session/storage/FileSessionStorage.java
focal_class.identifier: FileSessionStorage
focal_class.interfaces: implements SessionStorage
focal_class.class_method_signature: FileSessionStorage.FileSessionStorage(final String tempPath)
focal_class.full_signature: public  FileSessionStorage(final String tempPath)
focal_class.identifier: FileSessionStorage
focal_class.modifiers: public
focal_class.parameters: (final String tempPath)
focal_class.signature:  FileSessionStorage(final String tempPath)
focal_class.class_method_signature: FileSessionStorage.persistSession(final HttpSessionImpl session)
focal_class.full_signature: @Override public void persistSession(final HttpSessionImpl session)
focal_class.identifier: persistSession
focal_class.modifiers: @Override public
focal_class.parameters: (final HttpSessionImpl session)
focal_class.return: void
focal_class.signature: void persistSession(final HttpSessionImpl session)
focal_class.class_method_signature: FileSessionStorage.getSession(final String id)
focal_class.full_signature: @Override public HttpSessionImpl getSession(final String id)
focal_class.identifier: getSession
focal_class.modifiers: @Override public
focal_class.parameters: (final String id)
focal_class.return: HttpSessionImpl
focal_class.signature: HttpSessionImpl getSession(final String id)
focal_class.class_method_signature: FileSessionStorage.isSessionIdValid(final String id)
focal_class.full_signature: private boolean isSessionIdValid(final String id)
focal_class.identifier: isSessionIdValid
focal_class.modifiers: private
focal_class.parameters: (final String id)
focal_class.return: boolean
focal_class.signature: boolean isSessionIdValid(final String id)
focal_class.class_method_signature: FileSessionStorage.removeSession(final HttpSessionImpl session)
focal_class.full_signature: @Override public boolean removeSession(final HttpSessionImpl session)
focal_class.identifier: removeSession
focal_class.modifiers: @Override public
focal_class.parameters: (final HttpSessionImpl session)
focal_class.return: boolean
focal_class.signature: boolean removeSession(final HttpSessionImpl session)
focal_class.class_method_signature: FileSessionStorage.readSession(final String id, final File file)
focal_class.full_signature: private HttpSessionImpl readSession(final String id, final File file)
focal_class.identifier: readSession
focal_class.modifiers: private
focal_class.parameters: (final String id, final File file)
focal_class.return: HttpSessionImpl
focal_class.signature: HttpSessionImpl readSession(final String id, final File file)
focal_class.class_method_signature: FileSessionStorage.writeSession(final HttpSessionImpl session, final File file)
focal_class.full_signature: private void writeSession(final HttpSessionImpl session, final File file)
focal_class.identifier: writeSession
focal_class.modifiers: private
focal_class.parameters: (final HttpSessionImpl session, final File file)
focal_class.return: void
focal_class.signature: void writeSession(final HttpSessionImpl session, final File file)
focal_class.class_method_signature: FileSessionStorage.getSessionStoragePath(final String id)
focal_class.full_signature: private String getSessionStoragePath(final String id)
focal_class.identifier: getSessionStoragePath
focal_class.modifiers: private
focal_class.parameters: (final String id)
focal_class.return: String
focal_class.signature: String getSessionStoragePath(final String id)
focal_method.body: @Override
      public void persistSession(final HttpSessionImpl session) throws IOException {
          if (!isSessionIdValid(session.getId())) {
              throw new IllegalArgumentException("Session ID can not be empty and must be composed of 32 characters");
          }
  
          File file = new File(getSessionStoragePath(session.getId()));
          if (!file.exists() && !file.createNewFile()) {
              throw new IOException("Unable to create new file " + file.getAbsolutePath());
          }
          writeSession(session, file);
  
          LOGGER.log(Level.FINE, "Persisted session {0} in {1}",
                  new Object[]{session.getId(), tempPath});
      }
focal_method.class_method_signature: FileSessionStorage.persistSession(final HttpSessionImpl session)
focal_method.full_signature: @Override public void persistSession(final HttpSessionImpl session)
focal_method.identifier: persistSession
focal_method.invocations: isSessionIdValid getId getSessionStoragePath getId exists createNewFile getAbsolutePath writeSession log getId
focal_method.modifiers: @Override public
focal_method.parameters: (final HttpSessionImpl session)
focal_method.return: void
focal_method.signature: void persistSession(final HttpSessionImpl session)